52 Commits

Author SHA1 Message Date
Juraj Sadel
0180a38ba0
esp-storage now depends on esp-hal (#4173)
* esp-storage now depends on esp-hal

* clean up cfg gates

* changelog
2025-09-24 08:55:26 +00:00
Benedikt
129fa9676b
RMT: move more things to esp-metadata, improve HIL test robustness (#4138)
* RMT: use hil_test::assert{,eq}, clarify potential timing issues

* RMT: prevent flaky HIL tests by matching pulse codes fuzzily

* RMT: add rmt_clock_rate HIL test

* RMT: add esp-metadata flags for most hardware features

* RMT: move supported clock sources to esp-metadata

* RMT: move max_idle_threshold to esp-metadata

from a quick glance at the TRMs, it seems that these values are also
wrong! e.g. c3 & c6 appear to support up to 0x7FFF -> this should be verified
and fixed if correct
2025-09-23 09:50:38 +00:00
Simon Neuenhausen
8e29b925cb
Split out PHY init into esp-phy crate. (#3892)
* Minimal infrastructure

* Implemented dig reg backup.

* usb bbpll

* Removed default feature.

* OS adapter tweaks

* Fixed S2 and implemented PhyController

* Added manual deinit.

* Fixed linker scripts and migrated esp-radio to esp-phy

* Fixed warnings.

* Fixed NPL

* Tried fixing NPL again

* Fixed ieee802154

* Fixed reading chip version of S3.

* fmt

* Added changelog entry

* Added changelog for esp-radio

* Deleted chip specific common adapters.

* Added docs and unstable

* Migrated cal data load/store to esp-phy

* Fixed PHY cal CI error

* Removed instability

* Removed feature from esp-phy

* fmt

* Fixed esp-sync docs.

* Removed log with CONFIG

* Removed nonreentrantmutex from common adapter

* Disable reset for radio blocks where required.

* Fixed cfg_if for s2

* fmt

* Added bt_bb_v2_init_cmplx to phy_provides.x

* Added CHANGELOG

* Moved EXTERN and fixed comment.

* Fixed lint

* Fixed common adapter again.

* Docs and Readme.

* Fixed ref count.

* This time pls.

* Added MAC time update CB for esp-radio

* fixed field init

* Fixed inconsistency in metadata

* Removed useless changelog entry

* Fixed S2.

* Swaped addr_of for &raw mut

* Properly initialize NVS

* Fixed lint

* Fixed C6

* Fixed remaining issues

* Fixed CI

* Added link

* Updated esp-wifi-sys in esp-phy

* Address reviews

* Renamed PHY lock

* Moved syscon let in common_adapter

* Fmt

* Remove critical_section

* Don't steal when not necessary

* Added esp-phy changelog to workflow

* Add cargo metadata for esp-phy

* Added reference to #4015

* Refixed Cargo.toml

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-09-19 14:14:25 +00:00
Benedikt
099b70fef9
RMT: move channel specification to esp-metadata (#4131) 2025-09-17 11:05:29 +00:00
Dániel Buga
5f1c1feed9
I2C: Fix bus clearing/error recovery (#4000)
* Run test with multiple timeouts

* Align hw_bus_clear option with esp-idf

* Generate stop condition after HW bus clearing

* Tweak software bus clearing algo

* Make sure I2C is always reset

* Properly set finished flag even on timeouts

* Fix reset/clear interactions

* Add a note about blocking in Drop

* Add changelog entry
2025-08-28 19:56:28 +00:00
Dániel Buga
e42f7d2e06
More clock refactor (#3993)
* Remove duplicate constants

* Metadata-ify some clock frequencies

* Changelog
2025-08-27 08:50:34 +00:00
Dániel Buga
b8b7793bd9
Move SHA algos to metadata (#3991) 2025-08-26 14:38:48 +00:00
Dániel Buga
30e5591e88
Tweak XTAL frequency options (#3983)
* Don't estimate XTAL with RC oscillator if not necessary. Accept wider range in HIL tests. Skip calibration if value is valid.

* Init clock before RTC domain
2025-08-26 11:31:41 +00:00
Dániel Buga
2f1a5cc101
Minor, exploratory SHA cleanup (#3931)
* Add sha_dma metadata

* Move SHA interrupt to metadata

* Minor SHA cleanups
2025-08-13 14:23:09 +00:00
Dániel Buga
fab1221894
DMA-enabled work-queue based AES driver (#3897)
* AES-DMA work queue backend

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Clean up manual subslicing

* Don't copy in write_iv

* Add more to why we can use copy_from_nonoverlapping

* Replace buffers with NoBuffer

* Move buffers to backend

* Volatile-ly zero the key

* Make saving state the user's responsibility

* Ensure data is aligned on esp32

* Also make sure the DMA finishes in AesTransfer

* Deduplicate

* Fix paperwork

* Use the handler attribute

* Remove unused method

* Update esp-hal/MIGRATING-1.0.0-rc.0.md

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Fix build after rebase

* Add empty Final to NoBuffer

* Use the move api internally

* Make () the view type

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2025-08-12 12:19:24 +00:00
Dániel Buga
e1b8558057
RSA tweaks (#3900)
* RSA tweaks

* Fix copy-pasted typos from esp-idf docs

* Clean up

* Fix doc issues
2025-08-10 12:34:04 +00:00
Dániel Buga
406056ab9c
Midterm AES rework (#3882)
* Midterm AES rework

* Update esp-hal/src/aes/mod.rs

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Update esp-hal/MIGRATING-1.0.0-rc.0.md

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Panic on wrong size

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2025-07-30 15:02:12 +00:00
Dániel Buga
a215aca629
Move REF_TICK and RC_FAST_CLK to metadata (#3866)
* Move REF_TICK and RC_FAST_CLK to metadata

* Don't try to use ref_tick if it doesn't exist

* Fix S3
2025-07-28 10:14:34 +00:00
Dániel Buga
bb50746e9c
Move TIMG clock source defaults to metadata (#3864)
* Read register once

* Move TIMG clock sources to metadata

* Also describe C2/3/S2/S3 clock source options

* H2: Use PLL as WDT clock source

* Fix H2 WDT calculation

* Initialize clocks before setting up WDT

* Set clock source for all timers in the timer group
2025-07-28 07:10:58 +00:00
Dániel Buga
1af4e29014
Move RSA operand sizes to metadata (including AES fallout) (#3845)
* Encode RSA operand sizes in metadata, compactly

* Rework AES with for-each macro
2025-07-24 08:36:32 +00:00
Dániel Buga
0c1cc17ed1
Move SHA algos to metadata (#3844) 2025-07-21 19:47:33 +00:00
Dániel Buga
fd66bd3dcc
Encode AES key lengths in metadata (#3843) 2025-07-21 19:01:45 +00:00
Dániel Buga
0d9f43db29
Rewrite RNG (#3829) 2025-07-21 15:10:35 +00:00
Dániel Buga
8c64b09ba7
Allow configuring longer WDT periods (#3816)
* Clean up with new PAC

* Allow configuring longer WDT periods

* Enable WDT after updating timeout
2025-07-17 14:50:26 +00:00
Dániel Buga
e146e03c72
Use metadata to define LP peripheral FIFO sizes (#3812) 2025-07-17 12:16:24 +00:00
Dániel Buga
3a5aa72c4e
Define analog/LP functions (#3781)
* Shorten name

* Define analog/rtc functions

* Try to make the data useable

* Remove general pin attributes

* Do not generate unnecessary expanded matchers

* Remove expanded GPIO cases

* Move simplified io_type to where it is used

* Fix RTC IO with resistors calls

* Hide macros on H2

* Define rtcio pins for C2/C3

* Fix S2

* Compare against the correct GPIO number

* Deduplicate

* Restore one waker per pin

* Remove case that is no longer needed, avoid inline(always)
2025-07-11 09:41:50 +00:00
Simon Neuenhausen
3d6e522cbc
Allow splitting control over modem clocks. (#3687)
* Minimal architecture for split RCC.

* Removed critical section.

* Add all modem clock controllers and adjust esp-ieee802154.

* Fixed incorrect cfg.

* Fixed unstable attribute usage.

* Replaced AtomicU8 with Cell<u8>

* Reverted example channel back to 15

* Added unstable attribute to ModemClockController impls.

* Remember to actually increase the ref count.

* Experimentally removed RadioClockController

* Merged ref counters and made decrease panic if zero is reached.

* Removed RADIO_CLK peripheral.

* Removed RADIO_CLK again.

* Revert "Removed RADIO_CLK again."

This reverts commit 6da2d2834850068aa21bc52b141de2cfd8154acc.

* Removed RADIO_CLK without reformatting the files.

* Applied changes to examples and hil-tests.

* Fixed OS adapter for C2 and H2

* Adjusted docs and used unwrap!

* Fixed comments.

* Added changelog.

* Fixed esp-wifi for esp32h2.

* Changed comment for PHY_CLOCK_REF_COUNTER.

* Fixed lint for esp32c2.

* Update esp-hal/src/clock/mod.rs

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* Update esp-hal/src/clock/mod.rs

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* Removed unnecessary comments and made init_radio_clocks unstable.

* Update esp-hal/src/clock/mod.rs

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* Fixed lint.

* Removed clocks_ll functions for chips that don't have those peripherals.

* fmt

* Changed modem clock controller stealing.

* Added lifetime

* fixed peripheral stealing again

* Made modem_clock_controller not const.

* Used type alias instead of function for peripheral stealing.

* fmt

* Adjusted remaining comments.

* Added note about coex.

* fmt

* misc

* Revert "misc"

This reverts commit d8740421e0dff84af605160939e246f2308a48e1.

* Regenerated esp metadata

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-07-08 17:23:55 +00:00
Dániel Buga
1a9b4bafe0
Calculate max input/output signal ID automatically (#3773) 2025-07-08 13:39:00 +00:00
Dániel Buga
692a768b3a
Introduce esp-metadata-generated (#3754)
* Move macros to new crate

* Generate a single file

* Pre-generate esp-metadata-generated

* Move saving code to xtask

* Format with both rustfmt and prettyplease

* Fix doc build

* Unhide macros

* Fix doc string

* Update semver-check baseline
2025-07-07 15:37:05 +00:00
Dániel Buga
9146407573
Fix and extend pin layouts (#3726)
* Fix ESP32 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Tabulate ESP32

* Fix C2 pin layout

* Fix C3 pin layout

* Fix C6 pin layout

Co-authored-by: rmsyn <github@weathered-steel.dev>

* Note AF availability on IoMuxSignal

* Add mising AFs to H2

* Remove unavailable pins

* Add mising signals to S2

* Add mising signals to S3

* Changelog

* Update semver baseline

---------

Co-authored-by: rmsyn <github@weathered-steel.dev>
2025-07-02 13:16:48 +00:00
Dániel Buga
21f1d89f15
Generate peripherals macro call & remove paste (#3713)
* Expand peripheral metadata

* Generate peripherals macro call

* Remove paste from peripherals

* Add missing peris

* Fix ETM and TRACE0 naming

* Remove redundant tsens symbol

* Remove RTCIO stuff from h2

* Rename S2 RTC_CNTL

* Add missing SYSCON back to S2

* Do not mark the GPIO singleton stable

* Treat unlisted drivers as not available

* Assign stability based on driver info

* Fmt

* Remove unused info
2025-07-01 19:31:21 +00:00
Dániel Buga
745cfd71b6
de-paste! the any_peripheral macro (#3699)
* Stop using paste in any_peripheral

* Drop unused macro

* Generate a delegate macro for any-peripheral dispatching

* Fix up PDMA
2025-07-01 13:48:40 +00:00
Dániel Buga
175f4a16b6
Extract SPI metadata (#3702)
* Extract SPI M/S metadata

* Clean up additional instance trait

* Further SPI cleanups, add OSPI pin setters

* Re-generate semver baseline

* Fix typo
2025-07-01 11:13:26 +00:00
Dániel Buga
b2a8d6bcee
Move UART instance info to esp-metadata (#3698)
* Move UART instance info to esp-metadata

* Fix typo
2025-06-30 16:38:15 +00:00
Dániel Buga
b11d810d97
Tweak and make use of the old bind_X_interrupt functions (#3689)
* Rename bind_interrupt functions

* Generate enable/disable functions, remove redundant irq mapping from metadata

* Clean up PARL_IO

* Refactor SPI master, I2S, Uart

* Update USB_DEVICE
2025-06-30 15:28:42 +00:00
Dániel Buga
c72889a73d
Generate i2c instances from metadata (#3678) 2025-06-24 12:18:22 +00:00
Dániel Buga
1cd3a28954
Move IO_MUX signals to metadata (#3663)
* Generate Input/OutputSignal enums

* Deduplicate alternate function tables

* Don't misuse instance config for pins and signals
2025-06-23 14:43:17 +00:00
Dániel Buga
9507fa38b4
Move smaller GPIO properties to metadata (#3657)
* Move other GPIO properties

* Redo USB pins as pin capability

* Deduplicate interrupt status enum

* Remove unnecessary interrupt enable bits on S2

* Update S2 PAC and remove manual io_mux hackery

* Generate io_mux function from metadata
2025-06-23 12:45:21 +00:00
Dániel Buga
b98631570f
Move GPIO pin properties to metadata (#3656)
* Reorganize esp-metadata

* Move GPIO properties to metadata

* Fix AF enum variants, remove need for paste for them
2025-06-20 07:45:49 +00:00
Dániel Buga
2438d03b21
Simplify generated code to save on build time, yeet a few dependencies (#3643)
* Reduce use of iter::chain

* Cache all symbols

* Trim xtensa-lx-rt deps

* Remove unused dep

* Replace chrono with jiff

* Yeet minijinja

* Save a bit on toml_edit

* Disable some default features

* Disable regex log filters

* Reduce xtensa-lx-rt build script

* Remove unnecessary dependencies

* Remove darling

* Update embedded-test

* lol

* Clean up

* Only validate loaded config once

* fmt

* Changelog
2025-06-17 20:35:00 +00:00
Dániel Buga
891a5a4a8c
Move some more peripherals to metadata (#3633)
* Remove gpio bank 1 symbol

* Remove intr status width symbols

* Allow virtual periphs, redo ADC/DAC
2025-06-17 08:10:12 +00:00
Dániel Buga
3e6b85bf30
Update i2c/spi instance info (#3627)
* Add instances to drivers

* Move AnyI2c

* Move AnySpi and DataMode

* Generate new semver baseline
2025-06-13 13:56:52 +00:00
Dániel Buga
793b01beaa
Move timer instance config into driver metadata (#3626)
* Remove timg_timer1 symbol

* Ensure instances exist

* Rename timers to timergroup

* Remove unnecessary cfg
2025-06-12 14:49:04 +00:00
Dániel Buga
db3eb3da95
Remove hand-defined radio symbols (#3632) 2025-06-12 13:04:36 +00:00
Dániel Buga
f22ddb4a87
More i2c metadata & some additional cleanup (#3620)
* Define more i2c metadata

* Remove I2C1 AHB base address

* Encode address in metadata

* Extract timeout value calculation
2025-06-11 09:47:42 +00:00
Dániel Buga
f394af8ca2
Peri support corrections (#3621) 2025-06-10 13:58:19 +00:00
Dániel Buga
48a5927767
Generate peripheral support table (#3617) 2025-06-10 13:13:24 +00:00
Dániel Buga
f6d54a0471
Generate macros from metadata (#3604)
* Generate macros from metadata

* Don't generate metadata env vars

* Add trm link, change cores to integer

* Port RMT memory constants

* Add some I2C flags

* Auto-generate PeriConfig, remove trait

* Make sure memory_range is hidden
2025-06-10 10:06:32 +00:00
Björn Quentin
faf7115b0c
Define DRAM memory region in esp-metadata (#3300)
* Define DRAM memory region in esp-metadata

* CHANGELOG.md

* Dedicated macros for memory region start/end

* Use `from_str_radix` in esp-config

* Fix search+replace mistake

* Fix

* fix'n fmt

* fix unused

* Minor change
2025-04-02 14:56:34 +00:00
Dániel Buga
17255ac0ab
Enable async ADC for C2 and H2 (#3082)
* Enable async ADC for H2

* Enable for C2

* Prevent disabling interrupt if an async ADC is in use

* Introduce adc1/2 symbols
2025-02-03 09:41:04 +00:00
Dániel Buga
6b01f7993b
SPI and related changes (#2681)
* Define Octal SpiDataMode

* Fix BitOrder capitalization

* Hide DmaError

* Derive more traits

* Return error for unsupported half-duplex parameter combinations

* Remove unnecessary implementation detail

* Return error instead of silently breaking transaction

* Downgrade assert to debug_assert

* Expand on the enum variants

* Remove redundant imports

* Hide some unstable functions
2024-12-06 10:30:43 +00:00
Dániel Buga
9458fd3ed4
[DMA 8/8] Burst configuration (#2543)
* Implement burst configuration

* Reject transfers if the DMA in incapable of accessing external memory

* Fix psram

* Rename, documentation

* Address a few review comments

* Check buffer length, too

* Return error instead of panic

* Allow users to only specify the relevant burst config

* Add missing conversion

* Add missing docs

* Fix IN alignment requirements

* Fix test

* Deduplicate chunk size literal
2024-12-06 08:30:58 +00:00
Dániel Buga
a6a83d3bb5
Track async GPIOs in memory (#2625)
* Track async GPIOs in memory

* Add an example

* Deduplicate interrupt handling

* Changelog

* Add gpio_bank_1 symbol

* Derive EnumCount

* Try to fix issues around manual listen calls and multi-core

* Fix test

* Update esp-hal/src/gpio/mod.rs

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>

* Do not prevent pending interrupt from being handled

* Remove unnecessary unpin

* Add a note about interrupt status flags

---------

Co-authored-by: Dominic Fischer <14130965+Dominaezzz@users.noreply.github.com>
2024-12-02 15:35:10 +00:00
Dániel Buga
0981c1b619
SPI peripheral signal cleanup (#2245)
* Compact peripheral description a bit

* Enable QSPI on ESP32 SPI3

* Remove SPI4 from ESP32S2

* Changelog

* Remove inaccurate comment
2024-09-27 17:03:18 +00:00
Björn Quentin
4f9dc960c6
Improve xtensa interrupt latency (#1735)
* Avoid U128

* Avoid unnecessary calls

* CHANGELOG.md

* Simplify

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>

---------

Co-authored-by: Jesse Braham <jessebraham@users.noreply.github.com>
2024-07-03 15:43:01 +00:00