
GRMON3-UM
June 2019, Version 3.1.0
231
www.cobham.com/gaisler
Return
Code
Value
Description
0
-
The hook was successful. GRMON continue doing the access. This can be
used to do extra configuration or fix-ups. Any return value will be ignored.
-1
-
The hook overrides GRMON and the access was successful. Any return value
will be ignored.
1
Error text
The hook overrides GRMON and the access failed. Return an error descrip-
tion.
reset
The reset hook is called after GRMON has connected to the board and when a command reset or run is
issued.
Example C.1. Using hooks
# Define hook procedures
grmon::execsh eval {
proc myhook1 {} {puts "Hello World"}
proc myhook2 {} {puts "Hello again"; return -code 1 "Blocking next hook"}
proc myhook3 {} {puts "Will never run"}
lappend ::hooks::preexec ::myhook1 ::myhook2 ::myhook3 ;# Add hooks
}
run
grmon::execsh eval {unset ::hooks::preexec ;# Remove all hooks}
proc mypcicfg {bus slot func ofs size} {
if {$size == 32} {
return -code -1 0x01234567
} elseif {$size == 16} {
return -code -1 0x89AB
} elseif {$size == 8} {
return -code -1 0xCD
}
return -code 1 "Unknown size"
}
lappend ::hooks::pcicfg ::mypcicfg ;# Add hooks
puts [format 0x%x [pci cfg16 0:1:0 0]]
4. User defined driver
It is possible to extend GRMON with user defined drivers by implementing certain hooks and variables in Tcl.
GRMON scans the namespace
::drivers
for user defined drivers. Each driver must be located in the sub-
namespace with the name of the driver. Only the variables
vendor
,
device
,
version_min
,
version_max
and
description
are required to be implemented, the other variables and procedures are optional. The script
must be loaded into the system shell.
Cores that GRMON finds while scanning the plug and play area, will be matched against the defined vendor,
device and version_min/max variables. If it matches, then the core will be paired with the driver. If a driver is
called 'mydrv', then the first found core will be named 'mydrv0', the second 'mydrv1',etc. This name will be passed
to the to all the procedures defined in the driver, and can be used to identify the core.
NOTE: The name of the driver may not end with a number.
variable
vendor
The plug and play vendor identification number.
variable
device
The plug and play device identification number.
variable
version_min
variable
version_min
Minimum and maximum version of the core that this driver supports
variable
description
A short description of the device
Содержание GRMON3
Страница 56: ...GRMON3 UM June 2019 Version 3 1 0 56 www cobham com gaisler...
Страница 114: ...GRMON3 UM June 2019 Version 3 1 0 114 www cobham com gaisler...
Страница 123: ...GRMON3 UM June 2019 Version 3 1 0 123 www cobham com gaisler dcache...
Страница 156: ...GRMON3 UM June 2019 Version 3 1 0 156 www cobham com gaisler SEE ALSO Section 6 13 On chip logic analyzer driver...
Страница 208: ...GRMON3 UM June 2019 Version 3 1 0 208 www cobham com gaisler SEE ALSO Section 3 5 Tcl integration...