$Id: protocol.txt,v 1.2 2009-03-02 15:22:20 potyra Exp $ # Copyright (C) 2002-2009 FAUmachine Team . # This program is free software. You can redistribute it and/or modify it # under the terms of the GNU General Public License, either version 2 of # the License, or (at your option) any later version. See COPYING. expect - node - tracer communication protocol ********************************************* structure of protocol packet: ============================= ------------------------------------------------------------- | 2 byte |1b. | variable number of bytes |'\0'| | | | | | | | ------------------------------------------------------------- size type signal name val * size (2 bytes): length of complete packet in bytes * type (1 byte): type of packet, possible types are defined in expect/expect.h EXPECT_TYPE_NONE: ??? EXPECT_TYPE_CONTINUE: just tells the tracer to let stopped CPU#-process continue. no more data. EXPECT_TYPE_EVENT: really an event, event (signal) name and value follow. * signal name (variable number of bytes with terminating 0-byte (c-string)): possible signal names and values are listed below. * val (variable number of bytes): value of the signal (depends on which signal it is) signal names ============ Unless otherwise noted signals are generate by expect/GUI and sent to tracer/component via node. ??? signal names should be defined in a single place (currently it is in 2 places, expect/simulator.c, frontend/expint.c in independent non-compatible datastructures) ??? only first part of name should be used as index into signal-table to find corresponding function, rest of name should be given to function (change expect_event(), signal-functions) * cpu cpu/// cpu/%d/%s/%d a valid CPU ID (0 for mono-processor, between 0 and (number of processors - 1) for multi-processor) a valid (Intel architecture) register name, e.g. eax, ebx, ecx, a valid bit for the chosen register Value: on/off/pulse Action: will flip in of cpu * ctrl ctrl/ ctrl/%s is one of poweron, power_supply, reset (defined in expect/simulator.c and frontend/expint.c) Value: on/off Action: will power machine on/off, turn power_supply on/off, reset machine * eth eth/// eth/%d/%s/%d valid interface number (usually 0 for one installed ethernet interface) is one of send, receive, scramble_send, scramble_receive percentage of packets affected Value: on/off Action: as long as signal is on, will not send packets, not receive packets, send scrambled packets of the time, receive scrambled packets of the time. ??? in setup/components.c eth is called ethcard ... * hd hd/// hd/%c/%d/%d character identifying available device (e.g. a if hda is present) first byte of defective range, or all (in this case, will be ignored and access to all bytes will produce errors) number of defective bytes, or all (in this case, will be all bytes following ) Value: on/off Action: as long as signal is on, will produce errors when defective bytes are accessed. ??? in setup/components.c hd is called idecdrom/idedisk ... * keyboard keyboard/key Value: a single character Action: equivalent to pressing this key on the virtual keyboard * memory memory// memory/%d/%d valid byte in memory (word aligned) valid bit in a word Value: on/off/pulse Action: will flip in memory word started by if value was pulse, will flip bit once only. if value was on, will keep bit in the state it has after flip until signal is turned off (basically a stuck at) * mouse mouse/xtics mouse/ytics Value: integer delta to current mouse position Action: equivalent to moving the virtual mouse by delta pixels * ser ser/pattern ser/match (ser -> expect/GUI) ser/send Value: pattern: abstract datatype describing pattern match: boolean value (true if a pattern was matched, false if not) send: byte to send out over serial interface Action: pattern: ser will watch for the given pattern in data sent/received match: ser will notify expect that a pattern was found. send: ser will send the given byte out over the serial interface. ??? do we want to distinguish between sending and receiving when watching for patterns? ??? can we watch for several different patterns at a time? ??? do we need to know, which pattern was matched, if we are waiting for several? ??? do we need to be able to specify a timeout? * video video/pattern video/match (gfx -> exp) Value: pattern: abstract datatype describing pattern match: boolean value (true if a pattern was matched, false if not) Action: pattern: gfx will watch for the given pattern in data displayed on screen match: gfx will notify expect that a pattern was found. ??? can we watch for several different patterns at a time? ??? do we need to know, which pattern was matched, if we are waiting for several? ??? do we need to be able to specify a timeout? communication patterns or who sends what where ============================================== -r-> read -g-> generate -s-> signal system.vhdl (system description) --r--> setup --g--> node#-directory expect.vhdl (action description) --r--> expect expect ([1]) --s--> node (expect_handle_event()) --s--> (expect_recv()) tracer node/GUI ([2]) (expect_send()) --s--> (expect_recv()) tracer [1]: expect uses the functions defined in components[] and subtables to send stuff to node [2]: GUI uses a number of different functions which all eventually call expect_send() to send stuff to tracer