Skip to content

Commit

Permalink
Migrate PARL_IO driver to newer DMA API
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Fischer committed Jan 25, 2025
1 parent 24f8458 commit 0c575c5
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 279 deletions.
2 changes: 1 addition & 1 deletion esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Rng` and `Trng` now implement `Peripheral<P = Self>` (#2992)
- SPI, UART, I2C: `with_<pin>` functions of peripheral drivers now disconnect the previously assigned pins from the peripheral. (#3012)
- SPI, UART, I2C: Dropping a driver now disconnects pins from their peripherals. (#3012)

- Migrate PARL_IO driver to DMA move API (#0000)
- `Async` drivers are no longer `Send` (#2980)
- GPIO drivers now take configuration structs, and their constructors are fallible (#2990)
- `flip-link` feature is now a config option
Expand Down
28 changes: 28 additions & 0 deletions esp-hal/MIGRATING-0.23.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,34 @@ config/config.toml
+ ESP_HAL_CONFIG_PSRAM_MODE = "octal"
```

## PARL_IO changes
Parallel IO now uses the newer DMA Move API.

Changes on the TX side
```diff
let (_, _, tx_buffer, tx_descriptors) = dma_buffers!(0, 32000);
+ let mut dma_tx_buf = DmaTxBuf::new(tx_descriptors, tx_buffer).unwrap();

- let transfer = parl_io_tx.write_dma(&tx_buffer).unwrap();
- transfer.wait().unwrap();
+ let transfer = parl_io_tx.write(Some(dma_tx_buf.len()), dma_tx_buf).unwrap();
+ (result, parl_io_tx, dma_tx_buf) = transfer.wait();
+ result.unwrap();
```

Changes on the RX side
```diff
let (rx_buffer, rx_descriptors, _, _) = dma_buffers!(32000, 0);
+ let mut dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap();
- let transfer = parl_io_rx.read_dma(&mut rx_buffer).unwrap();
- transfer.wait().unwrap();
+ let transfer = parl_io_rx.read(Some(dma_rx_buf.len()), dma_rx_buf).unwrap();
+ (_, parl_io_rx, dma_rx_buf) = transfer.wait();
```

On the RX side, the `EofMode` is now decided at transfer time, rather than config time.
- `EofMode::ByteLen` -> `Some(<number of bytes to receive>)`
- `EofMode::EnableSignal` -> `None`

## UART halves have their configuration split too

Expand Down
Loading

0 comments on commit 0c575c5

Please sign in to comment.