summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/tools/lua/pp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'utils/hwstub/tools/lua/pp.lua')
-rw-r--r--utils/hwstub/tools/lua/pp.lua25
1 files changed, 13 insertions, 12 deletions
diff --git a/utils/hwstub/tools/lua/pp.lua b/utils/hwstub/tools/lua/pp.lua
index f9234780e5..38a4c1d0a2 100644
--- a/utils/hwstub/tools/lua/pp.lua
+++ b/utils/hwstub/tools/lua/pp.lua
@@ -42,16 +42,6 @@ function PP.is_pp500x()
return hwstub.dev.pp.chipid >= 0x5000 and hwstub.dev.pp.chipid < 0x5010
end
-if PP.is_pp611x() then
- identify("PP611x (aka GoForce6110)", "pp6110", "pp6110")
-elseif PP.is_pp502x() then
- identify("PP502x", "pp502x", "pp502x")
-elseif PP.is_pp500x() then
- identify("PP500x", "pp500x", "pp500x")
-else
- print(string.format("Unable to identify this chip as a PP: chipid=0x%x", hwstub.dev.pp.chipid));
-end
-
hh = h:create_topic("debug")
hh:add("PP.debug(...) prints some debug output if PP.debug_on is true and does nothing otherwise.")
@@ -66,6 +56,17 @@ hh:add("PP.debug(...) prints some debug output if PP.debug_on is true and does n
PP.debug_on = false
-if PP.info.chip ~= nil then
- require "pp/gpio"
+-- init
+function PP.init()
+ if PP.is_pp611x() then
+ identify("PP611x (aka GoForce6110)", "pp6110", "pp6110")
+ elseif PP.is_pp502x() then
+ identify("PP502x", "pp502x", "pp502x")
+ elseif PP.is_pp500x() then
+ identify("PP500x", "pp500x", "pp500x")
+ else
+ print(string.format("Unable to identify this chip as a PP: chipid=0x%x", hwstub.dev.pp.chipid));
+ end
end
+
+require "pp/gpio"