diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2016-02-07 21:46:58 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2016-04-08 19:38:18 +0200 |
commit | f6c61eb11a13f7a5141a980f56b9a14b3309c449 (patch) | |
tree | d1c4a4d992f88e40eacb65d5e046b595fdcb512a /utils/hwstub/tools/lua/stmp.lua | |
parent | a2f4c5201d78b9f351834b0512623eeac622280f (diff) | |
download | rockbox-f6c61eb11a13f7a5141a980f56b9a14b3309c449.tar.gz rockbox-f6c61eb11a13f7a5141a980f56b9a14b3309c449.zip |
hwstub: port hwstub_shell to the new library
Also use this opportunity to cleanup support for multiple devices: the shell
now supports dynamic changes in the device and will call init() everytime
a new device is selected, to prepare a new environment. The shell now
honors register width on register read/write. The shell also provides access
to variants as follows by creating a subtable under the register using the
variant type in UPPER case and having the same layout as a register.
For example if register HW.GPIO.DIR has variants "set" and "clr", those can
be used like this:
HW.GPIO.DIR.SET.write(0xff)
HW.GPIO.DIR.CLR.write(0xff00)
Change-Id: I943947fa98bce875de0cba4338e8b7196a4c1165
Diffstat (limited to 'utils/hwstub/tools/lua/stmp.lua')
-rw-r--r-- | utils/hwstub/tools/lua/stmp.lua | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/utils/hwstub/tools/lua/stmp.lua b/utils/hwstub/tools/lua/stmp.lua index 807c18df8d..ea1cde9c6d 100644 --- a/utils/hwstub/tools/lua/stmp.lua +++ b/utils/hwstub/tools/lua/stmp.lua | |||
@@ -1,7 +1,6 @@ | |||
1 | --- | 1 | --- |
2 | --- Chip Identification | 2 | --- Chip Identification |
3 | --- | 3 | --- |
4 | |||
5 | STMP = { info = {} } | 4 | STMP = { info = {} } |
6 | 5 | ||
7 | local h = HELP:create_topic("STMP") | 6 | local h = HELP:create_topic("STMP") |
@@ -49,18 +48,6 @@ function STMP.is_stmp3600() | |||
49 | return hwstub.dev.stmp.chipid >= 0x3600 and hwstub.dev.stmp.chipid < 0x3700 | 48 | return hwstub.dev.stmp.chipid >= 0x3600 and hwstub.dev.stmp.chipid < 0x3700 |
50 | end | 49 | end |
51 | 50 | ||
52 | if STMP.is_imx233() then | ||
53 | identify("STMP3780 (aka i.MX233)", "imx233", "imx233") | ||
54 | elseif STMP.is_stmp3700() then | ||
55 | identify("STMP3700", "stmp3700", "stmp3700") | ||
56 | elseif STMP.is_stmp3770() then | ||
57 | identify("STMP3770", "stmp3770", "stmp3700") | ||
58 | elseif STMP.is_stmp3600() then | ||
59 | identify("STMP3600", "stmp3600", "stmp3600") | ||
60 | else | ||
61 | print(string.format("Unable to identify this chip as a STMP: chipid=0x%x", hwstub.dev.stmp.chipid)); | ||
62 | end | ||
63 | |||
64 | hh = h:create_topic("debug") | 51 | hh = h:create_topic("debug") |
65 | hh:add("STMP.debug(...) prints some debug output if STMP.debug_on is true and does nothing otherwise.") | 52 | hh:add("STMP.debug(...) prints some debug output if STMP.debug_on is true and does nothing otherwise.") |
66 | 53 | ||
@@ -70,11 +57,24 @@ function STMP.debug(...) | |||
70 | if STMP.debug_on then print(...) end | 57 | if STMP.debug_on then print(...) end |
71 | end | 58 | end |
72 | 59 | ||
73 | if STMP.info.chip ~= nil then | 60 | -- init |
74 | require "stmp/digctl" | 61 | function STMP.init() |
75 | require "stmp/pinctrl" | 62 | if STMP.is_imx233() then |
76 | require "stmp/lcdif" | 63 | identify("STMP3780 (aka i.MX233)", "imx233", "imx233") |
77 | require "stmp/pwm" | 64 | elseif STMP.is_stmp3700() then |
78 | require "stmp/clkctrl" | 65 | identify("STMP3700", "stmp3700", "stmp3700") |
79 | require "stmp/i2c" | 66 | elseif STMP.is_stmp3770() then |
80 | end \ No newline at end of file | 67 | identify("STMP3770", "stmp3770", "stmp3700") |
68 | elseif STMP.is_stmp3600() then | ||
69 | identify("STMP3600", "stmp3600", "stmp3600") | ||
70 | else | ||
71 | print(string.format("Unable to identify this chip as a STMP: chipid=0x%x", hwstub.dev.stmp.chipid)); | ||
72 | end | ||
73 | end | ||
74 | |||
75 | require "stmp/digctl" | ||
76 | require "stmp/pinctrl" | ||
77 | require "stmp/lcdif" | ||
78 | require "stmp/pwm" | ||
79 | require "stmp/clkctrl" | ||
80 | require "stmp/i2c" \ No newline at end of file | ||