summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/tools/lua/stmp
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-09-05 23:14:07 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-09-05 23:16:27 +0200
commitf40b15d0cbe726e72652fcd8ff775d08b19affda (patch)
treec1ba87d1be4dedea86825e45c30e4ee19a9b21e3 /utils/hwstub/tools/lua/stmp
parentf13cad4c8ef0dae4393682d7da294ce63f0eb7f7 (diff)
downloadrockbox-f40b15d0cbe726e72652fcd8ff775d08b19affda.tar.gz
rockbox-f40b15d0cbe726e72652fcd8ff775d08b19affda.zip
hwstub: improve lcdif, digtctl, add sony nwz-e370
Change-Id: I5316cc9fd9addfca8a674628695fed1c1bf9269f
Diffstat (limited to 'utils/hwstub/tools/lua/stmp')
-rw-r--r--utils/hwstub/tools/lua/stmp/digctl.lua11
-rw-r--r--utils/hwstub/tools/lua/stmp/lcdif.lua50
2 files changed, 57 insertions, 4 deletions
diff --git a/utils/hwstub/tools/lua/stmp/digctl.lua b/utils/hwstub/tools/lua/stmp/digctl.lua
index 8dfc13b7f2..2ef3551c77 100644
--- a/utils/hwstub/tools/lua/stmp/digctl.lua
+++ b/utils/hwstub/tools/lua/stmp/digctl.lua
@@ -35,4 +35,15 @@ function STMP.digctl.package()
end
return pack
+end
+
+function STMP.digctl.udelay(us)
+ local tend = HW.DIGCTL.MICROSECONDS.read() + us
+ while HW.DIGCTL.MICROSECONDS.read() < tend do
+
+ end
+end
+
+function STMP.digctl.mdelay(ms)
+ STMP.digctl.udelay(ms * 1000)
end \ No newline at end of file
diff --git a/utils/hwstub/tools/lua/stmp/lcdif.lua b/utils/hwstub/tools/lua/stmp/lcdif.lua
index 0878cb1139..a2f085e166 100644
--- a/utils/hwstub/tools/lua/stmp/lcdif.lua
+++ b/utils/hwstub/tools/lua/stmp/lcdif.lua
@@ -29,6 +29,18 @@ function STMP.lcdif.set_reset(val)
end
end
+function STMP.lcdif.set_databus_width(bus_width)
+ local v = 0
+ if bus_width == 8 then
+ v = 1
+ elseif bus_width == 18 then
+ v = 2
+ elseif bus_width == 24 then
+ v = 3
+ end
+ HW.LCDIF.CTRL.LCD_DATABUS_WIDTH.write(v)
+end
+
function STMP.lcdif.set_word_length(bus_width)
if STMP.is_stmp3600() or STMP.is_stmp3700() then
if bus_width == 8 then
@@ -37,7 +49,15 @@ function STMP.lcdif.set_word_length(bus_width)
HW.LCDIF.CTRL.WORD_LENGTH.clr()
end
else
- error("STMP.lcdif.set_word_length: unimplemented")
+ local v = 0
+ if bus_width == 8 then
+ v = 1
+ elseif bus_width == 18 then
+ v = 2
+ elseif bus_width == 24 then
+ v = 3
+ end
+ HW.LCDIF.CTRL.WORD_LENGTH.write(v)
end
end
@@ -49,7 +69,11 @@ function STMP.lcdif.get_word_length()
return 16
end
else
- error("STMP.lcdif.get_word_length: unimplemented")
+ local v = HW.LCDIF.CTRL.WORD_LENGTH.read()
+ if v == 0 then return 16
+ elseif v == 1 then return 8
+ elseif v == 2 then return 18
+ else return 24 end
end
end
@@ -62,7 +86,11 @@ function STMP.lcdif.set_data_swizzle(swizzle)
error("unimplemented")
end
end
- HW.LCDIF.CTRL.DATA_SWIZZLE.write(v)
+ if STMP.is_stmp3600() or STMP.is_stmp3700() then
+ HW.LCDIF.CTRL.DATA_SWIZZLE.write(v)
+ else
+ HW.LCDIF.CTRL.INPUT_DATA_SWIZZLE.write(v)
+ end
end
function STMP.lcdif.is_busy()
@@ -73,6 +101,11 @@ function STMP.lcdif.is_busy()
end
end
+function STMP.lcdif.wait_ready()
+ while HW.LCDIF.CTRL.RUN.read() == 1 do
+ end
+end
+
function STMP.lcdif.send_pio(data_mode, data)
local wl = STMP.lcdif.get_word_length()
if data_mode then
@@ -81,8 +114,16 @@ function STMP.lcdif.send_pio(data_mode, data)
HW.LCDIF.CTRL.DATA_SELECT.clr()
end
STMP.debug(string.format("lcdif: count = %d", #data))
+ if STMP.is_imx233() then
+ HW.LCDIF.CTRL.LCDIF_MASTER.clr()
+ end
HW.LCDIF.CTRL.RUN.clr()
- HW.LCDIF.CTRL.COUNT.write(#data)
+ if STMP.is_stmp3600() or STMP.is_stmp3700() then
+ HW.LCDIF.CTRL.COUNT.write(#data)
+ else
+ HW.LCDIF.TRANSFER_COUNT.V_COUNT.write(1)
+ HW.LCDIF.TRANSFER_COUNT.H_COUNT.write(#data)
+ end
HW.LCDIF.CTRL.RUN.set()
local i = 1
while i <= #data do
@@ -97,4 +138,5 @@ function STMP.lcdif.send_pio(data_mode, data)
while STMP.lcdif.is_busy() do STMP.debug("lcdif: fifo full") end
HW.LCDIF.DATA.write(v)
end
+ STMP.lcdif.wait_ready()
end \ No newline at end of file