From f40b15d0cbe726e72652fcd8ff775d08b19affda Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 5 Sep 2013 23:14:07 +0200 Subject: hwstub: improve lcdif, digtctl, add sony nwz-e370 Change-Id: I5316cc9fd9addfca8a674628695fed1c1bf9269f --- utils/hwstub/tools/lua/stmp/lcdif.lua | 50 ++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'utils/hwstub/tools/lua/stmp/lcdif.lua') 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 -- cgit v1.2.3