Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (C) 2007, Red Hat, Inc. */
0003 
0004 #ifndef _LBS_CMD_H_
0005 #define _LBS_CMD_H_
0006 
0007 #include <net/cfg80211.h>
0008 
0009 #include "host.h"
0010 #include "dev.h"
0011 
0012 
0013 /* Command & response transfer between host and card */
0014 
0015 struct cmd_ctrl_node {
0016     struct list_head list;
0017     int result;
0018     /* command response */
0019     int (*callback)(struct lbs_private *,
0020             unsigned long,
0021             struct cmd_header *);
0022     unsigned long callback_arg;
0023     /* command data */
0024     struct cmd_header *cmdbuf;
0025     /* wait queue */
0026     u16 cmdwaitqwoken;
0027     wait_queue_head_t cmdwait_q;
0028 };
0029 
0030 
0031 /* lbs_cmd() infers the size of the buffer to copy data back into, from
0032    the size of the target of the pointer. Since the command to be sent
0033    may often be smaller, that size is set in cmd->size by the caller.*/
0034 #define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg)   ({      \
0035     uint16_t __sz = le16_to_cpu((cmd)->hdr.size);       \
0036     (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd)));      \
0037     __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg);  \
0038 })
0039 
0040 #define lbs_cmd_with_response(priv, cmdnr, cmd) \
0041     lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))
0042 
0043 void lbs_cmd_async(struct lbs_private *priv, uint16_t command,
0044     struct cmd_header *in_cmd, int in_cmd_size);
0045 
0046 int __lbs_cmd(struct lbs_private *priv, uint16_t command,
0047           struct cmd_header *in_cmd, int in_cmd_size,
0048           int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
0049           unsigned long callback_arg);
0050 
0051 struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
0052     uint16_t command, struct cmd_header *in_cmd, int in_cmd_size,
0053     int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
0054     unsigned long callback_arg);
0055 
0056 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
0057              struct cmd_header *resp);
0058 
0059 int lbs_allocate_cmd_buffer(struct lbs_private *priv);
0060 int lbs_free_cmd_buffer(struct lbs_private *priv);
0061 
0062 int lbs_execute_next_command(struct lbs_private *priv);
0063 void __lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
0064                 int result);
0065 void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
0066               int result);
0067 int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len);
0068 
0069 
0070 /* From cmdresp.c */
0071 
0072 void lbs_mac_event_disconnected(struct lbs_private *priv,
0073                 bool locally_generated);
0074 
0075 
0076 
0077 /* Events */
0078 
0079 void lbs_process_event(struct lbs_private *priv, u32 event);
0080 
0081 
0082 /* Actual commands */
0083 
0084 int lbs_update_hw_spec(struct lbs_private *priv);
0085 
0086 int lbs_set_channel(struct lbs_private *priv, u8 channel);
0087 
0088 int lbs_update_channel(struct lbs_private *priv);
0089 
0090 int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
0091         struct wol_config *p_wol_config);
0092 
0093 int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action,
0094                 struct sleep_params *sp);
0095 
0096 void lbs_ps_confirm_sleep(struct lbs_private *priv);
0097 
0098 int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on);
0099 
0100 void lbs_set_mac_control(struct lbs_private *priv);
0101 int lbs_set_mac_control_sync(struct lbs_private *priv);
0102 
0103 int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel,
0104              s16 *maxlevel);
0105 
0106 int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val);
0107 
0108 int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val);
0109 
0110 
0111 /* Commands only used in wext.c, assoc. and scan.c */
0112 
0113 int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
0114         int8_t p1, int8_t p2);
0115 
0116 int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
0117         int8_t p2, int usesnr);
0118 
0119 int lbs_set_data_rate(struct lbs_private *priv, u8 rate);
0120 
0121 int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv,
0122                       uint16_t cmd_action);
0123 
0124 int lbs_set_tx_power(struct lbs_private *priv, s16 dbm);
0125 
0126 int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep);
0127 
0128 int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep);
0129 
0130 int lbs_set_monitor_mode(struct lbs_private *priv, int enable);
0131 
0132 int lbs_get_rssi(struct lbs_private *priv, s8 *snr, s8 *nf);
0133 
0134 int lbs_set_11d_domain_info(struct lbs_private *priv);
0135 
0136 int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value);
0137 
0138 int lbs_set_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 value);
0139 
0140 int lbs_set_ps_mode(struct lbs_private *priv, u16 cmd_action, bool block);
0141 
0142 #endif /* _LBS_CMD_H */