* the result code from the firmware
*/
-int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
- int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
+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)
{
struct cmd_ctrl_node *cmdnode;
- struct cmd_ds_gen *cmdptr;
+ struct cmd_header *send_cmd;
unsigned long flags;
int ret = 0;
}
cmdnode = lbs_get_cmd_ctrl_node(priv);
-
if (cmdnode == NULL) {
lbs_deb_host("PREP_CMD: cmdnode is NULL\n");
goto done;
}
- cmdptr = (struct cmd_ds_gen *)cmdnode->bufvirtualaddr;
+ send_cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
cmdnode->callback = callback;
cmdnode->callback_arg = callback_arg;
+ /* Copy the incoming command to the buffer */
+ memcpy(send_cmd, in_cmd, in_cmd_size);
+
/* Set sequence number, clean result, move to buffer */
priv->seqnum++;
- cmdptr->command = cpu_to_le16(command);
- cmdptr->size = cpu_to_le16(cmd_size + S_DS_GEN);
- cmdptr->seqnum = cpu_to_le16(priv->seqnum);
- cmdptr->result = 0;
- memcpy(cmdptr->cmdresp, cmd, cmd_size);
+ send_cmd->command = cpu_to_le16(command);
+ send_cmd->size = cpu_to_le16(in_cmd_size);
+ send_cmd->seqnum = cpu_to_le16(priv->seqnum);
+ send_cmd->result = 0;
lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
#include "dev.h"
#define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \
- __lbs_cmd(priv, cmdnr, &cmd, sizeof(cmd), callback, callback_arg)
+ __lbs_cmd(priv, cmdnr, (struct cmd_header *) &cmd, sizeof(cmd), \
+ callback, callback_arg)
-int __lbs_cmd(struct lbs_private *priv, uint16_t command, void *cmd, int cmd_size,
- int (*callback)(struct lbs_private *, unsigned long, struct cmd_ds_command *),
+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);
#endif /* _LBS_CMD_H */
spin_unlock_irqrestore(&priv->driver_lock, flags);
- if (priv->cur_cmd && priv->cur_cmd->callback)
- ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, resp);
- else
+ if (priv->cur_cmd && priv->cur_cmd->callback) {
+ ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
+ (struct cmd_header *) resp);
+ } else
ret = handle_cmd_response(priv, 0, resp);
spin_lock_irqsave(&priv->driver_lock, flags);
u8 reserved[3];
};
+struct cmd_header {
+ __le16 command;
+ __le16 size;
+ __le16 seqnum;
+ __le16 result;
+} __attribute__ ((packed));
+
struct cmd_ctrl_node {
struct list_head list;
/* wait for finish or not */
u16 wait_option;
/* command response */
void *pdata_buf;
- int (*callback)(struct lbs_private *priv, unsigned long arg, struct cmd_ds_command *resp);
+ int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
unsigned long callback_arg;
/* command data */
u8 *bufvirtualaddr;
};
struct cmd_ds_set_boot2_ver {
+ struct cmd_header hdr;
+
__le16 action;
__le16 version;
};
struct cmd_ds_bt_access bt;
struct cmd_ds_fwt_access fwt;
struct cmd_ds_mesh_access mesh;
- struct cmd_ds_set_boot2_ver boot2_ver;
struct cmd_ds_get_tsf gettsf;
struct cmd_ds_802_11_subscribe_event subscribe_event;
struct cmd_ds_802_11_beacon_control bcn_ctrl;