GRMON3-UM
June 2019, Version 3.1.0
232 www.cobham.com/gaisler
variable regs (optional)
If implemented, the regs variable contains information used to parse the registers and present them to
the user, i.e. they will be printed in 'info reg' and Tcl-variables will be created in each shell. All register
descriptions must be put in the regs variable. Each register consists of a name, description and an optional
list of fields. The field entries are a quadruple on the format {name pos bits description}.
proc info devname (optional)
Optional procedure that may be used to present parsed information when 'info sys' is called. Returns a
newline separated string.
proc init {devname level} (optional)
Optional procedure that will be called during initialization. The procedure will be called nine times for each
device, with level argument set to 1-9. This way drivers that depend on another driver can be initialized in
a safe way. Normally initialization of devices is done in level 7.
proc restart devname (optional)
Procedure to reinitialize the device to a known state. This is called when GRMON starts (after initialization)
and when commands 'run' or 'reset' is issued.
proc regaddr {devname regname} (optional)
Required only if registers have been defined. It returns the address of the requested register. It's required
to be implemented if the variable regs is implemented.
NOTE: If the variable regs is implemented, then the procedure regaddr is required.
namespace eval drivers::mydrv {
# These variables are required
variable vendor 0x1
variable device 0x16
variable version_min 0
variable version_max 0
variable description "My device desciption"
# Proc init
# Args devname: Device name
# level : Which stage of initialization
# Return -
#
# Optional procedure that will be called during initialization. The procedure
# will be called with level argmuent set to 1-9, this way drivers that depend
# on another driver can be initialized in a safe way. Normally
# initialization is done in level 7.
#
# Commands wmem and mem can be used to access the registers. Use the driver procedure
# regaddr to calculate addresses or use static addresses.
proc init {devname level} {
puts "init $devname $level"
if {$level == 7} {
puts "Hello $devname!"
puts "Reg1 = mem [regaddr $devname myreg1] 4"
}
}
# Proc restart
# Args devname: Device name
# Return -
#
# Optional procedure to reinit the device. This is called when GRMON start,
# when commands 'run' or 'reset' is issued.
proc restart devname {
puts "restart $devname"
}
# Proc info
# Args devname: Device name
# Return A newline-separated string
#
# Optional procedure that may be used to present parsed information when
# 'info sys' is called.
proc info devname {
set str "Some extra information about $devname"
append str "\nSome more information about $devname"
return $str
}
# Proc regaddr
# Args devname: Device name,