Staging: add CSR wifi module
This consists of two modules, the driver, and a "helper" module that is just a wrapper around common kernel functions. The wrapper module will be removed soon, but for now it's needed. These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package provided by CSR and Blue Giga, and is covered under the license specified in the LICENSE.txt file (basically dual BSD and GPLv2). The files were flattened out of the deep directory mess they were originally in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to link properly with the helper module setup. Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
15a4bc17b7
commit
635d2b00e5
175 changed files with 98765 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
config CSR_WIFI
|
||||
tristate "CSR wireless driver"
|
||||
depends on PCI
|
||||
depends on PCI && MMC
|
||||
help
|
||||
Driver for the CSR wireless SDIO device.
|
||||
|
||||
|
|
39
drivers/staging/csr/LICENSE.txt
Normal file
39
drivers/staging/csr/LICENSE.txt
Normal file
|
@ -0,0 +1,39 @@
|
|||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
Except as contained in this notice, the names of above-listed
|
||||
copyright holders and the names of any contributors shall not be used
|
||||
in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
Alternatively, this software may be distributed under the terms of the
|
||||
GNU General Public License ("GPL") version 2 as published
|
||||
by the Free Software Foundation.
|
||||
|
||||
As a special exception, if other files instantiate templates or use
|
||||
macros or inline functions from this file, or you compile this file
|
||||
and link it with other works to produce a work based on this file,
|
||||
this file does not by itself cause the resulting work to be covered by
|
||||
the GNU General Public License. However the source code for this file
|
||||
must still be made available in accordance with section (3) of the GNU
|
||||
General Public License.
|
||||
|
||||
This exception does not invalidate any other reasons why a work based
|
||||
on this file might be covered by the GNU General Public License.
|
|
@ -1 +1,71 @@
|
|||
obj-$(CONFIG_CSR_WIFI) += oska/
|
||||
|
||||
ccflags-y := -DCSR_SME_USERSPACE -DCSR_SUPPORT_SME -DREMOTE_SYS_SAP -DCSR_WIFI_SECURITY_WAPI_ENABLE -DENABLE_SHUTDOWN
|
||||
|
||||
obj-$(CONFIG_CSR_WIFI) += csr_wifi.o
|
||||
obj-$(CONFIG_CSR_WIFI) += csr_helper.o
|
||||
|
||||
csr_wifi-y := bh.o \
|
||||
data_tx.o \
|
||||
drv.o \
|
||||
firmware.o \
|
||||
indications.o \
|
||||
inet.o \
|
||||
init_hw.o \
|
||||
io.o \
|
||||
monitor.o \
|
||||
netdev.o \
|
||||
os.o \
|
||||
putest.o \
|
||||
sdio_events.o \
|
||||
sdio_mmc.o \
|
||||
sdio_stubs.o \
|
||||
sme_blocking.o \
|
||||
ul_int.o \
|
||||
unifi_dbg.o \
|
||||
unifi_event.o \
|
||||
unifi_pdu_processing.o \
|
||||
unifi_sme.o \
|
||||
csr_formatted_io.o \
|
||||
csr_wifi_hip_card_sdio.o \
|
||||
csr_wifi_hip_card_sdio_intr.o \
|
||||
csr_wifi_hip_card_sdio_mem.o \
|
||||
csr_wifi_hip_chiphelper.o \
|
||||
csr_wifi_hip_download.o \
|
||||
csr_wifi_hip_dump.o \
|
||||
csr_wifi_hip_packing.o \
|
||||
csr_wifi_hip_send.o \
|
||||
csr_wifi_hip_signals.o \
|
||||
csr_wifi_hip_ta_sampling.o \
|
||||
csr_wifi_hip_udi.o \
|
||||
csr_wifi_hip_unifi_signal_names.o \
|
||||
csr_wifi_hip_xbv.o \
|
||||
csr_wifi_router_ctrl_sef.o \
|
||||
csr_wifi_router_sef.o \
|
||||
csr_wifi_router_transport.o \
|
||||
csr_wifi_sme_sef.o \
|
||||
csr_wifi_sme_converter_init.o \
|
||||
csr_wifi_sme_free_downstream_contents.o \
|
||||
csr_wifi_sme_free_upstream_contents.o \
|
||||
csr_wifi_sme_serialize.o \
|
||||
csr_wifi_router_ctrl_converter_init.o \
|
||||
csr_wifi_router_ctrl_free_downstream_contents.o \
|
||||
csr_wifi_router_ctrl_free_upstream_contents.o \
|
||||
csr_wifi_router_ctrl_serialize.o \
|
||||
csr_wifi_router_converter_init.o \
|
||||
csr_wifi_router_free_downstream_contents.o \
|
||||
csr_wifi_router_free_upstream_contents.o \
|
||||
csr_wifi_router_serialize.o \
|
||||
sme_mgt.o \
|
||||
sme_sys.o \
|
||||
sme_userspace.o
|
||||
|
||||
csr_helper-y := csr_time.o \
|
||||
csr_util.o \
|
||||
csr_framework_ext.o \
|
||||
csr_pmem.o \
|
||||
csr_wifi_serialize_primitive_types.o \
|
||||
csr_serialize_primitive_types.o \
|
||||
csr_utf16.o \
|
||||
csr_msgconv.o \
|
||||
csr_panic.o
|
||||
|
|
391
drivers/staging/csr/bh.c
Normal file
391
drivers/staging/csr/bh.c
Normal file
|
@ -0,0 +1,391 @@
|
|||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: bh.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* Provides an implementation for the driver bottom-half.
|
||||
* It is part of the porting exercise in Linux.
|
||||
*
|
||||
* Copyright (C) 2005-2009 by Cambridge Silicon Radio Ltd.
|
||||
*
|
||||
* Refer to LICENSE.txt included with this source code for details on
|
||||
* the license terms.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "unifi_priv.h"
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* uf_start_thread
|
||||
*
|
||||
* Helper function to start a new thread.
|
||||
*
|
||||
* Arguments:
|
||||
* priv Pointer to OS driver structure for the device.
|
||||
* thread Pointer to the thread object
|
||||
* func The thread function
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or else a Linux error code.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
uf_start_thread(unifi_priv_t *priv, struct uf_thread *thread, int (*func)(void *))
|
||||
{
|
||||
if (thread->thread_task != NULL) {
|
||||
unifi_error(priv, "%s thread already started\n", thread->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Start the kernel thread that handles all h/w accesses. */
|
||||
thread->thread_task = kthread_run(func, priv, "%s", thread->name);
|
||||
if (IS_ERR(thread->thread_task)) {
|
||||
return PTR_ERR(thread->thread_task);
|
||||
}
|
||||
|
||||
/* Module parameter overides the thread priority */
|
||||
if (bh_priority != -1) {
|
||||
if (bh_priority >= 0 && bh_priority <= MAX_RT_PRIO) {
|
||||
struct sched_param param;
|
||||
priv->bh_thread.prio = bh_priority;
|
||||
unifi_trace(priv, UDBG1, "%s thread (RT) priority = %d\n",
|
||||
thread->name, bh_priority);
|
||||
param.sched_priority = bh_priority;
|
||||
sched_setscheduler(thread->thread_task, SCHED_FIFO, ¶m);
|
||||
} else if (bh_priority > MAX_RT_PRIO && bh_priority <= MAX_PRIO) {
|
||||
priv->bh_thread.prio = bh_priority;
|
||||
unifi_trace(priv, UDBG1, "%s thread priority = %d\n",
|
||||
thread->name, PRIO_TO_NICE(bh_priority));
|
||||
set_user_nice(thread->thread_task, PRIO_TO_NICE(bh_priority));
|
||||
} else {
|
||||
priv->bh_thread.prio = DEFAULT_PRIO;
|
||||
unifi_warning(priv, "%s thread unsupported (%d) priority\n",
|
||||
thread->name, bh_priority);
|
||||
}
|
||||
} else {
|
||||
priv->bh_thread.prio = DEFAULT_PRIO;
|
||||
}
|
||||
unifi_trace(priv, UDBG2, "Started %s thread\n", thread->name);
|
||||
|
||||
return 0;
|
||||
} /* uf_start_thread() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* uf_stop_thread
|
||||
*
|
||||
* Helper function to stop a thread.
|
||||
*
|
||||
* Arguments:
|
||||
* priv Pointer to OS driver structure for the device.
|
||||
* thread Pointer to the thread object
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
uf_stop_thread(unifi_priv_t *priv, struct uf_thread *thread)
|
||||
{
|
||||
if (!thread->thread_task) {
|
||||
unifi_notice(priv, "%s thread is already stopped\n", thread->name);
|
||||
return;
|
||||
}
|
||||
|
||||
unifi_trace(priv, UDBG2, "Stopping %s thread\n", thread->name);
|
||||
|
||||
kthread_stop(thread->thread_task);
|
||||
thread->thread_task = NULL;
|
||||
|
||||
} /* uf_stop_thread() */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* uf_wait_for_thread_to_stop
|
||||
*
|
||||
* Helper function to wait until a thread is stopped.
|
||||
*
|
||||
* Arguments:
|
||||
* priv Pointer to OS driver structure for the device.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
uf_wait_for_thread_to_stop(unifi_priv_t *priv, struct uf_thread *thread)
|
||||
{
|
||||
/*
|
||||
* kthread_stop() cannot handle the thread exiting while
|
||||
* kthread_should_stop() is false, so sleep until kthread_stop()
|
||||
* wakes us up.
|
||||
*/
|
||||
unifi_trace(priv, UDBG2, "%s waiting for the stop signal.\n", thread->name);
|
||||
set_current_state(TASK_INTERRUPTIBLE);
|
||||
if (!kthread_should_stop()) {
|
||||
unifi_trace(priv, UDBG2, "%s schedule....\n", thread->name);
|
||||
schedule();
|
||||
}
|
||||
|
||||
thread->thread_task = NULL;
|
||||
unifi_trace(priv, UDBG2, "%s exiting....\n", thread->name);
|
||||
} /* uf_wait_for_thread_to_stop() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* handle_bh_error
|
||||
*
|
||||
* This function reports an error returned from the HIP core bottom-half.
|
||||
* Normally, implemented during the porting exercise, passing the error
|
||||
* to the SME using unifi_sys_wifi_off_ind().
|
||||
* The SME will try to reset the device and go through
|
||||
* the initialisation of the UniFi.
|
||||
*
|
||||
* Arguments:
|
||||
* priv Pointer to OS driver structure for the device.
|
||||
*
|
||||
* Returns:
|
||||
* None.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static void
|
||||
handle_bh_error(unifi_priv_t *priv)
|
||||
{
|
||||
u8 conf_param = CONFIG_IND_ERROR;
|
||||
CsrUint8 interfaceTag = 0; /* used as a loop counter */
|
||||
|
||||
|
||||
/* Block unifi_run_bh() until the error has been handled. */
|
||||
priv->bh_thread.block_thread = 1;
|
||||
|
||||
/* Consider UniFi to be uninitialised */
|
||||
priv->init_progress = UNIFI_INIT_NONE;
|
||||
|
||||
/* Stop the network traffic */
|
||||
for( interfaceTag =0; interfaceTag <CSR_WIFI_NUM_INTERFACES;interfaceTag ++) {
|
||||
netInterface_priv_t *interfacePriv = priv->interfacePriv[interfaceTag];
|
||||
if (interfacePriv->netdev_registered == 1) {
|
||||
netif_carrier_off(priv->netdev[interfaceTag]);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CSR_NATIVE_LINUX
|
||||
/* Force any client waiting on an mlme_wait_for_reply() to abort. */
|
||||
uf_abort_mlme(priv);
|
||||
|
||||
/* Cancel any pending workqueue tasks */
|
||||
flush_workqueue(priv->unifi_workqueue);
|
||||
|
||||
#endif /* CSR_NATIVE_LINUX */
|
||||
|
||||
unifi_error(priv, "handle_bh_error: fatal error is reported to the SME.\n");
|
||||
/* Notify the clients (SME or unifi_manager) for the error. */
|
||||
ul_log_config_ind(priv, &conf_param, sizeof(u8));
|
||||
|
||||
} /* handle_bh_error() */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* bh_thread_function
|
||||
*
|
||||
* All hardware access happens in this thread.
|
||||
* This means there is no need for locks on the hardware and we don't need
|
||||
* to worry about reentrancy with the SDIO library.
|
||||
* Provides and example implementation on how to call unifi_bh(), which
|
||||
* is part of the HIP core API.
|
||||
*
|
||||
* It processes the events generated by unifi_run_bh() to serialise calls
|
||||
* to unifi_bh(). It also demonstrates how the timeout parameter passed in
|
||||
* and returned from unifi_bh() needs to be handled.
|
||||
*
|
||||
* Arguments:
|
||||
* arg Pointer to OS driver structure for the device.
|
||||
*
|
||||
* Returns:
|
||||
* None.
|
||||
*
|
||||
* Notes:
|
||||
* When the bottom half of the driver needs to process signals, events,
|
||||
* or simply the host status (i.e sleep mode), it invokes unifi_run_bh().
|
||||
* Since we need all SDIO transaction to be in a single thread, the
|
||||
* unifi_run_bh() will wake up this thread to process it.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static int
|
||||
bh_thread_function(void *arg)
|
||||
{
|
||||
unifi_priv_t *priv = (unifi_priv_t*)arg;
|
||||
CsrResult csrResult;
|
||||
long ret;
|
||||
CsrUint32 timeout, t;
|
||||
struct uf_thread *this_thread;
|
||||
|
||||
unifi_trace(priv, UDBG2, "bh_thread_function starting\n");
|
||||
|
||||
this_thread = &priv->bh_thread;
|
||||
|
||||
t = timeout = 0;
|
||||
while (!kthread_should_stop()) {
|
||||
/* wait until an error occurs, or we need to process something. */
|
||||
unifi_trace(priv, UDBG3, "bh_thread goes to sleep.\n");
|
||||
|
||||
if (timeout > 0) {
|
||||
/* Convert t in ms to jiffies */
|
||||
t = msecs_to_jiffies(timeout);
|
||||
ret = wait_event_interruptible_timeout(this_thread->wakeup_q,
|
||||
(this_thread->wakeup_flag && !this_thread->block_thread) ||
|
||||
kthread_should_stop(),
|
||||
t);
|
||||
timeout = (ret > 0) ? jiffies_to_msecs(ret) : 0;
|
||||
} else {
|
||||
ret = wait_event_interruptible(this_thread->wakeup_q,
|
||||
(this_thread->wakeup_flag && !this_thread->block_thread) ||
|
||||
kthread_should_stop());
|
||||
}
|
||||
|
||||
if (kthread_should_stop()) {
|
||||
unifi_trace(priv, UDBG2, "bh_thread: signalled to exit\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
unifi_notice(priv,
|
||||
"bh_thread: wait_event returned %d, thread will exit\n",
|
||||
ret);
|
||||
uf_wait_for_thread_to_stop(priv, this_thread);
|
||||
break;
|
||||
}
|
||||
|
||||
this_thread->wakeup_flag = 0;
|
||||
|
||||
unifi_trace(priv, UDBG3, "bh_thread calls unifi_bh().\n");
|
||||
|
||||
CsrSdioClaim(priv->sdio);
|
||||
csrResult = unifi_bh(priv->card, &timeout);
|
||||
if(csrResult != CSR_RESULT_SUCCESS) {
|
||||
if (csrResult == CSR_WIFI_HIP_RESULT_NO_DEVICE) {
|
||||
CsrSdioRelease(priv->sdio);
|
||||
uf_wait_for_thread_to_stop(priv, this_thread);
|
||||
break;
|
||||
}
|
||||
/* Errors must be delivered to the error task */
|
||||
handle_bh_error(priv);
|
||||
}
|
||||
CsrSdioRelease(priv->sdio);
|
||||
}
|
||||
|
||||
/*
|
||||
* I would normally try to call csr_sdio_remove_irq() here to make sure
|
||||
* that we do not get any interrupts while this thread is not running.
|
||||
* However, the MMC/SDIO driver tries to kill its' interrupt thread.
|
||||
* The kernel threads implementation does not allow to kill threads
|
||||
* from a signalled to stop thread.
|
||||
* So, instead call csr_sdio_linux_remove_irq() always after calling
|
||||
* uf_stop_thread() to kill this thread.
|
||||
*/
|
||||
|
||||
unifi_trace(priv, UDBG2, "bh_thread exiting....\n");
|
||||
return 0;
|
||||
} /* bh_thread_function() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* uf_init_bh
|
||||
*
|
||||
* Helper function to start the bottom half of the driver.
|
||||
* All we need to do here is start the I/O bh thread.
|
||||
*
|
||||
* Arguments:
|
||||
* priv Pointer to OS driver structure for the device.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or else a Linux error code.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
uf_init_bh(unifi_priv_t *priv)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* Enable mlme interface. */
|
||||
priv->io_aborted = 0;
|
||||
|
||||
|
||||
/* Start the BH thread */
|
||||
r = uf_start_thread(priv, &priv->bh_thread, bh_thread_function);
|
||||
if (r) {
|
||||
unifi_error(priv,
|
||||
"uf_init_bh: failed to start the BH thread.\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Allow interrupts */
|
||||
r = csr_sdio_linux_install_irq(priv->sdio);
|
||||
if (r) {
|
||||
unifi_error(priv,
|
||||
"uf_init_bh: failed to install the IRQ.\n");
|
||||
|
||||
uf_stop_thread(priv, &priv->bh_thread);
|
||||
}
|
||||
|
||||
return r;
|
||||
} /* uf_init_bh() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_run_bh
|
||||
*
|
||||
* Part of the HIP core lib API, implemented in the porting exercise.
|
||||
* The bottom half of the driver calls this function when
|
||||
* it wants to process anything that requires access to unifi.
|
||||
* We need to call unifi_bh() which in this implementation is done
|
||||
* by waking up the I/O thread.
|
||||
*
|
||||
* Arguments:
|
||||
* ospriv Pointer to OS driver structure for the device.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or else a Linux error code.
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_run_bh(void *ospriv)
|
||||
{
|
||||
unifi_priv_t *priv = ospriv;
|
||||
|
||||
/*
|
||||
* If an error has occured, we discard silently all messages from the bh
|
||||
* until the error has been processed and the unifi has been reinitialised.
|
||||
*/
|
||||
if (priv->bh_thread.block_thread == 1) {
|
||||
unifi_trace(priv, UDBG3, "unifi_run_bh: discard message.\n");
|
||||
/*
|
||||
* Do not try to acknowledge a pending interrupt here.
|
||||
* This function is called by unifi_send_signal() which in turn can be
|
||||
* running in an atomic or 'disabled irq' level if a signal is sent
|
||||
* from a workqueue task (i.e multicass addresses set).
|
||||
* We can not hold the SDIO lock because it might sleep.
|
||||
*/
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
priv->bh_thread.wakeup_flag = 1;
|
||||
/* wake up I/O thread */
|
||||
wake_up_interruptible(&priv->bh_thread.wakeup_q);
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
} /* unifi_run_bh() */
|
||||
|
29
drivers/staging/csr/csr_formatted_io.c
Normal file
29
drivers/staging/csr/csr_formatted_io.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_formatted_io.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...)
|
||||
{
|
||||
CsrInt32 r;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
r = CsrVsnprintf(dest, n, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
if (dest && (n > 0))
|
||||
{
|
||||
dest[n - 1] = '\0';
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
25
drivers/staging/csr/csr_formatted_io.h
Normal file
25
drivers/staging/csr/csr_formatted_io.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef CSR_FORMATTED_IO_H__
|
||||
#define CSR_FORMATTED_IO_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
CsrInt32 CsrSnprintf(CsrCharString *dest, CsrSize n, const CsrCharString *fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
213
drivers/staging/csr/csr_framework_ext.c
Normal file
213
drivers/staging/csr/csr_framework_ext.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
|
||||
#include <linux/slab.h>
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 19)
|
||||
#include <linux/freezer.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
|
||||
#include <asm/semaphore.h>
|
||||
#else
|
||||
#include <linux/semaphore.h>
|
||||
#endif
|
||||
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_framework_ext.h"
|
||||
#include "csr_panic.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexCreate
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create a mutex and return a handle to the created mutex.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle)
|
||||
{
|
||||
if (mutexHandle == NULL)
|
||||
{
|
||||
return CSR_FE_RESULT_INVALID_POINTER;
|
||||
}
|
||||
|
||||
sema_init(mutexHandle, 1);
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexDestroy
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Destroy the previously created mutex.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrMutexDestroy(CsrMutexHandle *mutexHandle)
|
||||
{
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexLock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Lock the mutex refered to by the provided handle.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexLock(CsrMutexHandle *mutexHandle)
|
||||
{
|
||||
if (mutexHandle == NULL)
|
||||
{
|
||||
return CSR_FE_RESULT_INVALID_POINTER;
|
||||
}
|
||||
|
||||
if (down_interruptible(mutexHandle))
|
||||
{
|
||||
CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_UNEXPECTED_VALUE, "CsrMutexLock Failed");
|
||||
return CSR_FE_RESULT_INVALID_POINTER;
|
||||
}
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexUnlock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unlock the mutex refered to by the provided handle.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle)
|
||||
{
|
||||
if (mutexHandle == NULL)
|
||||
{
|
||||
return CSR_FE_RESULT_INVALID_POINTER;
|
||||
}
|
||||
|
||||
up(mutexHandle);
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrThreadSleep
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Sleep for a given period.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrThreadSleep(CsrUint16 sleepTimeInMs)
|
||||
{
|
||||
unsigned long t;
|
||||
|
||||
/* Convert t in ms to jiffies and round up */
|
||||
t = ((sleepTimeInMs * HZ) + 999) / 1000;
|
||||
schedule_timeout_uninterruptible(t);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrThreadSleep);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemCalloc
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocate dynamic memory of a given size calculated as the
|
||||
* numberOfElements times the elementSize.
|
||||
*
|
||||
* RETURNS
|
||||
* Pointer to allocated memory, or NULL in case of failure.
|
||||
* Allocated memory is zero initialised.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize)
|
||||
{
|
||||
void *buf;
|
||||
size_t size;
|
||||
|
||||
size = numberOfElements * elementSize;
|
||||
|
||||
buf = kmalloc(size, GFP_KERNEL);
|
||||
if (buf != NULL)
|
||||
{
|
||||
memset(buf, 0, size);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemAlloc
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocate dynamic memory of a given size.
|
||||
*
|
||||
* RETURNS
|
||||
* Pointer to allocated memory, or NULL in case of failure.
|
||||
* Allocated memory is not initialised.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void *CsrMemAlloc(CsrSize size)
|
||||
{
|
||||
return kmalloc(size, GFP_KERNEL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemAlloc);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemFree
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free dynamic allocated memory.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrMemFree(void *pointer)
|
||||
{
|
||||
kfree(pointer);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemFree);
|
354
drivers/staging/csr/csr_framework_ext.h
Normal file
354
drivers/staging/csr/csr_framework_ext.h
Normal file
|
@ -0,0 +1,354 @@
|
|||
#ifndef CSR_FRAMEWORK_EXT_H__
|
||||
#define CSR_FRAMEWORK_EXT_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_result.h"
|
||||
#include "csr_framework_ext_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Result codes */
|
||||
#define CSR_FE_RESULT_NO_MORE_EVENTS ((CsrResult) 0x0001)
|
||||
#define CSR_FE_RESULT_INVALID_POINTER ((CsrResult) 0x0002)
|
||||
#define CSR_FE_RESULT_INVALID_HANDLE ((CsrResult) 0x0003)
|
||||
#define CSR_FE_RESULT_NO_MORE_MUTEXES ((CsrResult) 0x0004)
|
||||
#define CSR_FE_RESULT_TIMEOUT ((CsrResult) 0x0005)
|
||||
#define CSR_FE_RESULT_NO_MORE_THREADS ((CsrResult) 0x0006)
|
||||
|
||||
/* Thread priorities */
|
||||
#define CSR_THREAD_PRIORITY_HIGHEST ((CsrUint16) 0)
|
||||
#define CSR_THREAD_PRIORITY_HIGH ((CsrUint16) 1)
|
||||
#define CSR_THREAD_PRIORITY_NORMAL ((CsrUint16) 2)
|
||||
#define CSR_THREAD_PRIORITY_LOW ((CsrUint16) 3)
|
||||
#define CSR_THREAD_PRIORITY_LOWEST ((CsrUint16) 4)
|
||||
|
||||
#define CSR_EVENT_WAIT_INFINITE ((CsrUint16) 0xFFFF)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrEventCreate
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Creates an event and returns a handle to the created event.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_NO_MORE_EVENTS in case of out of event resources
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case the eventHandle pointer is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrEventCreate(CsrEventHandle *eventHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrEventWait
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Wait fore one or more of the event bits to be set.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_TIMEOUT in case of timeout
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case the eventBits pointer is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrEventWait(CsrEventHandle *eventHandle, CsrUint16 timeoutInMs, CsrUint32 *eventBits);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrEventSet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Set an event.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the eventHandle is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrEventSet(CsrEventHandle *eventHandle, CsrUint32 eventBits);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrEventDestroy
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Destroy the event associated.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrEventDestroy(CsrEventHandle *eventHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexCreate
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create a mutex and return a handle to the created mutex.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_NO_MORE_MUTEXES in case of out of mutex resources
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case the mutexHandle pointer is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexCreate(CsrMutexHandle *mutexHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexLock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Lock the mutex refered to by the provided handle.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexLock(CsrMutexHandle *mutexHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexUnlock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unlock the mutex refered to by the provided handle.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_HANDLE in case the mutexHandle is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrMutexUnlock(CsrMutexHandle *mutexHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMutexDestroy
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Destroy the previously created mutex.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrMutexDestroy(CsrMutexHandle *mutexHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrGlobalMutexLock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Lock the global mutex. The global mutex is a single pre-initialised
|
||||
* shared mutex, spinlock or similar that does not need to be created prior
|
||||
* to use. The limitation is that there is only one single lock shared
|
||||
* between all code. Consequently, it must only be used very briefly to
|
||||
* either protect simple one-time initialisation or to protect the creation
|
||||
* of a dedicated mutex by calling CsrMutexCreate.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrGlobalMutexLock(void);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrGlobalMutexUnlock
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unlock the global mutex.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrGlobalMutexUnlock(void);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrThreadCreate
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Create thread function and return a handle to the created thread.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_NO_MORE_THREADS in case of out of thread resources
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case one of the supplied pointers is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrThreadCreate(void (*threadFunction)(void *pointer), void *pointer,
|
||||
CsrUint32 stackSize, CsrUint16 priority,
|
||||
const CsrCharString *threadName, CsrThreadHandle *threadHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrThreadGetHandle
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Return thread handle of calling thread.
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case of success
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case the threadHandle pointer is invalid
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrThreadGetHandle(CsrThreadHandle *threadHandle);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrThreadEqual
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare thread handles
|
||||
*
|
||||
* RETURNS
|
||||
* Possible values:
|
||||
* CSR_RESULT_SUCCESS in case thread handles are identical
|
||||
* CSR_FE_RESULT_INVALID_POINTER in case either threadHandle pointer is invalid
|
||||
* CSR_RESULT_FAILURE otherwise
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrThreadEqual(CsrThreadHandle *threadHandle1, CsrThreadHandle *threadHandle2);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrThreadSleep
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Sleep for a given period.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrThreadSleep(CsrUint16 sleepTimeInMs);
|
||||
|
||||
#ifndef CSR_PMEM_DEBUG_ENABLE
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemAlloc
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocate dynamic memory of a given size.
|
||||
*
|
||||
* RETURNS
|
||||
* Pointer to allocated memory, or NULL in case of failure.
|
||||
* Allocated memory is not initialised.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifdef CSR_MEM_DEBUG
|
||||
void *CsrMemAllocDebug(CsrSize size,
|
||||
const CsrCharString *file, CsrUint32 line);
|
||||
#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__)
|
||||
#else
|
||||
void *CsrMemAlloc(CsrSize size);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemCalloc
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocate dynamic memory of a given size calculated as the
|
||||
* numberOfElements times the elementSize.
|
||||
*
|
||||
* RETURNS
|
||||
* Pointer to allocated memory, or NULL in case of failure.
|
||||
* Allocated memory is zero initialised.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifdef CSR_MEM_DEBUG
|
||||
void *CsrMemCallocDebug(CsrSize numberOfElements, CsrSize elementSize,
|
||||
const CsrCharString *file, CsrUint32 line);
|
||||
#define CsrMemCalloc(cnt, sz) CsrMemAllocDebug((cnt), (sz), __FILE__, __LINE__)
|
||||
#else
|
||||
void *CsrMemCalloc(CsrSize numberOfElements, CsrSize elementSize);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemFree
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free dynamic allocated memory.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrMemFree(void *pointer);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemAllocDma
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocate dynamic memory suitable for DMA transfers.
|
||||
*
|
||||
* RETURNS
|
||||
* Pointer to allocated memory, or NULL in case of failure.
|
||||
* Allocated memory is not initialised.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifdef CSR_MEM_DEBUG
|
||||
void *CsrMemAllocDmaDebug(CsrSize size,
|
||||
const CsrCharString *file, CsrUint32 line);
|
||||
#define CsrMemAllocDma(sz) CsrMemAllocDmaDebug((sz), __FILE__, __LINE__)
|
||||
#else
|
||||
void *CsrMemAllocDma(CsrSize size);
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrMemFreeDma
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free dynamic memory allocated by CsrMemAllocDma.
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrMemFreeDma(void *pointer);
|
||||
#else
|
||||
|
||||
#include "csr_pmem.h"
|
||||
|
||||
#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
|
||||
|
||||
#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__)
|
||||
|
||||
#define CsrMemFree(ptr) CsrPmemDebugFree(ptr,CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
|
||||
|
||||
#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
|
||||
|
||||
#define CsrMemFreeDma(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
65
drivers/staging/csr/csr_framework_ext_types.h
Normal file
65
drivers/staging/csr/csr_framework_ext_types.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#ifndef CSR_FRAMEWORK_EXT_TYPES_H__
|
||||
#define CSR_FRAMEWORK_EXT_TYPES_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/semaphore.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct CsrThread
|
||||
{
|
||||
struct task_struct *thread_task;
|
||||
char name[16];
|
||||
};
|
||||
|
||||
struct CsrEvent
|
||||
{
|
||||
/* wait_queue for waking the kernel thread */
|
||||
wait_queue_head_t wakeup_q;
|
||||
unsigned int wakeup_flag;
|
||||
};
|
||||
|
||||
typedef struct CsrEvent CsrEventHandle;
|
||||
typedef struct semaphore CsrMutexHandle;
|
||||
typedef struct CsrThread CsrThreadHandle;
|
||||
|
||||
#else /* __KERNEL __ */
|
||||
|
||||
struct CsrEvent
|
||||
{
|
||||
pthread_cond_t event;
|
||||
pthread_mutex_t mutex;
|
||||
CsrUint32 eventBits;
|
||||
};
|
||||
|
||||
typedef struct CsrEvent CsrEventHandle;
|
||||
typedef pthread_mutex_t CsrMutexHandle;
|
||||
typedef pthread_t CsrThreadHandle;
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
189
drivers/staging/csr/csr_lib.h
Normal file
189
drivers/staging/csr/csr_lib.h
Normal file
|
@ -0,0 +1,189 @@
|
|||
#ifndef CSR_LIB_H__
|
||||
#define CSR_LIB_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
} CsrEvent;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEvent_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEvent
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEvent *CsrEvent_struct(CsrUint16 primtype, CsrUint16 msgtype);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint8 value;
|
||||
} CsrEventCsrUint8;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint8_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint8
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint8 *CsrEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint8 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 value;
|
||||
} CsrEventCsrUint16;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint16_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint16
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint16 *CsrEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 value1;
|
||||
CsrUint8 value2;
|
||||
} CsrEventCsrUint16CsrUint8;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint16CsrUint8_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint8
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint16CsrUint8 *CsrEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint8 value2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 value1;
|
||||
CsrUint16 value2;
|
||||
} CsrEventCsrUint16CsrUint16;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint16CsrUint16_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint16CsrUint16
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint16CsrUint16 *CsrEventCsrUint16CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint16 value2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 value1;
|
||||
CsrUint32 value2;
|
||||
} CsrEventCsrUint16CsrUint32;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint16_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint16
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint16CsrUint32 *CsrEventCsrUint16CsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrUint32 value2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 value1;
|
||||
CsrCharString *value2;
|
||||
} CsrEventCsrUint16CsrCharString;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint16CsrCharString_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint16CsrCharString
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint16CsrCharString *CsrEventCsrUint16CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint16 value1, CsrCharString *value2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint32 value;
|
||||
} CsrEventCsrUint32;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint32_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint32
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint32 *CsrEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint32 value1;
|
||||
CsrUint16 value2;
|
||||
} CsrEventCsrUint32CsrUint16;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint32CsrUint16_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint32CsrUint16
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint32CsrUint16 *CsrEventCsrUint32CsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrUint32 value2);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint32 value1;
|
||||
CsrCharString *value2;
|
||||
} CsrEventCsrUint32CsrCharString;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrEventCsrUint32CsrCharString_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrEventCsrUint32CsrCharString
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrEventCsrUint32CsrCharString *CsrEventCsrUint32CsrCharString_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrUint32 value1, CsrCharString *value2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_LIB_H__ */
|
250
drivers/staging/csr/csr_log.h
Normal file
250
drivers/staging/csr/csr_log.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
#ifndef CSR_LOG_H__
|
||||
#define CSR_LOG_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_panic.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_msgconv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Log filtering
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------*/
|
||||
/* Filtering on environment specific log levels */
|
||||
/*----------------------------------------------------*/
|
||||
typedef CsrUint32 CsrLogLevelEnvironment;
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_OFF ((CsrLogLevelEnvironment) 0x00000000) /* No environment data/events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_ACL ((CsrLogLevelEnvironment) 0x00000001) /* BlueCore Channel Interface HCI Acl data are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_HCI ((CsrLogLevelEnvironment) 0x00000002) /* BlueCore Channel Interface HCI Cmd/Evt data are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_SCO ((CsrLogLevelEnvironment) 0x00000004) /* BlueCore Channel Interface HCI Sco data are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BCI_VENDOR ((CsrLogLevelEnvironment) 0x00000008) /* BlueCore Channel Interface HCI Vendor specific data are logged (This includes BCCMD, HQ, VM etc) */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_TRANSPORTS ((CsrLogLevelEnvironment) 0x00000010) /* Transport protocol data is logged (This includes transport protocols like BCSP, H4 etc.) */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_REG ((CsrLogLevelEnvironment) 0x00000020) /* Background Interrupt registration events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_UNREG ((CsrLogLevelEnvironment) 0x00000040) /* Background Interrupt unregistration events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_SET ((CsrLogLevelEnvironment) 0x00000080) /* Background Interrupt set events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occured are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */
|
||||
/* The bit masks between here are reserved for future usage */
|
||||
#define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */
|
||||
|
||||
/*----------------------------------------------------*/
|
||||
/* Filtering on task specific log levels */
|
||||
/*----------------------------------------------------*/
|
||||
typedef CsrUint32 CsrLogLevelTask;
|
||||
#define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */
|
||||
#define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */
|
||||
#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_MESSAGE_GET ((CsrLogLevelTask) 0x00000200) /* Message get operations are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_PUSH ((CsrLogLevelTask) 0x00000400) /* Message push operations are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_MESSAGE_QUEUE_POP ((CsrLogLevelTask) 0x00000800) /* Message pop operations are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE ((CsrLogLevelTask) 0x00001000) /* Only the type of primitives in messages are logged. By default the entire primitive is serialized and logged */
|
||||
#define CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT ((CsrLogLevelTask) 0x00002000) /* An upper limit (defined by CSR_LOG_PRIM_SIZE_UPPER_LIMIT) is applied to how much of a primitive in a message are logged. NB: This limit is only applied if CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE is _not_ defined */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_IN ((CsrLogLevelTask) 0x00004000) /* TimedEventIn events are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_IN_LOC ((CsrLogLevelTask) 0x00008000) /* The location where a timer was started are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_IN, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL ((CsrLogLevelTask) 0x00010000) /* TimedEventCancel events are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_CANCEL_LOC ((CsrLogLevelTask) 0x00020000) /* The location where a timer was cancelled are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TIMER_CANCEL, it has no effect without it */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_FIRE ((CsrLogLevelTask) 0x00040000) /* TimedEventFire events are logged */
|
||||
#define CSR_LOG_LEVEL_TASK_TIMER_DONE ((CsrLogLevelTask) 0x00080000) /* TimedEventDone events are logged */
|
||||
/* The bit masks between here are reserved for future usage */
|
||||
#define CSR_LOG_LEVEL_TASK_ALL ((CsrLogLevelTask) 0xFFFFFFFF & ~(CSR_LOG_LEVEL_TASK_PRIM_ONLY_TYPE | CSR_LOG_LEVEL_TASK_PRIM_APPLY_LIMIT)) /* All info possible to log for a task are logged. WARNING: By using this define the application also accepts future possible task data/events in the logs */
|
||||
|
||||
CsrBool CsrLogEnvironmentIsFiltered(CsrLogLevelEnvironment level);
|
||||
CsrLogLevelTask CsrLogTaskFilterGet(CsrSchedQid taskId);
|
||||
CsrBool CsrLogTaskIsFiltered(CsrSchedQid taskId, CsrLogLevelTask level);
|
||||
|
||||
/*
|
||||
* Logging stuff
|
||||
*/
|
||||
#define CSR_LOG_STRINGIFY_REAL(a) #a
|
||||
#define CSR_LOG_STRINGIFY(a) CSR_LOG_STRINGIFY_REAL(a)
|
||||
|
||||
#ifdef CSR_LOG_ASSERT_ENABLE
|
||||
#define CSR_LOG_ASSERT(cond) \
|
||||
do { \
|
||||
if (!(cond)) \
|
||||
{ \
|
||||
CsrCharString *panic_arg = "[" __FILE__ ":" CSR_LOG_STRINGIFY(__LINE__) "] - " CSR_LOG_STRINGIFY(cond); \
|
||||
CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_ASSERTION_FAIL, panic_arg); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define CSR_LOG_ASSERT(cond)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 primitiveType;
|
||||
const CsrCharString *primitiveName;
|
||||
CsrMsgConvMsgEntry *messageConv; /* Private - do not use */
|
||||
} CsrLogPrimitiveInformation;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const CsrCharString *techVer;
|
||||
CsrUint32 primitiveInfoCount;
|
||||
CsrLogPrimitiveInformation *primitiveInfo;
|
||||
} CsrLogTechInformation;
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Tech logging */
|
||||
/*---------------------------------*/
|
||||
typedef CsrUint8 bitmask8_t;
|
||||
typedef CsrUint16 bitmask16_t;
|
||||
typedef CsrUint32 bitmask32_t;
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#ifdef CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER
|
||||
/* DEPRECATED - replaced by csr_log_text.h */
|
||||
#define CSR_LOG_TEXT(text) \
|
||||
do { \
|
||||
if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) \
|
||||
{ \
|
||||
CsrLogTaskText(text, __LINE__, __FILE__); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
/* DEPRECATED - replaced by csr_log_text.h */
|
||||
#define CSR_LOG_TEXT(text) \
|
||||
do { \
|
||||
if (!CsrLogTaskIsFiltered(CsrSchedTaskQueueGet(), CSR_LOG_LEVEL_TASK_TEXT)) \
|
||||
{ \
|
||||
CsrLogTaskText(text, 0, NULL); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
#else
|
||||
#define CSR_LOG_TEXT(text)
|
||||
#endif
|
||||
|
||||
/* DEPRECATED - replaced by csr_log_text.h */
|
||||
void CsrLogTaskText(const CsrCharString *text,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_FSM_NAME (0x001)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE (0x002)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_NEXT_STATE_STR (0x004)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE (0x008)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_PREV_STATE_STR (0x010)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_EVENT (0x020)
|
||||
#define CSR_LOG_STATE_TRANSITION_MASK_EVENT_STR (0x040)
|
||||
|
||||
/* DEPRECATED - replaced by csr_log_text.h */
|
||||
void CsrLogStateTransition(bitmask16_t mask,
|
||||
CsrUint32 identifier,
|
||||
const CsrCharString *fsm_name,
|
||||
CsrUint32 prev_state,
|
||||
const CsrCharString *prev_state_str,
|
||||
CsrUint32 in_event,
|
||||
const CsrCharString *in_event_str,
|
||||
CsrUint32 next_state,
|
||||
const CsrCharString *next_state_str,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
|
||||
/*---------------------------------*/
|
||||
/* BSP logging */
|
||||
/*---------------------------------*/
|
||||
void CsrLogSchedInit(CsrUint8 thread_id);
|
||||
void CsrLogSchedDeinit(CsrUint8 thread_id);
|
||||
|
||||
void CsrLogSchedStart(CsrUint8 thread_id);
|
||||
void CsrLogSchedStop(CsrUint8 thread_id);
|
||||
|
||||
void CsrLogInitTask(CsrUint8 thread_id, CsrSchedQid tskid, const CsrCharString *tskName);
|
||||
void CsrLogDeinitTask(CsrUint16 task_id);
|
||||
|
||||
void CsrLogActivate(CsrSchedQid tskid);
|
||||
void CsrLogDeactivate(CsrSchedQid tskid);
|
||||
|
||||
#define SYNERGY_SERIALIZER_TYPE_DUMP (0x000)
|
||||
#define SYNERGY_SERIALIZER_TYPE_SER (0x001)
|
||||
|
||||
void CsrLogMessagePut(CsrUint32 line,
|
||||
const CsrCharString *file,
|
||||
CsrSchedQid src_task_id,
|
||||
CsrSchedQid dst_taskid,
|
||||
CsrSchedMsgId msg_id,
|
||||
CsrUint16 prim_type,
|
||||
const void *msg);
|
||||
|
||||
void CsrLogMessageGet(CsrSchedQid src_task_id,
|
||||
CsrSchedQid dst_taskid,
|
||||
CsrBool get_res,
|
||||
CsrSchedMsgId msg_id,
|
||||
CsrUint16 prim_type,
|
||||
const void *msg);
|
||||
|
||||
void CsrLogTimedEventIn(CsrUint32 line,
|
||||
const CsrCharString *file,
|
||||
CsrSchedQid task_id,
|
||||
CsrSchedTid tid,
|
||||
CsrTime requested_delay,
|
||||
CsrUint16 fniarg,
|
||||
const void *fnvarg);
|
||||
|
||||
void CsrLogTimedEventFire(CsrSchedQid task_id,
|
||||
CsrSchedTid tid);
|
||||
|
||||
void CsrLogTimedEventDone(CsrSchedQid task_id,
|
||||
CsrSchedTid tid);
|
||||
|
||||
void CsrLogTimedEventCancel(CsrUint32 line,
|
||||
const CsrCharString *file,
|
||||
CsrSchedQid task_id,
|
||||
CsrSchedTid tid,
|
||||
CsrBool cancel_res);
|
||||
|
||||
void CsrLogBgintRegister(CsrUint8 thread_id,
|
||||
CsrSchedBgint irq,
|
||||
const CsrCharString *callback,
|
||||
const void *ptr);
|
||||
void CsrLogBgintUnregister(CsrSchedBgint irq);
|
||||
void CsrLogBgintSet(CsrSchedBgint irq);
|
||||
void CsrLogBgintServiceStart(CsrSchedBgint irq);
|
||||
void CsrLogBgintServiceDone(CsrSchedBgint irq);
|
||||
|
||||
void CsrLogExceptionStateEvent(CsrUint16 prim_type,
|
||||
CsrPrim msg_type,
|
||||
CsrUint16 state,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
void CsrLogExceptionGeneral(CsrUint16 prim_type,
|
||||
CsrUint16 state,
|
||||
const CsrCharString *text,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
void CsrLogExceptionWarning(CsrUint16 prim_type,
|
||||
CsrUint16 state,
|
||||
const CsrCharString *text,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
135
drivers/staging/csr/csr_log_configure.h
Normal file
135
drivers/staging/csr/csr_log_configure.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
#ifndef CSR_LOG_CONFIGURE_H__
|
||||
#define CSR_LOG_CONFIGURE_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_log.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Log init/deinit */
|
||||
/*---------------------------------*/
|
||||
void CsrLogInit(CsrUint8 size);
|
||||
void CsrLogDeinit(void);
|
||||
|
||||
/*---------------------------------*/
|
||||
/* Log Framework Tech info */
|
||||
/*---------------------------------*/
|
||||
void CsrLogTechInfoRegister(void);
|
||||
|
||||
/* Set the logging level for the environment outside the scheduler context */
|
||||
void CsrLogLevelEnvironmentSet(CsrLogLevelEnvironment environmentLogLevel);
|
||||
|
||||
|
||||
/* Set the logging level for all scheduler tasks */
|
||||
/* This function call takes precedence over all previous calls to CsrLogLevelTaskSetSpecific() */
|
||||
void CsrLogLevelTaskSetAll(CsrLogLevelTask tasksLogLevelMask);
|
||||
|
||||
/* Set the logging level for a given Task */
|
||||
/* This function can be used as a complement to CsrLogLevelTaskSetAll() to add more _or_ less log from a given task than what is set
|
||||
generally with CsrLogLevelTaskSetAll(). */
|
||||
void CsrLogLevelTaskSetSpecific(CsrSchedQid taskId, CsrLogLevelTask taskLogLevelMask);
|
||||
|
||||
|
||||
/*--------------------------------------------*/
|
||||
/* Filtering on log text warning levels */
|
||||
/*--------------------------------------------*/
|
||||
typedef CsrUint32 CsrLogLevelText;
|
||||
#define CSR_LOG_LEVEL_TEXT_OFF ((CsrLogLevelText) 0x0000)
|
||||
|
||||
#define CSR_LOG_LEVEL_TEXT_CRITICAL ((CsrLogLevelText) 0x0001)
|
||||
#define CSR_LOG_LEVEL_TEXT_ERROR ((CsrLogLevelText) 0x0002)
|
||||
#define CSR_LOG_LEVEL_TEXT_WARNING ((CsrLogLevelText) 0x0004)
|
||||
#define CSR_LOG_LEVEL_TEXT_INFO ((CsrLogLevelText) 0x0008)
|
||||
#define CSR_LOG_LEVEL_TEXT_DEBUG ((CsrLogLevelText) 0x0010)
|
||||
|
||||
#define CSR_LOG_LEVEL_TEXT_ALL ((CsrLogLevelText) 0xFFFF)
|
||||
|
||||
/* The log text interface is used by both scheduler tasks and components outside the scheduler context.
|
||||
* Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two CsrUint16's. The lower
|
||||
* 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used
|
||||
* by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the
|
||||
* scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid
|
||||
* clashes the technologies are only allowed to assign values within the same restrictive range as allies to
|
||||
* primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign
|
||||
* taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */
|
||||
typedef CsrUint32 CsrLogTextTaskId;
|
||||
|
||||
/* Set the text logging level for all Tasks */
|
||||
/* This function call takes precedence over all previous calls to CsrLogLevelTextSetTask() and CsrLogLevelTextSetTaskSubOrigin() */
|
||||
void CsrLogLevelTextSetAll(CsrLogLevelText warningLevelMask);
|
||||
|
||||
/* Set the text logging level for a given Task */
|
||||
/* This function call takes precedence over all previous calls to CsrLogLevelTextSetTaskSubOrigin(), but it can be used as a complement to
|
||||
* CsrLogLevelTextSetAll() to add more _or_ less log from a given task than what is set generally with CsrLogLevelTextSetAll(). */
|
||||
void CsrLogLevelTextSetTask(CsrLogTextTaskId taskId, CsrLogLevelText warningLevelMask);
|
||||
|
||||
/* Set the text logging level for a given tasks subOrigin */
|
||||
/* This function can be used as a complement to CsrLogLevelTextSetAll() and CsrLogLevelTextSetTask() to add more _or_ less log from a given
|
||||
* subOrigin within a task than what is set generally with CsrLogLevelTextSetAll() _or_ CsrLogLevelTextSetTask(). */
|
||||
void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrLogLevelText warningLevelMask);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrLogLevelTextSet
|
||||
|
||||
DESCRIPTION
|
||||
Set the text logging level for a given origin and optionally sub origin
|
||||
by name. If either string is NULL or zero length, it is interpreted as
|
||||
all origins and/or all sub origins respectively. If originName is NULL
|
||||
or zero length, subOriginName is ignored.
|
||||
|
||||
Passing NULL or zero length strings in both originName and subOriginName
|
||||
is equivalent to calling CsrLogLevelTextSetAll, and overrides all
|
||||
previous filter configurations for all origins and sub origins.
|
||||
|
||||
Passing NULL or a zero length string in subOriginName overrides all
|
||||
previous filter configurations for all sub origins of the specified
|
||||
origin.
|
||||
|
||||
Note: the supplied strings may be accessed after the function returns
|
||||
and must remain valid and constant until CsrLogDeinit is called.
|
||||
|
||||
Note: when specifying an origin (originName is not NULL and not zero
|
||||
length), this function can only be used for origins that use the
|
||||
csr_log_text_2.h interface for registration and logging. Filtering for
|
||||
origins that use the legacy csr_log_text.h interface must be be
|
||||
configured using the legacy filter configuration functions that accept
|
||||
a CsrLogTextTaskId as origin specifier. However, when not specifying an
|
||||
origin this function also affects origins that have been registered with
|
||||
the legacy csr_log_text.h interface. Furthermore, using this function
|
||||
and the legacy filter configuration functions on the same origin is not
|
||||
allowed.
|
||||
|
||||
PARAMETERS
|
||||
originName - a string containing the name of the origin. Can be NULL or
|
||||
zero length to set the log level for all origins. In this case, the
|
||||
subOriginName parameter will be ignored.
|
||||
subOriginName - a string containing the name of the sub origin. Can be
|
||||
NULL or zero length to set the log level for all sub origins of the
|
||||
specified origin.
|
||||
warningLevelMask - The desired log level for the specified origin(s) and
|
||||
sub origin(s).
|
||||
|
||||
*******************************************************************************/
|
||||
void CsrLogLevelTextSet(const CsrCharString *originName,
|
||||
const CsrCharString *subOriginName,
|
||||
CsrLogLevelText warningLevelMask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
133
drivers/staging/csr/csr_log_text.h
Normal file
133
drivers/staging/csr/csr_log_text.h
Normal file
|
@ -0,0 +1,133 @@
|
|||
#ifndef CSR_LOG_TEXT_H__
|
||||
#define CSR_LOG_TEXT_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_log_configure.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct CsrLogSubOrigin
|
||||
{
|
||||
CsrUint16 subOriginNumber; /* Id of the given SubOrigin */
|
||||
const CsrCharString *subOriginName; /* Prefix Text for this SubOrigin */
|
||||
} CsrLogSubOrigin;
|
||||
|
||||
/* Register a task which is going to use the CSR_LOG_TEXT_XXX interface */
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
void CsrLogTextRegister(CsrLogTextTaskId taskId, const CsrCharString *taskName, CsrUint16 subOriginsLength, const CsrLogSubOrigin *subOrigins);
|
||||
#else
|
||||
#define CsrLogTextRegister(taskId, taskName, subOriginsLength, subOrigins)
|
||||
#endif
|
||||
|
||||
/* CRITICAL: Conditions that are threatening to the integrity/stability of the
|
||||
system as a whole. */
|
||||
#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_CRITICAL_DISABLE)
|
||||
void CsrLogTextCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...);
|
||||
void CsrLogTextBufferCritical(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...);
|
||||
#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs) CsrLogTextCritical taskId_subOrigin_formatString_varargs
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_CRITICAL(logtextargs);}}
|
||||
#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferCritical taskId_subOrigin_length_buffer_formatString_varargs
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_CRITICAL(logtextbufferargs);}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_CRITICAL(taskId_subOrigin_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_CRITICAL(condition, logtextargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CRITICAL(taskId_subOrigin_length_buffer_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_CRITICAL(condition, logtextbufferargs)
|
||||
#endif
|
||||
|
||||
/* ERROR: Malfunction of a component rendering it unable to operate correctly,
|
||||
causing lack of functionality but not loss of system integrity/stability. */
|
||||
#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_ERROR_DISABLE)
|
||||
void CsrLogTextError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...);
|
||||
void CsrLogTextBufferError(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...);
|
||||
#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs) CsrLogTextError taskId_subOrigin_formatString_varargs
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_ERROR(logtextargs);}}
|
||||
#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferError taskId_subOrigin_length_buffer_formatString_varargs
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_ERROR(logtextbufferargs);}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_ERROR(taskId_subOrigin_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_ERROR(condition, logtextargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_ERROR(taskId_subOrigin_length_buffer_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_ERROR(condition, logtextbufferargs)
|
||||
#endif
|
||||
|
||||
/* WARNING: Conditions that are unexpected and indicative of possible problems
|
||||
or violations of specifications, where the result of such deviations does not
|
||||
lead to malfunction of the component. */
|
||||
#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_WARNING_DISABLE)
|
||||
void CsrLogTextWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...);
|
||||
void CsrLogTextBufferWarning(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...);
|
||||
#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs) CsrLogTextWarning taskId_subOrigin_formatString_varargs
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_WARNING(logtextargs);}}
|
||||
#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferWarning taskId_subOrigin_length_buffer_formatString_varargs
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_WARNING(logtextbufferargs);}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_WARNING(taskId_subOrigin_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_WARNING(condition, logtextargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_WARNING(taskId_subOrigin_length_buffer_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_WARNING(condition, logtextbufferargs)
|
||||
#endif
|
||||
|
||||
/* INFO: Important events that may aid in determining the conditions under which
|
||||
the more severe conditions are encountered. */
|
||||
#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_INFO_DISABLE)
|
||||
void CsrLogTextInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...);
|
||||
void CsrLogTextBufferInfo(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...);
|
||||
#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs) CsrLogTextInfo taskId_subOrigin_formatString_varargs
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_INFO(logtextargs);}}
|
||||
#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferInfo taskId_subOrigin_length_buffer_formatString_varargs
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_INFO(logtextbufferargs);}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_INFO(taskId_subOrigin_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_INFO(condition, logtextargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_INFO(taskId_subOrigin_length_buffer_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_INFO(condition, logtextbufferargs)
|
||||
#endif
|
||||
|
||||
/* DEBUG: Similar to INFO, but dedicated to events that occur more frequently. */
|
||||
#if defined(CSR_LOG_ENABLE) && !defined(CSR_LOG_LEVEL_TEXT_DEBUG_DISABLE)
|
||||
void CsrLogTextDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, const CsrCharString *formatString, ...);
|
||||
void CsrLogTextBufferDebug(CsrLogTextTaskId taskId, CsrUint16 subOrigin, CsrSize bufferLength, const void *buffer, const CsrCharString *formatString, ...);
|
||||
#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs) CsrLogTextDebug taskId_subOrigin_formatString_varargs
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs) {if (condition) {CSR_LOG_TEXT_DEBUG(logtextargs);}}
|
||||
#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs) CsrLogTextBufferDebug taskId_subOrigin_length_buffer_formatString_varargs
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs) {if (condition) {CSR_LOG_TEXT_BUFFER_DEBUG(logtextbufferargs);}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_DEBUG(taskId_subOrigin_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_CONDITIONAL_DEBUG(condition, logtextargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_DEBUG(taskId_subOrigin_length_buffer_formatString_varargs)
|
||||
#define CSR_LOG_TEXT_BUFFER_CONDITIONAL_DEBUG(condition, logtextbufferargs)
|
||||
#endif
|
||||
|
||||
/* CSR_LOG_TEXT_ASSERT (CRITICAL) */
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition) \
|
||||
{if (!(condition)) {CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Assertion \"%s\" failed at %s:%u", #condition, __FILE__, __LINE__));}}
|
||||
#else
|
||||
#define CSR_LOG_TEXT_ASSERT(origin, suborigin, condition)
|
||||
#endif
|
||||
|
||||
/* CSR_LOG_TEXT_UNHANDLED_PRIM (CRITICAL) */
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType) \
|
||||
CSR_LOG_TEXT_CRITICAL((origin, suborigin, "Unhandled primitive 0x%04X:0x%04X at %s:%u", primClass, primType, __FILE__, __LINE__))
|
||||
#else
|
||||
#define CSR_LOG_TEXT_UNHANDLED_PRIMITIVE(origin, suborigin, primClass, primType)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
111
drivers/staging/csr/csr_macro.h
Normal file
111
drivers/staging/csr/csr_macro.h
Normal file
|
@ -0,0 +1,111 @@
|
|||
#ifndef CSR_MACRO_H__
|
||||
#define CSR_MACRO_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Bits - intended to operate on CsrUint32 values */
|
||||
/*------------------------------------------------------------------*/
|
||||
#define CSR_MASK_IS_SET(val, mask) (((val) & (mask)) == (mask))
|
||||
#define CSR_MASK_IS_UNSET(val, mask) ((((val) & (mask)) ^ mask) == (mask))
|
||||
#define CSR_MASK_SET(val, mask) ((val) |= (mask))
|
||||
#define CSR_MASK_UNSET(val, mask) ((val) = ((val) ^ (mask)) & (val)) /* Unsets the bits in val that are set in mask */
|
||||
#define CSR_BIT_IS_SET(val, bit) ((CsrBool) ((((val) & (1UL << (bit))) != 0)))
|
||||
#define CSR_BIT_SET(val, bit) ((val) |= (1UL << (bit)))
|
||||
#define CSR_BIT_UNSET(val, bit) ((val) &= ~(1UL << (bit)))
|
||||
#define CSR_BIT_TOGGLE(val, bit) ((val) ^= (1UL << (bit)))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Endian conversion */
|
||||
/*------------------------------------------------------------------*/
|
||||
#define CSR_GET_UINT16_FROM_LITTLE_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[0]) | ((CsrUint16) ((CsrUint8 *) (ptr))[1]) << 8)
|
||||
#define CSR_GET_UINT32_FROM_LITTLE_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[0]) | ((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 8 | \
|
||||
((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[3]) << 24)
|
||||
#define CSR_COPY_UINT16_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x00FF)); \
|
||||
((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) >> 8))
|
||||
#define CSR_COPY_UINT32_TO_LITTLE_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[3] = ((CsrUint8) (((uint) >> 24) & 0x000000FF))
|
||||
#define CSR_GET_UINT16_FROM_BIG_ENDIAN(ptr) (((CsrUint16) ((CsrUint8 *) (ptr))[1]) | ((CsrUint16) ((CsrUint8 *) (ptr))[0]) << 8)
|
||||
#define CSR_GET_UINT24_FROM_BIG_ENDIAN(ptr) (((CsrUint24) ((CsrUint8 *) (ptr))[2]) | \
|
||||
((CsrUint24) ((CsrUint8 *) (ptr))[1]) << 8 | ((CsrUint24) ((CsrUint8 *) (ptr))[0]) << 16)
|
||||
#define CSR_GET_UINT32_FROM_BIG_ENDIAN(ptr) (((CsrUint32) ((CsrUint8 *) (ptr))[3]) | ((CsrUint32) ((CsrUint8 *) (ptr))[2]) << 8 | \
|
||||
((CsrUint32) ((CsrUint8 *) (ptr))[1]) << 16 | ((CsrUint32) ((CsrUint8 *) (ptr))[0]) << 24)
|
||||
#define CSR_COPY_UINT16_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[1] = ((CsrUint8) ((uint) & 0x00FF)); \
|
||||
((CsrUint8 *) (ptr))[0] = ((CsrUint8) ((uint) >> 8))
|
||||
#define CSR_COPY_UINT24_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[2] = ((CsrUint8) ((uint) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 16) & 0x000000FF))
|
||||
#define CSR_COPY_UINT32_TO_BIG_ENDIAN(uint, ptr) ((CsrUint8 *) (ptr))[3] = ((CsrUint8) ((uint) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[2] = ((CsrUint8) (((uint) >> 8) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[1] = ((CsrUint8) (((uint) >> 16) & 0x000000FF)); \
|
||||
((CsrUint8 *) (ptr))[0] = ((CsrUint8) (((uint) >> 24) & 0x000000FF))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* XAP conversion macros */
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
#define CSR_LSB16(a) ((CsrUint8) ((a) & 0x00ff))
|
||||
#define CSR_MSB16(b) ((CsrUint8) ((b) >> 8))
|
||||
|
||||
#define CSR_CONVERT_8_FROM_XAP(output, input) \
|
||||
(output) = ((CsrUint8) (input));(input) += 2
|
||||
|
||||
#define CSR_CONVERT_16_FROM_XAP(output, input) \
|
||||
(output) = (CsrUint16) ((((CsrUint16) (input)[1]) << 8) | \
|
||||
((CsrUint16) (input)[0]));(input) += 2
|
||||
|
||||
#define CSR_CONVERT_32_FROM_XAP(output, input) \
|
||||
(output) = (((CsrUint32) (input)[1]) << 24) | \
|
||||
(((CsrUint32) (input)[0]) << 16) | \
|
||||
(((CsrUint32) (input)[3]) << 8) | \
|
||||
((CsrUint32) (input)[2]);input += 4
|
||||
|
||||
#define CSR_ADD_UINT8_TO_XAP(output, input) \
|
||||
(output)[0] = (input); \
|
||||
(output)[1] = 0;(output) += 2
|
||||
|
||||
#define CSR_ADD_UINT16_TO_XAP(output, input) \
|
||||
(output)[0] = ((CsrUint8) ((input) & 0x00FF)); \
|
||||
(output)[1] = ((CsrUint8) ((input) >> 8));(output) += 2
|
||||
|
||||
#define CSR_ADD_UINT32_TO_XAP(output, input) \
|
||||
(output)[0] = ((CsrUint8) (((input) >> 16) & 0x00FF)); \
|
||||
(output)[1] = ((CsrUint8) ((input) >> 24)); \
|
||||
(output)[2] = ((CsrUint8) ((input) & 0x00FF)); \
|
||||
(output)[3] = ((CsrUint8) (((input) >> 8) & 0x00FF));(output) += 4
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Misc */
|
||||
/*------------------------------------------------------------------*/
|
||||
#define CSRMAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define CSRMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
/* Use this macro on unused local variables that cannot be removed (such as
|
||||
unused function parameters). This will quell warnings from certain compilers
|
||||
and static code analysis tools like Lint and Valgrind. */
|
||||
#define CSR_UNUSED(x) ((void) (x))
|
||||
|
||||
#define CSR_TOUPPER(character) (((character) >= 'a') && ((character) <= 'z') ? ((character) - 0x20) : (character))
|
||||
#define CSR_TOLOWER(character) (((character) >= 'A') && ((character) <= 'Z') ? ((character) + 0x20) : (character))
|
||||
#define CSR_ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
25
drivers/staging/csr/csr_msg_transport.h
Normal file
25
drivers/staging/csr/csr_msg_transport.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef CSR_MSG_TRANSPORT_H__
|
||||
#define CSR_MSG_TRANSPORT_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CsrMsgTransport
|
||||
#define CsrMsgTransport CsrSchedMessagePut
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_MSG_TRANSPORT */
|
324
drivers/staging/csr/csr_msgconv.c
Normal file
324
drivers/staging/csr/csr_msgconv.c
Normal file
|
@ -0,0 +1,324 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_panic.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_msgconv.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
static CsrMsgConvEntry *converter;
|
||||
|
||||
CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr = NULL;
|
||||
|
||||
if (converter)
|
||||
{
|
||||
ptr = converter->profile_converters;
|
||||
while (ptr)
|
||||
{
|
||||
if (ptr->primType == primType)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = ptr->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static const CsrMsgConvMsgEntry *find_msg_converter(CsrMsgConvPrimEntry *ptr, CsrUint16 msgType)
|
||||
{
|
||||
const CsrMsgConvMsgEntry *cv = ptr->conv;
|
||||
if (ptr->lookupFunc)
|
||||
{
|
||||
return (const CsrMsgConvMsgEntry *) ptr->lookupFunc((CsrMsgConvMsgEntry *) cv, msgType);
|
||||
}
|
||||
|
||||
while (cv)
|
||||
{
|
||||
if (cv->serFunc == NULL)
|
||||
{
|
||||
/* We've reached the end of the chain */
|
||||
cv = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cv->msgType == msgType)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
cv++;
|
||||
}
|
||||
}
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
static void *deserialize_data(CsrUint16 primType,
|
||||
CsrSize length,
|
||||
CsrUint8 *data)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr;
|
||||
CsrUint8 *ret;
|
||||
|
||||
ptr = CsrMsgConvFind(primType);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
const CsrMsgConvMsgEntry *cv;
|
||||
CsrUint16 msgId = 0;
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&msgId, data, &offset);
|
||||
|
||||
cv = find_msg_converter(ptr, msgId);
|
||||
if (cv)
|
||||
{
|
||||
ret = cv->deserFunc(data, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CsrSize sizeof_message(CsrUint16 primType, void *msg)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
|
||||
CsrSize ret;
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
const CsrMsgConvMsgEntry *cv;
|
||||
CsrUint16 msgId = *(CsrUint16 *) msg;
|
||||
|
||||
cv = find_msg_converter(ptr, msgId);
|
||||
if (cv)
|
||||
{
|
||||
ret = cv->sizeofFunc(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CsrBool free_message(CsrUint16 primType, CsrUint8 *data)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr;
|
||||
CsrBool ret;
|
||||
|
||||
ptr = CsrMsgConvFind(primType);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
const CsrMsgConvMsgEntry *cv;
|
||||
CsrUint16 msgId = *(CsrUint16 *) data;
|
||||
|
||||
cv = find_msg_converter(ptr, msgId);
|
||||
if (cv)
|
||||
{
|
||||
cv->freeFunc(data);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static CsrUint8 *serialize_message(CsrUint16 primType,
|
||||
void *msg,
|
||||
CsrSize *length,
|
||||
CsrUint8 *buffer)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr;
|
||||
CsrUint8 *ret;
|
||||
|
||||
ptr = CsrMsgConvFind(primType);
|
||||
|
||||
*length = 0;
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
const CsrMsgConvMsgEntry *cv;
|
||||
|
||||
cv = find_msg_converter(ptr, *(CsrUint16 *) msg);
|
||||
if (cv)
|
||||
{
|
||||
ret = cv->serFunc(buffer, length, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg)
|
||||
{
|
||||
return sizeof_message(primType, msg);
|
||||
}
|
||||
|
||||
CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg)
|
||||
{
|
||||
if (converter)
|
||||
{
|
||||
CsrSize serializedLength;
|
||||
CsrUint8 *bufSerialized;
|
||||
CsrUint8 *bufOffset = &buffer[*offset];
|
||||
bufSerialized = converter->serialize_message(primType, msg, &serializedLength, bufOffset);
|
||||
*offset += serializedLength;
|
||||
return bufSerialized;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert profile converter at head of converter list. */
|
||||
void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce)
|
||||
{
|
||||
CsrMsgConvPrimEntry *pc;
|
||||
pc = CsrMsgConvFind(primType);
|
||||
|
||||
if (pc)
|
||||
{
|
||||
/* Already registered. Do nothing */
|
||||
}
|
||||
else
|
||||
{
|
||||
pc = CsrPmemAlloc(sizeof(*pc));
|
||||
pc->primType = primType;
|
||||
pc->conv = ce;
|
||||
pc->lookupFunc = NULL;
|
||||
pc->next = converter->profile_converters;
|
||||
converter->profile_converters = pc;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMsgConvInsert);
|
||||
|
||||
CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
|
||||
if (ptr)
|
||||
{
|
||||
return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMsgConvFindEntry);
|
||||
|
||||
CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
|
||||
if (ptr && msg)
|
||||
{
|
||||
CsrUint16 msgType = *((CsrUint16 *) msg);
|
||||
return (CsrMsgConvMsgEntry *) find_msg_converter(ptr, msgType);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc)
|
||||
{
|
||||
CsrMsgConvPrimEntry *ptr = CsrMsgConvFind(primType);
|
||||
if (ptr)
|
||||
{
|
||||
ptr->lookupFunc = lookupFunc;
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMsgConvCustomLookupRegister);
|
||||
|
||||
CsrMsgConvEntry *CsrMsgConvInit(void)
|
||||
{
|
||||
if (!converter)
|
||||
{
|
||||
converter = (CsrMsgConvEntry *) CsrPmemAlloc(sizeof(CsrMsgConvEntry));
|
||||
|
||||
converter->profile_converters = NULL;
|
||||
converter->free_message = free_message;
|
||||
converter->sizeof_message = sizeof_message;
|
||||
converter->serialize_message = serialize_message;
|
||||
converter->deserialize_data = deserialize_data;
|
||||
}
|
||||
|
||||
return converter;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMsgConvInit);
|
||||
|
||||
CsrMsgConvEntry *CsrMsgConvGet(void)
|
||||
{
|
||||
return converter;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SHUTDOWN
|
||||
void CsrMsgConvDeinit(void)
|
||||
{
|
||||
CsrMsgConvPrimEntry *s;
|
||||
|
||||
if (converter == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Walk converter list and free elements. */
|
||||
s = converter->profile_converters;
|
||||
while (s)
|
||||
{
|
||||
CsrMsgConvPrimEntry *s_next;
|
||||
s_next = s->next;
|
||||
CsrPmemFree(s);
|
||||
s = s_next;
|
||||
}
|
||||
|
||||
CsrPmemFree(converter);
|
||||
converter = NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMsgConvDeinit);
|
||||
|
||||
#endif /* ENABLE_SHUTDOWN */
|
145
drivers/staging/csr/csr_msgconv.h
Normal file
145
drivers/staging/csr/csr_msgconv.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
#ifndef CSR_MSGCONV_H__
|
||||
#define CSR_MSGCONV_H__
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_unicode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef CsrSize (CsrMsgSizeofFunc)(void *msg);
|
||||
typedef CsrUint8 *(CsrMsgSerializeFunc)(CsrUint8 *buffer, CsrSize *length, void *msg);
|
||||
typedef void (CsrMsgFreeFunc)(void *msg);
|
||||
typedef void *(CsrMsgDeserializeFunc)(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
/* Converter entry for one message type */
|
||||
typedef struct CsrMsgConvMsgEntry
|
||||
{
|
||||
CsrUint16 msgType;
|
||||
CsrMsgSizeofFunc *sizeofFunc;
|
||||
CsrMsgSerializeFunc *serFunc;
|
||||
CsrMsgDeserializeFunc *deserFunc;
|
||||
CsrMsgFreeFunc *freeFunc;
|
||||
} CsrMsgConvMsgEntry;
|
||||
|
||||
/* Optional lookup function */
|
||||
typedef CsrMsgConvMsgEntry *(CsrMsgCustomLookupFunc)(CsrMsgConvMsgEntry *ce, CsrUint16 msgType);
|
||||
|
||||
/* All converter entries for one specific primitive */
|
||||
typedef struct CsrMsgConvPrimEntry
|
||||
{
|
||||
CsrUint16 primType;
|
||||
const CsrMsgConvMsgEntry *conv;
|
||||
CsrMsgCustomLookupFunc *lookupFunc;
|
||||
struct CsrMsgConvPrimEntry *next;
|
||||
} CsrMsgConvPrimEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrMsgConvPrimEntry *profile_converters;
|
||||
void *(*deserialize_data)(CsrUint16 primType, CsrSize length, CsrUint8 * data);
|
||||
CsrBool (*free_message)(CsrUint16 primType, CsrUint8 *data);
|
||||
CsrSize (*sizeof_message)(CsrUint16 primType, void *msg);
|
||||
CsrUint8 *(*serialize_message)(CsrUint16 primType, void *msg,
|
||||
CsrSize * length,
|
||||
CsrUint8 * buffer);
|
||||
} CsrMsgConvEntry;
|
||||
|
||||
CsrSize CsrMsgConvSizeof(CsrUint16 primType, void *msg);
|
||||
CsrUint8 *CsrMsgConvSerialize(CsrUint8 *buffer, CsrSize maxBufferOffset, CsrSize *offset, CsrUint16 primType, void *msg);
|
||||
void CsrMsgConvCustomLookupRegister(CsrUint16 primType, CsrMsgCustomLookupFunc *lookupFunc);
|
||||
void CsrMsgConvInsert(CsrUint16 primType, const CsrMsgConvMsgEntry *ce);
|
||||
CsrMsgConvPrimEntry *CsrMsgConvFind(CsrUint16 primType);
|
||||
CsrMsgConvMsgEntry *CsrMsgConvFindEntry(CsrUint16 primType, CsrUint16 msgType);
|
||||
CsrMsgConvMsgEntry *CsrMsgConvFindEntryByMsg(CsrUint16 primType, const void *msg);
|
||||
CsrMsgConvEntry *CsrMsgConvGet(void);
|
||||
CsrMsgConvEntry *CsrMsgConvInit(void);
|
||||
#ifdef ENABLE_SHUTDOWN
|
||||
void CsrMsgConvDeinit(void);
|
||||
#endif /* ENABLE_SHUTDOWN */
|
||||
|
||||
/* SHOULD BE INTERNAL TO FRAMEWORK AKA DEPRECATED */
|
||||
|
||||
CsrUint32 CsrCharStringSerLen(const CsrCharString *str);
|
||||
CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str);
|
||||
CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str);
|
||||
|
||||
/* Prototypes for primitive type serializers */
|
||||
void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value);
|
||||
void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value);
|
||||
void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value);
|
||||
void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length);
|
||||
void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value);
|
||||
void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value);
|
||||
void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value);
|
||||
void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr);
|
||||
void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value);
|
||||
|
||||
void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length);
|
||||
void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset);
|
||||
|
||||
CsrSize CsrEventSizeof(void *msg);
|
||||
CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventDes(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint8Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint16Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint32Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg);
|
||||
CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
22
drivers/staging/csr/csr_panic.c
Normal file
22
drivers/staging/csr/csr_panic.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_panic.h"
|
||||
|
||||
void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p)
|
||||
{
|
||||
BUG_ON(1);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrPanic);
|
55
drivers/staging/csr/csr_panic.h
Normal file
55
drivers/staging/csr/csr_panic.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#ifndef CSR_PANIC_H__
|
||||
#define CSR_PANIC_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Synergy techonology ID definitions */
|
||||
#define CSR_TECH_FW 0
|
||||
#define CSR_TECH_BT 1
|
||||
#define CSR_TECH_WIFI 2
|
||||
#define CSR_TECH_GPS 3
|
||||
#define CSR_TECH_NFC 4
|
||||
|
||||
/* Panic type ID definitions for technology type CSR_TECH_FW */
|
||||
#define CSR_PANIC_FW_UNEXPECTED_VALUE 0
|
||||
#define CSR_PANIC_FW_HEAP_EXHAUSTION 1
|
||||
#define CSR_PANIC_FW_INVALID_PFREE_POINTER 2
|
||||
#define CSR_PANIC_FW_EXCEPTION 3
|
||||
#define CSR_PANIC_FW_ASSERTION_FAIL 4
|
||||
#define CSR_PANIC_FW_NULL_TASK_HANDLER 5
|
||||
#define CSR_PANIC_FW_UNKNOWN_TASK 6
|
||||
#define CSR_PANIC_FW_QUEUE_ACCESS_VIOLATION 7
|
||||
#define CSR_PANIC_FW_TOO_MANY_MESSAGES 8
|
||||
#define CSR_PANIC_FW_TOO_MANY_TIMED_EVENTS 9
|
||||
#define CSR_PANIC_FW_ABCSP_SYNC_LOST 10
|
||||
#define CSR_PANIC_FW_OVERSIZE_ABCSP_PRIM 11
|
||||
#define CSR_PANIC_FW_H4_CORRUPTION 12
|
||||
#define CSR_PANIC_FW_H4_SYNC_LOST 13
|
||||
#define CSR_PANIC_FW_H4_RX_OVERRUN 14
|
||||
#define CSR_PANIC_FW_H4_TX_OVERRUN 15
|
||||
#define CSR_PANIC_FW_TM_BC_RESTART_FAIL 16
|
||||
#define CSR_PANIC_FW_TM_BC_START_FAIL 17
|
||||
#define CSR_PANIC_FW_TM_BC_BAD_STATE 18
|
||||
#define CSR_PANIC_FW_TM_BC_TRANSPORT_LOST 19
|
||||
|
||||
/* Panic interface used by technologies */
|
||||
/* DEPRECATED - replaced by csr_log_text.h */
|
||||
void CsrPanic(CsrUint8 tech, CsrUint16 reason, const char *p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_PANIC_H__ */
|
51
drivers/staging/csr/csr_pmem.c
Normal file
51
drivers/staging/csr/csr_pmem.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
#include <linux/autoconf.h>
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "csr_panic.h"
|
||||
#include "csr_pmem.h"
|
||||
|
||||
void *CsrPmemAlloc(CsrSize size)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = kmalloc(size, GFP_KERNEL);
|
||||
if (!ret)
|
||||
{
|
||||
CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_HEAP_EXHAUSTION,
|
||||
"out of memory");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrPmemAlloc);
|
||||
|
||||
void CsrPmemFree(void *ptr)
|
||||
{
|
||||
if (ptr == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
kfree(ptr);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrPmemFree);
|
143
drivers/staging/csr/csr_pmem.h
Normal file
143
drivers/staging/csr/csr_pmem.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
#ifndef CSR_PMEM_H__
|
||||
#define CSR_PMEM_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_PMEM_DEBUG_ENABLE
|
||||
/*****************************************************************************
|
||||
|
||||
NAME
|
||||
CsrPmemAlloc
|
||||
|
||||
DESCRIPTION
|
||||
This function will allocate a contiguous block of memory of at least
|
||||
the specified size in bytes and return a pointer to the allocated
|
||||
memory. This function is not allowed to return NULL. A size of 0 is a
|
||||
valid request, and a unique and valid (not NULL) pointer must be
|
||||
returned in this case.
|
||||
|
||||
PARAMETERS
|
||||
size - Size of memory requested. Note that a size of 0 is valid.
|
||||
|
||||
RETURNS
|
||||
Pointer to allocated memory.
|
||||
|
||||
*****************************************************************************/
|
||||
#ifdef CSR_PMEM_DEBUG
|
||||
void *CsrPmemAllocDebug(CsrSize size,
|
||||
const CsrCharString *file, CsrUint32 line);
|
||||
#define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__)
|
||||
#else
|
||||
void *CsrPmemAlloc(CsrSize size);
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
NAME
|
||||
CsrPmemFree
|
||||
|
||||
DESCRIPTION
|
||||
This function will deallocate a previously allocated block of memory.
|
||||
|
||||
PARAMETERS
|
||||
ptr - Pointer to allocated memory.
|
||||
|
||||
*****************************************************************************/
|
||||
void CsrPmemFree(void *ptr);
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
NAME
|
||||
CsrPmemZalloc
|
||||
|
||||
DESCRIPTION
|
||||
This function is equivalent to CsrPmemAlloc, but the allocated memory
|
||||
is initialised to zero.
|
||||
|
||||
PARAMETERS
|
||||
size - Size of memory requested. Note that a size of 0 is valid.
|
||||
|
||||
RETURNS
|
||||
Pointer to allocated memory.
|
||||
|
||||
*****************************************************************************/
|
||||
#define CsrPmemZalloc(s) (CsrMemSet(CsrPmemAlloc(s), 0x00, (s)))
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
NAME
|
||||
pnew and zpnew
|
||||
|
||||
DESCRIPTIOM
|
||||
Type-safe wrappers for CsrPmemAlloc and CsrPmemZalloc, for allocating
|
||||
single instances of a specified and named type.
|
||||
|
||||
PARAMETERS
|
||||
t - type to allocate.
|
||||
|
||||
*****************************************************************************/
|
||||
#define pnew(t) ((t *) (CsrPmemAlloc(sizeof(t))))
|
||||
#define zpnew(t) ((t *) (CsrPmemZalloc(sizeof(t))))
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Csr Pmem Debug code. Allows custom callbacks on CsrPmemAlloc and CsrPmemFree
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifdef CSR_PMEM_DEBUG_ENABLE
|
||||
|
||||
typedef CsrUint8 CsrPmemDebugAllocType;
|
||||
#define CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC 1
|
||||
#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC 2
|
||||
#define CSR_PMEM_DEBUG_TYPE_MEM_CALLOC 3
|
||||
#define CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA 4
|
||||
|
||||
typedef void (CsrPmemDebugOnAlloc)(void *ptr, void *userptr, CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line);
|
||||
typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrPmemInstallHooks
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Install debug hooks for memory allocation
|
||||
* Use NULL values to uninstall the hooks
|
||||
* headSize = The number of extra bytes to allocate in the head of the Allocated buffer
|
||||
* footSize = The number of extra bytes to allocate in the end of the Allocated buffer
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrPmemDebugInstallHooks(CsrUint8 headSize, CsrUint8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback);
|
||||
|
||||
void *CsrPmemDebugAlloc(CsrSize size, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line);
|
||||
#define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__)
|
||||
|
||||
void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const CsrCharString* file, CsrUint32 line);
|
||||
#define CsrPmemFree(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
64
drivers/staging/csr/csr_prim_defs.h
Normal file
64
drivers/staging/csr/csr_prim_defs.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef CSR_PRIM_DEFS_H__
|
||||
#define CSR_PRIM_DEFS_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Segmentation of primitives in upstream and downstream segment
|
||||
************************************************************************************/
|
||||
typedef CsrUint16 CsrPrim;
|
||||
#define CSR_PRIM_UPSTREAM ((CsrPrim) (0x8000))
|
||||
|
||||
/************************************************************************************
|
||||
* Primitive definitions for Synergy framework
|
||||
************************************************************************************/
|
||||
#define CSR_SYNERGY_EVENT_CLASS_BASE ((CsrUint16) (0x0600))
|
||||
|
||||
#define CSR_HCI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_BCCMD_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_HQ_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_VM_PRIM ((CsrUint16) (0x0003 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_TM_BLUECORE_PRIM ((CsrUint16) (0x0004 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_FP_PRIM ((CsrUint16) (0x0005 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_IP_SOCKET_PRIM ((CsrUint16) (0x0006 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_IP_ETHER_PRIM ((CsrUint16) (0x0007 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_IP_IFCONFIG_PRIM ((CsrUint16) (0x0008 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_IP_INTERNAL_PRIM ((CsrUint16) (0x0009 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_FSAL_PRIM ((CsrUint16) (0x000A | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_DATA_STORE_PRIM ((CsrUint16) (0x000B | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_AM_PRIM ((CsrUint16) (0x000C | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_TLS_PRIM ((CsrUint16) (0x000D | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_DHCP_SERVER_PRIM ((CsrUint16) (0x000E | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_TFTP_PRIM ((CsrUint16) (0x000F | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_DSPM_PRIM ((CsrUint16) (0x0010 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
#define CSR_TLS_INTERNAL_PRIM ((CsrUint16) (0x0011 | CSR_SYNERGY_EVENT_CLASS_BASE))
|
||||
|
||||
#define NUMBER_OF_CSR_FW_EVENTS (CSR_DSPM_PRIM - CSR_SYNERGY_EVENT_CLASS_BASE + 1)
|
||||
|
||||
#define CSR_SYNERGY_EVENT_CLASS_MISC_BASE ((CsrUint16) (0x06A0))
|
||||
|
||||
#define CSR_UI_PRIM ((CsrUint16) (0x0000 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
|
||||
#define CSR_APP_PRIM ((CsrUint16) (0x0001 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
|
||||
#define CSR_SDIO_PROBE_PRIM ((CsrUint16) (0x0002 | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
|
||||
|
||||
#define NUMBER_OF_CSR_FW_MISC_EVENTS (CSR_SDIO_PROBE_PRIM - CSR_SYNERGY_EVENT_CLASS_MISC_BASE + 1)
|
||||
|
||||
#define CSR_ENV_PRIM ((CsrUint16) (0x00FF | CSR_SYNERGY_EVENT_CLASS_MISC_BASE))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_PRIM_DEFS_H__ */
|
27
drivers/staging/csr/csr_result.h
Normal file
27
drivers/staging/csr/csr_result.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef CSR_RESULT_H__
|
||||
#define CSR_RESULT_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef CsrUint16 CsrResult;
|
||||
#define CSR_RESULT_SUCCESS ((CsrResult) 0x0000)
|
||||
#define CSR_RESULT_FAILURE ((CsrResult) 0xFFFF)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
292
drivers/staging/csr/csr_sched.h
Normal file
292
drivers/staging/csr/csr_sched.h
Normal file
|
@ -0,0 +1,292 @@
|
|||
#ifndef CSR_SCHED_H__
|
||||
#define CSR_SCHED_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_types.h"
|
||||
#include "csr_time.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* An identifier issued by the scheduler. */
|
||||
typedef CsrUint32 CsrSchedIdentifier;
|
||||
|
||||
/* A task identifier */
|
||||
typedef CsrUint16 CsrSchedTaskId;
|
||||
|
||||
/* A queue identifier */
|
||||
typedef CsrUint16 CsrSchedQid;
|
||||
#define CSR_SCHED_QID_INVALID ((CsrSchedQid) 0xFFFF)
|
||||
|
||||
/* A message identifier */
|
||||
typedef CsrSchedIdentifier CsrSchedMsgId;
|
||||
|
||||
/* A timer event identifier */
|
||||
typedef CsrSchedIdentifier CsrSchedTid;
|
||||
#define CSR_SCHED_TID_INVALID ((CsrSchedTid) 0)
|
||||
|
||||
/* Scheduler entry functions share this structure */
|
||||
typedef void (*schedEntryFunction_t)(void **inst);
|
||||
|
||||
/* Time constants. */
|
||||
#define CSR_SCHED_TIME_MAX ((CsrTime) 0xFFFFFFFF)
|
||||
#define CSR_SCHED_MILLISECOND ((CsrTime) (1000))
|
||||
#define CSR_SCHED_SECOND ((CsrTime) (1000 * CSR_SCHED_MILLISECOND))
|
||||
#define CSR_SCHED_MINUTE ((CsrTime) (60 * CSR_SCHED_SECOND))
|
||||
|
||||
/* Queue and primitive that identifies the environment */
|
||||
#define CSR_SCHED_TASK_ID 0xFFFF
|
||||
#define CSR_SCHED_PRIM (CSR_SCHED_TASK_ID)
|
||||
#define CSR_SCHED_EXCLUDED_MODULE_QUEUE 0xFFFF
|
||||
|
||||
/*
|
||||
* Background interrupt definitions
|
||||
*/
|
||||
typedef CsrUint16 CsrSchedBgint;
|
||||
#define CSR_SCHED_BGINT_INVALID ((CsrSchedBgint) 0xFFFF)
|
||||
|
||||
typedef void (*CsrSchedBgintHandler)(void *);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedBgintReg
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Register a background interrupt handler function with the scheduler.
|
||||
* When CsrSchedBgint() is called from the foreground (e.g. an interrupt
|
||||
* routine) the registered function is called.
|
||||
*
|
||||
* If "cb" is null then the interrupt is effectively disabled. If a
|
||||
* no bgints are available, CSR_SCHED_BGINT_INVALID is returned, otherwise
|
||||
* a CsrSchedBgint value is returned to be used in subsequent calls to
|
||||
* CsrSchedBgint(). id is a possibly NULL identifier used for logging
|
||||
* purposes only.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrSchedBgint -- CSR_SCHED_BGINT_INVALID denotes failure to obtain a CsrSchedBgintSet.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrSchedBgint CsrSchedBgintReg(CsrSchedBgintHandler cb,
|
||||
void *context,
|
||||
const CsrCharString *id);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedBgintUnreg
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unregister a background interrupt handler function.
|
||||
*
|
||||
* ``irq'' is a background interrupt handle previously obtained
|
||||
* from a call to CsrSchedBgintReg().
|
||||
*
|
||||
* RETURNS
|
||||
* void.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSchedBgintUnreg(CsrSchedBgint bgint);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedBgintSet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Set background interrupt.
|
||||
*
|
||||
* RETURNS
|
||||
* void.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSchedBgintSet(CsrSchedBgint bgint);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedMessagePut
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Sends a message consisting of the integer "mi" and the void * pointer
|
||||
* "mv" to the message queue "q".
|
||||
*
|
||||
* "mi" and "mv" are neither inspected nor changed by the scheduler - the
|
||||
* task that owns "q" is expected to make sense of the values. "mv" may
|
||||
* be null.
|
||||
*
|
||||
* NOTE
|
||||
* If "mv" is not null then it will typically be a chunk of CsrPmemAlloc()ed
|
||||
* memory, though there is no need for it to be so. Tasks should normally
|
||||
* obey the convention that when a message built with CsrPmemAlloc()ed memory
|
||||
* is given to CsrSchedMessagePut() then ownership of the memory is ceded to the
|
||||
* scheduler - and eventually to the recipient task. I.e., the receiver of
|
||||
* the message will be expected to CsrPmemFree() the message storage.
|
||||
*
|
||||
* RETURNS
|
||||
* void.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
|
||||
void CsrSchedMessagePutStringLog(CsrSchedQid q,
|
||||
CsrUint16 mi,
|
||||
void *mv,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
#define CsrSchedMessagePut(q, mi, mv) CsrSchedMessagePutStringLog((q), (mi), (mv), __LINE__, __FILE__)
|
||||
#else
|
||||
void CsrSchedMessagePut(CsrSchedQid q,
|
||||
CsrUint16 mi,
|
||||
void *mv);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedMessageBroadcast
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Sends a message to all tasks.
|
||||
*
|
||||
* The user must supply a "factory function" that is called once
|
||||
* for every task that exists. The "factory function", msg_build_func,
|
||||
* must allocate and initialise the message and set the msg_build_ptr
|
||||
* to point to the message when done.
|
||||
*
|
||||
* NOTE
|
||||
* N/A
|
||||
*
|
||||
* RETURNS
|
||||
* void
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
|
||||
void CsrSchedMessageBroadcastStringLog(CsrUint16 mi,
|
||||
void *(*msg_build_func)(void *),
|
||||
void *msg_build_ptr,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
#define CsrSchedMessageBroadcast(mi, fn, ptr) CsrSchedMessageBroadcastStringLog((mi), (fn), (ptr), __LINE__, __FILE__)
|
||||
#else
|
||||
void CsrSchedMessageBroadcast(CsrUint16 mi,
|
||||
void *(*msg_build_func)(void *),
|
||||
void *msg_build_ptr);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedMessageGet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Obtains a message from the message queue belonging to the calling task.
|
||||
* The message consists of one or both of a CsrUint16 and a void *.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrBool - TRUE if a message has been obtained from the queue, else FALSE.
|
||||
* If a message is taken from the queue, then "*pmi" and "*pmv" are set to
|
||||
* the "mi" and "mv" passed to CsrSchedMessagePut() respectively.
|
||||
*
|
||||
* "pmi" and "pmv" can be null, in which case the corresponding value from
|
||||
* them message is discarded.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrBool CsrSchedMessageGet(CsrUint16 *pmi, void **pmv);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedTimerSet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Causes the void function "fn" to be called with the arguments
|
||||
* "fniarg" and "fnvarg" after "delay" has elapsed.
|
||||
*
|
||||
* "delay" must be less than half the range of a CsrTime.
|
||||
*
|
||||
* CsrSchedTimerSet() does nothing with "fniarg" and "fnvarg" except
|
||||
* deliver them via a call to "fn()". (Unless CsrSchedTimerCancel()
|
||||
* is used to prevent delivery.)
|
||||
*
|
||||
* NOTE
|
||||
* The function will be called at or after "delay"; the actual delay will
|
||||
* depend on the timing behaviour of the scheduler's tasks.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrSchedTid - A timed event identifier, can be used in CsrSchedTimerCancel().
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
|
||||
CsrSchedTid CsrSchedTimerSetStringLog(CsrTime delay,
|
||||
void (*fn)(CsrUint16 mi, void *mv),
|
||||
CsrUint16 fniarg,
|
||||
void *fnvarg,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
#define CsrSchedTimerSet(d, fn, fni, fnv) CsrSchedTimerSetStringLog((d), (fn), (fni), (fnv), __LINE__, __FILE__)
|
||||
#else
|
||||
CsrSchedTid CsrSchedTimerSet(CsrTime delay,
|
||||
void (*fn)(CsrUint16 mi, void *mv),
|
||||
CsrUint16 fniarg,
|
||||
void *fnvarg);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedTimerCancel
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Attempts to prevent the timed event with identifier "eventid" from
|
||||
* occurring.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrBool - TRUE if cancelled, FALSE if the event has already occurred.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if defined(CSR_LOG_ENABLE) && defined(CSR_LOG_INCLUDE_FILE_NAME_AND_LINE_NUMBER)
|
||||
CsrBool CsrSchedTimerCancelStringLog(CsrSchedTid eventid,
|
||||
CsrUint16 *pmi,
|
||||
void **pmv,
|
||||
CsrUint32 line,
|
||||
const CsrCharString *file);
|
||||
#define CsrSchedTimerCancel(e, pmi, pmv) CsrSchedTimerCancelStringLog((e), (pmi), (pmv), __LINE__, __FILE__)
|
||||
#else
|
||||
CsrBool CsrSchedTimerCancel(CsrSchedTid eventid,
|
||||
CsrUint16 *pmi,
|
||||
void **pmv);
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedTaskQueueGet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Return the queue identifier for the currently running queue
|
||||
*
|
||||
* RETURNS
|
||||
* CsrSchedQid - The current task queue identifier, or 0xFFFF if not available.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrSchedQid CsrSchedTaskQueueGet(void);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSchedTaskQueueGet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Return the queue identifier for the currently running queue
|
||||
*
|
||||
* RETURNS
|
||||
* CsrCharString - The current task queue identifier, or 0xFFFF if not available.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrCharString* CsrSchedTaskNameGet(CsrSchedQid );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
732
drivers/staging/csr/csr_sdio.h
Normal file
732
drivers/staging/csr/csr_sdio.h
Normal file
|
@ -0,0 +1,732 @@
|
|||
#ifndef CSR_SDIO_H__
|
||||
#define CSR_SDIO_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_result.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Result Codes */
|
||||
#define CSR_SDIO_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */
|
||||
#define CSR_SDIO_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */
|
||||
#define CSR_SDIO_RESULT_CRC_ERROR ((CsrResult) 3) /* The transmitted/received data or command response contained a CRC error */
|
||||
#define CSR_SDIO_RESULT_TIMEOUT ((CsrResult) 4) /* No command response or data received from device, or function enable/disable did not succeed within timeout period */
|
||||
#define CSR_SDIO_RESULT_NOT_RESET ((CsrResult) 5) /* The device was not reset */
|
||||
|
||||
/* Features (for use in features member of CsrSdioFunction) */
|
||||
#define CSR_SDIO_FEATURE_BYTE_MODE 0x00000001 /* Transfer sizes do not have to be a multiple of block size */
|
||||
#define CSR_SDIO_FEATURE_DMA_CAPABLE_MEM_REQUIRED 0x00000002 /* Bulk operations require DMA friendly memory */
|
||||
|
||||
/* CsrSdioFunctionId wildcards (for use in CsrSdioFunctionId members) */
|
||||
#define CSR_SDIO_ANY_MANF_ID 0xFFFF
|
||||
#define CSR_SDIO_ANY_CARD_ID 0xFFFF
|
||||
#define CSR_SDIO_ANY_SDIO_FUNCTION 0xFF
|
||||
#define CSR_SDIO_ANY_SDIO_INTERFACE 0xFF
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionId
|
||||
*
|
||||
* DESCRIPTION
|
||||
* This structure describes one or more functions of a device, based on
|
||||
* four qualitative measures. The CsrSdioFunctionId wildcard defines can be
|
||||
* used for making the CsrSdioFunctionId match more than one function.
|
||||
*
|
||||
* MEMBERS
|
||||
* manfId - Vendor ID (or CSR_SDIO_ANY_MANF_ID).
|
||||
* cardId - Device ID (or CSR_SDIO_ANY_CARD_ID).
|
||||
* sdioFunction - SDIO Function number (or CSR_SDIO_ANY_SDIO_FUNCTION).
|
||||
* sdioInterface - SDIO Standard Interface Code (or CSR_SDIO_ANY_SDIO_INTERFACE)
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 manfId; /* Vendor ID to match or CSR_SDIO_ANY_MANF_ID */
|
||||
CsrUint16 cardId; /* Device ID to match or CSR_SDIO_ANY_CARD_ID */
|
||||
CsrUint8 sdioFunction; /* SDIO Function number to match or CSR_SDIO_ANY_SDIO_FUNCTION */
|
||||
CsrUint8 sdioInterface; /* SDIO Standard Interface Code to match or CSR_SDIO_ANY_SDIO_INTERFACE */
|
||||
} CsrSdioFunctionId;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunction
|
||||
*
|
||||
* DESCRIPTION
|
||||
* This structure represents a single function on a device.
|
||||
*
|
||||
* MEMBERS
|
||||
* sdioId - A CsrSdioFunctionId describing this particular function. The
|
||||
* subfield shall not contain any CsrSdioFunctionId wildcards. The
|
||||
* subfields shall describe the specific single function
|
||||
* represented by this structure.
|
||||
* blockSize - Actual configured block size, or 0 if unconfigured.
|
||||
* features - Bit mask with any of CSR_SDIO_FEATURE_* set.
|
||||
* device - Handle of device containing the function. If two functions have
|
||||
* the same device handle, they reside on the same device.
|
||||
* driverData - For use by the Function Driver. The SDIO Driver shall not
|
||||
* attempt to dereference the pointer.
|
||||
* priv - For use by the SDIO Driver. The Function Driver shall not attempt
|
||||
* to dereference the pointer.
|
||||
*
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
CsrSdioFunctionId sdioId;
|
||||
CsrUint16 blockSize; /* Actual configured block size, or 0 if unconfigured */
|
||||
CsrUint32 features; /* Bit mask with any of CSR_SDIO_FEATURE_* set */
|
||||
void *device; /* Handle of device containing the function */
|
||||
void *driverData; /* For use by the Function Driver */
|
||||
void *priv; /* For use by the SDIO Driver */
|
||||
} CsrSdioFunction;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioInsertedCallback, CsrSdioRemovedCallback
|
||||
*
|
||||
* DESCRIPTION
|
||||
* CsrSdioInsertedCallback is called when a function becomes available to
|
||||
* a registered Function Driver that supports the function.
|
||||
* CsrSdioRemovedCallback is called when a function is no longer available
|
||||
* to a Function Driver, either because the device has been removed, or the
|
||||
* Function Driver has been unregistered.
|
||||
*
|
||||
* NOTE: These functions are implemented by the Function Driver, and are
|
||||
* passed as function pointers in the CsrSdioFunctionDriver struct.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef void (*CsrSdioInsertedCallback)(CsrSdioFunction *function);
|
||||
typedef void (*CsrSdioRemovedCallback)(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioInterruptDsrCallback, CsrSdioInterruptCallback
|
||||
*
|
||||
* DESCRIPTION
|
||||
* CsrSdioInterruptCallback is called when an interrupt occurs on the
|
||||
* the device associated with the specified function.
|
||||
*
|
||||
* NOTE: These functions are implemented by the Function Driver, and are
|
||||
* passed as function pointers in the CsrSdioFunctionDriver struct.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
* RETURNS (only CsrSdioInterruptCallback)
|
||||
* A pointer to a CsrSdioInterruptDsrCallback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef void (*CsrSdioInterruptDsrCallback)(CsrSdioFunction *function);
|
||||
typedef CsrSdioInterruptDsrCallback (*CsrSdioInterruptCallback)(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioSuspendCallback, CsrSdioResumeCallback
|
||||
*
|
||||
* DESCRIPTION
|
||||
* CsrSdioSuspendCallback is called when the system is preparing to go
|
||||
* into a suspended state. CsrSdioResumeCallback is called when the system
|
||||
* has entered an active state again.
|
||||
*
|
||||
* NOTE: These functions are implemented by the Function Driver, and are
|
||||
* passed as function pointers in the CsrSdioFunctionDriver struct.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef void (*CsrSdioSuspendCallback)(CsrSdioFunction *function);
|
||||
typedef void (*CsrSdioResumeCallback)(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioAsyncCallback, CsrSdioAsyncDsrCallback
|
||||
*
|
||||
* DESCRIPTION
|
||||
* CsrSdioAsyncCallback is called when an asynchronous operation completes.
|
||||
*
|
||||
* NOTE: These functions are implemented by the Function Driver, and are
|
||||
* passed as function pointers in the function calls that initiate
|
||||
* the operation.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* result - The result of the operation that completed. See the description
|
||||
* of the initiating function for possible result values.
|
||||
*
|
||||
* RETURNS (only CsrSdioAsyncCallback)
|
||||
* A pointer to a CsrSdioAsyncDsrCallback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef void (*CsrSdioAsyncDsrCallback)(CsrSdioFunction *function, CsrResult result);
|
||||
typedef CsrSdioAsyncDsrCallback (*CsrSdioAsyncCallback)(CsrSdioFunction *function, CsrResult result);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionDriver
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Structure representing a Function Driver.
|
||||
*
|
||||
* MEMBERS
|
||||
* inserted - Callback, see description of CsrSdioInsertedCallback.
|
||||
* removed - Callback, see description of CsrSdioRemovedCallback.
|
||||
* intr - Callback, see description of CsrSdioInterruptCallback.
|
||||
* suspend - Callback, see description of CsrSdioSuspendCallback.
|
||||
* resume - Callback, see description of CsrSdioResumeCallback.
|
||||
* ids - Array of CsrSdioFunctionId describing one or more functions that
|
||||
* are supported by the Function Driver.
|
||||
* idsCount - Length of the ids array.
|
||||
* priv - For use by the SDIO Driver. The Function Driver may initialise
|
||||
* it to NULL, but shall otherwise not access the pointer or attempt
|
||||
* to dereference it.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
typedef struct
|
||||
{
|
||||
CsrSdioInsertedCallback inserted;
|
||||
CsrSdioRemovedCallback removed;
|
||||
CsrSdioInterruptCallback intr;
|
||||
CsrSdioSuspendCallback suspend;
|
||||
CsrSdioResumeCallback resume;
|
||||
CsrSdioFunctionId *ids;
|
||||
CsrUint8 idsCount;
|
||||
void *priv; /* For use by the SDIO Driver */
|
||||
} CsrSdioFunctionDriver;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionDriverRegister
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Register a Function Driver.
|
||||
*
|
||||
* PARAMETERS
|
||||
* functionDriver - Pointer to struct describing the Function Driver.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The Function Driver was successfully
|
||||
* registered.
|
||||
* CSR_RESULT_FAILURE - Unable to register the function driver,
|
||||
* because of an unspecified/unknown error. The
|
||||
* Function Driver has not been registered.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - The specified Function Driver pointer
|
||||
* does not point at a valid Function
|
||||
* Driver structure, or some of the members
|
||||
* contain invalid entries.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioFunctionDriverRegister(CsrSdioFunctionDriver *functionDriver);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionDriverUnregister
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unregister a previously registered Function Driver.
|
||||
*
|
||||
* PARAMETERS
|
||||
* functionDriver - pointer to struct describing the Function Driver.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionEnable, CsrSdioFunctionDisable
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Enable/disable the specified function by setting/clearing the
|
||||
* corresponding bit in the I/O Enable register in function 0, and then
|
||||
* periodically reading the related bit in the I/O Ready register until it
|
||||
* is set/clear, limited by an implementation defined timeout.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the
|
||||
* related bit in the I/O Enable register is
|
||||
* undefined.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related
|
||||
* bit in the I/O ready register was not
|
||||
* set/cleared within the timeout period.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioFunctionEnable(CsrSdioFunction *function);
|
||||
CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioInterruptEnable, CsrSdioInterruptDisable
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Enable/disable the interrupt for the specified function by
|
||||
* setting/clearing the corresponding bit in the INT Enable register in
|
||||
* function 0.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the
|
||||
* related bit in the INT Enable register is
|
||||
* unchanged.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be
|
||||
* enabled/disabled, because it either
|
||||
* does not exist or it is not possible to
|
||||
* individually enable/disable functions.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioInterruptEnable(CsrSdioFunction *function);
|
||||
CsrResult CsrSdioInterruptDisable(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioInterruptAcknowledge
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Acknowledge that a signalled interrupt has been handled. Shall only
|
||||
* be called once, and exactly once for each signalled interrupt to the
|
||||
* corresponding function.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function to which the
|
||||
* event was signalled.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSdioInterruptAcknowledge(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioInsertedAcknowledge, CsrSdioRemovedAcknowledge
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Acknowledge that a signalled inserted/removed event has been handled.
|
||||
* Shall only be called once, and exactly once for each signalled event to
|
||||
* the corresponding function.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function to which the
|
||||
* inserted was signalled.
|
||||
* result (CsrSdioInsertedAcknowledge only)
|
||||
* CSR_RESULT_SUCCESS - The Function Driver has accepted the
|
||||
* function, and the function is attached to
|
||||
* the Function Driver until the
|
||||
* CsrSdioRemovedCallback is called and
|
||||
* acknowledged.
|
||||
* CSR_RESULT_FAILURE - Unable to accept the function. The
|
||||
* function is not attached to the Function
|
||||
* Driver, and it may be passed to another
|
||||
* Function Driver which supports the
|
||||
* function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSdioInsertedAcknowledge(CsrSdioFunction *function, CsrResult result);
|
||||
void CsrSdioRemovedAcknowledge(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioSuspendAcknowledge, CsrSdioResumeAcknowledge
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Acknowledge that a signalled suspend event has been handled. Shall only
|
||||
* be called once, and exactly once for each signalled event to the
|
||||
* corresponding function.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function to which the
|
||||
* event was signalled.
|
||||
* result
|
||||
* CSR_RESULT_SUCCESS - Successfully suspended/resumed.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSdioSuspendAcknowledge(CsrSdioFunction *function, CsrResult result);
|
||||
void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioBlockSizeSet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Set the block size to use for the function. The actual configured block
|
||||
* size shall be the minimum of:
|
||||
* 1) Maximum block size supported by the function.
|
||||
* 2) Maximum block size supported by the host controller.
|
||||
* 3) The block size specified by the blockSize argument.
|
||||
*
|
||||
* When this function returns, the actual configured block size is
|
||||
* available in the blockSize member of the function struct.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* blockSize - Block size to use for the function. Valid range is 1 to
|
||||
* 2048.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The block size register on the chip
|
||||
* was updated.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The configured block
|
||||
* size is undefined.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER
|
||||
* bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned.
|
||||
* If the ERROR bit is set (but not FUNCTION_NUMBER),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
* NOTE: Setting the block size requires two individual operations. The
|
||||
* implementation shall ignore the OUT_OF_RANGE bit of the SDIO R5
|
||||
* response for the first operation, as the partially configured
|
||||
* block size may be out of range, even if the final block size
|
||||
* (after the second operation) is in the valid range.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, CsrUint16 blockSize);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioMaxBusClockFrequencySet
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Set the maximum clock frequency to use for the device associated with
|
||||
* the specified function. The actual configured clock frequency for the
|
||||
* device shall be the minimum of:
|
||||
* 1) Maximum clock frequency supported by the device.
|
||||
* 2) Maximum clock frequency supported by the host controller.
|
||||
* 3) Maximum clock frequency specified for any function on the same
|
||||
* device.
|
||||
*
|
||||
* If the clock frequency exceeds 25MHz, it is the responsibility of the
|
||||
* SDIO driver to enable high speed mode on the device, using the standard
|
||||
* defined procedure, before increasing the frequency beyond the limit.
|
||||
*
|
||||
* Note that the clock frequency configured affects all functions on the
|
||||
* same device.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* maxFrequency - The maximum clock frequency for the function in Hertz.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The maximum clock frequency was succesfully
|
||||
* set for the function.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and the FUNCTION_NUMBER
|
||||
* bits is set, CSR_SDIO_RESULT_INVALID_VALUE shall be returned.
|
||||
* If the ERROR bit is set (but not FUNCTION_NUMBER),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, CsrUint32 maxFrequency);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioRead8, CsrSdioWrite8, CsrSdioRead8Async, CsrSdioWrite8Async
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Read/write an 8bit value from/to the specified register address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* address - Register address within the function.
|
||||
* data - The data to read/write.
|
||||
* callback - The function to call on operation completion.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The data was successfully read/written.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
* NOTE: The CsrSdioRead8Async and CsrSdioWrite8Async functions return
|
||||
* immediately, and the supplied callback function is called when the
|
||||
* operation is complete. The result value is given as an argument to
|
||||
* the callback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioRead8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data);
|
||||
CsrResult CsrSdioWrite8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data);
|
||||
void CsrSdioRead8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback);
|
||||
void CsrSdioWrite8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioRead16, CsrSdioWrite16, CsrSdioRead16Async, CsrSdioWrite16Async
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Read/write a 16bit value from/to the specified register address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* address - Register address within the function.
|
||||
* data - The data to read/write.
|
||||
* callback - The function to call on operation completion.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The data was successfully read/written.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been
|
||||
* partially read/written.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
* NOTE: The CsrSdioRead16Async and CsrSdioWrite16Async functions return
|
||||
* immediately, and the supplied callback function is called when the
|
||||
* operation is complete. The result value is given as an argument to
|
||||
* the callback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioRead16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data);
|
||||
CsrResult CsrSdioWrite16(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data);
|
||||
void CsrSdioRead16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 *data, CsrSdioAsyncCallback callback);
|
||||
void CsrSdioWrite16Async(CsrSdioFunction *function, CsrUint32 address, CsrUint16 data, CsrSdioAsyncCallback callback);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioF0Read8, CsrSdioF0Write8, CsrSdioF0Read8Async,
|
||||
* CsrSdioF0Write8Async
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Read/write an 8bit value from/to the specified register address in
|
||||
* function 0.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* address - Register address within the function.
|
||||
* data - The data to read/write.
|
||||
* callback - The function to call on operation completion.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The data was successfully read/written.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
* NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return
|
||||
* immediately, and the supplied callback function is called when the
|
||||
* operation is complete. The result value is given as an argument to
|
||||
* the callback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioF0Read8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data);
|
||||
CsrResult CsrSdioF0Write8(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data);
|
||||
void CsrSdioF0Read8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 *data, CsrSdioAsyncCallback callback);
|
||||
void CsrSdioF0Write8Async(CsrSdioFunction *function, CsrUint32 address, CsrUint8 data, CsrSdioAsyncCallback callback);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioRead, CsrSdioWrite, CsrSdioReadAsync, CsrSdioWriteAsync
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Read/write a specified number of bytes from/to the specified register
|
||||
* address.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
* address - Register address within the function.
|
||||
* data - The data to read/write.
|
||||
* length - Number of byte to read/write.
|
||||
* callback - The function to call on operation completion.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - The data was successfully read/written.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been
|
||||
* partially read/written.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
|
||||
*
|
||||
* NOTE: If the SDIO R5 response is available, and either of the
|
||||
* FUNCTION_NUMBER or OUT_OF_RANGE bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE shall be returned. If the ERROR bit
|
||||
* is set (but none of FUNCTION_NUMBER or OUT_OF_RANGE),
|
||||
* CSR_RESULT_FAILURE shall be returned. The ILLEGAL_COMMAND and
|
||||
* COM_CRC_ERROR bits shall be ignored.
|
||||
*
|
||||
* If the CSPI response is available, and any of the
|
||||
* FUNCTION_DISABLED or CLOCK_DISABLED bits are set,
|
||||
* CSR_SDIO_RESULT_INVALID_VALUE will be returned.
|
||||
*
|
||||
* NOTE: The CsrSdioF0Read8Async and CsrSdioF0Write8Async functions return
|
||||
* immediately, and the supplied callback function is called when the
|
||||
* operation is complete. The result value is given as an argument to
|
||||
* the callback function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioRead(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length);
|
||||
CsrResult CsrSdioWrite(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length);
|
||||
void CsrSdioReadAsync(CsrSdioFunction *function, CsrUint32 address, void *data, CsrUint32 length, CsrSdioAsyncCallback callback);
|
||||
void CsrSdioWriteAsync(CsrSdioFunction *function, CsrUint32 address, const void *data, CsrUint32 length, CsrSdioAsyncCallback callback);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioPowerOn, CsrSdioPowerOff
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Power on/off the device.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function that resides on
|
||||
* the device to power on/off.
|
||||
*
|
||||
* RETURNS (only CsrSdioPowerOn)
|
||||
* CSR_RESULT_SUCCESS - Power was succesfully reapplied and the device
|
||||
* has been reinitialised.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device during
|
||||
* reinitialisation.
|
||||
* CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the
|
||||
* CsrSdioPowerOff call. The state of the
|
||||
* device is unchanged.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioPowerOn(CsrSdioFunction *function);
|
||||
void CsrSdioPowerOff(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioHardReset
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Perform a hardware reset of the device.
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function that resides on
|
||||
* the device to hard reset.
|
||||
*
|
||||
* RETURNS
|
||||
* CSR_RESULT_SUCCESS - Reset was succesfully performed and the device
|
||||
* has been reinitialised.
|
||||
* CSR_RESULT_FAILURE - Unspecified/unknown error.
|
||||
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
|
||||
* CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation.
|
||||
* CSR_SDIO_RESULT_TIMEOUT - No response from the device during
|
||||
* reinitialisation.
|
||||
* CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not
|
||||
* supported. The state of the device is
|
||||
* unchanged.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrResult CsrSdioHardReset(CsrSdioFunction *function);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrSdioFunctionActive, CsrSdioFunctionIdle
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* PARAMETERS
|
||||
* function - Pointer to struct representing the function.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrSdioFunctionActive(CsrSdioFunction *function);
|
||||
void CsrSdioFunctionIdle(CsrSdioFunction *function);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
472
drivers/staging/csr/csr_serialize_primitive_types.c
Normal file
472
drivers/staging/csr/csr_serialize_primitive_types.c
Normal file
|
@ -0,0 +1,472 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_msgconv.h"
|
||||
#include "csr_util.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_lib.h"
|
||||
|
||||
void CsrUint8Des(CsrUint8 *value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = buffer[*offset];
|
||||
*offset += sizeof(*value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint8Des);
|
||||
|
||||
void CsrUint16Des(CsrUint16 *value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = (buffer[*offset + 0] << 0) |
|
||||
(buffer[*offset + 1] << 8);
|
||||
*offset += sizeof(*value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint16Des);
|
||||
|
||||
void CsrUint32Des(CsrUint32 *value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = (buffer[*offset + 0] << 0) |
|
||||
(buffer[*offset + 1] << 8) |
|
||||
(buffer[*offset + 2] << 16) |
|
||||
(buffer[*offset + 3] << 24);
|
||||
*offset += sizeof(*value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint32Des);
|
||||
|
||||
void CsrMemCpyDes(void *value, CsrUint8 *buffer, CsrSize *offset, CsrSize length)
|
||||
{
|
||||
CsrMemCpy(value, &buffer[*offset], length);
|
||||
*offset += length;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemCpyDes);
|
||||
|
||||
void CsrCharStringDes(CsrCharString **value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = CsrStrDup((CsrCharString *) &buffer[*offset]);
|
||||
*offset += CsrStrLen(*value) + 1;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrCharStringDes);
|
||||
|
||||
void CsrUtf8StringDes(CsrUtf8String **value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = (CsrUtf8String *) CsrStrDup((CsrCharString *) &buffer[*offset]);
|
||||
*offset += CsrStrLen((CsrCharString *) *value) + 1;
|
||||
}
|
||||
|
||||
void CsrUtf16StringDes(CsrUtf16String **value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
CsrUint32 length, i;
|
||||
|
||||
CsrUint32Des(&length, buffer, offset);
|
||||
|
||||
*value = CsrPmemAlloc(length * sizeof(**value));
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
CsrUint16Des(&(*value)[i], buffer, offset);
|
||||
}
|
||||
}
|
||||
|
||||
void CsrSizeDes(CsrSize *value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
*value = (buffer[*offset + 0] << 0) |
|
||||
(buffer[*offset + 1] << 8) |
|
||||
(buffer[*offset + 2] << 16) |
|
||||
(buffer[*offset + 3] << 24);
|
||||
*offset += sizeof(*value);
|
||||
}
|
||||
|
||||
void CsrVoidPtrDes(void **value, CsrUint8 *buffer, CsrSize *offset)
|
||||
{
|
||||
CsrSizeDes((CsrSize *) value, buffer, offset);
|
||||
}
|
||||
|
||||
void CsrUint8Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint8 value)
|
||||
{
|
||||
buffer[*offset] = value;
|
||||
*offset += sizeof(value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint8Ser);
|
||||
|
||||
void CsrUint16Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint16 value)
|
||||
{
|
||||
buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF);
|
||||
buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF);
|
||||
*offset += sizeof(value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint16Ser);
|
||||
|
||||
void CsrUint32Ser(CsrUint8 *buffer, CsrSize *offset, CsrUint32 value)
|
||||
{
|
||||
buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF);
|
||||
buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF);
|
||||
buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF);
|
||||
buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF);
|
||||
*offset += sizeof(value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrUint32Ser);
|
||||
|
||||
void CsrMemCpySer(CsrUint8 *buffer, CsrSize *offset, const void *value, CsrSize length)
|
||||
{
|
||||
CsrMemCpy(&buffer[*offset], value, length);
|
||||
*offset += length;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemCpySer);
|
||||
|
||||
void CsrCharStringSer(CsrUint8 *buffer, CsrSize *offset, const CsrCharString *value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
CsrStrCpy(((CsrCharString *) &buffer[*offset]), value);
|
||||
*offset += CsrStrLen(value) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CsrUint8Ser(buffer, offset, 0);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrCharStringSer);
|
||||
|
||||
void CsrUtf8StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf8String *value)
|
||||
{
|
||||
CsrCharStringSer(buffer, offset, (CsrCharString *) value);
|
||||
}
|
||||
|
||||
void CsrUtf16StringSer(CsrUint8 *buffer, CsrSize *offset, const CsrUtf16String *value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
CsrUint32 length = CsrUtf16StrLen(value) + 1;
|
||||
CsrUint32 i;
|
||||
|
||||
CsrUint32Ser(buffer, offset, length);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
CsrUint16Ser(buffer, offset, (CsrUint16) value[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CsrUint32Ser(buffer, offset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CsrSizeSer(CsrUint8 *buffer, CsrSize *offset, CsrSize value)
|
||||
{
|
||||
buffer[*offset + 0] = (CsrUint8) ((value >> 0) & 0xFF);
|
||||
buffer[*offset + 1] = (CsrUint8) ((value >> 8) & 0xFF);
|
||||
buffer[*offset + 2] = (CsrUint8) ((value >> 16) & 0xFF);
|
||||
buffer[*offset + 3] = (CsrUint8) ((value >> 24) & 0xFF);
|
||||
*offset += sizeof(value);
|
||||
}
|
||||
|
||||
void CsrVoidPtrSer(CsrUint8 *buffer, CsrSize *offset, void *ptr)
|
||||
{
|
||||
CsrSizeSer(buffer, offset, (CsrSize) ptr);
|
||||
}
|
||||
|
||||
CsrUint32 CsrCharStringSerLen(const CsrCharString *str)
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
return (CsrUint32) (CsrStrLen(str) + sizeof(*str));
|
||||
}
|
||||
else
|
||||
{
|
||||
return sizeof(*str);
|
||||
}
|
||||
}
|
||||
|
||||
CsrUint32 CsrUtf8StringSerLen(const CsrUtf8String *str)
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
return (CsrUint32) (CsrStrLen((CsrCharString *) str) + sizeof(*str));
|
||||
}
|
||||
else
|
||||
{
|
||||
return sizeof(*str);
|
||||
}
|
||||
}
|
||||
|
||||
CsrUint32 CsrUtf16StringSerLen(const CsrUtf16String *str)
|
||||
{
|
||||
if (str)
|
||||
{
|
||||
/* We always write down the length of the string */
|
||||
return sizeof(CsrUint32) + (CsrUtf16StrLen(str) + 1) * sizeof(*str);
|
||||
}
|
||||
else
|
||||
{
|
||||
return sizeof(CsrUint32);
|
||||
}
|
||||
}
|
||||
|
||||
CsrSize CsrEventSizeof(void *msg)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEvent *primitive = (CsrEvent *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent));
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint8Sizeof(void *msg)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint8Ser(ptr, len, primitive->value);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint8Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint8Des(&primitive->value, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint16Sizeof(void *msg)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint16Ser(ptr, len, primitive->value);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint16Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint32Sizeof(void *msg)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint32Ser(ptr, len, primitive->value);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint32Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint32Des(&primitive->value, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint8Sizeof(void *msg)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint16Ser(ptr, len, primitive->value1);
|
||||
CsrUint8Ser(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value1, buffer, &offset);
|
||||
CsrUint8Des(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint16Sizeof(void *msg)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint16Ser(ptr, len, primitive->value1);
|
||||
CsrUint16Ser(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint16CsrUint16Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value1, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrUint32Sizeof(void *msg)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint16CsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint16Ser(ptr, len, primitive->value1);
|
||||
CsrUint32Ser(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint16CsrUint32Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value1, buffer, &offset);
|
||||
CsrUint32Des(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint16CsrCharStringSizeof(void *msg)
|
||||
{
|
||||
CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg;
|
||||
return 4 + CsrStrLen(primitive->value2) + 1;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint16CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint16Ser(ptr, len, primitive->value1);
|
||||
CsrCharStringSer(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint16CsrCharStringDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value1, buffer, &offset);
|
||||
CsrCharStringDes(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint32CsrUint16Sizeof(void *msg)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint32CsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint32Ser(ptr, len, primitive->value1);
|
||||
CsrUint16Ser(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint32CsrUint16Des(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint32Des(&primitive->value1, buffer, &offset);
|
||||
CsrUint16Des(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
CsrSize CsrEventCsrUint32CsrCharStringSizeof(void *msg)
|
||||
{
|
||||
CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg;
|
||||
return 6 + CsrStrLen(primitive->value2) + 1;
|
||||
}
|
||||
|
||||
CsrUint8 *CsrEventCsrUint32CsrCharStringSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->type);
|
||||
CsrUint32Ser(ptr, len, primitive->value1);
|
||||
CsrCharStringSer(ptr, len, primitive->value2);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *CsrEventCsrUint32CsrCharStringDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString));
|
||||
|
||||
CsrSize offset = 0;
|
||||
CsrUint16Des(&primitive->type, buffer, &offset);
|
||||
CsrUint32Des(&primitive->value1, buffer, &offset);
|
||||
CsrCharStringDes(&primitive->value2, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
71
drivers/staging/csr/csr_time.c
Normal file
71
drivers/staging/csr/csr_time.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
|
||||
#include <linux/autoconf.h>
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
|
||||
#include <linux/time.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_time.h"
|
||||
|
||||
CsrTime CsrTimeGet(CsrTime *high)
|
||||
{
|
||||
struct timespec ts;
|
||||
CsrUint64 time;
|
||||
CsrTime low;
|
||||
|
||||
ts = current_kernel_time();
|
||||
time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
|
||||
|
||||
if (high != NULL)
|
||||
{
|
||||
*high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
low = (CsrTime) (time & 0xFFFFFFFF);
|
||||
|
||||
return low;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrTimeGet);
|
||||
|
||||
void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high)
|
||||
{
|
||||
struct timespec ts;
|
||||
CsrUint64 time;
|
||||
|
||||
ts = current_kernel_time();
|
||||
time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
|
||||
|
||||
if (high != NULL)
|
||||
{
|
||||
*high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
if (low != NULL)
|
||||
{
|
||||
*low = (CsrTime) (time & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
if (tod != NULL)
|
||||
{
|
||||
struct timeval tv;
|
||||
do_gettimeofday(&tv);
|
||||
tod->sec = tv.tv_sec;
|
||||
tod->msec = tv.tv_usec / 1000;
|
||||
}
|
||||
}
|
205
drivers/staging/csr/csr_time.h
Normal file
205
drivers/staging/csr/csr_time.h
Normal file
|
@ -0,0 +1,205 @@
|
|||
#ifndef CSR_TIME_H__
|
||||
#define CSR_TIME_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrTime
|
||||
|
||||
DESCRIPTION
|
||||
Type to hold a value describing the current system time, which is a
|
||||
measure of time elapsed since some arbitrarily defined fixed time
|
||||
reference, usually associated with system startup.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint32 CsrTime;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrTimeUtc
|
||||
|
||||
DESCRIPTION
|
||||
Type to hold a value describing a UTC wallclock time expressed in
|
||||
seconds and milliseconds elapsed since midnight January 1st 1970.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint32 sec;
|
||||
CsrUint16 msec;
|
||||
} CsrTimeUtc;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrTimeGet
|
||||
|
||||
DESCRIPTION
|
||||
Returns the current system time in a low and a high part. The low part
|
||||
is expressed in microseconds. The high part is incremented when the low
|
||||
part wraps to provide an extended range.
|
||||
|
||||
The caller may provide a NULL pointer as the high parameter. In this case
|
||||
the function just returns the low part and ignores the high parameter.
|
||||
|
||||
Although the time is expressed in microseconds the actual resolution is
|
||||
platform dependent and can be less. It is recommended that the
|
||||
resolution is at least 10 milliseconds.
|
||||
|
||||
PARAMETERS
|
||||
high - Pointer to variable that will receive the high part of the
|
||||
current system time. Passing NULL is valid.
|
||||
|
||||
RETURNS
|
||||
Low part of current system time in microseconds.
|
||||
|
||||
*******************************************************************************/
|
||||
CsrTime CsrTimeGet(CsrTime *high);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrTimeUtcGet
|
||||
|
||||
DESCRIPTION
|
||||
Get the current system wallclock time, and optionally the current system
|
||||
time in a low and a high part as would have been returned by
|
||||
CsrTimeGet.
|
||||
|
||||
Although CsrTimeUtc is expressed in seconds and milliseconds, the actual
|
||||
resolution is platform dependent, and can be less. It is recommended
|
||||
that the resolution is at least 1 second.
|
||||
|
||||
PARAMETERS
|
||||
tod - Pointer to variable that will receive the current system
|
||||
wallclock time.
|
||||
low - The low part of the current system time in microseconds. Passing
|
||||
NULL is valid.
|
||||
high - The high part of the current system time in microseconds. Passing
|
||||
NULL is valid.
|
||||
|
||||
*******************************************************************************/
|
||||
void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high);
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* CsrTime Macros */
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeAdd
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Add two time values. Adding the numbers can overflow the range of a
|
||||
* CsrTime, so the user must be cautious.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrTime - the sum of "t1" and "t2".
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeAdd(t1, t2) ((t1) + (t2))
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeSub
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Subtract two time values. Subtracting the numbers can provoke an
|
||||
* underflow, so the user must be cautious.
|
||||
*
|
||||
* RETURNS
|
||||
* CsrTime - "t1" - "t2".
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeSub(t1, t2) ((CsrInt32) (t1) - (CsrInt32) (t2))
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeEq
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare two time values.
|
||||
*
|
||||
* RETURNS
|
||||
* !0 if "t1" equal "t2", else 0.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeEq(t1, t2) ((t1) == (t2))
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeGt
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare two time values.
|
||||
*
|
||||
* RETURNS
|
||||
* !0 if "t1" is greater than "t2", else 0.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeGt(t1, t2) (CsrTimeSub((t1), (t2)) > 0)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeGe
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare two time values.
|
||||
*
|
||||
* RETURNS
|
||||
* !0 if "t1" is greater than, or equal to "t2", else 0.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeGe(t1, t2) (CsrTimeSub((t1), (t2)) >= 0)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeLt
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare two time values.
|
||||
*
|
||||
* RETURNS
|
||||
* !0 if "t1" is less than "t2", else 0.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeLt(t1, t2) (CsrTimeSub((t1), (t2)) < 0)
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrTimeLe
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Compare two time values.
|
||||
*
|
||||
* RETURNS
|
||||
* !0 if "t1" is less than, or equal to "t2", else 0.
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrTimeLe(t1, t2) (CsrTimeSub((t1), (t2)) <= 0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
93
drivers/staging/csr/csr_types.h
Normal file
93
drivers/staging/csr/csr_types.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
#ifndef CSR_TYPES_H__
|
||||
#define CSR_TYPES_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/string.h>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#undef FALSE
|
||||
#define FALSE (0)
|
||||
|
||||
#undef TRUE
|
||||
#define TRUE (1)
|
||||
|
||||
/* Basic types */
|
||||
typedef size_t CsrSize; /* Return type of sizeof (ISO/IEC 9899:1990 7.1.6) */
|
||||
typedef ptrdiff_t CsrPtrdiff; /* Type of the result of subtracting two pointers (ISO/IEC 9899:1990 7.1.6) */
|
||||
typedef uintptr_t CsrUintptr; /* Unsigned integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */
|
||||
#ifdef __KERNEL__
|
||||
typedef ptrdiff_t CsrIntptr; /* intptr_t is not defined in kernel. Use the equivalent ptrdiff_t. */
|
||||
#else
|
||||
typedef intptr_t CsrIntptr; /* Signed integer large enough to hold any pointer (ISO/IEC 9899:1999 7.18.1.4) */
|
||||
#endif
|
||||
|
||||
/* Unsigned fixed width types */
|
||||
typedef uint8_t CsrUint8;
|
||||
typedef uint16_t CsrUint16;
|
||||
typedef uint32_t CsrUint32;
|
||||
|
||||
/* Signed fixed width types */
|
||||
typedef int8_t CsrInt8;
|
||||
typedef int16_t CsrInt16;
|
||||
typedef int32_t CsrInt32;
|
||||
|
||||
/* Boolean */
|
||||
typedef CsrUint8 CsrBool;
|
||||
|
||||
/* String types */
|
||||
typedef char CsrCharString;
|
||||
typedef CsrUint8 CsrUtf8String;
|
||||
typedef CsrUint16 CsrUtf16String; /* 16-bit UTF16 strings */
|
||||
typedef CsrUint32 CsrUint24;
|
||||
|
||||
/*
|
||||
* 64-bit integers
|
||||
*
|
||||
* Note: If a given compiler does not support 64-bit types, it is
|
||||
* OK to omit these definitions; 32-bit versions of the code using
|
||||
* these types may be available. Consult the relevant documentation
|
||||
* or the customer support group for information on this.
|
||||
*/
|
||||
#define CSR_HAVE_64_BIT_INTEGERS
|
||||
typedef uint64_t CsrUint64;
|
||||
typedef int64_t CsrInt64;
|
||||
|
||||
/*
|
||||
* Floating point
|
||||
*
|
||||
* Note: If a given compiler does not support floating point, it is
|
||||
* OK to omit these definitions; alternative versions of the code using
|
||||
* these types may be available. Consult the relevant documentation
|
||||
* or the customer support group for information on this.
|
||||
*/
|
||||
#define CSR_HAVE_FLOATING_POINT
|
||||
typedef float CsrFloat;
|
||||
typedef double CsrDouble;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
190
drivers/staging/csr/csr_unicode.h
Normal file
190
drivers/staging/csr/csr_unicode.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
#ifndef CSR_UNICODE_H__
|
||||
#define CSR_UNICODE_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
CsrUtf16String *CsrUint32ToUtf16String(CsrUint32 number);
|
||||
|
||||
CsrUint32 CsrUtf16StringToUint32(const CsrUtf16String *unicodeString);
|
||||
CsrUint32 CsrUtf16StrLen(const CsrUtf16String *unicodeString);
|
||||
|
||||
CsrUtf8String *CsrUtf16String2Utf8(const CsrUtf16String *source);
|
||||
|
||||
CsrUtf16String *CsrUtf82Utf16String(const CsrUtf8String *utf8String);
|
||||
|
||||
CsrUtf16String *CsrUtf16StrCpy(CsrUtf16String *target, const CsrUtf16String *source);
|
||||
CsrUtf16String *CsrUtf16StringDuplicate(const CsrUtf16String *source);
|
||||
|
||||
CsrUint16 CsrUtf16StrICmp(const CsrUtf16String *string1, const CsrUtf16String *string2);
|
||||
CsrUint16 CsrUtf16StrNICmp(const CsrUtf16String *string1, const CsrUtf16String *string2, CsrUint32 count);
|
||||
|
||||
CsrUtf16String *CsrUtf16MemCpy(CsrUtf16String *dest, const CsrUtf16String *src, CsrUint32 count);
|
||||
CsrUtf16String *CsrUtf16ConcatenateTexts(const CsrUtf16String *inputText1, const CsrUtf16String *inputText2,
|
||||
const CsrUtf16String *inputText3, const CsrUtf16String *inputText4);
|
||||
|
||||
CsrUtf16String *CsrUtf16String2XML(CsrUtf16String *str);
|
||||
CsrUtf16String *CsrXML2Utf16String(CsrUtf16String *str);
|
||||
|
||||
CsrInt32 CsrUtf8StrCmp(const CsrUtf8String *string1, const CsrUtf8String *string2);
|
||||
CsrInt32 CsrUtf8StrNCmp(const CsrUtf8String *string1, const CsrUtf8String *string2, CsrSize count);
|
||||
CsrUint32 CsrUtf8StringLengthInBytes(const CsrUtf8String *string);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrUtf8StrTruncate
|
||||
|
||||
DESCRIPTION
|
||||
In-place truncate a string on a UTF-8 character boundary by writing a
|
||||
null character somewhere in the range target[count - 3]:target[count].
|
||||
|
||||
Please note that memory passed must be at least of length count + 1, to
|
||||
ensure space for a full length string that is terminated at
|
||||
target[count], in the event that target[count - 1] is the final byte of
|
||||
a UTF-8 character.
|
||||
|
||||
PARAMETERS
|
||||
target - Target string to truncate.
|
||||
count - The desired length, in bytes, of the resulting string. Depending
|
||||
on the contents, the resulting string length will be between
|
||||
count - 3 and count.
|
||||
|
||||
RETURNS
|
||||
Returns target
|
||||
|
||||
*******************************************************************************/
|
||||
CsrUtf8String *CsrUtf8StrTruncate(CsrUtf8String *target, CsrSize count);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrUtf8StrCpy
|
||||
|
||||
DESCRIPTION
|
||||
Copies the null terminated UTF-8 string pointed at by source into the
|
||||
memory pointed at by target, including the terminating null character.
|
||||
|
||||
To avoid overflows, the size of the memory pointed at by target shall be
|
||||
long enough to contain the same UTF-8 string as source (including the
|
||||
terminating null character), and should not overlap in memory with
|
||||
source.
|
||||
|
||||
PARAMETERS
|
||||
target - Pointer to the target memory where the content is to be copied.
|
||||
source - UTF-8 string to be copied.
|
||||
|
||||
RETURNS
|
||||
Returns target
|
||||
|
||||
*******************************************************************************/
|
||||
CsrUtf8String *CsrUtf8StrCpy(CsrUtf8String *target, const CsrUtf8String *source);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrUtf8StrNCpy
|
||||
|
||||
DESCRIPTION
|
||||
Copies the first count bytes of source to target. If the end of the
|
||||
source UTF-8 string (which is signaled by a null-character) is found
|
||||
before count bytes have been copied, target is padded with null
|
||||
characters until a total of count bytes have been written to it.
|
||||
|
||||
No null-character is implicitly appended to the end of target, so target
|
||||
will only be null-terminated if the length of the UTF-8 string in source
|
||||
is less than count.
|
||||
|
||||
PARAMETERS
|
||||
target - Pointer to the target memory where the content is to be copied.
|
||||
source - UTF-8 string to be copied.
|
||||
count - Maximum number of bytes to be written to target.
|
||||
|
||||
RETURNS
|
||||
Returns target
|
||||
|
||||
*******************************************************************************/
|
||||
CsrUtf8String *CsrUtf8StrNCpy(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrUtf8StrNCpyZero
|
||||
|
||||
DESCRIPTION
|
||||
Equivalent to CsrUtf8StrNCpy, but if the length of source is equal to or
|
||||
greater than count the target string is truncated on a UTF-8 character
|
||||
boundary by writing a null character somewhere in the range
|
||||
target[count - 4]:target[count - 1], leaving the target string
|
||||
unconditionally null terminated in all cases.
|
||||
|
||||
Please note that if the length of source is shorter than count, no
|
||||
truncation will be applied, and the target string will be a one to one
|
||||
copy of source.
|
||||
|
||||
PARAMETERS
|
||||
target - Pointer to the target memory where the content is to be copied.
|
||||
source - UTF-8 string to be copied.
|
||||
count - Maximum number of bytes to be written to target.
|
||||
|
||||
RETURNS
|
||||
Returns target
|
||||
|
||||
*******************************************************************************/
|
||||
CsrUtf8String *CsrUtf8StrNCpyZero(CsrUtf8String *target, const CsrUtf8String *source, CsrSize count);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrUtf8StrDup
|
||||
|
||||
DESCRIPTION
|
||||
This function will allocate memory and copy the source string into the
|
||||
allocated memory, which is then returned as a duplicate of the original
|
||||
string. The memory returned must be freed by calling CsrPmemFree when
|
||||
the duplicate is no longer needed.
|
||||
|
||||
PARAMETERS
|
||||
source - UTF-8 string to be duplicated.
|
||||
|
||||
RETURNS
|
||||
Returns a duplicate of source.
|
||||
|
||||
*******************************************************************************/
|
||||
CsrUtf8String *CsrUtf8StrDup(const CsrUtf8String *source);
|
||||
|
||||
CsrUtf8String *CsrUtf8StringConcatenateTexts(const CsrUtf8String *inputText1, const CsrUtf8String *inputText2, const CsrUtf8String *inputText3, const CsrUtf8String *inputText4);
|
||||
|
||||
/*
|
||||
* UCS2
|
||||
*
|
||||
* D-13157
|
||||
*/
|
||||
typedef CsrUint8 CsrUcs2String;
|
||||
|
||||
CsrSize CsrUcs2ByteStrLen(const CsrUcs2String *ucs2String);
|
||||
CsrSize CsrConverterUcs2ByteStrLen(const CsrUcs2String *str);
|
||||
|
||||
CsrUint8 *CsrUcs2ByteString2Utf8(const CsrUcs2String *ucs2String);
|
||||
CsrUcs2String *CsrUtf82Ucs2ByteString(const CsrUint8 *utf8String);
|
||||
|
||||
CsrUint8 *CsrUtf16String2Ucs2ByteString(const CsrUtf16String *source);
|
||||
CsrUtf16String *CsrUcs2ByteString2Utf16String(const CsrUint8 *source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
1136
drivers/staging/csr/csr_utf16.c
Normal file
1136
drivers/staging/csr/csr_utf16.c
Normal file
File diff suppressed because it is too large
Load diff
435
drivers/staging/csr/csr_util.c
Normal file
435
drivers/staging/csr/csr_util.c
Normal file
|
@ -0,0 +1,435 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Bits */
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/* Time proportional with the number of 1's */
|
||||
CsrUint8 CsrBitCountSparse(CsrUint32 n)
|
||||
{
|
||||
CsrUint8 count = 0;
|
||||
|
||||
while (n)
|
||||
{
|
||||
count++;
|
||||
n &= (n - 1);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/* Time proportional with the number of 0's */
|
||||
CsrUint8 CsrBitCountDense(CsrUint32 n)
|
||||
{
|
||||
CsrUint8 count = 8 * sizeof(CsrUint32);
|
||||
|
||||
n ^= (CsrUint32) (-1);
|
||||
|
||||
while (n)
|
||||
{
|
||||
count--;
|
||||
n &= (n - 1);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Base conversion */
|
||||
/*------------------------------------------------------------------*/
|
||||
CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue)
|
||||
{
|
||||
CsrUint16 currentIndex = 0;
|
||||
*returnValue = 0;
|
||||
if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X'))
|
||||
{
|
||||
string += 2;
|
||||
}
|
||||
if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
*returnValue = (CsrUint8) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10));
|
||||
currentIndex++;
|
||||
if (currentIndex >= 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue)
|
||||
{
|
||||
CsrUint16 currentIndex = 0;
|
||||
*returnValue = 0;
|
||||
if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X'))
|
||||
{
|
||||
string += 2;
|
||||
}
|
||||
if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
*returnValue = (CsrUint16) (*returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10));
|
||||
currentIndex++;
|
||||
if (currentIndex >= 4)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue)
|
||||
{
|
||||
CsrUint16 currentIndex = 0;
|
||||
*returnValue = 0;
|
||||
if ((string[currentIndex] == '0') && (CSR_TOUPPER(string[currentIndex + 1]) == 'X'))
|
||||
{
|
||||
string += 2;
|
||||
}
|
||||
if (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
while (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) || ((CSR_TOUPPER(string[currentIndex]) >= 'A') && (CSR_TOUPPER(string[currentIndex]) <= 'F')))
|
||||
{
|
||||
*returnValue = *returnValue * 16 + (((string[currentIndex] >= '0') && (string[currentIndex] <= '9')) ? string[currentIndex] - '0' : CSR_TOUPPER(string[currentIndex]) - 'A' + 10);
|
||||
currentIndex++;
|
||||
if (currentIndex >= 8)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent)
|
||||
{
|
||||
if (exponent == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CsrUint32 i, t = base;
|
||||
|
||||
for (i = 1; i < exponent; i++)
|
||||
{
|
||||
t = t * base;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert signed 32 bit (or less) integer to string */
|
||||
#define I2B10_MAX 12
|
||||
void CsrIntToBase10(CsrInt32 number, CsrCharString *str)
|
||||
{
|
||||
CsrInt32 digit;
|
||||
CsrUint8 index;
|
||||
CsrCharString res[I2B10_MAX];
|
||||
CsrBool foundDigit = FALSE;
|
||||
|
||||
for (digit = 0; digit < I2B10_MAX; digit++)
|
||||
{
|
||||
res[digit] = '\0';
|
||||
}
|
||||
|
||||
/* Catch sign - and deal with positive numbers only afterwards */
|
||||
index = 0;
|
||||
if (number < 0)
|
||||
{
|
||||
res[index++] = '-';
|
||||
number = -1 * number;
|
||||
}
|
||||
|
||||
digit = 1000000000;
|
||||
if (number > 0)
|
||||
{
|
||||
while ((index < I2B10_MAX - 1) && (digit > 0))
|
||||
{
|
||||
/* If the foundDigit flag is TRUE, this routine should be proceeded.
|
||||
Otherwise the number which has '0' digit cannot be converted correctly */
|
||||
if (((number / digit) > 0) || foundDigit)
|
||||
{
|
||||
foundDigit = TRUE; /* set foundDigit flag to TRUE*/
|
||||
res[index++] = (char) ('0' + (number / digit));
|
||||
number = number % digit;
|
||||
}
|
||||
|
||||
digit = digit / 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res[index] = (char) '0';
|
||||
}
|
||||
|
||||
CsrStrCpy(str, res);
|
||||
}
|
||||
|
||||
void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str)
|
||||
{
|
||||
CsrUint16 index;
|
||||
CsrUint16 currentValue;
|
||||
|
||||
for (index = 0; index < 4; index++)
|
||||
{
|
||||
currentValue = (CsrUint16) (number & 0x000F);
|
||||
number >>= 4;
|
||||
str[3 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0');
|
||||
}
|
||||
str[4] = '\0';
|
||||
}
|
||||
|
||||
void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str)
|
||||
{
|
||||
CsrUint16 index;
|
||||
CsrUint32 currentValue;
|
||||
|
||||
for (index = 0; index < 8; index++)
|
||||
{
|
||||
currentValue = (CsrUint32) (number & 0x0000000F);
|
||||
number >>= 4;
|
||||
str[7 - index] = (char) (currentValue > 9 ? currentValue + 55 : currentValue + '0');
|
||||
}
|
||||
str[8] = '\0';
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* String */
|
||||
/*------------------------------------------------------------------*/
|
||||
void *CsrMemCpy(void *dest, const void *src, CsrSize count)
|
||||
{
|
||||
return memcpy(dest, src, count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemCpy);
|
||||
|
||||
void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count)
|
||||
{
|
||||
return memset(dest, c, count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemSet);
|
||||
|
||||
void *CsrMemMove(void *dest, const void *src, CsrSize count)
|
||||
{
|
||||
return memmove(dest, src, count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemMove);
|
||||
|
||||
CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count)
|
||||
{
|
||||
return memcmp(buf1, buf2, count);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrMemCmp);
|
||||
|
||||
void *CsrMemDup(const void *buf1, CsrSize count)
|
||||
{
|
||||
void *buf2 = NULL;
|
||||
|
||||
if (buf1)
|
||||
{
|
||||
buf2 = CsrPmemAlloc(count);
|
||||
CsrMemCpy(buf2, buf1, count);
|
||||
}
|
||||
|
||||
return buf2;
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src)
|
||||
{
|
||||
return strcpy(dest, src);
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count)
|
||||
{
|
||||
return strncpy(dest, src, count);
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src)
|
||||
{
|
||||
return strcat(dest, src);
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count)
|
||||
{
|
||||
return strncat(dest, src, count);
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2)
|
||||
{
|
||||
return strstr(string1, string2);
|
||||
}
|
||||
|
||||
CsrSize CsrStrLen(const CsrCharString *string)
|
||||
{
|
||||
return strlen(string);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrStrLen);
|
||||
|
||||
CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2)
|
||||
{
|
||||
return strcmp(string1, string2);
|
||||
}
|
||||
|
||||
CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count)
|
||||
{
|
||||
return strncmp(string1, string2, count);
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c)
|
||||
{
|
||||
return strchr(string, c);
|
||||
}
|
||||
|
||||
CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args)
|
||||
{
|
||||
return vsnprintf(string, count, format, args);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(CsrVsnprintf);
|
||||
|
||||
CsrCharString *CsrStrNCpyZero(CsrCharString *dest,
|
||||
const CsrCharString *src,
|
||||
CsrSize count)
|
||||
{
|
||||
CsrStrNCpy(dest, src, count - 1);
|
||||
dest[count - 1] = '\0';
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Convert string with base 10 to integer */
|
||||
CsrUint32 CsrStrToInt(const CsrCharString *str)
|
||||
{
|
||||
CsrInt16 i;
|
||||
CsrUint32 res;
|
||||
CsrUint32 digit;
|
||||
|
||||
res = 0;
|
||||
digit = 1;
|
||||
|
||||
/* Start from the string end */
|
||||
for (i = (CsrUint16) (CsrStrLen(str) - 1); i >= 0; i--)
|
||||
{
|
||||
/* Only convert numbers */
|
||||
if ((str[i] >= '0') && (str[i] <= '9'))
|
||||
{
|
||||
res += digit * (str[i] - '0');
|
||||
digit = digit * 10;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
CsrCharString *CsrStrDup(const CsrCharString *string)
|
||||
{
|
||||
CsrCharString *copy;
|
||||
CsrUint32 len;
|
||||
|
||||
copy = NULL;
|
||||
if (string != NULL)
|
||||
{
|
||||
len = CsrStrLen(string) + 1;
|
||||
copy = CsrPmemAlloc(len);
|
||||
CsrMemCpy(copy, string, len);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
int CsrStrNICmp(const CsrCharString *string1,
|
||||
const CsrCharString *string2,
|
||||
CsrSize count)
|
||||
{
|
||||
CsrUint32 index;
|
||||
int returnValue = 0;
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
if (CSR_TOUPPER(string1[index]) != CSR_TOUPPER(string2[index]))
|
||||
{
|
||||
if (CSR_TOUPPER(string1[index]) > CSR_TOUPPER(string2[index]))
|
||||
{
|
||||
returnValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
returnValue = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (string1[index] == '\0')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
const CsrCharString *CsrGetBaseName(const CsrCharString *file)
|
||||
{
|
||||
const CsrCharString *pch;
|
||||
static const CsrCharString dotDir[] = ".";
|
||||
|
||||
if (!file)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (file[0] == '\0')
|
||||
{
|
||||
return dotDir;
|
||||
}
|
||||
|
||||
pch = file + CsrStrLen(file) - 1;
|
||||
|
||||
while (*pch != '\\' && *pch != '/' && *pch != ':')
|
||||
{
|
||||
if (pch == file)
|
||||
{
|
||||
return pch;
|
||||
}
|
||||
--pch;
|
||||
}
|
||||
|
||||
return ++pch;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Misc */
|
||||
/*------------------------------------------------------------------*/
|
||||
CsrBool CsrIsSpace(CsrUint8 c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\f':
|
||||
case '\r':
|
||||
case ' ':
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
75
drivers/staging/csr/csr_util.h
Normal file
75
drivers/staging/csr/csr_util.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
#ifndef CSR_UTIL_H__
|
||||
#define CSR_UTIL_H__
|
||||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_macro.h"
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Bits - intended to operate on CsrUint32 values */
|
||||
/*------------------------------------------------------------------*/
|
||||
CsrUint8 CsrBitCountSparse(CsrUint32 n);
|
||||
CsrUint8 CsrBitCountDense(CsrUint32 n);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Base conversion */
|
||||
/*------------------------------------------------------------------*/
|
||||
CsrBool CsrHexStrToUint8(const CsrCharString *string, CsrUint8 *returnValue);
|
||||
CsrBool CsrHexStrToUint16(const CsrCharString *string, CsrUint16 *returnValue);
|
||||
CsrBool CsrHexStrToUint32(const CsrCharString *string, CsrUint32 *returnValue);
|
||||
CsrUint32 CsrPow(CsrUint32 base, CsrUint32 exponent);
|
||||
void CsrIntToBase10(CsrInt32 number, CsrCharString *str);
|
||||
void CsrUInt16ToHex(CsrUint16 number, CsrCharString *str);
|
||||
void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* String */
|
||||
/*------------------------------------------------------------------*/
|
||||
void *CsrMemCpy(void *dest, const void *src, CsrSize count);
|
||||
void *CsrMemSet(void *dest, CsrUint8 c, CsrSize count);
|
||||
void *CsrMemMove(void *dest, const void *src, CsrSize count);
|
||||
CsrInt32 CsrMemCmp(const void *buf1, const void *buf2, CsrSize count);
|
||||
void *CsrMemDup(const void *buf1, CsrSize count);
|
||||
CsrCharString *CsrStrCpy(CsrCharString *dest, const CsrCharString *src);
|
||||
CsrCharString *CsrStrNCpy(CsrCharString *dest, const CsrCharString *src, CsrSize count);
|
||||
int CsrStrNICmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
|
||||
CsrCharString *CsrStrCat(CsrCharString *dest, const CsrCharString *src);
|
||||
CsrCharString *CsrStrNCat(CsrCharString *dest, const CsrCharString *src, CsrSize count);
|
||||
CsrCharString *CsrStrStr(const CsrCharString *string1, const CsrCharString *string2);
|
||||
CsrSize CsrStrLen(const CsrCharString *string);
|
||||
CsrInt32 CsrStrCmp(const CsrCharString *string1, const CsrCharString *string2);
|
||||
CsrInt32 CsrStrNCmp(const CsrCharString *string1, const CsrCharString *string2, CsrSize count);
|
||||
CsrCharString *CsrStrDup(const CsrCharString *string);
|
||||
CsrCharString *CsrStrChr(const CsrCharString *string, CsrCharString c);
|
||||
CsrUint32 CsrStrToInt(const CsrCharString *string);
|
||||
CsrInt32 CsrVsnprintf(CsrCharString *string, CsrSize count, const CsrCharString *format, va_list args);
|
||||
CsrCharString *CsrStrNCpyZero(CsrCharString *dest, const CsrCharString *src, CsrSize count);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Filename */
|
||||
/*------------------------------------------------------------------*/
|
||||
const CsrCharString *CsrGetBaseName(const CsrCharString *file);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Misc */
|
||||
/*------------------------------------------------------------------*/
|
||||
CsrBool CsrIsSpace(CsrUint8 c);
|
||||
#define CsrOffsetOf(st, m) ((CsrSize) & ((st *) 0)->m)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
109
drivers/staging/csr/csr_wifi_common.h
Normal file
109
drivers/staging/csr/csr_wifi_common.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_COMMON_H__
|
||||
#define CSR_WIFI_COMMON_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_result.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* MAC address */
|
||||
typedef struct
|
||||
{
|
||||
CsrUint8 a[6];
|
||||
} CsrWifiMacAddress;
|
||||
|
||||
/* IPv4 address */
|
||||
typedef struct
|
||||
{
|
||||
CsrUint8 a[4];
|
||||
} CsrWifiIp4Address;
|
||||
|
||||
/* IPv6 address */
|
||||
typedef struct
|
||||
{
|
||||
CsrUint8 a[16];
|
||||
} CsrWifiIp6Address;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrUint8 ssid[32];
|
||||
CsrUint8 length;
|
||||
} CsrWifiSsid;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
DESCRIPTION
|
||||
Result values used on the Wifi Interfaces
|
||||
|
||||
VALUES
|
||||
CSR_RESULT_SUCCESS
|
||||
- The request/procedure succeeded
|
||||
CSR_RESULT_FAILURE
|
||||
- The request/procedure did not succeed because of an error
|
||||
CSR_WIFI_RESULT_NOT_FOUND
|
||||
- The request did not succeed because some resource was not
|
||||
found.
|
||||
CSR_WIFI_RESULT_TIMED_OUT
|
||||
- The request/procedure did not succeed because of a time out
|
||||
CSR_WIFI_RESULT_CANCELLED
|
||||
- The request was canceled due to another conflicting
|
||||
request that was issued before this one was completed
|
||||
CSR_WIFI_RESULT_INVALID_PARAMETER
|
||||
- The request/procedure did not succeed because it had an
|
||||
invalid parameter
|
||||
CSR_WIFI_RESULT_NO_ROOM
|
||||
- The request did not succeed due to a lack of resources,
|
||||
e.g. out of memory problem.
|
||||
CSR_WIFI_RESULT_UNSUPPORTED
|
||||
- The request/procedure did not succeed because the feature
|
||||
is not supported yet
|
||||
CSR_WIFI_RESULT_UNAVAILABLE
|
||||
- The request cannot be processed at this time
|
||||
CSR_WIFI_RESULT_WIFI_OFF
|
||||
- The requested action is not available because Wi-Fi is
|
||||
currently off
|
||||
CSR_WIFI_RESULT_SECURITY_ERROR
|
||||
- The request/procedure did not succeed because of a security
|
||||
error
|
||||
CSR_WIFI_RESULT_MIB_SET_FAILURE
|
||||
- MIB Set Failure: either the MIB OID to be written to does
|
||||
not exist or the MIB Value is invalid.
|
||||
CSR_WIFI_RESULT_INVALID_INTERFACE_TAG
|
||||
- The supplied Interface Tag is not valid.
|
||||
CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT
|
||||
- The new NOA configuration conflicts with the existing NOA configuration
|
||||
hence not accepted"
|
||||
*******************************************************************************/
|
||||
#define CSR_WIFI_RESULT_NOT_FOUND ((CsrResult) 0x0001)
|
||||
#define CSR_WIFI_RESULT_TIMED_OUT ((CsrResult) 0x0002)
|
||||
#define CSR_WIFI_RESULT_CANCELLED ((CsrResult) 0x0003)
|
||||
#define CSR_WIFI_RESULT_INVALID_PARAMETER ((CsrResult) 0x0004)
|
||||
#define CSR_WIFI_RESULT_NO_ROOM ((CsrResult) 0x0005)
|
||||
#define CSR_WIFI_RESULT_UNSUPPORTED ((CsrResult) 0x0006)
|
||||
#define CSR_WIFI_RESULT_UNAVAILABLE ((CsrResult) 0x0007)
|
||||
#define CSR_WIFI_RESULT_WIFI_OFF ((CsrResult) 0x0008)
|
||||
#define CSR_WIFI_RESULT_SECURITY_ERROR ((CsrResult) 0x0009)
|
||||
#define CSR_WIFI_RESULT_MIB_SET_FAILURE ((CsrResult) 0x000A)
|
||||
#define CSR_WIFI_RESULT_INVALID_INTERFACE_TAG ((CsrResult) 0x000B)
|
||||
#define CSR_WIFI_RESULT_P2P_NOA_CONFIG_CONFLICT ((CsrResult) 0x000C)
|
||||
|
||||
#define CSR_WIFI_VERSION "5.0.3.0"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
250
drivers/staging/csr/csr_wifi_fsm.h
Normal file
250
drivers/staging/csr/csr_wifi_fsm.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_FSM_H
|
||||
#define CSR_WIFI_FSM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_log_text.h"
|
||||
#include "csr_wifi_fsm_event.h"
|
||||
|
||||
/* including this file for CsrWifiInterfaceMode*/
|
||||
#include "csr_wifi_common.h"
|
||||
|
||||
#define CSR_WIFI_FSM_ENV (0xFFFF)
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Toplevel FSM context data
|
||||
*
|
||||
* @par Description
|
||||
* Holds ALL FSM static and dynamic data for a FSM
|
||||
*/
|
||||
typedef struct CsrWifiFsmContext CsrWifiFsmContext;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM External Wakeup CallbackFunction Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Defines the external wakeup function for the FSM
|
||||
* to call when an external event is injected into the systen
|
||||
*
|
||||
* @param[in] context : External context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmExternalWakupCallbackPtr)(void *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Initialises a top level FSM context
|
||||
*
|
||||
* @par Description
|
||||
* Initialises the FSM Context to an initial state and allocates
|
||||
* space for "maxProcesses" number of instances
|
||||
*
|
||||
* @param[in] osaContext : OSA context
|
||||
* @param[in] applicationContext : Internal fsm application context
|
||||
* @param[in] externalContext : External context
|
||||
* @param[in] maxProcesses : Max processes to allocate room for
|
||||
*
|
||||
* @return
|
||||
* CsrWifiFsmContext* fsm context
|
||||
*/
|
||||
extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externalContext, CsrUint16 maxProcesses, CsrLogTextTaskId loggingTaskId);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Resets the FSM's back to first conditions
|
||||
*
|
||||
* @par Description
|
||||
* This function is used to free any dynamic resources allocated for the
|
||||
* given context by CsrWifiFsmInit().
|
||||
* The FSM's reset function is called to cleanup any fsm specific memory
|
||||
* The reset funtion does NOT need to free the fsm data pointer as
|
||||
* CsrWifiFsmShutdown() will do it.
|
||||
* the FSM's init function is call again to reinitialise the FSM context.
|
||||
* CsrWifiFsmReset() should NEVER be called when CsrWifiFsmExecute() is running.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmReset(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Frees resources allocated by CsrWifiFsmInit
|
||||
*
|
||||
* @par Description
|
||||
* This function is used to free any dynamic resources allocated for the
|
||||
* given context by CsrWifiFsmInit(), prior to complete termination of
|
||||
* the program.
|
||||
* The FSM's reset function is called to cleanup any fsm specific memory.
|
||||
* The reset funtion does NOT need to free the fsm data pointer as
|
||||
* CsrWifiFsmShutdown() will do it.
|
||||
* CsrWifiFsmShutdown() should NEVER be called when CsrWifiFsmExecute() is running.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmShutdown(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Executes the fsm context
|
||||
*
|
||||
* @par Description
|
||||
* Executes the FSM context and runs until ALL events in the context are processed.
|
||||
* When no more events are left to process then CsrWifiFsmExecute() returns to a time
|
||||
* specifying when to next call the CsrWifiFsmExecute()
|
||||
* Scheduling, threading, blocking and external event notification are outside
|
||||
* the scope of the FSM and CsrWifiFsmExecute().
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
|
||||
*/
|
||||
extern CsrUint32 CsrWifiFsmExecute(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Adds an event to the FSM context's external event queue for processing
|
||||
*
|
||||
* @par Description
|
||||
* Adds an event to the contexts external queue
|
||||
* This is thread safe and adds an event to the fsm's external event queue.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] event : event to add to the event queue
|
||||
* @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id)
|
||||
* @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV)
|
||||
* @param[in] id : event id
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEvent *event, CsrUint16 source, CsrUint16 destination, CsrPrim primtype, CsrUint16 id);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Adds an Alien event to the FSM context's external event queue for processing
|
||||
*
|
||||
* @par Description
|
||||
* Adds an event to the contexts external queue
|
||||
* This is thread safe and adds an event to the fsm's external event queue.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] event : event to add to the event queue
|
||||
* @param[in] source : source of the event (this can be a synergy task queue or an fsm instance id)
|
||||
* @param[in] destination : destination of the event (This can be a fsm instance id or CSR_WIFI_FSM_ENV)
|
||||
* @param[in] id : event id
|
||||
*/
|
||||
#define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \
|
||||
{ \
|
||||
CsrWifiFsmAlienEvent *_evt = (CsrWifiFsmAlienEvent *)CsrPmemAlloc(sizeof(CsrWifiFsmAlienEvent)); \
|
||||
_evt->alienEvent = _alienEvent; \
|
||||
CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Current time of day in ms
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* CsrUint32 32 bit ms tick
|
||||
*/
|
||||
extern CsrUint32 CsrWifiFsmGetTimeOfDayMs(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Gets the time until the next FSM timer expiry
|
||||
*
|
||||
* @par Description
|
||||
* Returns the next timeout time or 0 if no timers are set.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* CsrUint32 Time in ms until next timeout or 0xFFFFFFFF for no timer set
|
||||
*/
|
||||
extern CsrUint32 CsrWifiFsmGetNextTimeout(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Fast forwards the fsm timers by ms Milliseconds
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] ms : Milliseconds to fast forward by
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, CsrUint16 ms);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* shift the current time of day by ms amount
|
||||
*
|
||||
* @par Description
|
||||
* usefull to speed up tests where time needs to pass
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] ms : ms to adjust time by
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmTestAdvanceTime(CsrWifiFsmContext *context, CsrUint32 ms);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Check if the fsm has events to process
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* CsrBool returns TRUE if there are events for the FSM to process
|
||||
*/
|
||||
extern CsrBool CsrWifiFsmHasEvents(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* function that installs the contexts wakeup function
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] callback : Callback function pointer
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
extern void CsrWifiFsmInstallWakeupCallback(CsrWifiFsmContext *context, CsrWifiFsmExternalWakupCallbackPtr callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_FSM_H */
|
||||
|
51
drivers/staging/csr/csr_wifi_fsm_event.h
Normal file
51
drivers/staging/csr/csr_wifi_fsm_event.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_FSM_EVENT_H
|
||||
#define CSR_WIFI_FSM_EVENT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_sched.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM event header.
|
||||
*
|
||||
* @par Description
|
||||
* All events MUST have this struct as the FIRST member.
|
||||
* The next member is used internally for linked lists
|
||||
*/
|
||||
typedef struct CsrWifiFsmEvent
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 primtype;
|
||||
CsrSchedQid destination;
|
||||
CsrSchedQid source;
|
||||
|
||||
/* Private pointer to allow an optimal Event list */
|
||||
/* NOTE: Ignore this pointer.
|
||||
* Do not waste code initializing OR freeing it.
|
||||
* The pointer is used internally in the CsrWifiFsm code
|
||||
* to avoid a second malloc when queuing events.
|
||||
*/
|
||||
struct CsrWifiFsmEvent *next;
|
||||
} CsrWifiFsmEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_FSM_EVENT_H */
|
||||
|
441
drivers/staging/csr/csr_wifi_fsm_types.h
Normal file
441
drivers/staging/csr/csr_wifi_fsm_types.h
Normal file
|
@ -0,0 +1,441 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_FSM_TYPES_H
|
||||
#define CSR_WIFI_FSM_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_util.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_panic.h"
|
||||
#include "csr_sched.h"
|
||||
|
||||
#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
|
||||
#include "csr_framework_ext.h"
|
||||
#endif
|
||||
|
||||
#include "csr_wifi_fsm.h"
|
||||
|
||||
#define CSR_WIFI_FSM_MAX_TRANSITION_HISTORY 10
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM event list header.
|
||||
*
|
||||
* @par Description
|
||||
* Singly linked list of events.
|
||||
*/
|
||||
typedef struct CsrWifiFsmEventList
|
||||
{
|
||||
CsrWifiFsmEvent *first;
|
||||
CsrWifiFsmEvent *last;
|
||||
} CsrWifiFsmEventList;
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM timer id.
|
||||
*
|
||||
* @par Description
|
||||
* Composite Id made up of the type, dest and a unique id so
|
||||
* CsrWifiFsmRemoveTimer knows where to look when removing the timer
|
||||
*/
|
||||
typedef struct CsrWifiFsmTimerId
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 primtype;
|
||||
CsrSchedQid destination;
|
||||
CsrUint16 uniqueid;
|
||||
} CsrWifiFsmTimerId;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM timer header.
|
||||
*
|
||||
* @par Description
|
||||
* All timer MUST have this struct as the FIRST member.
|
||||
* The first members of the structure MUST remain compatable
|
||||
* with the CsrWifiFsmEvent so that timers are just specialised events
|
||||
*/
|
||||
typedef struct CsrWifiFsmTimer
|
||||
{
|
||||
CsrPrim type;
|
||||
CsrUint16 primtype;
|
||||
CsrSchedQid destination;
|
||||
CsrSchedQid source;
|
||||
|
||||
/* Private pointer to allow an optimal Event list */
|
||||
struct CsrWifiFsmTimer *next;
|
||||
|
||||
CsrWifiFsmTimerId timerid;
|
||||
CsrUint32 timeoutTimeMs;
|
||||
} CsrWifiFsmTimer;
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Fsm Alien Event
|
||||
*
|
||||
* @par Description
|
||||
* Allows the wrapping of alien events that do not use CsrWifiFsmEvent
|
||||
* as the first member of the Event struct
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent event;
|
||||
void *alienEvent;
|
||||
} CsrWifiFsmAlienEvent;
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM timer list header.
|
||||
*
|
||||
* @par Description
|
||||
* Singly linked list of timers.
|
||||
*/
|
||||
typedef struct CsrWifiFsmTimerList
|
||||
{
|
||||
CsrWifiFsmTimer *first;
|
||||
CsrWifiFsmTimer *last;
|
||||
CsrUint16 nexttimerid;
|
||||
} CsrWifiFsmTimerList;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Process Entry Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Defines the entry function for a processes.
|
||||
* Called at process initialisation.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmProcEntryFnPtr)(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Process Transition Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Defines a transition function for a processes.
|
||||
* Called when an event causes a transition on a process
|
||||
*
|
||||
* @param[in] CsrWifiFsmContext* : FSM context
|
||||
* @param[in] void* : FSM data (can be NULL)
|
||||
* @param[in] const CsrWifiFsmEvent* : event to process
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmTransitionFnPtr)(CsrWifiFsmContext *context, void *fsmData, const CsrWifiFsmEvent *event);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Process reset/shutdown Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Defines the reset/shutdown function for a processes.
|
||||
* Called to reset or shutdown an fsm.
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmProcResetFnPtr)(CsrWifiFsmContext *context);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* FSM Default Destination CallbackFunction Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Defines the default destination function for the FSM
|
||||
* to call when an event does not have a valid destination.
|
||||
* This
|
||||
*
|
||||
* @param[in] context : External context
|
||||
*
|
||||
* @return
|
||||
* CsrUint16 a valid destination OR CSR_WIFI_FSM_ENV
|
||||
*/
|
||||
typedef CsrUint16 (*CsrWifiFsmDestLookupCallbackPtr)(void *context, const CsrWifiFsmEvent *event);
|
||||
|
||||
|
||||
#ifdef CSR_WIFI_FSM_DUMP_ENABLE
|
||||
/**
|
||||
* @brief
|
||||
* Trace Dump Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Called when we want to trace the FSM
|
||||
*
|
||||
* @param[in] context : FSM context
|
||||
* @param[in] id : fsm id
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmDumpFnPtr)(CsrWifiFsmContext *context, void *fsmData);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Event ID to transition function entry
|
||||
*
|
||||
* @par Description
|
||||
* Event ID to Transition Entry in a state table.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint32 eventid;
|
||||
CsrWifiFsmTransitionFnPtr transition;
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
const CsrCharString *transitionName;
|
||||
#endif
|
||||
} CsrWifiFsmEventEntry;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Single State's Transition Table
|
||||
*
|
||||
* @par Description
|
||||
* Stores Data for a single State's event to
|
||||
* transition functions mapping
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const CsrUint8 numEntries;
|
||||
const CsrBool saveAll;
|
||||
const CsrWifiFsmEventEntry *eventEntryArray; /* array of transition function pointers for state */
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
CsrUint16 stateNumber;
|
||||
const CsrCharString *stateName;
|
||||
#endif
|
||||
} CsrWifiFsmTableEntry;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Process State Transtion table
|
||||
*
|
||||
* @par Description
|
||||
* Stores Data for a processes State to transition table
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 numStates; /* number of states */
|
||||
const CsrWifiFsmTableEntry *aStateEventMatrix; /* state event matrix */
|
||||
} CsrWifiFsmTransitionFunctionTable;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Const Process definition
|
||||
*
|
||||
* @par Description
|
||||
* Constant process specification.
|
||||
* This is ALL the non dynamic data that defines
|
||||
* a process.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const CsrCharString *processName;
|
||||
const CsrUint32 processId;
|
||||
const CsrWifiFsmTransitionFunctionTable transitionTable;
|
||||
const CsrWifiFsmTableEntry unhandledTransitions;
|
||||
const CsrWifiFsmTableEntry ignoreFunctions;
|
||||
const CsrWifiFsmProcEntryFnPtr entryFn;
|
||||
const CsrWifiFsmProcResetFnPtr resetFn;
|
||||
#ifdef CSR_WIFI_FSM_DUMP_ENABLE
|
||||
const CsrWifiFsmDumpFnPtr dumpFn; /* Called to dump fsm specific trace if not NULL */
|
||||
#endif
|
||||
} CsrWifiFsmProcessStateMachine;
|
||||
|
||||
#ifdef CSR_WIFI_FSM_DUMP_ENABLE
|
||||
/**
|
||||
* @brief
|
||||
* Storage for state transition info
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 transitionNumber;
|
||||
CsrWifiFsmEvent event;
|
||||
CsrUint16 fromState;
|
||||
CsrUint16 toState;
|
||||
CsrWifiFsmTransitionFnPtr transitionFn;
|
||||
CsrUint16 transitionCount; /* number consecutive of times this transition was seen */
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
const CsrCharString *transitionName;
|
||||
#endif
|
||||
} CsrWifiFsmTransitionRecord;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Storage for the last state X transitions
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 numTransitions;
|
||||
CsrWifiFsmTransitionRecord records[CSR_WIFI_FSM_MAX_TRANSITION_HISTORY];
|
||||
} CsrWifiFsmTransitionRecords;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Dynamic Process data
|
||||
*
|
||||
* @par Description
|
||||
* Dynamic process data that is used to keep track of the
|
||||
* state and data for a process instance
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const CsrWifiFsmProcessStateMachine *fsmInfo; /* state machine info that is constant regardless of context */
|
||||
CsrUint16 instanceId; /* Runtime process id */
|
||||
CsrUint16 state; /* Current state */
|
||||
void *params; /* Instance user data */
|
||||
CsrWifiFsmEventList savedEventQueue; /* The saved event queue */
|
||||
struct CsrWifiFsmInstanceEntry *subFsm; /* Sub Fsm instance data */
|
||||
struct CsrWifiFsmInstanceEntry *subFsmCaller; /* The Fsm instance that created the SubFsm and should be used for callbacks*/
|
||||
#ifdef CSR_WIFI_FSM_DUMP_ENABLE
|
||||
CsrWifiFsmTransitionRecords transitionRecords; /* Last X transitions in the FSM */
|
||||
#endif
|
||||
} CsrWifiFsmInstanceEntry;
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* OnCreate Callback Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Called when an fsm is created.
|
||||
*
|
||||
* @param[in] extContext : External context
|
||||
* @param[in] instance : FSM instance
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmOnCreateFnPtr)(void *extContext, const CsrWifiFsmInstanceEntry *instance);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* OnTransition Callback Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Called when an event is processed by a fsm
|
||||
*
|
||||
* @param[in] extContext : External context
|
||||
* @param[in] eventEntryArray : Entry data
|
||||
* @param[in] event : Event
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmOnTransitionFnPtr)(void *extContext, const CsrWifiFsmEventEntry *eventEntryArray, const CsrWifiFsmEvent *event);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* OnStateChange Callback Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Called when CsrWifiFsmNextState is called
|
||||
*
|
||||
* @param[in] extContext : External context
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmOnStateChangeFnPtr)(void *extContext, CsrUint16 nextstate);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* OnIgnore,OnError or OnInvalid Callback Function Pointer
|
||||
*
|
||||
* @par Description
|
||||
* Called when an event is processed by a fsm
|
||||
*
|
||||
* @param[in] extContext : External context
|
||||
* @param[in] event : Event
|
||||
*
|
||||
* @return
|
||||
* void
|
||||
*/
|
||||
typedef void (*CsrWifiFsmOnEventFnPtr)(void *extContext, const CsrWifiFsmEvent *event);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Toplevel FSM context data
|
||||
*
|
||||
* @par Description
|
||||
* Holds ALL FSM static and dynamic data for a FSM
|
||||
*/
|
||||
struct CsrWifiFsmContext
|
||||
{
|
||||
CsrWifiFsmEventList eventQueue; /* The internal event queue */
|
||||
CsrWifiFsmEventList externalEventQueue; /* The external event queue */
|
||||
#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
|
||||
CsrMutexHandle externalEventQueueLock; /* The external event queue mutex */
|
||||
#endif
|
||||
CsrUint32 timeOffset; /* Amount to adjust the TimeOfDayMs by */
|
||||
CsrWifiFsmTimerList timerQueue; /* The internal timer queue */
|
||||
CsrBool useTempSaveList; /* Should the temp save list be used */
|
||||
CsrWifiFsmEventList tempSaveList; /* The temp save event queue */
|
||||
CsrWifiFsmEvent *eventForwardedOrSaved; /* The event that was forwarded or Saved */
|
||||
CsrUint16 maxProcesses; /* Size of instanceArray */
|
||||
CsrUint16 numProcesses; /* Current number allocated in instanceArray */
|
||||
CsrWifiFsmInstanceEntry *instanceArray; /* Array of processes for this component */
|
||||
CsrWifiFsmInstanceEntry *ownerInstance; /* The Process that owns currentInstance (SubFsm support) */
|
||||
CsrWifiFsmInstanceEntry *currentInstance; /* Current Process that is executing */
|
||||
CsrWifiFsmExternalWakupCallbackPtr externalEventFn; /* External event Callback */
|
||||
CsrWifiFsmOnEventFnPtr appIgnoreCallback; /* Application Ignore event Callback */
|
||||
CsrWifiFsmDestLookupCallbackPtr appEvtDstCallback; /* Application Lookup event Destination Function*/
|
||||
|
||||
void *applicationContext; /* Internal fsm application context */
|
||||
void *externalContext; /* External context (set by the user of the fsm)*/
|
||||
CsrLogTextTaskId loggingTaskId; /* Task Id to use in any logging output */
|
||||
|
||||
#ifndef CSR_WIFI_FSM_SCHEDULER_DISABLED
|
||||
CsrSchedTid schedTimerId; /* Scheduler TimerId for use in Scheduler Tasks */
|
||||
CsrUint32 schedTimerNexttimeoutMs; /* Next timeout time for the current timer */
|
||||
#endif
|
||||
|
||||
#ifdef CSR_WIFI_FSM_MUTEX_ENABLE
|
||||
#ifdef CSR_WIFI_FSM_TRANSITION_LOCK
|
||||
CsrMutexHandle transitionLock; /* Lock when calling transition functions */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
CsrWifiFsmOnCreateFnPtr onCreate; /* Debug Transition Callback */
|
||||
CsrWifiFsmOnTransitionFnPtr onTransition; /* Debug Transition Callback */
|
||||
CsrWifiFsmOnTransitionFnPtr onUnhandedCallback; /* Unhanded event Callback */
|
||||
CsrWifiFsmOnStateChangeFnPtr onStateChange; /* Debug State Change Callback */
|
||||
CsrWifiFsmOnEventFnPtr onIgnoreCallback; /* Ignore event Callback */
|
||||
CsrWifiFsmOnEventFnPtr onSaveCallback; /* Save event Callback */
|
||||
CsrWifiFsmOnEventFnPtr onErrorCallback; /* Error event Callback */
|
||||
CsrWifiFsmOnEventFnPtr onInvalidCallback; /* Invalid event Callback */
|
||||
#endif
|
||||
#ifdef CSR_WIFI_FSM_DUMP_ENABLE
|
||||
CsrUint16 masterTransitionNumber; /* Increments on every transition */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_FSM_TYPES_H */
|
114
drivers/staging/csr/csr_wifi_hip_card.h
Normal file
114
drivers/staging/csr/csr_wifi_hip_card.h
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* FILE : csr_wifi_hip_card.h
|
||||
*
|
||||
* PURPOSE : Defines abstract interface for hardware specific functions.
|
||||
* Note, this is a different file from one of the same name in the
|
||||
* Windows driver.
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
#ifndef __CARD_H__
|
||||
#define __CARD_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_wifi_hip_card_sdio.h"
|
||||
#include "csr_wifi_hip_signals.h"
|
||||
#include "csr_wifi_hip_unifi_udi.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* CardEnableInt -
|
||||
*/
|
||||
CsrResult CardEnableInt(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardGenInt -
|
||||
*/
|
||||
CsrResult CardGenInt(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardPendingInt -
|
||||
*/
|
||||
CsrResult CardPendingInt(card_t *card, CsrBool *pintr);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardDisableInt -
|
||||
*/
|
||||
CsrResult CardDisableInt(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardClearInt -
|
||||
*/
|
||||
CsrResult CardClearInt(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardDisable -
|
||||
*/
|
||||
void CardDisable(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardIntEnabled -
|
||||
*/
|
||||
CsrResult CardIntEnabled(card_t *card, CsrBool *enabled);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardGetDataSlotSize
|
||||
*/
|
||||
CsrUint16 CardGetDataSlotSize(card_t *card);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardWriteBulkData -
|
||||
*/
|
||||
CsrResult CardWriteBulkData(card_t *card, card_signal_t *csptr, unifi_TrafficQueue queue);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* CardClearFromHostDataSlot -
|
||||
*/
|
||||
void CardClearFromHostDataSlot(card_t *card, const CsrInt16 aSlotNum);
|
||||
|
||||
/*****************************************************************************
|
||||
* CardGetFreeFromHostDataSlots -
|
||||
*/
|
||||
CsrUint16 CardGetFreeFromHostDataSlots(card_t *card);
|
||||
|
||||
CsrUint16 CardAreAllFromHostDataSlotsEmpty(card_t *card);
|
||||
|
||||
CsrResult card_start_processor(card_t *card, enum unifi_dbg_processors_select which);
|
||||
|
||||
CsrResult card_wait_for_firmware_to_start(card_t *card, CsrUint32 *paddr);
|
||||
|
||||
CsrResult unifi_dl_firmware(card_t *card, void *arg);
|
||||
CsrResult unifi_dl_patch(card_t *card, void *arg, CsrUint32 boot_ctrl);
|
||||
CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode);
|
||||
void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw);
|
||||
|
||||
CsrResult unifi_coredump_handle_request(card_t *card);
|
||||
|
||||
CsrResult ConvertCsrSdioToCsrHipResult(card_t *card, CsrResult csrResult);
|
||||
#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
|
||||
void unifi_debug_log_to_buf(const CsrCharString *fmt, ...);
|
||||
void unifi_debug_string_to_buf(const CsrCharString *str);
|
||||
void unifi_debug_hex_to_buf(const CsrCharString *buff, CsrUint16 length);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CARD_H__ */
|
4128
drivers/staging/csr/csr_wifi_hip_card_sdio.c
Normal file
4128
drivers/staging/csr/csr_wifi_hip_card_sdio.c
Normal file
File diff suppressed because it is too large
Load diff
702
drivers/staging/csr/csr_wifi_hip_card_sdio.h
Normal file
702
drivers/staging/csr/csr_wifi_hip_card_sdio.h
Normal file
|
@ -0,0 +1,702 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
*
|
||||
* FILE: csr_wifi_hip_card_sdio.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* Internal header for Card API for SDIO.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CARD_SDIO_H__
|
||||
#define __CARD_SDIO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_unifi_udi.h"
|
||||
#include "csr_wifi_hip_unifihw.h"
|
||||
#include "csr_wifi_hip_unifiversion.h"
|
||||
#ifndef CSR_WIFI_HIP_TA_DISABLE
|
||||
#include "csr_wifi_hip_ta_sampling.h"
|
||||
#endif
|
||||
#include "csr_wifi_hip_xbv.h"
|
||||
#include "csr_wifi_hip_chiphelper.h"
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Configuration items.
|
||||
* Which of these should go in a platform unifi_config.h file?
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* When the traffic queues contain more signals than there is space for on
|
||||
* UniFi, a limiting algorithm comes into play.
|
||||
* If a traffic queue has enough slots free to buffer more traffic from the
|
||||
* network stack, then the following check is applied. The number of free
|
||||
* slots is RESUME_XMIT_THRESHOLD.
|
||||
*/
|
||||
#define RESUME_XMIT_THRESHOLD 4
|
||||
|
||||
|
||||
/*
|
||||
* When reading signals from UniFi, the host processes pending all signals
|
||||
* and then acknowledges them together in a single write to update the
|
||||
* to-host-chunks-read location.
|
||||
* When there is more than one bulk data transfer (e.g. one received data
|
||||
* packet and a request for the payload data of a transmitted packet), the
|
||||
* update can be delayed significantly. This ties up resources on chip.
|
||||
*
|
||||
* To remedy this problem, to-host-chunks-read is updated after processing
|
||||
* a signal if TO_HOST_FLUSH_THRESHOLD bytes of bulk data have been
|
||||
* transferred since the last update.
|
||||
*/
|
||||
#define TO_HOST_FLUSH_THRESHOLD (500 * 5)
|
||||
|
||||
|
||||
/* SDIO Card Common Control Registers */
|
||||
#define SDIO_CCCR_SDIO_REVISION (0x00)
|
||||
#define SDIO_SD_SPEC_REVISION (0x01)
|
||||
#define SDIO_IO_ENABLE (0x02)
|
||||
#define SDIO_IO_READY (0x03)
|
||||
#define SDIO_INT_ENABLE (0x04)
|
||||
#define SDIO_INT_PENDING (0x05)
|
||||
#define SDIO_IO_ABORT (0x06)
|
||||
#define SDIO_BUS_IFACE_CONTROL (0x07)
|
||||
#define SDIO_CARD_CAPABILOTY (0x08)
|
||||
#define SDIO_COMMON_CIS_POINTER (0x09)
|
||||
#define SDIO_BUS_SUSPEND (0x0C)
|
||||
#define SDIO_FUNCTION_SELECT (0x0D)
|
||||
#define SDIO_EXEC_FLAGS (0x0E)
|
||||
#define SDIO_READY_FLAGS (0x0F)
|
||||
#define SDIO_FN0_BLOCK_SIZE (0x10)
|
||||
#define SDIO_POWER_CONTROL (0x12)
|
||||
#define SDIO_VENDOR_START (0xF0)
|
||||
|
||||
#define SDIO_CSR_HOST_WAKEUP (0xf0)
|
||||
#define SDIO_CSR_HOST_INT_CLEAR (0xf1)
|
||||
#define SDIO_CSR_FROM_HOST_SCRATCH0 (0xf2)
|
||||
#define SDIO_CSR_FROM_HOST_SCRATCH1 (0xf3)
|
||||
#define SDIO_CSR_TO_HOST_SCRATCH0 (0xf4)
|
||||
#define SDIO_CSR_TO_HOST_SCRATCH1 (0xf5)
|
||||
#define SDIO_CSR_FUNC_EN (0xf6)
|
||||
#define SDIO_CSR_CSPI_MODE (0xf7)
|
||||
#define SDIO_CSR_CSPI_STATUS (0xf8)
|
||||
#define SDIO_CSR_CSPI_PADDING (0xf9)
|
||||
|
||||
|
||||
#define UNIFI_SD_INT_ENABLE_IENM 0x0001 /* Master INT Enable */
|
||||
|
||||
#ifdef CSR_PRE_ALLOC_NET_DATA
|
||||
#define BULK_DATA_PRE_ALLOC_NUM 16
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure to hold configuration information read from UniFi.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* The version of the SDIO signal queues and bulk data pools
|
||||
* configuration structure. The MSB is the major version number, used to
|
||||
* indicate incompatible changes. The LSB gives the minor revision number,
|
||||
* used to indicate changes that maintain backwards compatibility.
|
||||
*/
|
||||
CsrUint16 version;
|
||||
|
||||
/*
|
||||
* offset from the start of the shared data memory to the SD IO
|
||||
* control structure.
|
||||
*/
|
||||
CsrUint16 sdio_ctrl_offset;
|
||||
|
||||
/* Buffer handle of the from-host signal queue */
|
||||
CsrUint16 fromhost_sigbuf_handle;
|
||||
|
||||
/* Buffer handle of the to-host signal queue */
|
||||
CsrUint16 tohost_sigbuf_handle;
|
||||
|
||||
/*
|
||||
* Maximum number of signal primitive or bulk data command fragments that may be
|
||||
* pending in the to-hw signal queue.
|
||||
*/
|
||||
CsrUint16 num_fromhost_sig_frags;
|
||||
|
||||
/*
|
||||
* Number of signal primitive or bulk data command fragments that must be pending
|
||||
* in the to-host signal queue before the host will generate an interrupt
|
||||
* to indicate that it has read a signal. This will usually be the total
|
||||
* capacity of the to-host signal buffer less the size of the largest signal
|
||||
* primitive divided by the signal primitive fragment size, but may be set
|
||||
* to 1 to request interrupts every time that the host read a signal.
|
||||
* Note that the hw may place more signals in the to-host signal queue
|
||||
* than indicated by this field.
|
||||
*/
|
||||
CsrUint16 num_tohost_sig_frags;
|
||||
|
||||
/*
|
||||
* Number of to-hw bulk data slots. Slots are numbered from 0 (zero) to
|
||||
* one less than the value in this field
|
||||
*/
|
||||
CsrUint16 num_fromhost_data_slots;
|
||||
|
||||
/*
|
||||
* Number of frm-hw bulk data slots. Slots are numbered from 0 (zero) to
|
||||
* one less than the value in this field
|
||||
*/
|
||||
CsrUint16 num_tohost_data_slots;
|
||||
|
||||
/*
|
||||
* Size of the bulk data slots (2 octets)
|
||||
* The size of the bulk data slots in octets. This will usually be
|
||||
* the size of the largest MSDU. The value should always be even.
|
||||
*/
|
||||
CsrUint16 data_slot_size;
|
||||
|
||||
/*
|
||||
* Indicates that the host has finished the initialisation sequence.
|
||||
* Initialised to 0x0000 by the firmware, and set to 0x0001 by us.
|
||||
*/
|
||||
CsrUint16 initialised;
|
||||
|
||||
/* Added by protocol version 0x0001 */
|
||||
CsrUint32 overlay_size;
|
||||
|
||||
/* Added by protocol version 0x0300 */
|
||||
CsrUint16 data_slot_round;
|
||||
CsrUint16 sig_frag_size;
|
||||
|
||||
/* Added by protocol version 0x0500 */
|
||||
CsrUint16 tohost_signal_padding;
|
||||
} sdio_config_data_t;
|
||||
|
||||
/*
|
||||
* These values may change with versions of the Host Interface Protocol.
|
||||
*/
|
||||
/*
|
||||
* Size of config info block pointed to by the CSR_SLT_SDIO_SLOT_CONFIG
|
||||
* entry in the f/w symbol table
|
||||
*/
|
||||
#define SDIO_CONFIG_DATA_SIZE 30
|
||||
|
||||
/* Offset of the INIT flag in the config info block. */
|
||||
#define SDIO_INIT_FLAG_OFFSET 0x12
|
||||
#define SDIO_TO_HOST_SIG_PADDING_OFFSET 0x1C
|
||||
|
||||
|
||||
/* Structure for a bulk data transfer command */
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 cmd_and_len; /* bits 12-15 cmd, bits 0-11 len */
|
||||
CsrUint16 data_slot; /* slot number, perhaps OR'd with SLOT_DIR_TO_HOST */
|
||||
CsrUint16 offset;
|
||||
CsrUint16 buffer_handle;
|
||||
} bulk_data_cmd_t;
|
||||
|
||||
|
||||
/* Bulk Data signal command values */
|
||||
#define SDIO_CMD_SIGNAL 0x00
|
||||
#define SDIO_CMD_TO_HOST_TRANSFER 0x01
|
||||
#define SDIO_CMD_TO_HOST_TRANSFER_ACK 0x02 /*deprecated*/
|
||||
#define SDIO_CMD_FROM_HOST_TRANSFER 0x03
|
||||
#define SDIO_CMD_FROM_HOST_TRANSFER_ACK 0x04 /*deprecated*/
|
||||
#define SDIO_CMD_CLEAR_SLOT 0x05
|
||||
#define SDIO_CMD_OVERLAY_TRANSFER 0x06
|
||||
#define SDIO_CMD_OVERLAY_TRANSFER_ACK 0x07 /*deprecated*/
|
||||
#define SDIO_CMD_FROM_HOST_AND_CLEAR 0x08
|
||||
#define SDIO_CMD_PADDING 0x0f
|
||||
|
||||
#define SLOT_DIR_TO_HOST 0x8000
|
||||
|
||||
|
||||
/* Initialise bulkdata slot
|
||||
* params:
|
||||
* bulk_data_desc_t *bulk_data_slot
|
||||
*/
|
||||
#define UNIFI_INIT_BULK_DATA(bulk_data_slot) \
|
||||
{ \
|
||||
(bulk_data_slot)->os_data_ptr = NULL; \
|
||||
(bulk_data_slot)->data_length = 0; \
|
||||
(bulk_data_slot)->os_net_buf_ptr = NULL; \
|
||||
(bulk_data_slot)->net_buf_length = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Structure to contain a SIGNAL datagram.
|
||||
* This is used to build signal queues between the main driver and the
|
||||
* i/o thread.
|
||||
* The fields are:
|
||||
* sigbuf Contains the HIP signal is wire-format (i.e. packed,
|
||||
* little-endian)
|
||||
* bulkdata Contains a copy of any associated bulk data
|
||||
* signal_length The size of the signal in the sigbuf
|
||||
*/
|
||||
typedef struct card_signal
|
||||
{
|
||||
CsrUint8 sigbuf[UNIFI_PACKED_SIGBUF_SIZE];
|
||||
|
||||
/* Length of the SIGNAL inside sigbuf */
|
||||
CsrUint16 signal_length;
|
||||
|
||||
bulk_data_desc_t bulkdata[UNIFI_MAX_DATA_REFERENCES];
|
||||
} card_signal_t;
|
||||
|
||||
|
||||
/*
|
||||
* Control structure for a generic ring buffer.
|
||||
*/
|
||||
#define UNIFI_QUEUE_NAME_MAX_LENGTH 16
|
||||
typedef struct
|
||||
{
|
||||
card_signal_t *q_body;
|
||||
|
||||
/* Num elements in queue (capacity is one less than this!) */
|
||||
CsrUint16 q_length;
|
||||
|
||||
CsrUint16 q_wr_ptr;
|
||||
CsrUint16 q_rd_ptr;
|
||||
|
||||
CsrCharString name[UNIFI_QUEUE_NAME_MAX_LENGTH];
|
||||
} q_t;
|
||||
|
||||
|
||||
#define UNIFI_RESERVED_COMMAND_SLOTS 2
|
||||
|
||||
/* Considering approx 500 us per packet giving 0.5 secs */
|
||||
#define UNIFI_PACKETS_INTERVAL 1000
|
||||
|
||||
/*
|
||||
* Dynamic slot reservation for QoS
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 from_host_used_slots[UNIFI_NO_OF_TX_QS];
|
||||
CsrUint16 from_host_max_slots[UNIFI_NO_OF_TX_QS];
|
||||
CsrUint16 from_host_reserved_slots[UNIFI_NO_OF_TX_QS];
|
||||
|
||||
/* Parameters to determine if a queue was active.
|
||||
If number of packets sent is greater than the threshold
|
||||
for the queue, the queue is considered active and no
|
||||
re reservation is done, it is important not to keep this
|
||||
value too low */
|
||||
/* Packets sent during this interval */
|
||||
CsrUint16 packets_txed[UNIFI_NO_OF_TX_QS];
|
||||
CsrUint16 total_packets_txed;
|
||||
|
||||
/* Number of packets to see if slots need to be reassigned */
|
||||
CsrUint16 packets_interval;
|
||||
|
||||
/* Once a queue reaches a stable state, avoid processing */
|
||||
CsrBool queue_stable[UNIFI_NO_OF_TX_QS];
|
||||
} card_dynamic_slot_t;
|
||||
|
||||
|
||||
/* These are type-safe and don't write incorrect values to the
|
||||
* structure. */
|
||||
|
||||
/* Return queue slots used count
|
||||
* params:
|
||||
* const q_t *q
|
||||
* returns:
|
||||
* CsrUint16
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_SLOTS_USED(q) \
|
||||
(((q)->q_wr_ptr - (q)->q_rd_ptr < 0)? \
|
||||
((q)->q_wr_ptr - (q)->q_rd_ptr + (q)->q_length) : ((q)->q_wr_ptr - (q)->q_rd_ptr))
|
||||
|
||||
/* Return queue slots free count
|
||||
* params:
|
||||
* const q_t *q
|
||||
* returns:
|
||||
* CsrUint16
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_SLOTS_FREE(q) \
|
||||
((q)->q_length - CSR_WIFI_HIP_Q_SLOTS_USED((q)) - 1)
|
||||
|
||||
/* Return slot signal data pointer
|
||||
* params:
|
||||
* const q_t *q
|
||||
* CsrUint16 slot
|
||||
* returns:
|
||||
* card_signal_t *
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_SLOT_DATA(q, slot) \
|
||||
((q)->q_body + slot)
|
||||
|
||||
/* Return queue next read slot
|
||||
* params:
|
||||
* const q_t *q
|
||||
* returns:
|
||||
* CsrUint16 slot offset
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_NEXT_R_SLOT(q) \
|
||||
((q)->q_rd_ptr)
|
||||
|
||||
/* Return queue next write slot
|
||||
* params:
|
||||
* const q_t *q
|
||||
* returns:
|
||||
* CsrUint16 slot offset
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_NEXT_W_SLOT(q) \
|
||||
((q)->q_wr_ptr)
|
||||
|
||||
/* Return updated queue pointer wrapped around its length
|
||||
* params:
|
||||
* const q_t *q
|
||||
* CsrUint16 x amount to add to queue pointer
|
||||
* returns:
|
||||
* CsrUint16 wrapped queue pointer
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_WRAP(q, x) \
|
||||
((((x) >= (q)->q_length)?((x) % (q)->q_length) : (x)))
|
||||
|
||||
/* Advance queue read pointer
|
||||
* params:
|
||||
* const q_t *q
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_INC_R(q) \
|
||||
((q)->q_rd_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_rd_ptr + 1))
|
||||
|
||||
/* Advance queue write pointer
|
||||
* params:
|
||||
* const q_t *q
|
||||
*/
|
||||
#define CSR_WIFI_HIP_Q_INC_W(q) \
|
||||
((q)->q_wr_ptr = CSR_WIFI_HIP_Q_WRAP((q), (q)->q_wr_ptr + 1))
|
||||
|
||||
enum unifi_host_state
|
||||
{
|
||||
UNIFI_HOST_STATE_AWAKE = 0,
|
||||
UNIFI_HOST_STATE_DROWSY = 1,
|
||||
UNIFI_HOST_STATE_TORPID = 2
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bulk_data_desc_t bd;
|
||||
unifi_TrafficQueue queue; /* Used for dynamic slot reservation */
|
||||
} slot_desc_t;
|
||||
|
||||
/*
|
||||
* Structure describing a UniFi SDIO card.
|
||||
*/
|
||||
struct card
|
||||
{
|
||||
/*
|
||||
* Back pointer for the higher level OS code. This is passed as
|
||||
* an argument to callbacks (e.g. for received data and indications).
|
||||
*/
|
||||
void *ospriv;
|
||||
|
||||
/*
|
||||
* mapping of HIP slot to MA-PACKET.req host tag, the
|
||||
* array is indexed by slot numbers and each index stores
|
||||
* information of the last host tag it was used for
|
||||
*/
|
||||
CsrUint32 *fh_slot_host_tag_record;
|
||||
|
||||
|
||||
/* Info read from Symbol Table during probe */
|
||||
CsrUint32 build_id;
|
||||
CsrCharString build_id_string[128];
|
||||
|
||||
/* Retrieve from SDIO driver. */
|
||||
CsrUint16 chip_id;
|
||||
|
||||
/* Read from GBL_CHIP_VERSION. */
|
||||
CsrUint16 chip_version;
|
||||
|
||||
/* From the SDIO driver (probably 1) */
|
||||
CsrUint8 function;
|
||||
|
||||
/* This is sused to get the register addresses and things. */
|
||||
ChipDescript *helper;
|
||||
|
||||
/*
|
||||
* Bit mask of PIOs for the loader to waggle during download.
|
||||
* We assume these are connected to LEDs. The main firmware gets
|
||||
* the mask from a MIB entry.
|
||||
*/
|
||||
CsrInt32 loader_led_mask;
|
||||
|
||||
/*
|
||||
* Support for flow control. When the from-host queue of signals
|
||||
* is full, we ask the host upper layer to stop sending packets. When
|
||||
* the queue drains we tell it that it can send packets again.
|
||||
* We use this flag to remember the current state.
|
||||
*/
|
||||
#define card_is_tx_q_paused(card, q) (card->tx_q_paused_flag[q])
|
||||
#define card_tx_q_unpause(card, q) (card->tx_q_paused_flag[q] = 0)
|
||||
#define card_tx_q_pause(card, q) (card->tx_q_paused_flag[q] = 1)
|
||||
|
||||
CsrUint16 tx_q_paused_flag[UNIFI_TRAFFIC_Q_MAX + 1 + UNIFI_NO_OF_TX_QS]; /* defensive more than big enough */
|
||||
|
||||
/* UDI callback for logging UniFi interactions */
|
||||
udi_func_t udi_hook;
|
||||
|
||||
CsrUint8 bh_reason_host;
|
||||
CsrUint8 bh_reason_unifi;
|
||||
|
||||
/* SDIO clock speed request from OS layer */
|
||||
CsrUint8 request_max_clock;
|
||||
|
||||
/* Last SDIO clock frequency set */
|
||||
CsrUint32 sdio_clock_speed;
|
||||
|
||||
/*
|
||||
* Current host state (copy of value in IOABORT register and
|
||||
* spinlock to protect it.
|
||||
*/
|
||||
enum unifi_host_state host_state;
|
||||
|
||||
enum unifi_low_power_mode low_power_mode;
|
||||
enum unifi_periodic_wake_mode periodic_wake_mode;
|
||||
|
||||
/*
|
||||
* Ring buffer of signal structs for a queue of data packets from
|
||||
* the host.
|
||||
* The queue is empty when fh_data_q_num_rd == fh_data_q_num_wr.
|
||||
* To add a packet to the queue, copy it to index given by
|
||||
* (fh_data_q_num_wr%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_wr.
|
||||
* To take a packet from the queue, copy data from index given by
|
||||
* (fh_data_q_num_rd%UNIFI_SOFT_Q_LENGTH) and advance fh_data_q_num_rd.
|
||||
* fh_data_q_num_rd and fh_data_q_num_rd are both modulo 256.
|
||||
*/
|
||||
card_signal_t fh_command_q_body[UNIFI_SOFT_COMMAND_Q_LENGTH];
|
||||
q_t fh_command_queue;
|
||||
|
||||
card_signal_t fh_traffic_q_body[UNIFI_NO_OF_TX_QS][UNIFI_SOFT_TRAFFIC_Q_LENGTH];
|
||||
q_t fh_traffic_queue[UNIFI_NO_OF_TX_QS];
|
||||
|
||||
/*
|
||||
* Signal counts from UniFi SDIO Control Data Structure.
|
||||
* These are cached and synchronised with the UniFi before and after
|
||||
* a batch of operations.
|
||||
*
|
||||
* These are the modulo-256 count of signals written to or read from UniFi
|
||||
* The value is incremented for every signal.
|
||||
*/
|
||||
CsrInt32 from_host_signals_w;
|
||||
CsrInt32 from_host_signals_r;
|
||||
CsrInt32 to_host_signals_r;
|
||||
CsrInt32 to_host_signals_w;
|
||||
|
||||
|
||||
/* Should specify buffer size as a number of signals */
|
||||
/*
|
||||
* Enough for 10 th and 10 fh data slots:
|
||||
* 1 * 10 * 8 = 80
|
||||
* 2 * 10 * 8 = 160
|
||||
*/
|
||||
#define UNIFI_FH_BUF_SIZE 1024
|
||||
struct sigbuf
|
||||
{
|
||||
CsrUint8 *buf; /* buffer area */
|
||||
CsrUint8 *ptr; /* current pos */
|
||||
CsrUint16 count; /* signal count */
|
||||
CsrUint16 bufsize;
|
||||
} fh_buffer;
|
||||
struct sigbuf th_buffer;
|
||||
|
||||
|
||||
/*
|
||||
* Field to use for the incrementing value to write to the UniFi
|
||||
* SHARED_IO_INTERRUPT register.
|
||||
* Flag to say we need to generate an interrupt at end of processing.
|
||||
*/
|
||||
CsrUint32 unifi_interrupt_seq;
|
||||
CsrUint8 generate_interrupt;
|
||||
|
||||
|
||||
/* Pointers to the bulk data slots */
|
||||
slot_desc_t *from_host_data;
|
||||
bulk_data_desc_t *to_host_data;
|
||||
|
||||
|
||||
/*
|
||||
* Index of the next (hopefully) free data slot.
|
||||
* This is an optimisation that starts searching at a more likely point
|
||||
* than the beginning.
|
||||
*/
|
||||
CsrInt16 from_host_data_head;
|
||||
|
||||
/* Dynamic slot allocation for queues */
|
||||
card_dynamic_slot_t dynamic_slot_data;
|
||||
|
||||
/*
|
||||
* SDIO specific fields
|
||||
*/
|
||||
|
||||
/* Interface pointer for the SDIO library */
|
||||
CsrSdioFunction *sdio_if;
|
||||
|
||||
/* Copy of config_data struct from the card */
|
||||
sdio_config_data_t config_data;
|
||||
|
||||
/* SDIO address of the Initialised flag and Control Data struct */
|
||||
CsrUint32 init_flag_addr;
|
||||
CsrUint32 sdio_ctrl_addr;
|
||||
|
||||
/* The last value written to the Shared Data Memory Page register */
|
||||
CsrUint32 proc_select;
|
||||
CsrUint32 dmem_page;
|
||||
CsrUint32 pmem_page;
|
||||
|
||||
/* SDIO traffic counters limited to 32 bits for Synergy compatibility */
|
||||
CsrUint32 sdio_bytes_read;
|
||||
CsrUint32 sdio_bytes_written;
|
||||
|
||||
CsrUint8 memory_resources_allocated;
|
||||
|
||||
/* UniFi SDIO I/O Block size. */
|
||||
CsrUint16 sdio_io_block_size;
|
||||
|
||||
/* Pad transfer sizes to SDIO block boundaries */
|
||||
CsrBool sdio_io_block_pad;
|
||||
|
||||
/* Read from the XBV */
|
||||
struct FWOV fwov;
|
||||
|
||||
#ifndef CSR_WIFI_HIP_TA_DISABLE
|
||||
/* TA sampling */
|
||||
ta_data_t ta_sampling;
|
||||
#endif
|
||||
|
||||
/* Auto-coredump */
|
||||
CsrInt16 request_coredump_on_reset; /* request coredump on next reset */
|
||||
struct coredump_buf *dump_buf; /* root node */
|
||||
struct coredump_buf *dump_next_write; /* node to fill at next dump */
|
||||
struct coredump_buf *dump_cur_read; /* valid node to read, or NULL */
|
||||
|
||||
#ifdef CSR_WIFI_HIP_DATA_PLANE_PROFILE
|
||||
struct cmd_profile
|
||||
{
|
||||
CsrUint32 cmd52_count;
|
||||
CsrUint32 cmd53_count;
|
||||
CsrUint32 tx_count;
|
||||
CsrUint32 tx_cfm_count;
|
||||
CsrUint32 rx_count;
|
||||
CsrUint32 bh_count;
|
||||
CsrUint32 process_count;
|
||||
CsrUint32 protocol_count;
|
||||
|
||||
CsrUint32 cmd52_f0_r_count;
|
||||
CsrUint32 cmd52_f0_w_count;
|
||||
CsrUint32 cmd52_r8or16_count;
|
||||
CsrUint32 cmd52_w8or16_count;
|
||||
CsrUint32 cmd52_r16_count;
|
||||
CsrUint32 cmd52_w16_count;
|
||||
CsrUint32 cmd52_r32_count;
|
||||
|
||||
CsrUint32 sdio_cmd_signal;
|
||||
CsrUint32 sdio_cmd_clear_slot;
|
||||
CsrUint32 sdio_cmd_to_host;
|
||||
CsrUint32 sdio_cmd_from_host;
|
||||
CsrUint32 sdio_cmd_from_host_and_clear;
|
||||
} hip_prof;
|
||||
struct cmd_profile cmd_prof;
|
||||
#endif
|
||||
|
||||
/* Interrupt processing mode flags */
|
||||
CsrUint32 intmode;
|
||||
|
||||
#ifdef UNIFI_DEBUG
|
||||
CsrUint8 lsb;
|
||||
#endif
|
||||
|
||||
/* Historic firmware panic codes */
|
||||
CsrUint32 panic_data_phy_addr;
|
||||
CsrUint32 panic_data_mac_addr;
|
||||
CsrUint16 last_phy_panic_code;
|
||||
CsrUint16 last_phy_panic_arg;
|
||||
CsrUint16 last_mac_panic_code;
|
||||
CsrUint16 last_mac_panic_arg;
|
||||
#ifdef CSR_PRE_ALLOC_NET_DATA
|
||||
bulk_data_desc_t bulk_data_desc_list[BULK_DATA_PRE_ALLOC_NUM];
|
||||
CsrUint16 prealloc_netdata_r;
|
||||
CsrUint16 prealloc_netdata_w;
|
||||
#endif
|
||||
}; /* struct card */
|
||||
|
||||
|
||||
/* Reset types */
|
||||
enum unifi_reset_type
|
||||
{
|
||||
UNIFI_COLD_RESET = 1,
|
||||
UNIFI_WARM_RESET = 2
|
||||
};
|
||||
|
||||
/*
|
||||
* unifi_set_host_state() implements signalling for waking UniFi from
|
||||
* deep sleep. The host indicates to UniFi that it is in one of three states:
|
||||
* Torpid - host has nothing to send, UniFi can go to sleep.
|
||||
* Drowsy - host has data to send to UniFi. UniFi will respond with an
|
||||
* SDIO interrupt. When hosts responds it moves to Awake.
|
||||
* Awake - host has data to transfer, UniFi must stay awake.
|
||||
* When host has finished, it moves to Torpid.
|
||||
*/
|
||||
CsrResult unifi_set_host_state(card_t *card, enum unifi_host_state state);
|
||||
|
||||
|
||||
CsrResult unifi_set_proc_select(card_t *card, enum unifi_dbg_processors_select select);
|
||||
CsrInt32 card_read_signal_counts(card_t *card);
|
||||
bulk_data_desc_t* card_find_data_slot(card_t *card, CsrInt16 slot);
|
||||
|
||||
|
||||
CsrResult unifi_read32(card_t *card, CsrUint32 unifi_addr, CsrUint32 *pdata);
|
||||
CsrResult unifi_readnz(card_t *card, CsrUint32 unifi_addr,
|
||||
void *pdata, CsrUint16 len);
|
||||
CsrInt32 unifi_read_shared_count(card_t *card, CsrUint32 addr);
|
||||
|
||||
CsrResult unifi_writen(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len);
|
||||
|
||||
CsrResult unifi_bulk_rw(card_t *card, CsrUint32 handle,
|
||||
void *pdata, CsrUint32 len, CsrInt16 direction);
|
||||
CsrResult unifi_bulk_rw_noretry(card_t *card, CsrUint32 handle,
|
||||
void *pdata, CsrUint32 len, CsrInt16 direction);
|
||||
#define UNIFI_SDIO_READ 0
|
||||
#define UNIFI_SDIO_WRITE 1
|
||||
|
||||
CsrResult unifi_read_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 *pdata);
|
||||
CsrResult unifi_write_8_or_16(card_t *card, CsrUint32 unifi_addr, CsrUint8 data);
|
||||
CsrResult unifi_read_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 *pdata);
|
||||
CsrResult unifi_write_direct_8_or_16(card_t *card, CsrUint32 addr, CsrUint8 data);
|
||||
|
||||
CsrResult unifi_read_direct16(card_t *card, CsrUint32 addr, CsrUint16 *pdata);
|
||||
CsrResult unifi_read_direct32(card_t *card, CsrUint32 addr, CsrUint32 *pdata);
|
||||
CsrResult unifi_read_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len);
|
||||
|
||||
CsrResult unifi_write_direct16(card_t *card, CsrUint32 addr, CsrUint16 data);
|
||||
CsrResult unifi_write_directn(card_t *card, CsrUint32 addr, void *pdata, CsrUint16 len);
|
||||
|
||||
CsrResult sdio_read_f0(card_t *card, CsrUint32 addr, CsrUint8 *pdata);
|
||||
CsrResult sdio_write_f0(card_t *card, CsrUint32 addr, CsrUint8 data);
|
||||
|
||||
void unifi_read_panic(card_t *card);
|
||||
#ifdef CSR_PRE_ALLOC_NET_DATA
|
||||
void prealloc_netdata_free(card_t *card);
|
||||
CsrResult prealloc_netdata_alloc(card_t *card);
|
||||
#endif
|
||||
/* For diagnostic use */
|
||||
void dump(void *mem, CsrUint16 len);
|
||||
void dump16(void *mem, CsrUint16 len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CARD_SDIO_H__ */
|
2561
drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
Normal file
2561
drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
Normal file
File diff suppressed because it is too large
Load diff
1713
drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c
Normal file
1713
drivers/staging/csr/csr_wifi_hip_card_sdio_mem.c
Normal file
File diff suppressed because it is too large
Load diff
793
drivers/staging/csr/csr_wifi_hip_chiphelper.c
Normal file
793
drivers/staging/csr/csr_wifi_hip_chiphelper.c
Normal file
|
@ -0,0 +1,793 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include "csr_wifi_hip_chiphelper_private.h"
|
||||
|
||||
#ifndef nelem
|
||||
#define nelem(a) (sizeof(a) / sizeof(a[0]))
|
||||
#endif
|
||||
|
||||
#define counted(foo) { nelem(foo), foo }
|
||||
#define null_counted() { 0, NULL }
|
||||
|
||||
/* The init values are a set of register writes that we must
|
||||
perform when we first connect to the chip to get it working.
|
||||
They swicth on the correct clocks and possibly set the host
|
||||
interface as a wkaeup source. They should not be used if
|
||||
proper HIP opperation is required, but are useful before we
|
||||
do a code download. */
|
||||
static const struct chip_helper_init_values init_vals_v1[] = {
|
||||
{ 0xFDBB, 0xFFFF },
|
||||
{ 0xFDB6, 0x03FF },
|
||||
{ 0xFDB1, 0x01E3 },
|
||||
{ 0xFDB3, 0x0FFF },
|
||||
{ 0xFEE3, 0x08F0 },
|
||||
{ 0xFEE7, 0x3C3F },
|
||||
{ 0xFEE6, 0x0050 },
|
||||
{ 0xFDBA, 0x0000 }
|
||||
};
|
||||
|
||||
static const struct chip_helper_init_values init_vals_v2[] = {
|
||||
{ 0xFDB6, 0x0FFF },
|
||||
{ 0xF023, 0x3F3F },
|
||||
{ 0xFDB1, 0x01E3 },
|
||||
{ 0xFDB3, 0x0FFF },
|
||||
{ 0xF003, 0x08F0 },
|
||||
{ 0xF007, 0x3C3F },
|
||||
{ 0xF006, 0x0050 }
|
||||
};
|
||||
|
||||
|
||||
static const struct chip_helper_init_values init_vals_v22_v23[] = {
|
||||
{ 0xF81C, 0x00FF },
|
||||
/*{ 0x????, 0x???? }, */
|
||||
{ 0xF80C, 0x1FFF },
|
||||
{ 0xFA25, 0x001F },
|
||||
{ 0xF804, 0x00FF },
|
||||
{ 0xF802, 0x0FFF },
|
||||
/*{ 0x????, 0x???? },
|
||||
{ 0x????, 0x???? },
|
||||
{ 0x????, 0x???? }*/
|
||||
};
|
||||
|
||||
static const CsrUint16 reset_program_a_v1_or_v2[] = {
|
||||
0x0000
|
||||
};
|
||||
static const CsrUint16 reset_program_b_v1_or_v2[] = {
|
||||
0x0010, 0xFE00, 0xA021, 0xFF00, 0x8111, 0x0009, 0x0CA4, 0x0114,
|
||||
0x0280, 0x04F8, 0xFE00, 0x6F25, 0x06E0, 0x0010, 0xFC00, 0x0121,
|
||||
0xFC00, 0x0225, 0xFE00, 0x7125, 0xFE00, 0x6D11, 0x03F0, 0xFE00,
|
||||
0x6E25, 0x0008, 0x00E0
|
||||
};
|
||||
|
||||
static const struct chip_helper_reset_values reset_program_v1_or_v2[] =
|
||||
{
|
||||
{
|
||||
MAKE_GP(REGISTERS, 0x000C),
|
||||
nelem(reset_program_a_v1_or_v2),
|
||||
reset_program_a_v1_or_v2
|
||||
},
|
||||
{
|
||||
MAKE_GP(MAC_PMEM, 0x000000),
|
||||
nelem(reset_program_b_v1_or_v2),
|
||||
reset_program_b_v1_or_v2
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_map_address_t unifi_map_address_v1_v2[] =
|
||||
{
|
||||
{ 0xFE9F, 0xFE7B }, /* PM1_BANK_SELECT */
|
||||
{ 0xFE9E, 0xFE78 }, /* PM2_BANK_SELECT */
|
||||
{ 0xFE9D, 0xFE7E }, /* SHARED_DMEM_PAGE */
|
||||
{ 0xFE91, 0xFE90 }, /* PROC_SELECT */
|
||||
{ 0xFE8D, 0xFE8C }, /* STOP_STATUS */
|
||||
};
|
||||
|
||||
static const struct chip_map_address_t unifi_map_address_v22_v23[] =
|
||||
{
|
||||
{ 0xF8F9, 0xF8AC }, /* GW1_CONFIG */
|
||||
{ 0xF8FA, 0xF8AD }, /* GW2_CONFIG */
|
||||
{ 0xF8FB, 0xF8AE }, /* GW3_CONFIG */
|
||||
{ 0xF830, 0xF81E }, /* PROC_SELECT */
|
||||
{ 0xF831, 0xF81F }, /* STOP_STATUS */
|
||||
{ 0xF8FC, 0xF8AF }, /* IO_LOG_ADDRESS */
|
||||
};
|
||||
|
||||
static const struct chip_device_regs_t unifi_device_regs_null =
|
||||
{
|
||||
0xFE81, /* GBL_CHIP_VERSION */
|
||||
0x0000, /* GBL_MISC_ENABLES */
|
||||
0x0000, /* DBG_EMU_CMD */
|
||||
{
|
||||
0x0000, /* HOST.DBG_PROC_SELECT */
|
||||
0x0000, /* HOST.DBG_STOP_STATUS */
|
||||
0x0000, /* HOST.WINDOW1_PAGE */
|
||||
0x0000, /* HOST.WINDOW2_PAGE */
|
||||
0x0000, /* HOST.WINDOW3_PAGE */
|
||||
0x0000 /* HOST.IO_LOG_ADDR */
|
||||
},
|
||||
{
|
||||
0x0000, /* SPI.DBG_PROC_SELECT */
|
||||
0x0000, /* SPI.DBG_STOP_STATUS */
|
||||
0x0000, /* SPI.WINDOW1_PAGE */
|
||||
0x0000, /* SPI.WINDOW2_PAGE */
|
||||
0x0000, /* SPI.WINDOW3_PAGE */
|
||||
0x0000 /* SPI.IO_LOG_ADDR */
|
||||
},
|
||||
0x0000, /* DBG_RESET */
|
||||
0x0000, /* > DBG_RESET_VALUE */
|
||||
0x0000, /* DBG_RESET_WARN */
|
||||
0x0000, /* DBG_RESET_WARN_VALUE */
|
||||
0x0000, /* DBG_RESET_RESULT */
|
||||
0xFFE9, /* XAP_PCH */
|
||||
0xFFEA, /* XAP_PCL */
|
||||
0x0000, /* PROC_PC_SNOOP */
|
||||
0x0000, /* WATCHDOG_DISABLE */
|
||||
0x0000, /* MAILBOX0 */
|
||||
0x0000, /* MAILBOX1 */
|
||||
0x0000, /* MAILBOX2 */
|
||||
0x0000, /* MAILBOX3 */
|
||||
0x0000, /* SDIO_HOST_INT */
|
||||
0x0000, /* SHARED_IO_INTERRUPT */
|
||||
0x0000, /* SDIO HIP HANDSHAKE */
|
||||
0x0000 /* COEX_STATUS */
|
||||
};
|
||||
|
||||
/* UF105x */
|
||||
static const struct chip_device_regs_t unifi_device_regs_v1 =
|
||||
{
|
||||
0xFE81, /* GBL_CHIP_VERSION */
|
||||
0xFE87, /* GBL_MISC_ENABLES */
|
||||
0xFE9C, /* DBG_EMU_CMD */
|
||||
{
|
||||
0xFE90, /* HOST.DBG_PROC_SELECT */
|
||||
0xFE8C, /* HOST.DBG_STOP_STATUS */
|
||||
0xFE7B, /* HOST.WINDOW1_PAGE */
|
||||
0xFE78, /* HOST.WINDOW2_PAGE */
|
||||
0xFE7E, /* HOST.WINDOW3_PAGE */
|
||||
0x0000 /* HOST.IO_LOG_ADDR */
|
||||
},
|
||||
{
|
||||
0xFE91, /* SPI.DBG_PROC_SELECT */
|
||||
0xFE8D, /* SPI.DBG_STOP_STATUS */
|
||||
0xFE9F, /* SPI.WINDOW1_PAGE */
|
||||
0xFE9E, /* SPI.WINDOW2_PAGE */
|
||||
0xFE9D, /* SPI.WINDOW3_PAGE */
|
||||
0x0000 /* SPI.IO_LOG_ADDR */
|
||||
},
|
||||
0xFE92, /* DBG_RESET */
|
||||
0x0001, /* > DBG_RESET_VALUE */
|
||||
0xFDA0, /* DBG_RESET_WARN (HOST_SELECT) */
|
||||
0x0000, /* DBG_RESET_WARN_VALUE */
|
||||
0xFE92, /* DBG_RESET_RESULT */
|
||||
0xFFE9, /* XAP_PCH */
|
||||
0xFFEA, /* XAP_PCL */
|
||||
0x0051, /* PROC_PC_SNOOP */
|
||||
0xFE70, /* WATCHDOG_DISABLE */
|
||||
0xFE6B, /* MAILBOX0 */
|
||||
0xFE6A, /* MAILBOX1 */
|
||||
0xFE69, /* MAILBOX2 */
|
||||
0xFE68, /* MAILBOX3 */
|
||||
0xFE67, /* SDIO_HOST_INT */
|
||||
0xFE65, /* SHARED_IO_INTERRUPT */
|
||||
0xFDE9, /* SDIO HIP HANDSHAKE */
|
||||
0x0000 /* COEX_STATUS */
|
||||
};
|
||||
|
||||
/* UF2... */
|
||||
static const struct chip_device_regs_t unifi_device_regs_v2 =
|
||||
{
|
||||
0xFE81, /* GBL_CHIP_VERSION */
|
||||
0xFE87, /* GBL_MISC_ENABLES */
|
||||
0xFE9C, /* DBG_EMU_CMD */
|
||||
{
|
||||
0xFE90, /* HOST.DBG_PROC_SELECT */
|
||||
0xFE8C, /* HOST.DBG_STOP_STATUS */
|
||||
0xFE7B, /* HOST.WINDOW1_PAGE */
|
||||
0xFE78, /* HOST.WINDOW2_PAGE */
|
||||
0xFE7E, /* HOST.WINDOW3_PAGE */
|
||||
0x0000 /* HOST.IO_LOG_ADDR */
|
||||
},
|
||||
{
|
||||
0xFE91, /* SPI.DBG_PROC_SELECT */
|
||||
0xFE8D, /* SPI.DBG_STOP_STATUS */
|
||||
0xFE9F, /* SPI.WINDOW1_PAGE */
|
||||
0xFE9E, /* SPI.WINDOW2_PAGE */
|
||||
0xFE9D, /* SPI.WINDOW3_PAGE */
|
||||
0x0000 /* SPI.IO_LOG_ADDR */
|
||||
},
|
||||
0xFE92, /* DBG_RESET */
|
||||
0x0000, /* > DBG_RESET_VALUE */
|
||||
0xFDE9, /* DBG_RESET_WARN (TEST_FLASH_DATA - SHARED_MAILBOX2B) */
|
||||
0xFFFF, /* DBG_RESET_WARN_VALUE */
|
||||
0xFDE9, /* DBG_RESET_RESULT (TEST_FLASH_DATA) */
|
||||
0xFFE9, /* XAP_PCH */
|
||||
0xFFEA, /* XAP_PCL */
|
||||
0x0051, /* PROC_PC_SNOOP */
|
||||
0xFE70, /* WATCHDOG_DISABLE */
|
||||
0xFE6B, /* MAILBOX0 */
|
||||
0xFE6A, /* MAILBOX1 */
|
||||
0xFE69, /* MAILBOX2 */
|
||||
0xFE68, /* MAILBOX3 */
|
||||
0xFE67, /* SDIO_HOST_INT */
|
||||
0xFE65, /* SHARED_IO_INTERRUPT */
|
||||
0xFE69, /* SDIO HIP HANDSHAKE */
|
||||
0x0000 /* COEX_STATUS */
|
||||
};
|
||||
|
||||
/* UF60xx */
|
||||
static const struct chip_device_regs_t unifi_device_regs_v22_v23 =
|
||||
{
|
||||
0xFE81, /* GBL_CHIP_VERSION */
|
||||
0xF84F, /* GBL_MISC_ENABLES */
|
||||
0xF81D, /* DBG_EMU_CMD */
|
||||
{
|
||||
0xF81E, /* HOST.DBG_PROC_SELECT */
|
||||
0xF81F, /* HOST.DBG_STOP_STATUS */
|
||||
0xF8AC, /* HOST.WINDOW1_PAGE */
|
||||
0xF8AD, /* HOST.WINDOW2_PAGE */
|
||||
0xF8AE, /* HOST.WINDOW3_PAGE */
|
||||
0xF8AF /* HOST.IO_LOG_ADDR */
|
||||
},
|
||||
{
|
||||
0xF830, /* SPI.DBG_PROC_SELECT */
|
||||
0xF831, /* SPI.DBG_STOP_STATUS */
|
||||
0xF8F9, /* SPI.WINDOW1_PAGE */
|
||||
0xF8FA, /* SPI.WINDOW2_PAGE */
|
||||
0xF8FB, /* SPI.WINDOW3_PAGE */
|
||||
0xF8FC /* SPI.IO_LOG_ADDR */
|
||||
},
|
||||
0xF82F, /* DBG_RESET */
|
||||
0x0001, /* > DBG_RESET_VALUE */
|
||||
0x0000, /* DBG_RESET_WARN */
|
||||
0x0000, /* DBG_RESET_WARN_VALUE */
|
||||
0xF82F, /* DBG_RESET_RESULT */
|
||||
0xFFE9, /* XAP_PCH */
|
||||
0xFFEA, /* XAP_PCL */
|
||||
0x001B, /* PROC_PC_SNOOP */
|
||||
0x0055, /* WATCHDOG_DISABLE */
|
||||
0xF84B, /* MAILBOX0 */
|
||||
0xF84C, /* MAILBOX1 */
|
||||
0xF84D, /* MAILBOX2 */
|
||||
0xF84E, /* MAILBOX3 */
|
||||
0xF92F, /* SDIO_HOST_INT */
|
||||
0xF92B, /* SDIO_FROMHOST_SCRTACH0 / SHARED_IO_INTERRUPT */
|
||||
0xF84D, /* SDIO HIP HANDSHAKE (MAILBOX2) */
|
||||
0xF9FB /* COEX_STATUS */
|
||||
};
|
||||
|
||||
/* Program memory window on UF105x. */
|
||||
static const struct window_shift_info_t prog_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] =
|
||||
{
|
||||
{ TRUE, 11, 0x0200 }, /* CODE RAM */
|
||||
{ TRUE, 11, 0x0000 }, /* FLASH */
|
||||
{ TRUE, 11, 0x0400 }, /* External SRAM */
|
||||
{ FALSE, 0, 0 }, /* ROM */
|
||||
{ FALSE, 0, 0 } /* SHARED */
|
||||
};
|
||||
|
||||
/* Shared memory window on UF105x. */
|
||||
static const struct window_shift_info_t shared_window_array_unifi_v1_v2[CHIP_HELPER_WT_COUNT] =
|
||||
{
|
||||
{ FALSE, 0, 0 }, /* CODE RAM */
|
||||
{ FALSE, 0, 0 }, /* FLASH */
|
||||
{ FALSE, 0, 0 }, /* External SRAM */
|
||||
{ FALSE, 0, 0 }, /* ROM */
|
||||
{ TRUE, 11, 0x0000 } /* SHARED */
|
||||
};
|
||||
|
||||
/* One of the Generic Windows on UF60xx and later. */
|
||||
static const struct window_shift_info_t generic_window_array_unifi_v22_v23[CHIP_HELPER_WT_COUNT] =
|
||||
{
|
||||
{ TRUE, 11, 0x3800 }, /* CODE RAM */
|
||||
{ FALSE, 0, 0 }, /* FLASH */
|
||||
{ FALSE, 0, 0 }, /* External SRAM */
|
||||
{ TRUE, 11, 0x2000 }, /* ROM */
|
||||
{ TRUE, 11, 0x0000 } /* SHARED */
|
||||
};
|
||||
|
||||
/* The three windows on UF105x. */
|
||||
static const struct window_info_t prog1_window_unifi_v1_v2 = { 0x0000, 0x2000, 0x0080, prog_window_array_unifi_v1_v2 };
|
||||
static const struct window_info_t prog2_window_unifi_v1_v2 = { 0x2000, 0x2000, 0x0000, prog_window_array_unifi_v1_v2 };
|
||||
static const struct window_info_t shared_window_unifi_v1_v2 = { 0x4000, 0x2000, 0x0000, shared_window_array_unifi_v1_v2 };
|
||||
|
||||
/* The three windows on UF60xx and later. */
|
||||
static const struct window_info_t generic1_window_unifi_v22_v23 = { 0x0000, 0x2000, 0x0080, generic_window_array_unifi_v22_v23 };
|
||||
static const struct window_info_t generic2_window_unifi_v22_v23 = { 0x2000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 };
|
||||
static const struct window_info_t generic3_window_unifi_v22_v23 = { 0x4000, 0x2000, 0x0000, generic_window_array_unifi_v22_v23 };
|
||||
|
||||
static const struct chip_device_desc_t chip_device_desc_null =
|
||||
{
|
||||
{ FALSE, 0x0000, 0x0000, 0x00 },
|
||||
"",
|
||||
"",
|
||||
null_counted(), /* init */
|
||||
null_counted(), /* reset_prog */
|
||||
&unifi_device_regs_null, /* regs */
|
||||
{
|
||||
FALSE, /* has_flash */
|
||||
FALSE, /* has_ext_sram */
|
||||
FALSE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
FALSE, /* has_wlan */
|
||||
},
|
||||
null_counted(),
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x0000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t unifi_device_desc_v1 =
|
||||
{
|
||||
{ FALSE, 0xf0ff, 0x1001, 0x01 }, /* UF105x R01 */
|
||||
"UF105x",
|
||||
"UniFi-1",
|
||||
counted(init_vals_v1), /* init */
|
||||
counted(reset_program_v1_or_v2), /* reset_prog */
|
||||
&unifi_device_regs_v1, /* regs */
|
||||
{
|
||||
TRUE, /* has_flash */
|
||||
TRUE, /* has_ext_sram */
|
||||
FALSE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v1_v2), /* map */
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00100000, /* ram */
|
||||
0x00000000, /* rom (invalid) */
|
||||
0x00000000, /* flash */
|
||||
0x00200000, /* ext_ram */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&prog1_window_unifi_v1_v2,
|
||||
&prog2_window_unifi_v1_v2,
|
||||
&shared_window_unifi_v1_v2
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t unifi_device_desc_v2 =
|
||||
{
|
||||
{ FALSE, 0xf0ff, 0x2001, 0x02 }, /* UF2... R02 */
|
||||
"UF2...",
|
||||
"UniFi-2",
|
||||
counted(init_vals_v2), /* init */
|
||||
counted(reset_program_v1_or_v2), /* reset_prog */
|
||||
&unifi_device_regs_v2, /* regs */
|
||||
{
|
||||
TRUE, /* has_flash */
|
||||
TRUE, /* has_ext_sram */
|
||||
FALSE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v1_v2), /* map */
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00100000, /* ram */
|
||||
0x00000000, /* rom (invalid) */
|
||||
0x00000000, /* flash */
|
||||
0x00200000, /* ext_ram */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&prog1_window_unifi_v1_v2,
|
||||
&prog2_window_unifi_v1_v2,
|
||||
&shared_window_unifi_v1_v2
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t unifi_device_desc_v3 =
|
||||
{
|
||||
{ FALSE, 0xf0ff, 0x3001, 0x02 }, /* UF2... R03 */
|
||||
"UF2...",
|
||||
"UniFi-3",
|
||||
counted(init_vals_v2), /* init */
|
||||
counted(reset_program_v1_or_v2), /* reset_prog */
|
||||
&unifi_device_regs_v2, /* regs */
|
||||
{
|
||||
TRUE, /* has_flash */
|
||||
TRUE, /* has_ext_sram */
|
||||
FALSE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v1_v2), /* map */
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00100000, /* ram */
|
||||
0x00000000, /* rom (invalid) */
|
||||
0x00000000, /* flash */
|
||||
0x00200000, /* ext_ram */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&prog1_window_unifi_v1_v2,
|
||||
&prog2_window_unifi_v1_v2,
|
||||
&shared_window_unifi_v1_v2
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t unifi_device_desc_v22 =
|
||||
{
|
||||
{ FALSE, 0x00ff, 0x0022, 0x07 }, /* UF60xx */
|
||||
"UF60xx",
|
||||
"UniFi-4",
|
||||
counted(init_vals_v22_v23), /* init */
|
||||
null_counted(), /* reset_prog */
|
||||
&unifi_device_regs_v22_v23, /* regs */
|
||||
{
|
||||
FALSE, /* has_flash */
|
||||
FALSE, /* has_ext_sram */
|
||||
TRUE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v22_v23), /* map */
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00C00000, /* ram */
|
||||
0x00000000, /* rom */
|
||||
0x00000000, /* flash (invalid) */
|
||||
0x00000000, /* ext_ram (invalid) */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&generic1_window_unifi_v22_v23,
|
||||
&generic2_window_unifi_v22_v23,
|
||||
&generic3_window_unifi_v22_v23
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t unifi_device_desc_v23 =
|
||||
{
|
||||
{ FALSE, 0x00ff, 0x0023, 0x08 }, /* UF.... */
|
||||
"UF....",
|
||||
"UF.... (5)",
|
||||
counted(init_vals_v22_v23), /* init */
|
||||
null_counted(), /* reset_prog */
|
||||
&unifi_device_regs_v22_v23, /* regs */
|
||||
{
|
||||
FALSE, /* has_flash */
|
||||
FALSE, /* has_ext_sram */
|
||||
TRUE, /* has_rom */
|
||||
TRUE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v22_v23),
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00C00000, /* ram */
|
||||
0x00000000, /* rom */
|
||||
0x00000000, /* flash (invalid) */
|
||||
0x00000000, /* ext_sram (invalid) */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&generic1_window_unifi_v22_v23,
|
||||
&generic2_window_unifi_v22_v23,
|
||||
&generic3_window_unifi_v22_v23
|
||||
}
|
||||
};
|
||||
|
||||
static const struct chip_device_desc_t hyd_wlan_subsys_desc_v1 =
|
||||
{
|
||||
{ FALSE, 0x00ff, 0x0044, 0x00 }, /* UF.... */
|
||||
"HYD...",
|
||||
"HYD... ",
|
||||
counted(init_vals_v22_v23), /* init */
|
||||
null_counted(), /* reset_prog */
|
||||
&unifi_device_regs_v22_v23, /* regs */
|
||||
{
|
||||
FALSE, /* has_flash */
|
||||
FALSE, /* has_ext_sram */
|
||||
TRUE, /* has_rom */
|
||||
FALSE, /* has_bt */
|
||||
TRUE, /* has_wlan */
|
||||
},
|
||||
counted(unifi_map_address_v22_v23),
|
||||
/* prog_offset */
|
||||
{
|
||||
0x00C00000, /* ram */
|
||||
0x00000000, /* rom */
|
||||
0x00000000, /* flash (invalid) */
|
||||
0x00000000, /* ext_sram (invalid) */
|
||||
},
|
||||
/* data_offset */
|
||||
{
|
||||
0x8000 /* ram */
|
||||
},
|
||||
/* windows */
|
||||
{
|
||||
&generic1_window_unifi_v22_v23,
|
||||
&generic2_window_unifi_v22_v23,
|
||||
&generic3_window_unifi_v22_v23
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* This is the list of all chips that we know about. I'm
|
||||
assuming that the order here will be important - we
|
||||
might have multiple entries witrh the same SDIO id for
|
||||
instance. The first one in this list will be the one
|
||||
that is returned if a search is done on only that id.
|
||||
The client will then have to call GetVersionXXX again
|
||||
but with more detailed info.
|
||||
|
||||
I don't know if we need to signal this up to the client
|
||||
in some way?
|
||||
|
||||
(We get the SDIO id before we know anything else about
|
||||
the chip. We might not be able to read any of the other
|
||||
registers at first, but we still need to know about the
|
||||
chip). */
|
||||
static const struct chip_device_desc_t *chip_ver_to_desc[] =
|
||||
{
|
||||
&unifi_device_desc_v1, /* UF105x R01 */
|
||||
&unifi_device_desc_v2, /* UF2... R02 */
|
||||
&unifi_device_desc_v3, /* UF2... R03 */
|
||||
&unifi_device_desc_v22, /* UF60xx */
|
||||
&unifi_device_desc_v23, /* UF.... */
|
||||
&hyd_wlan_subsys_desc_v1
|
||||
};
|
||||
|
||||
ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_ver)
|
||||
{
|
||||
CsrUint32 i;
|
||||
|
||||
for (i = 0; i < nelem(chip_ver_to_desc); i++)
|
||||
{
|
||||
if (chip_ver_to_desc[i]->chip_version.sdio == sdio_ver)
|
||||
{
|
||||
return chip_ver_to_desc[i];
|
||||
}
|
||||
}
|
||||
|
||||
return &chip_device_desc_null;
|
||||
}
|
||||
|
||||
|
||||
ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81)
|
||||
{
|
||||
CsrUint32 i;
|
||||
|
||||
if ((from_FF9A & 0xFF00) != 0)
|
||||
{
|
||||
for (i = 0; i < nelem(chip_ver_to_desc); i++)
|
||||
{
|
||||
if (chip_ver_to_desc[i]->chip_version.pre_bc7 &&
|
||||
((from_FF9A & chip_ver_to_desc[i]->chip_version.mask) ==
|
||||
chip_ver_to_desc[i]->chip_version.result))
|
||||
{
|
||||
return chip_ver_to_desc[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nelem(chip_ver_to_desc); i++)
|
||||
{
|
||||
if (!chip_ver_to_desc[i]->chip_version.pre_bc7 &&
|
||||
((from_FE81 & chip_ver_to_desc[i]->chip_version.mask) ==
|
||||
chip_ver_to_desc[i]->chip_version.result))
|
||||
{
|
||||
return chip_ver_to_desc[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &chip_device_desc_null;
|
||||
}
|
||||
|
||||
|
||||
ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 ver)
|
||||
{
|
||||
return ChipHelper_GetVersionAny(0x0000, ver);
|
||||
}
|
||||
|
||||
|
||||
ChipDescript* ChipHelper_Null()
|
||||
{
|
||||
return &chip_device_desc_null;
|
||||
}
|
||||
|
||||
|
||||
ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age bc_age, CsrUint16 version)
|
||||
{
|
||||
if (bc_age == chip_helper_bluecore_pre_bc7)
|
||||
{
|
||||
return ChipHelper_GetVersionAny(version, 0x0000);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ChipHelper_GetVersionAny(0x0000, version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Expand the DEF0 functions into simple code to return the
|
||||
correct thing. The DEF1 functions expand to nothing in
|
||||
this X macro expansion. */
|
||||
#define CHIP_HELPER_DEF0_C_DEF(ret_type, name, info) \
|
||||
ret_type ChipHelper_ ## name(ChipDescript * chip_help) \
|
||||
{ \
|
||||
return chip_help->info; \
|
||||
}
|
||||
#define CHIP_HELPER_DEF1_C_DEF(ret_type, name, type1, name1)
|
||||
|
||||
CHIP_HELPER_LIST(C_DEF)
|
||||
|
||||
/*
|
||||
* Map register addresses between HOST and SPI access.
|
||||
*/
|
||||
CsrUint16 ChipHelper_MapAddress_SPI2HOST(ChipDescript *chip_help, CsrUint16 addr)
|
||||
{
|
||||
CsrUint32 i;
|
||||
for (i = 0; i < chip_help->map.len; i++)
|
||||
{
|
||||
if (chip_help->map.vals[i].spi == addr)
|
||||
{
|
||||
return chip_help->map.vals[i].host;
|
||||
}
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
CsrUint16 ChipHelper_MapAddress_HOST2SPI(ChipDescript *chip_help, CsrUint16 addr)
|
||||
{
|
||||
CsrUint32 i;
|
||||
for (i = 0; i < chip_help->map.len; i++)
|
||||
{
|
||||
if (chip_help->map.vals[i].host == addr)
|
||||
{
|
||||
return chip_help->map.vals[i].spi;
|
||||
}
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
/* The address returned by this function is the start of the
|
||||
window in the address space, that is where we can start
|
||||
accessing data from. If a section of the window at the
|
||||
start is unusable because something else is cluttering up
|
||||
the address map then that is taken into account and this
|
||||
function returns that address justt past that. */
|
||||
CsrUint16 ChipHelper_WINDOW_ADDRESS(ChipDescript *chip_help,
|
||||
enum chip_helper_window_index window)
|
||||
{
|
||||
if (window < CHIP_HELPER_WINDOW_COUNT &&
|
||||
chip_help->windows[window] != NULL)
|
||||
{
|
||||
return chip_help->windows[window]->address + chip_help->windows[window]->blocked;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* This returns the size of the window minus any blocked section */
|
||||
CsrUint16 ChipHelper_WINDOW_SIZE(ChipDescript *chip_help,
|
||||
enum chip_helper_window_index window)
|
||||
{
|
||||
if (window < CHIP_HELPER_WINDOW_COUNT &&
|
||||
chip_help->windows[window] != NULL)
|
||||
{
|
||||
return chip_help->windows[window]->size - chip_help->windows[window]->blocked;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Get the register writes we should do to make sure that
|
||||
the chip is running with most clocks on. */
|
||||
CsrUint32 ChipHelper_ClockStartupSequence(ChipDescript *chip_help,
|
||||
const struct chip_helper_init_values **val)
|
||||
{
|
||||
*val = chip_help->init.vals;
|
||||
return chip_help->init.len;
|
||||
}
|
||||
|
||||
|
||||
/* Get the set of values tat we should write to the chip to perform a reset. */
|
||||
CsrUint32 ChipHelper_HostResetSequence(ChipDescript *chip_help,
|
||||
const struct chip_helper_reset_values **val)
|
||||
{
|
||||
*val = chip_help->reset_prog.vals;
|
||||
return chip_help->reset_prog.len;
|
||||
}
|
||||
|
||||
|
||||
/* Decode a windowed access to the chip. */
|
||||
CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
|
||||
enum chip_helper_window_index window,
|
||||
enum chip_helper_window_type type,
|
||||
CsrUint32 offset,
|
||||
CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len)
|
||||
{
|
||||
const struct window_info_t *win;
|
||||
const struct window_shift_info_t *mode;
|
||||
CsrUint16 of, pg;
|
||||
|
||||
if (window >= CHIP_HELPER_WINDOW_COUNT)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((win = chip_help->windows[window]) == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (type >= CHIP_HELPER_WT_COUNT)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if ((mode = &win->mode[type]) == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!mode->allowed)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pg = (CsrUint16)(offset >> mode->page_shift) + mode->page_offset;
|
||||
of = (CsrUint16)(offset & ((1 << mode->page_shift) - 1));
|
||||
/* If 'blocked' is zero this does nothing, else decrease
|
||||
the page register and increase the offset until we aren't
|
||||
in the blocked region of the window. */
|
||||
while (of < win->blocked)
|
||||
{
|
||||
of += 1 << mode->page_shift;
|
||||
pg--;
|
||||
}
|
||||
*page = pg;
|
||||
*addr = win->address + of;
|
||||
*len = win->size - of;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
471
drivers/staging/csr/csr_wifi_hip_chiphelper.h
Normal file
471
drivers/staging/csr/csr_wifi_hip_chiphelper.h
Normal file
|
@ -0,0 +1,471 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_HIP_CHIPHELPER_H__
|
||||
#define CSR_WIFI_HIP_CHIPHELPER_H__
|
||||
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The age of the BlueCore chip. This is probably not useful, if
|
||||
you know the age then you can probably work out the version directly. */
|
||||
enum chip_helper_bluecore_age
|
||||
{
|
||||
chip_helper_bluecore_pre_bc7,
|
||||
chip_helper_bluecore_bc7_or_later
|
||||
};
|
||||
|
||||
/* We support up to three windowed regions at the moment.
|
||||
Don't reorder these - they're used to index into an array. */
|
||||
enum chip_helper_window_index
|
||||
{
|
||||
CHIP_HELPER_WINDOW_1 = 0,
|
||||
CHIP_HELPER_WINDOW_2 = 1,
|
||||
CHIP_HELPER_WINDOW_3 = 2,
|
||||
CHIP_HELPER_WINDOW_COUNT = 3
|
||||
};
|
||||
|
||||
/* These are the things that we can access through a window.
|
||||
Don't reorder these - they're used to index into an array. */
|
||||
enum chip_helper_window_type
|
||||
{
|
||||
CHIP_HELPER_WT_CODE_RAM = 0,
|
||||
CHIP_HELPER_WT_FLASH = 1,
|
||||
CHIP_HELPER_WT_EXT_SRAM = 2,
|
||||
CHIP_HELPER_WT_ROM = 3,
|
||||
CHIP_HELPER_WT_SHARED = 4,
|
||||
CHIP_HELPER_WT_COUNT = 5
|
||||
};
|
||||
|
||||
/* Commands to stop and start the XAP */
|
||||
enum chip_helper_dbg_emu_cmd_enum
|
||||
{
|
||||
CHIP_HELPER_DBG_EMU_CMD_XAP_STEP_MASK = 0x0001,
|
||||
CHIP_HELPER_DBG_EMU_CMD_XAP_RUN_B_MASK = 0x0002,
|
||||
CHIP_HELPER_DBG_EMU_CMD_XAP_BRK_MASK = 0x0004,
|
||||
CHIP_HELPER_DBG_EMU_CMD_XAP_WAKEUP_MASK = 0x0008
|
||||
};
|
||||
|
||||
/* Bitmasks for Stop and sleep status: DBG_SPI_STOP_STATUS & DBG_HOST_STOP_STATUS */
|
||||
enum chip_helper_dbg_stop_status_enum
|
||||
{
|
||||
CHIP_HELPER_DBG_STOP_STATUS_NONE_MASK = 0x0000,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_P0_MASK = 0x0001,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_P1_MASK = 0x0002,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_P2_MASK = 0x0004,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P0_MASK = 0x0008,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P1_MASK = 0x0010,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_P2_MASK = 0x0020,
|
||||
/* Legacy names/alias */
|
||||
CHIP_HELPER_DBG_STOP_STATUS_MAC_MASK = 0x0001,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_PHY_MASK = 0x0002,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_BT_MASK = 0x0004,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_MAC_MASK = 0x0008,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_PHY_MASK = 0x0010,
|
||||
CHIP_HELPER_DBG_STOP_STATUS_SLEEP_STATUS_BT_MASK = 0x0020
|
||||
};
|
||||
|
||||
/* Codes to disable the watchdog */
|
||||
enum chip_helper_watchdog_disable_enum
|
||||
{
|
||||
CHIP_HELPER_WATCHDOG_DISABLE_CODE1 = 0x6734,
|
||||
CHIP_HELPER_WATCHDOG_DISABLE_CODE2 = 0xD6BF,
|
||||
CHIP_HELPER_WATCHDOG_DISABLE_CODE3 = 0xC31E
|
||||
};
|
||||
|
||||
/* Other bits have changed between versions */
|
||||
enum chip_helper_gbl_misc_enum
|
||||
{
|
||||
CHIP_HELPER_GBL_MISC_SPI_STOP_OUT_EN_MASK = 0x0001,
|
||||
CHIP_HELPER_GBL_MISC_MMU_INIT_DONE_MASK = 0x0004
|
||||
};
|
||||
|
||||
/* Coex status register, contains interrupt status and reset pullup status.
|
||||
* CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK can be used to check
|
||||
* for WAPI on R03 chips and later. */
|
||||
enum chip_helper_coex_status_mask_enum
|
||||
{
|
||||
CHIP_HELPER_COEX_STATUS_RST_PULLS_LSB_MASK = 0x0001,
|
||||
CHIP_HELPER_COEX_STATUS_RST_PULLS_MSB_MASK = 0x0008,
|
||||
CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_LSB_MASK = 0x0010,
|
||||
CHIP_HELPER_COEX_STATUS_WL_FEC_PINS_MSB_MASK = 0x0080,
|
||||
CHIP_HELPER_COEX_STATUS_INT_UART_MASK = 0x0100,
|
||||
CHIP_HELPER_COEX_STATUS_INT_BT_LEG_MASK = 0x0200
|
||||
};
|
||||
|
||||
/* How to select the different CPUs */
|
||||
enum chip_helper_dbg_proc_sel_enum
|
||||
{
|
||||
CHIP_HELPER_DBG_PROC_SEL_MAC = 0,
|
||||
CHIP_HELPER_DBG_PROC_SEL_PHY = 1,
|
||||
CHIP_HELPER_DBG_PROC_SEL_BT = 2,
|
||||
CHIP_HELPER_DBG_PROC_SEL_NONE = 2,
|
||||
CHIP_HELPER_DBG_PROC_SEL_BOTH = 3
|
||||
};
|
||||
|
||||
/* These are the only registers that we have to know the
|
||||
address of before we know the chip version. */
|
||||
enum chip_helper_fixed_registers
|
||||
{
|
||||
/* This is the address of GBL_CHIP_VERISON on BC7,
|
||||
UF105x, UF60xx and
|
||||
anything later than that. */
|
||||
CHIP_HELPER_UNIFI_GBL_CHIP_VERSION = 0xFE81,
|
||||
|
||||
CHIP_HELPER_OLD_BLUECORE_GBL_CHIP_VERSION = 0xFF9A
|
||||
|
||||
/* This isn't used at the moment (but might be needed
|
||||
to distinguish the BlueCore sub version?) */
|
||||
/* CHIP_HELPER_OLD_BLUECORE_ANA_VERSION_ID = 0xFF7D */
|
||||
};
|
||||
|
||||
/* Address-value pairs for defining initialisation values */
|
||||
struct chip_helper_init_values
|
||||
{
|
||||
CsrUint16 addr;
|
||||
CsrUint16 value;
|
||||
};
|
||||
|
||||
/* A block of data that should be written to the device */
|
||||
struct chip_helper_reset_values
|
||||
{
|
||||
CsrUint32 gp_address;
|
||||
CsrUint32 len;
|
||||
const CsrUint16 *data;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the C API.
|
||||
*/
|
||||
|
||||
/* opaque type */
|
||||
typedef const struct chip_device_desc_t ChipDescript;
|
||||
|
||||
/* Return a NULL descriptor */
|
||||
ChipDescript* ChipHelper_Null(void);
|
||||
|
||||
/* This should get the correct version for any CSR chip.
|
||||
The two parameters are what is read from addresses
|
||||
0xFF9A and 0xFE81 (OLD_BLUECORE_GBL_CHIP_VERSION and
|
||||
UNIFI_GBL_CHIP_VERSION). These should give a unique identity
|
||||
for most (all?) chips.
|
||||
|
||||
FF9A is the old GBL_CHIP_VERSION register. If the high
|
||||
eight bits are zero then the chip is a new (BC7 +) one
|
||||
and FE81 is the _new_ GBL_CHIP_VERSION register. */
|
||||
ChipDescript* ChipHelper_GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81);
|
||||
|
||||
/* The chip is a UniFi, but we don't know which type
|
||||
The parameter is the value of UNIFI_GBL_CHIP_VERSION (0xFE81) */
|
||||
ChipDescript* ChipHelper_GetVersionUniFi(CsrUint16 version);
|
||||
|
||||
/* This gets the version from the SDIO device id. This only
|
||||
gives quite a coarse grained version, so we should update once
|
||||
we hav access to the function N registers. */
|
||||
ChipDescript* ChipHelper_GetVersionSdio(CsrUint8 sdio_version);
|
||||
|
||||
/* The chip is some sort of BlueCore. If "age" is "pre_bc7" then
|
||||
"version" is what was read from FF9A. If "age" is bc7_or_later
|
||||
then "version" is read from FE81. If we don't know if we're pre
|
||||
or post BC7 then we should use "GetVersionAny". */
|
||||
ChipDescript* ChipHelper_GetVersionBlueCore(enum chip_helper_bluecore_age age,
|
||||
CsrUint16 version);
|
||||
|
||||
/* The main functions of this class are built with an X macro. This
|
||||
means we can generate the C and C++ versions from the same source
|
||||
without the two diverging.
|
||||
|
||||
The DEF0 functions are simple and take no parameters. The first
|
||||
parameter to the macro is the return type. The second parameter
|
||||
is the function name and the third parameter is where to get the
|
||||
info from (this is hidden from the user).
|
||||
|
||||
The DEF1 functions take one parameter. This time the third macro
|
||||
parameter is the type of this parameter, and the fourth macro
|
||||
parameter is the name of the parameter. The bodies of these
|
||||
functions are hand written. */
|
||||
#define CHIP_HELPER_LIST(m) \
|
||||
CHIP_HELPER_DEF0(m, (const CsrCharString *, FriendlyName, friendly_name)) \
|
||||
CHIP_HELPER_DEF0(m, (const CsrCharString *, MarketingName, marketing_name)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_EMU_CMD, regs->dbg_emu_cmd)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_PROC_SELECT, regs->host.dbg_proc_select)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_HOST_STOP_STATUS, regs->host.dbg_stop_status)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW1_PAGE, regs->host.window1_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW2_PAGE, regs->host.window2_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, HOST_WINDOW3_PAGE, regs->host.window3_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, HOST_IO_LOG_ADDR, regs->host.io_log_addr)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_PROC_SELECT, regs->spi.dbg_proc_select)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_SPI_STOP_STATUS, regs->spi.dbg_stop_status)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW1_PAGE, regs->spi.window1_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW2_PAGE, regs->spi.window2_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SPI_WINDOW3_PAGE, regs->spi.window3_page)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SPI_IO_LOG_ADDR, regs->spi.io_log_addr)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET, regs->dbg_reset)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_VALUE, regs->dbg_reset_value)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN, regs->dbg_reset_warn)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_WARN_VALUE, regs->dbg_reset_warn_value)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DBG_RESET_RESULT, regs->dbg_reset_result)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, WATCHDOG_DISABLE, regs->watchdog_disable)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, PROC_PC_SNOOP, regs->proc_pc_snoop)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, GBL_CHIP_VERSION, regs->gbl_chip_version)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, GBL_MISC_ENABLES, regs->gbl_misc_enables)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCH, regs->xap_pch)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, XAP_PCL, regs->xap_pcl)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX0, regs->mailbox0)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX1, regs->mailbox1)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX2, regs->mailbox2)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, MAILBOX3, regs->mailbox3)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HIP_HANDSHAKE, regs->sdio_hip_handshake)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SDIO_HOST_INT, regs->sdio_host_int)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, COEX_STATUS, regs->coex_status)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, SHARED_IO_INTERRUPT, regs->shared_io_interrupt)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_RAM_OFFSET, prog_offset.ram)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_ROM_OFFSET, prog_offset.rom)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_FLASH_OFFSET, prog_offset.flash)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint32, PROGRAM_MEMORY_EXT_SRAM_OFFSET, prog_offset.ext_sram)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrUint16, DATA_MEMORY_RAM_OFFSET, data_offset.ram)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrInt32, HasFlash, bools.has_flash)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrInt32, HasExtSram, bools.has_ext_sram)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrInt32, HasRom, bools.has_rom)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrInt32, HasBt, bools.has_bt)) \
|
||||
CHIP_HELPER_DEF0(m, (CsrInt32, HasWLan, bools.has_wlan)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_ADDRESS, enum chip_helper_window_index, window)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint16, WINDOW_SIZE, enum chip_helper_window_index, window)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_SPI2HOST, CsrUint16, addr)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint16, MapAddress_HOST2SPI, CsrUint16, addr)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint32, ClockStartupSequence, const struct chip_helper_init_values **, val)) \
|
||||
CHIP_HELPER_DEF1(m, (CsrUint32, HostResetSequence, const struct chip_helper_reset_values **, val))
|
||||
|
||||
/* Some magic to help the expansion */
|
||||
#define CHIP_HELPER_DEF0(a, b) \
|
||||
CHIP_HELPER_DEF0_ ## a b
|
||||
#define CHIP_HELPER_DEF1(a, b) \
|
||||
CHIP_HELPER_DEF1_ ## a b
|
||||
|
||||
/* Macros so that when we expand the list we get "C" function prototypes. */
|
||||
#define CHIP_HELPER_DEF0_C_DEC(ret_type, name, info) \
|
||||
ret_type ChipHelper_ ## name(ChipDescript * chip_help);
|
||||
#define CHIP_HELPER_DEF1_C_DEC(ret_type, name, type1, name1) \
|
||||
ret_type ChipHelper_ ## name(ChipDescript * chip_help, type1 name1);
|
||||
|
||||
CHIP_HELPER_LIST(C_DEC)
|
||||
|
||||
/* FriendlyName
|
||||
MarketingName
|
||||
|
||||
These two functions return human readable strings that describe
|
||||
the chip. FriendlyName returns something that a software engineer
|
||||
at CSR might understand. MarketingName returns something more like
|
||||
an external name for a CSR chip.
|
||||
*/
|
||||
/* DBG_EMU_CMD
|
||||
WATCHDOG_DISABLE
|
||||
PROC_PC_SNOOP
|
||||
GBL_CHIP_VERSION
|
||||
XAP_PCH
|
||||
XAP_PCL
|
||||
|
||||
These registers are used to control the XAPs.
|
||||
*/
|
||||
/* DBG_HOST_PROC_SELECT DBG_HOST_STOP_STATUS
|
||||
HOST_WINDOW1_PAGE HOST_WINDOW2_PAGE HOST_WINDOW3_PAGE
|
||||
HOST_IO_LOG_ADDR
|
||||
DBG_SPI_PROC_SELECT DBG_SPI_STOP_STATUS
|
||||
SPI_WINDOW1_PAGE SPI_WINDOW2_PAGE SPI_WINDOW3_PAGE
|
||||
SPI_IO_LOG_ADDR
|
||||
|
||||
These register are used to control the XAPs and the memory
|
||||
windows, normally while debugging the code on chip. There
|
||||
are two versons of these registers, one for access via SPI
|
||||
and another for access via the host interface.
|
||||
*/
|
||||
/* DBG_RESET
|
||||
DBG_RESET_VALUE
|
||||
DBG_RESET_WARN
|
||||
DBG_RESET_WARN_VALUE
|
||||
DBG_RESET_RESULT
|
||||
|
||||
These registers are used to reset the XAP. This can be
|
||||
quite complex for some chips. If DBG_RESET_WARN is non
|
||||
zero the DBG_RESET_WARN_VALUE should be written to address
|
||||
DBG_RESET_WARN before the reset is perfeormed. DBG_RESET_VALUE
|
||||
should then be written to DBG_RESET to make the reset happen.
|
||||
The DBG_RESET_RESULT register should contain 0 if the reset
|
||||
was successful.
|
||||
*/
|
||||
/* GBL_MISC_ENABLES
|
||||
|
||||
This register controls some special chip features. It
|
||||
should be used with care is it changes quite a lot between
|
||||
chip versions.
|
||||
*/
|
||||
/* MAILBOX0
|
||||
MAILBOX1
|
||||
MAILBOX2
|
||||
MAILBOX3
|
||||
|
||||
The mailbox registers are for communication between the host
|
||||
and the firmware. There use is described in part by the host
|
||||
interface protcol specifcation.
|
||||
*/
|
||||
/* SDIO_HIP_HANDSHAKE
|
||||
|
||||
This is one of the more important SDIO HIP registers. On some
|
||||
chips it has the same value as one of the mailbox registers
|
||||
and on other chips it is different.
|
||||
*/
|
||||
/* SDIO_HOST_INT
|
||||
SHARED_IO_INTERRUPT
|
||||
|
||||
These registers are used by some versions of the host interface
|
||||
protocol specification. Their names should probably be changed
|
||||
to hide the registers and to expose the functions more.
|
||||
*/
|
||||
/* COEX_STATUS
|
||||
|
||||
Coex status register, contains interrupt status and reset
|
||||
pullup status. The latter is used to detect WAPI.
|
||||
*/
|
||||
/* PROGRAM_MEMORY_RAM_OFFSET
|
||||
PROGRAM_MEMORY_ROM_OFFSET
|
||||
PROGRAM_MEMORY_FLASH_OFFSET
|
||||
PROGRAM_MEMORY_EXT_SRAM_OFFSET
|
||||
DATA_MEMORY_RAM_OFFSET
|
||||
|
||||
These are constants that describe the offset of the different
|
||||
memory types in the two different address spaces.
|
||||
*/
|
||||
/* HasFlash HasExtSram HasRom
|
||||
HasBt HasWLan
|
||||
|
||||
These are a set of bools describing the chip.
|
||||
*/
|
||||
/* WINDOW_ADDRESS WINDOW_SIZE
|
||||
|
||||
These two functions return the size and address of the windows.
|
||||
The address is the address of the lowest value in the address
|
||||
map that is part of the window and the size is the number of
|
||||
visible words.
|
||||
|
||||
Some of the windows have thier lowest portion covered by
|
||||
registers. For these windows address is the first address
|
||||
after the registers and size is the siave excluding the part
|
||||
covered by registers.
|
||||
*/
|
||||
/* MapAddress_SPI2HOST
|
||||
MapAddress_HOST2SPI
|
||||
|
||||
The debugging interface is duplicated on UniFi and later chips
|
||||
so that there are two versions - one over the SPI interaface and
|
||||
the other over the SDIO interface. These functions map the
|
||||
registers between these two interfaces.
|
||||
*/
|
||||
/* ClockStartupSequence
|
||||
|
||||
This function returns the list of register value pairs that
|
||||
should be forced into UniFi to enable SPI communication. This
|
||||
set of registers is not needed if the firmware is running, but
|
||||
will be needed if the device is being booted from cold. These
|
||||
register writes enable the clocks and setup the PLL to a basic
|
||||
working state. SPI access might be unreliable until these writes
|
||||
have occured (And they may take mulitple goes).
|
||||
*/
|
||||
/* HostResetSequence
|
||||
|
||||
This returns a number of chunks of data and generic pointers.
|
||||
All of the XAPs should be stopped. The data should be written
|
||||
to the generic pointers. The instruction pointer for the MAC
|
||||
should then be set to the start of program memory and then the
|
||||
MAC should be "go"d. This will reset the chip in a reliable
|
||||
and orderly manner without resetting the SDIO interface. It
|
||||
is therefore not needed if the chip is being accessed by the
|
||||
SPI interface (the DBG_RESET_ mechanism can be used instead).
|
||||
*/
|
||||
|
||||
/* The Decode Window function is more complex. For the window
|
||||
'window' it tries to return the address and page register
|
||||
value needed to see offset 'offset' of memory type 'type'.
|
||||
|
||||
It return 1 on success and 0 on failure. 'page' is what
|
||||
should be written to the page register. 'addr' is the
|
||||
address in the XAPs 16 address map to read from. 'len'
|
||||
is the length that we can read without having to change
|
||||
the page registers. */
|
||||
CsrInt32 ChipHelper_DecodeWindow(ChipDescript *chip_help,
|
||||
enum chip_helper_window_index window,
|
||||
enum chip_helper_window_type type,
|
||||
CsrUint32 offset,
|
||||
CsrUint16 *page, CsrUint16 *addr, CsrUint32 *len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
/* Close the extern "C" */
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the C++ API.
|
||||
*/
|
||||
|
||||
class ChipHelper
|
||||
{
|
||||
public:
|
||||
/* If this constructor is used then a GetVersionXXX function
|
||||
should be called next. */
|
||||
ChipHelper();
|
||||
|
||||
/* copy constructor */
|
||||
ChipHelper(ChipDescript * desc);
|
||||
|
||||
/* The default constructor assume a BC7 / UF105x series chip
|
||||
and that the number given is the value of UNIFI_GBL_CHIP_VERSION
|
||||
(0xFE81) */
|
||||
ChipHelper(CsrUint16 version);
|
||||
|
||||
/* This returns the C interface magic token from a C++ instance. */
|
||||
ChipDescript* GetDescript() const
|
||||
{
|
||||
return m_desc;
|
||||
}
|
||||
|
||||
|
||||
/* Clear out theis class (set it to the null token). */
|
||||
void ClearVersion();
|
||||
|
||||
/* Load this class with data for a specific chip. */
|
||||
void GetVersionAny(CsrUint16 from_FF9A, CsrUint16 from_FE81);
|
||||
void GetVersionUniFi(CsrUint16 version);
|
||||
void GetVersionBlueCore(chip_helper_bluecore_age age, CsrUint16 version);
|
||||
void GetVersionSdio(CsrUint8 sdio_version);
|
||||
|
||||
/* Helpers to build the definitions of the member functions. */
|
||||
#define CHIP_HELPER_DEF0_CPP_DEC(ret_type, name, info) \
|
||||
ret_type name() const;
|
||||
#define CHIP_HELPER_DEF1_CPP_DEC(ret_type, name, type1, name1) \
|
||||
ret_type name(type1 name1) const;
|
||||
|
||||
CHIP_HELPER_LIST(CPP_DEC)
|
||||
|
||||
|
||||
/* The DecodeWindow function, see the description of the C version. */
|
||||
CsrInt32 DecodeWindow(chip_helper_window_index window,
|
||||
chip_helper_window_type type,
|
||||
CsrUint32 offset,
|
||||
CsrUint16 &page, CsrUint16 &addr, CsrUint32 &len) const;
|
||||
|
||||
private:
|
||||
ChipDescript *m_desc;
|
||||
};
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
208
drivers/staging/csr/csr_wifi_hip_chiphelper_private.h
Normal file
208
drivers/staging/csr/csr_wifi_hip_chiphelper_private.h
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
|
||||
#define CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__
|
||||
|
||||
|
||||
#include "csr_wifi_hip_chiphelper.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* This GP stuff should be somewhere else? */
|
||||
|
||||
/* Memory spaces encoded in top byte of Generic Pointer type */
|
||||
#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
|
||||
#define UNIFI_EXT_FLASH 0x02 /* External FLASH */
|
||||
#define UNIFI_EXT_SRAM 0x03 /* External SRAM */
|
||||
#define UNIFI_REGISTERS 0x04 /* Registers */
|
||||
#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
|
||||
#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
|
||||
#define UNIFI_PHY_ROM 0x12 /* PHY ROM */
|
||||
#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
|
||||
#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
|
||||
#define UNIFI_MAC_ROM 0x22 /* MAC ROM */
|
||||
#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
|
||||
#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
|
||||
#define UNIFI_BT_ROM 0x32 /* BT ROM */
|
||||
|
||||
#define MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
|
||||
#define GP_OFFSET(GP) ((GP) & 0xFFFFFF)
|
||||
#define GP_SPACE(GP) (((GP) >> 24) & 0xFF)
|
||||
|
||||
|
||||
/* Address value pairs */
|
||||
struct val_array_t
|
||||
{
|
||||
CsrUint32 len;
|
||||
const struct chip_helper_init_values *vals;
|
||||
};
|
||||
|
||||
/* Just a (counted) CsrUint16 array */
|
||||
struct data_array_t
|
||||
{
|
||||
CsrUint32 len;
|
||||
const CsrUint16 *vals;
|
||||
};
|
||||
|
||||
struct reset_prog_t
|
||||
{
|
||||
CsrUint32 len;
|
||||
const struct chip_helper_reset_values *vals;
|
||||
};
|
||||
|
||||
/* The addresses of registers that are equivalent but on
|
||||
different host transports. */
|
||||
struct chip_map_address_t
|
||||
{
|
||||
CsrUint16 spi, host;
|
||||
};
|
||||
|
||||
struct map_array_t
|
||||
{
|
||||
CsrUint32 len;
|
||||
const struct chip_map_address_t *vals;
|
||||
};
|
||||
|
||||
struct chip_device_regs_per_transport_t
|
||||
{
|
||||
CsrUint16 dbg_proc_select;
|
||||
CsrUint16 dbg_stop_status;
|
||||
CsrUint16 window1_page; /* PROG_PMEM1 or GW1 */
|
||||
CsrUint16 window2_page; /* PROG_PMEM2 or GW2 */
|
||||
CsrUint16 window3_page; /* SHARED or GW3 */
|
||||
CsrUint16 io_log_addr;
|
||||
};
|
||||
|
||||
struct chip_device_regs_t
|
||||
{
|
||||
CsrUint16 gbl_chip_version;
|
||||
CsrUint16 gbl_misc_enables;
|
||||
CsrUint16 dbg_emu_cmd;
|
||||
struct chip_device_regs_per_transport_t host;
|
||||
struct chip_device_regs_per_transport_t spi;
|
||||
CsrUint16 dbg_reset;
|
||||
CsrUint16 dbg_reset_value;
|
||||
CsrUint16 dbg_reset_warn;
|
||||
CsrUint16 dbg_reset_warn_value;
|
||||
CsrUint16 dbg_reset_result;
|
||||
CsrUint16 xap_pch;
|
||||
CsrUint16 xap_pcl;
|
||||
CsrUint16 proc_pc_snoop;
|
||||
CsrUint16 watchdog_disable;
|
||||
CsrUint16 mailbox0;
|
||||
CsrUint16 mailbox1;
|
||||
CsrUint16 mailbox2;
|
||||
CsrUint16 mailbox3;
|
||||
CsrUint16 sdio_host_int;
|
||||
CsrUint16 shared_io_interrupt;
|
||||
CsrUint16 sdio_hip_handshake;
|
||||
CsrUint16 coex_status; /* Allows WAPI detection */
|
||||
};
|
||||
|
||||
/* If allowed is false then this window does not provide this
|
||||
type of access.
|
||||
This describes how addresses should be shifted to make the
|
||||
"page" address. The address is shifted left by 'page_shift'
|
||||
and then has 'page_offset' added. This value should then be
|
||||
written to the page register. */
|
||||
struct window_shift_info_t
|
||||
{
|
||||
CsrInt32 allowed;
|
||||
CsrUint32 page_shift;
|
||||
CsrUint16 page_offset;
|
||||
};
|
||||
|
||||
/* Each window has an address and size. These are obvious. It then
|
||||
has a description for each type of memory that might be accessed
|
||||
through it. There might also be a start to the offset of the window.
|
||||
This means that that number of addresses at the start of the window
|
||||
are unusable. */
|
||||
struct window_info_t
|
||||
{
|
||||
CsrUint16 address;
|
||||
CsrUint16 size;
|
||||
CsrUint16 blocked;
|
||||
const struct window_shift_info_t *mode;
|
||||
};
|
||||
|
||||
/* If GBL_CHIP_VERSION and'ed with 'mask' and is equal to 'result'
|
||||
then this is the correct set of info. If pre_bc7 is true then the
|
||||
address of GBL_CHIP_VERSION is FF9A, else its FE81. */
|
||||
struct chip_version_t
|
||||
{
|
||||
CsrInt32 pre_bc7;
|
||||
CsrUint16 mask;
|
||||
CsrUint16 result;
|
||||
CsrUint8 sdio;
|
||||
};
|
||||
|
||||
struct chip_device_desc_t
|
||||
{
|
||||
struct chip_version_t chip_version;
|
||||
|
||||
/* This is a text string that a human might find useful (BC02, UF105x) */
|
||||
const CsrCharString *friendly_name;
|
||||
/* This is what we show to customers */
|
||||
const CsrCharString *marketing_name;
|
||||
|
||||
/* Initialisation values to write following a reset */
|
||||
struct val_array_t init;
|
||||
|
||||
/* Binary sequence for hard reset */
|
||||
struct reset_prog_t reset_prog;
|
||||
|
||||
/* The register map */
|
||||
const struct chip_device_regs_t *regs;
|
||||
|
||||
/* Some misc. info on the chip */
|
||||
struct
|
||||
{
|
||||
CsrUint32 has_flash : 1;
|
||||
CsrUint32 has_ext_sram : 1;
|
||||
CsrUint32 has_rom : 1;
|
||||
CsrUint32 has_bt : 1;
|
||||
CsrUint32 has_wlan : 1;
|
||||
} bools;
|
||||
|
||||
/* This table is used to remap register addresses depending on what
|
||||
host interface is used. On the BC7 and later chips there are
|
||||
multiple sets of memory window registers, on for each host
|
||||
interafce (SDIO / SPI). The correct one is needed. */
|
||||
struct map_array_t map;
|
||||
|
||||
/* The offsets into the program address space of the different types of memory.
|
||||
The RAM offset is probably the most useful. */
|
||||
struct
|
||||
{
|
||||
CsrUint32 ram;
|
||||
CsrUint32 rom;
|
||||
CsrUint32 flash;
|
||||
CsrUint32 ext_sram;
|
||||
} prog_offset;
|
||||
|
||||
/* The offsets into the data address space of interesting things. */
|
||||
struct
|
||||
{
|
||||
CsrUint16 ram;
|
||||
/* maybe add shared / page tables? */
|
||||
} data_offset;
|
||||
|
||||
/* Information on the different windows */
|
||||
const struct window_info_t *windows[CHIP_HELPER_WINDOW_COUNT];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* CSR_WIFI_HIP_CHIPHELPER_PRIVATE_H__ */
|
81
drivers/staging/csr/csr_wifi_hip_conversions.h
Normal file
81
drivers/staging/csr/csr_wifi_hip_conversions.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
*
|
||||
* FILE: csr_wifi_hip_conversions.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* This header file provides the macros for converting to and from
|
||||
* wire format.
|
||||
* These macros *MUST* work for little-endian AND big-endian hosts.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CSR_WIFI_HIP_CONVERSIONS_H__
|
||||
#define __CSR_WIFI_HIP_CONVERSIONS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIZEOF_UINT16 2
|
||||
#define SIZEOF_UINT32 4
|
||||
#define SIZEOF_UINT64 8
|
||||
|
||||
#define SIZEOF_SIGNAL_HEADER 6
|
||||
#define SIZEOF_DATAREF 4
|
||||
|
||||
|
||||
/*
|
||||
* Macro to retrieve the signal ID from a wire-format signal.
|
||||
*/
|
||||
#define GET_SIGNAL_ID(_buf) CSR_GET_UINT16_FROM_LITTLE_ENDIAN((_buf))
|
||||
|
||||
/*
|
||||
* Macros to retrieve and set the DATAREF fields in a packed (i.e. wire-format)
|
||||
* HIP signal.
|
||||
*/
|
||||
#define GET_PACKED_DATAREF_SLOT(_buf, _ref) \
|
||||
CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
|
||||
|
||||
#define GET_PACKED_DATAREF_LEN(_buf, _ref) \
|
||||
CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
|
||||
|
||||
#define SET_PACKED_DATAREF_SLOT(_buf, _ref, _slot) \
|
||||
CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_slot), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 0))
|
||||
|
||||
#define SET_PACKED_DATAREF_LEN(_buf, _ref, _len) \
|
||||
CSR_COPY_UINT16_TO_LITTLE_ENDIAN((_len), ((_buf) + SIZEOF_SIGNAL_HEADER + ((_ref) * SIZEOF_DATAREF) + 2))
|
||||
|
||||
#define GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(_buf) \
|
||||
CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
|
||||
|
||||
#define GET_PACKED_MA_PACKET_REQUEST_HOST_TAG(_buf) \
|
||||
CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 4))
|
||||
|
||||
#define GET_PACKED_MA_PACKET_CONFIRM_HOST_TAG(_buf) \
|
||||
CSR_GET_UINT32_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 8))
|
||||
|
||||
#define GET_PACKED_MA_PACKET_CONFIRM_TRANSMISSION_STATUS(_buf) \
|
||||
CSR_GET_UINT16_FROM_LITTLE_ENDIAN(((_buf) + SIZEOF_SIGNAL_HEADER + UNIFI_MAX_DATA_REFERENCES * SIZEOF_DATAREF + 2))
|
||||
|
||||
|
||||
CsrInt32 get_packed_struct_size(const CsrUint8 *buf);
|
||||
CsrResult read_unpack_signal(const CsrUint8 *ptr, CSR_SIGNAL *sig);
|
||||
CsrResult write_pack(const CSR_SIGNAL *sig, CsrUint8 *ptr, CsrUint16 *sig_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CSR_WIFI_HIP_CONVERSIONS_H__ */
|
||||
|
834
drivers/staging/csr/csr_wifi_hip_download.c
Normal file
834
drivers/staging/csr/csr_wifi_hip_download.c
Normal file
|
@ -0,0 +1,834 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_download.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* Routines for downloading firmware to UniFi.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_unifiversion.h"
|
||||
#include "csr_wifi_hip_card.h"
|
||||
#include "csr_wifi_hip_xbv.h"
|
||||
|
||||
#undef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH
|
||||
|
||||
static CsrResult do_patch_download(card_t *card, void *dlpriv,
|
||||
xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr);
|
||||
|
||||
static CsrResult do_patch_convert_download(card_t *card,
|
||||
void *dlpriv, xbv1_t *pfwinfo);
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* _find_in_slut
|
||||
*
|
||||
* Find the offset of the appropriate object in the SLUT of a card
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* psym Pointer to symbol object.
|
||||
* id set up by caller
|
||||
* obj will be set up by this function
|
||||
* pslut Pointer to SLUT address, if 0xffffffff then it must be
|
||||
* read from the chip.
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success
|
||||
* Non-zero on error,
|
||||
* CSR_WIFI_HIP_RESULT_NOT_FOUND if not found
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult _find_in_slut(card_t *card, symbol_t *psym, CsrUint32 *pslut)
|
||||
{
|
||||
CsrUint32 slut_address;
|
||||
CsrUint16 finger_print;
|
||||
CsrResult r;
|
||||
CsrResult csrResult;
|
||||
|
||||
/* Get SLUT address */
|
||||
if (*pslut == 0xffffffff)
|
||||
{
|
||||
r = card_wait_for_firmware_to_start(card, &slut_address);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Firmware hasn't started\n");
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
*pslut = slut_address;
|
||||
|
||||
/*
|
||||
* Firmware has started so set the SDIO bus clock to the initial speed,
|
||||
* faster than UNIFI_SDIO_CLOCK_SAFE_HZ, to speed up the f/w download.
|
||||
*/
|
||||
csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ);
|
||||
if (csrResult != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
r = ConvertCsrSdioToCsrHipResult(card, csrResult);
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
card->sdio_clock_speed = UNIFI_SDIO_CLOCK_INIT_HZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
slut_address = *pslut; /* Use previously discovered address */
|
||||
}
|
||||
unifi_trace(card->ospriv, UDBG4, "SLUT addr: 0x%lX\n", slut_address);
|
||||
|
||||
/*
|
||||
* Check the SLUT fingerprint.
|
||||
* The slut_address is a generic pointer so we must use unifi_card_read16().
|
||||
*/
|
||||
unifi_trace(card->ospriv, UDBG4, "Looking for SLUT finger print\n");
|
||||
finger_print = 0;
|
||||
r = unifi_card_read16(card, slut_address, &finger_print);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to read SLUT finger print\n");
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (finger_print != SLUT_FINGERPRINT)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to find SLUT fingerprint\n");
|
||||
func_exit_r(CSR_RESULT_FAILURE);
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
/* Symbol table starts imedately after the fingerprint */
|
||||
slut_address += 2;
|
||||
|
||||
while (1)
|
||||
{
|
||||
CsrUint16 id;
|
||||
CsrUint32 obj;
|
||||
|
||||
r = unifi_card_read16(card, slut_address, &id);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
slut_address += 2;
|
||||
|
||||
if (id == CSR_SLT_END)
|
||||
{
|
||||
/* End of table reached: not found */
|
||||
r = CSR_WIFI_HIP_RESULT_RANGE;
|
||||
break;
|
||||
}
|
||||
|
||||
r = unifi_read32(card, slut_address, &obj);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
slut_address += 4;
|
||||
|
||||
unifi_trace(card->ospriv, UDBG3, " found SLUT id %02d.%08lx\n", id, obj);
|
||||
|
||||
r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
|
||||
/* Found search term? */
|
||||
if (id == psym->id)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG1, " matched SLUT id %02d.%08lx\n", id, obj);
|
||||
psym->obj = obj;
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* do_patch_convert_download
|
||||
*
|
||||
* Download the given firmware image to the UniFi, converting from FWDL
|
||||
* to PTDL XBV format.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* dlpriv Pointer to source firmware image
|
||||
* fwinfo Pointer to source firmware info struct
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, CSR error code on error
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo)
|
||||
{
|
||||
CsrResult r;
|
||||
CsrUint32 slut_base = 0xffffffff;
|
||||
void *pfw;
|
||||
CsrUint32 psize;
|
||||
symbol_t sym;
|
||||
|
||||
/* Reset the chip to guarantee that the ROM loader is running */
|
||||
r = unifi_init(card);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv,
|
||||
"do_patch_convert_download: failed to re-init UniFi\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
/* If no unifi_helper is running, the firmware version must be read */
|
||||
if (card->build_id == 0)
|
||||
{
|
||||
CsrUint32 ver = 0;
|
||||
sym.id = CSR_SLT_BUILD_ID_NUMBER;
|
||||
sym.obj = 0; /* To be updated by _find_in_slut() */
|
||||
|
||||
unifi_trace(card->ospriv, UDBG1, "Need f/w version\n");
|
||||
|
||||
/* Find chip build id entry in SLUT */
|
||||
r = _find_in_slut(card, &sym, &slut_base);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to find CSR_SLT_BUILD_ID_NUMBER\n");
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
/* Read running f/w version */
|
||||
r = unifi_read32(card, sym.obj, &ver);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to read f/w id\n");
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
card->build_id = ver;
|
||||
}
|
||||
|
||||
/* Convert the ptest firmware to a patch against the running firmware */
|
||||
pfw = xbv_to_patch(card, unifi_fw_read, dlpriv, pfwinfo, &psize);
|
||||
if (!pfw)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to convert f/w to patch");
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
void *desc;
|
||||
sym.id = CSR_SLT_BOOT_LOADER_CONTROL;
|
||||
sym.obj = 0; /* To be updated by _find_in_slut() */
|
||||
|
||||
/* Find boot loader control entry in SLUT */
|
||||
r = _find_in_slut(card, &sym, &slut_base);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to find BOOT_LOADER_CONTROL\n");
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to wake UniFi\n");
|
||||
}
|
||||
|
||||
/* Get a dlpriv for the patch buffer so that unifi_fw_read() can
|
||||
* access it.
|
||||
*/
|
||||
desc = unifi_fw_open_buffer(card->ospriv, pfw, psize);
|
||||
if (!desc)
|
||||
{
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
}
|
||||
|
||||
/* Download the patch */
|
||||
unifi_info(card->ospriv, "Downloading converted f/w as patch\n");
|
||||
r = unifi_dl_patch(card, desc, sym.obj);
|
||||
CsrMemFree(pfw);
|
||||
unifi_fw_close_buffer(card->ospriv, desc);
|
||||
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Converted patch download failed\n");
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
else
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG1, "Converted patch downloaded\n");
|
||||
}
|
||||
|
||||
/* This command starts the firmware */
|
||||
r = unifi_do_loader_op(card, sym.obj + 6, UNIFI_BOOT_LOADER_RESTART);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to write loader restart cmd\n");
|
||||
}
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_dl_firmware
|
||||
*
|
||||
* Download the given firmware image to the UniFi.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* dlpriv A context pointer from the calling function to be
|
||||
* passed when calling unifi_fw_read().
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success,
|
||||
* CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
*
|
||||
* Notes:
|
||||
* Stops and resets the chip, does the download and runs the new
|
||||
* firmware.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_dl_firmware(card_t *card, void *dlpriv)
|
||||
{
|
||||
xbv1_t *fwinfo;
|
||||
CsrResult r;
|
||||
|
||||
func_enter();
|
||||
|
||||
fwinfo = CsrMemAlloc(sizeof(xbv1_t));
|
||||
if (fwinfo == NULL)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to allocate memory for firmware\n");
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan the firmware file to find the TLVs we are interested in.
|
||||
* These are:
|
||||
* - check we support the file format version in VERF
|
||||
* - SLTP Symbol Lookup Table Pointer
|
||||
* - FWDL firmware download segments
|
||||
* - FWOV firmware overlay segment
|
||||
* - VMEQ Register probe tests to verify matching h/w
|
||||
*/
|
||||
r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo);
|
||||
if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_firmware)
|
||||
{
|
||||
unifi_error(card->ospriv, "File type is %s, expected firmware.\n",
|
||||
fwinfo->mode == xbv_patch?"patch" : "unknown");
|
||||
CsrMemFree(fwinfo);
|
||||
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
|
||||
/* UF6xxx doesn't accept firmware, only patches. Therefore we convert
|
||||
* the file to patch format with version numbers matching the current
|
||||
* running firmware, and then download via the patch mechanism.
|
||||
* The sole purpose of this is to support production test firmware across
|
||||
* different ROM releases, the test firmware being provided in non-patch
|
||||
* format.
|
||||
*/
|
||||
if (card->chip_id > SDIO_CARD_ID_UNIFI_2)
|
||||
{
|
||||
unifi_info(card->ospriv, "Must convert f/w to patch format\n");
|
||||
r = do_patch_convert_download(card, dlpriv, fwinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Older UniFi chips allowed firmware to be directly loaded onto the
|
||||
* chip, which is no longer supported.
|
||||
*/
|
||||
unifi_error(card->ospriv, "Only patch downloading supported\n");
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
|
||||
CsrMemFree(fwinfo);
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
} /* unifi_dl_firmware() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_dl_patch
|
||||
*
|
||||
* Load the given patch set into UniFi.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* dlpriv The os specific handle to the firmware file.
|
||||
* boot_ctrl The address of the boot loader control structure.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success,
|
||||
* CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
*
|
||||
* Notes:
|
||||
* This ends up telling UniFi to restart.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_dl_patch(card_t *card, void *dlpriv, CsrUint32 boot_ctrl)
|
||||
{
|
||||
xbv1_t *fwinfo;
|
||||
CsrResult r;
|
||||
|
||||
func_enter();
|
||||
|
||||
unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl);
|
||||
|
||||
fwinfo = CsrMemAlloc(sizeof(xbv1_t));
|
||||
if (fwinfo == NULL)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to allocate memory for patches\n");
|
||||
func_exit();
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Scan the firmware file to find the TLVs we are interested in.
|
||||
* These are:
|
||||
* - check we support the file format version in VERF
|
||||
* - FWID The build ID of the ROM that we can patch
|
||||
* - PTDL patch download segments
|
||||
*/
|
||||
r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo);
|
||||
if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch)
|
||||
{
|
||||
CsrMemFree(fwinfo);
|
||||
unifi_error(card->ospriv, "Failed to read in patch file\n");
|
||||
func_exit();
|
||||
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have to check the build id read from the SLUT against that
|
||||
* for the patch file. They have to match exactly.
|
||||
* "card->build_id" == XBV1.PTCH.FWID
|
||||
*/
|
||||
if (card->build_id != fwinfo->build_id)
|
||||
{
|
||||
unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n",
|
||||
card->build_id, fwinfo->build_id);
|
||||
CsrMemFree(fwinfo);
|
||||
#ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH
|
||||
func_exit();
|
||||
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
#else
|
||||
fwinfo = NULL;
|
||||
dlpriv = NULL;
|
||||
return CSR_RESULT_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
r = do_patch_download(card, dlpriv, fwinfo, boot_ctrl);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to patch image\n");
|
||||
}
|
||||
|
||||
CsrMemFree(fwinfo);
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
} /* unifi_dl_patch() */
|
||||
|
||||
|
||||
void* unifi_dl_fw_read_start(card_t *card, CsrInt8 is_fw)
|
||||
{
|
||||
card_info_t card_info;
|
||||
|
||||
unifi_card_info(card, &card_info);
|
||||
unifi_trace(card->ospriv, UDBG5,
|
||||
"id=%d, ver=0x%x, fw_build=%u, fw_hip=0x%x, block_size=%d\n",
|
||||
card_info.chip_id, card_info.chip_version,
|
||||
card_info.fw_build, card_info.fw_hip_version,
|
||||
card_info.sdio_block_size);
|
||||
|
||||
return unifi_fw_read_start(card->ospriv, is_fw, &card_info);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* safe_read_shared_location
|
||||
*
|
||||
* Read a shared memory location repeatedly until we get two readings
|
||||
* the same.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card context struct.
|
||||
* unifi_addr UniFi shared-data-memory address to access.
|
||||
* pdata Pointer to a byte variable for the value read.
|
||||
*
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, CSR error code on failure
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult safe_read_shared_location(card_t *card, CsrUint32 address, CsrUint8 *pdata)
|
||||
{
|
||||
CsrResult r;
|
||||
CsrUint16 limit = 1000;
|
||||
CsrUint8 b, b2;
|
||||
|
||||
*pdata = 0;
|
||||
|
||||
r = unifi_read_8_or_16(card, address, &b);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
while (limit--)
|
||||
{
|
||||
r = unifi_read_8_or_16(card, address, &b2);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
/* When we have a stable value, return it */
|
||||
if (b == b2)
|
||||
{
|
||||
*pdata = b;
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
b = b2;
|
||||
}
|
||||
|
||||
return CSR_RESULT_FAILURE;
|
||||
} /* safe_read_shared_location() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_do_loader_op
|
||||
*
|
||||
* Send a loader / boot_loader command to the UniFi and wait for
|
||||
* it to complete.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card context struct.
|
||||
* op_addr The address of the loader operation control word.
|
||||
* opcode The operation to perform.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success
|
||||
* CSR_RESULT_FAILURE SDIO error or SDIO/XAP timeout
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ideally instead of sleeping, we want to busy wait.
|
||||
* Currently there is no framework API to do this. When it becomes available,
|
||||
* we can use it to busy wait using usecs
|
||||
*/
|
||||
#define OPERATION_TIMEOUT_LOOPS (100) /* when OPERATION_TIMEOUT_DELAY==1, (500) otherwise */
|
||||
#define OPERATION_TIMEOUT_DELAY 1 /* msec, or 200usecs */
|
||||
|
||||
CsrResult unifi_do_loader_op(card_t *card, CsrUint32 op_addr, CsrUint8 opcode)
|
||||
{
|
||||
CsrResult r;
|
||||
CsrInt16 op_retries;
|
||||
|
||||
unifi_trace(card->ospriv, UDBG4, "Loader cmd 0x%0x -> 0x%08x\n", opcode, op_addr);
|
||||
|
||||
/* Set the Operation command byte to the opcode */
|
||||
r = unifi_write_8_or_16(card, op_addr, opcode);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to write loader copy command\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Wait for Operation command byte to be Idle */
|
||||
/* Typically takes ~100us */
|
||||
op_retries = 0;
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
while (1)
|
||||
{
|
||||
CsrUint8 op;
|
||||
|
||||
/*
|
||||
* Read the memory location until two successive reads give
|
||||
* the same value.
|
||||
* Then handle it.
|
||||
*/
|
||||
r = safe_read_shared_location(card, op_addr, &op);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to read loader status\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (op == UNIFI_LOADER_IDLE)
|
||||
{
|
||||
/* Success */
|
||||
break;
|
||||
}
|
||||
|
||||
if (op != opcode)
|
||||
{
|
||||
unifi_error(card->ospriv, "Error reported by loader: 0x%X\n", op);
|
||||
r = CSR_RESULT_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Allow 500us timeout */
|
||||
if (++op_retries >= OPERATION_TIMEOUT_LOOPS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Timeout waiting for loader to ack transfer\n");
|
||||
/* Stop XAPs to aid post-mortem */
|
||||
r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to stop UniFi processors\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
r = CSR_RESULT_FAILURE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CsrThreadSleep(OPERATION_TIMEOUT_DELAY);
|
||||
} /* Loop exits with r != CSR_RESULT_SUCCESS on error */
|
||||
|
||||
return r;
|
||||
} /* unifi_do_loader_op() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* send_ptdl_to_unifi
|
||||
*
|
||||
* Copy a patch block from userland to the UniFi.
|
||||
* This function reads data, 2K at a time, from userland and writes
|
||||
* it to the UniFi.
|
||||
*
|
||||
* Arguments:
|
||||
* card A pointer to the card structure
|
||||
* dlpriv The os specific handle for the firmware file
|
||||
* ptdl A pointer ot the PTDL block
|
||||
* handle The buffer handle to use for the xfer
|
||||
* op_addr The address of the loader operation control word
|
||||
*
|
||||
* Returns:
|
||||
* Number of bytes sent (Positive) or negative value indicating
|
||||
* error code:
|
||||
* CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE error in XBV file
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv,
|
||||
const struct PTDL *ptdl, CsrUint32 handle,
|
||||
CsrUint32 op_addr)
|
||||
{
|
||||
CsrUint32 offset;
|
||||
CsrUint8 *buf;
|
||||
CsrInt32 data_len;
|
||||
CsrUint32 write_len;
|
||||
CsrResult r;
|
||||
const CsrUint16 buf_size = 2 * 1024;
|
||||
|
||||
offset = ptdl->dl_offset;
|
||||
data_len = ptdl->dl_size;
|
||||
|
||||
if (data_len > buf_size)
|
||||
{
|
||||
unifi_error(card->ospriv, "PTDL block is too large (%u)\n",
|
||||
ptdl->dl_size);
|
||||
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
|
||||
buf = CsrMemAlloc(buf_size);
|
||||
if (buf == NULL)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to allocate transfer buffer for firmware download\n");
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
}
|
||||
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
|
||||
if (unifi_fw_read(card->ospriv, dlpriv, offset, buf, data_len) != data_len)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to read from file\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We can always round these if the host wants to */
|
||||
if (card->sdio_io_block_pad)
|
||||
{
|
||||
write_len = (data_len + (card->sdio_io_block_size - 1)) &
|
||||
~(card->sdio_io_block_size - 1);
|
||||
|
||||
/* Zero out the rest of the buffer (This isn't needed, but it
|
||||
* makes debugging things later much easier). */
|
||||
CsrMemSet(buf + data_len, 0, write_len - data_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_len = data_len;
|
||||
}
|
||||
|
||||
r = unifi_bulk_rw_noretry(card, handle, buf, write_len, UNIFI_SDIO_WRITE);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "CMD53 failed writing %d bytes to handle %ld\n",
|
||||
data_len, handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Can change the order of things to overlap read from file
|
||||
* with copy to unifi
|
||||
*/
|
||||
r = unifi_do_loader_op(card, op_addr, UNIFI_BOOT_LOADER_PATCH);
|
||||
}
|
||||
}
|
||||
|
||||
CsrMemFree(buf);
|
||||
|
||||
if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to copy block of %u bytes to UniFi\n",
|
||||
ptdl->dl_size);
|
||||
}
|
||||
|
||||
return r;
|
||||
} /* send_ptdl_to_unifi() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* do_patch_download
|
||||
*
|
||||
* This function downloads a set of patches to UniFi and then
|
||||
* causes it to restart.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct.
|
||||
* dlpriv A context pointer from the calling function to be
|
||||
* used when reading the XBV file. This can be NULL
|
||||
* in which case not patches are applied.
|
||||
* pfwinfo Pointer to a fwinfo struct describing the f/w
|
||||
* XBV file.
|
||||
* boot_ctrl_addr The address of the boot loader control structure.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, or an error code
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE for a bad laoader version number
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult do_patch_download(card_t *card, void *dlpriv, xbv1_t *pfwinfo, CsrUint32 boot_ctrl_addr)
|
||||
{
|
||||
CsrResult r;
|
||||
CsrInt32 i;
|
||||
CsrUint16 loader_version;
|
||||
CsrUint16 handle;
|
||||
CsrUint32 total_bytes;
|
||||
|
||||
/*
|
||||
* Read info from the SDIO Loader Control Data Structure
|
||||
*/
|
||||
/* Check the loader version */
|
||||
r = unifi_card_read16(card, boot_ctrl_addr, &loader_version);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Patch download: Failed to read loader version\n");
|
||||
return r;
|
||||
}
|
||||
unifi_trace(card->ospriv, UDBG2, "Patch download: boot loader version 0x%04X\n", loader_version);
|
||||
switch (loader_version)
|
||||
{
|
||||
case 0x0000:
|
||||
break;
|
||||
|
||||
default:
|
||||
unifi_error(card->ospriv, "Patch loader version (0x%04X) is not supported by this driver\n",
|
||||
loader_version);
|
||||
return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
|
||||
/* Retrieve the handle to use with CMD53 */
|
||||
r = unifi_card_read16(card, boot_ctrl_addr + 4, &handle);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Patch download: Failed to read loader handle\n");
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Set the mask of LEDs to flash */
|
||||
if (card->loader_led_mask)
|
||||
{
|
||||
r = unifi_card_write16(card, boot_ctrl_addr + 2,
|
||||
(CsrUint16)card->loader_led_mask);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Patch download: Failed to write LED mask\n");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
total_bytes = 0;
|
||||
|
||||
/* Copy download data to UniFi memory */
|
||||
for (i = 0; i < pfwinfo->num_ptdl; i++)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG3, "Patch download: %d Downloading for %d from offset %d\n",
|
||||
i,
|
||||
pfwinfo->ptdl[i].dl_size,
|
||||
pfwinfo->ptdl[i].dl_offset);
|
||||
|
||||
r = send_ptdl_to_unifi(card, dlpriv, &pfwinfo->ptdl[i],
|
||||
handle, boot_ctrl_addr + 6);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
return r;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Patch failed after %u bytes\n",
|
||||
total_bytes);
|
||||
return r;
|
||||
}
|
||||
total_bytes += pfwinfo->ptdl[i].dl_size;
|
||||
}
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
} /* do_patch_download() */
|
||||
|
||||
|
872
drivers/staging/csr/csr_wifi_hip_dump.c
Normal file
872
drivers/staging/csr/csr_wifi_hip_dump.c
Normal file
|
@ -0,0 +1,872 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_dump.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* Routines for retrieving and buffering core status from the UniFi
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_unifiversion.h"
|
||||
#include "csr_wifi_hip_card.h"
|
||||
|
||||
/* Locations to capture in dump (XAP words) */
|
||||
#define HIP_CDUMP_FIRST_CPUREG (0xFFE0) /* First CPU register */
|
||||
#define HIP_CDUMP_FIRST_LO (0) /* Start of low address range */
|
||||
#define HIP_CDUMP_FIRST_HI_MAC (0x3C00) /* Start of MAC high area */
|
||||
#define HIP_CDUMP_FIRST_HI_PHY (0x1C00) /* Start of PHY high area */
|
||||
#define HIP_CDUMP_FIRST_SH (0) /* Start of shared memory area */
|
||||
|
||||
#define HIP_CDUMP_NCPUREGS (10) /* No. of 16-bit XAP registers */
|
||||
#define HIP_CDUMP_NWORDS_LO (0x0100) /* Low area size in 16-bit words */
|
||||
#define HIP_CDUMP_NWORDS_HI (0x0400) /* High area size in 16-bit words */
|
||||
#define HIP_CDUMP_NWORDS_SH (0x0500) /* Shared memory area size, 16-bit words */
|
||||
|
||||
#define HIP_CDUMP_NUM_ZONES 7 /* Number of UniFi memory areas to capture */
|
||||
|
||||
/* Mini-coredump state */
|
||||
typedef struct coredump_buf
|
||||
{
|
||||
CsrUint16 count; /* serial number of dump */
|
||||
CsrTime timestamp; /* host's system time at capture */
|
||||
CsrInt16 requestor; /* request: 0=auto dump, 1=manual */
|
||||
CsrUint16 chip_ver;
|
||||
CsrUint32 fw_ver;
|
||||
CsrUint16 *zone[HIP_CDUMP_NUM_ZONES];
|
||||
|
||||
struct coredump_buf *next; /* circular list */
|
||||
struct coredump_buf *prev; /* circular list */
|
||||
} coredump_buffer;
|
||||
|
||||
/* Structure used to describe a zone of chip memory captured by mini-coredump */
|
||||
struct coredump_zone
|
||||
{
|
||||
unifi_coredump_space_t space; /* XAP memory space this zone covers */
|
||||
enum unifi_dbg_processors_select cpu; /* XAP CPU core selector */
|
||||
CsrUint32 gp; /* Generic Pointer to memory zone on XAP */
|
||||
CsrUint16 offset; /* 16-bit XAP word offset of zone in memory space */
|
||||
CsrUint16 length; /* Length of zone in XAP words */
|
||||
};
|
||||
|
||||
static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf);
|
||||
static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf);
|
||||
static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zone,
|
||||
const struct coredump_zone *def);
|
||||
static CsrInt32 get_value_from_coredump(const coredump_buffer *dump,
|
||||
const unifi_coredump_space_t space, const CsrUint16 offset);
|
||||
|
||||
/* Table of chip memory zones we capture on mini-coredump */
|
||||
static const struct coredump_zone zonedef_table[HIP_CDUMP_NUM_ZONES] = {
|
||||
{ UNIFI_COREDUMP_MAC_REG, UNIFI_PROC_MAC, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS },
|
||||
{ UNIFI_COREDUMP_PHY_REG, UNIFI_PROC_PHY, UNIFI_MAKE_GP(REGISTERS, HIP_CDUMP_FIRST_CPUREG * 2), HIP_CDUMP_FIRST_CPUREG, HIP_CDUMP_NCPUREGS },
|
||||
{ UNIFI_COREDUMP_SH_DMEM, UNIFI_PROC_INVALID, UNIFI_MAKE_GP(SH_DMEM, HIP_CDUMP_FIRST_SH * 2), HIP_CDUMP_FIRST_SH, HIP_CDUMP_NWORDS_SH },
|
||||
{ UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO },
|
||||
{ UNIFI_COREDUMP_MAC_DMEM, UNIFI_PROC_MAC, UNIFI_MAKE_GP(MAC_DMEM, HIP_CDUMP_FIRST_HI_MAC * 2), HIP_CDUMP_FIRST_HI_MAC, HIP_CDUMP_NWORDS_HI },
|
||||
{ UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_LO * 2), HIP_CDUMP_FIRST_LO, HIP_CDUMP_NWORDS_LO },
|
||||
{ UNIFI_COREDUMP_PHY_DMEM, UNIFI_PROC_PHY, UNIFI_MAKE_GP(PHY_DMEM, HIP_CDUMP_FIRST_HI_PHY * 2), HIP_CDUMP_FIRST_HI_PHY, HIP_CDUMP_NWORDS_HI },
|
||||
};
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_request_at_next_reset
|
||||
*
|
||||
* Request that a mini-coredump is performed when the driver has
|
||||
* completed resetting the UniFi device.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* enable If non-zero, sets the request.
|
||||
* If zero, cancels any pending request.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS or CSR HIP error code
|
||||
*
|
||||
* Notes:
|
||||
* This function is typically called once the driver has detected that
|
||||
* the UniFi device has become unresponsive due to crash, or internal
|
||||
* watchdog reset. The driver must reset it to regain communication and,
|
||||
* immediately after that, the mini-coredump can be captured.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable)
|
||||
{
|
||||
CsrResult r;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (enable)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG2, "Mini-coredump requested after reset\n");
|
||||
}
|
||||
|
||||
if (card == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
card->request_coredump_on_reset = enable?1 : 0;
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_handle_request
|
||||
*
|
||||
* Performs a coredump now, if one was requested, and clears the request.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS or CSR HIP error code
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_coredump_handle_request(card_t *card)
|
||||
{
|
||||
CsrResult r = CSR_RESULT_SUCCESS;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (card == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (card->request_coredump_on_reset == 1)
|
||||
{
|
||||
card->request_coredump_on_reset = 0;
|
||||
r = unifi_coredump_capture(card, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_capture
|
||||
*
|
||||
* Capture the current status of the UniFi device.
|
||||
* Various registers are buffered for future offline inspection.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* req Pointer to request struct, or NULL:
|
||||
* A coredump requested manually by the user app
|
||||
* will have a request struct pointer, an automatic
|
||||
* coredump will have a NULL pointer.
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success,
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE Initialisation not complete
|
||||
*
|
||||
* Notes:
|
||||
* The result is a filled entry in the circular buffer of core dumps,
|
||||
* values from which can be extracted to userland via an ioctl.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req)
|
||||
{
|
||||
CsrResult r = CSR_RESULT_SUCCESS;
|
||||
static CsrUint16 dump_seq_no = 1;
|
||||
CsrTime time_of_capture;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (card->dump_next_write == NULL)
|
||||
{
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Reject forced capture before initialisation has happened */
|
||||
if (card->helper == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Force a mini-coredump capture right now
|
||||
*/
|
||||
time_of_capture = CsrTimeGet(NULL);
|
||||
unifi_info(card->ospriv, "Mini-coredump capture at t=%u\n", time_of_capture);
|
||||
|
||||
/* Wake up the processors so we can talk to them */
|
||||
r = unifi_set_host_state(card, UNIFI_HOST_STATE_AWAKE);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to wake UniFi\n");
|
||||
goto done;
|
||||
}
|
||||
CsrThreadSleep(20);
|
||||
|
||||
/* Stop both XAPs */
|
||||
unifi_trace(card->ospriv, UDBG4, "Stopping XAPs for coredump capture\n");
|
||||
r = unifi_card_stop_processor(card, UNIFI_PROC_BOTH);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to stop UniFi XAPs\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Dump core into the next available slot in the circular list */
|
||||
r = unifi_coredump_from_sdio(card, card->dump_next_write);
|
||||
if (r == CSR_RESULT_SUCCESS)
|
||||
{
|
||||
/* Record whether the dump was manual or automatic */
|
||||
card->dump_next_write->requestor = (req?1 : 0);
|
||||
card->dump_next_write->timestamp = time_of_capture;
|
||||
/* Advance to the next buffer */
|
||||
card->dump_next_write->count = dump_seq_no++;
|
||||
card->dump_cur_read = card->dump_next_write;
|
||||
card->dump_next_write = card->dump_next_write->next;
|
||||
|
||||
/* Sequence no. of zero indicates slot not in use, so handle wrap */
|
||||
if (dump_seq_no == 0)
|
||||
{
|
||||
dump_seq_no = 1;
|
||||
}
|
||||
|
||||
unifi_trace(card->ospriv, UDBG3,
|
||||
"Coredump (%p), SeqNo=%d, cur_read=%p, next_write=%p\n",
|
||||
req,
|
||||
card->dump_cur_read->count,
|
||||
card->dump_cur_read, card->dump_next_write);
|
||||
}
|
||||
|
||||
/* Start both XAPs */
|
||||
unifi_trace(card->ospriv, UDBG4, "Restart XAPs after coredump\n");
|
||||
r = card_start_processor(card, UNIFI_PROC_BOTH);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Failed to start UniFi XAPs\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
} /* unifi_coredump_capture() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* get_value_from_coredump
|
||||
*
|
||||
*
|
||||
*
|
||||
* Arguments:
|
||||
* dump Pointer to buffered coredump data
|
||||
* offset_in_space XAP memory space to retrieve from the buffer (there
|
||||
* may be more than one zone covering the same memory
|
||||
* space, but starting from different offsets).
|
||||
* offset Offset within the XAP memory space to be retrieved
|
||||
*
|
||||
* Returns:
|
||||
* >=0 Register value on success
|
||||
* <0 Register out of range of any captured zones
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrInt32 get_value_from_coredump(const coredump_buffer *dump,
|
||||
const unifi_coredump_space_t space,
|
||||
const CsrUint16 offset_in_space)
|
||||
{
|
||||
CsrInt32 r = -1;
|
||||
CsrUint16 offset_in_zone;
|
||||
CsrUint32 zone_end_offset;
|
||||
CsrInt32 i;
|
||||
const struct coredump_zone *def = &zonedef_table[0];
|
||||
|
||||
/* Search zone def table for a match with the requested memory space */
|
||||
for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++, def++)
|
||||
{
|
||||
if (space == def->space)
|
||||
{
|
||||
zone_end_offset = def->offset + def->length;
|
||||
|
||||
/* Is the space offset contained in this zone? */
|
||||
if (offset_in_space < zone_end_offset &&
|
||||
offset_in_space >= def->offset)
|
||||
{
|
||||
/* Calculate the offset of data within the zone buffer */
|
||||
offset_in_zone = offset_in_space - def->offset;
|
||||
r = (CsrInt32) * (dump->zone[i] + offset_in_zone);
|
||||
|
||||
unifi_trace(NULL, UDBG6,
|
||||
"sp %d, offs 0x%04x = 0x%04x (in z%d 0x%04x->0x%04x)\n",
|
||||
space, offset_in_space, r,
|
||||
i, def->offset, zone_end_offset - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_get_value
|
||||
*
|
||||
* Retrieve the value of a register buffered from a previous core dump,
|
||||
* so that it may be reported back to application code.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* req_reg Pointer to request parameter partially filled. This
|
||||
* function puts in the values retrieved from the dump.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, or:
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE Null parameter error
|
||||
* CSR_WIFI_HIP_RESULT_RANGE Register out of range
|
||||
* CSR_WIFI_HIP_RESULT_NOT_FOUND Dump index not (yet) captured
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req)
|
||||
{
|
||||
CsrResult r;
|
||||
CsrInt32 i = 0;
|
||||
coredump_buffer *find_dump = NULL;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (req == NULL || card == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
goto done;
|
||||
}
|
||||
req->value = -1;
|
||||
if (card->dump_buf == NULL)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG2, "No coredump buffers\n");
|
||||
r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* Coredumping disabled */
|
||||
goto done;
|
||||
}
|
||||
if (card->dump_cur_read == NULL)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG4, "No coredumps captured\n");
|
||||
r = CSR_WIFI_HIP_RESULT_NOT_FOUND; /* No coredump yet captured */
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Find the requested dump buffer */
|
||||
switch (req->index)
|
||||
{
|
||||
case 0: /* Newest */
|
||||
find_dump = card->dump_cur_read;
|
||||
break;
|
||||
case -1: /* Oldest: The next used slot forward */
|
||||
for (find_dump = card->dump_cur_read->next;
|
||||
(find_dump->count == 0) && (find_dump != card->dump_cur_read);
|
||||
find_dump = card->dump_cur_read->next)
|
||||
{
|
||||
}
|
||||
break;
|
||||
default: /* Number of steps back from current read position */
|
||||
for (i = 0, find_dump = card->dump_cur_read;
|
||||
i < req->index;
|
||||
i++, find_dump = find_dump->prev)
|
||||
{
|
||||
/* Walk the list for the index'th entry, but
|
||||
* stop when about to wrap. */
|
||||
unifi_trace(card->ospriv, UDBG6,
|
||||
"%d: %d, @%p, p=%p, n=%p, cr=%p, h=%p\n",
|
||||
i, find_dump->count, find_dump, find_dump->prev,
|
||||
find_dump->next, card->dump_cur_read, card->dump_buf);
|
||||
if (find_dump->prev == card->dump_cur_read)
|
||||
{
|
||||
/* Wrapped but still not found, index out of range */
|
||||
if (i != req->index)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG6,
|
||||
"Dump index %d not found %d\n", req->index, i);
|
||||
r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check if the slot is actually filled with a core dump */
|
||||
if (find_dump->count == 0)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG4, "Not captured %d\n", req->index);
|
||||
r = CSR_WIFI_HIP_RESULT_NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
unifi_trace(card->ospriv, UDBG6, "Req index %d, found seq %d at step %d\n",
|
||||
req->index, find_dump->count, i);
|
||||
|
||||
/* Find the appropriate entry in the buffer */
|
||||
req->value = get_value_from_coredump(find_dump, req->space, (CsrUint16)req->offset);
|
||||
if (req->value < 0)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_RANGE; /* Un-captured register */
|
||||
unifi_trace(card->ospriv, UDBG4,
|
||||
"Can't read space %d, reg 0x%x from coredump buffer %d\n",
|
||||
req->space, req->offset, req->index);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Update the private request structure with the found values */
|
||||
req->chip_ver = find_dump->chip_ver;
|
||||
req->fw_ver = find_dump->fw_ver;
|
||||
req->timestamp = find_dump->timestamp;
|
||||
req->requestor = find_dump->requestor;
|
||||
req->serial = find_dump->count;
|
||||
|
||||
done:
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
} /* unifi_coredump_get_value() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_read_zone
|
||||
*
|
||||
* Captures a UniFi memory zone into a buffer on the host
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* zonebuf Pointer to on-host buffer to dump the memory zone into
|
||||
* def Pointer to description of the memory zone to read from UniFi.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, or:
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
|
||||
*
|
||||
* Notes:
|
||||
* It is assumed that the caller has already stopped the XAPs
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult unifi_coredump_read_zone(card_t *card, CsrUint16 *zonebuf, const struct coredump_zone *def)
|
||||
{
|
||||
CsrResult r;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (zonebuf == NULL || def == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Select XAP CPU if necessary */
|
||||
if (def->cpu != UNIFI_PROC_INVALID)
|
||||
{
|
||||
if (def->cpu != UNIFI_PROC_MAC && def->cpu != UNIFI_PROC_PHY)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
goto done;
|
||||
}
|
||||
r = unifi_set_proc_select(card, def->cpu);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
unifi_trace(card->ospriv, UDBG4,
|
||||
"Dump sp %d, offs 0x%04x, 0x%04x words @GP=%08x CPU %d\n",
|
||||
def->space, def->offset, def->length, def->gp, def->cpu);
|
||||
|
||||
/* Read on-chip RAM (byte-wise) */
|
||||
r = unifi_card_readn(card, def->gp, zonebuf, (CsrUint16)(def->length * 2));
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Can't read UniFi shared data area\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_read_zones
|
||||
*
|
||||
* Walks through the table of on-chip memory zones defined in zonedef_table,
|
||||
* and reads each of them from the UniFi chip
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* dump_buf Buffer into which register values will be dumped
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, or:
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
|
||||
*
|
||||
* Notes:
|
||||
* It is assumed that the caller has already stopped the XAPs
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult unifi_coredump_read_zones(card_t *card, coredump_buffer *dump_buf)
|
||||
{
|
||||
CsrResult r = CSR_RESULT_SUCCESS;
|
||||
CsrInt32 i;
|
||||
|
||||
func_enter();
|
||||
|
||||
/* Walk the table of coredump zone definitions and read them from the chip */
|
||||
for (i = 0;
|
||||
(i < HIP_CDUMP_NUM_ZONES) && (r == 0);
|
||||
i++)
|
||||
{
|
||||
r = unifi_coredump_read_zone(card, dump_buf->zone[i], &zonedef_table[i]);
|
||||
}
|
||||
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_from_sdio
|
||||
*
|
||||
* Capture the status of the UniFi processors, over SDIO
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* reg_buffer Buffer into which register values will be dumped
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, or:
|
||||
* CSR_RESULT_FAILURE SDIO error
|
||||
* CSR_WIFI_HIP_RESULT_INVALID_VALUE Parameter error
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult unifi_coredump_from_sdio(card_t *card, coredump_buffer *dump_buf)
|
||||
{
|
||||
CsrUint16 val;
|
||||
CsrResult r;
|
||||
CsrUint32 sdio_addr;
|
||||
|
||||
func_enter();
|
||||
|
||||
if (dump_buf == NULL)
|
||||
{
|
||||
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
/* Chip and firmware version */
|
||||
unifi_trace(card->ospriv, UDBG4, "Get chip version\n");
|
||||
sdio_addr = 2 * ChipHelper_GBL_CHIP_VERSION(card->helper);
|
||||
if (sdio_addr != 0)
|
||||
{
|
||||
r = unifi_read_direct16(card, sdio_addr, &val);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Can't read GBL_CHIP_VERSION\n");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
dump_buf->chip_ver = val;
|
||||
dump_buf->fw_ver = card->build_id;
|
||||
|
||||
unifi_trace(card->ospriv, UDBG4, "chip_ver 0x%04x, fw_ver %u\n",
|
||||
dump_buf->chip_ver, dump_buf->fw_ver);
|
||||
|
||||
/* Capture the memory zones required from UniFi */
|
||||
r = unifi_coredump_read_zones(card, dump_buf);
|
||||
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "Can't read UniFi memory areas\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
func_exit_r(r);
|
||||
return r;
|
||||
} /* unifi_coredump_from_sdio() */
|
||||
|
||||
|
||||
#ifndef UNIFI_DISABLE_COREDUMP
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* new_coredump_node
|
||||
*
|
||||
* Allocates a coredump linked-list node, and links it to the previous.
|
||||
*
|
||||
* Arguments:
|
||||
* ospriv OS context
|
||||
* prevnode Previous node to link into
|
||||
*
|
||||
* Returns:
|
||||
* Pointer to valid coredump_buffer on success
|
||||
* NULL on memory allocation failure
|
||||
*
|
||||
* Notes:
|
||||
* Allocates "all or nothing"
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static
|
||||
coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode)
|
||||
{
|
||||
coredump_buffer *newnode = NULL;
|
||||
CsrUint16 *newzone = NULL;
|
||||
CsrInt32 i;
|
||||
CsrUint32 zone_size;
|
||||
|
||||
/* Allocate node header */
|
||||
newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer));
|
||||
if (newnode == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
CsrMemSet(newnode, 0, sizeof(coredump_buffer));
|
||||
|
||||
/* Allocate chip memory zone capture buffers */
|
||||
for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++)
|
||||
{
|
||||
zone_size = sizeof(CsrUint16) * zonedef_table[i].length;
|
||||
newzone = (CsrUint16 *)CsrMemAlloc(zone_size);
|
||||
newnode->zone[i] = newzone;
|
||||
if (newzone != NULL)
|
||||
{
|
||||
CsrMemSet(newzone, 0, zone_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n",
|
||||
i, zonedef_table[i].length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up if any zone alloc failed */
|
||||
if (newzone == NULL)
|
||||
{
|
||||
for (i = 0; newnode->zone[i] != NULL; i++)
|
||||
{
|
||||
CsrMemFree(newnode->zone[i]);
|
||||
newnode->zone[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Link to previous node */
|
||||
newnode->prev = prevnode;
|
||||
if (prevnode)
|
||||
{
|
||||
prevnode->next = newnode;
|
||||
}
|
||||
newnode->next = NULL;
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
|
||||
#endif /* UNIFI_DISABLE_COREDUMP */
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_init
|
||||
*
|
||||
* Allocates buffers for the automatic SDIO core dump
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
* num_dump_buffers Number of buffers to reserve for coredumps
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, or:
|
||||
* CSR_WIFI_HIP_RESULT_NO_MEMORY memory allocation failed
|
||||
*
|
||||
* Notes:
|
||||
* Allocates space in advance, to be used for the last n coredump buffers
|
||||
* the intention being that the size is sufficient for at least one dump,
|
||||
* probably several.
|
||||
* It's probably advisable to have at least 2 coredump buffers to allow
|
||||
* one to be enquired with the unifi_coredump tool, while leaving another
|
||||
* free for capturing.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers)
|
||||
{
|
||||
#ifndef UNIFI_DISABLE_COREDUMP
|
||||
void *ospriv = card->ospriv;
|
||||
coredump_buffer *prev = NULL;
|
||||
coredump_buffer *newnode = NULL;
|
||||
CsrUint32 i = 0;
|
||||
#endif
|
||||
|
||||
func_enter();
|
||||
|
||||
card->request_coredump_on_reset = 0;
|
||||
card->dump_next_write = NULL;
|
||||
card->dump_cur_read = NULL;
|
||||
card->dump_buf = NULL;
|
||||
|
||||
#ifndef UNIFI_DISABLE_COREDUMP
|
||||
unifi_trace(ospriv, UDBG1,
|
||||
"Allocate buffers for %d core dumps\n", num_dump_buffers);
|
||||
if (num_dump_buffers == 0)
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Root node */
|
||||
card->dump_buf = new_coredump_node(ospriv, NULL);
|
||||
if (card->dump_buf == NULL)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
prev = card->dump_buf;
|
||||
newnode = card->dump_buf;
|
||||
|
||||
/* Add each subsequent node at tail */
|
||||
for (i = 1; i < num_dump_buffers; i++)
|
||||
{
|
||||
newnode = new_coredump_node(ospriv, prev);
|
||||
if (newnode == NULL)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
prev = newnode;
|
||||
}
|
||||
|
||||
/* Link the first and last nodes to make the list circular */
|
||||
card->dump_buf->prev = newnode;
|
||||
newnode->next = card->dump_buf;
|
||||
|
||||
/* Set initial r/w access pointers */
|
||||
card->dump_next_write = card->dump_buf;
|
||||
card->dump_cur_read = NULL;
|
||||
|
||||
unifi_trace(ospriv, UDBG2, "Core dump configured (%d dumps max)\n", i);
|
||||
|
||||
done:
|
||||
#endif
|
||||
func_exit();
|
||||
return CSR_RESULT_SUCCESS;
|
||||
|
||||
#ifndef UNIFI_DISABLE_COREDUMP
|
||||
fail:
|
||||
/* Unwind what we allocated so far */
|
||||
unifi_error(ospriv, "Out of memory allocating core dump node %d\n", i);
|
||||
unifi_coredump_free(card);
|
||||
func_exit();
|
||||
return CSR_WIFI_HIP_RESULT_NO_MEMORY;
|
||||
#endif
|
||||
} /* unifi_coreump_init() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_coredump_free
|
||||
*
|
||||
* Free all memory dynamically allocated for core dump
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card struct
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void unifi_coredump_free(card_t *card)
|
||||
{
|
||||
void *ospriv = card->ospriv;
|
||||
coredump_buffer *node, *del_node;
|
||||
CsrInt16 i = 0;
|
||||
CsrInt16 j;
|
||||
|
||||
func_enter();
|
||||
unifi_trace(ospriv, UDBG2, "Core dump de-configured\n");
|
||||
|
||||
if (card->dump_buf == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
node = card->dump_buf;
|
||||
do
|
||||
{
|
||||
/* Free payload zones */
|
||||
for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++)
|
||||
{
|
||||
if (node->zone[j] != NULL)
|
||||
{
|
||||
CsrMemFree(node->zone[j]);
|
||||
node->zone[j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Detach */
|
||||
del_node = node;
|
||||
node = node->next;
|
||||
|
||||
/* Free header */
|
||||
CsrMemFree(del_node);
|
||||
i++;
|
||||
} while ((node != NULL) && (node != card->dump_buf));
|
||||
|
||||
unifi_trace(ospriv, UDBG3, "Freed %d coredump buffers\n", i);
|
||||
|
||||
card->dump_buf = NULL;
|
||||
card->dump_next_write = NULL;
|
||||
card->dump_cur_read = NULL;
|
||||
|
||||
func_exit();
|
||||
} /* unifi_coredump_free() */
|
||||
|
||||
|
4804
drivers/staging/csr/csr_wifi_hip_packing.c
Normal file
4804
drivers/staging/csr/csr_wifi_hip_packing.c
Normal file
File diff suppressed because it is too large
Load diff
422
drivers/staging/csr/csr_wifi_hip_send.c
Normal file
422
drivers/staging/csr/csr_wifi_hip_send.c
Normal file
|
@ -0,0 +1,422 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ***************************************************************************
|
||||
*
|
||||
* FILE: csr_wifi_hip_send.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* Code for adding a signal request to the from-host queue.
|
||||
* When the driver bottom-half is run, it will take requests from the
|
||||
* queue and pass them to the UniFi.
|
||||
*
|
||||
* ***************************************************************************
|
||||
*/
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_conversions.h"
|
||||
#include "csr_wifi_hip_sigs.h"
|
||||
#include "csr_wifi_hip_card.h"
|
||||
|
||||
unifi_TrafficQueue unifi_frame_priority_to_queue(CSR_PRIORITY priority)
|
||||
{
|
||||
switch (priority)
|
||||
{
|
||||
case CSR_QOS_UP0:
|
||||
case CSR_QOS_UP3:
|
||||
return UNIFI_TRAFFIC_Q_BE;
|
||||
case CSR_QOS_UP1:
|
||||
case CSR_QOS_UP2:
|
||||
return UNIFI_TRAFFIC_Q_BK;
|
||||
case CSR_QOS_UP4:
|
||||
case CSR_QOS_UP5:
|
||||
return UNIFI_TRAFFIC_Q_VI;
|
||||
case CSR_QOS_UP6:
|
||||
case CSR_QOS_UP7:
|
||||
case CSR_MANAGEMENT:
|
||||
return UNIFI_TRAFFIC_Q_VO;
|
||||
default:
|
||||
return UNIFI_TRAFFIC_Q_BE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue)
|
||||
{
|
||||
switch (queue)
|
||||
{
|
||||
case UNIFI_TRAFFIC_Q_BE:
|
||||
return CSR_QOS_UP0;
|
||||
case UNIFI_TRAFFIC_Q_BK:
|
||||
return CSR_QOS_UP1;
|
||||
case UNIFI_TRAFFIC_Q_VI:
|
||||
return CSR_QOS_UP5;
|
||||
case UNIFI_TRAFFIC_Q_VO:
|
||||
return CSR_QOS_UP6;
|
||||
default:
|
||||
return CSR_QOS_UP0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* send_signal
|
||||
*
|
||||
* This function queues a signal for sending to UniFi. It first checks
|
||||
* that there is space on the fh_signal_queue for another entry, then
|
||||
* claims any bulk data slots required and copies data into them. Then
|
||||
* increments the fh_signal_queue write count.
|
||||
*
|
||||
* The fh_signal_queue is later processed by the driver bottom half
|
||||
* (in unifi_bh()).
|
||||
*
|
||||
* This function call unifi_pause_xmit() to pause the flow of data plane
|
||||
* packets when:
|
||||
* - the fh_signal_queue ring buffer is full
|
||||
* - there are less than UNIFI_MAX_DATA_REFERENCES (2) bulk data
|
||||
* slots available.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card context structure
|
||||
* sigptr Pointer to the signal to write to UniFi.
|
||||
* siglen Number of bytes pointer to by sigptr.
|
||||
* bulkdata Array of pointers to an associated bulk data.
|
||||
* sigq To which from-host queue to add the signal.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success
|
||||
* CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or
|
||||
* no free signal queue entry
|
||||
*
|
||||
* Notes:
|
||||
* Calls unifi_pause_xmit() when the last slots are used.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static CsrResult send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen,
|
||||
const bulk_data_param_t *bulkdata,
|
||||
q_t *sigq, CsrUint32 priority_q, CsrUint32 run_bh)
|
||||
{
|
||||
CsrUint16 i, data_slot_size;
|
||||
card_signal_t *csptr;
|
||||
CsrInt16 qe;
|
||||
CsrResult r;
|
||||
CsrInt16 debug_print = 0;
|
||||
|
||||
data_slot_size = CardGetDataSlotSize(card);
|
||||
|
||||
/* Check that the fh_data_queue has a free slot */
|
||||
if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sigq))
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG3, "send_signal: %s full\n", sigq->name);
|
||||
|
||||
return CSR_WIFI_HIP_RESULT_NO_SPACE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now add the signal to the From Host signal queue
|
||||
*/
|
||||
/* Get next slot on queue */
|
||||
qe = CSR_WIFI_HIP_Q_NEXT_W_SLOT(sigq);
|
||||
csptr = CSR_WIFI_HIP_Q_SLOT_DATA(sigq, qe);
|
||||
|
||||
/* Make up the card_signal struct */
|
||||
csptr->signal_length = (CsrUint16)siglen;
|
||||
CsrMemCpy((void *)csptr->sigbuf, (void *)sigptr, siglen);
|
||||
|
||||
for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i)
|
||||
{
|
||||
if ((bulkdata != NULL) && (bulkdata->d[i].data_length != 0))
|
||||
{
|
||||
CsrUint32 datalen = bulkdata->d[i].data_length;
|
||||
|
||||
/* Make sure data will fit in a bulk data slot */
|
||||
if (bulkdata->d[i].os_data_ptr == NULL)
|
||||
{
|
||||
unifi_error(card->ospriv, "send_signal - NULL bulkdata[%d]\n", i);
|
||||
debug_print++;
|
||||
csptr->bulkdata[i].data_length = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (datalen > data_slot_size)
|
||||
{
|
||||
unifi_error(card->ospriv,
|
||||
"send_signal - Invalid data length %u (@%p), "
|
||||
"truncating\n",
|
||||
datalen, bulkdata->d[i].os_data_ptr);
|
||||
datalen = data_slot_size;
|
||||
debug_print++;
|
||||
}
|
||||
/* Store the bulk data info in the soft queue. */
|
||||
csptr->bulkdata[i].os_data_ptr = (CsrUint8 *)bulkdata->d[i].os_data_ptr;
|
||||
csptr->bulkdata[i].os_net_buf_ptr = (CsrUint8 *)bulkdata->d[i].os_net_buf_ptr;
|
||||
csptr->bulkdata[i].net_buf_length = bulkdata->d[i].net_buf_length;
|
||||
csptr->bulkdata[i].data_length = datalen;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIFI_INIT_BULK_DATA(&csptr->bulkdata[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (debug_print)
|
||||
{
|
||||
const CsrUint8 *sig = sigptr;
|
||||
|
||||
unifi_error(card->ospriv, "Signal(%d): %02x %02x %02x %02x %02x %02x %02x %02x"
|
||||
" %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
siglen,
|
||||
sig[0], sig[1], sig[2], sig[3],
|
||||
sig[4], sig[5], sig[6], sig[7],
|
||||
sig[8], sig[9], sig[10], sig[11],
|
||||
sig[12], sig[13], sig[14], sig[15]);
|
||||
unifi_error(card->ospriv, "Bulkdata pointer %p(%d), %p(%d)\n",
|
||||
bulkdata != NULL?bulkdata->d[0].os_data_ptr : NULL,
|
||||
bulkdata != NULL?bulkdata->d[0].data_length : 0,
|
||||
bulkdata != NULL?bulkdata->d[1].os_data_ptr : NULL,
|
||||
bulkdata != NULL?bulkdata->d[1].data_length : 0);
|
||||
}
|
||||
|
||||
/* Advance the written count to say there is a new entry */
|
||||
CSR_WIFI_HIP_Q_INC_W(sigq);
|
||||
|
||||
/*
|
||||
* Set the flag to say reason for waking was a host request.
|
||||
* Then ask the OS layer to run the unifi_bh.
|
||||
*/
|
||||
if (run_bh == 1)
|
||||
{
|
||||
card->bh_reason_host = 1;
|
||||
r = unifi_run_bh(card->ospriv);
|
||||
if (r != CSR_RESULT_SUCCESS)
|
||||
{
|
||||
unifi_error(card->ospriv, "failed to run bh.\n");
|
||||
card->bh_reason_host = 0;
|
||||
|
||||
/*
|
||||
* The bulk data buffer will be freed by the caller.
|
||||
* We need to invalidate the description of the bulk data in our
|
||||
* soft queue, to prevent the core freeing the bulk data again later.
|
||||
*/
|
||||
for (i = 0; i < UNIFI_MAX_DATA_REFERENCES; ++i)
|
||||
{
|
||||
if (csptr->bulkdata[i].data_length != 0)
|
||||
{
|
||||
csptr->bulkdata[i].os_data_ptr = csptr->bulkdata[i].os_net_buf_ptr = NULL;
|
||||
csptr->bulkdata[i].net_buf_length = csptr->bulkdata[i].data_length = 0;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unifi_error(card->ospriv, "run_bh=%d, bh not called.\n", run_bh);
|
||||
}
|
||||
|
||||
/*
|
||||
* Have we used up all the fh signal list entries?
|
||||
*/
|
||||
if (CSR_WIFI_HIP_Q_SLOTS_FREE(sigq) == 0)
|
||||
{
|
||||
/* We have filled the queue, so stop the upper layer. The command queue
|
||||
* is an exception, as suspending due to that being full could delay
|
||||
* resume/retry until new commands or data are received.
|
||||
*/
|
||||
if (sigq != &card->fh_command_queue)
|
||||
{
|
||||
/*
|
||||
* Must call unifi_pause_xmit() *before* setting the paused flag.
|
||||
* (the unifi_pause_xmit call should not be after setting the flag because of the possibility of being interrupted
|
||||
* by the bh thread between our setting the flag and the call to unifi_pause_xmit()
|
||||
* If bh thread then cleared the flag, we would end up paused, but without the flag set)
|
||||
* Instead, setting it afterwards means that if this thread is interrupted by the bh thread
|
||||
* the pause flag is still guaranteed to end up set
|
||||
* However the potential deadlock now is that if bh thread emptied the queue and cleared the flag before this thread's
|
||||
* call to unifi_pause_xmit(), then bh thread may not run again because it will be waiting for
|
||||
* a packet to appear in the queue but nothing ever will because xmit is paused.
|
||||
* So we will end up with the queue paused, and the flag set to say it is paused, but bh never runs to unpause it.
|
||||
* (Note even this bad situation would not persist long in practice, because something else (eg rx, or tx in different queue)
|
||||
* is likely to wake bh thread quite soon)
|
||||
* But to avoid this deadlock completely, after setting the flag we check that there is something left in the queue.
|
||||
* If there is, we know that bh thread has not emptied the queue yet.
|
||||
* Since bh thread checks to unpause the queue *after* taking packets from the queue, we know that it is still going to make at
|
||||
* least one more check to see whether it needs to unpause the queue. So all is well.
|
||||
* If there are no packets in the queue, then the deadlock described above might happen. To make sure it does not, we
|
||||
* unpause the queue here. A possible side effect is that unifi_restart_xmit() may (rarely) be called for second time
|
||||
* unnecessarily, which is harmless
|
||||
*/
|
||||
|
||||
#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
|
||||
unifi_debug_log_to_buf("P");
|
||||
#endif
|
||||
unifi_pause_xmit(card->ospriv, (unifi_TrafficQueue)priority_q);
|
||||
card_tx_q_pause(card, priority_q);
|
||||
if (CSR_WIFI_HIP_Q_SLOTS_USED(sigq) == 0)
|
||||
{
|
||||
card_tx_q_unpause(card, priority_q);
|
||||
unifi_restart_xmit(card->ospriv, (unifi_TrafficQueue) priority_q);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unifi_warning(card->ospriv,
|
||||
"send_signal: fh_cmd_q full, not pausing (run_bh=%d)\n",
|
||||
run_bh);
|
||||
}
|
||||
}
|
||||
|
||||
func_exit();
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
} /* send_signal() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_send_signal
|
||||
*
|
||||
* Invokes send_signal() to queue a signal in the command or traffic queue
|
||||
* If sigptr pointer is NULL, it pokes the bh to check if UniFi is responsive.
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card context struct
|
||||
* sigptr Pointer to signal from card.
|
||||
* siglen Size of the signal
|
||||
* bulkdata Pointer to the bulk data of the signal
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success
|
||||
* CSR_WIFI_HIP_RESULT_NO_SPACE if there were insufficient data slots or no free signal queue entry
|
||||
*
|
||||
* Notes:
|
||||
* unifi_send_signal() is used to queue signals, created by the driver,
|
||||
* to the device. Signals are constructed using the UniFi packed structures.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr, CsrUint32 siglen,
|
||||
const bulk_data_param_t *bulkdata)
|
||||
{
|
||||
q_t *sig_soft_q;
|
||||
CsrUint16 signal_id;
|
||||
CsrResult r;
|
||||
CsrUint32 run_bh;
|
||||
CsrUint32 priority_q;
|
||||
|
||||
/* A NULL signal pointer is a request to check if UniFi is responsive */
|
||||
if (sigptr == NULL)
|
||||
{
|
||||
card->bh_reason_host = 1;
|
||||
return unifi_run_bh(card->ospriv);
|
||||
}
|
||||
|
||||
priority_q = 0;
|
||||
run_bh = 1;
|
||||
signal_id = GET_SIGNAL_ID(sigptr);
|
||||
/*
|
||||
* If the signal is a CSR_MA_PACKET_REQUEST ,
|
||||
* we send it using the traffic soft queue. Else we use the command soft queue.
|
||||
*/
|
||||
if (signal_id == CSR_MA_PACKET_REQUEST_ID)
|
||||
{
|
||||
CsrUint16 frame_priority;
|
||||
|
||||
if (card->periodic_wake_mode == UNIFI_PERIODIC_WAKE_HOST_ENABLED)
|
||||
{
|
||||
run_bh = 0;
|
||||
}
|
||||
|
||||
#if defined (CSR_WIFI_HIP_DEBUG_OFFLINE) && defined (CSR_WIFI_HIP_DATA_PLANE_PROFILE)
|
||||
unifi_debug_log_to_buf("D");
|
||||
#endif
|
||||
/* Sanity check: MA-PACKET.req must have a valid bulk data */
|
||||
if ((bulkdata->d[0].data_length == 0) || (bulkdata->d[0].os_data_ptr == NULL))
|
||||
{
|
||||
unifi_error(card->ospriv, "MA-PACKET.req with empty bulk data (%d bytes in %p)\n",
|
||||
bulkdata->d[0].data_length, bulkdata->d[0].os_data_ptr);
|
||||
dump((void *)sigptr, siglen);
|
||||
return CSR_RESULT_FAILURE;
|
||||
}
|
||||
|
||||
/* Map the frame priority to a traffic queue index. */
|
||||
frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr);
|
||||
priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority);
|
||||
|
||||
sig_soft_q = &card->fh_traffic_queue[priority_q];
|
||||
}
|
||||
else
|
||||
{
|
||||
sig_soft_q = &card->fh_command_queue;
|
||||
}
|
||||
|
||||
r = send_signal(card, sigptr, siglen, bulkdata, sig_soft_q, priority_q, run_bh);
|
||||
/* On error, the caller must free or requeue bulkdata buffers */
|
||||
|
||||
return r;
|
||||
} /* unifi_send_signal() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_send_resources_available
|
||||
*
|
||||
* Examines whether there is available space to queue
|
||||
* a signal in the command or traffic queue
|
||||
*
|
||||
* Arguments:
|
||||
* card Pointer to card context struct
|
||||
* sigptr Pointer to signal.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS if resources available
|
||||
* CSR_WIFI_HIP_RESULT_NO_SPACE if there was no free signal queue entry
|
||||
*
|
||||
* Notes:
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr)
|
||||
{
|
||||
q_t *sig_soft_q;
|
||||
CsrUint16 signal_id = GET_SIGNAL_ID(sigptr);
|
||||
|
||||
/*
|
||||
* If the signal is a CSR_MA_PACKET_REQUEST ,
|
||||
* we send it using the traffic soft queue. Else we use the command soft queue.
|
||||
*/
|
||||
if (signal_id == CSR_MA_PACKET_REQUEST_ID)
|
||||
{
|
||||
CsrUint16 frame_priority;
|
||||
CsrUint32 priority_q;
|
||||
|
||||
/* Map the frame priority to a traffic queue index. */
|
||||
frame_priority = GET_PACKED_MA_PACKET_REQUEST_FRAME_PRIORITY(sigptr);
|
||||
priority_q = unifi_frame_priority_to_queue((CSR_PRIORITY)frame_priority);
|
||||
|
||||
sig_soft_q = &card->fh_traffic_queue[priority_q];
|
||||
}
|
||||
else
|
||||
{
|
||||
sig_soft_q = &card->fh_command_queue;
|
||||
}
|
||||
|
||||
/* Check that the fh_data_queue has a free slot */
|
||||
if (!CSR_WIFI_HIP_Q_SLOTS_FREE(sig_soft_q))
|
||||
{
|
||||
unifi_notice(card->ospriv, "unifi_send_resources_available: %s full\n",
|
||||
sig_soft_q->name);
|
||||
return CSR_WIFI_HIP_RESULT_NO_SPACE;
|
||||
}
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
} /* unifi_send_resources_available() */
|
||||
|
||||
|
1313
drivers/staging/csr/csr_wifi_hip_signals.c
Normal file
1313
drivers/staging/csr/csr_wifi_hip_signals.c
Normal file
File diff suppressed because it is too large
Load diff
137
drivers/staging/csr/csr_wifi_hip_signals.h
Normal file
137
drivers/staging/csr/csr_wifi_hip_signals.h
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
*
|
||||
* FILE: csr_wifi_hip_signals.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* Header file wrapping the auto-generated code in csr_wifi_hip_sigs.h
|
||||
* and csr_wifi_hip_signals.c -
|
||||
* csr_wifi_hip_sigs.h provides structures defining UniFi signals and
|
||||
* csr_wifi_hip_signals.c provides SigGetSize() and SigGetDataRefs().
|
||||
*
|
||||
*****************************************************************************
|
||||
*/
|
||||
#ifndef __CSR_WIFI_HIP_SIGNALS_H__
|
||||
#define __CSR_WIFI_HIP_SIGNALS_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_wifi_hip_sigs.h"
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/* INFORMATION ELEMENTS */
|
||||
/****************************************************************************/
|
||||
|
||||
/* Information Element ID's - shouldn't be in here, but nowhere better yet */
|
||||
#define IE_SSID_ID 0
|
||||
#define IE_SUPPORTED_RATES_ID 1
|
||||
#define IE_FH_PARAM_SET_ID 2
|
||||
#define IE_DS_PARAM_SET_ID 3
|
||||
#define IE_CF_PARAM_SET_ID 4
|
||||
#define IE_TIM_ID 5
|
||||
#define IE_IBSS_PARAM_SET_ID 6
|
||||
#define IE_COUNTRY_ID 7
|
||||
#define IE_HOPPING_PATTERN_PARAMS_ID 8
|
||||
#define IE_HOPPING_PATTERN_TABLE_ID 9
|
||||
#define IE_REQUEST_ID 10
|
||||
#define IE_QBSS_LOAD_ID 11
|
||||
#define IE_EDCA_PARAM_SET_ID 12
|
||||
#define IE_TRAFFIC_SPEC_ID 13
|
||||
#define IE_TRAFFIC_CLASS_ID 14
|
||||
#define IE_SCHEDULE_ID 15
|
||||
#define IE_CHALLENGE_TEXT_ID 16
|
||||
#define IE_POWER_CONSTRAINT_ID 32
|
||||
#define IE_POWER_CAPABILITY_ID 33
|
||||
#define IE_TPC_REQUEST_ID 34
|
||||
#define IE_TPC_REPORT_ID 35
|
||||
#define IE_SUPPORTED_CHANNELS_ID 36
|
||||
#define IE_CHANNEL_SWITCH_ANNOUNCE_ID 37
|
||||
#define IE_MEASUREMENT_REQUEST_ID 38
|
||||
#define IE_MEASUREMENT_REPORT_ID 39
|
||||
#define IE_QUIET_ID 40
|
||||
#define IE_IBSS_DFS_ID 41
|
||||
#define IE_ERP_INFO_ID 42
|
||||
#define IE_TS_DELAY_ID 43
|
||||
#define IE_TCLAS_PROCESSING_ID 44
|
||||
#define IE_QOS_CAPABILITY_ID 46
|
||||
#define IE_RSN_ID 48
|
||||
#define IE_EXTENDED_SUPPORTED_RATES_ID 50
|
||||
#define IE_AP_CHANNEL_REPORT_ID 52
|
||||
#define IE_RCPI_ID 53
|
||||
#define IE_WPA_ID 221
|
||||
|
||||
|
||||
/* The maximum number of data references in a signal structure */
|
||||
#define UNIFI_MAX_DATA_REFERENCES 2
|
||||
|
||||
/* The space to allow for a wire-format signal structure */
|
||||
#define UNIFI_PACKED_SIGBUF_SIZE 64
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* SIGNAL PARAMETER VALUES */
|
||||
/******************************************************************************/
|
||||
|
||||
/* ifIndex */
|
||||
#define UNIFI_IF_2G4 1
|
||||
#define UNIFI_IF_5G 2
|
||||
|
||||
/* SendProcessId */
|
||||
#define HOST_PROC_ID 0xc000
|
||||
|
||||
#define SIG_CAP_ESS 0x0001
|
||||
#define SIG_CAP_IBSS 0x0002
|
||||
#define SIG_CAP_CF_POLLABLE 0x0004
|
||||
#define SIG_CAP_CF_POLL_REQUEST 0x0008
|
||||
#define SIG_CAP_PRIVACY 0x0010
|
||||
#define SIG_CAP_SHORT_PREAMBLE 0x0020
|
||||
#define SIG_CAP_DSSSOFDM 0x2000
|
||||
|
||||
/******************************************************************************/
|
||||
/* FUNCTION DECLARATIONS */
|
||||
/******************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/******************************************************************************
|
||||
* SigGetNumDataRefs - Retrieve pointers to data-refs from a signal.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* aSignal - Pointer to signal to retrieve the data refs of.
|
||||
* aDataRef - Address of a pointer to the structure that the data refs
|
||||
* pointers will be stored.
|
||||
*
|
||||
* RETURNS:
|
||||
* The number of data-refs in the signal.
|
||||
*/
|
||||
CsrInt32 SigGetDataRefs(CSR_SIGNAL *aSignal, CSR_DATAREF **aDataRef);
|
||||
|
||||
/******************************************************************************
|
||||
* SigGetSize - Retrieve the size (in bytes) of a given signal.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* aSignal - Pointer to signal to retrieve size of.
|
||||
*
|
||||
* RETURNS:
|
||||
* The size (in bytes) of the given signal.
|
||||
*/
|
||||
CsrInt32 SigGetSize(const CSR_SIGNAL *aSignal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __CSR_WIFI_HIP_SIGNALS_H__ */
|
1425
drivers/staging/csr/csr_wifi_hip_sigs.h
Normal file
1425
drivers/staging/csr/csr_wifi_hip_sigs.h
Normal file
File diff suppressed because it is too large
Load diff
535
drivers/staging/csr/csr_wifi_hip_ta_sampling.c
Normal file
535
drivers/staging/csr/csr_wifi_hip_ta_sampling.c
Normal file
|
@ -0,0 +1,535 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_ta_sampling.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* The traffic analysis sampling module.
|
||||
* This gathers data which is sent to the SME and used to analyse
|
||||
* the traffic behaviour.
|
||||
*
|
||||
* Provides:
|
||||
* unifi_ta_sampling_init - Initialise the internal state
|
||||
* unifi_ta_sample - Sampling function, call this for every data packet
|
||||
*
|
||||
* Calls these external functions which must be provided:
|
||||
* unifi_ta_indicate_sampling - Pass sample data to the SME.
|
||||
* unifi_ta_indicate_protocol - Report certain data packet types to the SME.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "csr_wifi_hip_card_sdio.h"
|
||||
|
||||
/* Maximum number of Tx frames we store each CYCLE_1, for detecting period */
|
||||
#define TA_MAX_INTERVALS_IN_C1 100
|
||||
|
||||
/* Number of intervals in CYCLE_1 (one second), for detecting periodic */
|
||||
/* Must match size of unifi_TrafficStats.intervals - 1 */
|
||||
#define TA_INTERVALS_NUM 10
|
||||
|
||||
/* Step (in msecs) between intervals, for detecting periodic */
|
||||
/* We are only interested in periods up to 100ms, i.e. between beacons */
|
||||
/* This is correct for TA_INTERVALS_NUM=10 */
|
||||
#define TA_INTERVALS_STEP 10
|
||||
|
||||
|
||||
enum ta_frame_identity
|
||||
{
|
||||
TA_FRAME_UNKNOWN,
|
||||
TA_FRAME_ETHERNET_UNINTERESTING,
|
||||
TA_FRAME_ETHERNET_INTERESTING
|
||||
};
|
||||
|
||||
|
||||
#define TA_ETHERNET_TYPE_OFFSET 6
|
||||
#define TA_LLC_HEADER_SIZE 8
|
||||
#define TA_IP_TYPE_OFFSET 17
|
||||
#define TA_UDP_SOURCE_PORT_OFFSET 28
|
||||
#define TA_UDP_DEST_PORT_OFFSET (TA_UDP_SOURCE_PORT_OFFSET + 2)
|
||||
#define TA_BOOTP_CLIENT_MAC_ADDR_OFFSET 64
|
||||
#define TA_DHCP_MESSAGE_TYPE_OFFSET 278
|
||||
#define TA_DHCP_MESSAGE_TYPE_ACK 0x05
|
||||
#define TA_PROTO_TYPE_IP 0x0800
|
||||
#define TA_PROTO_TYPE_EAP 0x888E
|
||||
#define TA_PROTO_TYPE_WAI 0x8864
|
||||
#define TA_PROTO_TYPE_ARP 0x0806
|
||||
#define TA_IP_TYPE_TCP 0x06
|
||||
#define TA_IP_TYPE_UDP 0x11
|
||||
#define TA_UDP_PORT_BOOTPC 0x0044
|
||||
#define TA_UDP_PORT_BOOTPS 0x0043
|
||||
#define TA_EAPOL_TYPE_OFFSET 9
|
||||
#define TA_EAPOL_TYPE_START 0x01
|
||||
|
||||
static const CsrUint8 snap_802_2[3] = { 0xAA, 0xAA, 0x03 };
|
||||
static const CsrUint8 oui_rfc1042[3] = { 0x00, 0x00, 0x00 };
|
||||
static const CsrUint8 oui_8021h[3] = { 0x00, 0x00, 0xf8 };
|
||||
static const CsrUint8 aironet_snap[5] = { 0x00, 0x40, 0x96, 0x00, 0x00 };
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* ta_detect_protocol
|
||||
*
|
||||
* Internal only.
|
||||
* Detects a specific protocol in a frame and indicates a TA event.
|
||||
*
|
||||
* Arguments:
|
||||
* ta The pointer to the TA module.
|
||||
* direction The direction of the frame (tx or rx).
|
||||
* data Pointer to the structure that contains the data.
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
static enum ta_frame_identity ta_detect_protocol(card_t *card, CsrWifiRouterCtrlProtocolDirection direction,
|
||||
const bulk_data_desc_t *data,
|
||||
const CsrUint8 *saddr,
|
||||
const CsrUint8 *sta_macaddr)
|
||||
{
|
||||
ta_data_t *tad = &card->ta_sampling;
|
||||
CsrUint16 proto;
|
||||
CsrUint16 source_port, dest_port;
|
||||
CsrWifiMacAddress srcAddress;
|
||||
|
||||
if (data->data_length < TA_LLC_HEADER_SIZE)
|
||||
{
|
||||
return TA_FRAME_UNKNOWN;
|
||||
}
|
||||
|
||||
if (CsrMemCmp(data->os_data_ptr, snap_802_2, 3))
|
||||
{
|
||||
return TA_FRAME_UNKNOWN;
|
||||
}
|
||||
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
|
||||
{
|
||||
/*
|
||||
* Here we would use the custom filter to detect interesting frames.
|
||||
*/
|
||||
}
|
||||
|
||||
if (!CsrMemCmp(data->os_data_ptr + 3, oui_rfc1042, 3) ||
|
||||
!CsrMemCmp(data->os_data_ptr + 3, oui_8021h, 3))
|
||||
{
|
||||
proto = (data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET] * 256) +
|
||||
data->os_data_ptr[TA_ETHERNET_TYPE_OFFSET + 1];
|
||||
|
||||
/* The only interesting IP frames are the DHCP */
|
||||
if (proto == TA_PROTO_TYPE_IP)
|
||||
{
|
||||
if (data->data_length > TA_IP_TYPE_OFFSET)
|
||||
{
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
|
||||
{
|
||||
ta_l4stats_t *ta_l4stats = &tad->ta_l4stats;
|
||||
CsrUint8 l4proto = data->os_data_ptr[TA_IP_TYPE_OFFSET];
|
||||
|
||||
if (l4proto == TA_IP_TYPE_TCP)
|
||||
{
|
||||
if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
|
||||
{
|
||||
ta_l4stats->txTcpBytesCount += data->data_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
ta_l4stats->rxTcpBytesCount += data->data_length;
|
||||
}
|
||||
}
|
||||
else if (l4proto == TA_IP_TYPE_UDP)
|
||||
{
|
||||
if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
|
||||
{
|
||||
ta_l4stats->txUdpBytesCount += data->data_length;
|
||||
}
|
||||
else
|
||||
{
|
||||
ta_l4stats->rxUdpBytesCount += data->data_length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* detect DHCP frames */
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP)
|
||||
{
|
||||
/* DHCP frames are UDP frames with BOOTP ports */
|
||||
if (data->os_data_ptr[TA_IP_TYPE_OFFSET] == TA_IP_TYPE_UDP)
|
||||
{
|
||||
if (data->data_length > TA_UDP_DEST_PORT_OFFSET)
|
||||
{
|
||||
source_port = (data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET] * 256) +
|
||||
data->os_data_ptr[TA_UDP_SOURCE_PORT_OFFSET + 1];
|
||||
dest_port = (data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET] * 256) +
|
||||
data->os_data_ptr[TA_UDP_DEST_PORT_OFFSET + 1];
|
||||
|
||||
if (((source_port == TA_UDP_PORT_BOOTPC) && (dest_port == TA_UDP_PORT_BOOTPS)) ||
|
||||
((source_port == TA_UDP_PORT_BOOTPS) && (dest_port == TA_UDP_PORT_BOOTPC)))
|
||||
{
|
||||
/* The DHCP should have at least a message type (request, ack, nack, etc) */
|
||||
if (data->data_length > TA_DHCP_MESSAGE_TYPE_OFFSET + 6)
|
||||
{
|
||||
CsrMemCpy(srcAddress.a, saddr, 6);
|
||||
|
||||
if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX)
|
||||
{
|
||||
unifi_ta_indicate_protocol(card->ospriv,
|
||||
CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP,
|
||||
direction,
|
||||
&srcAddress);
|
||||
return TA_FRAME_ETHERNET_UNINTERESTING;
|
||||
}
|
||||
|
||||
/* DHCPACK is a special indication */
|
||||
if (!CsrMemCmp(data->os_data_ptr + TA_BOOTP_CLIENT_MAC_ADDR_OFFSET, sta_macaddr, 6))
|
||||
{
|
||||
if (data->os_data_ptr[TA_DHCP_MESSAGE_TYPE_OFFSET] == TA_DHCP_MESSAGE_TYPE_ACK)
|
||||
{
|
||||
unifi_ta_indicate_protocol(card->ospriv,
|
||||
CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP_ACK,
|
||||
direction,
|
||||
&srcAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
unifi_ta_indicate_protocol(card->ospriv,
|
||||
CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_DHCP,
|
||||
direction,
|
||||
&srcAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TA_FRAME_ETHERNET_INTERESTING;
|
||||
}
|
||||
|
||||
/* detect protocol type EAPOL or WAI (treated as equivalent here) */
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL)
|
||||
{
|
||||
if (TA_PROTO_TYPE_EAP == proto || TA_PROTO_TYPE_WAI == proto)
|
||||
{
|
||||
if ((TA_PROTO_TYPE_WAI == proto) || (direction != CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_TX) ||
|
||||
(data->os_data_ptr[TA_EAPOL_TYPE_OFFSET] == TA_EAPOL_TYPE_START))
|
||||
{
|
||||
CsrMemCpy(srcAddress.a, saddr, 6);
|
||||
unifi_ta_indicate_protocol(card->ospriv,
|
||||
CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_EAPOL,
|
||||
direction, &srcAddress);
|
||||
}
|
||||
return TA_FRAME_ETHERNET_UNINTERESTING;
|
||||
}
|
||||
}
|
||||
|
||||
/* detect protocol type 0x0806 (ARP) */
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP)
|
||||
{
|
||||
if (proto == TA_PROTO_TYPE_ARP)
|
||||
{
|
||||
CsrMemCpy(srcAddress.a, saddr, 6);
|
||||
unifi_ta_indicate_protocol(card->ospriv,
|
||||
CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_ARP,
|
||||
direction, &srcAddress);
|
||||
return TA_FRAME_ETHERNET_UNINTERESTING;
|
||||
}
|
||||
}
|
||||
|
||||
return TA_FRAME_ETHERNET_INTERESTING;
|
||||
}
|
||||
else if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET)
|
||||
{
|
||||
/* detect Aironet frames */
|
||||
if (!CsrMemCmp(data->os_data_ptr + 3, aironet_snap, 5))
|
||||
{
|
||||
CsrMemCpy(srcAddress.a, saddr, 6);
|
||||
unifi_ta_indicate_protocol(card->ospriv, CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_AIRONET,
|
||||
direction, &srcAddress);
|
||||
}
|
||||
}
|
||||
|
||||
return TA_FRAME_ETHERNET_UNINTERESTING;
|
||||
} /* ta_detect_protocol() */
|
||||
|
||||
|
||||
static void tas_reset_data(ta_data_t *tad)
|
||||
{
|
||||
CsrInt16 i;
|
||||
|
||||
for (i = 0; i < (TA_INTERVALS_NUM + 1); i++)
|
||||
{
|
||||
tad->stats.intervals[i] = 0;
|
||||
}
|
||||
|
||||
tad->stats.rxFramesNum = 0;
|
||||
tad->stats.txFramesNum = 0;
|
||||
tad->stats.rxBytesCount = 0;
|
||||
tad->stats.txBytesCount = 0;
|
||||
tad->stats.rxMeanRate = 0;
|
||||
|
||||
tad->rx_sum_rate = 0;
|
||||
|
||||
tad->ta_l4stats.rxTcpBytesCount = 0;
|
||||
tad->ta_l4stats.txTcpBytesCount = 0;
|
||||
tad->ta_l4stats.rxUdpBytesCount = 0;
|
||||
tad->ta_l4stats.txUdpBytesCount = 0;
|
||||
} /* tas_reset_data() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* API.
|
||||
* unifi_ta_sampling_init
|
||||
*
|
||||
* (Re)Initialise the Traffic Analysis sampling module.
|
||||
* Resets the counters and timestamps.
|
||||
*
|
||||
* Arguments:
|
||||
* tad Pointer to a ta_data_t structure containing the
|
||||
* context for this device instance.
|
||||
* drv_priv An opaque pointer that the TA sampling module will
|
||||
* pass in call-outs.
|
||||
*
|
||||
* Returns:
|
||||
* None.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void unifi_ta_sampling_init(card_t *card)
|
||||
{
|
||||
(void)unifi_ta_configure(card, CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET, NULL);
|
||||
|
||||
card->ta_sampling.packet_filter = CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE;
|
||||
card->ta_sampling.traffic_type = CSR_WIFI_ROUTER_CTRL_TRAFFIC_TYPE_OCCASIONAL;
|
||||
} /* unifi_ta_sampling_init() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* API.
|
||||
* unifi_ta_sample
|
||||
*
|
||||
* Sample a data frame for the TA module.
|
||||
* This function stores all the useful information it can extract from
|
||||
* the frame and detects any specific protocols.
|
||||
*
|
||||
* Arguments:
|
||||
* tad The pointer to the TA sampling context struct.
|
||||
* direction The direction of the frame (rx, tx)
|
||||
* data Pointer to the frame data
|
||||
* saddr Source MAC address of frame.
|
||||
* timestamp Time (in msecs) that the frame was received.
|
||||
* rate Reported data rate for the rx frame (0 for tx frames)
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void unifi_ta_sample(card_t *card,
|
||||
CsrWifiRouterCtrlProtocolDirection direction,
|
||||
const bulk_data_desc_t *data,
|
||||
const CsrUint8 *saddr,
|
||||
const CsrUint8 *sta_macaddr,
|
||||
CsrUint32 timestamp,
|
||||
CsrUint16 rate)
|
||||
{
|
||||
ta_data_t *tad = &card->ta_sampling;
|
||||
enum ta_frame_identity identity;
|
||||
CsrUint32 time_delta;
|
||||
|
||||
|
||||
|
||||
/* Step1: Check for specific frames */
|
||||
if (tad->packet_filter != CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_NONE)
|
||||
{
|
||||
identity = ta_detect_protocol(card, direction, data, saddr, sta_macaddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
identity = TA_FRAME_ETHERNET_INTERESTING;
|
||||
}
|
||||
|
||||
|
||||
/* Step2: Update the information in the current record */
|
||||
if (direction == CSR_WIFI_ROUTER_CTRL_PROTOCOL_DIRECTION_RX)
|
||||
{
|
||||
/* Update the Rx packet count and the throughput count */
|
||||
tad->stats.rxFramesNum++;
|
||||
tad->stats.rxBytesCount += data->data_length;
|
||||
|
||||
/* Accumulate packet Rx rates for later averaging */
|
||||
tad->rx_sum_rate += rate;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (identity == TA_FRAME_ETHERNET_INTERESTING)
|
||||
{
|
||||
/*
|
||||
* Store the period between the last and the current frame.
|
||||
* There is not point storing more than TA_MAX_INTERVALS_IN_C1 periods,
|
||||
* the traffic will be bursty or continuous.
|
||||
*/
|
||||
if (tad->stats.txFramesNum < TA_MAX_INTERVALS_IN_C1)
|
||||
{
|
||||
CsrUint32 interval;
|
||||
CsrUint32 index_in_intervals;
|
||||
|
||||
interval = timestamp - tad->tx_last_ts;
|
||||
tad->tx_last_ts = timestamp;
|
||||
index_in_intervals = (interval + TA_INTERVALS_STEP / 2 - 1) / TA_INTERVALS_STEP;
|
||||
|
||||
/* If the interval is interesting, update the t1_intervals count */
|
||||
if (index_in_intervals <= TA_INTERVALS_NUM)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG5,
|
||||
"unifi_ta_sample: TX interval=%d index=%d\n",
|
||||
interval, index_in_intervals);
|
||||
tad->stats.intervals[index_in_intervals]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the Tx packet count... */
|
||||
tad->stats.txFramesNum++;
|
||||
/* ... and the number of bytes for throughput. */
|
||||
tad->stats.txBytesCount += data->data_length;
|
||||
}
|
||||
|
||||
/*
|
||||
* If more than one second has elapsed since the last report, send
|
||||
* another one.
|
||||
*/
|
||||
/* Unsigned subtraction handles wrap-around from 0xFFFFFFFF to 0 */
|
||||
time_delta = timestamp - tad->last_indication_time;
|
||||
if (time_delta >= 1000)
|
||||
{
|
||||
/*
|
||||
* rxFramesNum can be flashed in tas_reset_data() by another thread.
|
||||
* Use a temp to avoid division by zero.
|
||||
*/
|
||||
CsrUint32 temp_rxFramesNum;
|
||||
temp_rxFramesNum = tad->stats.rxFramesNum;
|
||||
|
||||
/* Calculate this interval's mean frame Rx rate from the sum */
|
||||
if (temp_rxFramesNum)
|
||||
{
|
||||
tad->stats.rxMeanRate = tad->rx_sum_rate / temp_rxFramesNum;
|
||||
}
|
||||
unifi_trace(card->ospriv, UDBG5,
|
||||
"unifi_ta_sample: RX fr=%lu, r=%u, sum=%lu, av=%lu\n",
|
||||
tad->stats.rxFramesNum, rate,
|
||||
tad->rx_sum_rate, tad->stats.rxMeanRate);
|
||||
|
||||
/*
|
||||
* Send the information collected in the stats struct
|
||||
* to the SME and reset the counters.
|
||||
*/
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
|
||||
{
|
||||
CsrUint32 rxTcpThroughput = tad->ta_l4stats.rxTcpBytesCount / time_delta;
|
||||
CsrUint32 txTcpThroughput = tad->ta_l4stats.txTcpBytesCount / time_delta;
|
||||
CsrUint32 rxUdpThroughput = tad->ta_l4stats.rxUdpBytesCount / time_delta;
|
||||
CsrUint32 txUdpThroughput = tad->ta_l4stats.txUdpBytesCount / time_delta;
|
||||
|
||||
unifi_ta_indicate_l4stats(card->ospriv,
|
||||
rxTcpThroughput,
|
||||
txTcpThroughput,
|
||||
rxUdpThroughput,
|
||||
txUdpThroughput
|
||||
);
|
||||
}
|
||||
unifi_ta_indicate_sampling(card->ospriv, &tad->stats);
|
||||
tas_reset_data(tad);
|
||||
tad->last_indication_time = timestamp;
|
||||
}
|
||||
} /* unifi_ta_sample() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* External API.
|
||||
* unifi_ta_configure
|
||||
*
|
||||
* Configures the TA module parameters.
|
||||
*
|
||||
* Arguments:
|
||||
* ta The pointer to the TA module.
|
||||
* config_type The type of the configuration request
|
||||
* config Pointer to the configuration parameters.
|
||||
*
|
||||
* Returns:
|
||||
* CSR_RESULT_SUCCESS on success, CSR error code otherwise
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrResult unifi_ta_configure(card_t *card,
|
||||
CsrWifiRouterCtrlTrafficConfigType config_type,
|
||||
const CsrWifiRouterCtrlTrafficConfig *config)
|
||||
{
|
||||
ta_data_t *tad = &card->ta_sampling;
|
||||
|
||||
/* Reinitialise our data when we are reset */
|
||||
if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_RESET)
|
||||
{
|
||||
/* Reset the stats to zero */
|
||||
tas_reset_data(tad);
|
||||
|
||||
/* Reset the timer variables */
|
||||
tad->tx_last_ts = 0;
|
||||
tad->last_indication_time = 0;
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
if (config_type == CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_TYPE_FILTER)
|
||||
{
|
||||
tad->packet_filter = config->packetFilter;
|
||||
|
||||
if (tad->packet_filter & CSR_WIFI_ROUTER_CTRL_TRAFFIC_PACKET_TYPE_CUSTOM)
|
||||
{
|
||||
tad->custom_filter = config->customFilter;
|
||||
}
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
return CSR_RESULT_SUCCESS;
|
||||
} /* unifi_ta_configure() */
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* External API.
|
||||
* unifi_ta_classification
|
||||
*
|
||||
* Configures the current TA classification.
|
||||
*
|
||||
* Arguments:
|
||||
* ta The pointer to the TA module.
|
||||
* traffic_type The classification type
|
||||
* period The traffic period if the type is periodic
|
||||
*
|
||||
* Returns:
|
||||
* None
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void unifi_ta_classification(card_t *card,
|
||||
CsrWifiRouterCtrlTrafficType traffic_type,
|
||||
CsrUint16 period)
|
||||
{
|
||||
unifi_trace(card->ospriv, UDBG3,
|
||||
"Changed current ta classification to: %d\n", traffic_type);
|
||||
|
||||
card->ta_sampling.traffic_type = traffic_type;
|
||||
}
|
||||
|
||||
|
75
drivers/staging/csr/csr_wifi_hip_ta_sampling.h
Normal file
75
drivers/staging/csr/csr_wifi_hip_ta_sampling.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_ta_sampling.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* This file contains Traffic Analysis definitions common to the
|
||||
* sampling and analysis modules.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __TA_SAMPLING_H__
|
||||
#define __TA_SAMPLING_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
|
||||
typedef struct ta_l4stats
|
||||
{
|
||||
CsrUint32 rxTcpBytesCount;
|
||||
CsrUint32 txTcpBytesCount;
|
||||
CsrUint32 rxUdpBytesCount;
|
||||
CsrUint32 txUdpBytesCount;
|
||||
} ta_l4stats_t;
|
||||
|
||||
/*
|
||||
* Context structure to preserve state between calls.
|
||||
*/
|
||||
|
||||
typedef struct ta_data
|
||||
{
|
||||
/* Current packet filter configuration */
|
||||
CsrUint16 packet_filter;
|
||||
|
||||
/* Current packet custom filter configuration */
|
||||
CsrWifiRouterCtrlTrafficFilter custom_filter;
|
||||
|
||||
/* The timestamp of the last tx packet processed. */
|
||||
CsrUint32 tx_last_ts;
|
||||
|
||||
/* The timestamp of the last packet processed. */
|
||||
CsrUint32 last_indication_time;
|
||||
|
||||
/* Statistics */
|
||||
CsrWifiRouterCtrlTrafficStats stats;
|
||||
|
||||
/* Current traffic classification */
|
||||
CsrWifiRouterCtrlTrafficType traffic_type;
|
||||
|
||||
/* Sum of packet rx rates for this interval used to calculate mean */
|
||||
CsrUint32 rx_sum_rate;
|
||||
ta_l4stats_t ta_l4stats;
|
||||
} ta_data_t;
|
||||
|
||||
|
||||
void unifi_ta_sampling_init(card_t *card);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TA_SAMPLING_H__ */
|
268
drivers/staging/csr/csr_wifi_hip_udi.c
Normal file
268
drivers/staging/csr/csr_wifi_hip_udi.c
Normal file
|
@ -0,0 +1,268 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_card_udi.c
|
||||
*
|
||||
* PURPOSE:
|
||||
* Maintain a list of callbacks to log UniFi exchanges to one or more
|
||||
* debug/monitoring client applications.
|
||||
*
|
||||
* NOTES:
|
||||
* Just call the UDI driver log fn directly for now.
|
||||
* When done properly, each open() on the UDI device will install
|
||||
* a log function. We will call all log fns whenever a signal is written
|
||||
* to or read form the UniFi.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_card.h"
|
||||
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* unifi_print_status
|
||||
*
|
||||
* Print status info to given character buffer.
|
||||
*
|
||||
* Arguments:
|
||||
* None.
|
||||
*
|
||||
* Returns:
|
||||
* None.
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain)
|
||||
{
|
||||
CsrCharString *p = str;
|
||||
sdio_config_data_t *cfg;
|
||||
CsrUint16 i, n;
|
||||
CsrInt32 remaining = *remain;
|
||||
CsrInt32 written;
|
||||
#ifdef CSR_UNSAFE_SDIO_ACCESS
|
||||
CsrInt32 iostate;
|
||||
CsrResult r;
|
||||
static const CsrCharString *const states[] = {
|
||||
"AWAKE", "DROWSY", "TORPID"
|
||||
};
|
||||
#define SHARED_READ_RETRY_LIMIT 10
|
||||
CsrUint8 b;
|
||||
#endif
|
||||
|
||||
if (remaining <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = n = 0;
|
||||
written = CsrSnprintf(p, remaining, "Chip ID %u\n",
|
||||
(CsrUint16)card->chip_id);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "Chip Version %04X\n",
|
||||
card->chip_version);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "HIP v%u.%u\n",
|
||||
(card->config_data.version >> 8) & 0xFF,
|
||||
card->config_data.version & 0xFF);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "Build %lu: %s\n",
|
||||
card->build_id, card->build_id_string);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
cfg = &card->config_data;
|
||||
|
||||
written = CsrSnprintf(p, remaining, "sdio ctrl offset %u\n",
|
||||
cfg->sdio_ctrl_offset);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "fromhost sigbuf handle %u\n",
|
||||
cfg->fromhost_sigbuf_handle);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "tohost_sigbuf_handle %u\n",
|
||||
cfg->tohost_sigbuf_handle);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "num_fromhost_sig_frags %u\n",
|
||||
cfg->num_fromhost_sig_frags);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "num_tohost_sig_frags %u\n",
|
||||
cfg->num_tohost_sig_frags);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "num_fromhost_data_slots %u\n",
|
||||
cfg->num_fromhost_data_slots);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "num_tohost_data_slots %u\n",
|
||||
cfg->num_tohost_data_slots);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "data_slot_size %u\n",
|
||||
cfg->data_slot_size);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
/* Added by protocol version 0x0001 */
|
||||
written = CsrSnprintf(p, remaining, "overlay_size %u\n",
|
||||
(CsrUint16)cfg->overlay_size);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
/* Added by protocol version 0x0300 */
|
||||
written = CsrSnprintf(p, remaining, "data_slot_round %u\n",
|
||||
cfg->data_slot_round);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "sig_frag_size %u\n",
|
||||
cfg->sig_frag_size);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
/* Added by protocol version 0x0300 */
|
||||
written = CsrSnprintf(p, remaining, "tohost_sig_pad %u\n",
|
||||
cfg->tohost_signal_padding);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining, "\nInternal state:\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n",
|
||||
card->last_phy_panic_code, card->last_phy_panic_arg);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n",
|
||||
card->last_mac_panic_code, card->last_mac_panic_arg);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining, "fhsr: %u\n",
|
||||
(CsrUint16)card->from_host_signals_r);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "fhsw: %u\n",
|
||||
(CsrUint16)card->from_host_signals_w);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "thsr: %u\n",
|
||||
(CsrUint16)card->to_host_signals_r);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "thsw: %u\n",
|
||||
(CsrUint16)card->to_host_signals_w);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining,
|
||||
"fh buffer contains: %u signals, %u bytes\n",
|
||||
card->fh_buffer.count,
|
||||
card->fh_buffer.ptr - card->fh_buffer.buf);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining, "paused: ");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
written = CsrSnprintf(p, remaining, "\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining,
|
||||
"fh command q: %u waiting, %u free of %u:\n",
|
||||
CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
|
||||
CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
|
||||
UNIFI_SOFT_COMMAND_Q_LENGTH);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining,
|
||||
"fh traffic q[%u]: %u waiting, %u free of %u:\n",
|
||||
i,
|
||||
CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
|
||||
CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
|
||||
UNIFI_SOFT_TRAFFIC_Q_LENGTH);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
|
||||
written = CsrSnprintf(p, remaining, "fh data slots free: %u\n",
|
||||
card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
|
||||
written = CsrSnprintf(p, remaining, "From host data slots:");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
n = card->config_data.num_fromhost_data_slots;
|
||||
for (i = 0; i < n && card->from_host_data; i++)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, " %u",
|
||||
(CsrUint16)card->from_host_data[i].bd.data_length);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
written = CsrSnprintf(p, remaining, "\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
written = CsrSnprintf(p, remaining, "To host data slots:");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
n = card->config_data.num_tohost_data_slots;
|
||||
for (i = 0; i < n && card->to_host_data; i++)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, " %u",
|
||||
(CsrUint16)card->to_host_data[i].data_length);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
|
||||
written = CsrSnprintf(p, remaining, "\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
#ifdef CSR_UNSAFE_SDIO_ACCESS
|
||||
written = CsrSnprintf(p, remaining, "Host State: %s\n", states[card->host_state]);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
r = unifi_check_io_status(card, &iostate);
|
||||
if (iostate == 1)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, "I/O Check: F1 disabled\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iostate == 1)
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, "I/O Check: pending interrupt\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
|
||||
written = CsrSnprintf(p, remaining, "BH reason interrupt = %d\n",
|
||||
card->bh_reason_unifi);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "BH reason host = %d\n",
|
||||
card->bh_reason_host);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++)
|
||||
{
|
||||
r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
|
||||
if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80)))
|
||||
{
|
||||
written = CsrSnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n",
|
||||
b, card->from_host_signals_r);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
break;
|
||||
}
|
||||
}
|
||||
iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
|
||||
written = CsrSnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n",
|
||||
iostate, card->to_host_signals_w);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
}
|
||||
#endif
|
||||
|
||||
written = CsrSnprintf(p, remaining, "\nStats:\n");
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "Total SDIO bytes: R=%lu W=%lu\n",
|
||||
card->sdio_bytes_read, card->sdio_bytes_written);
|
||||
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
written = CsrSnprintf(p, remaining, "Interrupts generated on card: %lu\n",
|
||||
card->unifi_interrupt_seq);
|
||||
UNIFI_SNPRINTF_RET(p, remaining, written);
|
||||
|
||||
*remain = remaining;
|
||||
return (p - str);
|
||||
} /* unifi_print_status() */
|
||||
|
||||
|
852
drivers/staging/csr/csr_wifi_hip_unifi.h
Normal file
852
drivers/staging/csr/csr_wifi_hip_unifi.h
Normal file
|
@ -0,0 +1,852 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
*
|
||||
* FILE : csr_wifi_hip_unifi.h
|
||||
*
|
||||
* PURPOSE : Public API for the UniFi HIP core library.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CSR_WIFI_HIP_UNIFI_H__
|
||||
#define __CSR_WIFI_HIP_UNIFI_H__ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_HIP_TA_DISABLE
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
#include "csr_wifi_router_prim.h"
|
||||
#else
|
||||
#include "csr_time.h"
|
||||
#endif
|
||||
|
||||
/* SDIO chip ID numbers */
|
||||
|
||||
/* Manufacturer id */
|
||||
#define SDIO_MANF_ID_CSR 0x032a
|
||||
|
||||
/* Device id */
|
||||
#define SDIO_CARD_ID_UNIFI_1 0x0001
|
||||
#define SDIO_CARD_ID_UNIFI_2 0x0002
|
||||
#define SDIO_CARD_ID_UNIFI_3 0x0007
|
||||
#define SDIO_CARD_ID_UNIFI_4 0x0008
|
||||
|
||||
/* Function number for WLAN */
|
||||
#define SDIO_WLAN_FUNC_ID_UNIFI_1 0x0001
|
||||
#define SDIO_WLAN_FUNC_ID_UNIFI_2 0x0001
|
||||
#define SDIO_WLAN_FUNC_ID_UNIFI_3 0x0001
|
||||
#define SDIO_WLAN_FUNC_ID_UNIFI_4 0x0002
|
||||
|
||||
/* Maximum SDIO bus clock supported. */
|
||||
#define UNIFI_SDIO_CLOCK_MAX_HZ 50000000 /* Hz */
|
||||
|
||||
/*
|
||||
* Initialisation SDIO bus clock.
|
||||
*
|
||||
* The initialisation clock speed should be used from when the chip has been
|
||||
* reset until the first MLME-reset has been received (i.e. during firmware
|
||||
* initialisation), unless UNIFI_SDIO_CLOCK_SAFE_HZ applies.
|
||||
*/
|
||||
#define UNIFI_SDIO_CLOCK_INIT_HZ 12500000 /* Hz */
|
||||
|
||||
/*
|
||||
* Safe SDIO bus clock.
|
||||
*
|
||||
* The safe speed should be used when the chip is in deep sleep or
|
||||
* it's state is unknown (just after reset / power on).
|
||||
*/
|
||||
#define UNIFI_SDIO_CLOCK_SAFE_HZ 1000000 /* Hz */
|
||||
|
||||
/* I/O default block size to use for UniFi. */
|
||||
#define UNIFI_IO_BLOCK_SIZE 64
|
||||
|
||||
#define UNIFI_WOL_OFF 0
|
||||
#define UNIFI_WOL_SDIO 1
|
||||
#define UNIFI_WOL_PIO 2
|
||||
|
||||
/* The number of Tx traffic queues */
|
||||
#define UNIFI_NO_OF_TX_QS 4
|
||||
|
||||
#define CSR_WIFI_HIP_RESERVED_HOST_TAG 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* The number of slots in the from-host queues.
|
||||
*
|
||||
* UNIFI_SOFT_TRAFFIC_Q_LENGTH is the number of slots in the traffic queues
|
||||
* and there will be UNIFI_NO_OF_TX_QS of them.
|
||||
* Traffic queues are used for data packets.
|
||||
*
|
||||
* UNIFI_SOFT_COMMAND_Q_LENGTH is the number of slots in the command queue.
|
||||
* The command queue is used for MLME management requests.
|
||||
*
|
||||
* Queues are ring buffers and so must always have 1 unused slot.
|
||||
*/
|
||||
#define UNIFI_SOFT_TRAFFIC_Q_LENGTH (20 + 1)
|
||||
#define UNIFI_SOFT_COMMAND_Q_LENGTH (16 + 1)
|
||||
|
||||
#include "csr_types.h" /* from the synergy porting folder */
|
||||
#include "csr_framework_ext.h" /* from the synergy porting folder */
|
||||
#include "csr_sdio.h" /* from the synergy porting folder */
|
||||
#include "csr_pmem.h" /* from the synergy porting folder */
|
||||
#include "csr_util.h" /* from the synergy porting folder */
|
||||
#include "csr_formatted_io.h" /* from the synergy gsp folder */
|
||||
#include "csr_wifi_result.h"
|
||||
|
||||
|
||||
/* Traffic queue ordered according to priority
|
||||
* EAPOL/Uncontrolled port Queue should be the last
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
UNIFI_TRAFFIC_Q_BK = 0,
|
||||
UNIFI_TRAFFIC_Q_BE,
|
||||
UNIFI_TRAFFIC_Q_VI,
|
||||
UNIFI_TRAFFIC_Q_VO,
|
||||
UNIFI_TRAFFIC_Q_EAPOL, /* Non existant in HIP */
|
||||
UNIFI_TRAFFIC_Q_MAX, /* Non existant */
|
||||
UNIFI_TRAFFIC_Q_MLME /* Non existant */
|
||||
} unifi_TrafficQueue;
|
||||
|
||||
/*
|
||||
* Structure describing a bulk data slot.
|
||||
* This structure is shared between the HIP core library and the OS
|
||||
* layer. See the definition of unifi_net_data_malloc() for more details.
|
||||
*
|
||||
* The data_length field is used to indicate empty/occupied state.
|
||||
* Needs to be defined before #include "unifi_os.h".
|
||||
*/
|
||||
typedef struct _bulk_data_desc
|
||||
{
|
||||
const CsrUint8 *os_data_ptr;
|
||||
CsrUint32 data_length;
|
||||
const void *os_net_buf_ptr;
|
||||
CsrUint32 net_buf_length;
|
||||
} bulk_data_desc_t;
|
||||
|
||||
/* Structure of an entry in the Symbol Look Up Table (SLUT). */
|
||||
typedef struct _symbol
|
||||
{
|
||||
CsrUint16 id;
|
||||
CsrUint32 obj;
|
||||
} symbol_t;
|
||||
|
||||
/*
|
||||
* Header files need to be included from the current directory,
|
||||
* the SME library, the synergy framework and the OS layer.
|
||||
* A thin OS layer needs to be implemented in the porting exercise.
|
||||
*
|
||||
* Note that unifi_os.h should be included only in unifi.h
|
||||
*/
|
||||
|
||||
#include "unifi_os.h"
|
||||
|
||||
/*
|
||||
* Contains the HIP core definitions selected in the porting exercise, such as
|
||||
* UNIFI_PAD_BULK_DATA_TO_BLOCK_SIZE and UNIFI_PAD_SIGNALS_TO_BLOCK_SIZE.
|
||||
* Implemented in the OS layer, as part of the porting exersice.
|
||||
*/
|
||||
#include "unifi_config.h"
|
||||
|
||||
#include "csr_wifi_hip_signals.h" /* from this dir */
|
||||
|
||||
/*
|
||||
* The card structure is an opaque pointer that is used to pass context
|
||||
* to the upper-edge API functions.
|
||||
*/
|
||||
typedef struct card card_t;
|
||||
|
||||
|
||||
/*
|
||||
* This structure describes all of the bulk data that 'might' be
|
||||
* associated with a signal.
|
||||
*/
|
||||
typedef struct _bulk_data_param
|
||||
{
|
||||
bulk_data_desc_t d[UNIFI_MAX_DATA_REFERENCES];
|
||||
} bulk_data_param_t;
|
||||
|
||||
|
||||
/*
|
||||
* This structure describes the chip and HIP core lib
|
||||
* information that exposed to the OS layer.
|
||||
*/
|
||||
typedef struct _card_info
|
||||
{
|
||||
CsrUint16 chip_id;
|
||||
CsrUint16 chip_version;
|
||||
CsrUint32 fw_build;
|
||||
CsrUint16 fw_hip_version;
|
||||
CsrUint32 sdio_block_size;
|
||||
} card_info_t;
|
||||
|
||||
|
||||
/*
|
||||
* Mini-coredump definitions
|
||||
*/
|
||||
/* Definition of XAP memory ranges used by the mini-coredump system.
|
||||
* Note that, these values are NOT the same as UNIFI_REGISTERS, etc
|
||||
* in unifihw.h which don't allow selection of register areas for each XAP.
|
||||
*/
|
||||
typedef enum unifi_coredump_space
|
||||
{
|
||||
UNIFI_COREDUMP_MAC_REG,
|
||||
UNIFI_COREDUMP_PHY_REG,
|
||||
UNIFI_COREDUMP_SH_DMEM,
|
||||
UNIFI_COREDUMP_MAC_DMEM,
|
||||
UNIFI_COREDUMP_PHY_DMEM,
|
||||
UNIFI_COREDUMP_TRIGGER_MAGIC = 0xFEED
|
||||
} unifi_coredump_space_t;
|
||||
|
||||
/* Structure used to request a register value from a mini-coredump buffer */
|
||||
typedef struct unifi_coredump_req
|
||||
{
|
||||
/* From user */
|
||||
CsrInt32 index; /* 0=newest, -1=oldest */
|
||||
unifi_coredump_space_t space; /* memory space */
|
||||
CsrUint32 offset; /* register offset in space */
|
||||
/* From driver */
|
||||
CsrUint32 drv_build; /* Driver build id */
|
||||
CsrUint32 chip_ver; /* Chip version */
|
||||
CsrUint32 fw_ver; /* Firmware version */
|
||||
CsrInt32 requestor; /* Requestor: 0=auto dump, 1=manual */
|
||||
CsrTime timestamp; /* time of capture by driver */
|
||||
CsrUint32 serial; /* capture serial number */
|
||||
CsrInt32 value; /* register value */
|
||||
} unifi_coredump_req_t; /* mini-coredumped reg value request */
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup upperedge Upper edge API
|
||||
*
|
||||
* The following functions are implemented in the HIP core lib.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialise the HIP core lib.
|
||||
* Note that the OS layer must initialise the SDIO glue layer and obtain
|
||||
* an SDIO function context, prior to this call.
|
||||
*
|
||||
* @param sdiopriv the SDIO function context.
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @return \p card_t the HIP core lib API context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialise the UniFi chip.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param led_mask the led mask to apply to UniFi.
|
||||
*
|
||||
* @return \b 0 if UniFi is initialized.
|
||||
*
|
||||
* @return \b -CSR_EIO if an I/O error occured while initializing UniFi
|
||||
*
|
||||
* @return \b -CSR_ENODEV if the card is no longer present.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_init_card(card_t *card, CsrInt32 led_mask);
|
||||
|
||||
/**
|
||||
*
|
||||
* De-Initialise the HIP core lib.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_free_card(card_t *card);
|
||||
|
||||
/**
|
||||
*
|
||||
* Cancel all the signals pending in the HIP core lib.
|
||||
* Normally used during a system suspend when the power is retained on UniFi.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_cancel_pending_signals(card_t *card);
|
||||
|
||||
/**
|
||||
*
|
||||
* Send a signal to UniFi.
|
||||
* Normally it is called from unifi_sys_hip_req() and the OS layer
|
||||
* Tx data plane.
|
||||
*
|
||||
* Note that the bulkdata buffers ownership is passed to the HIP core lib.
|
||||
* These buffers must be allocated using unifi_net_data_malloc().
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param sigptr pointer to the signal.
|
||||
*
|
||||
* @param siglen size of the signal.
|
||||
*
|
||||
* @param bulkdata pointer to the bulk data associated with the signal.
|
||||
*
|
||||
* @return \b 0 signal is sent.
|
||||
*
|
||||
* @return \b -CSR_EIO if an error occured while sending the signal
|
||||
*
|
||||
* @return \b -CSR_ENODEV if the card is no longer present.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_send_signal(card_t *card, const CsrUint8 *sigptr,
|
||||
CsrUint32 siglen,
|
||||
const bulk_data_param_t *bulkdata);
|
||||
|
||||
/**
|
||||
*
|
||||
* Check if the HIP core lib has resources to send a signal.
|
||||
* Normally there no need to use this function.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param sigptr pointer to the signal.
|
||||
*
|
||||
* @return \b 0 if there are resources for the signal.
|
||||
*
|
||||
* @return \b -CSR_ENOSPC if there are not enough resources
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_send_resources_available(card_t *card, const CsrUint8 *sigptr);
|
||||
|
||||
/**
|
||||
*
|
||||
* Read the UniFi chip and the HIP core lib information.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param card_info pointer to save the information.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_card_info(card_t *card, card_info_t *card_info);
|
||||
|
||||
/**
|
||||
*
|
||||
* Print the UniFi I/O and Interrupt status.
|
||||
* Normally it is used for debug purposes only.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
|
||||
* @param status buffer for the chip status
|
||||
*
|
||||
* @return \b 0 if the check was performed.
|
||||
*
|
||||
* @return \b -CSR_EIO if an error occured while checking the status.
|
||||
*
|
||||
* @return \b -CSR_ENODEV if the card is no longer present.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_check_io_status(card_t *card, CsrInt32 *status);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Run the HIP core lib Botton-Half.
|
||||
* Whenever the HIP core lib want this function to be called
|
||||
* by the OS layer, it calls unifi_run_bh().
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param remaining pointer to return the time (in msecs) that this function
|
||||
* should be re-scheduled. A return value of 0 means that no re-scheduling
|
||||
* is required. If unifi_bh() is called before the timeout expires,
|
||||
* the caller must pass in the remaining time.
|
||||
*
|
||||
* @return \b 0 if no error occured.
|
||||
*
|
||||
* @return \b -CSR_ENODEV if the card is no longer present.
|
||||
*
|
||||
* @return \b -CSR_E* if an error occured while running the bottom half.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_bh(card_t *card, CsrUint32 *remaining);
|
||||
|
||||
|
||||
/**
|
||||
* UniFi Low Power Mode (Deep Sleep Signaling)
|
||||
*
|
||||
* unifi_low_power_mode defines the UniFi Deep Sleep Signaling status.
|
||||
* Use with unifi_configure_low_power_mode() to enable/disable
|
||||
* the Deep Sleep Signaling.
|
||||
*/
|
||||
enum unifi_low_power_mode
|
||||
{
|
||||
UNIFI_LOW_POWER_DISABLED,
|
||||
UNIFI_LOW_POWER_ENABLED
|
||||
};
|
||||
|
||||
/**
|
||||
* Periodic Wake Host Mode
|
||||
*
|
||||
* unifi_periodic_wake_mode defines the Periodic Wake Host Mode.
|
||||
* It can only be set to UNIFI_PERIODIC_WAKE_HOST_ENABLED if
|
||||
* low_power_mode == UNIFI_LOW_POWER_ENABLED.
|
||||
*/
|
||||
enum unifi_periodic_wake_mode
|
||||
{
|
||||
UNIFI_PERIODIC_WAKE_HOST_DISABLED,
|
||||
UNIFI_PERIODIC_WAKE_HOST_ENABLED
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Run the HIP core lib Botton-Half.
|
||||
* Whenever the HIP core lib want this function to be called
|
||||
* by the OS layer, it calls unifi_run_bh().
|
||||
*
|
||||
* Typically, the SME is responsible for configuring these parameters,
|
||||
* so unifi_sys_configure_power_mode_req() is usually implemented
|
||||
* as a direct call to unifi_configure_low_power_mode().
|
||||
*
|
||||
* Note: When polling mode is used instead of interrupts,
|
||||
* low_power_mode must never be set to UNIFI_LOW_POWER_ENABLED.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @param low_power_mode the Low Power Mode.
|
||||
*
|
||||
* @param periodic_wake_mode the Periodic Wake Mode.
|
||||
*
|
||||
* @return \b 0 if no error occured.
|
||||
*
|
||||
* @return \b -CSR_E* if the request failed.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_configure_low_power_mode(card_t *card,
|
||||
enum unifi_low_power_mode low_power_mode,
|
||||
enum unifi_periodic_wake_mode periodic_wake_mode);
|
||||
|
||||
/**
|
||||
*
|
||||
* Forces the UniFi chip to enter a Deep Sleep state.
|
||||
* This is normally called by the OS layer when the platform suspends.
|
||||
*
|
||||
* Note that if the UniFi Low Power Mode is disabled this call fails.
|
||||
*
|
||||
* @param card the HIP core lib API context.
|
||||
*
|
||||
* @return \b 0 if no error occured.
|
||||
*
|
||||
* @return \b -CSR_ENODEV if the card is no longer present.
|
||||
*
|
||||
* @return \b -CSR_E* if the request failed.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_force_low_power_mode(card_t *card);
|
||||
|
||||
#ifndef CSR_WIFI_HIP_TA_DISABLE
|
||||
/**
|
||||
* Configure the Traffic Analysis sampling
|
||||
*
|
||||
* Enable or disable statistics gathering.
|
||||
* Enable or disable particular packet detection.
|
||||
*
|
||||
* @param card the HIP core context
|
||||
* @param config_type the item to configure
|
||||
* @param config pointer to struct containing config info
|
||||
*
|
||||
* @return \b 0 if configuration was successful
|
||||
*
|
||||
* @return \b -CSR_EINVAL if a parameter had an invalid value
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_ta_configure(card_t *card,
|
||||
CsrWifiRouterCtrlTrafficConfigType config_type,
|
||||
const CsrWifiRouterCtrlTrafficConfig *config);
|
||||
|
||||
/**
|
||||
* Pass a packet for Traffic Analysis sampling
|
||||
*
|
||||
* @param card the HIP core context
|
||||
* @param direction the direction (Rx or Tx) of the frame.
|
||||
* @param data pointer to bulkdata struct containing the packet
|
||||
* @param saddr the source address of the packet
|
||||
* @param sta_macaddr the MAC address of the UniFi chip
|
||||
* @param timestamp the current time in msecs
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_ta_sample(card_t *card,
|
||||
CsrWifiRouterCtrlProtocolDirection direction,
|
||||
const bulk_data_desc_t *data,
|
||||
const CsrUint8 *saddr,
|
||||
const CsrUint8 *sta_macaddr,
|
||||
CsrUint32 timestamp,
|
||||
CsrUint16 rate);
|
||||
|
||||
/**
|
||||
* Notify the HIP core lib for a detected Traffic Classification.
|
||||
* Typically, the SME is responsible for configuring these parameters,
|
||||
* so unifi_sys_traffic_classification_req() is usually implemented
|
||||
* as a direct call to unifi_ta_classification().
|
||||
*
|
||||
* @param card the HIP core context.
|
||||
* @param traffic_type the detected traffic type.
|
||||
* @param period The detected period of the traffic.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_ta_classification(card_t *card,
|
||||
CsrWifiRouterCtrlTrafficType traffic_type,
|
||||
CsrUint16 period);
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Use software to hard reset the chip.
|
||||
* This is a subset of the unifi_init_card() functionality and should
|
||||
* only be used only to reset a paniced chip before a coredump is taken.
|
||||
*
|
||||
* @param card the HIP core context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_card_hard_reset(card_t *card);
|
||||
|
||||
|
||||
CsrResult unifi_card_readn(card_t *card, CsrUint32 unifi_addr, void *pdata, CsrUint16 len);
|
||||
CsrResult unifi_card_read16(card_t *card, CsrUint32 unifi_addr, CsrUint16 *pdata);
|
||||
CsrResult unifi_card_write16(card_t *card, CsrUint32 unifi_addr, CsrUint16 data);
|
||||
|
||||
|
||||
enum unifi_dbg_processors_select
|
||||
{
|
||||
UNIFI_PROC_MAC,
|
||||
UNIFI_PROC_PHY,
|
||||
UNIFI_PROC_BT,
|
||||
UNIFI_PROC_BOTH,
|
||||
UNIFI_PROC_INVALID
|
||||
};
|
||||
|
||||
CsrResult unifi_card_stop_processor(card_t *card, enum unifi_dbg_processors_select which);
|
||||
|
||||
/**
|
||||
* Call-outs from the HIP core lib to the OS layer.
|
||||
* The following functions need to be implemented during the porting exercise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Selects appropriate queue according to priority
|
||||
* Helps maintain uniformity in queue selection between the HIP
|
||||
* and the OS layers.
|
||||
*
|
||||
* @param priority priority of the packet
|
||||
*
|
||||
* @return \b Traffic queue to which a packet of this priority belongs
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
unifi_TrafficQueue
|
||||
unifi_frame_priority_to_queue(CSR_PRIORITY priority);
|
||||
|
||||
/**
|
||||
* Returns the priority corresponding to a particular Queue when that is used
|
||||
* when downgrading a packet to a lower AC.
|
||||
* Helps maintain uniformity in queue - priority mapping between the HIP
|
||||
* and the OS layers.
|
||||
*
|
||||
* @param queue
|
||||
*
|
||||
* @return \b Highest priority corresponding to this queue
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CSR_PRIORITY unifi_get_default_downgrade_priority(unifi_TrafficQueue queue);
|
||||
|
||||
/**
|
||||
*
|
||||
* Flow control callbacks.
|
||||
* unifi_pause_xmit() is called when the HIP core lib does not have any
|
||||
* resources to store data packets. The OS layer needs to pause
|
||||
* the Tx data plane until unifi_restart_xmit() is called.
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_pause_xmit(void *ospriv, unifi_TrafficQueue queue);
|
||||
void unifi_restart_xmit(void *ospriv, unifi_TrafficQueue queue);
|
||||
|
||||
/**
|
||||
*
|
||||
* Request to run the Bottom-Half.
|
||||
* The HIP core lib calls this function to request that unifi_bh()
|
||||
* needs to be run by the OS layer. It can be called anytime, i.e.
|
||||
* when the unifi_bh() is running.
|
||||
* Since unifi_bh() is not re-entrant, usually unifi_run_bh() sets
|
||||
* an event to a thread that schedules a call to unifi_bh().
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrResult unifi_run_bh(void *ospriv);
|
||||
|
||||
/**
|
||||
*
|
||||
* Delivers a signal received from UniFi to the OS layer.
|
||||
* Normally, the data signals should be delivered to the data plane
|
||||
* and all the rest to the SME (unifi_sys_hip_ind()).
|
||||
*
|
||||
* Note that the OS layer is responsible for freeing the bulkdata
|
||||
* buffers, using unifi_net_data_free().
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param sigptr pointer to the signal.
|
||||
*
|
||||
* @param siglen size of the signal.
|
||||
*
|
||||
* @param bulkdata pointer to the bulk data associated with the signal.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_receive_event(void *ospriv,
|
||||
CsrUint8 *sigdata, CsrUint32 siglen,
|
||||
const bulk_data_param_t *bulkdata);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 free_fh_sig_queue_slots[UNIFI_NO_OF_TX_QS];
|
||||
CsrUint16 free_fh_bulkdata_slots;
|
||||
CsrUint16 free_fh_fw_slots;
|
||||
} unifi_HipQosInfo;
|
||||
|
||||
void unifi_get_hip_qos_info(card_t *card, unifi_HipQosInfo *hipqosinfo);
|
||||
|
||||
|
||||
/**
|
||||
* Functions that read a portion of a firmware file.
|
||||
*
|
||||
* Note: If the UniFi chip runs the f/w from ROM, the HIP core may never
|
||||
* call these functions. Also, the HIP core may call these functions even if
|
||||
* a f/w file is not available. In this case, it is safe to fail the request.
|
||||
*/
|
||||
#define UNIFI_FW_STA 1 /* Identify STA firmware file */
|
||||
|
||||
/**
|
||||
*
|
||||
* Ask the OS layer to initialise a read from a f/w file.
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param is_fw if 0 the request if for the loader file, if 1 the request
|
||||
* is for a f/w file.
|
||||
*
|
||||
* @param info a card_info_t structure containing versions information.
|
||||
* Note that some members of the structure may not be initialised.
|
||||
*
|
||||
* @return \p NULL if the file is not available, or a pointer which contains
|
||||
* OS specific information for the file (typically the contents of the file)
|
||||
* that the HIP core uses when calling unifi_fw_read() and unifi_fw_read_stop()
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void* unifi_fw_read_start(void *ospriv, CsrInt8 is_fw, const card_info_t *info);
|
||||
|
||||
/**
|
||||
*
|
||||
* Ask the OS layer to return a portion from a f/w file.
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param arg the OS pointer returned by unifi_fw_read_start().
|
||||
*
|
||||
* @param offset the offset in the f/w file to read the read from.
|
||||
*
|
||||
* @param buf the buffer to store the returned data.
|
||||
*
|
||||
* @param len the size in bytes of the requested read.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
CsrInt32 unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, void *buf, CsrUint32 len);
|
||||
|
||||
/**
|
||||
*
|
||||
* Ask the OS layer to finish reading from a f/w file.
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param dlpriv the OS pointer returned by unifi_fw_read_start().
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_fw_read_stop(void *ospriv, void *dlpriv);
|
||||
|
||||
/**
|
||||
*
|
||||
* Ask OS layer for a handle to a dynamically allocated firmware buffer
|
||||
* (primarily intended for production test images which may need conversion)
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param fwbuf pointer to dynamically allocated buffer
|
||||
*
|
||||
* @param len length of provided buffer in bytes
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void* unifi_fw_open_buffer(void *ospriv, void *fwbuf, CsrUint32 len);
|
||||
|
||||
/**
|
||||
*
|
||||
* Release a handle to a dynamically allocated firmware buffer
|
||||
* (primarily intended for production test images which may need conversion)
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param fwbuf pointer to dynamically allocated buffer
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_fw_close_buffer(void *ospriv, void *fwbuf);
|
||||
|
||||
#ifndef CSR_WIFI_HIP_TA_DISABLE
|
||||
/*
|
||||
* Driver must provide these.
|
||||
*
|
||||
* A simple implementation will just call
|
||||
* unifi_sys_traffic_protocol_ind() or unifi_sys_traffic_classification_ind()
|
||||
* respectively. See sme_csr_userspace/sme_userspace.c.
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* Indicates a detected packet of type packet_type.
|
||||
* Typically, this information is processed by the SME so
|
||||
* unifi_ta_indicate_protocol() needs to schedule a call to
|
||||
* unifi_sys_traffic_protocol_ind().
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param packet_type the detected packet type.
|
||||
*
|
||||
* @param direction the direction of the packet (Rx, Tx).
|
||||
*
|
||||
* @param src_addr the source address of the packet.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_ta_indicate_protocol(void *ospriv,
|
||||
CsrWifiRouterCtrlTrafficPacketType packet_type,
|
||||
CsrWifiRouterCtrlProtocolDirection direction,
|
||||
const CsrWifiMacAddress *src_addr);
|
||||
|
||||
/**
|
||||
*
|
||||
* Indicates statistics for the sample data over a period.
|
||||
* Typically, this information is processed by the SME so
|
||||
* unifi_ta_indicate_sampling() needs to schedule a call to
|
||||
* unifi_sys_traffic_sample_ind().
|
||||
*
|
||||
* @param ospriv the OS layer context.
|
||||
*
|
||||
* @param stats the pointer to the structure that contains the statistics.
|
||||
*
|
||||
* @ingroup upperedge
|
||||
*/
|
||||
void unifi_ta_indicate_sampling(void *ospriv, CsrWifiRouterCtrlTrafficStats *stats);
|
||||
void unifi_ta_indicate_l4stats(void *ospriv,
|
||||
CsrUint32 rxTcpThroughput,
|
||||
CsrUint32 txTcpThroughput,
|
||||
CsrUint32 rxUdpThroughput,
|
||||
CsrUint32 txUdpThroughput);
|
||||
#endif
|
||||
|
||||
void unifi_rx_queue_flush(void *ospriv);
|
||||
|
||||
/**
|
||||
* Call-out from the SDIO glue layer.
|
||||
*
|
||||
* The glue layer needs to call unifi_sdio_interrupt_handler() every time
|
||||
* an interrupts occurs.
|
||||
*
|
||||
* @param card the HIP core context.
|
||||
*
|
||||
* @ingroup bottomedge
|
||||
*/
|
||||
void unifi_sdio_interrupt_handler(card_t *card);
|
||||
|
||||
|
||||
/* HELPER FUNCTIONS */
|
||||
|
||||
/*
|
||||
* unifi_init() and unifi_download() implement a subset of unifi_init_card functionality
|
||||
* that excludes HIP initialization.
|
||||
*/
|
||||
CsrResult unifi_init(card_t *card);
|
||||
CsrResult unifi_download(card_t *card, CsrInt32 led_mask);
|
||||
|
||||
/*
|
||||
* unifi_start_processors() ensures both on-chip processors are running
|
||||
*/
|
||||
CsrResult unifi_start_processors(card_t *card);
|
||||
|
||||
CsrResult unifi_capture_panic(card_t *card);
|
||||
|
||||
/*
|
||||
* Configure HIP interrupt processing mode
|
||||
*/
|
||||
#define CSR_WIFI_INTMODE_DEFAULT 0
|
||||
#define CSR_WIFI_INTMODE_RUN_BH_ONCE 1 /* Run BH once per interrupt */
|
||||
|
||||
void unifi_set_interrupt_mode(card_t *card, CsrUint32 mode);
|
||||
|
||||
/*
|
||||
* unifi_request_max_clock() requests that max SDIO clock speed is set at the
|
||||
* next suitable opportunity.
|
||||
*/
|
||||
void unifi_request_max_sdio_clock(card_t *card);
|
||||
|
||||
|
||||
/* Functions to lookup bulk data command names. */
|
||||
const CsrCharString* lookup_bulkcmd_name(CsrUint16 id);
|
||||
|
||||
/* Function to log HIP's global debug buffer */
|
||||
#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
|
||||
void unifi_debug_buf_dump(void);
|
||||
#endif
|
||||
|
||||
/* Mini-coredump utility functions */
|
||||
CsrResult unifi_coredump_get_value(card_t *card, struct unifi_coredump_req *req);
|
||||
CsrResult unifi_coredump_capture(card_t *card, struct unifi_coredump_req *req);
|
||||
CsrResult unifi_coredump_request_at_next_reset(card_t *card, CsrInt8 enable);
|
||||
CsrResult unifi_coredump_init(card_t *card, CsrUint16 num_dump_buffers);
|
||||
void unifi_coredump_free(card_t *card);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CSR_WIFI_HIP_UNIFI_H__ */
|
46
drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c
Normal file
46
drivers/staging/csr/csr_wifi_hip_unifi_signal_names.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
|
||||
struct sig_name
|
||||
{
|
||||
CsrInt16 id;
|
||||
const CsrCharString *name;
|
||||
};
|
||||
|
||||
static const struct sig_name Unifi_bulkcmd_names[] = {
|
||||
{ 0, "SignalCmd" },
|
||||
{ 1, "CopyToHost" },
|
||||
{ 2, "CopyToHostAck" },
|
||||
{ 3, "CopyFromHost" },
|
||||
{ 4, "CopyFromHostAck" },
|
||||
{ 5, "ClearSlot" },
|
||||
{ 6, "CopyOverlay" },
|
||||
{ 7, "CopyOverlayAck" },
|
||||
{ 8, "CopyFromHostAndClearSlot" },
|
||||
{ 15, "Padding" }
|
||||
};
|
||||
|
||||
const CsrCharString* lookup_bulkcmd_name(CsrUint16 id)
|
||||
{
|
||||
if (id < 9)
|
||||
{
|
||||
return Unifi_bulkcmd_names[id].name;
|
||||
}
|
||||
if (id == 15)
|
||||
{
|
||||
return "Padding";
|
||||
}
|
||||
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
|
76
drivers/staging/csr/csr_wifi_hip_unifi_udi.h
Normal file
76
drivers/staging/csr/csr_wifi_hip_unifi_udi.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_unifi_udi.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* Declarations and definitions for the UniFi Debug Interface.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __CSR_WIFI_HIP_UNIFI_UDI_H__
|
||||
#define __CSR_WIFI_HIP_UNIFI_UDI_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#include "csr_wifi_hip_signals.h"
|
||||
|
||||
|
||||
/*
|
||||
* Support for tracing the wire protocol.
|
||||
*/
|
||||
enum udi_log_direction
|
||||
{
|
||||
UDI_LOG_FROM_HOST = 0x0000,
|
||||
UDI_LOG_TO_HOST = 0x0001
|
||||
};
|
||||
|
||||
typedef void (*udi_func_t)(void *ospriv, CsrUint8 *sigdata,
|
||||
CsrUint32 signal_len,
|
||||
const bulk_data_param_t *bulkdata,
|
||||
enum udi_log_direction dir);
|
||||
|
||||
CsrResult unifi_set_udi_hook(card_t *card, udi_func_t udi_fn);
|
||||
CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
|
||||
|
||||
|
||||
/*
|
||||
* Function to print current status info to a string.
|
||||
* This is used in the linux /proc interface and might be useful
|
||||
* in other systems.
|
||||
*/
|
||||
CsrInt32 unifi_print_status(card_t *card, CsrCharString *str, CsrInt32 *remain);
|
||||
|
||||
#define UNIFI_SNPRINTF_RET(buf_p, remain, written) \
|
||||
do { \
|
||||
if (written >= remain) { \
|
||||
if (remain >= 2) { \
|
||||
buf_p[remain - 2] = '\n'; \
|
||||
buf_p[remain - 1] = 0; \
|
||||
} \
|
||||
buf_p += remain; \
|
||||
remain = 0; \
|
||||
} else if (written > 0) { \
|
||||
buf_p += written; \
|
||||
remain -= written; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
|
67
drivers/staging/csr/csr_wifi_hip_unifihw.h
Normal file
67
drivers/staging/csr/csr_wifi_hip_unifihw.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
*
|
||||
* File: csr_wifi_hip_unifihw.h
|
||||
*
|
||||
* Definitions of various chip registers, addresses, values etc.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __UNIFIHW_H__
|
||||
#define __UNIFIHW_H__ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Symbol Look Up Table fingerprint. IDs are in sigs.h */
|
||||
#define SLUT_FINGERPRINT 0xD397
|
||||
|
||||
|
||||
/* Values of LoaderOperation */
|
||||
#define UNIFI_LOADER_IDLE 0x00
|
||||
#define UNIFI_LOADER_COPY 0x01
|
||||
#define UNIFI_LOADER_ERROR_MASK 0xF0
|
||||
|
||||
/* Values of BootLoaderOperation */
|
||||
#define UNIFI_BOOT_LOADER_IDLE 0x00
|
||||
#define UNIFI_BOOT_LOADER_RESTART 0x01
|
||||
#define UNIFI_BOOT_LOADER_PATCH 0x02
|
||||
#define UNIFI_BOOT_LOADER_LOAD_STA 0x10
|
||||
#define UNIFI_BOOT_LOADER_LOAD_PTEST 0x11
|
||||
|
||||
|
||||
/* Memory spaces encoded in top byte of Generic Pointer type */
|
||||
#define UNIFI_SH_DMEM 0x01 /* Shared Data Memory */
|
||||
#define UNIFI_EXT_FLASH 0x02 /* External FLASH */
|
||||
#define UNIFI_EXT_SRAM 0x03 /* External SRAM */
|
||||
#define UNIFI_REGISTERS 0x04 /* Registers */
|
||||
#define UNIFI_PHY_DMEM 0x10 /* PHY Data Memory */
|
||||
#define UNIFI_PHY_PMEM 0x11 /* PHY Program Memory */
|
||||
#define UNIFI_PHY_ROM 0x12 /* PHY ROM */
|
||||
#define UNIFI_MAC_DMEM 0x20 /* MAC Data Memory */
|
||||
#define UNIFI_MAC_PMEM 0x21 /* MAC Program Memory */
|
||||
#define UNIFI_MAC_ROM 0x22 /* MAC ROM */
|
||||
#define UNIFI_BT_DMEM 0x30 /* BT Data Memory */
|
||||
#define UNIFI_BT_PMEM 0x31 /* BT Program Memory */
|
||||
#define UNIFI_BT_ROM 0x32 /* BT ROM */
|
||||
|
||||
#define UNIFI_MAKE_GP(R, O) (((UNIFI_ ## R) << 24) | (O))
|
||||
#define UNIFI_GP_OFFSET(GP) ((GP) & 0xFFFFFF)
|
||||
#define UNIFI_GP_SPACE(GP) (((GP) >> 24) & 0xFF)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __UNIFIHW_H__ */
|
38
drivers/staging/csr/csr_wifi_hip_unifiversion.h
Normal file
38
drivers/staging/csr/csr_wifi_hip_unifiversion.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: unifiversion.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* Version information for the portable UniFi driver.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __UNIFIVERSION_H__
|
||||
#define __UNIFIVERSION_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The minimum version of Host Interface Protocol required by the driver.
|
||||
*/
|
||||
#define UNIFI_HIP_MAJOR_VERSION 9
|
||||
#define UNIFI_HIP_MINOR_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __UNIFIVERSION_H__ */
|
1075
drivers/staging/csr/csr_wifi_hip_xbv.c
Normal file
1075
drivers/staging/csr/csr_wifi_hip_xbv.c
Normal file
File diff suppressed because it is too large
Load diff
127
drivers/staging/csr/csr_wifi_hip_xbv.h
Normal file
127
drivers/staging/csr/csr_wifi_hip_xbv.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* FILE: csr_wifi_hip_xbv.h
|
||||
*
|
||||
* PURPOSE:
|
||||
* Definitions and declarations for code to read XBV files - the UniFi
|
||||
* firmware download file format.
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef __XBV_H__
|
||||
#define __XBV_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_XBV_TEST
|
||||
/* Driver includes */
|
||||
#include "csr_wifi_hip_unifi.h"
|
||||
#endif
|
||||
|
||||
|
||||
struct VMEQ
|
||||
{
|
||||
CsrUint32 addr;
|
||||
CsrUint16 mask;
|
||||
CsrUint16 value;
|
||||
};
|
||||
|
||||
struct VAND
|
||||
{
|
||||
CsrUint32 first;
|
||||
CsrUint32 count;
|
||||
};
|
||||
|
||||
struct VERS
|
||||
{
|
||||
CsrUint32 num_vand;
|
||||
};
|
||||
|
||||
struct FWDL
|
||||
{
|
||||
CsrUint32 dl_addr;
|
||||
CsrUint32 dl_size;
|
||||
CsrUint32 dl_offset;
|
||||
};
|
||||
|
||||
struct FWOV
|
||||
{
|
||||
CsrUint32 dl_size;
|
||||
CsrUint32 dl_offset;
|
||||
};
|
||||
|
||||
struct PTDL
|
||||
{
|
||||
CsrUint32 dl_size;
|
||||
CsrUint32 dl_offset;
|
||||
};
|
||||
|
||||
#define MAX_VMEQ 64
|
||||
#define MAX_VAND 64
|
||||
#define MAX_FWDL 256
|
||||
#define MAX_PTDL 256
|
||||
|
||||
/* An XBV1 file can either contain firmware or patches (at the
|
||||
* moment). The 'mode' member of the xbv1_t structure tells us which
|
||||
* one is the case. */
|
||||
typedef enum
|
||||
{
|
||||
xbv_unknown,
|
||||
xbv_firmware,
|
||||
xbv_patch
|
||||
} xbv_mode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
xbv_mode mode;
|
||||
|
||||
/* Parts of a Firmware XBV1 */
|
||||
|
||||
struct VMEQ vmeq[MAX_VMEQ];
|
||||
CsrUint32 num_vmeq;
|
||||
struct VAND vand[MAX_VAND];
|
||||
struct VERS vers;
|
||||
|
||||
CsrUint32 slut_addr;
|
||||
|
||||
/* F/W download image, possibly more than one part */
|
||||
struct FWDL fwdl[MAX_FWDL];
|
||||
CsrInt16 num_fwdl;
|
||||
|
||||
/* F/W overlay image, add r not used */
|
||||
struct FWOV fwov;
|
||||
|
||||
/* Parts of a Patch XBV1 */
|
||||
|
||||
CsrUint32 build_id;
|
||||
|
||||
struct PTDL ptdl[MAX_PTDL];
|
||||
CsrInt16 num_ptdl;
|
||||
} xbv1_t;
|
||||
|
||||
|
||||
typedef CsrInt32 (*fwreadfn_t)(void *ospriv, void *dlpriv, CsrUint32 offset, void *buf, CsrUint32 len);
|
||||
|
||||
CsrResult xbv1_parse(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo);
|
||||
CsrInt32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo,
|
||||
symbol_t *slut, CsrUint32 slut_len);
|
||||
void* xbv_to_patch(card_t *card, fwreadfn_t readfn, const void *fw_buf, const xbv1_t *fwinfo,
|
||||
CsrUint32 *size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __XBV_H__ */
|
27
drivers/staging/csr/csr_wifi_hostio_prim.h
Normal file
27
drivers/staging/csr/csr_wifi_hostio_prim.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef CSR_WIFI_HOSTIO_H
|
||||
#define CSR_WIFI_HOSTIO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define CSR_WIFI_HOSTIO_PRIM 0x0453
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_HOSTIO_H */
|
||||
|
113
drivers/staging/csr/csr_wifi_lib.h
Normal file
113
drivers/staging/csr/csr_wifi_lib.h
Normal file
|
@ -0,0 +1,113 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#ifndef CSR_WIFI_LIB_H__
|
||||
#define CSR_WIFI_LIB_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_wifi_fsm_event.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiFsmEventInit
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Macro to initialise the members of a CsrWifiFsmEvent.
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define CsrWifiFsmEventInit(evt, p_primtype, p_msgtype, p_dst, p_src) \
|
||||
(evt)->primtype = p_primtype; \
|
||||
(evt)->type = p_msgtype; \
|
||||
(evt)->destination = p_dst; \
|
||||
(evt)->source = p_src
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiEvent_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrWifiEvent
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrWifiFsmEvent* CsrWifiEvent_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint8 value;
|
||||
} CsrWifiEventCsrUint8;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiEventCsrUint8_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrWifiEventCsrUint8
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrWifiEventCsrUint8* CsrWifiEventCsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint8 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 value;
|
||||
} CsrWifiEventCsrUint16;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiEventCsrUint16_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrWifiEventCsrUint16
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrWifiEventCsrUint16* CsrWifiEventCsrUint16_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint32 value;
|
||||
} CsrWifiEventCsrUint32;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiEventCsrUint32_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrWifiEventCsrUint32
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrWifiEventCsrUint32* CsrWifiEventCsrUint32_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint32 value);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 value16;
|
||||
CsrUint8 value8;
|
||||
} CsrWifiEventCsrUint16CsrUint8;
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiEventCsrUint16CsrUint8_struct
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Generic message creator.
|
||||
* Allocates and fills in a message with the signature CsrWifiEventCsrUint16CsrUint8
|
||||
*
|
||||
*----------------------------------------------------------------------------*/
|
||||
CsrWifiEventCsrUint16CsrUint8* CsrWifiEventCsrUint16CsrUint8_struct(CsrUint16 primtype, CsrUint16 msgtype, CsrSchedQid dst, CsrSchedQid src, CsrUint16 value16, CsrUint8 value8);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_LIB_H__ */
|
60
drivers/staging/csr/csr_wifi_msgconv.h
Normal file
60
drivers/staging/csr/csr_wifi_msgconv.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_MSGCONV_H__
|
||||
#define CSR_WIFI_MSGCONV_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_unicode.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
void CsrUint16SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint16 v);
|
||||
void CsrUint24SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v);
|
||||
void CsrUint32SerBigEndian(CsrUint8 *ptr, CsrSize *len, CsrUint32 v);
|
||||
|
||||
void CsrUint16DesBigEndian(CsrUint16 *v, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUint24DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset);
|
||||
void CsrUint32DesBigEndian(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset);
|
||||
|
||||
void CsrUint24Ser(CsrUint8 *ptr, CsrSize *len, CsrUint32 v);
|
||||
void CsrUint24Des(CsrUint32 *v, CsrUint8 *buffer, CsrSize *offset);
|
||||
|
||||
|
||||
CsrSize CsrWifiEventSizeof(void *msg);
|
||||
CsrUint8* CsrWifiEventSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void* CsrWifiEventDes(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrWifiEventCsrUint8Sizeof(void *msg);
|
||||
CsrUint8* CsrWifiEventCsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void* CsrWifiEventCsrUint8Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrWifiEventCsrUint16Sizeof(void *msg);
|
||||
CsrUint8* CsrWifiEventCsrUint16Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void* CsrWifiEventCsrUint16Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrWifiEventCsrUint32Sizeof(void *msg);
|
||||
CsrUint8* CsrWifiEventCsrUint32Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void* CsrWifiEventCsrUint32Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
CsrSize CsrWifiEventCsrUint16CsrUint8Sizeof(void *msg);
|
||||
CsrUint8* CsrWifiEventCsrUint16CsrUint8Ser(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
void* CsrWifiEventCsrUint16CsrUint8Des(CsrUint8 *buffer, CsrSize length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_MSGCONV_H__ */
|
49
drivers/staging/csr/csr_wifi_nme_ap_converter_init.h
Normal file
49
drivers/staging/csr/csr_wifi_nme_ap_converter_init.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_AP_CONVERTER_INIT_H__
|
||||
#define CSR_WIFI_NME_AP_CONVERTER_INIT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h
|
||||
#endif
|
||||
#ifndef CSR_WIFI_AP_ENABLE
|
||||
#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_converter_init.h
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_NME_AP_MODULE
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
|
||||
extern const CsrLogPrimitiveInformation* CsrWifiNmeApTechInfoGet(void);
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
|
||||
extern void CsrWifiNmeApConverterInit(void);
|
||||
|
||||
#else /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */
|
||||
|
||||
#define CsrWifiNmeApConverterInit()
|
||||
|
||||
#endif /* EXCLUDE_CSR_WIFI_NME_AP_MODULE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_NME_AP_CONVERTER_INIT_H__ */
|
526
drivers/staging/csr/csr_wifi_nme_ap_lib.h
Normal file
526
drivers/staging/csr/csr_wifi_nme_ap_lib.h
Normal file
|
@ -0,0 +1,526 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_AP_LIB_H__
|
||||
#define CSR_WIFI_NME_AP_LIB_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_util.h"
|
||||
#include "csr_msg_transport.h"
|
||||
|
||||
#include "csr_wifi_lib.h"
|
||||
|
||||
#include "csr_wifi_nme_ap_prim.h"
|
||||
#include "csr_wifi_nme_task.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
|
||||
#endif
|
||||
#ifndef CSR_WIFI_AP_ENABLE
|
||||
#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_lib.h
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiNmeApFreeUpstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free the allocated memory in a CSR_WIFI_NME_AP upstream message. Does not
|
||||
* free the message itself, and can only be used for upstream messages.
|
||||
*
|
||||
* PARAMETERS
|
||||
* Deallocates the resources in a CSR_WIFI_NME_AP upstream message
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiNmeApFreeUpstreamMessageContents(CsrUint16 eventClass, void *message);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiNmeApFreeDownstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free the allocated memory in a CSR_WIFI_NME_AP downstream message. Does not
|
||||
* free the message itself, and can only be used for downstream messages.
|
||||
*
|
||||
* PARAMETERS
|
||||
* Deallocates the resources in a CSR_WIFI_NME_AP downstream message
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiNmeApFreeDownstreamMessageContents(CsrUint16 eventClass, void *message);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Enum to string functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
const CsrCharString* CsrWifiNmeApPersCredentialTypeToString(CsrWifiNmeApPersCredentialType value);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrPrim Type toString function.
|
||||
* Converts a message type to the String name of the Message
|
||||
*----------------------------------------------------------------------------*/
|
||||
const CsrCharString* CsrWifiNmeApPrimTypeToString(CsrPrim msgType);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Lookup arrays for PrimType name Strings
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern const CsrCharString *CsrWifiNmeApUpstreamPrimNames[CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT];
|
||||
extern const CsrCharString *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT];
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApConfigSetReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive passes AP configuration info for NME. This can be sent at
|
||||
any time but will be acted upon when the AP is started again. This
|
||||
information is common to both P2P GO and AP
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
apConfig - AP configuration for the NME.
|
||||
apMacConfig - MAC configuration to be acted on when
|
||||
CSR_WIFI_NME_AP_START.request is sent.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \
|
||||
msg__ = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \
|
||||
msg__->apConfig = (apConfig__); \
|
||||
msg__->apMacConfig = (apMacConfig__);
|
||||
|
||||
#define CsrWifiNmeApConfigSetReqSendTo(dst__, src__, apConfig__, apMacConfig__) \
|
||||
{ \
|
||||
CsrWifiNmeApConfigSetReq *msg__; \
|
||||
CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApConfigSetReqSend(src__, apConfig__, apMacConfig__) \
|
||||
CsrWifiNmeApConfigSetReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, apConfig__, apMacConfig__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApConfigSetCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of the request.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \
|
||||
msg__ = (CsrWifiNmeApConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiNmeApConfigSetCfmSendTo(dst__, src__, status__) \
|
||||
{ \
|
||||
CsrWifiNmeApConfigSetCfm *msg__; \
|
||||
CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApConfigSetCfmSend(dst__, status__) \
|
||||
CsrWifiNmeApConfigSetCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStaRemoveReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive disconnects a connected station. If keepBlocking is set to
|
||||
TRUE, the station with the specified MAC address is not allowed to
|
||||
connect. If the requested station is not already connected,it may be
|
||||
blocked based on keepBlocking parameter.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
staMacAddress - Mac Address of the station to be disconnected or blocked
|
||||
keepBlocking - If TRUE, the station is blocked. If FALSE and the station is
|
||||
connected, disconnect the station. If FALSE and the station
|
||||
is not connected, no action is taken.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
|
||||
msg__ = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->staMacAddress = (staMacAddress__); \
|
||||
msg__->keepBlocking = (keepBlocking__);
|
||||
|
||||
#define CsrWifiNmeApStaRemoveReqSendTo(dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \
|
||||
{ \
|
||||
CsrWifiNmeApStaRemoveReq *msg__; \
|
||||
CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStaRemoveReqSend(src__, interfaceTag__, staMacAddress__, keepBlocking__) \
|
||||
CsrWifiNmeApStaRemoveReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, staMacAddress__, keepBlocking__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStartReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive requests NME to started the AP operation.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
apType - AP Type specifies the Legacy AP or P2P GO operation
|
||||
cloakSsid - Indicates whether the SSID should be cloaked (hidden and
|
||||
not broadcast in beacon) or not
|
||||
ssid - Service Set Identifier
|
||||
ifIndex - Radio interface
|
||||
channel - Channel number of the channel to use
|
||||
apCredentials - Security credential configuration.
|
||||
maxConnections - Maximum number of stations/P2P clients allowed
|
||||
p2pGoParam - P2P specific GO parameters.
|
||||
NOT USED FOR CURRENT RELEASE
|
||||
wpsEnabled - Indicates whether WPS should be enabled or not
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
|
||||
msg__ = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->apType = (apType__); \
|
||||
msg__->cloakSsid = (cloakSsid__); \
|
||||
msg__->ssid = (ssid__); \
|
||||
msg__->ifIndex = (ifIndex__); \
|
||||
msg__->channel = (channel__); \
|
||||
msg__->apCredentials = (apCredentials__); \
|
||||
msg__->maxConnections = (maxConnections__); \
|
||||
msg__->p2pGoParam = (p2pGoParam__); \
|
||||
msg__->wpsEnabled = (wpsEnabled__);
|
||||
|
||||
#define CsrWifiNmeApStartReqSendTo(dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
|
||||
{ \
|
||||
CsrWifiNmeApStartReq *msg__; \
|
||||
CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStartReqSend(src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \
|
||||
CsrWifiNmeApStartReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStartCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of CSR_WIFI_NME_AP_START.request.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
ssid - Service Set Identifier
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \
|
||||
msg__ = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->status = (status__); \
|
||||
msg__->ssid = (ssid__);
|
||||
|
||||
#define CsrWifiNmeApStartCfmSendTo(dst__, src__, interfaceTag__, status__, ssid__) \
|
||||
{ \
|
||||
CsrWifiNmeApStartCfm *msg__; \
|
||||
CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStartCfmSend(dst__, interfaceTag__, status__, ssid__) \
|
||||
CsrWifiNmeApStartCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__, ssid__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStationIndSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive indicates that a station has joined or a previously joined
|
||||
station has left the BSS/group
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
mediaStatus - Indicates whether the station is connected or
|
||||
disconnected
|
||||
peerMacAddress - MAC address of the station
|
||||
peerDeviceAddress - P2P Device Address
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
|
||||
msg__ = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->mediaStatus = (mediaStatus__); \
|
||||
msg__->peerMacAddress = (peerMacAddress__); \
|
||||
msg__->peerDeviceAddress = (peerDeviceAddress__);
|
||||
|
||||
#define CsrWifiNmeApStationIndSendTo(dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
|
||||
{ \
|
||||
CsrWifiNmeApStationInd *msg__; \
|
||||
CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStationIndSend(dst__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \
|
||||
CsrWifiNmeApStationIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive requests NME to stop the AP operation.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \
|
||||
msg__ = (CsrWifiNmeApStopReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__);
|
||||
|
||||
#define CsrWifiNmeApStopReqSendTo(dst__, src__, interfaceTag__) \
|
||||
{ \
|
||||
CsrWifiNmeApStopReq *msg__; \
|
||||
CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStopReqSend(src__, interfaceTag__) \
|
||||
CsrWifiNmeApStopReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopIndSend
|
||||
|
||||
DESCRIPTION
|
||||
Indicates that AP operation had stopped because of some unrecoverable
|
||||
error after AP operation was started successfully. NME sends this signal
|
||||
after failing to restart the AP operation internally following an error
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
apType - Reports AP Type (P2PGO or AP)
|
||||
status - Error Status
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \
|
||||
msg__ = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->apType = (apType__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiNmeApStopIndSendTo(dst__, src__, interfaceTag__, apType__, status__) \
|
||||
{ \
|
||||
CsrWifiNmeApStopInd *msg__; \
|
||||
CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStopIndSend(dst__, interfaceTag__, apType__, status__) \
|
||||
CsrWifiNmeApStopIndSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, apType__, status__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive confirms that the AP operation is stopped. NME shall send
|
||||
this primitive in response to the request even if AP operation has
|
||||
already been stopped
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
|
||||
msg__ = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiNmeApStopCfmSendTo(dst__, src__, interfaceTag__, status__) \
|
||||
{ \
|
||||
CsrWifiNmeApStopCfm *msg__; \
|
||||
CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApStopCfmSend(dst__, interfaceTag__, status__) \
|
||||
CsrWifiNmeApStopCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWmmParamUpdateReqSend
|
||||
|
||||
DESCRIPTION
|
||||
Application uses this primitive to update the WMM parameters
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
wmmApParams - WMM Access point parameters per access category. The array
|
||||
index corresponds to the ACI
|
||||
wmmApBcParams - WMM station parameters per access category to be advertised
|
||||
in the beacons and probe response The array index
|
||||
corresponds to the ACI
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \
|
||||
msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \
|
||||
CsrMemCpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \
|
||||
CsrMemCpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4);
|
||||
|
||||
#define CsrWifiNmeApWmmParamUpdateReqSendTo(dst__, src__, wmmApParams__, wmmApBcParams__) \
|
||||
{ \
|
||||
CsrWifiNmeApWmmParamUpdateReq *msg__; \
|
||||
CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApWmmParamUpdateReqSend(src__, wmmApParams__, wmmApBcParams__) \
|
||||
CsrWifiNmeApWmmParamUpdateReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, wmmApParams__, wmmApBcParams__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWmmParamUpdateCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
A confirm for for the WMM parameters update
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \
|
||||
msg__ = (CsrWifiNmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, src__, status__) \
|
||||
{ \
|
||||
CsrWifiNmeApWmmParamUpdateCfm *msg__; \
|
||||
CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmSend(dst__, status__) \
|
||||
CsrWifiNmeApWmmParamUpdateCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, status__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWpsRegisterReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive allows the NME to accept the WPS registration from an
|
||||
enrollee. Such registration procedure can be cancelled by sending
|
||||
CSR_WIFI_NME_WPS_CANCEL.request.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an
|
||||
interface
|
||||
selectedDevicePasswordId - Selected password type
|
||||
selectedConfigMethod - Selected WPS configuration method type
|
||||
pin - PIN value.
|
||||
Relevant if selected device password ID is PIN.4
|
||||
digit pin is passed by sending the pin digits in
|
||||
pin[0]..pin[3] and rest of the contents filled
|
||||
with '-'.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
|
||||
msg__ = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \
|
||||
msg__->selectedConfigMethod = (selectedConfigMethod__); \
|
||||
CsrMemCpy(msg__->pin, (pin__), sizeof(CsrUint8) * 8);
|
||||
|
||||
#define CsrWifiNmeApWpsRegisterReqSendTo(dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
|
||||
{ \
|
||||
CsrWifiNmeApWpsRegisterReq *msg__; \
|
||||
CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApWpsRegisterReqSend(src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \
|
||||
CsrWifiNmeApWpsRegisterReqSendTo(CSR_WIFI_NME_IFACEQUEUE, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWpsRegisterCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of WPS procedure.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
|
||||
msg__ = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiNmeApWpsRegisterCfmSendTo(dst__, src__, interfaceTag__, status__) \
|
||||
{ \
|
||||
CsrWifiNmeApWpsRegisterCfm *msg__; \
|
||||
CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_NME_AP_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiNmeApWpsRegisterCfmSend(dst__, interfaceTag__, status__) \
|
||||
CsrWifiNmeApWpsRegisterCfmSendTo(dst__, CSR_WIFI_NME_IFACEQUEUE, interfaceTag__, status__)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_NME_AP_LIB_H__ */
|
504
drivers/staging/csr/csr_wifi_nme_ap_prim.h
Normal file
504
drivers/staging/csr/csr_wifi_nme_ap_prim.h
Normal file
|
@ -0,0 +1,504 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_AP_PRIM_H__
|
||||
#define CSR_WIFI_NME_AP_PRIM_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_wifi_common.h"
|
||||
#include "csr_result.h"
|
||||
#include "csr_wifi_fsm_event.h"
|
||||
#include "csr_wifi_sme_ap_prim.h"
|
||||
#include "csr_wifi_nme_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h
|
||||
#endif
|
||||
#ifndef CSR_WIFI_AP_ENABLE
|
||||
#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_prim.h
|
||||
#endif
|
||||
|
||||
#define CSR_WIFI_NME_AP_PRIM (0x0426)
|
||||
|
||||
typedef CsrPrim CsrWifiNmeApPrim;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApPersCredentialType
|
||||
|
||||
DESCRIPTION
|
||||
NME Credential Types
|
||||
|
||||
VALUES
|
||||
CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK
|
||||
- Use PSK as credential.
|
||||
CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE
|
||||
- Use the specified passphrase as credential
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint8 CsrWifiNmeApPersCredentialType;
|
||||
#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PSK ((CsrWifiNmeApPersCredentialType) 0x00)
|
||||
#define CSR_WIFI_NME_AP_CREDENTIAL_TYPE_PASSPHRASE ((CsrWifiNmeApPersCredentialType) 0x01)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApConfig
|
||||
|
||||
DESCRIPTION
|
||||
Structure holding AP config data.
|
||||
|
||||
MEMBERS
|
||||
apGroupkeyTimeout - Access point group key timeout.
|
||||
apStrictGtkRekey - Access point strict GTK rekey flag. If set TRUE, the AP
|
||||
shall rekey GTK every time a connected STA leaves BSS.
|
||||
apGmkTimeout - Access point GMK timeout
|
||||
apResponseTimeout - Response timeout
|
||||
apRetransLimit - Max allowed retransmissions
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrUint16 apGroupkeyTimeout;
|
||||
CsrBool apStrictGtkRekey;
|
||||
CsrUint16 apGmkTimeout;
|
||||
CsrUint16 apResponseTimeout;
|
||||
CsrUint8 apRetransLimit;
|
||||
} CsrWifiNmeApConfig;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApAuthPers
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
MEMBERS
|
||||
authSupport - Credential type value (as defined in the
|
||||
enumeration type).
|
||||
rsnCapabilities - RSN capabilities mask
|
||||
wapiCapabilities - WAPI capabilities mask
|
||||
pskOrPassphrase - Credential type value (as defined in the
|
||||
enumeration type).
|
||||
authPers_credentials - Union containing credentials which depends
|
||||
on credentialType parameter.
|
||||
authPers_credentialspsk -
|
||||
authPers_credentialspassphrase -
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiSmeApAuthSupportMask authSupport;
|
||||
CsrWifiSmeApRsnCapabilitiesMask rsnCapabilities;
|
||||
CsrWifiSmeApWapiCapabilitiesMask wapiCapabilities;
|
||||
CsrWifiNmeApPersCredentialType pskOrPassphrase;
|
||||
union {
|
||||
CsrWifiNmePsk psk;
|
||||
CsrWifiNmePassphrase passphrase;
|
||||
} authPers_credentials;
|
||||
} CsrWifiNmeApAuthPers;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApCredentials
|
||||
|
||||
DESCRIPTION
|
||||
Structure containing the Credentials data.
|
||||
|
||||
MEMBERS
|
||||
authType - Authentication type
|
||||
nmeAuthType - Authentication parameters
|
||||
nmeAuthTypeopenSystemEmpty -
|
||||
nmeAuthTypeauthwep -
|
||||
nmeAuthTypeauthTypePersonal -
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiSmeApAuthType authType;
|
||||
union {
|
||||
CsrWifiSmeEmpty openSystemEmpty;
|
||||
CsrWifiSmeWepAuth authwep;
|
||||
CsrWifiNmeApAuthPers authTypePersonal;
|
||||
} nmeAuthType;
|
||||
} CsrWifiNmeApCredentials;
|
||||
|
||||
|
||||
/* Downstream */
|
||||
#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST (0x0000)
|
||||
|
||||
#define CSR_WIFI_NME_AP_CONFIG_SET_REQ ((CsrWifiNmeApPrim) (0x0000 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_WPS_REGISTER_REQ ((CsrWifiNmeApPrim) (0x0001 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_START_REQ ((CsrWifiNmeApPrim) (0x0002 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_STOP_REQ ((CsrWifiNmeApPrim) (0x0003 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ ((CsrWifiNmeApPrim) (0x0004 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_STA_REMOVE_REQ ((CsrWifiNmeApPrim) (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST))
|
||||
|
||||
|
||||
#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST (0x0005 + CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)
|
||||
|
||||
/* Upstream */
|
||||
#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
|
||||
|
||||
#define CSR_WIFI_NME_AP_CONFIG_SET_CFM ((CsrWifiNmeApPrim)(0x0000 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_WPS_REGISTER_CFM ((CsrWifiNmeApPrim)(0x0001 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_START_CFM ((CsrWifiNmeApPrim)(0x0002 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_STOP_CFM ((CsrWifiNmeApPrim)(0x0003 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_STOP_IND ((CsrWifiNmeApPrim)(0x0004 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM ((CsrWifiNmeApPrim)(0x0005 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_NME_AP_STATION_IND ((CsrWifiNmeApPrim)(0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST))
|
||||
|
||||
#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST (0x0006 + CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)
|
||||
|
||||
#define CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_DOWNSTREAM_LOWEST)
|
||||
#define CSR_WIFI_NME_AP_PRIM_UPSTREAM_COUNT (CSR_WIFI_NME_AP_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_NME_AP_PRIM_UPSTREAM_LOWEST)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApConfigSetReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive passes AP configuration info for NME. This can be sent at
|
||||
any time but will be acted upon when the AP is started again. This
|
||||
information is common to both P2P GO and AP
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
apConfig - AP configuration for the NME.
|
||||
apMacConfig - MAC configuration to be acted on when
|
||||
CSR_WIFI_NME_AP_START.request is sent.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrWifiNmeApConfig apConfig;
|
||||
CsrWifiSmeApMacConfig apMacConfig;
|
||||
} CsrWifiNmeApConfigSetReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWpsRegisterReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive allows the NME to accept the WPS registration from an
|
||||
enrollee. Such registration procedure can be cancelled by sending
|
||||
CSR_WIFI_NME_WPS_CANCEL.request.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an
|
||||
interface
|
||||
selectedDevicePasswordId - Selected password type
|
||||
selectedConfigMethod - Selected WPS configuration method type
|
||||
pin - PIN value.
|
||||
Relevant if selected device password ID is PIN.4
|
||||
digit pin is passed by sending the pin digits in
|
||||
pin[0]..pin[3] and rest of the contents filled
|
||||
with '-'.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiSmeWpsDpid selectedDevicePasswordId;
|
||||
CsrWifiSmeWpsConfigType selectedConfigMethod;
|
||||
CsrUint8 pin[8];
|
||||
} CsrWifiNmeApWpsRegisterReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStartReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive requests NME to started the AP operation.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
apType - AP Type specifies the Legacy AP or P2P GO operation
|
||||
cloakSsid - Indicates whether the SSID should be cloaked (hidden and
|
||||
not broadcast in beacon) or not
|
||||
ssid - Service Set Identifier
|
||||
ifIndex - Radio interface
|
||||
channel - Channel number of the channel to use
|
||||
apCredentials - Security credential configuration.
|
||||
maxConnections - Maximum number of stations/P2P clients allowed
|
||||
p2pGoParam - P2P specific GO parameters.
|
||||
NOT USED FOR CURRENT RELEASE
|
||||
wpsEnabled - Indicates whether WPS should be enabled or not
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiSmeApType apType;
|
||||
CsrBool cloakSsid;
|
||||
CsrWifiSsid ssid;
|
||||
CsrWifiSmeRadioIF ifIndex;
|
||||
CsrUint8 channel;
|
||||
CsrWifiNmeApCredentials apCredentials;
|
||||
CsrUint8 maxConnections;
|
||||
CsrWifiSmeApP2pGoConfig p2pGoParam;
|
||||
CsrBool wpsEnabled;
|
||||
} CsrWifiNmeApStartReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive requests NME to stop the AP operation.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
} CsrWifiNmeApStopReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWmmParamUpdateReq
|
||||
|
||||
DESCRIPTION
|
||||
Application uses this primitive to update the WMM parameters
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
wmmApParams - WMM Access point parameters per access category. The array
|
||||
index corresponds to the ACI
|
||||
wmmApBcParams - WMM station parameters per access category to be advertised
|
||||
in the beacons and probe response The array index
|
||||
corresponds to the ACI
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrWifiSmeWmmAcParams wmmApParams[4];
|
||||
CsrWifiSmeWmmAcParams wmmApBcParams[4];
|
||||
} CsrWifiNmeApWmmParamUpdateReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStaRemoveReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive disconnects a connected station. If keepBlocking is set to
|
||||
TRUE, the station with the specified MAC address is not allowed to
|
||||
connect. If the requested station is not already connected,it may be
|
||||
blocked based on keepBlocking parameter.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
staMacAddress - Mac Address of the station to be disconnected or blocked
|
||||
keepBlocking - If TRUE, the station is blocked. If FALSE and the station is
|
||||
connected, disconnect the station. If FALSE and the station
|
||||
is not connected, no action is taken.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiMacAddress staMacAddress;
|
||||
CsrBool keepBlocking;
|
||||
} CsrWifiNmeApStaRemoveReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApConfigSetCfm
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of the request.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrResult status;
|
||||
} CsrWifiNmeApConfigSetCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWpsRegisterCfm
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of WPS procedure.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrResult status;
|
||||
} CsrWifiNmeApWpsRegisterCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStartCfm
|
||||
|
||||
DESCRIPTION
|
||||
This primitive reports the result of CSR_WIFI_NME_AP_START.request.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
ssid - Service Set Identifier
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrResult status;
|
||||
CsrWifiSsid ssid;
|
||||
} CsrWifiNmeApStartCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopCfm
|
||||
|
||||
DESCRIPTION
|
||||
This primitive confirms that the AP operation is stopped. NME shall send
|
||||
this primitive in response to the request even if AP operation has
|
||||
already been stopped
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface identifier; unique identifier of an interface
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrResult status;
|
||||
} CsrWifiNmeApStopCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStopInd
|
||||
|
||||
DESCRIPTION
|
||||
Indicates that AP operation had stopped because of some unrecoverable
|
||||
error after AP operation was started successfully. NME sends this signal
|
||||
after failing to restart the AP operation internally following an error
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
apType - Reports AP Type (P2PGO or AP)
|
||||
status - Error Status
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiSmeApType apType;
|
||||
CsrResult status;
|
||||
} CsrWifiNmeApStopInd;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApWmmParamUpdateCfm
|
||||
|
||||
DESCRIPTION
|
||||
A confirm for for the WMM parameters update
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
status - Status of the request.
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrResult status;
|
||||
} CsrWifiNmeApWmmParamUpdateCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiNmeApStationInd
|
||||
|
||||
DESCRIPTION
|
||||
This primitive indicates that a station has joined or a previously joined
|
||||
station has left the BSS/group
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
mediaStatus - Indicates whether the station is connected or
|
||||
disconnected
|
||||
peerMacAddress - MAC address of the station
|
||||
peerDeviceAddress - P2P Device Address
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiSmeMediaStatus mediaStatus;
|
||||
CsrWifiMacAddress peerMacAddress;
|
||||
CsrWifiMacAddress peerDeviceAddress;
|
||||
} CsrWifiNmeApStationInd;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_NME_AP_PRIM_H__ */
|
||||
|
30
drivers/staging/csr/csr_wifi_nme_ap_sef.c
Normal file
30
drivers/staging/csr/csr_wifi_nme_ap_sef.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*****************************************************************************
|
||||
|
||||
FILE: csr_wifi_nme_sef.c
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_wifi_nme_ap_sef.h"
|
||||
#include "unifi_priv.h"
|
||||
|
||||
void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg)
|
||||
{
|
||||
switch(msg->type) {
|
||||
case CSR_WIFI_NME_AP_START_CFM:
|
||||
CsrWifiNmeApStartCfmHandler(drvpriv, msg);
|
||||
break;
|
||||
case CSR_WIFI_NME_AP_STOP_CFM:
|
||||
CsrWifiNmeApStopCfmHandler(drvpriv, msg);
|
||||
break;
|
||||
case CSR_WIFI_NME_AP_CONFIG_SET_CFM:
|
||||
CsrWifiNmeApConfigSetCfmHandler(drvpriv,msg);
|
||||
break;
|
||||
default:
|
||||
unifi_error(drvpriv, "CsrWifiNmeApUpstreamStateHandlers: unhandled NME_AP message type 0x%.4X\n",msg->type);
|
||||
break;
|
||||
}
|
||||
}
|
31
drivers/staging/csr/csr_wifi_nme_ap_sef.h
Normal file
31
drivers/staging/csr/csr_wifi_nme_ap_sef.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*****************************************************************************
|
||||
FILE: csr_wifi_nme_sef.h
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__
|
||||
#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__
|
||||
|
||||
#include "csr_wifi_nme_prim.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CsrWifiNmeApUpstreamStateHandlers(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
|
||||
|
||||
extern void CsrWifiNmeApConfigSetCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiNmeApStartCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiNmeApStopCfmHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_NME_H__ */
|
105
drivers/staging/csr/csr_wifi_nme_ap_serialize.h
Normal file
105
drivers/staging/csr/csr_wifi_nme_ap_serialize.h
Normal file
|
@ -0,0 +1,105 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_AP_SERIALIZE_H__
|
||||
#define CSR_WIFI_NME_AP_SERIALIZE_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_msgconv.h"
|
||||
|
||||
#include "csr_wifi_nme_ap_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h
|
||||
#endif
|
||||
#ifndef CSR_WIFI_AP_ENABLE
|
||||
#error CSR_WIFI_AP_ENABLE MUST be defined inorder to use csr_wifi_nme_ap_serialize.h
|
||||
#endif
|
||||
|
||||
extern void CsrWifiNmeApPfree(void *ptr);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApConfigSetReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApConfigSetReqSizeof(void *msg);
|
||||
extern void CsrWifiNmeApConfigSetReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApWpsRegisterReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApWpsRegisterReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApWpsRegisterReqSizeof(void *msg);
|
||||
#define CsrWifiNmeApWpsRegisterReqSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStartReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStartReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStartReqSizeof(void *msg);
|
||||
extern void CsrWifiNmeApStartReqSerFree(void *msg);
|
||||
|
||||
#define CsrWifiNmeApStopReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeApStopReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeApStopReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeApStopReqSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApWmmParamUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApWmmParamUpdateReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApWmmParamUpdateReqSizeof(void *msg);
|
||||
#define CsrWifiNmeApWmmParamUpdateReqSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStaRemoveReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStaRemoveReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStaRemoveReqSizeof(void *msg);
|
||||
#define CsrWifiNmeApStaRemoveReqSerFree CsrWifiNmeApPfree
|
||||
|
||||
#define CsrWifiNmeApConfigSetCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeApConfigSetCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeApConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeApConfigSetCfmSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApWpsRegisterCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApWpsRegisterCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApWpsRegisterCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeApWpsRegisterCfmSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStartCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStartCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStartCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeApStartCfmSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStopCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStopCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStopCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeApStopCfmSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStopIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStopIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStopIndSizeof(void *msg);
|
||||
#define CsrWifiNmeApStopIndSerFree CsrWifiNmeApPfree
|
||||
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeApWmmParamUpdateCfmSerFree CsrWifiNmeApPfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeApStationIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeApStationIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeApStationIndSizeof(void *msg);
|
||||
#define CsrWifiNmeApStationIndSerFree CsrWifiNmeApPfree
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CSR_WIFI_NME_AP_SERIALIZE_H__ */
|
||||
|
46
drivers/staging/csr/csr_wifi_nme_converter_init.h
Normal file
46
drivers/staging/csr/csr_wifi_nme_converter_init.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_CONVERTER_INIT_H__
|
||||
#define CSR_WIFI_NME_CONVERTER_INIT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_converter_init.h
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_NME_MODULE
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
|
||||
extern const CsrLogPrimitiveInformation* CsrWifiNmeTechInfoGet(void);
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
|
||||
extern void CsrWifiNmeConverterInit(void);
|
||||
|
||||
#else /* EXCLUDE_CSR_WIFI_NME_MODULE */
|
||||
|
||||
#define CsrWifiNmeConverterInit()
|
||||
|
||||
#endif /* EXCLUDE_CSR_WIFI_NME_MODULE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_NME_CONVERTER_INIT_H__ */
|
1056
drivers/staging/csr/csr_wifi_nme_lib.h
Normal file
1056
drivers/staging/csr/csr_wifi_nme_lib.h
Normal file
File diff suppressed because it is too large
Load diff
1666
drivers/staging/csr/csr_wifi_nme_prim.h
Normal file
1666
drivers/staging/csr/csr_wifi_nme_prim.h
Normal file
File diff suppressed because it is too large
Load diff
177
drivers/staging/csr/csr_wifi_nme_serialize.h
Normal file
177
drivers/staging/csr/csr_wifi_nme_serialize.h
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_SERIALIZE_H__
|
||||
#define CSR_WIFI_NME_SERIALIZE_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_msgconv.h"
|
||||
|
||||
#include "csr_wifi_nme_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_serialize.h
|
||||
#endif
|
||||
|
||||
extern void CsrWifiNmePfree(void *ptr);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileSetReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileSetReqSizeof(void *msg);
|
||||
extern void CsrWifiNmeProfileSetReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileDeleteReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileDeleteReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileDeleteReqSizeof(void *msg);
|
||||
#define CsrWifiNmeProfileDeleteReqSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeProfileDeleteAllReqSer CsrWifiEventSer
|
||||
#define CsrWifiNmeProfileDeleteAllReqDes CsrWifiEventDes
|
||||
#define CsrWifiNmeProfileDeleteAllReqSizeof CsrWifiEventSizeof
|
||||
#define CsrWifiNmeProfileDeleteAllReqSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileOrderSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileOrderSetReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileOrderSetReqSizeof(void *msg);
|
||||
extern void CsrWifiNmeProfileOrderSetReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileConnectReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileConnectReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileConnectReqSizeof(void *msg);
|
||||
#define CsrWifiNmeProfileConnectReqSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeWpsReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeWpsReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeWpsReqSizeof(void *msg);
|
||||
#define CsrWifiNmeWpsReqSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeWpsCancelReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeWpsCancelReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeWpsCancelReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeWpsCancelReqSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeConnectionStatusGetReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeConnectionStatusGetReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeConnectionStatusGetReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeConnectionStatusGetReqSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeSimImsiGetResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeSimImsiGetResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeSimImsiGetResSizeof(void *msg);
|
||||
extern void CsrWifiNmeSimImsiGetResSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeSimGsmAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeSimGsmAuthResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeSimGsmAuthResSizeof(void *msg);
|
||||
extern void CsrWifiNmeSimGsmAuthResSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeSimUmtsAuthResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeSimUmtsAuthResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeSimUmtsAuthResSizeof(void *msg);
|
||||
extern void CsrWifiNmeSimUmtsAuthResSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeWpsConfigSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeWpsConfigSetReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeWpsConfigSetReqSizeof(void *msg);
|
||||
extern void CsrWifiNmeWpsConfigSetReqSerFree(void *msg);
|
||||
|
||||
#define CsrWifiNmeEventMaskSetReqSer CsrWifiEventCsrUint32Ser
|
||||
#define CsrWifiNmeEventMaskSetReqDes CsrWifiEventCsrUint32Des
|
||||
#define CsrWifiNmeEventMaskSetReqSizeof CsrWifiEventCsrUint32Sizeof
|
||||
#define CsrWifiNmeEventMaskSetReqSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeProfileSetCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeProfileSetCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeProfileSetCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeProfileSetCfmSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeProfileDeleteCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeProfileDeleteCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeProfileDeleteCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeProfileDeleteCfmSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeProfileDeleteAllCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeProfileDeleteAllCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeProfileDeleteAllCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeProfileDeleteAllCfmSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileOrderSetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileOrderSetCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileOrderSetCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeProfileOrderSetCfmSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileConnectCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileConnectCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileConnectCfmSizeof(void *msg);
|
||||
extern void CsrWifiNmeProfileConnectCfmSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeWpsCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeWpsCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeWpsCfmSizeof(void *msg);
|
||||
extern void CsrWifiNmeWpsCfmSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeWpsCancelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeWpsCancelCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeWpsCancelCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeWpsCancelCfmSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeConnectionStatusGetCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeConnectionStatusGetCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeConnectionStatusGetCfmSizeof(void *msg);
|
||||
#define CsrWifiNmeConnectionStatusGetCfmSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileUpdateIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileUpdateIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileUpdateIndSizeof(void *msg);
|
||||
extern void CsrWifiNmeProfileUpdateIndSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeProfileDisconnectIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeProfileDisconnectIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeProfileDisconnectIndSizeof(void *msg);
|
||||
extern void CsrWifiNmeProfileDisconnectIndSerFree(void *msg);
|
||||
|
||||
#define CsrWifiNmeSimImsiGetIndSer CsrWifiEventSer
|
||||
#define CsrWifiNmeSimImsiGetIndDes CsrWifiEventDes
|
||||
#define CsrWifiNmeSimImsiGetIndSizeof CsrWifiEventSizeof
|
||||
#define CsrWifiNmeSimImsiGetIndSerFree CsrWifiNmePfree
|
||||
|
||||
extern CsrUint8* CsrWifiNmeSimGsmAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeSimGsmAuthIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeSimGsmAuthIndSizeof(void *msg);
|
||||
extern void CsrWifiNmeSimGsmAuthIndSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiNmeSimUmtsAuthIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiNmeSimUmtsAuthIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiNmeSimUmtsAuthIndSizeof(void *msg);
|
||||
#define CsrWifiNmeSimUmtsAuthIndSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeWpsConfigSetCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeWpsConfigSetCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeWpsConfigSetCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeWpsConfigSetCfmSerFree CsrWifiNmePfree
|
||||
|
||||
#define CsrWifiNmeEventMaskSetCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiNmeEventMaskSetCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiNmeEventMaskSetCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiNmeEventMaskSetCfmSerFree CsrWifiNmePfree
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CSR_WIFI_NME_SERIALIZE_H__ */
|
||||
|
38
drivers/staging/csr/csr_wifi_nme_task.h
Normal file
38
drivers/staging/csr/csr_wifi_nme_task.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_NME_TASK_H__
|
||||
#define CSR_WIFI_NME_TASK_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef CSR_WIFI_NME_ENABLE
|
||||
#error CSR_WIFI_NME_ENABLE MUST be defined inorder to use csr_wifi_nme_task.h
|
||||
#endif
|
||||
|
||||
#define CSR_WIFI_NME_LOG_ID 0x1203FFFF
|
||||
extern CsrSchedQid CSR_WIFI_NME_IFACEQUEUE;
|
||||
void CsrWifiNmeInit(void **gash);
|
||||
void CsrWifiNmeDeinit(void **gash);
|
||||
void CsrWifiNmeHandler(void **gash);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_NME_TASK_H__ */
|
||||
|
91
drivers/staging/csr/csr_wifi_private_common.h
Normal file
91
drivers/staging/csr/csr_wifi_private_common.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_PRIVATE_COMMON_H__
|
||||
#define CSR_WIFI_PRIVATE_COMMON_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief maximum number of STAs allowed to be connected
|
||||
*
|
||||
* @par Description
|
||||
* min & max Beacon Interval
|
||||
*/
|
||||
#define CSR_WIFI_AP_MAX_ASSOC_STA 8
|
||||
|
||||
/** Number of only b rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_ONLY_B_RATES 4
|
||||
|
||||
|
||||
/** Number of mandatory b rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_MANDATORY_B_RATES 2
|
||||
|
||||
|
||||
/** Number of mandatory bg rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_MANDATORY_BG_RATES 4
|
||||
|
||||
|
||||
/** Number of bg rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_BG_RATES 12
|
||||
|
||||
|
||||
/** Number of no b only g rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_NO_B_ONLY_G_RATES 8
|
||||
|
||||
|
||||
/** Number of mandatory g rates */
|
||||
#define CSR_WIFI_SME_AP_MAX_MANDATORY_G_RATES 7
|
||||
|
||||
|
||||
/* Number of g mandatory rates */
|
||||
#define CSR_WIFI_SME_AP_G_MANDATORY_RATES_NUM 7
|
||||
|
||||
|
||||
/* Number of b mandatory rates */
|
||||
#define CSR_WIFI_SME_AP_B_MANDATORY_RATES_NUM 2
|
||||
|
||||
|
||||
/* Number of b/g mandatory rates */
|
||||
#define CSR_WIFI_SME_AP_BG_MANDATORY_RATES_NUM 4
|
||||
|
||||
|
||||
/* The maximum allowed length of SSID */
|
||||
#define CSR_WIFI_SME_AP_SSID_MAX_LENGTH 32
|
||||
|
||||
/* Refer 8.4.2.27 RSN element - we support TKIP, WPA2, WAPI and PSK only, no pmkid, group cipher suite */
|
||||
#define CSR_WIFI_SME_RSN_PACKED_SIZE (1 + 1 + 2 + 4 + 2 + 4 * 2 + 2 + 4 * 1 + 2 + 24)
|
||||
|
||||
/* Refer 7.3.2.9 (ISO/IEC 8802-11:2006) WAPI element - we support WAPI PSK only, no bkid, group cipher suite */
|
||||
#define CSR_WIFI_SME_WAPI_PACKED_SIZE (1 + 1 + 2 + 2 + 4 * 1 + 2 + 4 * 1 + 4 + 2 + 24)
|
||||
|
||||
|
||||
/* Common structure for NME and SME to maintain Interface mode*/
|
||||
typedef CsrUint8 CsrWifiInterfaceMode;
|
||||
#define CSR_WIFI_MODE_NONE ((CsrWifiInterfaceMode) 0xFF)
|
||||
#define CSR_WIFI_MODE_STA ((CsrWifiInterfaceMode) 0x00)
|
||||
#define CSR_WIFI_MODE_AP ((CsrWifiInterfaceMode) 0x01)
|
||||
#define CSR_WIFI_MODE_P2P_DEVICE ((CsrWifiInterfaceMode) 0x02)
|
||||
#define CSR_WIFI_MODE_P2P_CLI ((CsrWifiInterfaceMode) 0x03)
|
||||
#define CSR_WIFI_MODE_P2P_GO ((CsrWifiInterfaceMode) 0x04)
|
||||
#define CSR_WIFI_MODE_AMP ((CsrWifiInterfaceMode) 0x05)
|
||||
#define CSR_WIFI_MODE_WPS_ENROLLEE ((CsrWifiInterfaceMode) 0x06)
|
||||
#define CSR_WIFI_MODE_IBSS ((CsrWifiInterfaceMode) 0x07)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
36
drivers/staging/csr/csr_wifi_result.h
Normal file
36
drivers/staging/csr/csr_wifi_result.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CSR_WIFI_RESULT_H__
|
||||
#define CSR_WIFI_RESULT_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_result.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* THIS FILE SHOULD CONTAIN ONLY RESULT CODES */
|
||||
|
||||
/* Result Codes */
|
||||
#define CSR_WIFI_HIP_RESULT_INVALID_VALUE ((CsrResult) 1) /* Invalid argument value */
|
||||
#define CSR_WIFI_HIP_RESULT_NO_DEVICE ((CsrResult) 2) /* The specified device is no longer present */
|
||||
#define CSR_WIFI_HIP_RESULT_NO_SPACE ((CsrResult) 3) /* A queue or buffer is full */
|
||||
#define CSR_WIFI_HIP_RESULT_NO_MEMORY ((CsrResult) 4) /* Fatal error, no memory */
|
||||
#define CSR_WIFI_HIP_RESULT_RANGE ((CsrResult) 5) /* Request exceeds the range of a file or a buffer */
|
||||
#define CSR_WIFI_HIP_RESULT_NOT_FOUND ((CsrResult) 6) /* A file (typically a f/w patch) is not found */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_RESULT_H__ */
|
||||
|
83
drivers/staging/csr/csr_wifi_router_converter_init.c
Normal file
83
drivers/staging/csr/csr_wifi_router_converter_init.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE
|
||||
#include "csr_wifi_router_serialize.h"
|
||||
#include "csr_wifi_router_prim.h"
|
||||
|
||||
static CsrMsgConvMsgEntry csrwifirouter_conv_lut[] = {
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, CsrWifiRouterMaPacketSubscribeReqSizeof, CsrWifiRouterMaPacketSubscribeReqSer, CsrWifiRouterMaPacketSubscribeReqDes, CsrWifiRouterMaPacketSubscribeReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, CsrWifiRouterMaPacketUnsubscribeReqSizeof, CsrWifiRouterMaPacketUnsubscribeReqSer, CsrWifiRouterMaPacketUnsubscribeReqDes, CsrWifiRouterMaPacketUnsubscribeReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_REQ, CsrWifiRouterMaPacketReqSizeof, CsrWifiRouterMaPacketReqSer, CsrWifiRouterMaPacketReqDes, CsrWifiRouterMaPacketReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_RES, CsrWifiRouterMaPacketResSizeof, CsrWifiRouterMaPacketResSer, CsrWifiRouterMaPacketResDes, CsrWifiRouterMaPacketResSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, CsrWifiRouterMaPacketCancelReqSizeof, CsrWifiRouterMaPacketCancelReqSer, CsrWifiRouterMaPacketCancelReqDes, CsrWifiRouterMaPacketCancelReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, CsrWifiRouterMaPacketSubscribeCfmSizeof, CsrWifiRouterMaPacketSubscribeCfmSer, CsrWifiRouterMaPacketSubscribeCfmDes, CsrWifiRouterMaPacketSubscribeCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, CsrWifiRouterMaPacketUnsubscribeCfmSizeof, CsrWifiRouterMaPacketUnsubscribeCfmSer, CsrWifiRouterMaPacketUnsubscribeCfmDes, CsrWifiRouterMaPacketUnsubscribeCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_CFM, CsrWifiRouterMaPacketCfmSizeof, CsrWifiRouterMaPacketCfmSer, CsrWifiRouterMaPacketCfmDes, CsrWifiRouterMaPacketCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_MA_PACKET_IND, CsrWifiRouterMaPacketIndSizeof, CsrWifiRouterMaPacketIndSer, CsrWifiRouterMaPacketIndDes, CsrWifiRouterMaPacketIndSerFree },
|
||||
|
||||
{ 0, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
CsrMsgConvMsgEntry* CsrWifiRouterConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType)
|
||||
{
|
||||
if (msgType & CSR_PRIM_UPSTREAM)
|
||||
{
|
||||
CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT;
|
||||
if (index < (CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT) &&
|
||||
csrwifirouter_conv_lut[index].msgType == msgType)
|
||||
{
|
||||
return &csrwifirouter_conv_lut[index];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (msgType < CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT &&
|
||||
csrwifirouter_conv_lut[msgType].msgType == msgType)
|
||||
{
|
||||
return &csrwifirouter_conv_lut[msgType];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CsrWifiRouterConverterInit(void)
|
||||
{
|
||||
CsrMsgConvInsert(CSR_WIFI_ROUTER_PRIM, csrwifirouter_conv_lut);
|
||||
CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_PRIM, CsrWifiRouterConverterLookup);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
static const CsrLogPrimitiveInformation csrwifirouter_conv_info = {
|
||||
CSR_WIFI_ROUTER_PRIM,
|
||||
(CsrCharString *)"CSR_WIFI_ROUTER_PRIM",
|
||||
csrwifirouter_conv_lut
|
||||
};
|
||||
const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void)
|
||||
{
|
||||
return &csrwifirouter_conv_info;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
|
42
drivers/staging/csr/csr_wifi_router_converter_init.h
Normal file
42
drivers/staging/csr/csr_wifi_router_converter_init.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_CONVERTER_INIT_H__
|
||||
#define CSR_WIFI_ROUTER_CONVERTER_INIT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_ROUTER_MODULE
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
|
||||
extern const CsrLogPrimitiveInformation* CsrWifiRouterTechInfoGet(void);
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
|
||||
extern void CsrWifiRouterConverterInit(void);
|
||||
|
||||
#else /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
|
||||
|
||||
#define CsrWifiRouterConverterInit()
|
||||
|
||||
#endif /* EXCLUDE_CSR_WIFI_ROUTER_MODULE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_CONVERTER_INIT_H__ */
|
132
drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c
Normal file
132
drivers/staging/csr/csr_wifi_router_ctrl_converter_init.c
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_util.h"
|
||||
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE
|
||||
#include "csr_wifi_router_ctrl_serialize.h"
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
|
||||
static CsrMsgConvMsgEntry csrwifirouterctrl_conv_lut[] = {
|
||||
{ CSR_WIFI_ROUTER_CTRL_CONFIGURE_POWER_MODE_REQ, CsrWifiRouterCtrlConfigurePowerModeReqSizeof, CsrWifiRouterCtrlConfigurePowerModeReqSer, CsrWifiRouterCtrlConfigurePowerModeReqDes, CsrWifiRouterCtrlConfigurePowerModeReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_HIP_REQ, CsrWifiRouterCtrlHipReqSizeof, CsrWifiRouterCtrlHipReqSer, CsrWifiRouterCtrlHipReqDes, CsrWifiRouterCtrlHipReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_MEDIA_STATUS_REQ, CsrWifiRouterCtrlMediaStatusReqSizeof, CsrWifiRouterCtrlMediaStatusReqSer, CsrWifiRouterCtrlMediaStatusReqDes, CsrWifiRouterCtrlMediaStatusReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES, CsrWifiRouterCtrlMulticastAddressResSizeof, CsrWifiRouterCtrlMulticastAddressResSer, CsrWifiRouterCtrlMulticastAddressResDes, CsrWifiRouterCtrlMulticastAddressResSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_REQ, CsrWifiRouterCtrlPortConfigureReqSizeof, CsrWifiRouterCtrlPortConfigureReqSer, CsrWifiRouterCtrlPortConfigureReqDes, CsrWifiRouterCtrlPortConfigureReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_QOS_CONTROL_REQ, CsrWifiRouterCtrlQosControlReqSizeof, CsrWifiRouterCtrlQosControlReqSer, CsrWifiRouterCtrlQosControlReqDes, CsrWifiRouterCtrlQosControlReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_SUSPEND_RES, CsrWifiRouterCtrlSuspendResSizeof, CsrWifiRouterCtrlSuspendResSer, CsrWifiRouterCtrlSuspendResDes, CsrWifiRouterCtrlSuspendResSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ, CsrWifiRouterCtrlTclasAddReqSizeof, CsrWifiRouterCtrlTclasAddReqSer, CsrWifiRouterCtrlTclasAddReqDes, CsrWifiRouterCtrlTclasAddReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RESUME_RES, CsrWifiRouterCtrlResumeResSizeof, CsrWifiRouterCtrlResumeResSer, CsrWifiRouterCtrlResumeResDes, CsrWifiRouterCtrlResumeResSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_REQ, CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseReqSer, CsrWifiRouterCtrlRawSdioDeinitialiseReqDes, CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_REQ, CsrWifiRouterCtrlRawSdioInitialiseReqSizeof, CsrWifiRouterCtrlRawSdioInitialiseReqSer, CsrWifiRouterCtrlRawSdioInitialiseReqDes, CsrWifiRouterCtrlRawSdioInitialiseReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ, CsrWifiRouterCtrlTclasDelReqSizeof, CsrWifiRouterCtrlTclasDelReqSer, CsrWifiRouterCtrlTclasDelReqDes, CsrWifiRouterCtrlTclasDelReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TRAFFIC_CLASSIFICATION_REQ, CsrWifiRouterCtrlTrafficClassificationReqSizeof, CsrWifiRouterCtrlTrafficClassificationReqSer, CsrWifiRouterCtrlTrafficClassificationReqDes, CsrWifiRouterCtrlTrafficClassificationReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TRAFFIC_CONFIG_REQ, CsrWifiRouterCtrlTrafficConfigReqSizeof, CsrWifiRouterCtrlTrafficConfigReqSer, CsrWifiRouterCtrlTrafficConfigReqDes, CsrWifiRouterCtrlTrafficConfigReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_OFF_REQ, CsrWifiRouterCtrlWifiOffReqSizeof, CsrWifiRouterCtrlWifiOffReqSer, CsrWifiRouterCtrlWifiOffReqDes, CsrWifiRouterCtrlWifiOffReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_OFF_RES, CsrWifiRouterCtrlWifiOffResSizeof, CsrWifiRouterCtrlWifiOffResSer, CsrWifiRouterCtrlWifiOffResDes, CsrWifiRouterCtrlWifiOffResSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_ON_REQ, CsrWifiRouterCtrlWifiOnReqSizeof, CsrWifiRouterCtrlWifiOnReqSer, CsrWifiRouterCtrlWifiOnReqDes, CsrWifiRouterCtrlWifiOnReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES, CsrWifiRouterCtrlWifiOnResSizeof, CsrWifiRouterCtrlWifiOnResSer, CsrWifiRouterCtrlWifiOnResDes, CsrWifiRouterCtrlWifiOnResSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_M4_TRANSMIT_REQ, CsrWifiRouterCtrlM4TransmitReqSizeof, CsrWifiRouterCtrlM4TransmitReqSer, CsrWifiRouterCtrlM4TransmitReqDes, CsrWifiRouterCtrlM4TransmitReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_MODE_SET_REQ, CsrWifiRouterCtrlModeSetReqSizeof, CsrWifiRouterCtrlModeSetReqSer, CsrWifiRouterCtrlModeSetReqDes, CsrWifiRouterCtrlModeSetReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_ADD_REQ, CsrWifiRouterCtrlPeerAddReqSizeof, CsrWifiRouterCtrlPeerAddReqSer, CsrWifiRouterCtrlPeerAddReqDes, CsrWifiRouterCtrlPeerAddReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_DEL_REQ, CsrWifiRouterCtrlPeerDelReqSizeof, CsrWifiRouterCtrlPeerDelReqSer, CsrWifiRouterCtrlPeerDelReqDes, CsrWifiRouterCtrlPeerDelReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_REQ, CsrWifiRouterCtrlPeerUpdateReqSizeof, CsrWifiRouterCtrlPeerUpdateReqSer, CsrWifiRouterCtrlPeerUpdateReqDes, CsrWifiRouterCtrlPeerUpdateReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_CAPABILITIES_REQ, CsrWifiRouterCtrlCapabilitiesReqSizeof, CsrWifiRouterCtrlCapabilitiesReqSer, CsrWifiRouterCtrlCapabilitiesReqDes, CsrWifiRouterCtrlCapabilitiesReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_REQ, CsrWifiRouterCtrlBlockAckEnableReqSizeof, CsrWifiRouterCtrlBlockAckEnableReqSer, CsrWifiRouterCtrlBlockAckEnableReqDes, CsrWifiRouterCtrlBlockAckEnableReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_REQ, CsrWifiRouterCtrlBlockAckDisableReqSizeof, CsrWifiRouterCtrlBlockAckDisableReqSer, CsrWifiRouterCtrlBlockAckDisableReqDes, CsrWifiRouterCtrlBlockAckDisableReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ, CsrWifiRouterCtrlWapiMulticastReqSizeof, CsrWifiRouterCtrlWapiMulticastReqSer, CsrWifiRouterCtrlWapiMulticastReqDes, CsrWifiRouterCtrlWapiMulticastReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_FILTER_REQ, CsrWifiRouterCtrlWapiMulticastFilterReqSizeof, CsrWifiRouterCtrlWapiMulticastFilterReqSer, CsrWifiRouterCtrlWapiMulticastFilterReqDes, CsrWifiRouterCtrlWapiMulticastFilterReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WAPI_UNICAST_FILTER_REQ, CsrWifiRouterCtrlWapiUnicastFilterReqSizeof, CsrWifiRouterCtrlWapiUnicastFilterReqSer, CsrWifiRouterCtrlWapiUnicastFilterReqDes, CsrWifiRouterCtrlWapiUnicastFilterReqSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_HIP_IND, CsrWifiRouterCtrlHipIndSizeof, CsrWifiRouterCtrlHipIndSer, CsrWifiRouterCtrlHipIndDes, CsrWifiRouterCtrlHipIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND, CsrWifiRouterCtrlMulticastAddressIndSizeof, CsrWifiRouterCtrlMulticastAddressIndSer, CsrWifiRouterCtrlMulticastAddressIndDes, CsrWifiRouterCtrlMulticastAddressIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PORT_CONFIGURE_CFM, CsrWifiRouterCtrlPortConfigureCfmSizeof, CsrWifiRouterCtrlPortConfigureCfmSer, CsrWifiRouterCtrlPortConfigureCfmDes, CsrWifiRouterCtrlPortConfigureCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RESUME_IND, CsrWifiRouterCtrlResumeIndSizeof, CsrWifiRouterCtrlResumeIndSer, CsrWifiRouterCtrlResumeIndDes, CsrWifiRouterCtrlResumeIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_SUSPEND_IND, CsrWifiRouterCtrlSuspendIndSizeof, CsrWifiRouterCtrlSuspendIndSer, CsrWifiRouterCtrlSuspendIndDes, CsrWifiRouterCtrlSuspendIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_CFM, CsrWifiRouterCtrlTclasAddCfmSizeof, CsrWifiRouterCtrlTclasAddCfmSer, CsrWifiRouterCtrlTclasAddCfmDes, CsrWifiRouterCtrlTclasAddCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RAW_SDIO_DEINITIALISE_CFM, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer, CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes, CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_RAW_SDIO_INITIALISE_CFM, CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof, CsrWifiRouterCtrlRawSdioInitialiseCfmSer, CsrWifiRouterCtrlRawSdioInitialiseCfmDes, CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_CFM, CsrWifiRouterCtrlTclasDelCfmSizeof, CsrWifiRouterCtrlTclasDelCfmSer, CsrWifiRouterCtrlTclasDelCfmDes, CsrWifiRouterCtrlTclasDelCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TRAFFIC_PROTOCOL_IND, CsrWifiRouterCtrlTrafficProtocolIndSizeof, CsrWifiRouterCtrlTrafficProtocolIndSer, CsrWifiRouterCtrlTrafficProtocolIndDes, CsrWifiRouterCtrlTrafficProtocolIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_TRAFFIC_SAMPLE_IND, CsrWifiRouterCtrlTrafficSampleIndSizeof, CsrWifiRouterCtrlTrafficSampleIndSer, CsrWifiRouterCtrlTrafficSampleIndDes, CsrWifiRouterCtrlTrafficSampleIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_OFF_IND, CsrWifiRouterCtrlWifiOffIndSizeof, CsrWifiRouterCtrlWifiOffIndSer, CsrWifiRouterCtrlWifiOffIndDes, CsrWifiRouterCtrlWifiOffIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_OFF_CFM, CsrWifiRouterCtrlWifiOffCfmSizeof, CsrWifiRouterCtrlWifiOffCfmSer, CsrWifiRouterCtrlWifiOffCfmDes, CsrWifiRouterCtrlWifiOffCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND, CsrWifiRouterCtrlWifiOnIndSizeof, CsrWifiRouterCtrlWifiOnIndSer, CsrWifiRouterCtrlWifiOnIndDes, CsrWifiRouterCtrlWifiOnIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WIFI_ON_CFM, CsrWifiRouterCtrlWifiOnCfmSizeof, CsrWifiRouterCtrlWifiOnCfmSer, CsrWifiRouterCtrlWifiOnCfmDes, CsrWifiRouterCtrlWifiOnCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_M4_READY_TO_SEND_IND, CsrWifiRouterCtrlM4ReadyToSendIndSizeof, CsrWifiRouterCtrlM4ReadyToSendIndSer, CsrWifiRouterCtrlM4ReadyToSendIndDes, CsrWifiRouterCtrlM4ReadyToSendIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_M4_TRANSMITTED_IND, CsrWifiRouterCtrlM4TransmittedIndSizeof, CsrWifiRouterCtrlM4TransmittedIndSer, CsrWifiRouterCtrlM4TransmittedIndDes, CsrWifiRouterCtrlM4TransmittedIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_MIC_FAILURE_IND, CsrWifiRouterCtrlMicFailureIndSizeof, CsrWifiRouterCtrlMicFailureIndSer, CsrWifiRouterCtrlMicFailureIndDes, CsrWifiRouterCtrlMicFailureIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_CONNECTED_IND, CsrWifiRouterCtrlConnectedIndSizeof, CsrWifiRouterCtrlConnectedIndSer, CsrWifiRouterCtrlConnectedIndDes, CsrWifiRouterCtrlConnectedIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_ADD_CFM, CsrWifiRouterCtrlPeerAddCfmSizeof, CsrWifiRouterCtrlPeerAddCfmSer, CsrWifiRouterCtrlPeerAddCfmDes, CsrWifiRouterCtrlPeerAddCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_DEL_CFM, CsrWifiRouterCtrlPeerDelCfmSizeof, CsrWifiRouterCtrlPeerDelCfmSer, CsrWifiRouterCtrlPeerDelCfmDes, CsrWifiRouterCtrlPeerDelCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_UNEXPECTED_FRAME_IND, CsrWifiRouterCtrlUnexpectedFrameIndSizeof, CsrWifiRouterCtrlUnexpectedFrameIndSer, CsrWifiRouterCtrlUnexpectedFrameIndDes, CsrWifiRouterCtrlUnexpectedFrameIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_PEER_UPDATE_CFM, CsrWifiRouterCtrlPeerUpdateCfmSizeof, CsrWifiRouterCtrlPeerUpdateCfmSer, CsrWifiRouterCtrlPeerUpdateCfmDes, CsrWifiRouterCtrlPeerUpdateCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_CAPABILITIES_CFM, CsrWifiRouterCtrlCapabilitiesCfmSizeof, CsrWifiRouterCtrlCapabilitiesCfmSer, CsrWifiRouterCtrlCapabilitiesCfmDes, CsrWifiRouterCtrlCapabilitiesCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ENABLE_CFM, CsrWifiRouterCtrlBlockAckEnableCfmSizeof, CsrWifiRouterCtrlBlockAckEnableCfmSer, CsrWifiRouterCtrlBlockAckEnableCfmDes, CsrWifiRouterCtrlBlockAckEnableCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_DISABLE_CFM, CsrWifiRouterCtrlBlockAckDisableCfmSizeof, CsrWifiRouterCtrlBlockAckDisableCfmSer, CsrWifiRouterCtrlBlockAckDisableCfmDes, CsrWifiRouterCtrlBlockAckDisableCfmSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_BLOCK_ACK_ERROR_IND, CsrWifiRouterCtrlBlockAckErrorIndSizeof, CsrWifiRouterCtrlBlockAckErrorIndSer, CsrWifiRouterCtrlBlockAckErrorIndDes, CsrWifiRouterCtrlBlockAckErrorIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_STA_INACTIVE_IND, CsrWifiRouterCtrlStaInactiveIndSizeof, CsrWifiRouterCtrlStaInactiveIndSer, CsrWifiRouterCtrlStaInactiveIndDes, CsrWifiRouterCtrlStaInactiveIndSerFree },
|
||||
{ CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND, CsrWifiRouterCtrlWapiMulticastIndSizeof, CsrWifiRouterCtrlWapiMulticastIndSer, CsrWifiRouterCtrlWapiMulticastIndDes, CsrWifiRouterCtrlWapiMulticastIndSerFree },
|
||||
|
||||
{ 0, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
CsrMsgConvMsgEntry* CsrWifiRouterCtrlConverterLookup(CsrMsgConvMsgEntry *ce, CsrUint16 msgType)
|
||||
{
|
||||
if (msgType & CSR_PRIM_UPSTREAM)
|
||||
{
|
||||
CsrUint16 index = (msgType & ~CSR_PRIM_UPSTREAM) + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT;
|
||||
if (index < (CSR_WIFI_ROUTER_CTRL_PRIM_UPSTREAM_COUNT + CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT) &&
|
||||
csrwifirouterctrl_conv_lut[index].msgType == msgType)
|
||||
{
|
||||
return &csrwifirouterctrl_conv_lut[index];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (msgType < CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT &&
|
||||
csrwifirouterctrl_conv_lut[msgType].msgType == msgType)
|
||||
{
|
||||
return &csrwifirouterctrl_conv_lut[msgType];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CsrWifiRouterCtrlConverterInit(void)
|
||||
{
|
||||
CsrMsgConvInsert(CSR_WIFI_ROUTER_CTRL_PRIM, csrwifirouterctrl_conv_lut);
|
||||
CsrMsgConvCustomLookupRegister(CSR_WIFI_ROUTER_CTRL_PRIM, CsrWifiRouterCtrlConverterLookup);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
static const CsrLogPrimitiveInformation csrwifirouterctrl_conv_info = {
|
||||
CSR_WIFI_ROUTER_CTRL_PRIM,
|
||||
(CsrCharString *)"CSR_WIFI_ROUTER_CTRL_PRIM",
|
||||
csrwifirouterctrl_conv_lut
|
||||
};
|
||||
const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void)
|
||||
{
|
||||
return &csrwifirouterctrl_conv_info;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
|
42
drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h
Normal file
42
drivers/staging/csr/csr_wifi_router_ctrl_converter_init.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__
|
||||
#define CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE
|
||||
|
||||
#include "csr_msgconv.h"
|
||||
|
||||
#ifdef CSR_LOG_ENABLE
|
||||
#include "csr_log.h"
|
||||
|
||||
extern const CsrLogPrimitiveInformation* CsrWifiRouterCtrlTechInfoGet(void);
|
||||
#endif /* CSR_LOG_ENABLE */
|
||||
|
||||
extern void CsrWifiRouterCtrlConverterInit(void);
|
||||
|
||||
#else /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
|
||||
|
||||
#define CsrWifiRouterCtrlConverterInit()
|
||||
|
||||
#endif /* EXCLUDE_CSR_WIFI_ROUTER_CTRL_MODULE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_CTRL_CONVERTER_INIT_H__ */
|
|
@ -0,0 +1,95 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
#include "csr_wifi_router_ctrl_lib.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrWifiRouterCtrlFreeDownstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*
|
||||
* PARAMETERS
|
||||
* eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled
|
||||
* message: the message to free
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterCtrlFreeDownstreamMessageContents(CsrUint16 eventClass, void *message)
|
||||
{
|
||||
if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (NULL == message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (*((CsrWifiRouterCtrlPrim *) message))
|
||||
{
|
||||
case CSR_WIFI_ROUTER_CTRL_HIP_REQ:
|
||||
{
|
||||
CsrWifiRouterCtrlHipReq *p = (CsrWifiRouterCtrlHipReq *)message;
|
||||
CsrPmemFree(p->mlmeCommand);
|
||||
p->mlmeCommand = NULL;
|
||||
CsrPmemFree(p->dataRef1);
|
||||
p->dataRef1 = NULL;
|
||||
CsrPmemFree(p->dataRef2);
|
||||
p->dataRef2 = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_RES:
|
||||
{
|
||||
CsrWifiRouterCtrlMulticastAddressRes *p = (CsrWifiRouterCtrlMulticastAddressRes *)message;
|
||||
CsrPmemFree(p->getAddresses);
|
||||
p->getAddresses = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_TCLAS_ADD_REQ:
|
||||
{
|
||||
CsrWifiRouterCtrlTclasAddReq *p = (CsrWifiRouterCtrlTclasAddReq *)message;
|
||||
CsrPmemFree(p->tclas);
|
||||
p->tclas = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_TCLAS_DEL_REQ:
|
||||
{
|
||||
CsrWifiRouterCtrlTclasDelReq *p = (CsrWifiRouterCtrlTclasDelReq *)message;
|
||||
CsrPmemFree(p->tclas);
|
||||
p->tclas = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_WIFI_ON_RES:
|
||||
{
|
||||
CsrWifiRouterCtrlWifiOnRes *p = (CsrWifiRouterCtrlWifiOnRes *)message;
|
||||
CsrPmemFree(p->smeVersions.smeBuild);
|
||||
p->smeVersions.smeBuild = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_REQ:
|
||||
{
|
||||
CsrWifiRouterCtrlWapiMulticastReq *p = (CsrWifiRouterCtrlWapiMulticastReq *)message;
|
||||
CsrPmemFree(p->signal);
|
||||
p->signal = NULL;
|
||||
CsrPmemFree(p->data);
|
||||
p->data = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
#include "csr_wifi_router_ctrl_lib.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrWifiRouterCtrlFreeUpstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*
|
||||
* PARAMETERS
|
||||
* eventClass: only the value CSR_WIFI_ROUTER_CTRL_PRIM will be handled
|
||||
* message: the message to free
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterCtrlFreeUpstreamMessageContents(CsrUint16 eventClass, void *message)
|
||||
{
|
||||
if (eventClass != CSR_WIFI_ROUTER_CTRL_PRIM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (NULL == message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (*((CsrWifiRouterCtrlPrim *) message))
|
||||
{
|
||||
case CSR_WIFI_ROUTER_CTRL_HIP_IND:
|
||||
{
|
||||
CsrWifiRouterCtrlHipInd *p = (CsrWifiRouterCtrlHipInd *)message;
|
||||
CsrPmemFree(p->mlmeCommand);
|
||||
p->mlmeCommand = NULL;
|
||||
CsrPmemFree(p->dataRef1);
|
||||
p->dataRef1 = NULL;
|
||||
CsrPmemFree(p->dataRef2);
|
||||
p->dataRef2 = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_MULTICAST_ADDRESS_IND:
|
||||
{
|
||||
CsrWifiRouterCtrlMulticastAddressInd *p = (CsrWifiRouterCtrlMulticastAddressInd *)message;
|
||||
CsrPmemFree(p->setAddresses);
|
||||
p->setAddresses = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_WIFI_ON_IND:
|
||||
{
|
||||
CsrWifiRouterCtrlWifiOnInd *p = (CsrWifiRouterCtrlWifiOnInd *)message;
|
||||
CsrPmemFree(p->versions.routerBuild);
|
||||
p->versions.routerBuild = NULL;
|
||||
break;
|
||||
}
|
||||
case CSR_WIFI_ROUTER_CTRL_WAPI_MULTICAST_IND:
|
||||
{
|
||||
CsrWifiRouterCtrlWapiMulticastInd *p = (CsrWifiRouterCtrlWapiMulticastInd *)message;
|
||||
CsrPmemFree(p->signal);
|
||||
p->signal = NULL;
|
||||
CsrPmemFree(p->data);
|
||||
p->data = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
1958
drivers/staging/csr/csr_wifi_router_ctrl_lib.h
Normal file
1958
drivers/staging/csr/csr_wifi_router_ctrl_lib.h
Normal file
File diff suppressed because it is too large
Load diff
2018
drivers/staging/csr/csr_wifi_router_ctrl_prim.h
Normal file
2018
drivers/staging/csr/csr_wifi_router_ctrl_prim.h
Normal file
File diff suppressed because it is too large
Load diff
43
drivers/staging/csr/csr_wifi_router_ctrl_sef.c
Normal file
43
drivers/staging/csr/csr_wifi_router_ctrl_sef.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
Confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_wifi_router_ctrl_sef.h"
|
||||
|
||||
const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT] =
|
||||
{
|
||||
/* 0x0000 */ CsrWifiRouterCtrlConfigurePowerModeReqHandler,
|
||||
/* 0x0001 */ CsrWifiRouterCtrlHipReqHandler,
|
||||
/* 0x0002 */ CsrWifiRouterCtrlMediaStatusReqHandler,
|
||||
/* 0x0003 */ CsrWifiRouterCtrlMulticastAddressResHandler,
|
||||
/* 0x0004 */ CsrWifiRouterCtrlPortConfigureReqHandler,
|
||||
/* 0x0005 */ CsrWifiRouterCtrlQosControlReqHandler,
|
||||
/* 0x0006 */ CsrWifiRouterCtrlSuspendResHandler,
|
||||
/* 0x0007 */ CsrWifiRouterCtrlTclasAddReqHandler,
|
||||
/* 0x0008 */ CsrWifiRouterCtrlResumeResHandler,
|
||||
/* 0x0009 */ CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler,
|
||||
/* 0x000A */ CsrWifiRouterCtrlRawSdioInitialiseReqHandler,
|
||||
/* 0x000B */ CsrWifiRouterCtrlTclasDelReqHandler,
|
||||
/* 0x000C */ CsrWifiRouterCtrlTrafficClassificationReqHandler,
|
||||
/* 0x000D */ CsrWifiRouterCtrlTrafficConfigReqHandler,
|
||||
/* 0x000E */ CsrWifiRouterCtrlWifiOffReqHandler,
|
||||
/* 0x000F */ CsrWifiRouterCtrlWifiOffResHandler,
|
||||
/* 0x0010 */ CsrWifiRouterCtrlWifiOnReqHandler,
|
||||
/* 0x0011 */ CsrWifiRouterCtrlWifiOnResHandler,
|
||||
/* 0x0012 */ CsrWifiRouterCtrlM4TransmitReqHandler,
|
||||
/* 0x0013 */ CsrWifiRouterCtrlModeSetReqHandler,
|
||||
/* 0x0014 */ CsrWifiRouterCtrlPeerAddReqHandler,
|
||||
/* 0x0015 */ CsrWifiRouterCtrlPeerDelReqHandler,
|
||||
/* 0x0016 */ CsrWifiRouterCtrlPeerUpdateReqHandler,
|
||||
/* 0x0017 */ CsrWifiRouterCtrlCapabilitiesReqHandler,
|
||||
CsrWifiRouterCtrlBlockAckEnableReqHandler, /* 0x0018 */
|
||||
CsrWifiRouterCtrlBlockAckDisableReqHandler, /* 0x0019 */
|
||||
CsrWifiRouterCtrlWapiMulticastReqHandler, /* 0x001A */
|
||||
CsrWifiRouterCtrlWapiMulticastFilterReqHandler, /* 0x001B */
|
||||
CsrWifiRouterCtrlWapiUnicastFilterReqHandler, /* 0x001C */
|
||||
};
|
56
drivers/staging/csr/csr_wifi_router_ctrl_sef.h
Normal file
56
drivers/staging/csr/csr_wifi_router_ctrl_sef.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
Confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__
|
||||
#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__
|
||||
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*CsrWifiRouterCtrlStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
|
||||
extern const CsrWifiRouterCtrlStateHandlerType CsrWifiRouterCtrlDownstreamStateHandlers[CSR_WIFI_ROUTER_CTRL_PRIM_DOWNSTREAM_COUNT];
|
||||
|
||||
extern void CsrWifiRouterCtrlConfigurePowerModeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlHipReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlMediaStatusReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlMulticastAddressResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlPortConfigureReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlQosControlReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlSuspendResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlTclasAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlResumeResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlRawSdioDeinitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlRawSdioInitialiseReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlTclasDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlTrafficClassificationReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlTrafficConfigReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWifiOffReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWifiOffResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWifiOnReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWifiOnResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlM4TransmitReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlModeSetReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlPeerAddReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlPeerDelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlPeerUpdateReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlCapabilitiesReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlBlockAckEnableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlBlockAckDisableReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWapiMulticastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWapiMulticastReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterCtrlWapiUnicastFilterReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_CTRL_H__ */
|
2369
drivers/staging/csr/csr_wifi_router_ctrl_serialize.c
Normal file
2369
drivers/staging/csr/csr_wifi_router_ctrl_serialize.c
Normal file
File diff suppressed because it is too large
Load diff
323
drivers/staging/csr/csr_wifi_router_ctrl_serialize.h
Normal file
323
drivers/staging/csr/csr_wifi_router_ctrl_serialize.h
Normal file
|
@ -0,0 +1,323 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__
|
||||
#define CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_msgconv.h"
|
||||
|
||||
#include "csr_wifi_router_ctrl_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void CsrWifiRouterCtrlPfree(void *ptr);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlConfigurePowerModeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlConfigurePowerModeReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlConfigurePowerModeReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlConfigurePowerModeReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlHipReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlHipReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlHipReqSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlHipReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlMediaStatusReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlMediaStatusReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlMediaStatusReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlMediaStatusReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlMulticastAddressResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlMulticastAddressResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlMulticastAddressResSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlMulticastAddressResSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPortConfigureReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPortConfigureReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPortConfigureReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPortConfigureReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlQosControlReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlQosControlReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlQosControlReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlQosControlReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlSuspendResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlSuspendResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlSuspendResSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlSuspendResSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTclasAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTclasAddReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTclasAddReqSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlTclasAddReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlResumeResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlResumeResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlResumeResSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlResumeResSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlRawSdioDeinitialiseReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlRawSdioDeinitialiseReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlRawSdioInitialiseReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlRawSdioInitialiseReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlRawSdioInitialiseReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlRawSdioInitialiseReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTclasDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTclasDelReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTclasDelReqSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlTclasDelReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTrafficClassificationReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTrafficClassificationReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTrafficClassificationReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTrafficClassificationReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTrafficConfigReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTrafficConfigReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTrafficConfigReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTrafficConfigReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWifiOffReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlWifiOffReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlWifiOffReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlWifiOffReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWifiOffResSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlWifiOffResDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlWifiOffResSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlWifiOffResSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWifiOnReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlWifiOnReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlWifiOnReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlWifiOnReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlWifiOnResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlWifiOnResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlWifiOnResSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlWifiOnResSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlM4TransmitReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlM4TransmitReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlM4TransmitReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlM4TransmitReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlModeSetReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlModeSetReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlModeSetReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlModeSetReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerAddReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerAddReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerAddReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerAddReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerDelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerDelReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerDelReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerDelReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerUpdateReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerUpdateReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerUpdateReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerUpdateReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlCapabilitiesReqSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlCapabilitiesReqDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlCapabilitiesReqSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlCapabilitiesReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlBlockAckEnableReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlBlockAckEnableReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlBlockAckEnableReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlBlockAckDisableReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlBlockAckDisableReqSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlBlockAckDisableReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlWapiMulticastReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlWapiMulticastReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlWapiMulticastReqSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlWapiMulticastReqSerFree(void *msg);
|
||||
|
||||
#define CsrWifiRouterCtrlWapiMulticastFilterReqSer CsrWifiEventCsrUint8Ser
|
||||
#define CsrWifiRouterCtrlWapiMulticastFilterReqDes CsrWifiEventCsrUint8Des
|
||||
#define CsrWifiRouterCtrlWapiMulticastFilterReqSizeof CsrWifiEventCsrUint8Sizeof
|
||||
#define CsrWifiRouterCtrlWapiMulticastFilterReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWapiUnicastFilterReqSer CsrWifiEventCsrUint8Ser
|
||||
#define CsrWifiRouterCtrlWapiUnicastFilterReqDes CsrWifiEventCsrUint8Des
|
||||
#define CsrWifiRouterCtrlWapiUnicastFilterReqSizeof CsrWifiEventCsrUint8Sizeof
|
||||
#define CsrWifiRouterCtrlWapiUnicastFilterReqSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlHipIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlHipIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlHipIndSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlHipIndSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlMulticastAddressIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlMulticastAddressIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlMulticastAddressIndSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlMulticastAddressIndSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPortConfigureCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPortConfigureCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPortConfigureCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPortConfigureCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlResumeIndSer CsrWifiEventCsrUint16CsrUint8Ser
|
||||
#define CsrWifiRouterCtrlResumeIndDes CsrWifiEventCsrUint16CsrUint8Des
|
||||
#define CsrWifiRouterCtrlResumeIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
|
||||
#define CsrWifiRouterCtrlResumeIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlSuspendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlSuspendIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlSuspendIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlSuspendIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTclasAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTclasAddCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTclasAddCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTclasAddCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlRawSdioDeinitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlRawSdioDeinitialiseCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlRawSdioDeinitialiseCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlRawSdioDeinitialiseCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlRawSdioInitialiseCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlRawSdioInitialiseCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlRawSdioInitialiseCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlRawSdioInitialiseCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTclasDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTclasDelCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTclasDelCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTclasDelCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTrafficProtocolIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTrafficProtocolIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTrafficProtocolIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTrafficProtocolIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlTrafficSampleIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlTrafficSampleIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlTrafficSampleIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlTrafficSampleIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWifiOffIndSer CsrWifiEventCsrUint16CsrUint8Ser
|
||||
#define CsrWifiRouterCtrlWifiOffIndDes CsrWifiEventCsrUint16CsrUint8Des
|
||||
#define CsrWifiRouterCtrlWifiOffIndSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
|
||||
#define CsrWifiRouterCtrlWifiOffIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
#define CsrWifiRouterCtrlWifiOffCfmSer CsrWifiEventCsrUint16Ser
|
||||
#define CsrWifiRouterCtrlWifiOffCfmDes CsrWifiEventCsrUint16Des
|
||||
#define CsrWifiRouterCtrlWifiOffCfmSizeof CsrWifiEventCsrUint16Sizeof
|
||||
#define CsrWifiRouterCtrlWifiOffCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlWifiOnIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlWifiOnIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlWifiOnIndSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlWifiOnIndSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlWifiOnCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlWifiOnCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlWifiOnCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlWifiOnCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlM4ReadyToSendIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlM4ReadyToSendIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlM4ReadyToSendIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlM4ReadyToSendIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlM4TransmittedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlM4TransmittedIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlM4TransmittedIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlM4TransmittedIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlMicFailureIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlMicFailureIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlMicFailureIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlMicFailureIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlConnectedIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlConnectedIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlConnectedIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlConnectedIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerAddCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerAddCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerAddCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerAddCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerDelCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerDelCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerDelCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerDelCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlUnexpectedFrameIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlUnexpectedFrameIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlUnexpectedFrameIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlUnexpectedFrameIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlPeerUpdateCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlPeerUpdateCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlPeerUpdateCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlPeerUpdateCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlCapabilitiesCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlCapabilitiesCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlCapabilitiesCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlCapabilitiesCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlBlockAckEnableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlBlockAckEnableCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlBlockAckEnableCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlBlockAckEnableCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlBlockAckDisableCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlBlockAckDisableCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlBlockAckDisableCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlBlockAckDisableCfmSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlBlockAckErrorIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlBlockAckErrorIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlBlockAckErrorIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlBlockAckErrorIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlStaInactiveIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlStaInactiveIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlStaInactiveIndSizeof(void *msg);
|
||||
#define CsrWifiRouterCtrlStaInactiveIndSerFree CsrWifiRouterCtrlPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterCtrlWapiMulticastIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterCtrlWapiMulticastIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterCtrlWapiMulticastIndSizeof(void *msg);
|
||||
extern void CsrWifiRouterCtrlWapiMulticastIndSerFree(void *msg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CSR_WIFI_ROUTER_CTRL_SERIALIZE_H__ */
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_router_prim.h"
|
||||
#include "csr_wifi_router_lib.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrWifiRouterFreeDownstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*
|
||||
* PARAMETERS
|
||||
* eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled
|
||||
* message: the message to free
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message)
|
||||
{
|
||||
if (eventClass != CSR_WIFI_ROUTER_PRIM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (NULL == message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (*((CsrWifiRouterPrim *) message))
|
||||
{
|
||||
case CSR_WIFI_ROUTER_MA_PACKET_REQ:
|
||||
{
|
||||
CsrWifiRouterMaPacketReq *p = (CsrWifiRouterMaPacketReq *)message;
|
||||
CsrPmemFree(p->frame);
|
||||
p->frame = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
54
drivers/staging/csr/csr_wifi_router_free_upstream_contents.c
Normal file
54
drivers/staging/csr/csr_wifi_router_free_upstream_contents.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_router_prim.h"
|
||||
#include "csr_wifi_router_lib.h"
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* NAME
|
||||
* CsrWifiRouterFreeUpstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
*
|
||||
* PARAMETERS
|
||||
* eventClass: only the value CSR_WIFI_ROUTER_PRIM will be handled
|
||||
* message: the message to free
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message)
|
||||
{
|
||||
if (eventClass != CSR_WIFI_ROUTER_PRIM)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (NULL == message)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (*((CsrWifiRouterPrim *) message))
|
||||
{
|
||||
case CSR_WIFI_ROUTER_MA_PACKET_IND:
|
||||
{
|
||||
CsrWifiRouterMaPacketInd *p = (CsrWifiRouterMaPacketInd *)message;
|
||||
CsrPmemFree(p->frame);
|
||||
p->frame = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
429
drivers/staging/csr/csr_wifi_router_lib.h
Normal file
429
drivers/staging/csr/csr_wifi_router_lib.h
Normal file
|
@ -0,0 +1,429 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_LIB_H__
|
||||
#define CSR_WIFI_ROUTER_LIB_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_util.h"
|
||||
#include "csr_msg_transport.h"
|
||||
|
||||
#include "csr_wifi_lib.h"
|
||||
|
||||
#include "csr_wifi_router_prim.h"
|
||||
#include "csr_wifi_router_task.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiRouterFreeUpstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free the allocated memory in a CSR_WIFI_ROUTER upstream message. Does not
|
||||
* free the message itself, and can only be used for upstream messages.
|
||||
*
|
||||
* PARAMETERS
|
||||
* Deallocates the resources in a CSR_WIFI_ROUTER upstream message
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterFreeUpstreamMessageContents(CsrUint16 eventClass, void *message);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrWifiRouterFreeDownstreamMessageContents
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Free the allocated memory in a CSR_WIFI_ROUTER downstream message. Does not
|
||||
* free the message itself, and can only be used for downstream messages.
|
||||
*
|
||||
* PARAMETERS
|
||||
* Deallocates the resources in a CSR_WIFI_ROUTER downstream message
|
||||
*----------------------------------------------------------------------------*/
|
||||
void CsrWifiRouterFreeDownstreamMessageContents(CsrUint16 eventClass, void *message);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Enum to string functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
const CsrCharString* CsrWifiRouterAppTypeToString(CsrWifiRouterAppType value);
|
||||
const CsrCharString* CsrWifiRouterEncapsulationToString(CsrWifiRouterEncapsulation value);
|
||||
const CsrCharString* CsrWifiRouterOuiToString(CsrWifiRouterOui value);
|
||||
const CsrCharString* CsrWifiRouterPriorityToString(CsrWifiRouterPriority value);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* CsrPrim Type toString function.
|
||||
* Converts a message type to the String name of the Message
|
||||
*----------------------------------------------------------------------------*/
|
||||
const CsrCharString* CsrWifiRouterPrimTypeToString(CsrPrim msgType);
|
||||
|
||||
/*----------------------------------------------------------------------------*
|
||||
* Lookup arrays for PrimType name Strings
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern const CsrCharString *CsrWifiRouterUpstreamPrimNames[CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT];
|
||||
extern const CsrCharString *CsrWifiRouterDownstreamPrimNames[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT];
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketCancelReqSend
|
||||
|
||||
DESCRIPTION
|
||||
This primitive is used to request cancellation of a previously send
|
||||
CsrWifiRouterMaPacketReq.
|
||||
The frame may already have been transmitted so there is no guarantees
|
||||
that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission
|
||||
of the frame in question.
|
||||
If the cancellation fails, the Router will send, if required,
|
||||
CsrWifiRouterMaPacketCfm.
|
||||
If the cancellation succeeds, the Router will not send
|
||||
CsrWifiRouterMaPacketCfm.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
hostTag - The hostTag for the frame, which should be cancelled.
|
||||
priority - Priority of the frame, which should be cancelled
|
||||
peerMacAddress - Destination MAC address of the frame, which should be
|
||||
cancelled
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
|
||||
msg__ = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->hostTag = (hostTag__); \
|
||||
msg__->priority = (priority__); \
|
||||
msg__->peerMacAddress = (peerMacAddress__);
|
||||
|
||||
#define CsrWifiRouterMaPacketCancelReqSendTo(dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketCancelReq *msg__; \
|
||||
CsrWifiRouterMaPacketCancelReqCreate(msg__, dst__, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketCancelReqSend(src__, interfaceTag__, hostTag__, priority__, peerMacAddress__) \
|
||||
CsrWifiRouterMaPacketCancelReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, hostTag__, priority__, peerMacAddress__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketReqSend
|
||||
|
||||
DESCRIPTION
|
||||
A task sends this primitive to transmit a frame.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
frameLength - Length of the frame to be sent in bytes
|
||||
frame - Pointer to the frame to be sent
|
||||
freeFunction - Pointer to function to be used to free the frame
|
||||
priority - Priority of the frame, which should be sent
|
||||
hostTag - An application shall set the bits b31..b28 using one of
|
||||
the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can
|
||||
be used by the requestor without any restrictions, but
|
||||
the hostTag shall be unique so the hostTag for
|
||||
CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured
|
||||
in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER
|
||||
(4 bits) | SubscriptionHandle (8 bits) | Sequence no.
|
||||
(20 bits) ]. If the hostTag is not unique, the
|
||||
behaviour of the system is unpredicatable with respect
|
||||
to data/management frame transfer.
|
||||
cfmRequested - Indicates if the requestor needs a confirm for packet
|
||||
requests sent under this subscription. If set to TRUE,
|
||||
the router will send a confirm, else it will not send
|
||||
any confirm
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
|
||||
msg__ = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->subscriptionHandle = (subscriptionHandle__); \
|
||||
msg__->frameLength = (frameLength__); \
|
||||
msg__->frame = (frame__); \
|
||||
msg__->freeFunction = (freeFunction__); \
|
||||
msg__->priority = (priority__); \
|
||||
msg__->hostTag = (hostTag__); \
|
||||
msg__->cfmRequested = (cfmRequested__);
|
||||
|
||||
#define CsrWifiRouterMaPacketReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketReq *msg__; \
|
||||
CsrWifiRouterMaPacketReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketReqSend(src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__) \
|
||||
CsrWifiRouterMaPacketReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, frameLength__, frame__, freeFunction__, priority__, hostTag__, cfmRequested__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketIndSend
|
||||
|
||||
DESCRIPTION
|
||||
The router sends the primitive to a subscribed task when it receives a
|
||||
frame matching the subscription.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
result - Status of the operation
|
||||
frameLength - Length of the received frame in bytes
|
||||
frame - Pointer to the received frame
|
||||
freeFunction - Pointer to function to be used to free the frame
|
||||
rssi - Received signal strength indication in dBm
|
||||
snr - Signal to Noise Ratio
|
||||
rate - Transmission/Reception rate
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
|
||||
msg__ = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_IND, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->subscriptionHandle = (subscriptionHandle__); \
|
||||
msg__->result = (result__); \
|
||||
msg__->frameLength = (frameLength__); \
|
||||
msg__->frame = (frame__); \
|
||||
msg__->freeFunction = (freeFunction__); \
|
||||
msg__->rssi = (rssi__); \
|
||||
msg__->snr = (snr__); \
|
||||
msg__->rate = (rate__);
|
||||
|
||||
#define CsrWifiRouterMaPacketIndSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketInd *msg__; \
|
||||
CsrWifiRouterMaPacketIndCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketIndSend(dst__, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__) \
|
||||
CsrWifiRouterMaPacketIndSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, result__, frameLength__, frame__, freeFunction__, rssi__, snr__, rate__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketResSend
|
||||
|
||||
DESCRIPTION
|
||||
A task send this primitive to confirm the reception of the received
|
||||
frame.
|
||||
|
||||
PARAMETERS
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
result - Status of the operation
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__) \
|
||||
msg__ = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_RES, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->subscriptionHandle = (subscriptionHandle__); \
|
||||
msg__->result = (result__);
|
||||
|
||||
#define CsrWifiRouterMaPacketResSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, result__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketRes *msg__; \
|
||||
CsrWifiRouterMaPacketResCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, result__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketResSend(src__, interfaceTag__, subscriptionHandle__, result__) \
|
||||
CsrWifiRouterMaPacketResSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__, result__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
The router sends the primitive to confirm the result of the transmission
|
||||
of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
result - Status of the operation
|
||||
hostTag - The hostTrag will match the hostTag sent in the request.
|
||||
rate - Transmission/Reception rate
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__) \
|
||||
msg__ = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->result = (result__); \
|
||||
msg__->hostTag = (hostTag__); \
|
||||
msg__->rate = (rate__);
|
||||
|
||||
#define CsrWifiRouterMaPacketCfmSendTo(dst__, src__, interfaceTag__, result__, hostTag__, rate__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketCfm *msg__; \
|
||||
CsrWifiRouterMaPacketCfmCreate(msg__, dst__, src__, interfaceTag__, result__, hostTag__, rate__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketCfmSend(dst__, interfaceTag__, result__, hostTag__, rate__) \
|
||||
CsrWifiRouterMaPacketCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, result__, hostTag__, rate__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketSubscribeReqSend
|
||||
|
||||
DESCRIPTION
|
||||
A task can use this primitive to subscribe for a particular OUI/protocol
|
||||
and transmit and receive frames matching the subscription.
|
||||
NOTE: Multiple subscriptions for a given protocol and OUI will result in
|
||||
the first subscription receiving the data and not the subsequent
|
||||
subscriptions.
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
encapsulation - Specifies the encapsulation type, which will be used for the
|
||||
subscription
|
||||
protocol - Together with the OUI, specifies the protocol, which a task
|
||||
wants to subscribe to
|
||||
oui - Specifies the OUI for the protocol, which a task wants to
|
||||
subscribe to
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \
|
||||
msg__ = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->encapsulation = (encapsulation__); \
|
||||
msg__->protocol = (protocol__); \
|
||||
msg__->oui = (oui__);
|
||||
|
||||
#define CsrWifiRouterMaPacketSubscribeReqSendTo(dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketSubscribeReq *msg__; \
|
||||
CsrWifiRouterMaPacketSubscribeReqCreate(msg__, dst__, src__, interfaceTag__, encapsulation__, protocol__, oui__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketSubscribeReqSend(src__, interfaceTag__, encapsulation__, protocol__, oui__) \
|
||||
CsrWifiRouterMaPacketSubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, encapsulation__, protocol__, oui__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketSubscribeCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
The router sends this primitive to confirm the result of the
|
||||
subscription.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - Handle to the subscription
|
||||
This handle must be used in all subsequent requests
|
||||
status - Status of the operation
|
||||
allocOffset - Size of the offset for the frames of the subscription
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
|
||||
msg__ = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->subscriptionHandle = (subscriptionHandle__); \
|
||||
msg__->status = (status__); \
|
||||
msg__->allocOffset = (allocOffset__);
|
||||
|
||||
#define CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketSubscribeCfm *msg__; \
|
||||
CsrWifiRouterMaPacketSubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__, status__, allocOffset__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketSubscribeCfmSend(dst__, interfaceTag__, subscriptionHandle__, status__, allocOffset__) \
|
||||
CsrWifiRouterMaPacketSubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, subscriptionHandle__, status__, allocOffset__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketUnsubscribeReqSend
|
||||
|
||||
DESCRIPTION
|
||||
A task sends this primitive to unsubscribe a subscription
|
||||
|
||||
PARAMETERS
|
||||
queue - Message Source Task Queue (Cfm's will be sent to this Queue)
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__) \
|
||||
msg__ = (CsrWifiRouterMaPacketUnsubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeReq)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->subscriptionHandle = (subscriptionHandle__);
|
||||
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqSendTo(dst__, src__, interfaceTag__, subscriptionHandle__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketUnsubscribeReq *msg__; \
|
||||
CsrWifiRouterMaPacketUnsubscribeReqCreate(msg__, dst__, src__, interfaceTag__, subscriptionHandle__); \
|
||||
CsrMsgTransport(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqSend(src__, interfaceTag__, subscriptionHandle__) \
|
||||
CsrWifiRouterMaPacketUnsubscribeReqSendTo(CSR_WIFI_ROUTER_IFACEQUEUE, src__, interfaceTag__, subscriptionHandle__)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketUnsubscribeCfmSend
|
||||
|
||||
DESCRIPTION
|
||||
The router sends this primitive to confirm the result of the
|
||||
unsubscription.
|
||||
|
||||
PARAMETERS
|
||||
queue - Destination Task Queue
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
status - Status of the operation
|
||||
|
||||
*******************************************************************************/
|
||||
#define CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \
|
||||
msg__ = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm)); \
|
||||
CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_ROUTER_PRIM, CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM, dst__, src__); \
|
||||
msg__->interfaceTag = (interfaceTag__); \
|
||||
msg__->status = (status__);
|
||||
|
||||
#define CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, src__, interfaceTag__, status__) \
|
||||
{ \
|
||||
CsrWifiRouterMaPacketUnsubscribeCfm *msg__; \
|
||||
CsrWifiRouterMaPacketUnsubscribeCfmCreate(msg__, dst__, src__, interfaceTag__, status__); \
|
||||
CsrSchedMessagePut(dst__, CSR_WIFI_ROUTER_PRIM, msg__); \
|
||||
}
|
||||
|
||||
#define CsrWifiRouterMaPacketUnsubscribeCfmSend(dst__, interfaceTag__, status__) \
|
||||
CsrWifiRouterMaPacketUnsubscribeCfmSendTo(dst__, CSR_WIFI_ROUTER_IFACEQUEUE, interfaceTag__, status__)
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_LIB_H__ */
|
430
drivers/staging/csr/csr_wifi_router_prim.h
Normal file
430
drivers/staging/csr/csr_wifi_router_prim.h
Normal file
|
@ -0,0 +1,430 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_PRIM_H__
|
||||
#define CSR_WIFI_ROUTER_PRIM_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_prim_defs.h"
|
||||
#include "csr_sched.h"
|
||||
#include "csr_wifi_common.h"
|
||||
#include "csr_result.h"
|
||||
#include "csr_wifi_fsm_event.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CSR_WIFI_ROUTER_PRIM (0x0400)
|
||||
|
||||
typedef CsrPrim CsrWifiRouterPrim;
|
||||
|
||||
typedef void (*CsrWifiRouterFrameFreeFunction)(void *frame);
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterAppType
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
VALUES
|
||||
CSR_WIFI_ROUTER_APP_TYPE_SME -
|
||||
CSR_WIFI_ROUTER_APP_TYPE_PAL -
|
||||
CSR_WIFI_ROUTER_APP_TYPE_NME -
|
||||
CSR_WIFI_ROUTER_APP_TYPE_OTHER -
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint8 CsrWifiRouterAppType;
|
||||
#define CSR_WIFI_ROUTER_APP_TYPE_SME ((CsrWifiRouterAppType) 0x0)
|
||||
#define CSR_WIFI_ROUTER_APP_TYPE_PAL ((CsrWifiRouterAppType) 0x1)
|
||||
#define CSR_WIFI_ROUTER_APP_TYPE_NME ((CsrWifiRouterAppType) 0x2)
|
||||
#define CSR_WIFI_ROUTER_APP_TYPE_OTHER ((CsrWifiRouterAppType) 0x3)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterEncapsulation
|
||||
|
||||
DESCRIPTION
|
||||
Indicates the type of encapsulation used for the subscription
|
||||
|
||||
VALUES
|
||||
CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET
|
||||
- Ethernet encapsulation
|
||||
CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP
|
||||
- LLC/SNAP encapsulation
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint8 CsrWifiRouterEncapsulation;
|
||||
#define CSR_WIFI_ROUTER_ENCAPSULATION_ETHERNET ((CsrWifiRouterEncapsulation) 0x00)
|
||||
#define CSR_WIFI_ROUTER_ENCAPSULATION_LLC_SNAP ((CsrWifiRouterEncapsulation) 0x01)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterOui
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
VALUES
|
||||
CSR_WIFI_ROUTER_OUI_RFC_1042 -
|
||||
CSR_WIFI_ROUTER_OUI_BT -
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint32 CsrWifiRouterOui;
|
||||
#define CSR_WIFI_ROUTER_OUI_RFC_1042 ((CsrWifiRouterOui) 0x000000)
|
||||
#define CSR_WIFI_ROUTER_OUI_BT ((CsrWifiRouterOui) 0x001958)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterPriority
|
||||
|
||||
DESCRIPTION
|
||||
As defined in the IEEE 802.11 standards
|
||||
|
||||
VALUES
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP0
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP1
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP2
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP3
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP4
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP5
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP6
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_QOS_UP7
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_CONTENTION
|
||||
- See IEEE 802.11 Standard
|
||||
CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT
|
||||
- See IEEE 802.11 Standard
|
||||
|
||||
*******************************************************************************/
|
||||
typedef CsrUint16 CsrWifiRouterPriority;
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP0 ((CsrWifiRouterPriority) 0x0000)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP1 ((CsrWifiRouterPriority) 0x0001)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP2 ((CsrWifiRouterPriority) 0x0002)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP3 ((CsrWifiRouterPriority) 0x0003)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP4 ((CsrWifiRouterPriority) 0x0004)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP5 ((CsrWifiRouterPriority) 0x0005)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP6 ((CsrWifiRouterPriority) 0x0006)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_QOS_UP7 ((CsrWifiRouterPriority) 0x0007)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_CONTENTION ((CsrWifiRouterPriority) 0x8000)
|
||||
#define CSR_WIFI_ROUTER_PRIORITY_MANAGEMENT ((CsrWifiRouterPriority) 0x8010)
|
||||
|
||||
|
||||
/* Downstream */
|
||||
#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST (0x0000)
|
||||
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0000 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_REQ ((CsrWifiRouterPrim) (0x0001 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_REQ ((CsrWifiRouterPrim) (0x0002 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_RES ((CsrWifiRouterPrim) (0x0003 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_CANCEL_REQ ((CsrWifiRouterPrim) (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST))
|
||||
|
||||
|
||||
#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST (0x0004 + CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)
|
||||
|
||||
/* Upstream */
|
||||
#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST (0x0000 + CSR_PRIM_UPSTREAM)
|
||||
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_SUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0000 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_UNSUBSCRIBE_CFM ((CsrWifiRouterPrim)(0x0001 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_CFM ((CsrWifiRouterPrim)(0x0002 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
|
||||
#define CSR_WIFI_ROUTER_MA_PACKET_IND ((CsrWifiRouterPrim)(0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST))
|
||||
|
||||
#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST (0x0003 + CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)
|
||||
|
||||
#define CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_LOWEST)
|
||||
#define CSR_WIFI_ROUTER_PRIM_UPSTREAM_COUNT (CSR_WIFI_ROUTER_PRIM_UPSTREAM_HIGHEST + 1 - CSR_WIFI_ROUTER_PRIM_UPSTREAM_LOWEST)
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketSubscribeReq
|
||||
|
||||
DESCRIPTION
|
||||
A task can use this primitive to subscribe for a particular OUI/protocol
|
||||
and transmit and receive frames matching the subscription.
|
||||
NOTE: Multiple subscriptions for a given protocol and OUI will result in
|
||||
the first subscription receiving the data and not the subsequent
|
||||
subscriptions.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
encapsulation - Specifies the encapsulation type, which will be used for the
|
||||
subscription
|
||||
protocol - Together with the OUI, specifies the protocol, which a task
|
||||
wants to subscribe to
|
||||
oui - Specifies the OUI for the protocol, which a task wants to
|
||||
subscribe to
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrWifiRouterEncapsulation encapsulation;
|
||||
CsrUint16 protocol;
|
||||
CsrUint32 oui;
|
||||
} CsrWifiRouterMaPacketSubscribeReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketUnsubscribeReq
|
||||
|
||||
DESCRIPTION
|
||||
A task sends this primitive to unsubscribe a subscription
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint8 subscriptionHandle;
|
||||
} CsrWifiRouterMaPacketUnsubscribeReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketReq
|
||||
|
||||
DESCRIPTION
|
||||
A task sends this primitive to transmit a frame.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
frameLength - Length of the frame to be sent in bytes
|
||||
frame - Pointer to the frame to be sent
|
||||
freeFunction - Pointer to function to be used to free the frame
|
||||
priority - Priority of the frame, which should be sent
|
||||
hostTag - An application shall set the bits b31..b28 using one of
|
||||
the CSR_WIFI_ROUTER_APP_TYPE_* masks. Bits b0..b27 can
|
||||
be used by the requestor without any restrictions, but
|
||||
the hostTag shall be unique so the hostTag for
|
||||
CSR_WIFI_ROUTER_APP _TYPE_OTHER should be constructured
|
||||
in the following way [ CSR_WIFI_ROUTER_APP_TYPE_OTHER
|
||||
(4 bits) | SubscriptionHandle (8 bits) | Sequence no.
|
||||
(20 bits) ]. If the hostTag is not unique, the
|
||||
behaviour of the system is unpredicatable with respect
|
||||
to data/management frame transfer.
|
||||
cfmRequested - Indicates if the requestor needs a confirm for packet
|
||||
requests sent under this subscription. If set to TRUE,
|
||||
the router will send a confirm, else it will not send
|
||||
any confirm
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint8 subscriptionHandle;
|
||||
CsrUint16 frameLength;
|
||||
CsrUint8 *frame;
|
||||
CsrWifiRouterFrameFreeFunction freeFunction;
|
||||
CsrWifiRouterPriority priority;
|
||||
CsrUint32 hostTag;
|
||||
CsrBool cfmRequested;
|
||||
} CsrWifiRouterMaPacketReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketRes
|
||||
|
||||
DESCRIPTION
|
||||
A task send this primitive to confirm the reception of the received
|
||||
frame.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
result - Status of the operation
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint8 subscriptionHandle;
|
||||
CsrResult result;
|
||||
} CsrWifiRouterMaPacketRes;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketCancelReq
|
||||
|
||||
DESCRIPTION
|
||||
This primitive is used to request cancellation of a previously send
|
||||
CsrWifiRouterMaPacketReq.
|
||||
The frame may already have been transmitted so there is no guarantees
|
||||
that the CsrWifiRouterMaPacketCancelReq actually cancels the transmission
|
||||
of the frame in question.
|
||||
If the cancellation fails, the Router will send, if required,
|
||||
CsrWifiRouterMaPacketCfm.
|
||||
If the cancellation succeeds, the Router will not send
|
||||
CsrWifiRouterMaPacketCfm.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
hostTag - The hostTag for the frame, which should be cancelled.
|
||||
priority - Priority of the frame, which should be cancelled
|
||||
peerMacAddress - Destination MAC address of the frame, which should be
|
||||
cancelled
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint32 hostTag;
|
||||
CsrWifiRouterPriority priority;
|
||||
CsrWifiMacAddress peerMacAddress;
|
||||
} CsrWifiRouterMaPacketCancelReq;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketSubscribeCfm
|
||||
|
||||
DESCRIPTION
|
||||
The router sends this primitive to confirm the result of the
|
||||
subscription.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - Handle to the subscription
|
||||
This handle must be used in all subsequent requests
|
||||
status - Status of the operation
|
||||
allocOffset - Size of the offset for the frames of the subscription
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint8 subscriptionHandle;
|
||||
CsrResult status;
|
||||
CsrUint16 allocOffset;
|
||||
} CsrWifiRouterMaPacketSubscribeCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketUnsubscribeCfm
|
||||
|
||||
DESCRIPTION
|
||||
The router sends this primitive to confirm the result of the
|
||||
unsubscription.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
status - Status of the operation
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrResult status;
|
||||
} CsrWifiRouterMaPacketUnsubscribeCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketCfm
|
||||
|
||||
DESCRIPTION
|
||||
The router sends the primitive to confirm the result of the transmission
|
||||
of the packet of the corresponding CSR_WIFI_ROUTER MA_PACKET_REQ request.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
result - Status of the operation
|
||||
hostTag - The hostTrag will match the hostTag sent in the request.
|
||||
rate - Transmission/Reception rate
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrResult result;
|
||||
CsrUint32 hostTag;
|
||||
CsrUint16 rate;
|
||||
} CsrWifiRouterMaPacketCfm;
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
NAME
|
||||
CsrWifiRouterMaPacketInd
|
||||
|
||||
DESCRIPTION
|
||||
The router sends the primitive to a subscribed task when it receives a
|
||||
frame matching the subscription.
|
||||
|
||||
MEMBERS
|
||||
common - Common header for use with the CsrWifiFsm Module
|
||||
interfaceTag - Interface Identifier; unique identifier of an interface
|
||||
subscriptionHandle - The handle of the subscription
|
||||
result - Status of the operation
|
||||
frameLength - Length of the received frame in bytes
|
||||
frame - Pointer to the received frame
|
||||
freeFunction - Pointer to function to be used to free the frame
|
||||
rssi - Received signal strength indication in dBm
|
||||
snr - Signal to Noise Ratio
|
||||
rate - Transmission/Reception rate
|
||||
|
||||
*******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CsrWifiFsmEvent common;
|
||||
CsrUint16 interfaceTag;
|
||||
CsrUint8 subscriptionHandle;
|
||||
CsrResult result;
|
||||
CsrUint16 frameLength;
|
||||
CsrUint8 *frame;
|
||||
CsrWifiRouterFrameFreeFunction freeFunction;
|
||||
CsrInt16 rssi;
|
||||
CsrInt16 snr;
|
||||
CsrUint16 rate;
|
||||
} CsrWifiRouterMaPacketInd;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_PRIM_H__ */
|
||||
|
19
drivers/staging/csr/csr_wifi_router_sef.c
Normal file
19
drivers/staging/csr/csr_wifi_router_sef.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
Confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#include "csr_wifi_router_sef.h"
|
||||
|
||||
const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT] =
|
||||
{
|
||||
/* 0x0000 */ CsrWifiRouterMaPacketSubscribeReqHandler,
|
||||
/* 0x0001 */ CsrWifiRouterMaPacketUnsubscribeReqHandler,
|
||||
/* 0x0002 */ CsrWifiRouterMaPacketReqHandler,
|
||||
/* 0x0003 */ CsrWifiRouterMaPacketResHandler,
|
||||
/* 0x0004 */ CsrWifiRouterMaPacketCancelReqHandler,
|
||||
};
|
33
drivers/staging/csr/csr_wifi_router_sef.h
Normal file
33
drivers/staging/csr/csr_wifi_router_sef.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2010
|
||||
Confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
#ifndef CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__
|
||||
#define CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__
|
||||
|
||||
#include "csr_wifi_router_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*CsrWifiRouterStateHandlerType)(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
|
||||
extern const CsrWifiRouterStateHandlerType CsrWifiRouterDownstreamStateHandlers[CSR_WIFI_ROUTER_PRIM_DOWNSTREAM_COUNT];
|
||||
|
||||
extern void CsrWifiRouterMaPacketSubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterMaPacketUnsubscribeReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterMaPacketReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterMaPacketResHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
extern void CsrWifiRouterMaPacketCancelReqHandler(void* drvpriv, CsrWifiFsmEvent* msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_SEF_CSR_WIFI_ROUTER_H__ */
|
422
drivers/staging/csr/csr_wifi_router_serialize.c
Normal file
422
drivers/staging/csr/csr_wifi_router_serialize.c
Normal file
|
@ -0,0 +1,422 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_msgconv.h"
|
||||
#include "csr_unicode.h"
|
||||
|
||||
|
||||
#include "csr_wifi_router_prim.h"
|
||||
#include "csr_wifi_router_serialize.h"
|
||||
|
||||
void CsrWifiRouterPfree(void *ptr)
|
||||
{
|
||||
CsrPmemFree(ptr);
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */
|
||||
bufferSize += 2; /* CsrUint16 primitive->protocol */
|
||||
bufferSize += 4; /* CsrUint32 primitive->oui */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->encapsulation);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->protocol);
|
||||
CsrUint32Ser(ptr, len, (CsrUint32) primitive->oui);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeReq));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->encapsulation, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->protocol, buffer, &offset);
|
||||
CsrUint32Des((CsrUint32 *) &primitive->oui, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg;
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */
|
||||
bufferSize += 2; /* CsrUint16 primitive->frameLength */
|
||||
bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */
|
||||
bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
|
||||
bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
|
||||
bufferSize += 4; /* CsrUint32 primitive->hostTag */
|
||||
bufferSize += 1; /* CsrBool primitive->cfmRequested */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength);
|
||||
if (primitive->frameLength)
|
||||
{
|
||||
CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength)));
|
||||
}
|
||||
CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority);
|
||||
CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->cfmRequested);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketReq));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset);
|
||||
if (primitive->frameLength)
|
||||
{
|
||||
primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength);
|
||||
CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength)));
|
||||
}
|
||||
else
|
||||
{
|
||||
primitive->frame = NULL;
|
||||
}
|
||||
primitive->freeFunction = NULL; /* Special for Function Pointers... */
|
||||
offset += 4;
|
||||
CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset);
|
||||
CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->cfmRequested, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer)
|
||||
{
|
||||
CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer;
|
||||
CsrPmemFree(primitive->frame);
|
||||
CsrPmemFree(primitive);
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketResSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */
|
||||
bufferSize += 2; /* CsrResult primitive->result */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->result);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketRes));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 4; /* CsrUint32 primitive->hostTag */
|
||||
bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
|
||||
bufferSize += 6; /* CsrUint8 primitive->peerMacAddress.a[6] */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->priority);
|
||||
CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((CsrUint16) (6)));
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCancelReq));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->priority, buffer, &offset);
|
||||
CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((CsrUint16) (6)));
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */
|
||||
bufferSize += 2; /* CsrResult primitive->status */
|
||||
bufferSize += 2; /* CsrUint16 primitive->allocOffset */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->status);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->allocOffset);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->allocOffset, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 2; /* CsrResult primitive->status */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->status);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->status, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg)
|
||||
{
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 2; /* CsrResult primitive->result */
|
||||
bufferSize += 4; /* CsrUint32 primitive->hostTag */
|
||||
bufferSize += 2; /* CsrUint16 primitive->rate */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->result);
|
||||
CsrUint32Ser(ptr, len, (CsrUint32) primitive->hostTag);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketCfm));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset);
|
||||
CsrUint32Des((CsrUint32 *) &primitive->hostTag, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg;
|
||||
CsrSize bufferSize = 2;
|
||||
|
||||
/* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */
|
||||
bufferSize += 2; /* CsrUint16 primitive->interfaceTag */
|
||||
bufferSize += 1; /* CsrUint8 primitive->subscriptionHandle */
|
||||
bufferSize += 2; /* CsrResult primitive->result */
|
||||
bufferSize += 2; /* CsrUint16 primitive->frameLength */
|
||||
bufferSize += primitive->frameLength; /* CsrUint8 primitive->frame */
|
||||
bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
|
||||
bufferSize += 2; /* CsrInt16 primitive->rssi */
|
||||
bufferSize += 2; /* CsrInt16 primitive->snr */
|
||||
bufferSize += 2; /* CsrUint16 primitive->rate */
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
|
||||
CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg)
|
||||
{
|
||||
CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg;
|
||||
*len = 0;
|
||||
CsrUint16Ser(ptr, len, primitive->common.type);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->interfaceTag);
|
||||
CsrUint8Ser(ptr, len, (CsrUint8) primitive->subscriptionHandle);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->result);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->frameLength);
|
||||
if (primitive->frameLength)
|
||||
{
|
||||
CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((CsrUint16) (primitive->frameLength)));
|
||||
}
|
||||
CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->rssi);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->snr);
|
||||
CsrUint16Ser(ptr, len, (CsrUint16) primitive->rate);
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
|
||||
void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize length)
|
||||
{
|
||||
CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) CsrPmemAlloc(sizeof(CsrWifiRouterMaPacketInd));
|
||||
CsrSize offset;
|
||||
offset = 0;
|
||||
|
||||
CsrUint16Des(&primitive->common.type, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->interfaceTag, buffer, &offset);
|
||||
CsrUint8Des((CsrUint8 *) &primitive->subscriptionHandle, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->result, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->frameLength, buffer, &offset);
|
||||
if (primitive->frameLength)
|
||||
{
|
||||
primitive->frame = (CsrUint8 *)CsrPmemAlloc(primitive->frameLength);
|
||||
CsrMemCpyDes(primitive->frame, buffer, &offset, ((CsrUint16) (primitive->frameLength)));
|
||||
}
|
||||
else
|
||||
{
|
||||
primitive->frame = NULL;
|
||||
}
|
||||
primitive->freeFunction = NULL; /* Special for Function Pointers... */
|
||||
offset += 4;
|
||||
CsrUint16Des((CsrUint16 *) &primitive->rssi, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->snr, buffer, &offset);
|
||||
CsrUint16Des((CsrUint16 *) &primitive->rate, buffer, &offset);
|
||||
|
||||
return primitive;
|
||||
}
|
||||
|
||||
|
||||
void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer)
|
||||
{
|
||||
CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer;
|
||||
CsrPmemFree(primitive->frame);
|
||||
CsrPmemFree(primitive);
|
||||
}
|
||||
|
||||
|
78
drivers/staging/csr/csr_wifi_router_serialize.h
Normal file
78
drivers/staging/csr/csr_wifi_router_serialize.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_SERIALIZE_H__
|
||||
#define CSR_WIFI_ROUTER_SERIALIZE_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_pmem.h"
|
||||
#include "csr_wifi_msgconv.h"
|
||||
|
||||
#include "csr_wifi_router_prim.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void CsrWifiRouterPfree(void *ptr);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketSubscribeReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketSubscribeReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketSubscribeReqSerFree CsrWifiRouterPfree
|
||||
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqSer CsrWifiEventCsrUint16CsrUint8Ser
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqDes CsrWifiEventCsrUint16CsrUint8Des
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqSizeof CsrWifiEventCsrUint16CsrUint8Sizeof
|
||||
#define CsrWifiRouterMaPacketUnsubscribeReqSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketReqSizeof(void *msg);
|
||||
extern void CsrWifiRouterMaPacketReqSerFree(void *msg);
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketResSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketResDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketResSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketResSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketCancelReqSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketCancelReqDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketCancelReqSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketCancelReqSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketSubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketSubscribeCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketSubscribeCfmSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketUnsubscribeCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketUnsubscribeCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketUnsubscribeCfmSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketCfmSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketCfmDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketCfmSizeof(void *msg);
|
||||
#define CsrWifiRouterMaPacketCfmSerFree CsrWifiRouterPfree
|
||||
|
||||
extern CsrUint8* CsrWifiRouterMaPacketIndSer(CsrUint8 *ptr, CsrSize *len, void *msg);
|
||||
extern void* CsrWifiRouterMaPacketIndDes(CsrUint8 *buffer, CsrSize len);
|
||||
extern CsrSize CsrWifiRouterMaPacketIndSizeof(void *msg);
|
||||
extern void CsrWifiRouterMaPacketIndSerFree(void *msg);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CSR_WIFI_ROUTER_SERIALIZE_H__ */
|
||||
|
34
drivers/staging/csr/csr_wifi_router_task.h
Normal file
34
drivers/staging/csr/csr_wifi_router_task.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*****************************************************************************
|
||||
|
||||
(c) Cambridge Silicon Radio Limited 2011
|
||||
All rights reserved and confidential information of CSR
|
||||
|
||||
Refer to LICENSE.txt included with this source for details
|
||||
on the license terms.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/* Note: this is an auto-generated file. */
|
||||
|
||||
#ifndef CSR_WIFI_ROUTER_TASK_H__
|
||||
#define CSR_WIFI_ROUTER_TASK_H__
|
||||
|
||||
#include "csr_types.h"
|
||||
#include "csr_sched.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CSR_WIFI_ROUTER_LOG_ID 0x1201FFFF
|
||||
extern CsrSchedQid CSR_WIFI_ROUTER_IFACEQUEUE;
|
||||
void CsrWifiRouterInit(void **gash);
|
||||
void CsrWifiRouterDeinit(void **gash);
|
||||
void CsrWifiRouterHandler(void **gash);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CSR_WIFI_ROUTER_TASK_H__ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue