diff options
Diffstat (limited to 'utils/hwstub/tools/lua/help.lua')
-rw-r--r-- | utils/hwstub/tools/lua/help.lua | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/help.lua b/utils/hwstub/tools/lua/help.lua new file mode 100644 index 0000000000..280382eb61 --- /dev/null +++ b/utils/hwstub/tools/lua/help.lua | |||
@@ -0,0 +1,60 @@ | |||
1 | -- | ||
2 | -- HELP | ||
3 | -- | ||
4 | HELP = hwstub.help | ||
5 | |||
6 | function HELP:create_topic(name) | ||
7 | self[name] = { create_topic = HELP.create_topic, add = HELP.add, get_topic = HELP.get_topic } | ||
8 | return self[name] | ||
9 | end | ||
10 | |||
11 | function HELP:get_topic(name) | ||
12 | return self[name] | ||
13 | end | ||
14 | |||
15 | function HELP:add(text) | ||
16 | table.insert(self, text) | ||
17 | end | ||
18 | |||
19 | do | ||
20 | local h = HELP:create_topic("hwstub") | ||
21 | h:add("This tool uses a number of well-defined namespaces (tables) to organise its features.") | ||
22 | h:add("The hwstub table contains a number of information and functions related to the tool itself.") | ||
23 | h:add("Of particular interest are") | ||
24 | h:add("* hwstub.host which holds host specific information.") | ||
25 | h:add("* hwstub.dev which holds device specific information. See DEV") | ||
26 | h:add("* hwstub.help (aka HELP) which holds the help. See HELP."); | ||
27 | h:add("* hwstub.soc which holds soc specific information. See HW"); | ||
28 | |||
29 | h = HELP:create_topic("HELP"); | ||
30 | h:add("This variable redirects to hwstub.help and provides access to the help system."); | ||
31 | h:add("You can enhance the help using the following methods on any topic (including HELP itself)."); | ||
32 | h:add("* t:create_topic(s) to create a new subtopic named s under topic t"); | ||
33 | h:add("* t:add(s) to add a help line to topic t"); | ||
34 | h:add("* t:get_topic(s) to get the subtopic s under topic t"); | ||
35 | |||
36 | h = HELP:create_topic("DEV"); | ||
37 | h:add("This variable redirects to hwstub.dev and provides direct access to the device."); | ||
38 | h:add("It contains some information about the device and the following methods."); | ||
39 | h:add("* read8/16/32(a) reads a 8/16/32-bit integer at address a atomically"); | ||
40 | h:add("* write8/16/32(a, v) writes the 8/16/32-bit integer v at address a atomically"); | ||
41 | h:add("* jump(a) jump to specified address"); | ||
42 | h:add("* call(a) call function at specified address and return to hwstub"); | ||
43 | h:add("* print_log() prints the device log"); | ||
44 | |||
45 | h = HELP:create_topic("HW"); | ||
46 | h:add("This variable redirects to the current soc under hwstub.soc and should be changed by calling hwstub:soc:select only."); | ||
47 | h:add("The complete register tree can be found under HW in a well organised fashion."); | ||
48 | h:add("* HW.dev points to device dev"); | ||
49 | h:add("* HW.dev[i] points to device devi if there are several copies of the device at different addresses."); | ||
50 | h:add("* HW.dev.reg points to the register reg under dev"); | ||
51 | h:add("* HW.dev.reg[i] points to the register regi if there are several copies."); | ||
52 | h:add("* HW.dev.reg.f points to the field f under register reg."); | ||
53 | h:add("* HW.dev.reg.f.v gives the value of named value v of field f."); | ||
54 | h:add("* All registers can be read using HW.dev.reg.read() and written using HW.dev.reg.write(v)."); | ||
55 | h:add("* Register with a SCT variant also implement HW.dev.reg.set/clr/tog(v)."); | ||
56 | h:add("* All register field can be read using HW.dev.reg.f.read() and written using HW.dev.reg.f.write(v)."); | ||
57 | h:add("* Field writes can either give a integer or a named value to write(v)."); | ||
58 | h:add("* Register with a SCT variant also implement HW.dev.reg.f.set/clr/tog(v) with the same properties."); | ||
59 | h:add("* All devices, registers and fields also have descriptions available such as addresses."); | ||
60 | end | ||