Dan Williams | 14e865b | 2007-12-10 15:11:23 -0500 | [diff] [blame] | 1 | /* Copyright (C) 2007, Red Hat, Inc. */ |
| 2 | |
| 3 | #ifndef _LBS_CMD_H_ |
| 4 | #define _LBS_CMD_H_ |
| 5 | |
Holger Schurig | 9e66e70 | 2009-10-16 17:32:16 +0200 | [diff] [blame^] | 6 | #include "host.h" |
Dan Williams | 14e865b | 2007-12-10 15:11:23 -0500 | [diff] [blame] | 7 | #include "dev.h" |
| 8 | |
David Woodhouse | f15ebb6 | 2007-12-19 13:03:19 +0000 | [diff] [blame] | 9 | /* lbs_cmd() infers the size of the buffer to copy data back into, from |
| 10 | the size of the target of the pointer. Since the command to be sent |
| 11 | may often be smaller, that size is set in cmd->size by the caller.*/ |
| 12 | #define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) ({ \ |
| 13 | uint16_t __sz = le16_to_cpu((cmd)->hdr.size); \ |
| 14 | (cmd)->hdr.size = cpu_to_le16(sizeof(*(cmd))); \ |
| 15 | __lbs_cmd(priv, cmdnr, &(cmd)->hdr, __sz, cb, cb_arg); \ |
| 16 | }) |
Dan Williams | 14e865b | 2007-12-10 15:11:23 -0500 | [diff] [blame] | 17 | |
David Woodhouse | 689442d | 2007-12-12 16:00:42 -0500 | [diff] [blame] | 18 | #define lbs_cmd_with_response(priv, cmdnr, cmd) \ |
| 19 | lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) |
David Woodhouse | 7e22627 | 2007-12-14 22:53:41 -0500 | [diff] [blame] | 20 | |
Holger Schurig | 8db4a2b | 2008-03-19 10:11:00 +0100 | [diff] [blame] | 21 | void lbs_cmd_async(struct lbs_private *priv, uint16_t command, |
| 22 | struct cmd_header *in_cmd, int in_cmd_size); |
| 23 | |
Dan Williams | 7ad994d | 2007-12-11 12:33:30 -0500 | [diff] [blame] | 24 | int __lbs_cmd(struct lbs_private *priv, uint16_t command, |
David Woodhouse | 7e22627 | 2007-12-14 22:53:41 -0500 | [diff] [blame] | 25 | struct cmd_header *in_cmd, int in_cmd_size, |
Dan Williams | 7ad994d | 2007-12-11 12:33:30 -0500 | [diff] [blame] | 26 | int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), |
Dan Williams | 14e865b | 2007-12-10 15:11:23 -0500 | [diff] [blame] | 27 | unsigned long callback_arg); |
| 28 | |
Holger Schurig | 6d898b1 | 2009-10-14 16:49:53 +0200 | [diff] [blame] | 29 | struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, |
| 30 | uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, |
| 31 | int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), |
| 32 | unsigned long callback_arg); |
| 33 | |
Anna Neal | 0112c9e | 2008-09-11 11:17:25 -0700 | [diff] [blame] | 34 | int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, |
| 35 | int8_t p1, int8_t p2); |
| 36 | |
| 37 | int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, |
| 38 | int8_t p2, int usesnr); |
| 39 | |
Anna Neal | 3ed6e08 | 2008-09-26 11:34:35 -0400 | [diff] [blame] | 40 | int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0, |
| 41 | int8_t p1, int8_t p2); |
| 42 | |
| 43 | int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1, |
| 44 | int8_t p2, int usesnr); |
| 45 | |
Dan Williams | a8bdcd7 | 2007-12-11 12:40:35 -0500 | [diff] [blame] | 46 | int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, |
| 47 | struct cmd_header *resp); |
| 48 | |
Dan Williams | 6e66f03 | 2007-12-11 12:42:16 -0500 | [diff] [blame] | 49 | int lbs_update_hw_spec(struct lbs_private *priv); |
| 50 | |
David Woodhouse | 301eacb | 2007-12-11 15:23:59 -0500 | [diff] [blame] | 51 | int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, |
| 52 | struct cmd_ds_mesh_access *cmd); |
| 53 | |
Dan Williams | 8e3c91b | 2007-12-11 15:50:59 -0500 | [diff] [blame] | 54 | int lbs_set_data_rate(struct lbs_private *priv, u8 rate); |
| 55 | |
Dan Williams | 2dd4b26 | 2007-12-11 16:54:15 -0500 | [diff] [blame] | 56 | int lbs_get_channel(struct lbs_private *priv); |
| 57 | int lbs_set_channel(struct lbs_private *priv, u8 channel); |
| 58 | |
Javier Cardona | edaea5c | 2008-05-17 00:55:10 -0700 | [diff] [blame] | 59 | int lbs_mesh_config_send(struct lbs_private *priv, |
| 60 | struct cmd_ds_mesh_config *cmd, |
| 61 | uint16_t action, uint16_t type); |
David Woodhouse | 8606213 | 2007-12-13 00:32:36 -0500 | [diff] [blame] | 62 | int lbs_mesh_config(struct lbs_private *priv, uint16_t enable, uint16_t chan); |
David Woodhouse | 23a397a | 2007-12-11 18:56:42 -0500 | [diff] [blame] | 63 | |
Anna Neal | 582c1b5 | 2008-10-20 16:46:56 -0700 | [diff] [blame] | 64 | int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, |
| 65 | struct wol_config *p_wol_config); |
David Woodhouse | ab25eca | 2007-12-12 17:38:56 -0500 | [diff] [blame] | 66 | int lbs_suspend(struct lbs_private *priv); |
Holger Schurig | a63e5cb | 2008-04-30 10:50:39 +0200 | [diff] [blame] | 67 | void lbs_resume(struct lbs_private *priv); |
David Woodhouse | 6ce4fd2 | 2007-12-12 15:19:29 -0500 | [diff] [blame] | 68 | |
Javier Cardona | 85319f9 | 2008-05-24 10:59:49 +0100 | [diff] [blame] | 69 | int lbs_cmd_802_11_rate_adapt_rateset(struct lbs_private *priv, |
| 70 | uint16_t cmd_action); |
David Woodhouse | 6e5cc4f | 2007-12-17 23:04:37 -0500 | [diff] [blame] | 71 | int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, |
| 72 | uint16_t cmd_action, uint16_t *timeout); |
David Woodhouse | 3fbe104 | 2007-12-17 23:48:31 -0500 | [diff] [blame] | 73 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, |
| 74 | struct sleep_params *sp); |
David Woodhouse | f70dd45 | 2007-12-18 00:18:05 -0500 | [diff] [blame] | 75 | int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, |
| 76 | struct assoc_request *assoc); |
David Woodhouse | 4f59abf | 2007-12-18 00:47:17 -0500 | [diff] [blame] | 77 | int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, |
| 78 | uint16_t *enable); |
David Woodhouse | 9e1228d | 2008-03-03 12:15:39 +0100 | [diff] [blame] | 79 | int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action, |
| 80 | struct assoc_request *assoc); |
David Woodhouse | 6e5cc4f | 2007-12-17 23:04:37 -0500 | [diff] [blame] | 81 | |
Dan Williams | 87c8c72 | 2008-08-19 15:15:35 -0400 | [diff] [blame] | 82 | int lbs_get_tx_power(struct lbs_private *priv, s16 *curlevel, s16 *minlevel, |
| 83 | s16 *maxlevel); |
| 84 | int lbs_set_tx_power(struct lbs_private *priv, s16 dbm); |
| 85 | |
Dan Williams | d5db2df | 2008-08-21 17:51:07 -0400 | [diff] [blame] | 86 | int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on); |
| 87 | |
Dan Williams | 39fcf7a | 2008-09-10 12:49:00 -0400 | [diff] [blame] | 88 | int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val); |
| 89 | |
| 90 | int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val); |
| 91 | |
Dan Williams | 14e865b | 2007-12-10 15:11:23 -0500 | [diff] [blame] | 92 | #endif /* _LBS_CMD_H */ |