Skip to content

Commit b8c3dc7

Browse files
committed
Update API of recv()
1 parent f98d0e0 commit b8c3dc7

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/dma/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ impl<'rx, 'tx> EthernetDMA<'rx, 'tx> {
214214

215215
/// Receive a packet.
216216
#[cfg(feature = "async-await")]
217-
pub async fn recv(&mut self) -> RxPacket {
218-
self.rx_ring.recv().await
217+
pub async fn recv(&mut self, packet_id: Option<PacketId>) -> RxPacket {
218+
self.rx_ring.recv(packet_id).await
219219
}
220220

221221
/// Is Rx DMA currently running?

src/dma/rx/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a> RxRing<'a> {
8383

8484
/// Demand that the DMA engine polls the current `RxDescriptor`
8585
/// (when in [`RunningState::Stopped`].)
86-
pub fn demand_poll(&self) {
86+
fn demand_poll(&self) {
8787
// SAFETY: we only perform an atomic write to `dmarpdr`.
8888
let eth_dma = unsafe { &*ETHERNET_DMA::ptr() };
8989
eth_dma.dmarpdr.write(|w| unsafe { w.rpd().bits(1) });
@@ -163,9 +163,9 @@ impl<'a> RxRing<'a> {
163163
/// The returned [`RxPacket`] can be used as a slice, and
164164
/// will contain the ethernet data.
165165
#[cfg(feature = "async-await")]
166-
pub async fn recv(&mut self) -> RxPacket {
166+
pub async fn recv(&mut self, packet_id: Option<PacketId>) -> RxPacket {
167167
let (entry_num, length) = core::future::poll_fn(|ctx| {
168-
let res = self.recv_next_impl(None);
168+
let res = self.recv_next_impl(packet_id.clone());
169169

170170
match res {
171171
Ok(value) => Poll::Ready(value),

src/ptp/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ impl EthernetPTP {
252252
pub async fn wait_until(&mut self, timestamp: Timestamp) {
253253
self.configure_target_time_interrupt(timestamp);
254254
core::future::poll_fn(|ctx| {
255+
// This is the happy path, the status bits have
256+
// usually been reset at this point.
255257
if EthernetPTP::get_time().raw() >= timestamp.raw() {
256258
Poll::Ready(())
257259
} else if EthernetPTP::interrupt_handler() {

0 commit comments

Comments
 (0)