forked from M-Labs/humpback-dds
ethernet: change tab
This commit is contained in:
parent
fa117c94bb
commit
a4b9f7b4f2
|
@ -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);
|
||||||
|
@ -236,7 +235,7 @@ fn main() -> ! {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Counting socket (:6969)
|
// Counting socket (:6969)
|
||||||
{
|
{
|
||||||
let mut socket = sockets.get::<TcpSocket>(tcp1_handle);
|
let mut socket = sockets.get::<TcpSocket>(tcp1_handle);
|
||||||
if !socket.is_open() {
|
if !socket.is_open() {
|
||||||
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue