# morsemicro/morse_driver architecture

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

- Interactive diagram: https://gitdiagram.com/morsemicro/morse_driver
- Repository: https://github.com/morsemicro/morse_driver

## Overview

This is a Linux kernel WLAN driver for Morse Micro hardware. Its principal workflow is mac80211 handing operations and frames to the driver, which configures firmware and transfers commands or packets over a host bus; received traffic and status return through the driver. Major capabilities include 802.11ah/S1G frame and channel handling, scanning, mesh, power save, TWT, and raw-frame support. The README only describes cross-compilation; connections below rely on shown excerpts and SOURCE INDEX references, so unsampled subsystem links are omitted where their callers are not established.

Main entry points: [`mac.c`](https://github.com/morsemicro/morse_driver/blob/main/mac.c) (MAC callbacks), [`command.c`](https://github.com/morsemicro/morse_driver/blob/main/command.c) (Firmware commands), [`dot11ah/rx_s1g_to_11n.c`](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/rx_s1g_to_11n.c) (S1G frame handling), [`skbq.c`](https://github.com/morsemicro/morse_driver/blob/main/skbq.c) (Packet queues)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mac["Wireless interface"]
  node_mac["MAC callbacks<br/>[mac.c]"]
  node_wiphy["Wiphy registration<br/>[wiphy.c]"]
  node_state["Driver state<br/>[morse.h]"]
end

subgraph group_s1g["802.11ah / S1G"]
  node_s1g["S1G frame handling<br/>[rx_s1g_to_11n.c]"]
  node_s1gtx["S1G transmit conversion<br/>[tx_11n_to_s1g.c]"]
  node_tim["S1G TIM<br/>[tim.c]"]
  node_channels["S1G channels<br/>[s1g_channels.c]"]
  node_reg["Regulatory rules<br/>[reg.c]"]
  node_dotdebug["S1G logging<br/>[debug.c]"]
end

subgraph group_features["Wireless features"]
  node_scan["Scanning<br/>[hw_scan.c]"]
  node_mesh["Mesh networking<br/>[mesh.c]"]
  node_power["Power save<br/>[ps.c]"]
  node_twt["TWT agreements<br/>[twt.c]"]
  node_raw["Raw frames<br/>[raw.c]"]
  node_debug["Driver logging<br/>[debug.c]"]
end

subgraph group_device["Firmware and transport"]
  node_command["Firmware commands<br/>[command.c]"]
  node_queue["Packet queues<br/>[skbq.c]"]
  node_bus["Bus interface<br/>[bus.h]"]
  node_spi["SPI transport<br/>[spi.c]"]
  node_firmware["Firmware management<br/>[firmware.c]"]
  node_header["Packet metadata<br/>[skb_header.h]"]
end

node_mac80211(("Linux mac80211"))

node_mac80211 -.->|"calls callbacks"| node_mac
node_wiphy -.->|"configures interface"| node_mac
node_mac -->|"uses driver state"| node_state
node_mac -->|"issues commands"| node_command
node_mac -->|"translates frames"| node_s1g
node_mac -->|"uses power controls"| node_power
node_mac -->|"handles TWT"| node_twt
node_mac -->|"handles raw frames"| node_raw
node_command -->|"uses packet queues"| node_queue
node_command -->|"uses packet metadata"| node_header
node_queue -->|"uses packet metadata"| node_header
node_bus -->|"accesses device state"| node_state
node_spi -->|"implements bus interface"| node_bus
node_s1g -->|"uses TIM handling"| node_tim
node_s1gtx -->|"uses TIM handling"| node_tim
node_channels -->|"uses channel rules"| node_reg
node_mac -->|"uses mesh support"| node_mesh
node_mac -->|"uses scan support"| node_scan
node_dotdebug -.->|"logs S1G operations"| node_s1g

click node_mac "https://github.com/morsemicro/morse_driver/blob/main/mac.c"
click node_wiphy "https://github.com/morsemicro/morse_driver/blob/main/wiphy.c"
click node_state "https://github.com/morsemicro/morse_driver/blob/main/morse.h"
click node_command "https://github.com/morsemicro/morse_driver/blob/main/command.c"
click node_queue "https://github.com/morsemicro/morse_driver/blob/main/skbq.c"
click node_bus "https://github.com/morsemicro/morse_driver/blob/main/bus.h"
click node_spi "https://github.com/morsemicro/morse_driver/blob/main/spi.c"
click node_firmware "https://github.com/morsemicro/morse_driver/blob/main/firmware.c"
click node_s1g "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/rx_s1g_to_11n.c"
click node_s1gtx "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/tx_11n_to_s1g.c"
click node_tim "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/tim.c"
click node_channels "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/s1g_channels.c"
click node_reg "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/reg.c"
click node_scan "https://github.com/morsemicro/morse_driver/blob/main/hw_scan.c"
click node_mesh "https://github.com/morsemicro/morse_driver/blob/main/mesh.c"
click node_power "https://github.com/morsemicro/morse_driver/blob/main/ps.c"
click node_twt "https://github.com/morsemicro/morse_driver/blob/main/twt.c"
click node_raw "https://github.com/morsemicro/morse_driver/blob/main/raw.c"
click node_debug "https://github.com/morsemicro/morse_driver/blob/main/debug.c"
click node_dotdebug "https://github.com/morsemicro/morse_driver/blob/main/dot11ah/debug.c"
click node_header "https://github.com/morsemicro/morse_driver/blob/main/skb_header.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_mac,node_wiphy,node_state toneBlue
class node_s1g,node_s1gtx,node_tim,node_channels,node_reg,node_dotdebug toneAmber
class node_scan,node_mesh,node_power,node_twt,node_raw,node_debug toneMint
class node_command,node_queue,node_bus,node_spi,node_firmware,node_header toneRose
class node_mac80211 toneIndigo
```

## Components

### Wireless interface

- [MAC callbacks](https://github.com/morsemicro/morse_driver/blob/main/mac.c): `mac.c`
- [Wiphy registration](https://github.com/morsemicro/morse_driver/blob/main/wiphy.c): `wiphy.c`
- [Driver state](https://github.com/morsemicro/morse_driver/blob/main/morse.h): `morse.h`

### 802.11ah / S1G

- [S1G frame handling](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/rx_s1g_to_11n.c): `dot11ah/rx_s1g_to_11n.c`
- [S1G transmit conversion](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/tx_11n_to_s1g.c): `dot11ah/tx_11n_to_s1g.c`
- [S1G TIM](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/tim.c): `dot11ah/tim.c`
- [S1G channels](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/s1g_channels.c): `dot11ah/s1g_channels.c`
- [Regulatory rules](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/reg.c): `dot11ah/reg.c`
- [S1G logging](https://github.com/morsemicro/morse_driver/blob/main/dot11ah/debug.c): `dot11ah/debug.c`

### Wireless features

- [Scanning](https://github.com/morsemicro/morse_driver/blob/main/hw_scan.c): `hw_scan.c`
- [Mesh networking](https://github.com/morsemicro/morse_driver/blob/main/mesh.c): `mesh.c`
- [Power save](https://github.com/morsemicro/morse_driver/blob/main/ps.c): `ps.c`
- [TWT agreements](https://github.com/morsemicro/morse_driver/blob/main/twt.c): `twt.c`
- [Raw frames](https://github.com/morsemicro/morse_driver/blob/main/raw.c): `raw.c`
- [Driver logging](https://github.com/morsemicro/morse_driver/blob/main/debug.c): `debug.c`

### Firmware and transport

- [Firmware commands](https://github.com/morsemicro/morse_driver/blob/main/command.c): `command.c`
- [Packet queues](https://github.com/morsemicro/morse_driver/blob/main/skbq.c): `skbq.c`
- [Bus interface](https://github.com/morsemicro/morse_driver/blob/main/bus.h): `bus.h`
- [SPI transport](https://github.com/morsemicro/morse_driver/blob/main/spi.c): `spi.c`
- [Firmware management](https://github.com/morsemicro/morse_driver/blob/main/firmware.c): `firmware.c`
- [Packet metadata](https://github.com/morsemicro/morse_driver/blob/main/skb_header.h): `skb_header.h`

### Other components

- **Linux mac80211**

## Connections

- Linux mac80211 → MAC callbacks: calls callbacks (evidence: `mac.c`)
- Wiphy registration → MAC callbacks: configures interface
- MAC callbacks → Driver state: uses driver state (evidence: `mac.c`)
- MAC callbacks → Firmware commands: issues commands (evidence: `mac.c`)
- MAC callbacks → S1G frame handling: translates frames (evidence: `mac.c`)
- MAC callbacks → Power save: uses power controls (evidence: `mac.c`)
- MAC callbacks → TWT agreements: handles TWT (evidence: `mac.c`)
- MAC callbacks → Raw frames: handles raw frames (evidence: `mac.c`)
- Firmware commands → Packet queues: uses packet queues (evidence: `command.c`)
- Firmware commands → Packet metadata: uses packet metadata (evidence: `command.c`)
- Packet queues → Packet metadata: uses packet metadata (evidence: `skbq.c`)
- Bus interface → Driver state: accesses device state (evidence: `bus.h`)
- SPI transport → Bus interface: implements bus interface (evidence: `spi.c`)
- S1G frame handling → S1G TIM: uses TIM handling (evidence: `dot11ah/rx_s1g_to_11n.c`)
- S1G transmit conversion → S1G TIM: uses TIM handling (evidence: `dot11ah/tx_11n_to_s1g.c`)
- S1G channels → Regulatory rules: uses channel rules (evidence: `dot11ah/s1g_channels.c`)
- MAC callbacks → Mesh networking: uses mesh support (evidence: `mac.c`)
- MAC callbacks → Scanning: uses scan support (evidence: `mac.c`)
- S1G logging → S1G frame handling: logs S1G operations
