MCPcopy Index your code
hub / github.com/esp32-open-mac/esp-wifi-hal

github.com/esp32-open-mac/esp-wifi-hal @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
171 symbols 451 edges 23 files 112 documented · 65%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

esp-wifi-hal

This repo contains an experimental port of esp32-open-mac to Rust, with embassy. It is not intended to replace the C version, but to explore, how this can be done in Rust idiomatically. We still rely on the proprietary blobs for initializing the RF frontend and some more minor initialization.

DISCLAIMER

This is experimental software. USE AT YOUR OWN RISK! We'll not take any liability for damage to the hardware. We do not condone the use of this for malicious purposes.

Usage

The actual crate lives in esp-wifi-hal/ and examples are in examples/. The critical_section feature allows using the driver across cores. If it is disabled, no critical sections are used in the driver at all.

For further information see the docs.

Building

To set up a development environment follow the guide at https://docs.esp-rs.org/book/installation/index.html. Since this only works on the ESP32 and ESP32-S2 right now, only the Xtensa section is of interest. To try one of these examples: 1. Clone the repo 2. Connect the ESP32 3. cd examples 4. Run cargo run -r --bin [EXAMPLE_NAME_GOES_HERE]

Technical Notes

The ESP32 WiFi peripheral has five TX slots, which we number 0-4. The MMIO addresses, where these are configured are in reverse order. This means, that slot zero starts at the HIGHEST address and slot four at the lowest. This numbering is also suggested by the TX status registers. We could in theory reverse this ordering to ascending addresses, this would however cause headaches with TX slot status handling, so we chose to stick with descending addresses. This is also the way the proprietary task handles this.

We have reason to believe, that slot four is in some way special, as the TX completion handler in the proprietary task masks away the bit corresponding to that slot (See hal_mac_get_txq_state). However, as our tests do not indicate any special behaviour, we just use it like a normal slot.

Extension points exported contracts — how you extend this code

DmaDescriptorExt (Interface)
(no doc) [1 implementers]
esp-wifi-hal/src/dma_list.rs

Core symbols most depended-on inside this repo

next
called by 27
esp-wifi-hal/src/sync.rs
common_init
called by 12
examples/src/lib.rs
embassy_init
called by 12
examples/src/lib.rs
wifi_init
called by 12
examples/src/lib.rs
reset
called by 11
esp-wifi-hal/src/sync.rs
set_channel
called by 10
esp-wifi-hal/src/wmac.rs
transmit
called by 8
esp-wifi-hal/src/wmac.rs
header_buffer
called by 7
esp-wifi-hal/src/wmac.rs

Shape

Method 92
Function 56
Class 11
Enum 11
Interface 1

Languages

Rust100%

Modules by API surface

esp-wifi-hal/src/wmac.rs64 symbols
examples/src/bin/test_cli.rs17 symbols
esp-wifi-hal/src/crypto.rs17 symbols
esp-wifi-hal/src/sync.rs14 symbols
esp-wifi-hal/src/ll.rs14 symbols
esp-wifi-hal/src/dma_list.rs14 symbols
examples/src/lib.rs7 symbols
esp-wifi-hal/src/rates.rs5 symbols
esp-wifi-hal/src/ffi.rs5 symbols
examples/src/bin/scanner.rs2 symbols
examples/src/bin/multi_beacon.rs1 symbols
examples/src/bin/minimal.rs1 symbols

For agents

$ claude mcp add esp-wifi-hal \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact