drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
Source file repositories/reference/linux-study-clean/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c- Extension
.c- Size
- 29152 bytes
- Lines
- 964
- Domain
- Driver Families
- Bucket
- drivers/staging
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drv_types.hrtl8723b_hal.hlinux/etherdevice.hhal_com_h2c.h
Detected Declarations
function Copyrightfunction FillH2CCmd8723Bfunction ConstructBeaconfunction ConstructPSPollfunction ConstructNullFunctionDatafunction rtl8723b_set_FwRsvdPage_cmdfunction rtl8723b_set_FwMediaStatusRpt_cmdfunction rtl8723b_set_FwMacIdConfig_cmdfunction rtl8723b_set_rssi_cmdfunction rtl8723b_set_FwPwrMode_cmdfunction rtl8723b_set_FwPsTuneParam_cmdfunction rtl8723b_set_FwPwrModeInIPS_cmdfunction rtl8723b_set_FwRsvdPagePktfunction rtl8723b_download_rsvd_pagefunction rtl8723b_set_FwJoinBssRpt_cmdfunction rtl8723b_Add_RateATidfunction ConstructBtNullFunctionDatafunction SetFwRsvdPagePkt_BTCoexfunction rtl8723b_download_BTCoex_AP_mode_rsvd_page
Annotated Snippet
if (0 == valid) {
read_down = true;
}
} while ((!read_down) && (retry_cnts--));
return read_down;
}
/*****************************************
* H2C Msg format :
*| 31 - 8 |7-5 | 4 - 0 |
*| h2c_msg |Class |CMD_ID |
*| 31-0 |
*| Ext msg |
*
******************************************/
s32 FillH2CCmd8723B(struct adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer)
{
u8 h2c_box_num;
u32 msgbox_addr;
u32 msgbox_ex_addr = 0;
struct hal_com_data *pHalData;
u32 h2c_cmd = 0;
u32 h2c_cmd_ex = 0;
s32 ret = _FAIL;
padapter = GET_PRIMARY_ADAPTER(padapter);
pHalData = GET_HAL_DATA(padapter);
if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex)))
return ret;
if (!pCmdBuffer)
goto exit;
if (CmdLen > RTL8723B_MAX_CMD_LEN)
goto exit;
if (padapter->bSurpriseRemoved)
goto exit;
/* pay attention to if race condition happened in H2C cmd setting. */
do {
h2c_box_num = pHalData->LastHMEBoxNum;
if (!_is_fw_read_cmd_down(padapter, h2c_box_num))
goto exit;
if (CmdLen <= 3)
memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, CmdLen);
else {
memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, 3);
memcpy((u8 *)(&h2c_cmd_ex), pCmdBuffer+3, CmdLen-3);
/* *(u8 *)(&h2c_cmd) |= BIT(7); */
}
*(u8 *)(&h2c_cmd) |= ElementID;
if (CmdLen > 3) {
msgbox_ex_addr = REG_HMEBOX_EXT0_8723B + (h2c_box_num*RTL8723B_EX_MESSAGE_BOX_SIZE);
rtw_write32(padapter, msgbox_ex_addr, h2c_cmd_ex);
}
msgbox_addr = REG_HMEBOX_0 + (h2c_box_num*MESSAGE_BOX_SIZE);
rtw_write32(padapter, msgbox_addr, h2c_cmd);
pHalData->LastHMEBoxNum = (h2c_box_num+1) % MAX_H2C_BOX_NUMS;
} while (0);
ret = _SUCCESS;
exit:
mutex_unlock(&(adapter_to_dvobj(padapter)->h2c_fwcmd_mutex));
return ret;
}
static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)
{
struct ieee80211_hdr *pwlanhdr;
__le16 *fctrl;
u32 rate_len, pktlen;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network);
pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_control);
Annotation
- Immediate include surface: `drv_types.h`, `rtl8723b_hal.h`, `linux/etherdevice.h`, `hal_com_h2c.h`.
- Detected declarations: `function Copyright`, `function FillH2CCmd8723B`, `function ConstructBeacon`, `function ConstructPSPoll`, `function ConstructNullFunctionData`, `function rtl8723b_set_FwRsvdPage_cmd`, `function rtl8723b_set_FwMediaStatusRpt_cmd`, `function rtl8723b_set_FwMacIdConfig_cmd`, `function rtl8723b_set_rssi_cmd`, `function rtl8723b_set_FwPwrMode_cmd`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.