提交 ade7615d 编写于 作者: G Greg Kroah-Hartman

staging: csr: remove driver

This driver is not being updated as the specifications are not able to
be gotten from CSR or anyone else.  Without those, getting this driver
into proper mergable shape is going to be impossible.  So remove the
driver from the tree.

If the specifications ever become available, this patch can be reverted
and the driver fixed up properly.
Reported-by: NLidza Louina <lidza.louina@gmail.com>
Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
Cc: Riku Mettälä <riku.mettala@bluegiga.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ad81f054
......@@ -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
/*
* ---------------------------------------------------------------------------
* 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"
#include <linux/sched/rt.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, &param);
} 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)
{
netInterface_priv_t *interfacePriv;
u8 conf_param = CONFIG_IND_ERROR;
u8 interfaceTag;
/* 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 < CSR_WIFI_NUM_INTERFACES; interfaceTag++) {
interfacePriv = priv->interfacePriv[interfaceTag];
if (interfacePriv->netdev_registered)
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;
u32 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 occurred, 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() */
/*****************************************************************************
(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
#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_sched.h"
#include "csr_prim_defs.h"
#include "csr_msgconv.h"
/*
* Log filtering
*/
/*----------------------------------------------------*/
/* Filtering on environment specific log levels */
/*----------------------------------------------------*/
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 */
#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 occurred 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 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 occurred 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 occurred 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 */
u8 CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level);
CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId);
u8 CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level);
/*
* Logging stuff
*/
#define CSR_LOG_STRINGIFY_REAL(a) (#a)
#define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a)
typedef struct {
u16 primitiveType;
const char *primitiveName;
CsrMsgConvMsgEntry *messageConv; /* Private - do not use */
} CsrLogPrimitiveInformation;
typedef struct {
const char *techVer;
u32 primitiveInfoCount;
CsrLogPrimitiveInformation *primitiveInfo;
} CsrLogTechInformation;
/*---------------------------------*/
/* Tech logging */
/*---------------------------------*/
typedef u8 bitmask8_t;
typedef u16 bitmask16_t;
typedef u32 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 char *text,
u32 line,
const char *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,
u32 identifier,
const char *fsm_name,
u32 prev_state,
const char *prev_state_str,
u32 in_event,
const char *in_event_str,
u32 next_state,
const char *next_state_str,
u32 line,
const char *file);
/*---------------------------------*/
/* BSP logging */
/*---------------------------------*/
void CsrLogSchedInit(u8 thread_id);
void CsrLogSchedDeinit(u8 thread_id);
void CsrLogSchedStart(u8 thread_id);
void CsrLogSchedStop(u8 thread_id);
void CsrLogInitTask(u8 thread_id, CsrSchedQid tskid, const char *tskName);
void CsrLogDeinitTask(u16 task_id);
void CsrLogActivate(CsrSchedQid tskid);
void CsrLogDeactivate(CsrSchedQid tskid);
#define SYNERGY_SERIALIZER_TYPE_DUMP (0x000)
#define SYNERGY_SERIALIZER_TYPE_SER (0x001)
void CsrLogMessagePut(u32 line,
const char *file,
CsrSchedQid src_task_id,
CsrSchedQid dst_taskid,
CsrSchedMsgId msg_id,
u16 prim_type,
const void *msg);
void CsrLogMessageGet(CsrSchedQid src_task_id,
CsrSchedQid dst_taskid,
u8 get_res,
CsrSchedMsgId msg_id,
u16 prim_type,
const void *msg);
void CsrLogTimedEventIn(u32 line,
const char *file,
CsrSchedQid task_id,
CsrSchedTid tid,
u32 requested_delay,
u16 fniarg,
const void *fnvarg);
void CsrLogTimedEventFire(CsrSchedQid task_id,
CsrSchedTid tid);
void CsrLogTimedEventDone(CsrSchedQid task_id,
CsrSchedTid tid);
void CsrLogTimedEventCancel(u32 line,
const char *file,
CsrSchedQid task_id,
CsrSchedTid tid,
u8 cancel_res);
void CsrLogBgintRegister(u8 thread_id,
CsrSchedBgint irq,
const char *callback,
const void *ptr);
void CsrLogBgintUnregister(CsrSchedBgint irq);
void CsrLogBgintSet(CsrSchedBgint irq);
void CsrLogBgintServiceStart(CsrSchedBgint irq);
void CsrLogBgintServiceDone(CsrSchedBgint irq);
void CsrLogExceptionStateEvent(u16 prim_type,
CsrPrim msg_type,
u16 state,
u32 line,
const char *file);
void CsrLogExceptionGeneral(u16 prim_type,
u16 state,
const char *text,
u32 line,
const char *file);
void CsrLogExceptionWarning(u16 prim_type,
u16 state,
const char *text,
u32 line,
const char *file);
#endif
#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
此差异已折叠。
/*****************************************************************************
(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 */
/*****************************************************************************
(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
#include <linux/types.h>
#include "csr_macro.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;
u16 primtype;
CsrSchedQid destination;
u16 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;
u16 primtype;
CsrSchedQid destination;
CsrSchedQid source;
/* Private pointer to allow an optimal Event list */
struct CsrWifiFsmTimer *next;
CsrWifiFsmTimerId timerid;
u32 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;
u16 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
* u16 a valid destination OR CSR_WIFI_FSM_ENV
*/
typedef u16 (*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
{
u32 eventid;
CsrWifiFsmTransitionFnPtr transition;
#ifdef CSR_LOG_ENABLE
const char *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 u8 numEntries;
const u8 saveAll;
const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */
#ifdef CSR_LOG_ENABLE
u16 stateNumber;
const char *stateName;
#endif
} CsrWifiFsmTableEntry;
/**
* @brief
* Process State Transtion table
*
* @par Description
* Stores Data for a processes State to transition table
*/
typedef struct
{
u16 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 char *processName;
const u32 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
{
u16 transitionNumber;
CsrWifiFsmEvent event;
u16 fromState;
u16 toState;
CsrWifiFsmTransitionFnPtr transitionFn;
u16 transitionCount; /* number consecutive of times this transition was seen */
#ifdef CSR_LOG_ENABLE
const char *transitionName;
#endif
} CsrWifiFsmTransitionRecord;
/**
* @brief
* Storage for the last state X transitions
*/
typedef struct
{
u16 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 */
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 */
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, u16 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
u32 timeOffset; /* Amount to adjust the TimeOfDayMs by */
CsrWifiFsmTimerList timerQueue; /* The internal timer queue */
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 */
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 */
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 */
u32 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
u16 masterTransitionNumber; /* Increments on every transition */
#endif
};
#endif /* CSR_WIFI_FSM_TYPES_H */
/*****************************************************************************
(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__ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*****************************************************************************
(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 */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册