linux/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *  Copyright (C) 2008, cozybit Inc.
 *  Copyright (C) 2007, Red Hat, Inc.
 *  Copyright (C) 2003-2006, Marvell International Ltd.
 */
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/kthread.h>
#include <net/mac80211.h>

#include "deb_defs.h"

#ifndef DRV_NAME
#define DRV_NAME
#endif

#define MRVL_DEFAULT_RETRIES
#define MRVL_PER_PACKET_RATE
#define MRVL_MAX_BCN_SIZE
#define CMD_OPTION_WAITFORRSP

/* Return command are almost always the same as the host command, but with
 * bit 15 set high.  There are a few exceptions, though...
 */
#define CMD_RET(cmd)

/* Command codes */
#define CMD_GET_HW_SPEC
#define CMD_802_11_RESET
#define CMD_MAC_MULTICAST_ADR
#define CMD_802_11_RADIO_CONTROL
#define CMD_802_11_RF_CHANNEL
#define CMD_802_11_RF_TX_POWER
#define CMD_MAC_CONTROL
#define CMD_802_11_MAC_ADDRESS
#define CMD_SET_BOOT2_VER
#define CMD_802_11_BEACON_CTRL
#define CMD_802_11_BEACON_SET
#define CMD_802_11_SET_MODE
#define CMD_802_11_SET_BSSID

#define CMD_ACT_GET
#define CMD_ACT_SET

/* Define action or option for CMD_802_11_RESET */
#define CMD_ACT_HALT

/* Define action or option for CMD_MAC_CONTROL */
#define CMD_ACT_MAC_RX_ON
#define CMD_ACT_MAC_TX_ON
#define CMD_ACT_MAC_MULTICAST_ENABLE
#define CMD_ACT_MAC_BROADCAST_ENABLE
#define CMD_ACT_MAC_PROMISCUOUS_ENABLE
#define CMD_ACT_MAC_ALL_MULTICAST_ENABLE

/* Define action or option for CMD_802_11_RADIO_CONTROL */
#define CMD_TYPE_AUTO_PREAMBLE
#define CMD_TYPE_SHORT_PREAMBLE
#define CMD_TYPE_LONG_PREAMBLE

#define TURN_ON_RF
#define RADIO_ON
#define RADIO_OFF

#define SET_AUTO_PREAMBLE
#define SET_SHORT_PREAMBLE
#define SET_LONG_PREAMBLE

/* Define action or option for CMD_802_11_RF_CHANNEL */
#define CMD_OPT_802_11_RF_CHANNEL_GET
#define CMD_OPT_802_11_RF_CHANNEL_SET

/* Codes for CMD_802_11_SET_MODE */
enum lbtf_mode {};

/** Card Event definition */
#define MACREG_INT_CODE_FIRMWARE_READY
/** Buffer Constants */

/*	The size of SQ memory PPA, DPA are 8 DWORDs, that keep the physical
*	addresses of TxPD buffers. Station has only 8 TxPD available, Whereas
*	driver has more local TxPDs. Each TxPD on the host memory is associated
*	with a Tx control node. The driver maintains 8 RxPD descriptors for
*	station firmware to store Rx packet information.
*
*	Current version of MAC has a 32x6 multicast address buffer.
*
*	802.11b can have up to  14 channels, the driver keeps the
*	BSSID(MAC address) of each APs or Ad hoc stations it has sensed.
*/

#define MRVDRV_MAX_MULTICAST_LIST_SIZE
#define LBS_NUM_CMD_BUFFERS
#define LBS_CMD_BUFFER_SIZE
#define MRVDRV_MAX_CHANNEL_SIZE
#define MRVDRV_SNAP_HEADER_LEN

#define LBS_UPLD_SIZE
#define DEV_NAME_LEN

/** Misc constants */
/* This section defines 802.11 specific contants */

#define MRVDRV_MAX_REGION_CODE
/**
 * the table to keep region code
 */
#define LBTF_REGDOMAIN_US
#define LBTF_REGDOMAIN_CA
#define LBTF_REGDOMAIN_EU
#define LBTF_REGDOMAIN_SP
#define LBTF_REGDOMAIN_FR
#define LBTF_REGDOMAIN_JP

#define SBI_EVENT_CAUSE_SHIFT

/** RxPD status */

#define MRVDRV_RXPD_STATUS_OK


/* This is for firmware specific length */
#define EXTRA_LEN

#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE

#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE

#define CMD_F_HOSTCMD
#define FW_CAPINFO_WPA

#define RF_ANTENNA_1
#define RF_ANTENNA_2
#define RF_ANTENNA_AUTO

#define LBTF_EVENT_BCN_SENT

/** Global Variable Declaration */
/** mv_ms_type */
enum mv_ms_type {};

extern struct workqueue_struct *lbtf_wq;

struct lbtf_private;

struct lbtf_offset_value {};

struct channel_range {};

struct if_usb_card;

struct lbtf_ops {};

/** Private structure for the MV device */
struct lbtf_private {};

/* 802.11-related definitions */

/* TxPD descriptor */
struct txpd {} __packed;

/* RxPD Descriptor */
struct rxpd {} __packed;

struct cmd_header {} __packed;

struct cmd_ctrl_node {};

/*
 * Define data structure for CMD_GET_HW_SPEC
 * This structure defines the response for the GET_HW_SPEC command
 */
struct cmd_ds_get_hw_spec {} __packed;

struct cmd_ds_mac_control {} __packed;

struct cmd_ds_802_11_mac_address {} __packed;

struct cmd_ds_mac_multicast_addr {} __packed;

struct cmd_ds_set_mode {} __packed;

struct cmd_ds_set_bssid {} __packed;

struct cmd_ds_802_11_radio_control {} __packed;


struct cmd_ds_802_11_rf_channel {} __packed;

struct cmd_ds_set_boot2_ver {} __packed;

struct cmd_ds_802_11_reset {} __packed;

struct cmd_ds_802_11_beacon_control {} __packed;

struct cmd_ds_802_11_beacon_set {} __packed;

struct cmd_ctrl_node;

/** Function Prototype Declaration */
void lbtf_set_mac_control(struct lbtf_private *priv);

int lbtf_free_cmd_buffer(struct lbtf_private *priv);

int lbtf_allocate_cmd_buffer(struct lbtf_private *priv);
int lbtf_execute_next_command(struct lbtf_private *priv);
int lbtf_set_radio_control(struct lbtf_private *priv);
int lbtf_update_hw_spec(struct lbtf_private *priv);
int lbtf_cmd_set_mac_multicast_addr(struct lbtf_private *priv);
void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode);
void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid);
int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr);

int lbtf_set_channel(struct lbtf_private *priv, u8 channel);

int lbtf_beacon_set(struct lbtf_private *priv, struct sk_buff *beacon);
int lbtf_beacon_ctrl(struct lbtf_private *priv, bool beacon_enable,
		     int beacon_int);


int lbtf_process_rx_command(struct lbtf_private *priv);
void lbtf_complete_command(struct lbtf_private *priv, struct cmd_ctrl_node *cmd,
			  int result);
void lbtf_cmd_response_rx(struct lbtf_private *priv);

/* main.c */
struct chan_freq_power *lbtf_get_region_cfp_table(u8 region,
	int *cfp_no);
struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev,
				   const struct lbtf_ops *ops);
int lbtf_remove_card(struct lbtf_private *priv);
int lbtf_start_card(struct lbtf_private *priv);
int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb);
void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail);
void lbtf_bcn_sent(struct lbtf_private *priv);

/* support functions for cmd.c */
/* lbtf_cmd() infers the size of the buffer to copy data back into, from
   the size of the target of the pointer. Since the command to be sent
   may often be smaller, that size is set in cmd->size by the caller.*/
#define lbtf_cmd(priv, cmdnr, cmd, cb, cb_arg)

#define lbtf_cmd_with_response(priv, cmdnr, cmd)

void lbtf_cmd_async(struct lbtf_private *priv, uint16_t command,
	struct cmd_header *in_cmd, int in_cmd_size);

int __lbtf_cmd(struct lbtf_private *priv, uint16_t command,
	      struct cmd_header *in_cmd, int in_cmd_size,
	      int (*callback)(struct lbtf_private *, unsigned long,
			      struct cmd_header *),
	      unsigned long callback_arg);

int lbtf_cmd_copyback(struct lbtf_private *priv, unsigned long extra,
		     struct cmd_header *resp);