diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2014-06-15 12:53:28 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2014-06-15 12:53:28 +0200 |
commit | 4f950e0af98bc75ec9d6aa59d85da8b1c7d1a5ae (patch) | |
tree | a1b902e9bb0ed501c014fbb9f98432d3d719fbec | |
parent | 6c106a79c63ea3168016304a1518cdf23dd3b683 (diff) | |
download | rockbox-4f950e0af98bc75ec9d6aa59d85da8b1c7d1a5ae.tar.gz rockbox-4f950e0af98bc75ec9d6aa59d85da8b1c7d1a5ae.zip |
hwstub: Add support for rk27xx lradc block
Change-Id: I8fe15ad8207ac7098944bb85d6b66b91b9858e8f
-rw-r--r-- | utils/hwstub/tools/lua/rk27xx.lua | 8 | ||||
-rw-r--r-- | utils/hwstub/tools/lua/rk27xx/lradc.lua | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/utils/hwstub/tools/lua/rk27xx.lua b/utils/hwstub/tools/lua/rk27xx.lua new file mode 100644 index 0000000000..2a5bb9287c --- /dev/null +++ b/utils/hwstub/tools/lua/rk27xx.lua | |||
@@ -0,0 +1,8 @@ | |||
1 | --- | ||
2 | --- Chip Identification | ||
3 | --- | ||
4 | |||
5 | RK27XX = {} | ||
6 | |||
7 | hwstub.soc:select("rk27xx") | ||
8 | require 'rk27xx/lcdif' | ||
diff --git a/utils/hwstub/tools/lua/rk27xx/lradc.lua b/utils/hwstub/tools/lua/rk27xx/lradc.lua new file mode 100644 index 0000000000..943bdac72e --- /dev/null +++ b/utils/hwstub/tools/lua/rk27xx/lradc.lua | |||
@@ -0,0 +1,12 @@ | |||
1 | RK27XX.adc = {} | ||
2 | |||
3 | function RK27XX.adc.init() | ||
4 | -- setup ADC clock divider to reach max 1MHz | ||
5 | HW.SCU.DIVCON1.write(bit32.replace(HW.SCU.DIVCON1.read(), 49, 10, 8)) | ||
6 | end | ||
7 | |||
8 | function RK27XX.adc.read(channel) | ||
9 | HW.ADC.CTRL.write(bit32.bor(bit32.lshift(1,4), bit32.lshift(1,3), bit32.band(channel,3))) | ||
10 | -- udelay(20) | ||
11 | return bit32.band(HW.ADC.DATA.read(), 0x3ff) | ||
12 | end | ||