f6c61eb11a
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
26 lines
768 B
Lua
26 lines
768 B
Lua
---
|
|
--- Chip Identification
|
|
---
|
|
JZ = { info = {} }
|
|
|
|
local h = HELP:create_topic("JZ")
|
|
h:add("This table contains the abstraction of the different device blocks for the JZ.")
|
|
h:add("It allows one to use higher-level primitives rather than poking at register directly.")
|
|
|
|
hh = h:create_topic("debug")
|
|
hh:add("STMP.debug(...) prints some debug output if JZ.debug_on is true and does nothing otherwise.")
|
|
|
|
JZ.debug_on = false
|
|
|
|
function STMP.debug(...)
|
|
if STMP.debug_on then print(...) end
|
|
end
|
|
|
|
-- init
|
|
function JZ.init()
|
|
local desc = string.format("jz%04x%c", hwstub.dev.jz.chipid, hwstub.dev.jz.rev)
|
|
desc = desc:lower()
|
|
if not hwstub.soc:select(desc) then
|
|
print("Looking for soc " .. desc .. ": not found. Please load a soc by hand.")
|
|
end
|
|
end
|