Commit f6a0d9d5 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'staging-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging tree fixes from Greg KH:
 "Here are a few iio driver fixes for 3.11-rc2.  They are still spread
  across drivers/iio and drivers/staging/iio so they are coming in
  through this tree.

  I've also removed the drivers/staging/csr/ driver as the developers
  who originally sent it to me have moved on to other companies, and CSR
  still will not send us the specs for the device, making the driver
  pretty much obsolete and impossible to fix up.  Deleting it now
  prevents people from sending in lots of tiny codingsyle fixes that
  will never go anywhere.

  It also helps to offset the large lustre filesystem merge that
  happened in 3.11-rc1 in the overall 3.11.0 diffstat.  :)"

* tag 'staging-3.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: csr: remove driver
  iio: lps331ap: Fix wrong in_pressure_scale output value
  iio staging: fix lis3l02dq, read error handling
  staging:iio:ad7291: add missing .driver_module to struct iio_info
  iio: ti_am335x_adc: add missing .driver_module to struct iio_info
  iio: mxs-lradc: Remove useless check in read_raw
  iio: mxs-lradc: Fix misuse of iio->trig
  iio: inkern: fix iio_convert_raw_to_processed_unlocked
  iio: Fix iio_channel_has_info
  iio:trigger: device_unregister->device_del to avoid double free
  iio: dac: ad7303: fix error return code in ad7303_probe()
parents 36231d25 78077256
......@@ -183,6 +183,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
static const struct iio_info tiadc_info = {
.read_raw = &tiadc_read_raw,
.driver_module = THIS_MODULE,
};
static int tiadc_probe(struct platform_device *pdev)
......
......@@ -235,8 +235,10 @@ static int ad7303_probe(struct spi_device *spi)
if (ext_ref) {
st->vref_reg = regulator_get(&spi->dev, "REF");
if (IS_ERR(st->vref_reg))
if (IS_ERR(st->vref_reg)) {
ret = PTR_ERR(st->vref_reg);
goto err_disable_vdd_reg;
}
ret = regulator_enable(st->vref_reg);
if (ret)
......
......@@ -104,7 +104,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info)
ida_simple_remove(&iio_trigger_ida, trig_info->id);
/* Possible issue in here */
device_unregister(&trig_info->dev);
device_del(&trig_info->dev);
}
EXPORT_SYMBOL(iio_trigger_unregister);
......
......@@ -451,7 +451,7 @@ static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
int ret;
ret = iio_channel_read(chan, &offset, NULL, IIO_CHAN_INFO_OFFSET);
if (ret == 0)
if (ret >= 0)
raw64 += offset;
scale_type = iio_channel_read(chan, &scale_val, &scale_val2,
......
......@@ -28,7 +28,9 @@
#include <linux/iio/common/st_sensors.h>
#include "st_pressure.h"
#define ST_PRESS_MBAR_TO_KPASCAL(x) (x * 10)
#define ST_PRESS_LSB_PER_MBAR 4096UL
#define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \
ST_PRESS_LSB_PER_MBAR)
#define ST_PRESS_NUMBER_DATA_CHANNELS 1
/* DEFAULT VALUE FOR SENSORS */
......@@ -51,8 +53,8 @@
#define ST_PRESS_1_FS_ADDR 0x23
#define ST_PRESS_1_FS_MASK 0x30
#define ST_PRESS_1_FS_AVL_1260_VAL 0x00
#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_MBAR_TO_KPASCAL(244141)
#define ST_PRESS_1_FS_AVL_TEMP_GAIN 2083000
#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE
#define ST_PRESS_1_BDU_ADDR 0x20
#define ST_PRESS_1_BDU_MASK 0x04
#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22
......
......@@ -118,8 +118,6 @@ source "drivers/staging/ozwpan/Kconfig"
source "drivers/staging/gdm72xx/Kconfig"
source "drivers/staging/csr/Kconfig"
source "drivers/staging/silicom/Kconfig"
source "drivers/staging/ced1401/Kconfig"
......
......@@ -52,7 +52,6 @@ obj-$(CONFIG_MFD_NVEC) += nvec/
obj-$(CONFIG_ANDROID) += android/
obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
obj-$(CONFIG_WIMAX_GDM72XX) += gdm72xx/
obj-$(CONFIG_CSR_WIFI) += csr/
obj-$(CONFIG_NET_VENDOR_SILICOM) += silicom/
obj-$(CONFIG_CED1401) += ced1401/
obj-$(CONFIG_DRM_IMX) += imx-drm/
......
config CSR_WIFI
tristate "CSR wireless driver"
depends on MMC && CFG80211_WEXT && INET
select WIRELESS_EXT
select WEXT_PRIV
help
Driver for the CSR wireless SDIO device.
If unsure, select N.
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.
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
csr_wifi-y := bh.o \
data_tx.o \
drv.o \
firmware.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_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_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 \
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 \
sme_wext.o \
wext_events.o
csr_helper-y := csr_time.o \
csr_util.o \
csr_framework_ext.o \
csr_wifi_serialize_primitive_types.o \
csr_serialize_primitive_types.o \
csr_msgconv.o
This diff is collapsed.
/*****************************************************************************
(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 <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/freezer.h>
#include <linux/semaphore.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include "csr_framework_ext.h"
/*----------------------------------------------------------------------------*
* NAME
* CsrThreadSleep
*
* DESCRIPTION
* Sleep for a given period.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrThreadSleep(u16 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);
#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_result.h"
#include "csr_framework_ext_types.h"
/* 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 ((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 ((u16) 0xFFFF)
void CsrThreadSleep(u16 sleepTimeInMs);
#endif
#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.
*****************************************************************************/
#ifdef __KERNEL__
#include <linux/kthread.h>
#include <linux/semaphore.h>
#else
#include <pthread.h>
#endif
#ifdef __KERNEL__
typedef struct semaphore CsrMutexHandle;
#else /* __KERNEL __ */
typedef pthread_mutex_t CsrMutexHandle;
#endif /* __KERNEL__ */
#endif
This diff is collapsed.
#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_log.h"
/*--------------------------------------------*/
/* Filtering on log text warning levels */
/*--------------------------------------------*/
typedef u32 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 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
* 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 u32 CsrLogTextTaskId;
#endif
#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_log_configure.h"
typedef struct CsrLogSubOrigin
{
u16 subOriginNumber; /* Id of the given 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 char *taskName, u16 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, u16 subOrigin, 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
#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, u16 subOrigin, 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
#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, u16 subOrigin, 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
#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, u16 subOrigin, 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
#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, u16 subOrigin, 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
#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
#endif
#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 <linux/types.h>
#define FALSE (0)
#define TRUE (1)
/*------------------------------------------------------------------*/
/* 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) (((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)); \
((u8 *) (ptr))[1] = ((u8) (((uint) >> 8) & 0x000000FF)); \
((u8 *) (ptr))[2] = ((u8) (((uint) >> 16) & 0x000000FF)); \
((u8 *) (ptr))[3] = ((u8) (((uint) >> 24) & 0x000000FF))
/*------------------------------------------------------------------*/
/* Misc */
/*------------------------------------------------------------------*/
/* 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))
#endif
#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.
*****************************************************************************/
#ifndef CsrMsgTransport
#define CsrMsgTransport CsrSchedMessagePut
#endif
#endif /* CSR_MSG_TRANSPORT */
/*****************************************************************************
(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 <linux/module.h>
#include <linux/types.h>
#include <linux/slab.h>
#include "csr_sched.h"
#include "csr_msgconv.h"
#include "csr_macro.h"
static CsrMsgConvEntry *converter;
CsrMsgConvPrimEntry *CsrMsgConvFind(u16 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, u16 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(u16 primType,
size_t length,
u8 *data)
{
CsrMsgConvPrimEntry *ptr;
u8 *ret;
ptr = CsrMsgConvFind(primType);
if (ptr)
{
const CsrMsgConvMsgEntry *cv;
u16 msgId = 0;
size_t 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 size_t sizeof_message(u16 primType, void *msg)
{
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
size_t ret;
if (ptr)
{
const CsrMsgConvMsgEntry *cv;
u16 msgId = *(u16 *) msg;
cv = find_msg_converter(ptr, msgId);
if (cv)
{
ret = cv->sizeofFunc(msg);
}
else
{
ret = 0;
}
}
else
{
ret = 0;
}
return ret;
}
static u8 free_message(u16 primType, u8 *data)
{
CsrMsgConvPrimEntry *ptr;
u8 ret;
ptr = CsrMsgConvFind(primType);
if (ptr)
{
const CsrMsgConvMsgEntry *cv;
u16 msgId = *(u16 *) data;
cv = find_msg_converter(ptr, msgId);
if (cv)
{
cv->freeFunc(data);
ret = TRUE;
}
else
{
ret = FALSE;
}
}
else
{
ret = FALSE;
}
return ret;
}
static u8 *serialize_message(u16 primType,
void *msg,
size_t *length,
u8 *buffer)
{
CsrMsgConvPrimEntry *ptr;
u8 *ret;
ptr = CsrMsgConvFind(primType);
*length = 0;
if (ptr)
{
const CsrMsgConvMsgEntry *cv;
cv = find_msg_converter(ptr, *(u16 *) msg);
if (cv)
{
ret = cv->serFunc(buffer, length, msg);
}
else
{
ret = NULL;
}
}
else
{
ret = NULL;
}
return ret;
}
size_t CsrMsgConvSizeof(u16 primType, void *msg)
{
return sizeof_message(primType, msg);
}
u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg)
{
if (converter)
{
size_t serializedLength;
u8 *bufSerialized;
u8 *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(u16 primType, const CsrMsgConvMsgEntry *ce)
{
CsrMsgConvPrimEntry *pc;
pc = CsrMsgConvFind(primType);
if (pc)
{
/* Already registered. Do nothing */
}
else
{
pc = kmalloc(sizeof(*pc), GFP_KERNEL);
pc->primType = primType;
pc->conv = ce;
pc->lookupFunc = NULL;
pc->next = converter->profile_converters;
converter->profile_converters = pc;
}
}
EXPORT_SYMBOL_GPL(CsrMsgConvInsert);
CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType)
{
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
if (ptr)
{
return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
}
return NULL;
}
EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry);
CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg)
{
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
if (ptr && msg)
{
u16 msgType = *((u16 *) msg);
return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
}
return NULL;
}
void CsrMsgConvCustomLookupRegister(u16 primType, CsrMsgCustomLookupFunc *lookupFunc)
{
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
if (ptr)
{
ptr->lookupFunc = lookupFunc;
}
}
EXPORT_SYMBOL_GPL(CsrMsgConvCustomLookupRegister);
CsrMsgConvEntry *CsrMsgConvInit(void)
{
if (!converter)
{
converter = kmalloc(sizeof(CsrMsgConvEntry), GFP_KERNEL);
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);
#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 <linux/types.h>
#include "csr_prim_defs.h"
#include "csr_sched.h"
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, size_t length);
/* Converter entry for one message type */
typedef struct CsrMsgConvMsgEntry
{
u16 msgType;
CsrMsgSizeofFunc *sizeofFunc;
CsrMsgSerializeFunc *serFunc;
CsrMsgDeserializeFunc *deserFunc;
CsrMsgFreeFunc *freeFunc;
} CsrMsgConvMsgEntry;
/* Optional lookup function */
typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, u16 msgType);
/* All converter entries for one specific primitive */
typedef struct CsrMsgConvPrimEntry
{
u16 primType;
const CsrMsgConvMsgEntry *conv;
CsrMsgCustomLookupFunc *lookupFunc;
struct CsrMsgConvPrimEntry *next;
} CsrMsgConvPrimEntry;
typedef struct
{
CsrMsgConvPrimEntry *profile_converters;
void *(*deserialize_data)(u16 primType, size_t length, u8 * data);
u8 (*free_message)(u16 primType, u8 *data);
size_t (*sizeof_message)(u16 primType, void *msg);
u8 *(*serialize_message)(u16 primType, void *msg,
size_t * length,
u8 * buffer);
} CsrMsgConvEntry;
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);
CsrMsgConvMsgEntry *CsrMsgConvFindEntry(u16 primType, u16 msgType);
CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(u16 primType, const void *msg);
CsrMsgConvEntry *CsrMsgConvInit(void);
/* Prototypes for primitive type serializers */
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 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);
#endif
#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.
*****************************************************************************/
/************************************************************************************
* Segmentation of primitives in upstream and downstream segment
************************************************************************************/
typedef u16 CsrPrim;
#define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000))
/************************************************************************************
* Primitive definitions for Synergy framework
************************************************************************************/
#define CSR_SYNERGY_EVENT_CLASS_BASE ((u16) (0x0600))
#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 ((u16) (0x06A0))
#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 ((u16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
#endif /* CSR_PRIM_DEFS_H__ */
#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.
*****************************************************************************/
typedef u16 CsrResult;
#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000)
#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF)
#endif
#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 <linux/types.h>
#include "csr_time.h"
/* An identifier issued by the scheduler. */
typedef u32 CsrSchedIdentifier;
/* A task identifier */
typedef u16 CsrSchedTaskId;
/* A queue identifier */
typedef u16 CsrSchedQid;
/* A message identifier */
typedef CsrSchedIdentifier CsrSchedMsgId;
/* A timer event identifier */
typedef CsrSchedIdentifier CsrSchedTid;
#define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0)
/* Time constants. */
#define CSR_SCHED_TIME_MAX (0xFFFFFFFF)
#define CSR_SCHED_MILLISECOND (1000)
#define CSR_SCHED_SECOND (1000 * CSR_SCHED_MILLISECOND)
#define CSR_SCHED_MINUTE (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 u16 CsrSchedBgint;
#define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF)
/*----------------------------------------------------------------------------*
* 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 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 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.
*
* RETURNS
* void.
*
*----------------------------------------------------------------------------*/
#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
void CsrSchedMessagePutStringLog(CsrSchedQid q,
u16 mi,
void *mv,
u32 line,
const char *file);
#define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__)
#else
void CsrSchedMessagePut(CsrSchedQid q,
u16 mi,
void *mv);
#endif
#endif
This diff is collapsed.
/*****************************************************************************
(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 <linux/module.h>
#include <linux/slab.h>
#include "csr_prim_defs.h"
#include "csr_msgconv.h"
#include "csr_macro.h"
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, size_t *offset)
{
*value = (buffer[*offset + 0] << 0) |
(buffer[*offset + 1] << 8);
*offset += sizeof(*value);
}
EXPORT_SYMBOL_GPL(CsrUint16Des);
void CsrUint32Des(u32 *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);
}
EXPORT_SYMBOL_GPL(CsrUint32Des);
void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length)
{
memcpy(value, &buffer[*offset], length);
*offset += length;
}
EXPORT_SYMBOL_GPL(CsrMemCpyDes);
void CsrCharStringDes(char **value, u8 *buffer, size_t *offset)
{
*value = kstrdup((char *) &buffer[*offset], GFP_KERNEL);
*offset += strlen(*value) + 1;
}
EXPORT_SYMBOL_GPL(CsrCharStringDes);
void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value)
{
buffer[*offset] = value;
*offset += sizeof(value);
}
EXPORT_SYMBOL_GPL(CsrUint8Ser);
void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value)
{
buffer[*offset + 0] = (u8) ((value >> 0) & 0xFF);
buffer[*offset + 1] = (u8) ((value >> 8) & 0xFF);
*offset += sizeof(value);
}
EXPORT_SYMBOL_GPL(CsrUint16Ser);
void CsrUint32Ser(u8 *buffer, size_t *offset, u32 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);
}
EXPORT_SYMBOL_GPL(CsrUint32Ser);
void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length)
{
memcpy(&buffer[*offset], value, length);
*offset += length;
}
EXPORT_SYMBOL_GPL(CsrMemCpySer);
void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value)
{
if (value)
{
strcpy(((char *) &buffer[*offset]), value);
*offset += strlen(value) + 1;
}
else
{
CsrUint8Ser(buffer, offset, 0);
}
}
EXPORT_SYMBOL_GPL(CsrCharStringSer);
/*****************************************************************************
(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 <linux/kernel.h>
#include <linux/time.h>
#include <linux/module.h>
#include "csr_time.h"
u32 CsrTimeGet(u32 *high)
{
struct timespec ts;
u64 time;
u32 low;
ts = current_kernel_time();
time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
if (high != NULL)
*high = (u32) ((time >> 32) & 0xFFFFFFFF);
low = (u32) (time & 0xFFFFFFFF);
return low;
}
EXPORT_SYMBOL_GPL(CsrTimeGet);
#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 <linux/types.h>
/*******************************************************************************
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.
*******************************************************************************/
u32 CsrTimeGet(u32 *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) ((s32) (t1) - (s32) (t2))
#endif
/*****************************************************************************
(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 <linux/module.h>
MODULE_DESCRIPTION("CSR Operating System Kernel Abstraction");
MODULE_AUTHOR("Cambridge Silicon Radio Ltd.");
MODULE_LICENSE("GPL and additional rights");
/*****************************************************************************
(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 <linux/types.h>
#include "csr_result.h"
/* MAC address */
typedef struct
{
u8 a[6];
} CsrWifiMacAddress;
/* IPv4 address */
typedef struct
{
u8 a[4];
} CsrWifiIp4Address;
/* IPv6 address */
typedef struct
{
u8 a[16];
} CsrWifiIp6Address;
typedef struct
{
u8 ssid[32];
u8 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.1.0.0"
#endif
/*****************************************************************************
(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
#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, u16 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 function 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 function 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
* u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
*/
extern u32 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, u16 source, u16 destination, CsrPrim primtype, u16 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 = kmalloc(sizeof(CsrWifiFsmAlienEvent), GFP_KERNEL); \
_evt->alienEvent = _alienEvent; \
CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \
}
/**
* @brief
* Current time of day in ms
*
* @param[in] context : FSM context
*
* @return
* u32 32 bit ms tick
*/
extern u32 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
* u32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
*/
extern u32 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, u16 ms);
/**
* @brief
* shift the current time of day by ms amount
*
* @par Description
* useful 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, u32 ms);
/**
* @brief
* Check if the fsm has events to process
*
* @param[in] context : FSM context
*
* @return
* u8 returns TRUE if there are events for the FSM to process
*/
extern u8 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);
#endif /* CSR_WIFI_FSM_H */
/*****************************************************************************
(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
#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;
u16 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;
#endif /* CSR_WIFI_FSM_EVENT_H */
This diff is collapsed.
/*****************************************************************************
(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.
*****************************************************************************/
/*
******************************************************************************
* 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__
#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, u8 *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, u8 *enabled);
/*****************************************************************************
* CardGetDataSlotSize
*/
u16 CardGetDataSlotSize(card_t *card);
/*****************************************************************************
* CardWriteBulkData -
*/
CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue);
/*****************************************************************************
* CardClearFromHostDataSlot -
*/
void CardClearFromHostDataSlot(card_t *card, const s16 aSlotNum);
#ifdef CSR_WIFI_REQUEUE_PACKET_TO_HAL
/*****************************************************************************
* CardClearFromHostDataSlotWithoutFreeingBulkData - Clear the data stot
* without freeing the bulk data
*/
void CardClearFromHostDataSlotWithoutFreeingBulkData(card_t *card, const s16 aSlotNum);
#endif
/*****************************************************************************
* CardGetFreeFromHostDataSlots -
*/
u16 CardGetFreeFromHostDataSlots(card_t *card);
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, u32 *paddr);
CsrResult unifi_dl_firmware(card_t *card, void *arg);
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);
CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult);
#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
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
#endif /* __CARD_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
(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"
/* 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
{
u32 len;
const struct chip_helper_init_values *vals;
};
/* Just a (counted) u16 array */
struct data_array_t
{
u32 len;
const u16 *vals;
};
struct reset_prog_t
{
u32 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
{
u16 spi, host;
};
struct map_array_t
{
u32 len;
const struct chip_map_address_t *vals;
};
struct chip_device_regs_per_transport_t
{
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
{
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;
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
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
{
s32 allowed;
u32 page_shift;
u16 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
{
u16 address;
u16 size;
u16 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
{
s32 pre_bc7;
u16 mask;
u16 result;
u8 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 char *friendly_name;
/* This is what we show to customers */
const char *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
{
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
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
{
u32 ram;
u32 rom;
u32 flash;
u32 ext_sram;
} prog_offset;
/* The offsets into the data address space of interesting things. */
struct
{
u16 ram;
/* maybe add shared / page tables? */
} data_offset;
/* Information on the different windows */
const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT];
};
#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */
/*****************************************************************************
(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__
#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))
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);
#endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
(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__
#include "csr_wifi_hip_unifi.h"
typedef struct ta_l4stats
{
u32 rxTcpBytesCount;
u32 txTcpBytesCount;
u32 rxUdpBytesCount;
u32 txUdpBytesCount;
} ta_l4stats_t;
/*
* Context structure to preserve state between calls.
*/
typedef struct ta_data
{
/* Current packet filter configuration */
u16 packet_filter;
/* Current packet custom filter configuration */
CsrWifiRouterCtrlTrafficFilter custom_filter;
/* The timestamp of the last tx packet processed. */
u32 tx_last_ts;
/* The timestamp of the last packet processed. */
u32 last_indication_time;
/* Statistics */
CsrWifiRouterCtrlTrafficStats stats;
/* Current traffic classification */
CsrWifiRouterCtrlTrafficType traffic_type;
/* Sum of packet rx rates for this interval used to calculate mean */
u32 rx_sum_rate;
ta_l4stats_t ta_l4stats;
} ta_data_t;
void unifi_ta_sampling_init(card_t *card);
#endif /* __TA_SAMPLING_H__ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
(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
#define CSR_WIFI_HOSTIO_PRIM 0x0453
#endif /* CSR_WIFI_HOSTIO_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment