This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CSE 466 – Fall 2000 - Introduction - 1
COMMANDS
RESPONSES
Master/Slave Software Architecture
Mastervoid master() _task_ MAST{ Button(mode); // enq(cmd) checkDB(mode); // enq(cmd)}void comTop() _task_ COM{ wait(K_TMO, 1); if (!deq(cmd)) { cmd = pollCmd(next++); slave = next; } else slave = toWho(cmd); write(slave, cmd); read(response); signal(VERIFY);} void comBot() _task_ VERIFY{ // match up resp. and commds wait(K_SIG); verify(response); updateDB(response);}
void comTop() _task_ TOP{ read(master,cmd); write(master,response); //prev signal(DO);}// could be ISR
void comBot() _task_ DO { wait(K_SIG); response = do(cmd); // set local mode}
commands and responses are packets not single bytes
responses are forprevious command
mode is NOT a global variable
CSE 466 – Fall 2000 - Introduction - 2
Sockets are a logical constructs
Master
slave
slave
slave
socket == 2-way fifo
Socket could be implemented in shared memory, internet, or anything in between.
High level architecture can be independent of implementation choices.
CSE 466 – Fall 2000 - Introduction - 3
Physical Network
MCU1
MCU2
Device1
Device2
Bus
CSE 466 – Fall 2000 - Introduction - 4
ISO Network Layers – modularity/interop.
Physical Layer: What physically moves a bit/byte from one place to another (ethernet). Devices have a local physical address. Voltage Current Photons Radio Sonar
Data Link Layer: Guarantees delivery of “frames” over the physical layer, to the physical address. Assembles/dissembles packets from/to frames. Address (Source and Destination) Checksum Data Usually a fixed size or maximum size.
Network Layer: Primarily responsible for routing of network packets Maps packet destination address from/to local physical address Adds network layer header to packet Gives packets w/ header to data link layer, along with physical address.
CSE 466 – Fall 2000 - Introduction - 5
ISO Layers Continued Transport Layer: responsible for end-to-end protocol of user data buffer transmissions.
Source and destination addresses are private – host to host. Maps application space channel (socket) name to network address. makes network packets w/ transport header and communicates w/ network layer.
Each layer has a peer-to-peer and an intra-stack protocol
Transport -- TCP
Network -- IP
Datalink -- Ether
Physical -- Ether ethernet fiber
Datalink -- Ether
Network -- IP
fiber ethernet
Datalink -- Ether
Network -- IP
Transport -- TCP
Network -- IP
Datalink -- Ether
Physical -- Ether
write(s, buf,n); read(s, buf,n );
Application Application
CSE 466 – Fall 2000 - Introduction - 6
Transport
Network -- IP Network -- IP
Transport
Network -- IP Network -- IP
Embedded Networking: Simplest Case Simple case: socket name is the same as physical address. No mapping, we just need
to break our message into frames…maybe
Physical Layer – typically low bandwidth, serial, byte oriented
Data link layer – read/write interface to the application
frames: destination address, data, checksum. No mapping from sockets to network address No mapping from network address to physical address (no routing)