drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
Source file repositories/reference/linux-study-clean/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c- Extension
.c- Size
- 77161 bytes
- Lines
- 2920
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/slab.hdrv_types.hrtl8723b_hal.hhal_com_h2c.h
Detected Declarations
function Copyrightfunction _BlockWritefunction _PageWritefunction _WriteFWfunction _8051Reset8723function polling_fwdl_chksumfunction _FWFreeToGofunction rtl8723b_FirmwareSelfResetfunction rtl8723b_FirmwareDownloadfunction rtl8723b_InitializeFirmwareVarsfunction hal_EfuseSwitchToBankfunction Hal_GetEfuseDefinitionfunction Hal_EfusePowerSwitchfunction hal_ReadEFuse_WiFifunction hal_ReadEFuse_BTfunction Hal_ReadEFusefunction ReadChipVersion8723Bfunction rtl8723b_read_chip_versionfunction rtl8723b_InitBeaconParametersfunction _InitBurstPktLen_8723BSfunction ResumeTxBeaconfunction StopTxBeaconfunction _BeaconFunctionEnablefunction rtl8723b_SetBeaconRelatedRegistersfunction hal_notch_filter_8723bfunction UpdateHalRAMask8723Bfunction rtl8723b_InitAntenna_Selectionfunction rtl8723b_init_default_valuefunction GetEEPROMSize8723Bfunction rtl8723b_InitLLTTablefunction hal_get_chnl_group_8723bfunction Hal_InitPGDatafunction Hal_EfuseParseIDCodefunction Hal_ReadPowerValueFromPROM_8723Bfunction Hal_EfuseParseTxPowerInfo_8723Bfunction Hal_EfuseParseBTCoexistInfo_8723Bfunction Hal_EfuseParseEEPROMVer_8723Bfunction Hal_EfuseParsePackageType_8723Bfunction Hal_EfuseParseVoltage_8723Bfunction Hal_EfuseParseChnlPlan_8723Bfunction Hal_EfuseParseCustomerID_8723Bfunction Hal_EfuseParseXtal_8723Bfunction Hal_EfuseParseThermalMeter_8723Bfunction Hal_ReadRFGainOffsetfunction BWMapping_8723Bfunction SCMapping_8723Bfunction rtl8723b_cal_txdesc_chksumfunction fill_txdesc_sectype
Annotated Snippet
if (ret == _FAIL) {
netdev_dbg(padapter->pnetdev, "write failed at %s %d, block:%d\n",
__func__, __LINE__, i);
goto exit;
}
}
/* 3 Phase #2 */
if (remainSize_p1) {
offset = blockCount_p1 * blockSize_p1;
blockCount_p2 = remainSize_p1/blockSize_p2;
remainSize_p2 = remainSize_p1%blockSize_p2;
}
/* 3 Phase #3 */
if (remainSize_p2) {
offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2);
blockCount_p3 = remainSize_p2 / blockSize_p3;
for (i = 0; i < blockCount_p3; i++) {
ret = rtw_write8(padapter, (FW_8723B_START_ADDRESS + offset + i), *(bufferPtr + offset + i));
if (ret == _FAIL) {
netdev_dbg(padapter->pnetdev, "write failed at %s %d, block:%d\n",
__func__, __LINE__, i);
goto exit;
}
}
}
exit:
return ret;
}
static int _PageWrite(
struct adapter *padapter,
u32 page,
void *buffer,
u32 size
)
{
u8 value8;
u8 u8Page = (u8) (page & 0x07);
value8 = (rtw_read8(padapter, REG_MCUFWDL+2) & 0xF8) | u8Page;
rtw_write8(padapter, REG_MCUFWDL+2, value8);
return _BlockWrite(padapter, buffer, size);
}
static int _WriteFW(struct adapter *padapter, void *buffer, u32 size)
{
/* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */
/* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */
int ret = _SUCCESS;
u32 pageNums, remainSize;
u32 page, offset;
u8 *bufferPtr = buffer;
pageNums = size / MAX_DLFW_PAGE_SIZE;
remainSize = size % MAX_DLFW_PAGE_SIZE;
for (page = 0; page < pageNums; page++) {
offset = page * MAX_DLFW_PAGE_SIZE;
ret = _PageWrite(padapter, page, bufferPtr+offset, MAX_DLFW_PAGE_SIZE);
if (ret == _FAIL) {
netdev_dbg(padapter->pnetdev, "page write failed at %s %d\n",
__func__, __LINE__);
goto exit;
}
}
if (remainSize) {
offset = pageNums * MAX_DLFW_PAGE_SIZE;
page = pageNums;
ret = _PageWrite(padapter, page, bufferPtr+offset, remainSize);
if (ret == _FAIL) {
netdev_dbg(padapter->pnetdev, "remaining page write failed at %s %d\n",
__func__, __LINE__);
goto exit;
}
}
exit:
return ret;
}
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/slab.h`, `drv_types.h`, `rtl8723b_hal.h`, `hal_com_h2c.h`.
- Detected declarations: `function Copyright`, `function _BlockWrite`, `function _PageWrite`, `function _WriteFW`, `function _8051Reset8723`, `function polling_fwdl_chksum`, `function _FWFreeToGo`, `function rtl8723b_FirmwareSelfReset`, `function rtl8723b_FirmwareDownload`, `function rtl8723b_InitializeFirmwareVars`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
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.