linux/drivers/staging/rtl8712/rtl871x_cmd.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
 *
 * Modifications for inclusion into the Linux staging tree are
 * Copyright(c) 2010 Larry Finger. All rights reserved.
 *
 * Contact information:
 * WLAN FAE <[email protected]>
 * Larry Finger <[email protected]>
 *
 ******************************************************************************/
#ifndef __RTL871X_CMD_H_
#define __RTL871X_CMD_H_

#include "wlan_bssdef.h"
#include "rtl871x_rf.h"
#define C2H_MEM_SZ

#include "osdep_service.h"
#include "ieee80211.h"

#define FREE_CMDOBJ_SZ
#define MAX_CMDSZ
#define MAX_RSPSZ
#define MAX_EVTSZ
#define CMDBUFF_ALIGN_SZ

struct cmd_obj {};

struct cmd_priv {};

struct evt_obj {};

struct	evt_priv {};

#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code)

void r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
void r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
struct cmd_obj *r8712_dequeue_cmd(struct  __queue *queue);
void r8712_free_cmd_obj(struct cmd_obj *pcmd);
int r8712_cmd_thread(void *context);
int r8712_init_cmd_priv(struct cmd_priv *pcmdpriv);
void r8712_free_cmd_priv(struct cmd_priv *pcmdpriv);
int r8712_init_evt_priv(struct evt_priv *pevtpriv);
void r8712_free_evt_priv(struct evt_priv *pevtpriv);

enum rtl871x_drvint_cid {};

enum RFINTFS {};

/*
 * Caller Mode: Infra, Ad-HoC(C)
 * Notes: To enter USB suspend mode
 * Command Mode
 */
struct usb_suspend_parm {};

/*
 * Caller Mode: Infra, Ad-HoC(C)
 * Notes: To disconnect the current associated BSS
 * Command Mode
 */
struct disconnect_parm {};

/*
 * Caller Mode: AP, Ad-HoC, Infra
 * Notes: To set the NIC mode of RTL8711
 * Command Mode
 * The definition of mode:
 *
 * #define IW_MODE_AUTO	0	// Let the driver decides which AP to join
 * #define IW_MODE_ADHOC	1	// Single cell network (Ad-Hoc Clients)
 * #define IW_MODE_INFRA	2	// Multi cell network, roaming, ..
 * #define IW_MODE_MASTER	3	// Synchronisation master or AP
 * #define IW_MODE_REPEAT	4	// Wireless Repeater (forwarder)
 * #define IW_MODE_SECOND	5	// Secondary master/repeater (backup)
 * #define IW_MODE_MONITOR	6	// Passive monitor (listen only)
 */
struct	setopmode_parm {};

/*
 * Caller Mode: AP, Ad-HoC, Infra
 * Notes: To ask RTL8711 performing site-survey
 * Command-Event Mode
 */
struct sitesurvey_parm {};

/*
 * Caller Mode: Any
 * Notes: To set the auth type of RTL8711. open/shared/802.1x
 * Command Mode
 */
struct setauth_parm {};

/*
 * Caller Mode: Infra
 * a. algorithm: wep40, wep104, tkip & aes
 * b. keytype: grp key/unicast key
 * c. key contents
 *
 * when shared key ==> keyid is the camid
 * when 802.1x ==> keyid [0:1] ==> grp key
 * when 802.1x ==> keyid > 2 ==> unicast key
 */
struct setkey_parm {};

/*
 * When in AP or Ad-Hoc mode, this is used to
 * allocate an sw/hw entry for a newly associated sta.
 * Command
 * when shared key ==> algorithm/keyid
 */
struct set_stakey_parm {};

struct set_stakey_rsp {};

struct SetMacAddr_param {};

/*
 *	Caller Ad-Hoc/AP
 *
 *	Command -Rsp(AID == CAMID) mode
 *
 *	This is to force fw to add an sta_data entry per driver's request.
 *
 *	FW will write an cam entry associated with it.
 *
 */
struct set_assocsta_parm {};

struct set_assocsta_rsp {};

/*
 *	Caller Ad-Hoc/AP
 *
 *	Command mode
 *
 *	This is to force fw to del an sta_data entry per driver's request
 *
 *	FW will invalidate the cam entry associated with it.
 *
 */
struct del_assocsta_parm {};

/*
 *	Caller Mode: AP/Ad-HoC(M)
 *
 *	Notes: To notify fw that given staid has changed its power state
 *
 *	Command Mode
 *
 */
struct setstapwrstate_parm {};

/*
 *	Caller Mode: Any
 *
 *	Notes: To setup the basic rate of RTL8711
 *
 *	Command Mode
 *
 */
struct	setbasicrate_parm {};

/*
 *	Caller Mode: Any
 *
 *	Notes: To read the current basic rate
 *
 *	Command-Rsp Mode
 *
 */
struct getbasicrate_parm {};

struct getbasicrate_rsp {};

/*
 *	Caller Mode: Any
 *
 *	Notes: To setup the data rate of RTL8711
 *
 *	Command Mode
 *
 */
struct setdatarate_parm {};

enum _RT_CHANNEL_DOMAIN {};

struct SetChannelPlan_param {};

/*
 *	Caller Mode: Any
 *
 *	Notes: To read the current data rate
 *
 *	Command-Rsp Mode
 *
 */
struct getdatarate_parm {};

struct getdatarate_rsp {};

/*
 *	Caller Mode: Any
 *	AP: AP can use the info for the contents of beacon frame
 *	Infra: STA can use the info when sitesurveying
 *	Ad-HoC(M): Like AP
 *	Ad-HoC(C): Like STA
 *
 *
 *	Notes: To set the phy capability of the NIC
 *
 *	Command Mode
 *
 */

/*
 *	Caller Mode: Any
 *
 *	Notes: To set the channel/modem/band
 *	This command will be used when channel/modem/band is changed.
 *
 *	Command Mode
 *
 */
/*
 *	Caller Mode: Any
 *
 *	Notes: To get the current setting of channel/modem/band
 *
 *	Command-Rsp Mode
 *
 */
struct	getphy_rsp {};

struct readBB_parm {};

struct readBB_rsp {};

struct readTSSI_parm {};

struct readTSSI_rsp {};

struct writeBB_parm {};

struct writePTM_parm {};

struct readRF_parm {};

struct readRF_rsp {};

struct writeRF_parm {};

struct setrfintfs_parm {};

struct getrfintfs_parm {};

/*
 *	Notes: This command is used for H2C/C2H loopback testing
 *
 *	mac[0] == 0
 *	==> CMD mode, return H2C_SUCCESS.
 *	The following condition must be true under CMD mode
 *		mac[1] == mac[4], mac[2] == mac[3], mac[0]=mac[5]= 0;
 *		s0 == 0x1234, s1 == 0xabcd, w0 == 0x78563412, w1 == 0x5aa5def7;
 *		s2 == (b1 << 8 | b0);
 *
 *	mac[0] == 1
 *	==> CMD_RSP mode, return H2C_SUCCESS_RSP
 *
 *	The rsp layout shall be:
 *	rsp:			parm:
 *		mac[0]  =   mac[5];
 *		mac[1]  =   mac[4];
 *		mac[2]  =   mac[3];
 *		mac[3]  =   mac[2];
 *		mac[4]  =   mac[1];
 *		mac[5]  =   mac[0];
 *		s0		=   s1;
 *		s1		=   swap16(s0);
 *		w0		=	swap32(w1);
 *		b0		=	b1
 *		s2		=	s0 + s1
 *		b1		=	b0
 *		w1		=	w0
 *
 *	mac[0] ==	2
 *	==> CMD_EVENT mode, return	H2C_SUCCESS
 *	The event layout shall be:
 *	event:	     parm:
 *	mac[0]  =   mac[5];
 *	mac[1]  =   mac[4];
 *	mac[2]  =   event's sequence number, starting from 1 to parm's marc[3]
 *	mac[3]  =   mac[2];
 *	mac[4]  =   mac[1];
 *	mac[5]  =   mac[0];
 *	s0		=   swap16(s0) - event.mac[2];
 *	s1		=   s1 + event.mac[2];
 *	w0		=	swap32(w0);
 *	b0		=	b1
 *	s2		=	s0 + event.mac[2]
 *	b1		=	b0
 *	w1		=	swap32(w1) - event.mac[2];
 *
 *	parm->mac[3] is the total event counts that host requested.
 *
 *
 *	event will be the same with the cmd's param.
 *
 */

/* CMD param Formart for DRV INTERNAL CMD HDL*/
struct drvint_cmd_parm {};

/*------------------- Below are used for RF/BB tuning ---------------------*/

struct	setantenna_parm {};

struct	enrateadaptive_parm {};

struct settxagctbl_parm {};

struct gettxagctbl_parm {};

struct gettxagctbl_rsp {};

struct setagcctrl_parm {};

struct setssup_parm	{};

struct getssup_parm	{};

struct getssup_rsp	{};

struct setssdlevel_parm	{};

struct getssdlevel_parm	{};

struct getssdlevel_rsp	{};

struct setssulevel_parm	{};

struct getssulevel_parm	{};

struct getssulevel_rsp	{};

struct	setcountjudge_parm {};

struct	getcountjudge_parm {};

struct	getcountjudge_rsp {};

struct setpwrmode_parm  {};

struct setatim_parm {};

struct setratable_parm {};

struct getratable_parm {};

struct getratable_rsp {};

/*to get TX,RX retry count*/
struct gettxretrycnt_parm {};

struct gettxretrycnt_rsp {};

struct getrxretrycnt_parm {};

struct getrxretrycnt_rsp {};

/*to get BCNOK,BCNERR count*/
struct getbcnokcnt_parm {};

struct getbcnokcnt_rsp {};

struct getbcnerrcnt_parm {};

struct getbcnerrcnt_rsp {};

/* to get current TX power level*/
struct getcurtxpwrlevel_parm {};

struct getcurtxpwrlevel_rsp {};

/*dynamic on/off DIG*/
struct setdig_parm {};

/*dynamic on/off RA*/
struct setra_parm {};

struct setprobereqextraie_parm {};

struct setassocreqextraie_parm {};

struct setproberspextraie_parm {};

struct setassocrspextraie_parm {};

struct addBaReq_parm {};

/*H2C Handler index: 46 */
struct SetChannel_parm {};

/*H2C Handler index: 61 */
struct DisconnectCtrlEx_param {};

#define GEN_CMD_CODE(cmd)

/*
 * Result:
 * 0x00: success
 * 0x01: success, and check Response.
 * 0x02: cmd ignored due to duplicated sequence number
 * 0x03: cmd dropped due to invalid cmd code
 * 0x04: reserved.
 */

#define H2C_RSP_OFFSET
#define H2C_SUCCESS
#define H2C_SUCCESS_RSP
#define H2C_DUPLICATED
#define H2C_DROPPED
#define H2C_PARAMETERS_ERROR
#define H2C_REJECTED
#define H2C_CMD_OVERFLOW
#define H2C_RESERVED

void r8712_setMacAddr_cmd(struct _adapter *padapter, const u8 *mac_addr);
u8 r8712_sitesurvey_cmd(struct _adapter *padapter, struct ndis_802_11_ssid *pssid);
int r8712_createbss_cmd(struct _adapter *padapter);
void r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key);
int r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork);
void r8712_disassoc_cmd(struct _adapter *padapter);
void r8712_setopmode_cmd(struct _adapter *padapter, enum NDIS_802_11_NETWORK_INFRASTRUCTURE networktype);
int r8712_setdatarate_cmd(struct _adapter *padapter, u8 *rateset);
void r8712_set_chplan_cmd(struct _adapter  *padapter, int chplan);
int r8712_getrfreg_cmd(struct _adapter *padapter, u8 offset, u8 *pval);
int r8712_setrfreg_cmd(struct _adapter  *padapter, u8 offset, u32 val);
void r8712_addbareq_cmd(struct _adapter *padapter, u8 tid);
void r8712_wdg_wk_cmd(struct _adapter *padapter);
void r8712_survey_cmd_callback(struct _adapter  *padapter, struct cmd_obj *pcmd);
void r8712_disassoc_cmd_callback(struct _adapter  *padapter, struct cmd_obj *pcmd);
void r8712_joinbss_cmd_callback(struct _adapter  *padapter, struct cmd_obj *pcmd);
void r8712_createbss_cmd_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
void r8712_getbbrfreg_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
void r8712_readtssi_cmdrsp_callback(struct _adapter *padapter, struct cmd_obj *pcmd);
void r8712_setstaKey_cmdrsp_callback(struct _adapter  *padapter, struct cmd_obj *pcmd);
void r8712_setassocsta_cmdrsp_callback(struct _adapter  *padapter, struct cmd_obj *pcmd);
void r8712_disconnectCtrlEx_cmd(struct _adapter *adapter, u32 enableDrvCtrl, u32 tryPktCnt,
				u32 tryPktInterval, u32 firstStageTO);

struct _cmd_callback {};

#include "rtl8712_cmd.h"

#endif /* _CMD_H_ */