ATH12K驱动框架架构图(分层描述)
I. 顶层架构
┌───────────────────────────────────────────────────────┐
│ Linux Kernel │
├───────────────────────────────────────────────────────┤
│ mac80211 │
├───────────────────────────────────────────────────────┤
│ ATH12K Driver │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │
│ │ Core │ │ MAC │ │ DP │ │Debug/Tracing│ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────────┘ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────┐ │
│ │ HAL │ │ HTC │ │ WMI │ │ CE │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────────┘ │
├───────────────────────────────────────────────────────┤
│ PCI/AHB 总线接口层 (Bus Interface) │
├───────────────────────────────────────────────────────┤
│ Hardware │
└───────────────────────────────────────────────────────┘
II. 核心数据结构层次关系
┌──────────────────────────────────────────────────────────────┐
│ struct ath12k_hw_group │
│ ┌──────────────────────────────────────────────┐ │
│ │ struct ath12k_hw │ │
│ │ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ struct │ │ struct │ │ │
│ │ │ ath12k │ │ ath12k │... │ │
│ │ │ (radio 0) │ │ (radio 1) │ │ │
│ │ └──────────────┘ └──────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ struct ath12k_base (SOC 0) │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │struct ath12k│ │struct ath12k│... │ │
│ │ │_pdev (0) │ │_pdev (1) │ │ │
│ │ └─────────────┘ └─────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ struct ath12k_base (SOC 1) │ │
│ │ ┌─────────────┐ ┌─────────────┐ │ │
│ │ │struct ath12k│ │struct ath12k│... │ │
│ │ │_pdev (0) │ │_pdev (1) │ │ │
│ │ └─────────────┘ └─────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
III. 主要模块详解
1. 核心模块 (Core)
┌──────────────────────────────────────────────────────────────┐
│ Core Module │
├──────────────────────────────────────────────────────────────┤
│ ┌────────────────────┐ ┌─────────────────────────────────┐ │
│ │ Initialization │ │ Resource Management │ │
│ │ - ath12k_core_init │ │ - Memory allocation │ │
│ │ - ath12k_core_qmi │ │ - Interrupts │ │
│ │ - Firmware loading │ │ - Device tree parsing │ │
│ └────────────────────┘ └─────────────────────────────────┘ │
│ │
│ ┌────────────────────┐ ┌─────────────────────────────────┐ │
│ │ Power Management │ │ Recovery handling │ │
│ │ - Suspend/Resume │ │ - SSR (Subsystem restart) │ │
│ │ - Runtime PM │ │ - FW crash handling │ │
│ └────────────────────┘ └─────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────┘
2. 硬件抽象层 (HAL)
┌─────────────────────────────────