tcp_client: minor change

This commit is contained in:
occheung 2020-09-11 17:36:41 +08:00
parent 3292ccda83
commit 412308b39d
2 changed files with 27 additions and 10 deletions

View File

@ -37,6 +37,7 @@ use rtic::cyccnt::{Instant, U32Ext};
use log::info;
use log::debug;
use log::trace;
use log::warn;
use nb::block;
@ -113,7 +114,7 @@ fn main() -> ! {
let mut green_led = gpiob.pb0.into_push_pull_output();
green_led.set_low().unwrap();
gpiob.pb3.into_alternate_af0().set_speed(Speed::VeryHigh);
// gpiob.pb3.into_alternate_af0().set_speed(Speed::VeryHigh);
logger::init();
@ -148,11 +149,11 @@ fn main() -> ! {
let mut neighbor_cache_entries = [None; 8];
let mut neighbor_cache = net::iface::NeighborCache::new(&mut neighbor_cache_entries[..]);
// neighbor_cache.fill(
// net::wire::IpAddress::v4(192, 168, 1, 125),
// net::wire::EthernetAddress([0x2C, 0xF0, 0x5D, 0x26, 0xB8, 0x2F]),
// clock.elapsed(),
// );
neighbor_cache.fill(
net::wire::IpAddress::v4(192, 168, 1, 125),
net::wire::EthernetAddress([0x2C, 0xF0, 0x5D, 0x26, 0xB8, 0x2F]),
clock.elapsed(),
);
let mut net_interface = net::iface::EthernetInterfaceBuilder::new(eth_dma)
.ethernet_addr(mac_addr)
@ -231,6 +232,11 @@ fn main() -> ! {
red_led.set_high().unwrap();
let mut green = true;
// let mut eth_status = 0;
// unsafe {
// eth_status = (*pac::ETHERNET_MAC::ptr()).macdr.read().bits();
// debug!("eth_status: {:X}", eth_status);
// }
loop {
// let timestamp = net::time::Instant::from_millis(TIME.load(Ordering::Relaxed) as i64);
@ -241,6 +247,17 @@ fn main() -> ! {
}
}
// unsafe {
// // let p = &DES_RING as *const _;
// // let tdeses = core::ptr::read_volatile(p as *const [u32; 16]);
// // debug!("{:X?}", core::ptr::read_volatile(tdeses[0] as *const [u32; 20]))
// let new_eth_status = (*pac::ETHERNET_MAC::ptr()).macdr.read().bits();
// if new_eth_status != eth_status {
// eth_status = new_eth_status;
// debug!("eth_status: {:X}", eth_status);
// }
// }
{
let mut socket = sockets.get::<net::socket::TcpSocket>(handle);
@ -267,9 +284,9 @@ fn main() -> ! {
continue;
}
Some(time_delay) => {
// green_led.set_low().unwrap();
// delay.delay_ms(time_delay.total_millis() as u32);
// green_led.set_high().unwrap();
green_led.set_low().unwrap();
delay.delay_ms(time_delay.total_millis() as u32);
green_led.set_high().unwrap();
clock.advance(time_delay)
},
None => {

View File

@ -26,7 +26,7 @@ pub unsafe fn enable_itm(
*(0x5c00_4fb0 as *mut u32) = 0xC5ACCE55;
// SWO CODR Register: Set SWO speed
*(0x5c00_3010 as *mut _) = 199;
*(0x5c00_3010 as *mut _) = 200;
// SWO SPPR Register:
// 1 = Manchester