Manual

Synthetic Target Ethernet Driver
max_show 128
}
User Interface Additions
When running in graphical mode the ethernet script extends the user interface in two ways: a button is added to
the toolbar so that users can enable or disable packet logging; and an entry is added to the Help menu for the
ethernet-specific documentation.
Command Line Arguments
The synthetic target ethernet support does not use any command line arguments. All configuration is handled
through the target definition file.
Hooks
The ethernet support defines two hooks that can be used by other scripts, especially user scripts: ethernet_tx and
ethernet_rx. The tx hook is called whenever eCos tries to transmit a packet. The rx hook is called whenever an
incoming packet is passed to the eCos application. Note that this may be a little bit after the packet was actually
received by the I/O auxiliary since it can buffer some packets. Both hooks are called with two arguments, the name
of the network device and the packet being transferred. Typical usage might look like:
proc my_tx_hook { arg_list } {
set dev [lindex $arg_list 0]
incr ::my_ethernet_tx_packets($dev)
incr ::my_ethernet_tx_bytes($dev) [string length [lindex $arg_list 1]]
}
proc my_rx_hook { arg_list } {
set dev [lindex $arg_list 0]
incr ::my_ethernet_rx_packets($dev)
incr ::my_ethernet_rx_bytes($dev) [string length [lindex $arg_list 1]]
}
synth::hook_add "ethernet_tx" my_tx_hook
synth::hook_add "ethernet_rx" my_rx_hook
The global arrays my_ethernet_tx_packets etc. will now be updated whenever there is ethernet traffic. Other
code, probably running at regular intervals by use of the Tcl after procedure, can then use this information to
update a graphical monitor of some sort.
Additional Tcl Procedures
The ethernet support provides one additional Tcl procedure that can be used by other scripts;
ethernet::devices_get_list
This procedure returns a list of the ethernet devices that have been instantiated, for example {eth0 eth1}.
704