1 #include "halmac_88xx_cfg.h"
4 * halmac_init_pcie_cfg_88xx() - init PCIe
5 * @pHalmac_adapter : the adapter of halmac
6 * Author : KaiYuan Chang
7 * Return : HALMAC_RET_STATUS
8 * More details of status code can be found in prototype document
11 halmac_init_pcie_cfg_88xx(
12 IN PHALMAC_ADAPTER pHalmac_adapter
15 VOID *pDriver_adapter = NULL;
17 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
18 return HALMAC_RET_ADAPTER_INVALID;
20 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
21 return HALMAC_RET_API_INVALID;
23 halmac_api_record_id_88xx(pHalmac_adapter, HALMAC_API_INIT_PCIE_CFG);
25 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
27 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_init_pcie_cfg_88xx ==========>\n");
29 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_init_pcie_cfg_88xx <==========\n");
31 return HALMAC_RET_SUCCESS;
35 * halmac_deinit_pcie_cfg_88xx() - deinit PCIE
36 * @pHalmac_adapter : the adapter of halmac
37 * Author : KaiYuan Chang
38 * Return : HALMAC_RET_STATUS
39 * More details of status code can be found in prototype document
42 halmac_deinit_pcie_cfg_88xx(
43 IN PHALMAC_ADAPTER pHalmac_adapter
46 VOID *pDriver_adapter = NULL;
48 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
49 return HALMAC_RET_ADAPTER_INVALID;
51 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
52 return HALMAC_RET_API_INVALID;
54 halmac_api_record_id_88xx(pHalmac_adapter, HALMAC_API_DEINIT_PCIE_CFG);
56 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
58 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_deinit_pcie_cfg_88xx ==========>\n");
60 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_deinit_pcie_cfg_88xx <==========\n");
62 return HALMAC_RET_SUCCESS;
66 * halmac_cfg_rx_aggregation_88xx_pcie() - config rx aggregation
67 * @pHalmac_adapter : the adapter of halmac
69 * Author : KaiYuan Chang/Ivan Lin
70 * Return : HALMAC_RET_STATUS
71 * More details of status code can be found in prototype document
74 halmac_cfg_rx_aggregation_88xx_pcie(
75 IN PHALMAC_ADAPTER pHalmac_adapter,
76 IN PHALMAC_RXAGG_CFG phalmac_rxagg_cfg
79 VOID *pDriver_adapter = NULL;
81 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
82 return HALMAC_RET_ADAPTER_INVALID;
84 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
85 return HALMAC_RET_API_INVALID;
87 halmac_api_record_id_88xx(pHalmac_adapter, HALMAC_API_CFG_RX_AGGREGATION);
89 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
91 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_cfg_rx_aggregation_88xx_pcie ==========>\n");
93 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_cfg_rx_aggregation_88xx_pcie <==========\n");
95 return HALMAC_RET_SUCCESS;
99 * halmac_reg_read_8_pcie_88xx() - read 1byte register
100 * @pHalmac_adapter : the adapter of halmac
101 * @halmac_offset : register offset
102 * Author : KaiYuan Chang/Ivan Lin
103 * Return : HALMAC_RET_STATUS
104 * More details of status code can be found in prototype document
107 halmac_reg_read_8_pcie_88xx(
108 IN PHALMAC_ADAPTER pHalmac_adapter,
112 VOID *pDriver_adapter = NULL;
113 PHALMAC_API pHalmac_api;
115 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
116 return HALMAC_RET_ADAPTER_INVALID;
118 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
119 return HALMAC_RET_API_INVALID;
121 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
122 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
124 return PLATFORM_REG_READ_8(pDriver_adapter, halmac_offset);
128 * halmac_reg_write_8_pcie_88xx() - write 1byte register
129 * @pHalmac_adapter : the adapter of halmac
130 * @halmac_offset : register offset
131 * @halmac_data : register value
132 * Author : KaiYuan Chang/Ivan Lin
133 * Return : HALMAC_RET_STATUS
134 * More details of status code can be found in prototype document
137 halmac_reg_write_8_pcie_88xx(
138 IN PHALMAC_ADAPTER pHalmac_adapter,
139 IN u32 halmac_offset,
143 VOID *pDriver_adapter = NULL;
144 PHALMAC_API pHalmac_api;
146 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
147 return HALMAC_RET_ADAPTER_INVALID;
149 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
150 return HALMAC_RET_API_INVALID;
152 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
153 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
155 PLATFORM_REG_WRITE_8(pDriver_adapter, halmac_offset, halmac_data);
157 return HALMAC_RET_SUCCESS;
161 * halmac_reg_read_16_pcie_88xx() - read 2byte register
162 * @pHalmac_adapter : the adapter of halmac
163 * @halmac_offset : register offset
164 * Author : KaiYuan Chang/Ivan Lin
165 * Return : HALMAC_RET_STATUS
166 * More details of status code can be found in prototype document
169 halmac_reg_read_16_pcie_88xx(
170 IN PHALMAC_ADAPTER pHalmac_adapter,
174 VOID *pDriver_adapter = NULL;
175 PHALMAC_API pHalmac_api;
177 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
178 return HALMAC_RET_ADAPTER_INVALID;
180 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
181 return HALMAC_RET_API_INVALID;
183 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
184 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
186 return PLATFORM_REG_READ_16(pDriver_adapter, halmac_offset);
190 * halmac_reg_write_16_pcie_88xx() - write 2byte register
191 * @pHalmac_adapter : the adapter of halmac
192 * @halmac_offset : register offset
193 * @halmac_data : register value
194 * Author : KaiYuan Chang/Ivan Lin
195 * Return : HALMAC_RET_STATUS
196 * More details of status code can be found in prototype document
199 halmac_reg_write_16_pcie_88xx(
200 IN PHALMAC_ADAPTER pHalmac_adapter,
201 IN u32 halmac_offset,
205 VOID *pDriver_adapter = NULL;
206 PHALMAC_API pHalmac_api;
208 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
209 return HALMAC_RET_ADAPTER_INVALID;
211 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
212 return HALMAC_RET_API_INVALID;
214 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
215 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
217 PLATFORM_REG_WRITE_16(pDriver_adapter, halmac_offset, halmac_data);
219 return HALMAC_RET_SUCCESS;
223 * halmac_reg_read_32_pcie_88xx() - read 4byte register
224 * @pHalmac_adapter : the adapter of halmac
225 * @halmac_offset : register offset
226 * Author : KaiYuan Chang/Ivan Lin
227 * Return : HALMAC_RET_STATUS
228 * More details of status code can be found in prototype document
231 halmac_reg_read_32_pcie_88xx(
232 IN PHALMAC_ADAPTER pHalmac_adapter,
236 VOID *pDriver_adapter = NULL;
237 PHALMAC_API pHalmac_api;
239 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
240 return HALMAC_RET_ADAPTER_INVALID;
242 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
243 return HALMAC_RET_API_INVALID;
245 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
246 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
248 return PLATFORM_REG_READ_32(pDriver_adapter, halmac_offset);
252 * halmac_reg_write_32_pcie_88xx() - write 4byte register
253 * @pHalmac_adapter : the adapter of halmac
254 * @halmac_offset : register offset
255 * @halmac_data : register value
256 * Author : KaiYuan Chang/Ivan Lin
257 * Return : HALMAC_RET_STATUS
258 * More details of status code can be found in prototype document
261 halmac_reg_write_32_pcie_88xx(
262 IN PHALMAC_ADAPTER pHalmac_adapter,
263 IN u32 halmac_offset,
267 VOID *pDriver_adapter = NULL;
268 PHALMAC_API pHalmac_api;
270 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
271 return HALMAC_RET_ADAPTER_INVALID;
273 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
274 return HALMAC_RET_API_INVALID;
276 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
277 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
279 PLATFORM_REG_WRITE_32(pDriver_adapter, halmac_offset, halmac_data);
281 return HALMAC_RET_SUCCESS;
285 * halmac_cfg_tx_agg_align_pcie_88xx() -config sdio bus tx agg alignment
286 * @pHalmac_adapter : the adapter of halmac
287 * @enable : function enable(1)/disable(0)
288 * @align_size : sdio bus tx agg alignment size (2^n, n = 3~11)
290 * Return : HALMAC_RET_STATUS
291 * More details of status code can be found in prototype document
294 halmac_cfg_tx_agg_align_pcie_not_support_88xx(
295 IN PHALMAC_ADAPTER pHalmac_adapter,
300 PHALMAC_API pHalmac_api;
301 VOID *pDriver_adapter = NULL;
303 if (HALMAC_RET_SUCCESS != halmac_adapter_validate(pHalmac_adapter))
304 return HALMAC_RET_ADAPTER_INVALID;
306 if (HALMAC_RET_SUCCESS != halmac_api_validate(pHalmac_adapter))
307 return HALMAC_RET_API_INVALID;
309 halmac_api_record_id_88xx(pHalmac_adapter, HALMAC_API_CFG_TX_AGG_ALIGN);
311 pDriver_adapter = pHalmac_adapter->pDriver_adapter;
312 pHalmac_api = (PHALMAC_API)pHalmac_adapter->pHalmac_api;
315 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_cfg_tx_agg_align_pcie_not_support_88xx ==========>\n");
317 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_cfg_tx_agg_align_pcie_not_support_88xx not support\n");
318 PLATFORM_MSG_PRINT(pDriver_adapter, HALMAC_MSG_INIT, HALMAC_DBG_TRACE, "halmac_cfg_tx_agg_align_pcie_not_support_88xx <==========\n");
320 return HALMAC_RET_SUCCESS;