hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/******************************************************************************
 *
 * Copyright(c) 2013 - 2017 Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 *****************************************************************************/
#ifdef CONFIG_BTC
 
#include <drv_types.h>
 
typedef struct _btcdbginfo {    
   void* p_msgprn_hdl;
   struct submit_ctx btc_dbg_info_sctx;
} BTCDBGINFO, *PBTCDBGINFO;
 
BTCDBGINFO GLBtcDbgInfo;
 
#define BTC_INFO_DUMP_TIMEOUT_MS    3000
 
static void rtw_btc_info_dump_init(_adapter *padapter)
{
   GLBtcDbgInfo.p_msgprn_hdl = NULL;
}
 
static void rtw_btc_info_dump_set(_adapter *padapter, void* p_msgprn_hdl, u32 timeout_ms)
{
   GLBtcDbgInfo.p_msgprn_hdl = p_msgprn_hdl;
   rtw_sctx_init(&GLBtcDbgInfo.btc_dbg_info_sctx, timeout_ms);
}
 
static void rtw_btc_info_dump(const char *pmsg)
{
   if (GLBtcDbgInfo.p_msgprn_hdl == NULL)
       return;
 
   _RTW_PRINT_SEL(GLBtcDbgInfo.p_msgprn_hdl, "%s", pmsg);
}
 
static int rtw_btc_info_dump_callback(void *priv, enum RTW_PHL_BTC_NOTIFY ntfy, struct rtw_phl_btc_ntfy *info)
{
   struct submit_ctx *sctx = &GLBtcDbgInfo.btc_dbg_info_sctx;
 
   rtw_sctx_done(&sctx);
 
   return 0;
}
 
static int rtw_btc_info_dump_wait(_adapter *padapter)
{
   return rtw_sctx_wait(&GLBtcDbgInfo.btc_dbg_info_sctx, __func__);
}
 
void rtw_btc_disp_btc_info(_adapter *padapter, void* p_msgprn_hdl, u8 info_type)
{
   struct rtw_phl_btc_ntfy ntfy = {0};
   struct rtw_phl_btc_coex_info_param *pcinfo = &ntfy.u.cinfo;
   struct dvobj_priv *dvobj = adapter_to_dvobj(padapter);
   struct rtw_phl_btc_ops phl_btc_ops = {rtw_btc_info_dump};
 
   pcinfo->query_type = info_type;
   
   ntfy.notify = PHL_BTC_NTFY_COEX_INFO;
   ntfy.ops = &phl_btc_ops;
   ntfy.priv = padapter;
   ntfy.ntfy_cb = rtw_btc_info_dump_callback;
 
   rtw_btc_info_dump_set(padapter, p_msgprn_hdl, BTC_INFO_DUMP_TIMEOUT_MS);
 
   rtw_phl_btc_notify(dvobj->phl, ntfy.notify, &ntfy);
 
   /* wait here until info dump finishes or timeout expires */
   rtw_btc_info_dump_wait(padapter);
 
   rtw_btc_info_dump_init(padapter);
}
 
void rtw_btc_set_dbg(_adapter *padapter, u32 *pDbgModule)
{
}
 
u32 rtw_btc_get_dbg(_adapter *padapter, u8 *pStrBuf, u32 bufSize)
{
   return 0;
}
 
#if 0
u16 rtw_btc_btreg_read(_adapter *padapter, u8 type, u16 addr, u32 *data)
{
   return 0;
}
 
u16 rtw_btc_btreg_write(_adapter *padapter, u8 type, u16 addr, u16 val)
{
   return _SUCCESS;
}
#endif
 
#endif /* CONFIG_BTC */