# libc0607/rtl88x2eu-20230815 architecture

> Architecture diagram of the GitHub repository libc0607/rtl88x2eu-20230815, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/libc0607/rtl88x2eu-20230815
- Repository: https://github.com/libc0607/rtl88x2eu-20230815

## Overview

This repository is a Linux Wi-Fi driver for RTL8812EU/RTL8822EU adapters. Its main user-to-result path is wireless configuration through Linux WEXT/cfg80211 interfaces, driver MLME and channel/power handling, then chip and USB hardware control; monitor-mode injection and narrow-band operation are documented capabilities. The graph also includes calibration, efuse, PHY management, and Bluetooth coexistence. Some subsystem links are documented at a high level; unsampled implementation details are not inferred.

Main entry points: [`core/rtw_mlme.c`](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_mlme.c) (Link management), [`hal/hal_halmac.h`](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_halmac.h) (HALMAC driver API), [`hal/rtl8822e/rtl8822e_ops.c`](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/rtl8822e/rtl8822e_ops.c) (RTL8822E operations), [`hal/halmac/halmac_88xx/halmac_common_88xx.c`](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_88xx/halmac_common_88xx.c) (HALMAC common)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_linux["Linux interfaces"]
  node_linux_api["WEXT and cfg80211<br/>[ioctl_linux.c]"]
end

subgraph group_wireless["Wireless runtime"]
  node_core_mlme["Link management<br/>[rtw_mlme.c]"]
  node_channel["Channel planning<br/>[rtw_chplan.c]"]
  node_tx_power["TX power control<br/>[rtw_txpwr.h]"]
  node_crypto["Wireless crypto<br/>[aes-internal.c]"]
  node_wifi_types["Wi-Fi data definitions<br/>[wifi.h]"]
end

subgraph group_chip["Chip and transport"]
  node_efuse["Efuse calibration<br/>[rtw_efuse.c]"]
  node_phy_cfg["PHY configuration<br/>[hal_com_phycfg.c]"]
  node_phydm["PHY management<br/>[phydm_antdiv.c]"]
  node_chip_ops["RTL8822E operations<br/>[rtl8822e_ops.c]"]
  node_chip_defs["RTL8822E definitions<br/>[rtl8822e.h]"]
  node_halmac_driver["HALMAC driver API<br/>[hal_halmac.h]"]
  node_halmac_common["HALMAC common"]
  node_halmac_registers["HALMAC registers<br/>[halmac_reg2.h]"]
  node_usb["USB transport<br/>[hal_usb.c]"]
  node_efuse_masks["Efuse masks<br/>[efuse_mask.h]"]
  node_phy_support["PHYDM support<br/>[phydm_precomp.h]"]
  node_halmac_api["HALMAC API<br/>[halmac_api.h]"]
end

subgraph group_radio["Radio features"]
  node_monitor["Monitor radiotap<br/>[rtw_radiotap.c]"]
  node_coexistence["Bluetooth coexistence<br/>[halbtccommon.c]"]
  node_coex_chip["RTL8822E coexistence<br/>[halbtc8822e.c]"]
end

node_operator(("Wireless user"))
node_adapter{{"RTL8812EU/RTL8822EU adapter"}}

node_operator -->|"configures"| node_linux_api
node_linux_api -.->|"sets link state"| node_core_mlme
node_operator -->|"sets monitor mode"| node_monitor
node_monitor -->|"injects packets"| node_adapter
node_operator -->|"sets channel"| node_channel
node_operator -->|"sets TX power"| node_tx_power
node_channel -.->|"configures bandwidth"| node_adapter
node_tx_power -.->|"sets radio power"| node_phy_cfg
node_core_mlme -.->|"secures traffic"| node_crypto
node_efuse -->|"reads efuse"| node_halmac_driver
node_efuse_masks -->|"selects masks"| node_efuse
node_chip_ops -->|"uses definitions"| node_chip_defs
node_chip_ops -->|"uses HALMAC"| node_halmac_driver
node_phy_cfg -->|"uses chip definitions"| node_chip_defs
node_phy_support -->|"supports PHYDM"| node_phydm
node_coexistence -->|"uses chip coexistence"| node_coex_chip
node_halmac_driver -->|"declares operations"| node_halmac_api
node_halmac_common -->|"uses API"| node_halmac_api
node_halmac_common -->|"uses registers"| node_halmac_registers
node_usb -.->|"transfers frames"| node_adapter
node_adapter -->|"provides Wi-Fi"| node_operator
node_wifi_types -.->|"defines Wi-Fi types"| node_core_mlme

click node_linux_api "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/os_dep/linux/ioctl_linux.c"
click node_core_mlme "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_mlme.c"
click node_channel "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_chplan.c"
click node_tx_power "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_txpwr.h"
click node_monitor "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/monitor/rtw_radiotap.c"
click node_crypto "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/crypto/aes-internal.c"
click node_efuse "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/efuse/rtw_efuse.c"
click node_phy_cfg "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_com_phycfg.c"
click node_phydm "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/phydm/phydm_antdiv.c"
click node_coexistence "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/btc/halbtccommon.c"
click node_chip_ops "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/rtl8822e/rtl8822e_ops.c"
click node_chip_defs "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/rtl8822e/rtl8822e.h"
click node_halmac_driver "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_halmac.h"
click node_halmac_common "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_88xx/halmac_common_88xx.c"
click node_halmac_registers "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_reg2.h"
click node_usb "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_hci/hal_usb.c"
click node_efuse_masks "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/efuse/efuse_mask.h"
click node_phy_support "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/phydm/phydm_precomp.h"
click node_coex_chip "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/btc/halbtc8822e.c"
click node_wifi_types "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/include/wifi.h"
click node_halmac_api "https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_api.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_linux_api,node_operator toneBlue
class node_core_mlme,node_channel,node_tx_power,node_crypto,node_wifi_types toneAmber
class node_efuse,node_phy_cfg,node_phydm,node_chip_ops,node_chip_defs,node_halmac_driver,node_halmac_common,node_halmac_registers,node_usb,node_efuse_masks,node_phy_support,node_halmac_api toneMint
class node_monitor,node_coexistence,node_coex_chip toneRose
class node_adapter toneIndigo
```

## Components

### Linux interfaces

- [WEXT and cfg80211](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/os_dep/linux/ioctl_linux.c): `os_dep/linux/ioctl_linux.c`

### Wireless runtime

- [Link management](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_mlme.c): `core/rtw_mlme.c`
- [Channel planning](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_chplan.c): `core/rtw_chplan.c`
- [TX power control](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/rtw_txpwr.h): `core/rtw_txpwr.h`
- [Wireless crypto](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/crypto/aes-internal.c): `core/crypto/aes-internal.c`
- [Wi-Fi data definitions](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/include/wifi.h): `include/wifi.h`

### Chip and transport

- [Efuse calibration](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/efuse/rtw_efuse.c): `core/efuse/rtw_efuse.c`
- [PHY configuration](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_com_phycfg.c): `hal/hal_com_phycfg.c`
- [PHY management](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/phydm/phydm_antdiv.c): `hal/phydm/phydm_antdiv.c`
- [RTL8822E operations](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/rtl8822e/rtl8822e_ops.c): `hal/rtl8822e/rtl8822e_ops.c`
- [RTL8822E definitions](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/rtl8822e/rtl8822e.h): `hal/rtl8822e/rtl8822e.h`
- [HALMAC driver API](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_halmac.h): `hal/hal_halmac.h`
- [HALMAC common](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_88xx/halmac_common_88xx.c): `hal/halmac/halmac_88xx/halmac_common_88xx.c`
- [HALMAC registers](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_reg2.h): `hal/halmac/halmac_reg2.h`
- [USB transport](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/hal_hci/hal_usb.c): `hal/hal_hci/hal_usb.c`
- [Efuse masks](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/efuse/efuse_mask.h): `hal/efuse/efuse_mask.h`
- [PHYDM support](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/phydm/phydm_precomp.h): `hal/phydm/phydm_precomp.h`
- [HALMAC API](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/halmac/halmac_api.h): `hal/halmac/halmac_api.h`

### Radio features

- [Monitor radiotap](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/core/monitor/rtw_radiotap.c): `core/monitor/rtw_radiotap.c`
- [Bluetooth coexistence](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/btc/halbtccommon.c): `hal/btc/halbtccommon.c`
- [RTL8822E coexistence](https://github.com/libc0607/rtl88x2eu-20230815/blob/v5.15.0.1/hal/btc/halbtc8822e.c): `hal/btc/halbtc8822e.c`

### Other components

- **Wireless user**
- **RTL8812EU/RTL8822EU adapter**

## Connections

- Wireless user → WEXT and cfg80211: configures
- WEXT and cfg80211 → Link management: sets link state
- Wireless user → Monitor radiotap: sets monitor mode
- Monitor radiotap → RTL8812EU/RTL8822EU adapter: injects packets
- Wireless user → Channel planning: sets channel
- Wireless user → TX power control: sets TX power
- Channel planning → RTL8812EU/RTL8822EU adapter: configures bandwidth
- TX power control → PHY configuration: sets radio power
- Link management → Wireless crypto: secures traffic
- Efuse calibration → HALMAC driver API: reads efuse (evidence: `core/efuse/rtw_efuse.c`)
- Efuse masks → Efuse calibration: selects masks (evidence: `core/efuse/rtw_efuse.c`)
- RTL8822E operations → RTL8822E definitions: uses definitions (evidence: `hal/rtl8822e/rtl8822e_ops.c`)
- RTL8822E operations → HALMAC driver API: uses HALMAC (evidence: `hal/rtl8822e/rtl8822e_ops.c`)
- PHY configuration → RTL8822E definitions: uses chip definitions (evidence: `hal/hal_com_phycfg.c`)
- PHYDM support → PHY management: supports PHYDM (evidence: `hal/phydm/phydm_antdiv.c`)
- Bluetooth coexistence → RTL8822E coexistence: uses chip coexistence
- HALMAC driver API → HALMAC API: declares operations (evidence: `hal/hal_halmac.h`)
- HALMAC common → HALMAC API: uses API (evidence: `hal/halmac/halmac_88xx/halmac_common_88xx.c`)
- HALMAC common → HALMAC registers: uses registers
- USB transport → RTL8812EU/RTL8822EU adapter: transfers frames
- RTL8812EU/RTL8822EU adapter → Wireless user: provides Wi-Fi
- Wi-Fi data definitions → Link management: defines Wi-Fi types
