linux/drivers/staging/rtl8723bs/include/rtw_cmd.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
 *
 ******************************************************************************/
#ifndef __RTW_CMD_H_
#define __RTW_CMD_H_

#include <linux/completion.h>

#define C2H_MEM_SZ

	#define FREE_CMDOBJ_SZ

	#define MAX_CMDSZ
	#define MAX_RSPSZ
	#define MAX_EVTSZ

	#define CMDBUFF_ALIGN_SZ

	struct cmd_obj {};

	/* cmd flags */
	enum {};

	struct cmd_priv {};

	struct	evt_priv {};

#define init_h2fwcmd_w_parm_no_rsp(pcmd, pparm, code)

#define init_h2fwcmd_w_parm_no_parm_rsp(pcmd, code)

struct c2h_evt_hdr {};

struct c2h_evt_hdr_88xx {};

#define c2h_evt_valid(c2h_evt)

int rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj);
extern struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv);
extern void rtw_free_cmd_obj(struct cmd_obj *pcmd);

void rtw_stop_cmd_thread(struct adapter *adapter);
int rtw_cmd_thread(void *context);

extern void rtw_free_cmd_priv(struct cmd_priv *pcmdpriv);

extern void rtw_free_evt_priv(struct evt_priv *pevtpriv);
extern void rtw_evt_notify_isr(struct evt_priv *pevtpriv);

enum {};

enum {};

enum {};

/*
Caller Mode: Infra, Ad-HoC

Notes: To join a known BSS.

Command-Event Mode

*/

/*
Caller Mode: Infra, Ad-Hoc

Notes: To join the specified bss

Command Event Mode

*/
struct joinbss_parm {};

/*
Caller Mode: Infra, Ad-HoC(C)

Notes: To disconnect the current associated BSS

Command Mode

*/
struct disconnect_parm {};

/*
Caller Mode: AP, Ad-HoC(M)

Notes: To create a BSS

Command Mode
*/
struct createbss_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 Access Point
#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

*/

#define RTW_SSID_SCAN_AMOUNT
#define RTW_CHANNEL_SCAN_AMOUNT
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 {};

/*
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 {};

/*
Caller Mode: Any

Notes: To setup the data rate of RTL8711

Command Mode

*/
struct setdatarate_parm {};

/*
Caller Mode: Any

Notes: To read the current data rate

Command-Rsp Mode

*/
struct getdatarate_parm {};

/*
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

*/

struct	setphyinfo_parm {};

struct	getphyinfo_parm {};

/*
Caller Mode: Any

Notes: To set the channel/modem/band
This command will be used when channel/modem/band is changed.

Command Mode

*/
struct	setphy_parm {};

/*
Caller Mode: Any

Notes: To get the current setting of channel/modem/band

Command-Rsp Mode

*/
struct	getphy_parm {};

struct Tx_Beacon_param {};

/*
	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 driver extra cmd handler */
struct drvextra_cmd_parm {};

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

struct	getcountjudge_rsp {};

struct addBaReq_parm {};

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

/*H2C Handler index: 59 */
struct SetChannelPlan_param {};

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

/*H2C Handler index: 62 */
struct TDLSoption_param {};

/*H2C Handler index: 64 */
struct RunInThread_param {};


#define GEN_CMD_CODE(cmd)


/*

Result:
0x00: success
0x01: success, and check Response.
0x02: cmd ignored due to duplicated sequcne 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

u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid, int ssid_num, struct rtw_ieee80211_channel *ch, int ch_num);
extern u8 rtw_createbss_cmd(struct adapter  *padapter);
int rtw_startbss_cmd(struct adapter  *padapter, int flags);

struct sta_info;
extern u8 rtw_setstakey_cmd(struct adapter  *padapter, struct sta_info *sta, u8 unicast_key, bool enqueue);
extern u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueue);

extern u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork);
u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueue);
extern u8 rtw_setopmode_cmd(struct adapter  *padapter, enum ndis_802_11_network_infrastructure networktype, bool enqueue);
extern u8 rtw_setrfintfs_cmd(struct adapter  *padapter, u8 mode);

extern u8 rtw_gettssi_cmd(struct adapter  *padapter, u8 offset, u8 *pval);
extern u8 rtw_setfwdig_cmd(struct adapter *padapter, u8 type);
extern u8 rtw_setfwra_cmd(struct adapter *padapter, u8 type);

extern u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr);
/*  add for CONFIG_IEEE80211W, none 11w also can use */
extern u8 rtw_reset_securitypriv_cmd(struct adapter *padapter);
extern u8 rtw_free_assoc_resources_cmd(struct adapter *padapter);
extern u8 rtw_dynamic_chk_wk_cmd(struct adapter *adapter);

u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue);
u8 rtw_dm_in_lps_wk_cmd(struct adapter *padapter);

u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 *psta);

extern u8 rtw_ps_cmd(struct adapter *padapter);

u8 rtw_chk_hi_queue_cmd(struct adapter *padapter);

extern u8 rtw_c2h_packet_wk_cmd(struct adapter *padapter, u8 *pbuf, u16 length);
extern u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt);

u8 rtw_drvextra_cmd_hdl(struct adapter *padapter, unsigned char *pbuf);

extern void rtw_survey_cmd_callback(struct adapter  *padapter, struct cmd_obj *pcmd);
extern void rtw_disassoc_cmd_callback(struct adapter  *padapter, struct cmd_obj *pcmd);
extern void rtw_joinbss_cmd_callback(struct adapter  *padapter, struct cmd_obj *pcmd);
extern void rtw_createbss_cmd_callback(struct adapter  *padapter, struct cmd_obj *pcmd);
extern void rtw_getbbrfreg_cmdrsp_callback(struct adapter  *padapter, struct cmd_obj *pcmd);

extern void rtw_setstaKey_cmdrsp_callback(struct adapter  *padapter,  struct cmd_obj *pcmd);
extern void rtw_setassocsta_cmdrsp_callback(struct adapter  *padapter,  struct cmd_obj *pcmd);
extern void rtw_getrttbl_cmdrsp_callback(struct adapter  *padapter,  struct cmd_obj *pcmd);


struct _cmd_callback {};

enum {};

#define _GetBBReg_CMD_
#define _SetBBReg_CMD_
#define _GetRFReg_CMD_
#define _SetRFReg_CMD_

#endif /*  _CMD_H_ */