path: root/utils/hwstub/tools/lua/help.lua
diff options
Diffstat (limited to 'utils/hwstub/tools/lua/help.lua')
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 @@
+-- HELP
+function HELP:create_topic(name)
+ self[name] = { create_topic = HELP.create_topic, add = HELP.add, get_topic = HELP.get_topic }
+ return self[name]
+function HELP:get_topic(name)
+ return self[name]
+function HELP:add(text)
+ table.insert(self, text)
+ local h = HELP:create_topic("hwstub")
+ h:add("This tool uses a number of well-defined namespaces (tables) to organise its features.")
+ h:add("The hwstub table contains a number of information and functions related to the tool itself.")
+ h:add("Of particular interest are")
+ h:add("* which holds host specific information.")
+ h:add("* which holds device specific information. See DEV")
+ h:add("* (aka HELP) which holds the help. See HELP.");
+ h:add("* hwstub.soc which holds soc specific information. See HW");
+ h = HELP:create_topic("HELP");
+ h:add("This variable redirects to and provides access to the help system.");
+ h:add("You can enhance the help using the following methods on any topic (including HELP itself).");
+ h:add("* t:create_topic(s) to create a new subtopic named s under topic t");
+ h:add("* t:add(s) to add a help line to topic t");
+ h:add("* t:get_topic(s) to get the subtopic s under topic t");
+ h = HELP:create_topic("DEV");
+ h:add("This variable redirects to and provides direct access to the device.");
+ h:add("It contains some information about the device and the following methods.");
+ h:add("* read8/16/32(a) reads a 8/16/32-bit integer at address a atomically");
+ h:add("* write8/16/32(a, v) writes the 8/16/32-bit integer v at address a atomically");
+ h:add("* jump(a) jump to specified address");
+ h:add("* call(a) call function at specified address and return to hwstub");
+ h:add("* print_log() prints the device log");
+ h = HELP:create_topic("HW");
+ h:add("This variable redirects to the current soc under hwstub.soc and should be changed by calling hwstub:soc:select only.");
+ h:add("The complete register tree can be found under HW in a well organised fashion.");
+ h:add("* points to device dev");
+ h:add("*[i] points to device devi if there are several copies of the device at different addresses.");
+ h:add("* points to the register reg under dev");
+ h:add("*[i] points to the register regi if there are several copies.");
+ h:add("* points to the field f under register reg.");
+ h:add("* gives the value of named value v of field f.");
+ h:add("* All registers can be read using and written using");
+ h:add("* Register with a SCT variant also implement");
+ h:add("* All register field can be read using and written using");
+ h:add("* Field writes can either give a integer or a named value to write(v).");
+ h:add("* Register with a SCT variant also implement with the same properties.");
+ h:add("* All devices, registers and fields also have descriptions available such as addresses.");