Linux-libre 5.7.3-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8188eu / include / hal8188e_rate_adaptive.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __INC_RA_H
3 #define __INC_RA_H
4 /*
5  * Copyright (c) Realtek Semiconductor Corp. All rights reserved.
6  *
7  * Module Name:
8  *      RateAdaptive.h
9  *
10  * Abstract:
11  *      Prototype of RA and related data structure.
12  *
13  * Major Change History:
14  *      When       Who               What
15  *      ---------- ---------------   -------------------------------
16  *      2011-08-12 Page            Create.
17  */
18
19 /*  Rate adaptive define */
20 #define PERENTRY        23
21 #define RETRYSIZE       5
22 #define RATESIZE        28
23 #define TX_RPT2_ITEM_SIZE       8
24
25 /*  */
26 /*  TX report 2 format in Rx desc */
27 /*  */
28 #define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc)           \
29         LE_BITS_TO_4BYTE(__pRxStatusDesc, 0, 9)
30 #define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc)     \
31         LE_BITS_TO_4BYTE(__pRxStatusDesc+16, 0, 32)
32 #define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc)     \
33         LE_BITS_TO_4BYTE(__pRxStatusDesc+20, 0, 32)
34
35 #define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr)                    \
36         LE_BITS_TO_4BYTE(__pAddr, 0, 16)
37 #define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr)                    \
38         LE_BITS_TO_1BYTE(__pAddr+2, 0, 8)
39 #define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr)                    \
40         LE_BITS_TO_1BYTE(__pAddr+3, 0, 8)
41 #define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr)                    \
42         LE_BITS_TO_1BYTE(__pAddr+4, 0, 8)
43 #define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr)                    \
44         LE_BITS_TO_1BYTE(__pAddr+4+1, 0, 8)
45 #define GET_TX_REPORT_TYPE1_DROP_0(__pAddr)                     \
46         LE_BITS_TO_1BYTE(__pAddr+4+2, 0, 8)
47 #define GET_TX_REPORT_TYPE1_DROP_1(__pAddr)                     \
48         LE_BITS_TO_1BYTE(__pAddr+4+3, 0, 8)
49
50 /*  End rate adaptive define */
51
52 int ODM_RAInfo_Init_all(struct odm_dm_struct *dm_odm);
53
54 int ODM_RAInfo_Init(struct odm_dm_struct *dm_odm, u8 MacID);
55
56 u8 ODM_RA_GetShortGI_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
57
58 u8 ODM_RA_GetDecisionRate_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
59
60 u8 ODM_RA_GetHwPwrStatus_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
61 void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u8 MacID,
62                                  u8 RateID, u32 RateMask,
63                                  u8 SGIEnable);
64
65 void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u8 macid,
66                           u8 rssi);
67
68 void ODM_RA_TxRPT2Handle_8188E(struct odm_dm_struct *dm_odm,
69                                u8 *txrpt_buf, u16 txrpt_len,
70                                u32 validentry0, u32 validentry1);
71
72 void ODM_RA_Set_TxRPT_Time(struct odm_dm_struct *dm_odm, u16 minRptTime);
73
74 #endif