/* * Copyright (c) 2014 Redpine Signals Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/** * rsi_dbg() - This function outputs informational messages. * @zone: Zone of interest for output message. * @fmt: printf-style format for output message. * * Return: none
*/ void rsi_dbg(u32 zone, constchar *fmt, ...)
{ struct va_format vaf;
va_list args;
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
if (zone & rsi_zone_enabled)
pr_info("%pV", &vaf);
va_end(args);
}
EXPORT_SYMBOL_GPL(rsi_dbg);
staticchar *opmode_str(int oper_mode)
{ switch (oper_mode) { case DEV_OPMODE_WIFI_ALONE: return"Wi-Fi alone"; case DEV_OPMODE_BT_ALONE: return"BT EDR alone"; case DEV_OPMODE_BT_LE_ALONE: return"BT LE alone"; case DEV_OPMODE_BT_DUAL: return"BT Dual"; case DEV_OPMODE_STA_BT: return"Wi-Fi STA + BT EDR"; case DEV_OPMODE_STA_BT_LE: return"Wi-Fi STA + BT LE"; case DEV_OPMODE_STA_BT_DUAL: return"Wi-Fi STA + BT DUAL"; case DEV_OPMODE_AP_BT: return"Wi-Fi AP + BT EDR"; case DEV_OPMODE_AP_BT_DUAL: return"Wi-Fi AP + BT DUAL";
}
/** * rsi_read_pkt() - This function reads frames from the card. * @common: Pointer to the driver private structure. * @rx_pkt: Received pkt. * @rcv_pkt_len: Received pkt length. In case of USB it is 0. * * Return: 0 on success, -1 on failure.
*/ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len)
{
u8 *frame_desc = NULL, extended_desc = 0;
u32 index, length = 0, queueno = 0;
u16 actual_length = 0, offset; struct sk_buff *skb = NULL; #ifdef CONFIG_RSI_COEX
u8 bt_pkt_type; #endif
index = 0; do {
frame_desc = &rx_pkt[index];
actual_length = *(u16 *)&frame_desc[0];
offset = *(u16 *)&frame_desc[2]; if (!rcv_pkt_len && offset >
RSI_MAX_RX_USB_PKT_SIZE - FRAME_DESC_SZ) goto fail;
/** * rsi_tx_scheduler_thread() - This function is a kernel thread to send the * packets to the device. * @common: Pointer to the driver private structure. * * Return: None.
*/ staticvoid rsi_tx_scheduler_thread(struct rsi_common *common)
{ struct rsi_hw *adapter = common->priv;
u32 timeout = EVENT_WAIT_FOREVER;
do { if (adapter->determine_event_timeout)
timeout = adapter->determine_event_timeout(adapter);
rsi_wait_event(&common->tx_thread.event, timeout);
rsi_reset_event(&common->tx_thread.event);
if (common->init_done)
rsi_core_qos_processor(common);
} while (atomic_read(&common->tx_thread.thread_done) == 0);
kthread_complete_and_exit(&common->tx_thread.completion, 0);
}
void rsi_attach_bt(struct rsi_common *common)
{ #ifdef CONFIG_RSI_COEX if (rsi_bt_ops.attach(common, &g_proto_ops))
rsi_dbg(ERR_ZONE, "Failed to attach BT module\n"); #endif
}
/** * rsi_91x_init() - This function initializes os interface operations. * @oper_mode: One of DEV_OPMODE_*. * * Return: Pointer to the adapter structure on success, NULL on failure .
*/ struct rsi_hw *rsi_91x_init(u16 oper_mode)
{ struct rsi_hw *adapter = NULL; struct rsi_common *common = NULL;
u8 ii = 0;
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); if (!adapter) return NULL;
adapter->priv = kzalloc(sizeof(*common), GFP_KERNEL); if (adapter->priv == NULL) {
rsi_dbg(ERR_ZONE, "%s: Failed in allocation of memory\n",
__func__);
kfree(adapter); return NULL;
} else {
common = adapter->priv;
common->priv = adapter;
}
for (ii = 0; ii < NUM_SOFT_QUEUES; ii++)
skb_queue_head_init(&common->tx_queue[ii]);
/** * rsi_91x_hal_module_init() - This function is invoked when the module is * loaded into the kernel. * It registers the client driver. * @void: Void. * * Return: 0 on success, -1 on failure.
*/ staticint rsi_91x_hal_module_init(void)
{
rsi_dbg(INIT_ZONE, "%s: Module init called\n", __func__); return 0;
}
/** * rsi_91x_hal_module_exit() - This function is called at the time of * removing/unloading the module. * It unregisters the client driver. * @void: Void. * * Return: None.
*/ staticvoid rsi_91x_hal_module_exit(void)
{
rsi_dbg(INIT_ZONE, "%s: Module exit called\n", __func__);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.