Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
cmd.c File Reference
#include <linux/hardirq.h>
#include <linux/kfifo.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/if_arp.h>
#include <linux/export.h>
#include "decl.h"
#include "cfg.h"
#include "cmd.h"

Go to the source code of this file.

Macros

#define CAL_NF(nf)   ((s32)(-(s32)(nf)))
 
#define CAL_RSSI(snr, nf)   ((s32)((s32)(snr) + CAL_NF(nf)))
 

Functions

int lbs_cmd_copyback (struct lbs_private *priv, unsigned long extra, struct cmd_header *resp)
 
 EXPORT_SYMBOL_GPL (lbs_cmd_copyback)
 
int lbs_update_hw_spec (struct lbs_private *priv)
 
int lbs_host_sleep_cfg (struct lbs_private *priv, uint32_t criteria, struct wol_config *p_wol_config)
 
 EXPORT_SYMBOL_GPL (lbs_host_sleep_cfg)
 
int lbs_set_ps_mode (struct lbs_private *priv, u16 cmd_action, bool block)
 
int lbs_cmd_802_11_sleep_params (struct lbs_private *priv, uint16_t cmd_action, struct sleep_params *sp)
 
int lbs_set_deep_sleep (struct lbs_private *priv, int deep_sleep)
 
int lbs_set_host_sleep (struct lbs_private *priv, int host_sleep)
 
int lbs_set_snmp_mib (struct lbs_private *priv, u32 oid, u16 val)
 
int lbs_get_snmp_mib (struct lbs_private *priv, u32 oid, u16 *out_val)
 
int lbs_get_tx_power (struct lbs_private *priv, s16 *curlevel, s16 *minlevel, s16 *maxlevel)
 
int lbs_set_tx_power (struct lbs_private *priv, s16 dbm)
 
int lbs_set_monitor_mode (struct lbs_private *priv, int enable)
 
int lbs_update_channel (struct lbs_private *priv)
 
int lbs_set_channel (struct lbs_private *priv, u8 channel)
 
int lbs_get_rssi (struct lbs_private *priv, s8 *rssi, s8 *nf)
 
int lbs_set_11d_domain_info (struct lbs_private *priv)
 
int lbs_get_reg (struct lbs_private *priv, u16 reg, u16 offset, u32 *value)
 
int lbs_set_reg (struct lbs_private *priv, u16 reg, u16 offset, u32 value)
 
void __lbs_complete_command (struct lbs_private *priv, struct cmd_ctrl_node *cmd, int result)
 
void lbs_complete_command (struct lbs_private *priv, struct cmd_ctrl_node *cmd, int result)
 
int lbs_set_radio (struct lbs_private *priv, u8 preamble, u8 radio_on)
 
void lbs_set_mac_control (struct lbs_private *priv)
 
int lbs_set_mac_control_sync (struct lbs_private *priv)
 
int lbs_allocate_cmd_buffer (struct lbs_private *priv)
 
int lbs_free_cmd_buffer (struct lbs_private *priv)
 
int lbs_execute_next_command (struct lbs_private *priv)
 
void lbs_ps_confirm_sleep (struct lbs_private *priv)
 
int lbs_set_tpc_cfg (struct lbs_private *priv, int enable, int8_t p0, int8_t p1, int8_t p2, int usesnr)
 
int lbs_set_power_adapt_cfg (struct lbs_private *priv, int enable, int8_t p0, int8_t p1, int8_t p2)
 
struct cmd_ctrl_node__lbs_cmd_async (struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int(*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg)
 
void lbs_cmd_async (struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size)
 
int __lbs_cmd (struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int(*callback)(struct lbs_private *, unsigned long, struct cmd_header *), unsigned long callback_arg)
 
 EXPORT_SYMBOL_GPL (__lbs_cmd)
 

Macro Definition Documentation

#define CAL_NF (   nf)    ((s32)(-(s32)(nf)))

Definition at line 17 of file cmd.c.

#define CAL_RSSI (   snr,
  nf 
)    ((s32)((s32)(snr) + CAL_NF(nf)))

Definition at line 18 of file cmd.c.

Function Documentation

int __lbs_cmd ( struct lbs_private priv,
uint16_t  command,
struct cmd_header in_cmd,
int  in_cmd_size,
int(*)(struct lbs_private *, unsigned long, struct cmd_header *)  callback,
unsigned long  callback_arg 
)

Definition at line 1684 of file cmd.c.

struct cmd_ctrl_node* __lbs_cmd_async ( struct lbs_private priv,
uint16_t  command,
struct cmd_header in_cmd,
int  in_cmd_size,
int(*)(struct lbs_private *, unsigned long, struct cmd_header *)  callback,
unsigned long  callback_arg 
)
read

Definition at line 1617 of file cmd.c.

void __lbs_complete_command ( struct lbs_private priv,
struct cmd_ctrl_node cmd,
int  result 
)

Definition at line 1075 of file cmd.c.

EXPORT_SYMBOL_GPL ( lbs_cmd_copyback  )
EXPORT_SYMBOL_GPL ( lbs_host_sleep_cfg  )
EXPORT_SYMBOL_GPL ( __lbs_cmd  )
int lbs_allocate_cmd_buffer ( struct lbs_private priv)

lbs_allocate_cmd_buffer - allocates the command buffer and links it to command free queue

: A pointer to &struct lbs_private structure

returns: 0 for success or -1 on error

Definition at line 1186 of file cmd.c.

int lbs_cmd_802_11_sleep_params ( struct lbs_private priv,
uint16_t  cmd_action,
struct sleep_params sp 
)

Definition at line 269 of file cmd.c.

void lbs_cmd_async ( struct lbs_private priv,
uint16_t  command,
struct cmd_header in_cmd,
int  in_cmd_size 
)

Definition at line 1675 of file cmd.c.

int lbs_cmd_copyback ( struct lbs_private priv,
unsigned long  extra,
struct cmd_header resp 
)

lbs_cmd_copyback - Simple callback that copies response back into command

: A pointer to &struct lbs_private structure : A pointer to the original command structure for which 'resp' is a response : A pointer to the command response

returns: 0 on success, error on failure

Definition at line 30 of file cmd.c.

void lbs_complete_command ( struct lbs_private priv,
struct cmd_ctrl_node cmd,
int  result 
)

Definition at line 1096 of file cmd.c.

int lbs_execute_next_command ( struct lbs_private priv)

lbs_execute_next_command - execute next command in command pending queue. Will put firmware back to PS mode if applicable.

: A pointer to &struct lbs_private structure

returns: 0 on success or -1 on error

Definition at line 1310 of file cmd.c.

int lbs_free_cmd_buffer ( struct lbs_private priv)

lbs_free_cmd_buffer - free the command buffer

: A pointer to &struct lbs_private structure

returns: 0 for success

Definition at line 1232 of file cmd.c.

int lbs_get_reg ( struct lbs_private priv,
u16  reg,
u16  offset,
u32 value 
)

lbs_get_reg - Read a MAC, Baseband, or RF register

: pointer to &struct lbs_private : register command, one of CMD_MAC_REG_ACCESS, CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS : byte offset of the register to get : on success, the value of the register at 'offset'

returns: 0 on success, error code on failure

Definition at line 867 of file cmd.c.

int lbs_get_rssi ( struct lbs_private priv,
s8 rssi,
s8 nf 
)

lbs_get_rssi - Get current RSSI and noise floor

: A pointer to &struct lbs_private structure : On successful return, signal level in mBm : On successful return, Noise floor

returns: The channel on success, error on failure

Definition at line 706 of file cmd.c.

int lbs_get_snmp_mib ( struct lbs_private priv,
u32  oid,
u16 out_val 
)

lbs_get_snmp_mib - Get an SNMP MIB value

: A pointer to &struct lbs_private structure : The OID to retrieve from the firmware : Location for the returned value

returns: 0 on success, error on failure

Definition at line 486 of file cmd.c.

int lbs_get_tx_power ( struct lbs_private priv,
s16 curlevel,
s16 minlevel,
s16 maxlevel 
)

lbs_get_tx_power - Get the min, max, and current TX power

: A pointer to &struct lbs_private structure : Current power level in dBm : Minimum supported power level in dBm (optional) : Maximum supported power level in dBm (optional)

returns: 0 on success, error on failure

Definition at line 530 of file cmd.c.

int lbs_host_sleep_cfg ( struct lbs_private priv,
uint32_t  criteria,
struct wol_config p_wol_config 
)

Definition at line 183 of file cmd.c.

void lbs_ps_confirm_sleep ( struct lbs_private priv)

lbs_ps_confirm_sleep - checks condition and prepares to send sleep confirm command to firmware if ok

: A pointer to &struct lbs_private structure

returns: n/a

Definition at line 1516 of file cmd.c.

int lbs_set_11d_domain_info ( struct lbs_private priv)

lbs_set_11d_domain_info - Send regulatory and 802.11d domain information to the firmware

: pointer to &struct lbs_private

returns: 0 on success, error code on failure

Definition at line 739 of file cmd.c.

int lbs_set_channel ( struct lbs_private priv,
u8  channel 
)

lbs_set_channel - Set the radio channel

: A pointer to &struct lbs_private structure : The desired channel, or 0 to clear a locked channel

returns: 0 on success, error on failure

Definition at line 669 of file cmd.c.

int lbs_set_deep_sleep ( struct lbs_private priv,
int  deep_sleep 
)

Definition at line 329 of file cmd.c.

int lbs_set_host_sleep ( struct lbs_private priv,
int  host_sleep 
)

Definition at line 376 of file cmd.c.

void lbs_set_mac_control ( struct lbs_private priv)

Definition at line 1147 of file cmd.c.

int lbs_set_mac_control_sync ( struct lbs_private priv)

Definition at line 1162 of file cmd.c.

int lbs_set_monitor_mode ( struct lbs_private priv,
int  enable 
)

lbs_set_monitor_mode - Enable or disable monitor mode (only implemented on OLPC usb8388 FW)

: A pointer to &struct lbs_private structure : 1 to enable monitor mode, 0 to disable

returns: 0 on success, error on failure

Definition at line 592 of file cmd.c.

int lbs_set_power_adapt_cfg ( struct lbs_private priv,
int  enable,
int8_t  p0,
int8_t  p1,
int8_t  p2 
)

lbs_set_power_adapt_cfg - Configures the power adaptation settings

: A pointer to &struct lbs_private structure : Power adaptation enable : Power level for 1, 2, 5.5 and 11 Mbps (dBm). : Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). : Power level for 48 and 54 Mbps (dBm).

returns: 0 on Success

Definition at line 1597 of file cmd.c.

int lbs_set_ps_mode ( struct lbs_private priv,
u16  cmd_action,
bool  block 
)

lbs_set_ps_mode - Sets the Power Save mode

: A pointer to &struct lbs_private structure : The Power Save operation (PS_MODE_ACTION_ENTER_PS or PS_MODE_ACTION_EXIT_PS) : Whether to block on a response or not

returns: 0 on success, error on failure

Definition at line 234 of file cmd.c.

int lbs_set_radio ( struct lbs_private priv,
u8  preamble,
u8  radio_on 
)

Definition at line 1105 of file cmd.c.

int lbs_set_reg ( struct lbs_private priv,
u16  reg,
u16  offset,
u32  value 
)

lbs_set_reg - Write a MAC, Baseband, or RF register

: pointer to &struct lbs_private : register command, one of CMD_MAC_REG_ACCESS, CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS : byte offset of the register to set : the value to write to the register at 'offset'

returns: 0 on success, error code on failure

Definition at line 912 of file cmd.c.

int lbs_set_snmp_mib ( struct lbs_private priv,
u32  oid,
u16  val 
)

lbs_set_snmp_mib - Set an SNMP MIB value

: A pointer to &struct lbs_private structure : The OID to set in the firmware : Value to set the OID to

returns: 0 on success, error on failure

Definition at line 436 of file cmd.c.

int lbs_set_tpc_cfg ( struct lbs_private priv,
int  enable,
int8_t  p0,
int8_t  p1,
int8_t  p2,
int  usesnr 
)

lbs_set_tpc_cfg - Configures the transmission power control functionality

: A pointer to &struct lbs_private structure : Transmission power control enable : Power level when link quality is good (dBm). : Power level when link quality is fair (dBm). : Power level when link quality is poor (dBm). : Use Signal to Noise Ratio in TPC

returns: 0 on success

Definition at line 1565 of file cmd.c.

int lbs_set_tx_power ( struct lbs_private priv,
s16  dbm 
)

lbs_set_tx_power - Set the TX power

: A pointer to &struct lbs_private structure : The desired power level in dBm

returns: 0 on success, error on failure

Definition at line 563 of file cmd.c.

int lbs_update_channel ( struct lbs_private priv)

Definition at line 645 of file cmd.c.

int lbs_update_hw_spec ( struct lbs_private priv)

lbs_update_hw_spec - Updates the hardware details like MAC address and regulatory region

: A pointer to &struct lbs_private structure

returns: 0 on success, error on failure

Definition at line 88 of file cmd.c.