2013-06-13 00:02:53 +00:00
|
|
|
-- init code for hwstub_tools
|
|
|
|
|
|
|
|
--
|
|
|
|
-- INFO
|
|
|
|
--
|
|
|
|
|
2016-02-07 21:46:58 +00:00
|
|
|
function hwstub.info()
|
|
|
|
--- if not hwstub.options.quiet then
|
2013-06-13 00:02:53 +00:00
|
|
|
print("information")
|
|
|
|
print(" hwstub")
|
2014-08-05 16:18:17 +00:00
|
|
|
print(" version: " .. string.format("%d.%d", hwstub.host.version.major,
|
|
|
|
hwstub.host.version.minor))
|
2013-06-13 00:02:53 +00:00
|
|
|
print(" device")
|
|
|
|
print(" version: " .. string.format("%d.%d.%d", hwstub.dev.version.major,
|
|
|
|
hwstub.dev.version.minor, hwstub.dev.version.revision))
|
2013-07-13 15:38:34 +00:00
|
|
|
print(" target")
|
|
|
|
local id_str = string.char(bit32.extract(hwstub.dev.target.id, 0, 8),
|
|
|
|
bit32.extract(hwstub.dev.target.id, 8, 8),
|
|
|
|
bit32.extract(hwstub.dev.target.id, 16, 8),
|
|
|
|
bit32.extract(hwstub.dev.target.id, 24, 8))
|
|
|
|
print(" id: " .. string.format("%#x (%s)", hwstub.dev.target.id, id_str))
|
|
|
|
print(" name: " .. hwstub.dev.target.name)
|
2013-06-13 00:02:53 +00:00
|
|
|
print(" layout")
|
2014-02-03 23:10:41 +00:00
|
|
|
print(" code: " .. string.format("%#x bytes @ %#x",
|
|
|
|
hwstub.dev.layout.code.size, hwstub.dev.layout.code.start))
|
|
|
|
print(" stack: " .. string.format("%#x bytes @ %#x",
|
|
|
|
hwstub.dev.layout.stack.size, hwstub.dev.layout.stack.start))
|
|
|
|
print(" buffer: " .. string.format("%#x bytes @ %#x",
|
|
|
|
hwstub.dev.layout.buffer.size, hwstub.dev.layout.buffer.start))
|
2016-02-07 21:46:58 +00:00
|
|
|
if hwstub.dev.target.id == hwstub.dev.target.STMP then
|
|
|
|
print(" stmp")
|
|
|
|
print(" chipid: " .. string.format("%x", hwstub.dev.stmp.chipid))
|
|
|
|
print(" rev: " .. string.format("%d", hwstub.dev.stmp.rev))
|
|
|
|
print(" package: " .. string.format("%d", hwstub.dev.stmp.package))
|
|
|
|
elseif hwstub.dev.target.id == hwstub.dev.target.PP then
|
|
|
|
print(" pp")
|
|
|
|
print(" chipid: " .. string.format("%x", hwstub.dev.pp.chipid))
|
|
|
|
print(" rev: " .. string.format("%d", hwstub.dev.pp.rev))
|
|
|
|
elseif hwstub.dev.target.id == hwstub.dev.target.JZ then
|
|
|
|
print(" jz")
|
|
|
|
print(" chipid: " .. string.format("%x", hwstub.dev.jz.chipid))
|
|
|
|
print(" revision: " .. string.format("%c", hwstub.dev.jz.rev))
|
|
|
|
end
|
2013-06-13 00:02:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--
|
|
|
|
-- SOC
|
|
|
|
--
|
|
|
|
function hwstub.soc:select(soc)
|
|
|
|
if self[soc] == nil then return false end
|
|
|
|
print("Selecting soc " .. soc .. ". Redirecting HW to hwstub.soc." .. soc)
|
|
|
|
HW = self[soc]
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
--
|
|
|
|
-- DEV
|
|
|
|
--
|
|
|
|
DEV = hwstub.dev
|
|
|
|
|
2013-12-24 14:24:40 +00:00
|
|
|
--
|
|
|
|
-- Misc
|
|
|
|
--
|
|
|
|
function hwstub.mdelay(msec)
|
|
|
|
hwstub.udelay(msec * 1000)
|
|
|
|
end
|
|
|
|
|
2016-02-07 21:46:58 +00:00
|
|
|
require "lua/help"
|
2013-06-13 00:02:53 +00:00
|
|
|
require "lua/load"
|
2016-02-07 21:46:58 +00:00
|
|
|
|
|
|
|
function init()
|
|
|
|
LOAD.init()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- first time init
|
|
|
|
init()
|