forgot to push again
Some checks failed
ci / Check build (push) Has been cancelled
ci / Check formatting (push) Has been cancelled
ci / Check Documentation Build (push) Has been cancelled
ci / Clippy (push) Has been cancelled
ci / Check build (pull_request) Has been cancelled
ci / Check formatting (pull_request) Has been cancelled
ci / Check Documentation Build (pull_request) Has been cancelled
ci / Clippy (pull_request) Has been cancelled
Some checks failed
ci / Check build (push) Has been cancelled
ci / Check formatting (push) Has been cancelled
ci / Check Documentation Build (push) Has been cancelled
ci / Clippy (push) Has been cancelled
ci / Check build (pull_request) Has been cancelled
ci / Check formatting (pull_request) Has been cancelled
ci / Check Documentation Build (pull_request) Has been cancelled
ci / Clippy (pull_request) Has been cancelled
This commit is contained in:
@@ -48,6 +48,7 @@ static ETH_RX_BUFS: static_cell::ConstStaticCell<[AlignedBuffer; NUM_RX_BUFS]> =
|
||||
static ETH_TX_BUFS: static_cell::ConstStaticCell<[AlignedBuffer; NUM_TX_BUFS]> =
|
||||
static_cell::ConstStaticCell::new([AlignedBuffer([0; zynq7000_hal::eth::MTU]); NUM_TX_BUFS]);
|
||||
|
||||
/*
|
||||
static ETH_ERR_QUEUE: static_cell::ConstStaticCell<
|
||||
embassy_sync::channel::Channel<
|
||||
embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex,
|
||||
@@ -55,6 +56,14 @@ static ETH_ERR_QUEUE: static_cell::ConstStaticCell<
|
||||
8,
|
||||
>,
|
||||
> = static_cell::ConstStaticCell::new(embassy_sync::channel::Channel::new());
|
||||
*/
|
||||
|
||||
static ETH_ERR_QUEUE: embassy_sync::channel::Channel<
|
||||
embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex,
|
||||
InterruptResult,
|
||||
8,
|
||||
> = embassy_sync::channel::Channel::new();
|
||||
/*
|
||||
static ETH_ERR_SENDER: critical_section::Mutex<
|
||||
RefCell<
|
||||
Option<
|
||||
@@ -67,6 +76,7 @@ static ETH_ERR_SENDER: critical_section::Mutex<
|
||||
>,
|
||||
>,
|
||||
> = critical_section::Mutex::new(RefCell::new(None));
|
||||
*/
|
||||
|
||||
/// See memory.x file. 1 MB starting at this address will be configured as uncached memory using the
|
||||
/// MMU.
|
||||
@@ -246,13 +256,15 @@ async fn main(spawner: Spawner) -> ! {
|
||||
RESOURCES.init(embassy_net::StackResources::new()),
|
||||
rng.next_u64(),
|
||||
);
|
||||
let eth_err_queue = ETH_ERR_QUEUE.take();
|
||||
let sender = eth_err_queue.sender();
|
||||
//let eth_err_queue = ETH_ERR_QUEUE.take();
|
||||
//let mut receiver = eth_err_queue.sender();
|
||||
/*
|
||||
let receiver = eth_err_queue.receiver();
|
||||
critical_section::with(|cs| {
|
||||
let mut sender_ref = ETH_ERR_SENDER.borrow(cs).borrow_mut();
|
||||
sender_ref.replace(sender);
|
||||
});
|
||||
*/
|
||||
spawner.spawn(embassy_net_task(runner)).unwrap();
|
||||
|
||||
let mut mio_led = Output::new_for_mio(gpio_pins.mio.mio7, PinState::Low);
|
||||
@@ -271,7 +283,7 @@ async fn main(spawner: Spawner) -> ! {
|
||||
];
|
||||
let mut ip_mode = IpMode::LinkDown;
|
||||
loop {
|
||||
while let Ok(msg) = receiver.try_receive() {}
|
||||
while let Ok(msg) = ETH_ERR_QUEUE.try_receive() {}
|
||||
match ip_mode {
|
||||
// Assuming that auto-negotiation is performed automatically.
|
||||
IpMode::LinkDown => {
|
||||
@@ -341,11 +353,12 @@ pub extern "C" fn _irq_handler() {
|
||||
zynq7000_hal::eth::EthernetId::Eth0,
|
||||
);
|
||||
if result.has_anomalies() || result.has_errors() {
|
||||
critical_section::with(|cs| {
|
||||
let sender_ref = ETH_ERR_SENDER.borrow(cs).borrow_mut();
|
||||
let sender_mut = sender_ref.unwrap();
|
||||
sender_mut.try_send(result).ok();
|
||||
})
|
||||
ETH_ERR_QUEUE.try_send(result).ok();
|
||||
/*
|
||||
let sender_ref = ETH_ERR_SENDER.borrow(cs).borrow_mut();
|
||||
let sender_mut = sender_ref.unwrap();
|
||||
sender_mut.try_send(result).ok();
|
||||
*/
|
||||
}
|
||||
// TODO: Send the result structure back to the main thread.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user