Make RX queue size configurable (#2324)

This commit is contained in:
Alexandra Clifford 2024-10-15 03:38:09 -04:00 committed by GitHub
parent ef7842fab4
commit a15cfe7f21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 35 additions and 9 deletions

View File

@ -23,20 +23,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added board-specific consts for c6 and h2 when caluclating transmit power conversion
- Added board-specific consts for c6 and h2 when caluclating transmit power conversion (#2114)
- Added `defmt` and `log` features (#2183)
- Make RX queue size configurable using esp-config (#2324)
### Changed
- Modified CCA threshold value to default of -60
- Modified CCA threshold value to default of -60 (#2114)
- The driver now take `RADIO_CLK` by value to avoid a collision with esp-wifi's usage (#2183)
- `binary-logs` feature renamed to `sys-logs` (#2183)
- Updated PHY driver to v5.3.1 (#2239)
### Fixed
- Fixed possible integer underflow in array access
- Fixed compile error when building sys-logs feature
- Fixed possible integer underflow in array access (#2114)
- Fixed compile error when building sys-logs feature (#2114)
## 0.2.0 - 2024-08-29

View File

@ -20,19 +20,21 @@ byte = "0.2.7"
critical-section = "1.1.3"
document-features = "0.2.10"
esp-hal = { version = "0.21.0", path = "../esp-hal" }
esp-wifi-sys = { version = "0.6.0" }
esp-wifi-sys = { version = "0.6.0" }
heapless = "0.8.0"
ieee802154 = "0.6.1"
cfg-if = "1.0.0"
esp-config = { version = "0.1.0", path = "../esp-config" }
defmt = { version = "0.3.8", optional = true }
log = { version = "0.4.22", optional = true }
defmt = { version = "0.3.8", optional = true }
log = { version = "0.4.22", optional = true }
[build-dependencies]
esp-config = { version = "0.1.0", path = "../esp-config" }
[features]
esp32c6 = ["esp-hal/esp32c6", "esp-wifi-sys/esp32c6"]
esp32h2 = ["esp-hal/esp32h2", "esp-wifi-sys/esp32h2"]
sys-logs = ["esp-wifi-sys/sys-logs"]
log = ["dep:log", "esp-wifi-sys/log"]
defmt = ["dep:defmt", "esp-wifi-sys/defmt"]

View File

@ -1,6 +1,19 @@
use std::{env, path::PathBuf};
use esp_config::{generate_config, Value};
fn main() {
let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
// emit config
generate_config(
"esp_ieee802154",
&[(
"rx_queue_size",
Value::UnsignedInteger(50),
"Size of the RX queue in frames",
)],
true,
);
}

View File

@ -18,6 +18,7 @@ use core::{cell::RefCell, marker::PhantomData};
use byte::{BytesExt, TryRead};
use critical_section::Mutex;
use esp_config::*;
use esp_hal::peripherals::{IEEE802154, RADIO_CLK};
use heapless::Vec;
use ieee802154::mac::{self, FooterMode, FrameSerDesContext};
@ -58,6 +59,14 @@ impl From<byte::Error> for Error {
}
}
struct QueueConfig {
rx_queue_size: usize,
}
pub(crate) const CONFIG: QueueConfig = QueueConfig {
rx_queue_size: esp_config_int!(usize, "ESP_IEEE802154_RX_QUEUE_SIZE"),
};
/// IEEE 802.15.4 driver configuration
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Config {

View File

@ -33,7 +33,8 @@ use crate::{
const PHY_ENABLE_VERSION_PRINT: u32 = 1;
static mut RX_BUFFER: [u8; FRAME_SIZE] = [0u8; FRAME_SIZE];
static RX_QUEUE: Mutex<RefCell<Queue<RawReceived, 20>>> = Mutex::new(RefCell::new(Queue::new()));
static RX_QUEUE: Mutex<RefCell<Queue<RawReceived, { crate::CONFIG.rx_queue_size }>>> =
Mutex::new(RefCell::new(Queue::new()));
static STATE: Mutex<RefCell<Ieee802154State>> = Mutex::new(RefCell::new(Ieee802154State::Idle));
extern "C" {