Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 466 – Fall 2000 - Introduction - 1 AB 2 4 3 1 Chat Application 1 2 3 4 (no event) || (getchar(&c) && !call(c) ) / if (c) echo c, print failure message.

Similar presentations


Presentation on theme: "CSE 466 – Fall 2000 - Introduction - 1 AB 2 4 3 1 Chat Application 1 2 3 4 (no event) || (getchar(&c) && !call(c) ) / if (c) echo c, print failure message."— Presentation transcript:

1 CSE 466 – Fall 2000 - Introduction - 1 AB 2 4 3 1 Chat Application 1 2 3 4 (no event) || (getchar(&c) && !call(c) ) / if (c) echo c, print failure message (getchar(&c) && call(c)) || recv(&c) / echo c, print success message, call accept() if from network (no event) || (getchar(&c) && c!=ESC) || (recv(&c) && (c!= ESC)) / if (c) putchar(c), if from term, send(c). (getchar(&c) && c==ESC) || (recv(&c) && (c== ESC)) / call close(), print message Transport Layer Services: call(); accept(); send(); recv(); close();

2 CSE 466 – Fall 2000 - Introduction - 2 Complete the Stack User the weather? Transport Physical I2C Transport message semantics / telephone model dial tone ? I2C frames ? Describe the API that the physical layer has to provide to the transport layer. Try writing call(), accept(), send(), recv(), close() functions using that API. Find out what functions you want the physical layer to provide. Application dial tone call() accept() send()… call() accept() send()… connection management / security

3 CSE 466 – Fall 2000 - Introduction - 3 New Versions of the App void stateB() _task_ B { while(1) { if (!busy) wait(K_SIG); busy = 1; if (g=getchar(&c) || (recv(CHAT,&c)) { if (c != ESC) { putchar(c); if (g) send(CHAT,c); } else { close(CHAT); busy = 0; os_signal_task(A); } void stateA() _task_ A{ while(1) { if (!avail) wait(K_SIG); avail = 1; if ((getchar(&c) && call(CHAT, c)) || accept(CHAT,&c)) { sprint(“connected to: ”); putchar(c); avail = 0; os_signal_task(B); } AVAIL BUSY generic transport layer interface: > call(port, address)// blocking > accept(port, *address)// non-blocking > send(port, data)// blocking > recv(port, data)// non-blocking > close(port, data)// non-blocking can close if undesired caller

4 CSE 466 – Fall 2000 - Introduction - 4 My Attempt Physical Data Queues Allocated by transport layer as needed for application requests. Has Port and Dst attributes Physical Layer Stuffs incoming data into matching queue Stuffs control info into control queue Makes and sends control and data frames data frame [s, dst, src, port, data, …, data, p] control frame [s, dst, 0, src, port, cmd, p] Control queue (transport to transport communication) dst Port Transport control adr port cmd adr port cmd … data … call(), accept(), close(), send(), recv()

5 CSE 466 – Fall 2000 - Introduction - 5 The Transport Layer Protocol User Transport Physical I2C Transport dial tone ?? Application dial tone call() accept() send()… call() accept() send()… call() accept()

6 CSE 466 – Fall 2000 - Introduction - 6 A look at Call() int call(int port, int dst) { // establish a connection to specified port on dst system queue *inq, *outq; int count ; if (status[port] == BUSY) return 0; else (status[port] == BUSY); outq = outQueues[port] ; inq = inQueues[port];// static allocation of queues…could be dynamic inq->addr = outq->addr = c; inq->port = outq->port = port; enq(outCtlQ,c); enq(outCtlQ,port);// put call into control queue enq(outCtlQ,CALL); while (ack = scan(inCtlQ,c,port,ACK) && count++<=MAX); if (ack) return port; status[port] = AVAIL; return 0; }

7 CSE 466 – Fall 2000 - Introduction - 7 A look at Accept() int accept(int port, char c) { queue *inq, *outq; if (status[port] == BUSY) return 0; if (scan(inCtlQ, &c, port, CALL)) { status[port] == BUSY; outq = outQueues[port] inq = inQueues[port];// static allocation inq->src = outq->dst = c; inq->port = outq->port = port; enq(outCtlQ, c); enq(outCtlQ, port); enq(outCtlQ, ACK);// send an acknowledgement } return port; }

8 CSE 466 – Fall 2000 - Introduction - 8 The rest of the Functions int send(char port, char c) { queue *outq; if (status[port] == AVAIL) return 0; outq = outQueues[port]; enq(outq,c); //blocking } int recv(char port, char *c) { queue *inq; if (status[port] == AVAIL) { return 0; } inq = inQueues[port]; return(deq(inq, c)); //non blocking } int close(char port) { queue *outq; if (status[port] == AVAIL) return 0; outq = outQueues[port]; while(!empty(outq)); enq(outCtlQ, outQueues[port]->dst); enq(port); enq(outCtlQ, CLOSE) ; status[port] = AVAIL; return 1; } physical/datalink layer has to provide flow control guarantees security/validation I2C does not enforce indentification of the sender!

9 CSE 466 – Fall 2000 - Introduction - 9 Physical Layer API (same as Lab)  enq(), deq(), scan()  Periodically  if not currently master and there is a non-empty outgoing queue  select non-empty outgoing queue and attempt to become bus master by sending start condition  On Interrupt  if bus master and not end of frame (data queue empty, control queue new command) send next byte, otherwise send stop condition  if currently bus slave  get byte and place into appropriate queue based on frame header info  Deal w/ flow control somehow (control frames for acknowledgement)  Deal w/ Security dst port Timer Interrupt and External Interrupt Routines Function Calls

10 CSE 466 – Fall 2000 - Introduction - 10 Phew…is it just TCP?  Probably. I tried to find a TCP/I2C stack but no hits on the web. Its probably been done  What’s the embedded way?  Get an OS w/ a built in stack…you can get these  Give up on layers… write a non-layered special purpose protocol  Most companies with a product line will  develop a hardware platform  develop kernel and networking infrastructure  churn out products by writing primarily at the application layer

11 CSE 466 – Fall 2000 - Introduction - 11 A simple monolithic solution  Keep same frame specification, except all data packets are one byte  On I2C Interrupt  if master send next byte frame or stop  if slave, get next byte of frame.  If complete frame received  if NACK frame from dst set avail  if call and busy, queue up NACK frame  if data and avail ignore  if call and avail set busy, set dst, queue up ACK frame  if data and busy and wrong dst ignore  if data and busy and right dst display  On keypress  if not busy queue up CALL frame, signal initMaster  if busy, queue up data frame, signal initMaster  No flow control or error handling

12 CSE 466 – Fall 2000 - Introduction - 12 Finishing out the Term  Option 1: A final lab assignment … to be negotiated.  Some improvement on music player (I think we can do 20K music at 11 MHz anyway). Maybe Streaming from NT through one player to another player over I2C. No upload needed.  Chat  A PCB for the Music Player w/I2C and Serial ports  Option 2: A report/presentation  design approaches for some existing system  fuzzy logic controller for people movers  automotive apps and networking (ECU, Airbag, CAN)  Embedded TCP (IP?/I2C?)  Embedded web-servers  Robots  Convergence devices  hw that we didn’t cover  motors  watchdog circuits  DAC, ADC  display…vga/lcd  radios  flash  audio codec

13 CSE 466 – Fall 2000 - Introduction - 13


Download ppt "CSE 466 – Fall 2000 - Introduction - 1 AB 2 4 3 1 Chat Application 1 2 3 4 (no event) || (getchar(&c) && !call(c) ) / if (c) echo c, print failure message."

Similar presentations


Ads by Google