2013-05-08 21:45:39 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
2014-12-19 06:59:46 +00:00
|
|
|
*
|
2013-05-08 21:45:39 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
#include <drv_types.h>
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
#ifdef CONFIG_IOL
|
|
|
|
struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
struct xmit_frame *xmit_frame;
|
|
|
|
struct xmit_buf *xmitbuf;
|
|
|
|
struct pkt_attrib *pattrib;
|
|
|
|
struct xmit_priv *pxmitpriv = &(adapter->xmitpriv);
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
#if 1
|
|
|
|
xmit_frame = rtw_alloc_xmitframe(pxmitpriv);
|
|
|
|
if (xmit_frame == NULL) {
|
2018-11-03 19:22:43 +00:00
|
|
|
RTW_INFO("%s rtw_alloc_xmitframe return null\n", __func__);
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
xmitbuf = rtw_alloc_xmitbuf(pxmitpriv);
|
|
|
|
if (xmitbuf == NULL) {
|
2018-11-03 19:22:43 +00:00
|
|
|
RTW_INFO("%s rtw_alloc_xmitbuf return null\n", __func__);
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_free_xmitframe(pxmitpriv, xmit_frame);
|
2015-08-15 18:31:56 +00:00
|
|
|
xmit_frame = NULL;
|
2013-05-08 21:45:39 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
xmit_frame->frame_tag = MGNT_FRAMETAG;
|
|
|
|
xmit_frame->pxmitbuf = xmitbuf;
|
|
|
|
xmit_frame->buf_addr = xmitbuf->pbuf;
|
|
|
|
xmitbuf->priv_data = xmit_frame;
|
|
|
|
|
|
|
|
pattrib = &xmit_frame->attrib;
|
|
|
|
update_mgntframe_attrib(adapter, pattrib);
|
2018-10-15 00:07:45 +00:00
|
|
|
pattrib->qsel = QSLT_BEACON;/* Beacon */
|
2014-12-19 06:59:46 +00:00
|
|
|
pattrib->subtype = WIFI_BEACON;
|
2014-12-11 21:15:04 +00:00
|
|
|
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
#else
|
|
|
|
xmit_frame = alloc_mgtxmitframe(pxmitpriv);
|
|
|
|
if (xmit_frame == NULL)
|
2018-11-03 19:22:43 +00:00
|
|
|
RTW_INFO("%s alloc_mgtxmitframe return null\n", __func__);
|
2018-10-15 00:07:45 +00:00
|
|
|
else {
|
|
|
|
pattrib = &xmit_frame->attrib;
|
|
|
|
update_mgntframe_attrib(adapter, pattrib);
|
|
|
|
pattrib->qsel = QSLT_BEACON;
|
|
|
|
pattrib->pktlen = pattrib->last_txcmdsz = 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
exit:
|
|
|
|
return xmit_frame;
|
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
int rtw_IOL_append_cmds(struct xmit_frame *xmit_frame, u8 *IOL_cmds, u32 cmd_len)
|
|
|
|
{
|
|
|
|
struct pkt_attrib *pattrib = &xmit_frame->attrib;
|
|
|
|
u16 buf_offset;
|
|
|
|
u32 ori_len;
|
|
|
|
|
|
|
|
buf_offset = TXDESC_OFFSET;
|
2018-10-15 00:07:45 +00:00
|
|
|
ori_len = buf_offset + pattrib->pktlen;
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2015-02-19 21:34:32 +00:00
|
|
|
/* check if the io_buf can accommodate new cmds */
|
2015-08-15 18:02:34 +00:00
|
|
|
if (ori_len + cmd_len + 8 > MAX_XMITBUF_SZ) {
|
2018-11-03 19:22:43 +00:00
|
|
|
RTW_INFO("%s %u is large than MAX_XMITBUF_SZ:%u, can't accommodate new cmds\n", __func__
|
2018-10-15 00:07:45 +00:00
|
|
|
, ori_len + cmd_len + 8, MAX_XMITBUF_SZ);
|
2013-05-08 21:45:39 +00:00
|
|
|
return _FAIL;
|
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
_rtw_memcpy(xmit_frame->buf_addr + buf_offset + pattrib->pktlen, IOL_cmds, cmd_len);
|
2013-05-08 21:45:39 +00:00
|
|
|
pattrib->pktlen += cmd_len;
|
|
|
|
pattrib->last_txcmdsz += cmd_len;
|
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s ori:%u + cmd_len:%u = %u\n", __func__, ori_len, cmd_len, buf_offset+pattrib->pktlen); */
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
return _SUCCESS;
|
|
|
|
}
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
bool rtw_IOL_applied(ADAPTER *adapter)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2015-08-15 18:02:34 +00:00
|
|
|
if (1 == adapter->registrypriv.fw_iol)
|
2018-10-15 00:07:45 +00:00
|
|
|
return _TRUE;
|
|
|
|
|
|
|
|
#ifdef CONFIG_USB_HCI
|
|
|
|
if ((2 == adapter->registrypriv.fw_iol) && (IS_FULL_SPEED_USB(adapter)))
|
|
|
|
return _TRUE;
|
|
|
|
#endif
|
2013-07-09 22:38:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
return _FALSE;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
int rtw_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
return rtw_hal_iol_cmd(adapter, xmit_frame, max_wating_ms, bndy_cnt);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
#ifdef CONFIG_IOL_NEW_GENERATION
|
2013-05-08 21:45:39 +00:00
|
|
|
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
|
|
|
{
|
|
|
|
return _SUCCESS;
|
|
|
|
}
|
|
|
|
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 mask)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0};
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
2014-12-19 06:59:46 +00:00
|
|
|
cmd.address = cpu_to_le16(addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.data = cpu_to_le32(value);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
if (mask != 0xFF) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.length = 12;
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.mask = cpu_to_le32(mask);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __func__, addr,value,mask); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
2013-07-09 22:38:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u16 mask)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {8, IOREG_CMD_WW_REG, 0x0, 0x0, 0x0};
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
2014-12-19 06:59:46 +00:00
|
|
|
cmd.address = cpu_to_le16(addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.data = cpu_to_le32(value);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
if (mask != 0xFFFF) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.length = 12;
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.mask = cpu_to_le32(mask);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __func__, addr,value,mask); */
|
2013-07-29 16:54:09 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u32 mask)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0};
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
2014-12-19 06:59:46 +00:00
|
|
|
cmd.address = cpu_to_le16(addr);
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.data = cpu_to_le32(value);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
if (mask != 0xFFFFFFFF) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.length = 12;
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.mask = cpu_to_le32(mask);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_INFO("%s addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__, addr,value,mask); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, u32 value, u32 mask)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0};
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, addr); */
|
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */
|
2018-10-29 16:09:26 +00:00
|
|
|
cmd.address = cpu_to_le16((rf_path << 8) | ((addr) & 0xFF));
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.data = cpu_to_le32(value);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
if (mask != 0x000FFFFF) {
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.length = 12;
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE32((u8*)&cmd.mask, (u32)mask); */
|
2013-05-08 21:45:39 +00:00
|
|
|
cmd.mask = cpu_to_le32(mask);
|
2014-12-19 06:59:46 +00:00
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_INFO("%s rf_path:0x%02x addr:0x%04x,value:0x%08x,mask:0x%08x\n", __FU2NCTION__,rf_path, addr,value,mask); */
|
2014-12-11 21:15:04 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, cmd.length);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
|
2013-05-08 21:45:39 +00:00
|
|
|
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, us); */
|
2014-12-19 06:59:46 +00:00
|
|
|
cmd.address = cpu_to_le16(us);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s %u\n", __func__, us); */
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
|
|
|
{
|
2015-08-15 18:19:16 +00:00
|
|
|
struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0};
|
2013-05-08 21:45:39 +00:00
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
/* RTW_PUT_LE16((u8*)&cmd.address, ms); */
|
2014-12-19 06:59:46 +00:00
|
|
|
cmd.address = cpu_to_le16(ms);
|
2013-07-29 16:54:09 +00:00
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s %u\n", __func__, ms); */
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
2014-12-11 21:15:04 +00:00
|
|
|
}
|
2013-05-08 21:45:39 +00:00
|
|
|
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2018-10-29 16:09:26 +00:00
|
|
|
struct ioreg_cfg cmd = {4, IOREG_CMD_END, cpu_to_le16(0xFFFF), cpu_to_le32(0xFF), 0x0};
|
2018-10-15 00:07:45 +00:00
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 4);
|
2013-05-08 21:45:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 rtw_IOL_cmd_boundary_handle(struct xmit_frame *pxmit_frame)
|
2014-12-19 06:59:46 +00:00
|
|
|
{
|
2018-10-15 00:07:45 +00:00
|
|
|
u8 is_cmd_bndy = _FALSE;
|
|
|
|
if (((pxmit_frame->attrib.pktlen + 32) % 256) + 8 >= 256) {
|
2013-05-08 21:45:39 +00:00
|
|
|
rtw_IOL_append_END_cmd(pxmit_frame);
|
2018-10-15 00:07:45 +00:00
|
|
|
pxmit_frame->attrib.pktlen = ((((pxmit_frame->attrib.pktlen + 32) / 256) + 1) * 256);
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("==> %s, pktlen(%d)\n",__func__,pxmit_frame->attrib.pktlen); */
|
2013-05-08 21:45:39 +00:00
|
|
|
pxmit_frame->attrib.last_txcmdsz = pxmit_frame->attrib.pktlen;
|
2018-10-15 00:07:45 +00:00
|
|
|
is_cmd_bndy = _TRUE;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
|
|
|
return is_cmd_bndy;
|
|
|
|
}
|
|
|
|
|
2018-10-15 00:07:45 +00:00
|
|
|
void rtw_IOL_cmd_buf_dump(ADAPTER *Adapter, int buf_len, u8 *pbuf)
|
2013-05-08 21:45:39 +00:00
|
|
|
{
|
|
|
|
int i;
|
2018-10-15 00:07:45 +00:00
|
|
|
int j = 1;
|
2014-12-19 06:59:46 +00:00
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
RTW_INFO("###### %s ######\n", __func__);
|
2018-10-15 00:07:45 +00:00
|
|
|
for (i = 0; i < buf_len; i++) {
|
2018-10-20 18:03:01 +00:00
|
|
|
RTW_INFO("%02x-", *(pbuf + i));
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
if (j % 32 == 0)
|
2018-10-20 18:03:01 +00:00
|
|
|
RTW_INFO("\n");
|
2018-04-11 15:19:48 +00:00
|
|
|
j++;
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2018-10-20 18:03:01 +00:00
|
|
|
RTW_INFO("\n");
|
|
|
|
RTW_INFO("============= ioreg_cmd len = %d ===============\n", buf_len);
|
2013-05-08 21:45:39 +00:00
|
|
|
}
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#else /* CONFIG_IOL_NEW_GENERATION */
|
|
|
|
int rtw_IOL_append_LLT_cmd(struct xmit_frame *xmit_frame, u8 page_boundary)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_LLT, 0x0, 0x0};
|
|
|
|
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)page_boundary);
|
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_WB_REG, 0x0, 0x0};
|
|
|
|
|
|
|
|
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_WW_REG, 0x0, 0x0};
|
|
|
|
|
|
|
|
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_WD_REG, 0x0, 0x0};
|
|
|
|
u8 *pos = (u8 *)&cmd;
|
|
|
|
|
|
|
|
RTW_PUT_BE16((u8 *)&cmd.address, (u16)addr);
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)value);
|
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DBG_IO
|
|
|
|
int dbg_rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, const char *caller, const int line)
|
|
|
|
{
|
|
|
|
if (match_write_sniff_ranges(addr, 1))
|
|
|
|
RTW_INFO("DBG_IO %s:%d IOL_WB(0x%04x, 0x%02x)\n", caller, line, addr, value);
|
|
|
|
|
|
|
|
return _rtw_IOL_append_WB_cmd(xmit_frame, addr, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
int dbg_rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, const char *caller, const int line)
|
|
|
|
{
|
|
|
|
if (match_write_sniff_ranges(addr, 2))
|
|
|
|
RTW_INFO("DBG_IO %s:%d IOL_WW(0x%04x, 0x%04x)\n", caller, line, addr, value);
|
|
|
|
|
|
|
|
return _rtw_IOL_append_WW_cmd(xmit_frame, addr, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
int dbg_rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, const char *caller, const int line)
|
|
|
|
{
|
|
|
|
if (match_write_sniff_ranges(addr, 4))
|
|
|
|
RTW_INFO("DBG_IO %s:%d IOL_WD(0x%04x, 0x%08x)\n", caller, line, addr, value);
|
|
|
|
|
|
|
|
return _rtw_IOL_append_WD_cmd(xmit_frame, addr, value);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_US, 0x0, 0x0};
|
|
|
|
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)us);
|
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s %u\n", __func__, us); */
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms)
|
|
|
|
{
|
|
|
|
IOL_CMD cmd = {0x0, IOL_CMD_DELAY_MS, 0x0, 0x0};
|
|
|
|
|
|
|
|
RTW_PUT_BE32((u8 *)&cmd.value, (u32)ms);
|
|
|
|
|
2018-11-03 19:22:43 +00:00
|
|
|
/* RTW_INFO("%s %u\n", __func__, ms); */
|
2018-10-15 00:07:45 +00:00
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&cmd, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame)
|
|
|
|
{
|
|
|
|
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
|
|
|
|
|
|
|
|
|
|
|
return rtw_IOL_append_cmds(xmit_frame, (u8 *)&end_cmd, 8);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw_IOL_exec_cmd_array_sync(PADAPTER adapter, u8 *IOL_cmds, u32 cmd_num, u32 max_wating_ms)
|
|
|
|
{
|
|
|
|
struct xmit_frame *xmit_frame;
|
|
|
|
|
|
|
|
xmit_frame = rtw_IOL_accquire_xmit_frame(adapter);
|
|
|
|
if (xmit_frame == NULL)
|
|
|
|
return _FAIL;
|
|
|
|
|
|
|
|
if (rtw_IOL_append_cmds(xmit_frame, IOL_cmds, cmd_num << 3) == _FAIL)
|
|
|
|
return _FAIL;
|
|
|
|
|
|
|
|
return rtw_IOL_exec_cmds_sync(adapter, xmit_frame, max_wating_ms, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int rtw_IOL_exec_empty_cmds_sync(ADAPTER *adapter, u32 max_wating_ms)
|
|
|
|
{
|
|
|
|
IOL_CMD end_cmd = {0x0, IOL_CMD_END, 0x0, 0x0};
|
|
|
|
return rtw_IOL_exec_cmd_array_sync(adapter, (u8 *)&end_cmd, 1, max_wating_ms);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_IOL_NEW_GENERATION */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* CONFIG_IOL */
|