Merge remote-tracking branch 'origin/main' into nrf-pdm
This commit is contained in:
commit
42de1c3a06
41
.gitattributes
vendored
Normal file
41
.gitattributes
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.adoc text
|
||||||
|
*.html text
|
||||||
|
*.in text
|
||||||
|
*.json text
|
||||||
|
*.md text
|
||||||
|
*.proto text
|
||||||
|
*.py text
|
||||||
|
*.rs text
|
||||||
|
*.service text
|
||||||
|
*.sh text
|
||||||
|
*.toml text
|
||||||
|
*.txt text
|
||||||
|
*.x text
|
||||||
|
*.yml text
|
||||||
|
|
||||||
|
*.raw binary
|
||||||
|
*.bin binary
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.jpeg binary
|
||||||
|
*.gif binary
|
||||||
|
*.ico binary
|
||||||
|
*.mov binary
|
||||||
|
*.mp4 binary
|
||||||
|
*.mp3 binary
|
||||||
|
*.flv binary
|
||||||
|
*.fla binary
|
||||||
|
*.swf binary
|
||||||
|
*.gz binary
|
||||||
|
*.zip binary
|
||||||
|
*.7z binary
|
||||||
|
*.ttf binary
|
||||||
|
*.eot binary
|
||||||
|
*.woff binary
|
||||||
|
*.pyc binary
|
||||||
|
*.pdf binary
|
||||||
|
*.ez binary
|
||||||
|
*.bz2 binary
|
||||||
|
*.swp binary
|
17
.github/ci/crlf.sh
vendored
Executable file
17
.github/ci/crlf.sh
vendored
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## on push branch~=gh-readonly-queue/main/.*
|
||||||
|
## on pull_request
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
FILES_WITH_CRLF=$(find ! -path "./.git/*" -not -type d | xargs file -N | (grep " CRLF " || true))
|
||||||
|
|
||||||
|
if [ -z "$FILES_WITH_CRLF" ]; then
|
||||||
|
echo -e "No files with CRLF endings found."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
NR_FILES=$(echo "$FILES_WITH_CRLF" | wc -l)
|
||||||
|
echo -e "ERROR: Found ${NR_FILES} files with CRLF endings."
|
||||||
|
echo "$FILES_WITH_CRLF"
|
||||||
|
exit "$NR_FILES"
|
||||||
|
fi
|
1
.github/ci/doc.sh
vendored
1
.github/ci/doc.sh
vendored
@ -37,6 +37,7 @@ docserver-builder -i ./embassy-usb-logger -o webroot/crates/embassy-usb-logger/g
|
|||||||
docserver-builder -i ./cyw43 -o webroot/crates/cyw43/git.zup
|
docserver-builder -i ./cyw43 -o webroot/crates/cyw43/git.zup
|
||||||
docserver-builder -i ./cyw43-pio -o webroot/crates/cyw43-pio/git.zup
|
docserver-builder -i ./cyw43-pio -o webroot/crates/cyw43-pio/git.zup
|
||||||
docserver-builder -i ./embassy-net-w5500 -o webroot/crates/embassy-net-w5500/git.zup
|
docserver-builder -i ./embassy-net-w5500 -o webroot/crates/embassy-net-w5500/git.zup
|
||||||
|
docserver-builder -i ./embassy-net-esp-hosted -o webroot/crates/embassy-net-esp-hosted/git.zup
|
||||||
docserver-builder -i ./embassy-stm32-wpan -o webroot/crates/embassy-stm32-wpan/git.zup --output-static webroot/static
|
docserver-builder -i ./embassy-stm32-wpan -o webroot/crates/embassy-stm32-wpan/git.zup --output-static webroot/static
|
||||||
|
|
||||||
export KUBECONFIG=/ci/secrets/kubeconfig.yml
|
export KUBECONFIG=/ci/secrets/kubeconfig.yml
|
||||||
|
@ -18,3 +18,9 @@ embedded-hal-async = { version = "=0.2.0-alpha.2" }
|
|||||||
noproto = { git="https://github.com/embassy-rs/noproto", default-features = false, features = ["derive"] }
|
noproto = { git="https://github.com/embassy-rs/noproto", default-features = false, features = ["derive"] }
|
||||||
#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] }
|
#noproto = { version = "0.1", path = "/home/dirbaio/noproto", default-features = false, features = ["derive"] }
|
||||||
heapless = "0.7.16"
|
heapless = "0.7.16"
|
||||||
|
|
||||||
|
[package.metadata.embassy_docs]
|
||||||
|
src_base = "https://github.com/embassy-rs/embassy/blob/embassy-net-esp-hosted-v$VERSION/embassy-net-esp-hosted/src/"
|
||||||
|
src_base_git = "https://github.com/embassy-rs/embassy/blob/$COMMIT/embassy-net-esp-hosted/src/"
|
||||||
|
target = "thumbv7em-none-eabi"
|
||||||
|
features = ["defmt"]
|
@ -479,30 +479,78 @@ impl<D: Driver + 'static> Stack<D> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "igmp")]
|
#[cfg(feature = "igmp")]
|
||||||
impl<D: Driver + smoltcp::phy::Device + 'static> Stack<D> {
|
impl<D: Driver + 'static> Stack<D> {
|
||||||
/// Join a multicast group.
|
/// Join a multicast group.
|
||||||
pub fn join_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
|
pub async fn join_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
|
||||||
|
where
|
||||||
|
T: Into<IpAddress>,
|
||||||
|
{
|
||||||
|
let addr = addr.into();
|
||||||
|
|
||||||
|
poll_fn(move |cx| self.poll_join_multicast_group(addr, cx)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Join a multicast group.
|
||||||
|
///
|
||||||
|
/// When the send queue is full, this method will return `Poll::Pending`
|
||||||
|
/// and register the current task to be notified when the queue has space available.
|
||||||
|
pub fn poll_join_multicast_group<T>(&self, addr: T, cx: &mut Context<'_>) -> Poll<Result<bool, MulticastError>>
|
||||||
where
|
where
|
||||||
T: Into<IpAddress>,
|
T: Into<IpAddress>,
|
||||||
{
|
{
|
||||||
let addr = addr.into();
|
let addr = addr.into();
|
||||||
|
|
||||||
self.with_mut(|s, i| {
|
self.with_mut(|s, i| {
|
||||||
s.iface
|
let mut smoldev = DriverAdapter {
|
||||||
.join_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now()))
|
cx: Some(cx),
|
||||||
|
inner: &mut i.device,
|
||||||
|
};
|
||||||
|
|
||||||
|
match s
|
||||||
|
.iface
|
||||||
|
.join_multicast_group(&mut smoldev, addr, instant_to_smoltcp(Instant::now()))
|
||||||
|
{
|
||||||
|
Ok(announce_sent) => Poll::Ready(Ok(announce_sent)),
|
||||||
|
Err(MulticastError::Exhausted) => Poll::Pending,
|
||||||
|
Err(other) => Poll::Ready(Err(other)),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Leave a multicast group.
|
/// Leave a multicast group.
|
||||||
pub fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
|
pub async fn leave_multicast_group<T>(&self, addr: T) -> Result<bool, MulticastError>
|
||||||
|
where
|
||||||
|
T: Into<IpAddress>,
|
||||||
|
{
|
||||||
|
let addr = addr.into();
|
||||||
|
|
||||||
|
poll_fn(move |cx| self.poll_leave_multicast_group(addr, cx)).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Leave a multicast group.
|
||||||
|
///
|
||||||
|
/// When the send queue is full, this method will return `Poll::Pending`
|
||||||
|
/// and register the current task to be notified when the queue has space available.
|
||||||
|
pub fn poll_leave_multicast_group<T>(&self, addr: T, cx: &mut Context<'_>) -> Poll<Result<bool, MulticastError>>
|
||||||
where
|
where
|
||||||
T: Into<IpAddress>,
|
T: Into<IpAddress>,
|
||||||
{
|
{
|
||||||
let addr = addr.into();
|
let addr = addr.into();
|
||||||
|
|
||||||
self.with_mut(|s, i| {
|
self.with_mut(|s, i| {
|
||||||
s.iface
|
let mut smoldev = DriverAdapter {
|
||||||
.leave_multicast_group(&mut i.device, addr, instant_to_smoltcp(Instant::now()))
|
cx: Some(cx),
|
||||||
|
inner: &mut i.device,
|
||||||
|
};
|
||||||
|
|
||||||
|
match s
|
||||||
|
.iface
|
||||||
|
.leave_multicast_group(&mut smoldev, addr, instant_to_smoltcp(Instant::now()))
|
||||||
|
{
|
||||||
|
Ok(leave_sent) => Poll::Ready(Ok(leave_sent)),
|
||||||
|
Err(MulticastError::Exhausted) => Poll::Pending,
|
||||||
|
Err(other) => Poll::Ready(Err(other)),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,11 +579,14 @@ impl<D: Driver + 'static> Inner<D> {
|
|||||||
|
|
||||||
debug!(" IP address: {}", config.address);
|
debug!(" IP address: {}", config.address);
|
||||||
s.iface.update_ip_addrs(|addrs| {
|
s.iface.update_ip_addrs(|addrs| {
|
||||||
if addrs.is_empty() {
|
if let Some((index, _)) = addrs
|
||||||
addrs.push(IpCidr::Ipv4(config.address)).unwrap();
|
.iter()
|
||||||
} else {
|
.enumerate()
|
||||||
addrs[0] = IpCidr::Ipv4(config.address);
|
.find(|(_, &addr)| matches!(addr, IpCidr::Ipv4(_)))
|
||||||
|
{
|
||||||
|
addrs.remove(index);
|
||||||
}
|
}
|
||||||
|
addrs.push(IpCidr::Ipv4(config.address)).unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
@ -570,11 +621,14 @@ impl<D: Driver + 'static> Inner<D> {
|
|||||||
|
|
||||||
debug!(" IP address: {}", config.address);
|
debug!(" IP address: {}", config.address);
|
||||||
s.iface.update_ip_addrs(|addrs| {
|
s.iface.update_ip_addrs(|addrs| {
|
||||||
if addrs.is_empty() {
|
if let Some((index, _)) = addrs
|
||||||
addrs.push(IpCidr::Ipv6(config.address)).unwrap();
|
.iter()
|
||||||
} else {
|
.enumerate()
|
||||||
addrs[0] = IpCidr::Ipv6(config.address);
|
.find(|(_, &addr)| matches!(addr, IpCidr::Ipv6(_)))
|
||||||
|
{
|
||||||
|
addrs.remove(index);
|
||||||
}
|
}
|
||||||
|
addrs.push(IpCidr::Ipv6(config.address)).unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
@ -642,13 +696,21 @@ impl<D: Driver + 'static> Inner<D> {
|
|||||||
socket.set_retry_config(config.retry_config);
|
socket.set_retry_config(config.retry_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)] // used only with dhcp
|
#[cfg(feature = "dhcpv4")]
|
||||||
fn unapply_config(&mut self, s: &mut SocketStack) {
|
fn unapply_config_v4(&mut self, s: &mut SocketStack) {
|
||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
let medium = self.device.capabilities().medium;
|
let medium = self.device.capabilities().medium;
|
||||||
|
|
||||||
debug!("Lost IP configuration");
|
debug!("Lost IP configuration");
|
||||||
s.iface.update_ip_addrs(|ip_addrs| ip_addrs.clear());
|
s.iface.update_ip_addrs(|ip_addrs| {
|
||||||
|
#[cfg(feature = "proto-ipv4")]
|
||||||
|
if let Some((index, _)) = ip_addrs
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.find(|(_, &addr)| matches!(addr, IpCidr::Ipv4(_)))
|
||||||
|
{
|
||||||
|
ip_addrs.remove(index);
|
||||||
|
}
|
||||||
|
});
|
||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
if medium == Medium::Ethernet {
|
if medium == Medium::Ethernet {
|
||||||
#[cfg(feature = "proto-ipv4")]
|
#[cfg(feature = "proto-ipv4")]
|
||||||
@ -695,7 +757,7 @@ impl<D: Driver + 'static> Inner<D> {
|
|||||||
if self.link_up {
|
if self.link_up {
|
||||||
match socket.poll() {
|
match socket.poll() {
|
||||||
None => {}
|
None => {}
|
||||||
Some(dhcpv4::Event::Deconfigured) => self.unapply_config(s),
|
Some(dhcpv4::Event::Deconfigured) => self.unapply_config_v4(s),
|
||||||
Some(dhcpv4::Event::Configured(config)) => {
|
Some(dhcpv4::Event::Configured(config)) => {
|
||||||
let config = StaticConfigV4 {
|
let config = StaticConfigV4 {
|
||||||
address: config.address,
|
address: config.address,
|
||||||
@ -707,7 +769,7 @@ impl<D: Driver + 'static> Inner<D> {
|
|||||||
}
|
}
|
||||||
} else if old_link_up {
|
} else if old_link_up {
|
||||||
socket.reset();
|
socket.reset();
|
||||||
self.unapply_config(s);
|
self.unapply_config_v4(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if old_link_up || self.link_up {
|
//if old_link_up || self.link_up {
|
||||||
|
@ -716,6 +716,9 @@ mod nightly {
|
|||||||
async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
|
async fn transaction(&mut self, address: A, operations: &mut [Operation<'_>]) -> Result<(), Self::Error> {
|
||||||
let addr: u16 = address.into();
|
let addr: u16 = address.into();
|
||||||
|
|
||||||
|
if operations.len() > 0 {
|
||||||
|
Self::setup(addr)?;
|
||||||
|
}
|
||||||
let mut iterator = operations.iter_mut();
|
let mut iterator = operations.iter_mut();
|
||||||
|
|
||||||
while let Some(op) = iterator.next() {
|
while let Some(op) = iterator.next() {
|
||||||
@ -723,11 +726,9 @@ mod nightly {
|
|||||||
|
|
||||||
match op {
|
match op {
|
||||||
Operation::Read(buffer) => {
|
Operation::Read(buffer) => {
|
||||||
Self::setup(addr)?;
|
|
||||||
self.read_async_internal(buffer, false, last).await?;
|
self.read_async_internal(buffer, false, last).await?;
|
||||||
}
|
}
|
||||||
Operation::Write(buffer) => {
|
Operation::Write(buffer) => {
|
||||||
Self::setup(addr)?;
|
|
||||||
self.write_async_internal(buffer.into_iter().cloned(), last).await?;
|
self.write_async_internal(buffer.into_iter().cloned(), last).await?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,19 +45,18 @@ use self::phy_consts::*;
|
|||||||
pub struct GenericSMI {
|
pub struct GenericSMI {
|
||||||
#[cfg(feature = "time")]
|
#[cfg(feature = "time")]
|
||||||
poll_interval: Duration,
|
poll_interval: Duration,
|
||||||
|
#[cfg(not(feature = "time"))]
|
||||||
|
_private: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenericSMI {
|
impl GenericSMI {
|
||||||
#[cfg(feature = "time")]
|
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
#[cfg(feature = "time")]
|
||||||
poll_interval: Duration::from_millis(500),
|
poll_interval: Duration::from_millis(500),
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "time"))]
|
#[cfg(not(feature = "time"))]
|
||||||
pub fn new() -> Self {
|
_private: (),
|
||||||
Self {}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +101,7 @@ unsafe impl PHY for GenericSMI {
|
|||||||
|
|
||||||
/// Public functions for the PHY
|
/// Public functions for the PHY
|
||||||
impl GenericSMI {
|
impl GenericSMI {
|
||||||
|
#[cfg(feature = "time")]
|
||||||
pub fn set_poll_interval(&mut self, poll_interval: Duration) {
|
pub fn set_poll_interval(&mut self, poll_interval: Duration) {
|
||||||
self.poll_interval = poll_interval
|
self.poll_interval = poll_interval
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user