Econet packet

From BeebWiki
Revision as of 19:12, 8 March 2015 by WikiSysop (talk | contribs) (1 revision)
Jump to: navigation, search

Econet Packet

An Econet packet looks like this:

 +------+------+-----+-----+---------+------+-----------------------------+
 | Dest | Dest | Src | Src | Control | Port |         Data                |
 | Stn  | Net  | Stn | Net |  Byte   |      |                             |
 +------+------+-----+-----+---------+------+-----------------------------+
  <-------- - - Packet Header - - ---------> <--- - - Packet Data - - --->

The Control Byte is sometimes refered to as the Flag Byte.

Econet Frames

The Econet system sends a packet in four frames using a four-way handshake which the 6454 ADLC puts on the wire as follows:

 Scout:
 +---------+-----------------------------+-----+-----+---------+
 |         |+----+----+---+---+----+----+|     |     |         |
 | Opening ||Dest|Dest|Src|Src|Ctrl|Port|| CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net|Byte|    ||     |     |  Flag   |
 |         |+----+----+---+---+----+----+|     |     |         |
 +---------+-----------------------------+-----+-----+---------+
             <--- - Packet Header - --->
 Scout acknowledge sent back:
 +---------+-------------------+-----+-----+---------+
 |         |+----+----+---+---+|     |     |         |
 | Opening ||Dest|Dest|Src|Src|| CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net||     |     |  Flag   |
 |         |+----+----+---+---+|     |     |         |
 +---------+-------------------+-----+-----+---------+
 Where Dest and Src are opposite to Scout frame
 Data:
 +---------+-------------------+--------+-----+-----+---------+
 |         |+----+----+---+---+|        |     |     |         |
 | Opening ||Dest|Dest|Src|Src|| Packet | CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net||  Data  |     |     |  Flag   |
 |         |+----+----+---+---+|        |     |     |         |
 +---------+-------------------+--------+-----+-----+---------+
 Data acknowledge sent back:
 +---------+-------------------+-----+-----+---------+
 |         |+----+----+---+---+|     |     |         |
 | Opening ||Dest|Dest|Src|Src|| CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net||     |     |  Flag   |
 |         |+----+----+---+---+|     |     |         |
 +---------+-------------------+-----+-----+---------+
 Where Dest and Src are opposite to Data frame

Broadcasts

Broadcasts are sent as an extended scout frame with eight bytes of data.

 Broadcast (Dest=&FFFF), 14-byte Scout frame only:
 +---------+-----------------------------+---------+-----+-----+---------+
 |         |+----+----+---+---+----+----+|         |     |     |         |
 | Opening ||Dest|Dest|Src|Src|Ctrl|Port|| 8 bytes | CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net|Byte|    || of data |     |     |  Flag   |
 |         |+----+----+---+---+----+----+|         |     |     |         |
 +---------+-----------------------------+---------+-----+-----+---------+
             <--- - Packet Header - --->

Although RISC OS Econet can transmit and receive broadcasts with more than eight bytes of data, broadcasts should be restricted to exactly eight bytes to ensure correct reception and propagation over bridges and gateways.

Immediates

Immediate operations are sent as an extended scout frame with four bytes of data.

 Immediates (Port=&00), 10-byte Scout:
 +---------+-----------------------------+---------+-----+-----+---------+
 |         |+----+----+---+---+----+----+|         |     |     |         |
 | Opening ||Dest|Dest|Src|Src|Ctrl|Port|| 4 bytes | CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net|Byte|&00 || of data |     |     |  Flag   |
 |         |+----+----+---+---+----+----+|         |     |     |         |
 +---------+-----------------------------+---------+-----+-----+---------+
             <--- - Packet Header - --->

What follows the immediate scout depends on the immediate operation, as follows:

 Flag Action
  &81 PEEK         Scout->, <-Data
  &82 POKE         Scout->, <-Ack, Data->, <-Ack
  &83 JSR          Scout->, <-Ack, Data->, <-Ack
  &84 USERPROC     Scout->, <-Ack, Data->, <-Ack
  &85 OSPROC       Scout->, <-Ack, Data->, <-Ack
  &86 HALT         Scout->, <-Ack
  &87 CONTINUE     Scout->, <-Ack
  &88 MACHINETYPE  Scout->, <-Data
  &89 GETREGISTERS Scout->, <-Data

Example NetFS packet

An Econet packet can contain anything, for instance an NetFS command, a PrintFS packet, a data load/save block, a teletext data block. This example shows a NetFS file server command transmission.

A NetFS file server command is as follows:

 +-------+----------+--------+--------+--------+----- - - - - -+
 | Reply | Function |  URD   |  CSD   |  LIB   | Parameters    |
 | Port  |   Code   | Handle | Handle | Handle |               |
 +-------+----------+--------+--------+--------+----- - - - - -+

The program API encapulates this as follows for OSWORD &14,0:

 +-----+------------+-----------------------------+
 | &00 |   Length   | +-------------------------+ |
 |     | of command | |File Server Command Block| |
 |     |    block   | +-------------------------+ |
 +-----+------------+-----------------------------+

After setting up a receive block to receive the fileserver reply, this is passed to the network transmission system to send to the file server as follows, equivalent to OSWORD &10:

 +-------+------+------+-----+-----+---------------+---------------+
 | RxNum | Ctrl | Port | FS  | FS  | Command Block | Command Block |
 |  &00  | &7F  | &99  | Stn | Net | Start Address | End Address+1 |
 +-------+------+------+-----+-----+---------------+---------------+

This gets encapsulated as an Econet packet as follows:

 +------+------+-----+-----+------+------+-----------------------------+
 | Dest | Dest | Src | Src | Ctrl | Port | +-------------------------+ |
 | Stn  | Net  | Stn | Net | &80  | &99  | |File Server Command Block| |
 | (FS) | (FS) |     |     |      |      | +-------------------------+ |
 +------+------+-----+-----+------+------+-----------------------------+
   <------ - - Packet Header - - ------>   <---- - Packet Data - ---->

This is sent as four Econet frames as follows:

 Scout:
 +---------+-----------------------------+-----+-----+---------+
 |         |+----+----+---+---+----+----+|     |     |         |
 | Opening ||Dest|Dest|Src|Src|Ctrl|Port|| CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net|&80 |&99 ||     |     |  Flag   |
 |         ||(FS)|(FS)|   |   |    |    ||     |     |         |
 |         |+----+----+---+---+----+----+|     |     |         |
 +---------+-----------------------------+-----+-----+---------+
             <--- - Packet Header - --->
 Scout acknowledge sent back:
 +---------+---------------------+-----+-----+---------+
 |         |+----+----+----+----+|     |     |         |
 | Opening ||Dest|Dest|Src |Src || CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn |Net ||     |     |  Flag   |
 |         ||    |    |(FS)|(FS)||     |     |         |
 |         |+----+----+----+----+|     |     |         |
 +---------+---------------------+-----+-----+---------+
 Where Dest and Src are opposite to Scout frame
 Data:
 +---------+-------------------+---------------+-----+-----+---------+
 |         |+----+----+---+---+|+-------------+|     |     |         |
 | Opening ||Dest|Dest|Src|Src||| File Server || CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn|Net|||Command Block||     |     |  Flag   |
 |         ||(FS)|(FS)|   |   |||             ||     |     |         |
 |         |+----+----+---+---+|+-------------+|     |     |         |
 +---------+-------------------+---------------+-----+-----+---------+
 Data acknowledge sent back:
 +---------+---------------------+-----+-----+---------+
 |         |+----+----+----+----+|     |     |         |
 | Opening ||Dest|Dest|Src |Src || CRC | CRC | Closing |
 |  Flag   ||Stn |Net |Stn |Net ||     |     |  Flag   |
 |         ||    |    |(FS)|(FS)||     |     |         |
 |         |+----+----+----+----+|     |     |         |
 +---------+---------------------+-----+-----+---------+
 Where Dest and Src are opposite to Data frame

Jgharston 22:23, 14 May 2009 (UTC)