ethernet: change tab

This commit is contained in:
occheung 2020-08-27 17:34:31 +08:00
parent fa117c94bb
commit a4b9f7b4f2

View File

@ -85,8 +85,7 @@ static mut DES_RING: ethernet::DesRing = ethernet::DesRing::new();
const SOCKET_COUNT: usize = 2; const SOCKET_COUNT: usize = 2;
// Give buffer sizes of transmitting and receiving TCP packets // Give buffer sizes of transmitting and receiving TCP packets
const TCP_RX_BUFFER_SIZE: usize = 2048; const BUFFER_SIZE: usize = 2048;
const TCP_TX_BUFFER_SIZE: usize = 2048;
// the program entry point // the program entry point
#[entry] #[entry]
@ -190,8 +189,8 @@ fn main() -> ! {
// TODO: Need Iinitialize TCP socket storage? // TODO: Need Iinitialize TCP socket storage?
// Yes cannot into vectors // Yes cannot into vectors
let mut rx_storage = [0; TCP_RX_BUFFER_SIZE]; let mut rx_storage = [0; BUFFER_SIZE];
let mut tx_storage = [0; TCP_TX_BUFFER_SIZE]; let mut tx_storage = [0; BUFFER_SIZE];
// Setup TCP sockets // Setup TCP sockets
let tcp1_rx_buffer = TcpSocketBuffer::new(&mut rx_storage[..]); let tcp1_rx_buffer = TcpSocketBuffer::new(&mut rx_storage[..]);
@ -199,8 +198,8 @@ fn main() -> ! {
let mut tcp1_socket = TcpSocket::new(tcp1_rx_buffer, tcp1_tx_buffer); let mut tcp1_socket = TcpSocket::new(tcp1_rx_buffer, tcp1_tx_buffer);
// Setup a silent socket // Setup a silent socket
let mut silent_rx_storage = [0; TCP_RX_BUFFER_SIZE]; let mut silent_rx_storage = [0; BUFFER_SIZE];
let mut silent_tx_storage = [0; TCP_TX_BUFFER_SIZE]; let mut silent_tx_storage = [0; BUFFER_SIZE];
let silent_rx_buffer = TcpSocketBuffer::new(&mut silent_rx_storage[..]); let silent_rx_buffer = TcpSocketBuffer::new(&mut silent_rx_storage[..]);
let silent_tx_buffer = TcpSocketBuffer::new(&mut silent_tx_storage[..]); let silent_tx_buffer = TcpSocketBuffer::new(&mut silent_tx_storage[..]);
let mut silent_socket = TcpSocket::new(silent_rx_buffer, silent_tx_buffer); let mut silent_socket = TcpSocket::new(silent_rx_buffer, silent_tx_buffer);
@ -292,7 +291,6 @@ fn main() -> ! {
if socket.can_recv() { if socket.can_recv() {
// hprintln!("About to recv").unwrap();
hprintln!("{:?}", socket.recv(|buffer| { hprintln!("{:?}", socket.recv(|buffer| {
(buffer.len(), str::from_utf8(buffer).unwrap()) (buffer.len(), str::from_utf8(buffer).unwrap())
})).unwrap(); })).unwrap();