From d55680993df9b6743506814d98b5cc1859828f8a Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Thu, 27 Apr 2017 11:36:40 +0200 Subject: [PATCH] Agptek Rocker: Initial commit Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b --- apps/SOURCES | 2 + apps/bitmaps/native/SOURCES | 10 +- apps/bitmaps/native/hibyicon.70x70x16.bmp | Bin 0 -> 14978 bytes apps/bitmaps/native/rockboxicon.70x70x16.bmp | Bin 0 -> 14978 bytes apps/bitmaps/native/toolsicon.70x70x16.bmp | Bin 0 -> 14978 bytes apps/keymaps/keymap-agptekrocker.c | 254 ++++++++ apps/recorder/bmp.c | 2 +- bootloader/SOURCES | 2 + bootloader/rocker_linux.c | 546 ++++++++++++++++++ firmware/SOURCES | 51 +- firmware/asm/SOURCES | 4 +- firmware/asm/mips/thread-mips32.c | 71 +-- firmware/asm/mips/thread.h | 17 +- firmware/drivers/audio/rocker_codec.c | 77 +++ firmware/drivers/lcd-24bit.c | 3 +- firmware/export/audiohw.h | 2 + firmware/export/config.h | 5 + firmware/export/config/agptekrocker.h | 119 ++++ firmware/export/rbpaths.h | 5 +- firmware/export/rocker_codec.h | 6 + firmware/include/bitarray.h | 1 + firmware/kernel/thread.c | 3 + firmware/screendump.c | 4 +- firmware/target/hosted/agptek/adc-target.h | 0 .../target/hosted/agptek/backlight-agptek.c | 64 ++ .../target/hosted/agptek/backlight-target.h | 36 ++ firmware/target/hosted/agptek/button-agptek.c | 149 +++++ firmware/target/hosted/agptek/button-target.h | 43 ++ firmware/target/hosted/agptek/debug-agptek.c | 6 + firmware/target/hosted/agptek/lcd-agptek.c | 111 ++++ firmware/target/hosted/agptek/lcd-target.h | 26 + firmware/target/hosted/agptek/power-agptek.c | 59 ++ firmware/target/hosted/agptek/power-agptek.h | 29 + .../target/hosted/agptek/powermgmt-agptek.c | 63 ++ firmware/target/hosted/agptek/rocker.make | 48 ++ firmware/target/hosted/agptek/sysfs.c | 186 ++++++ firmware/target/hosted/agptek/sysfs.h | 31 + firmware/target/hosted/agptek/system-agptek.c | 184 ++++++ firmware/target/hosted/agptek/system-target.h | 28 + firmware/target/hosted/alsa-controls.c | 2 +- firmware/target/hosted/alsa-controls.h | 9 + firmware/target/hosted/filesystem-app.c | 3 +- firmware/target/hosted/sdl/sim-ui-defines.h | 6 + lib/rbcodec/codecs/libmad/libmad.make | 3 +- tools/configure | 47 +- tools/root.make | 6 + uisimulator/bitmaps/UI-agptekrocker.bmp | Bin 0 -> 282858 bytes uisimulator/buttonmap/SOURCES | 2 + uisimulator/buttonmap/agptek-rocker.c | 80 +++ wps/WPSLIST | 12 +- 50 files changed, 2343 insertions(+), 74 deletions(-) create mode 100644 apps/bitmaps/native/hibyicon.70x70x16.bmp create mode 100644 apps/bitmaps/native/rockboxicon.70x70x16.bmp create mode 100644 apps/bitmaps/native/toolsicon.70x70x16.bmp create mode 100644 apps/keymaps/keymap-agptekrocker.c create mode 100644 bootloader/rocker_linux.c create mode 100644 firmware/drivers/audio/rocker_codec.c create mode 100644 firmware/export/config/agptekrocker.h create mode 100644 firmware/export/rocker_codec.h create mode 100644 firmware/target/hosted/agptek/adc-target.h create mode 100644 firmware/target/hosted/agptek/backlight-agptek.c create mode 100644 firmware/target/hosted/agptek/backlight-target.h create mode 100644 firmware/target/hosted/agptek/button-agptek.c create mode 100644 firmware/target/hosted/agptek/button-target.h create mode 100644 firmware/target/hosted/agptek/debug-agptek.c create mode 100644 firmware/target/hosted/agptek/lcd-agptek.c create mode 100644 firmware/target/hosted/agptek/lcd-target.h create mode 100644 firmware/target/hosted/agptek/power-agptek.c create mode 100644 firmware/target/hosted/agptek/power-agptek.h create mode 100644 firmware/target/hosted/agptek/powermgmt-agptek.c create mode 100644 firmware/target/hosted/agptek/rocker.make create mode 100644 firmware/target/hosted/agptek/sysfs.c create mode 100644 firmware/target/hosted/agptek/sysfs.h create mode 100644 firmware/target/hosted/agptek/system-agptek.c create mode 100644 firmware/target/hosted/agptek/system-target.h create mode 100644 uisimulator/bitmaps/UI-agptekrocker.bmp create mode 100644 uisimulator/buttonmap/agptek-rocker.c diff --git a/apps/SOURCES b/apps/SOURCES index 666bf69f60..de633880f6 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -315,4 +315,6 @@ keymaps/keymap-ihifi.c keymaps/keymap-ypr1.c #elif CONFIG_KEYPAD == DX50_PAD keymaps/keymap-dx50.c +#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD +keymaps/keymap-agptekrocker.c #endif diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES index dbd0f577ed..ea726d4c07 100644 --- a/apps/bitmaps/native/SOURCES +++ b/apps/bitmaps/native/SOURCES @@ -13,7 +13,7 @@ rockboxlogo.112x30x1.bmp rockboxlogo.96x30x16.bmp #elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2) rockboxlogo.128x42x2.bmp -#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) +#elif (LCD_WIDTH == 128) && (LCD_DEPTH >= 16) rockboxlogo.128x40x16.bmp #elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16) rockboxlogo.132x40x16.bmp @@ -40,9 +40,15 @@ rockboxlogo.640x198x16.bmp #endif /* The Sony NWZ linux bootloader needs icons to display a menu */ -#if defined(BOOTLOADER) && defined(SONY_NWZ_LINUX) +#if defined(BOOTLOADER) +#if defined(SONY_NWZ_LINUX) rockboxicon.130x130x16.bmp toolsicon.130x130x16.bmp +#elif defined(AGPTEK_ROCKER) +hibyicon.70x70x16.bmp +rockboxicon.70x70x16.bmp +toolsicon.70x70x16.bmp +#endif #endif #ifndef BOOTLOADER /* We don't need these for the bootloader */ diff --git a/apps/bitmaps/native/hibyicon.70x70x16.bmp b/apps/bitmaps/native/hibyicon.70x70x16.bmp new file mode 100644 index 0000000000000000000000000000000000000000..640623421f977391ba4e7db2c20d036600bda817 GIT binary patch literal 14978 zcmeI2J!lnK6vwk$r$}LO3kx5+g#lR}o|*g3oI5jb<|R*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icon.70x70x16.bmp b/apps/bitmaps/native/rockboxicon.70x70x16.bmp new file mode 100644 index 0000000000000000000000000000000000000000..20f6709530755af6c0739f6c607bf91d0cb13051 GIT binary patch literal 14978 zcmds82Y3`mvaXpGL12?b5(otlAP^vA5kxdcGSL_V_7M$OfQ>OA(gSRA&Nd>5Y?2X4 zLJ{RvLJcVJ=4+|9w|Cv; zetzz~{roB)-n-Ynd$k*y=Hs??ESXPaXZ+*8xIKL%ZBL*L;j}T*wz}T-DR>25v?0Q_ z7nMsGp81KE{<=`*(wX=FE!YD~c z(T^$aDbJ02LNUKmLa~&plhSokrcPF>l%bOVFH4{t@3wC^nghpJJ964+684npq_0>EuqY$(tkOJ32Z0 z8I!DK#>lxkP2v+eewWsT(}%lg>Ux^CnHC(PovG6K|I+|yjsW+}{9S@(0L{|TM<*(X zY3yR^GMKs!q3*9!?@`oqBv&+ihf$7%H=RrKI*GTFyf;tc3 z+I2X!>rD+^ncjXA>8(X{_`0msNr$e`h!3f8OSw|z8kIFo>eOiI=+L}j-3B$P+1p8E zUz0p~(Cl4u_;-}8qa=t$spYR2CUxmscV_VQn^NVf+>kYV9Xyqmog$}JwB#t3(tt@} z7=$YP2ddYYheU;9FfoFS9Pd6veCJybK8`Y{;4^Sl8u1yn%4=22N zaL3xD@RJ285m(b9Q7>yRL_$nCczc49ZerOptUaHl*(KZCZ4g&OfBJ=k=IA{FEYpB9AT<_8lvPib)6__KiqLgObz6bqOXqo*yRcHMb^ zB6a0rGN!kJZHOY2EFrs^edqrWga_UzH!_E6UrUQ#^o*DQzS?N2Hul}|IbQDC;7 z+|rmJc(8b5{CR+|_slHCMzB6vmOV4x^Sobd{z{Vd5 z*sy%I-@+La)-HJe{E>iLS+RGsV$EP-{I%4G?1T_!hnm#7iv+#5oln?lf*!Kz69uN! z*zQ3~@yKn4 zzH1OXZdQO#pp-YQ)QC3*{RLB`q0{N$6*=-pyZ1K9OOLXf?9~^p%i`J70Lz$Ln0WJ2 zR9wihT9t?Us*r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HHm3m-sMniZdt0lc2nQxO#D*<^1M=cLy0T$e$Ao#R>@5tS!IP*Ef}|XFK(VY< zaEOhYjTwZpX|(ljDNH8+D^$d%x=5Ta4~Yyuq#NADB;|?Bs literal 0 HcmV?d00001 diff --git a/apps/bitmaps/native/toolsicon.70x70x16.bmp b/apps/bitmaps/native/toolsicon.70x70x16.bmp new file mode 100644 index 0000000000000000000000000000000000000000..aa0deb9ad4710370e4be671a2dc0340034a935bb GIT binary patch literal 14978 zcmds;2aFX(7{|W@j&}531dbAVF@ORBiigw)fTOTo87nX2u|)Uv$MP3_x*O-H{Z-<^_z1U6{Lmu zdk21dMt;+%MnU6EX!Jl(P?8m!0m(}aq$vMYQHyx8-w`%6xQ)%7WwX2+y zo!z)wc6RZ++}u)KN}nj&XvC7XvG<9Ji5Fh}*t!4PkC|!f=d|=0I{f#AN31X%IZM;l zP@{_@)tPnug@+Z-wB<8u-cfFxz&i5Jd9JMkf6$sYXwG(;oJ->u(&*VVcoHo+qPI$5 zTJt7VVtrYrqVt8d>0=sq54Gq->BSYBh#I!0qyK8KqD~{Bznm#uma^yR`$d$g)7A1z>UE)EEy|~i@~Zww2|)Xfr6<4A)DRoP3z+UdU=$$T zxN2C+YwMxolwLwo8@p_CIjwrlNFy+HyDs)p!dyzR@=sIsdU_LTWKz!71T+Fuxk`F5 zrqUk6Q&n3t)@gK>DnmEUB@BIz?g7!kGgP9KMv}cKMOdx6Xw;%LI?@RBv}k`ItPvsC zR{n4Lfe!ABeyCaf>8ykpPr`I&}J zi}Ru?R;PWx+L;)Z#r2X*s8E$K!MH<+PioxG4lvdL5X6HGjA3r-b;W$714neQPtje~gS*z6hj;%U7Y?SK>6fG5NwmZ4H}lTeC4f zbiS66c%WpZkIQ<^DDT}kAP9G6Vpx~}N|tugSuCA0TTq`HX#elBPKd%}gWjG@!U6=5 z7VV_vhlzb(h{3?op^vLUZM(}@aC^H9aD82R4qp^Y-P=|W#&Twl`qw`bmx0;4b|Xop z<`N6eo!`dv!->J#%Q2y{5d^tqF=4QuyOUPG?&Pf`!34Nn-;s6|Cz?FI^%^DK zwB<28Z}=egF8`JZGs!VQ{L??!YO8hEm`e?(xnH&oLc9lGU)vEA0^xzAnIHobm?Fj1=MY-Hy2$R-45FF-fY2>TbPC$09I0 zzVV`^Jb8`K=e9+{T1=V=YZ}we9ygq2Fl@7h6tJ)a<_Rv5-yJ49R&q?UH#>QzFds2i zaoCn?D>`r4jdi>mlnGzlaqZv%RoA#aJHGa!;5>y`TW(C-zVQ44bO>-DK8<*f_7Da) zP|P4!g@uOp6Q>Bv%Cz?vFPb5G*rKs6`HXUM@J)hKu^xU_{{f^IEth5{Z22S^A%#cB zygQ42+>(Y2jD#+4S!C*%;12X2?NST2XAts1^wy$TyoK6A^pPi=yIJ;}>${>HmRFeI zgLS@!OAnYqn10p;orol>8>yT!Tvt@W z;#v?GPz@7HqD(leIdWEH-&(w{=5JcSrOTNR<5^5EPPEo)AZtOtu+Mx^Ce?OR2}WGg zF;%hunO^r>K6Z}Ggln`FwrtT#^Unk^=x}Pn=L>w6Kx-N+#EMayuq$VJD-e@*m4TB^ zCMC&~BMxc`M~gdKqKZIFBfWnxkrO;BQE-TPOfm>|stGeP&VQ(i{4=3}Y0m`vb?{VM zEG6qtP~&zgmA8^p|3|?O6XquvUiBi4>@pRCZ|hl5#9MH#N6aJ~K$FtAd*!NfW?Jzg zHR~XWi(O(HS=67pJXVb8xMISIC}|9IV8X&3JLRfx%LSt;TBhmH`EZJWFYhp`z`2lA zSebBweN2wNe=;D5gg*r5SCU!?mv?U?Y{RKQP;F*f_qOf7Qb2QQZ^DtTLNMQ?!n84O zX2SS}4 ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "action.h" +#include "button.h" +#include "settings.h" + +/* {Action Code, Button code, Prereq button code } */ + +/* + * The format of the list is as follows + * { Action Code, Button code, Prereq button code } + * if there's no need to check the previous button's value, use BUTTON_NONE + * Insert LAST_ITEM_IN_LIST at the end of each mapping + */ +static const struct button_mapping button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, + + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, + + { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + { ACTION_STD_MENU, BUTTON_POWER, BUTTON_NONE }, + +// ACTION_STD_QUICKSCREEN, +// ACTION_STD_KEYLOCK +// ACTION_STD_REC +// ACTION_STD_HOTKEY + +// { ACTION_STD_QUICKSCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST +}; /* button_context_standard */ + + +static const struct button_mapping button_context_wps[] = { +// { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, + { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOLUP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, +// ACTION_WPS_PITCHSCREEN optional +// ACTION_WPS_ID3SCREEN optional + { ACTION_WPS_CONTEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, + { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, // optional + { ACTION_WPS_MENU, BUTTON_UP|BUTTON_REL, BUTTON_UP }, /*this should be the same as ACTION_STD_MENU */ +// ACTION_WPS_VIEW_PLAYLIST +// ACTION_WPS_LIST_BOOKMARKS,/* optional */ +// ACTION_WPS_CREATE_BOOKMARK,/* optional */ + + { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_wps */ + +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, +// ACTION_SETTINGS_INCBIGSTEP + { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, +// ACTION_SETTINGS_DECBIGSTEP + { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, +// ACTION_SETTINGS_SET, /* Used by touchscreen targets */ + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), +}; /* button_context_settings */ + +static const struct button_mapping button_context_list[] = { +// ACTION_LISTTREE_PGUP,/* optional */ +// ACTION_LISTTREE_PGDOWN,/* optional */ + +#ifdef HAVE_VOLUME_IN_LIST + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, +#endif + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + +static const struct button_mapping button_context_tree[] = { +// ACTION_TREE_ROOT_INIT, +// ACTION_TREE_PGLEFT,/* optional */ +// ACTION_TREE_PGRIGHT,/* optional */ +// ACTION_TREE_STOP, +// ACTION_TREE_WPS, +// ACTION_TREE_HOTKEY, + + { ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP }, +// { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, +// { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), +}; /* button_context_tree */ + +static const struct button_mapping button_context_yesno[] = { + { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), +}; /* button_context_settings_yesno */ + +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), +}; /* button_context_quickscreen */ + +static const struct button_mapping button_context_settings_time[] = { + { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) +}; /* button_context_settings_time */ + +static const struct button_mapping button_context_pitchscreen[] = { + { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, +// { ACTION_PS_TOGGLE_MODE, BUTTON_REC, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE }, + { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), +}; /* button_context_pitchscreen */ + +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_UP, BUTTON_VOLDOWN, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_VOLUP, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_PAGE_FLIP, BUTTON_POWER|BUTTON_SELECT, BUTTON_POWER }, + { ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE }, + { ACTION_KBD_MORSE_INPUT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_LEFT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), +}; /* button_context_bmark */ + +/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ +const struct button_mapping* get_context_mapping(int context) +{ + switch (context) + { + case CONTEXT_STD: + return button_context_standard; + + case CONTEXT_WPS: + return button_context_wps; + + case CONTEXT_LIST: + return button_context_list; + + case CONTEXT_CUSTOM|CONTEXT_TREE: + return button_context_tree; + + case CONTEXT_SETTINGS: + case CONTEXT_SETTINGS_EQ: + return button_context_settings; + + case CONTEXT_SETTINGS_TIME: + return button_context_settings_time; + + case CONTEXT_YESNOSCREEN: + return button_context_yesno; + + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + + case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: + return button_context_keyboard; + + default: + return button_context_standard; + } + return button_context_standard; +} diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index 8d49fd7582..b11c41b424 100644 --- a/apps/recorder/bmp.c +++ b/apps/recorder/bmp.c @@ -670,7 +670,7 @@ int read_bmp_fd(int fd, /* Check if this fits the buffer */ if (totalsize > maxsize) { DEBUGF("read_bmp_fd: Bitmap too large for buffer: " - "%d bytes.\n", totalsize); + "%d bytes (%d max).\n", totalsize, maxsize); return -6; } diff --git a/bootloader/SOURCES b/bootloader/SOURCES index 88b8aa03d2..359e2ba700 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES @@ -73,6 +73,8 @@ show_logo.c mpio_hd200_hd300.c #elif defined(SONY_NWZ_LINUX) nwz_linux.c +#elif defined(AGPTEK_ROCKER) +rocker_linux.c #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \ || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \ || defined(IHIFI760) || defined(IHIFI960) diff --git a/bootloader/rocker_linux.c b/bootloader/rocker_linux.c new file mode 100644 index 0000000000..dd912ee378 --- /dev/null +++ b/bootloader/rocker_linux.c @@ -0,0 +1,546 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * + * Copyright (C) 2016 by Amaury Pouly + * 2018 by Marcin Bukat + * + * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing + * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "system.h" +#include "lcd.h" +#include "backlight.h" +#include "button-target.h" +#include "button.h" +#include "../kernel/kernel-internal.h" +#include "core_alloc.h" +#include "filesystem-app.h" +#include "lcd.h" +#include "font.h" +#include "power.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "version.h" + +/* all images must have the following size */ +#define ICON_WIDTH 70 +#define ICON_HEIGHT 70 + +/* images */ +#include "bitmaps/rockboxicon.h" +#include "bitmaps/hibyicon.h" +#include "bitmaps/toolsicon.h" + +/* don't issue an error when parsing the file for dependencies */ +#if defined(BMPWIDTH_rockboxicon) && (BMPWIDTH_rockboxicon != ICON_WIDTH || \ + BMPHEIGHT_rockboxicon != ICON_HEIGHT) +#error rockboxicon has the wrong resolution +#endif +#if defined(BMPWIDTH_hibyicon) && (BMPWIDTH_hibyicon != ICON_WIDTH || \ + BMPHEIGHT_hibyicon != ICON_HEIGHT) +#error hibyicon has the wrong resolution +#endif +#if defined(BMPWIDTH_toolsicon) && (BMPWIDTH_toolsicon != ICON_WIDTH || \ + BMPHEIGHT_toolsicon != ICON_HEIGHT) +#error toolsicon has the wrong resolution +#endif + +#ifndef BUTTON_REW +#define BUTTON_REW BUTTON_LEFT +#endif +#ifndef BUTTON_FF +#define BUTTON_FF BUTTON_RIGHT +#endif +#ifndef BUTTON_PLAY +#define BUTTON_PLAY BUTTON_SELECT +#endif + +/* return icon y position (x is always centered) */ +static int get_icon_y(void) +{ + int h; + lcd_getstringsize("X", NULL, &h); + return ((LCD_HEIGHT - ICON_HEIGHT)/2) - h; +} + +/* Important Note: this bootloader is carefully written so that in case of + * error, the OF is run. This seems like the safest option since the OF is + * always there and might do magic things. */ + +enum boot_mode +{ + BOOT_ROCKBOX, + BOOT_TOOLS, + BOOT_OF, + BOOT_COUNT, + BOOT_USB, /* special */ + BOOT_STOP, /* power down/suspend */ +}; + +static void display_text_center(int y, const char *text) +{ + int width; + lcd_getstringsize(text, &width, NULL); + lcd_putsxy(LCD_WIDTH / 2 - width / 2, y, text); +} + +static void display_text_centerf(int y, const char *format, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, format); + + vsnprintf(buf, sizeof(buf), format, ap); + display_text_center(y, buf); +} + +/* get timeout before taking action if the user doesn't touch the device */ +static int get_inactivity_tmo(void) +{ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + return 5 * HZ; /* Inactivity timeout when on hold */ + else +#endif + return 10 * HZ; /* Inactivity timeout when not on hold */ +} + +/* return action on idle timeout */ +static enum boot_mode inactivity_action(enum boot_mode cur_selection) +{ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + return BOOT_STOP; /* power down/suspend */ + else +#endif + return cur_selection; /* return last choice */ +} + +/* we store the boot mode in a file in /tmp so we can reload it between 'boots' + * (since the mostly suspends instead of powering down) */ +static enum boot_mode load_boot_mode(enum boot_mode mode) +{ + int fd = open("/data/rb_bl_mode.txt", O_RDONLY); + if(fd >= 0) + { + read(fd, &mode, sizeof(mode)); + close(fd); + } + return mode; +} + +static void save_boot_mode(enum boot_mode mode) +{ + int fd = open("/data/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC); + if(fd >= 0) + { + write(fd, &mode, sizeof(mode)); + close(fd); + } +} + +static enum boot_mode get_boot_mode(void) +{ + /* load previous mode, or start with rockbox if none */ + enum boot_mode init_mode = load_boot_mode(BOOT_ROCKBOX); + /* wait for user action */ + enum boot_mode mode = init_mode; + int last_activity = current_tick; +#if defined(HAS_BUTTON_HOLD) + bool hold_status = button_hold(); +#endif + while(true) + { + /* on usb detect, return to usb + * FIXME this is a hack, we need proper usb detection */ + if(power_input_status() & POWER_INPUT_USB_CHARGER) + { + /* save last choice */ + save_boot_mode(mode); + return BOOT_USB; + } + /* inactivity detection */ + int timeout = last_activity + get_inactivity_tmo(); + if(TIME_AFTER(current_tick, timeout)) + { + /* save last choice */ + save_boot_mode(mode); + return inactivity_action(mode); + } + /* redraw */ + lcd_clear_display(); + /* display top text */ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + display_text_center(0, "ON HOLD!"); + } + else +#endif + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + display_text_center(0, "SELECT PLAYER"); + } + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + /* display icon */ + const struct bitmap *icon = (mode == BOOT_OF) ? &bm_hibyicon : + (mode == BOOT_ROCKBOX) ? &bm_rockboxicon : &bm_toolsicon; + lcd_bmp(icon, (LCD_WIDTH - ICON_WIDTH) / 2, get_icon_y()); + /* display bottom description */ + const char *desc = (mode == BOOT_OF) ? "HIBY PLAYER" : + (mode == BOOT_ROCKBOX) ? "ROCKBOX" : "TOOLS"; + + int desc_height; + lcd_getstringsize(desc, NULL, &desc_height); + display_text_center(LCD_HEIGHT - 3*desc_height, desc); + + /* display arrows */ + int arrow_width, arrow_height; + lcd_getstringsize("<", &arrow_width, &arrow_height); + int arrow_y = get_icon_y() + ICON_HEIGHT / 2 - arrow_height / 2; + lcd_putsxy(arrow_width / 2, arrow_y, "<"); + lcd_putsxy(LCD_WIDTH - 3 * arrow_width / 2, arrow_y, ">"); + + lcd_set_foreground(LCD_RGBPACK(0, 255, 0)); + display_text_centerf(LCD_HEIGHT - arrow_height * 3 / 2, "timeout in %d sec", + (timeout - current_tick + HZ - 1) / HZ); + + lcd_update(); + + /* wait for a key */ + int btn = button_get_w_tmo(HZ / 10); + +#if defined(HAS_BUTTON_HOLD) + /* record action, changing HOLD counts as action */ + if(btn & BUTTON_MAIN || hold_status != button_hold()) + last_activity = current_tick; + + hold_status = button_hold(); +#else + if(btn & BUTTON_MAIN) + last_activity = current_tick; +#endif + /* ignore release, allow repeat */ + if(btn & BUTTON_REL) + continue; + if(btn & BUTTON_REPEAT) + btn &= ~BUTTON_REPEAT; + /* play -> stop loop and return mode */ + if(btn == BUTTON_PLAY) + break; + /* left/right/up/down: change mode */ + if(btn == BUTTON_LEFT || btn == BUTTON_DOWN || btn == BUTTON_REW) + mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT; + if(btn == BUTTON_RIGHT || btn == BUTTON_UP || btn == BUTTON_FF) + mode = (mode + 1) % BOOT_COUNT; + } + + /* save mode */ + save_boot_mode(mode); + return mode; +} + +void error_screen(const char *msg) +{ + lcd_clear_display(); + lcd_putsf(0, 0, msg); + lcd_update(); +} + +int choice_screen(const char *title, bool center, int nr_choices, const char *choices[]) +{ + int choice = 0; + int max_len = 0; + int h; + lcd_getstringsize("x", NULL, &h); + for(int i = 0; i < nr_choices; i++) + { + int len = strlen(choices[i]); + if(len > max_len) + max_len = len; + } + char *buf = malloc(max_len + 10); + int top_y = 2 * h; + int nr_lines = (LCD_HEIGHT - top_y) / h; + while(true) + { + /* make sure choice is visible */ + int offset = choice - nr_lines / 2; + if(offset < 0) + offset = 0; + lcd_clear_display(); + /* display top text */ + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + display_text_center(0, title); + int line = 0; + for(int i = 0; i < nr_choices && line < nr_lines; i++) + { + if(i < offset) + continue; + if(i == choice) + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + else + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + sprintf(buf, "%s", choices[i]); + if(center) + display_text_center(top_y + h * line, buf); + else + lcd_putsxy(0, top_y + h * line, buf); + line++; + } + + lcd_update(); + + /* wait for a key */ + int btn = button_get_w_tmo(HZ / 10); + /* ignore release, allow repeat */ + if(btn & BUTTON_REL) + continue; + if(btn & BUTTON_REPEAT) + btn &= ~BUTTON_REPEAT; + /* play -> stop loop and return mode */ + if(btn == BUTTON_PLAY || btn == BUTTON_LEFT) + { + free(buf); + return btn == BUTTON_PLAY ? choice : -1; + } + /* left/right/up/down: change mode */ + if(btn == BUTTON_UP) + choice = (choice + nr_choices - 1) % nr_choices; + if(btn == BUTTON_DOWN) + choice = (choice + 1) % nr_choices; + } +} + +void run_file(const char *name) +{ + char *dirname = "/mnt/sd_0/"; + char *buf = malloc(strlen(dirname) + strlen(name) + 1); + sprintf(buf, "%s%s", dirname, name); + + lcd_clear_display(); + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 0, "Running %s", name); + lcd_update(); + + pid_t pid = fork(); + if(pid == 0) + { + execlp("sh", "sh", buf, NULL); + _exit(42); + } + int status; + waitpid(pid, &status, 0); + if(WIFEXITED(status)) + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); + } + else + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 1, "an error occured: %x", status); + } + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 3, "Press any key or wait"); + lcd_update(); + /* wait a small time */ + sleep(HZ); + /* ignore event */ + while(button_get(false) != 0) {} + /* wait for any key or timeout */ + button_get_w_tmo(4 * HZ); +} + +void run_script_menu(void) +{ + const char **entries = NULL; + int nr_entries = 0; + DIR *dir = opendir("/mnt/sd_0"); + struct dirent *ent; + while((ent = readdir(dir))) + { + if(ent->d_type != DT_REG) + continue; + entries = realloc(entries, (nr_entries + 1) * sizeof(const char *)); + entries[nr_entries++] = strdup(ent->d_name); + } + closedir(dir); + int idx = choice_screen("RUN SCRIPT", false, nr_entries, entries); + if(idx >= 0) + run_file(entries[idx]); + for(int i = 0; i < nr_entries; i++) + free((char *)entries[i]); + free(entries); +} + +static void adb(int start) +{ + pid_t pid = fork(); + if(pid == 0) + { + execlp("/etc/init.d/K90adb", "K90adb", start ? "start" : "stop", NULL); + _exit(42); + } + int status; + waitpid(pid, &status, 0); +#if 0 + if(WIFEXITED(status)) + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); + } + else + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 1, "an error occured: %x", status); + } +#endif +} + +static void tools_screen(void) +{ + const char *choices[] = {"ADB start", "ADB stop", "Run script", "Restart", "Shutdown"}; + int choice = choice_screen("TOOLS MENU", true, 5, choices); + if(choice == 0) + { + /* run service menu */ + printf("Starting ADB service...\n"); + fflush(stdout); + adb(1); + } + else if(choice == 1) + { + printf("Stopping ADB service...\n"); + fflush(stdout); + adb(0); + } + else if(choice == 2) + { + run_script_menu(); + } +// else if(choice == 2) +// nwz_power_restart(); + else if(choice == 4) + power_off(); +} + +/* open log file */ +static int open_log(void) +{ + /* open regular log file */ + int fd = open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND); + /* get its size */ + struct stat stat; + if(fstat(fd, &stat) != 0) + return fd; /* on error, don't do anything */ + /* if file is too large, rename it and start a new log file */ + if(stat.st_size < 1000000) + return fd; + close(fd); + /* move file */ + rename("/mnt/sd_0/rockbox.log", "/mnt_sd0/rockbox.log.1"); + /* re-open the file, truncate in case the move was unsuccessful */ + return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC); +} + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; + /* redirect stdout and stderr to have error messages logged somewhere on the + * user partition */ + int fd = open_log(); + if(fd >= 0) + { + dup2(fd, fileno(stdout)); + dup2(fd, fileno(stderr)); + close(fd); + } + /* print version */ + printf("Rockbox boot loader\n"); + printf("Version: %s\n", rbversion); + printf("%s\n", MODEL_NAME); + + system_init(); + core_allocator_init(); + kernel_init(); + paths_init(); + lcd_init(); + font_init(); + button_init(); + backlight_init(); + backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); +// /* try to load the extra font we install on the device */ +// int font_id = font_load("/usr/local/share/rockbox/bootloader.fnt"); +// if(font_id >= 0) +// lcd_setfont(font_id); + + /* run all tools menu */ + while(true) + { + enum boot_mode mode = get_boot_mode(); + if(mode == BOOT_USB || mode == BOOT_OF) + { + fflush(stdout); + fflush(stderr); + close(fileno(stdout)); + close(fileno(stderr)); + /* for now the only way we have to trigger USB mode it to run the OF */ + /* boot OF */ + execvp("/usr/bin/hiby_player", argv); + error_screen("Cannot boot OF"); + sleep(5 * HZ); + } + else if(mode == BOOT_TOOLS) + { + tools_screen(); + } + else if(mode == BOOT_ROCKBOX) + { + /* Rockbox expects /.rockbox to contain themes, rocks, etc, but we + * cannot easily create this symlink because the root filesystem is + * mounted read-only. Although we could remount it read-write temporarily, + * this is neededlessly complicated and we defer this job to the dualboot + * install script */ + fflush(stdout); + execl("/mnt/sd_0/.rockbox/rockbox.rocker", "rockbox.rocker", NULL); + printf("execvp failed: %s\n", strerror(errno)); + /* fallback to OF in case of failure */ + error_screen("Cannot boot Rockbox"); + sleep(5 * HZ); + } + else + { + printf("suspend\n"); +// nwz_power_suspend(); + } + } + /* if we reach this point, everything failed, so return an error so that + * sysmgrd knows something is wrong */ + return 1; +} diff --git a/firmware/SOURCES b/firmware/SOURCES index 1310fa0434..96d5d3dcec 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -96,10 +96,6 @@ target/hosted/samsungypr/radio-ypr.c #endif #if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR) -target/hosted/backtrace-glibc.c -target/hosted/kernel-unix.c -target/hosted/filesystem-unix.c -target/hosted/lc-unix.c target/hosted/sonynwz/lcd-nwz.c target/hosted/sonynwz/button-nwz.c target/hosted/sonynwz/system-nwz.c @@ -113,6 +109,23 @@ target/hosted/sonynwz/nvp-nwz.c target/hosted/sonynwz/nwz-db.c #endif +#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) +target/hosted/backtrace-glibc.c +target/hosted/kernel-unix.c +target/hosted/filesystem-unix.c +target/hosted/lc-unix.c +target/hosted/alsa-controls.c +target/hosted/pcm-alsa.c +target/hosted/agptek/sysfs.c +target/hosted/agptek/backlight-agptek.c +target/hosted/agptek/button-agptek.c +target/hosted/agptek/debug-agptek.c +target/hosted/agptek/lcd-agptek.c +target/hosted/agptek/power-agptek.c +target/hosted/agptek/powermgmt-agptek.c +target/hosted/agptek/system-agptek.c +#endif + #if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) drivers/adc-as3514.c #if (CONFIG_RTC == RTC_AS3514) @@ -250,7 +263,7 @@ drivers/lcd-16bit-vert.c #else drivers/lcd-16bit.c #endif -#elif LCD_DEPTH == 24 +#elif (LCD_DEPTH == 24) || (LCD_PIXELFORMAT == XRGB8888) drivers/lcd-24bit.c #endif /* LCD_DEPTH */ common/diacritic.c @@ -470,6 +483,8 @@ target/hosted/pcm-alsa.c drivers/audio/nwzlinux-codec.c target/hosted/alsa-controls.c target/hosted/pcm-alsa.c +#elif defined(HAVE_ROCKER_CODEC) +drivers/audio/rocker_codec.c #elif defined(HAVE_SDL_AUDIO) drivers/audio/sdl.c #if CONFIG_CODEC == SWCODEC @@ -1618,10 +1633,10 @@ target/arm/s5l8700/ipodnano2g/piezo-nano2g.c #ifdef IPOD_6G target/arm/ipod/button-clickwheel.c -target/arm/s5l8702/ipod6g/storage_ata-6g.c -target/arm/s5l8702/ipod6g/backlight-6g.c -target/arm/s5l8702/ipod6g/powermgmt-6g.c -target/arm/s5l8702/ipod6g/power-6g.c +target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c +target/arm/s5l8702/ipod6g/backlight-ipod6g.c +target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c +target/arm/s5l8702/ipod6g/power-ipod6g.c target/arm/s5l8702/kernel-s5l8702.c target/arm/s5l8702/system-s5l8702.c target/arm/s5l8702/timer-s5l8702.c @@ -1629,28 +1644,28 @@ target/arm/s5l8702/gpio-s5l8702.c target/arm/s5l8702/pl080.c target/arm/s5l8702/dma-s5l8702.c target/arm/s5l8702/clocking-s5l8702.c -target/arm/s5l8702/ipod6g/lcd-6g.c -target/arm/s5l8702/ipod6g/lcd-asm-6g.S -target/arm/s5l8702/ipod6g/piezo-6g.c +target/arm/s5l8702/ipod6g/lcd-ipod6g.c +target/arm/s5l8702/ipod6g/lcd-asm-ipod6g.S +target/arm/s5l8702/ipod6g/piezo-ipod6g.c #if 0 //TODO target/arm/s5l8702/postmortemstub.S #endif -target/arm/s5l8702/ipod6g/pmu-6g.c -target/arm/s5l8702/ipod6g/rtc-6g.c -target/arm/s5l8702/ipod6g/adc-6g.c +target/arm/s5l8702/ipod6g/pmu-ipod6g.c +target/arm/s5l8702/ipod6g/rtc-ipod6g.c +target/arm/s5l8702/ipod6g/adc-ipod6g.c #if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) target/arm/s5l8702/usb-s5l8702.c #endif #ifdef HAVE_SERIAL target/arm/uc870x.c target/arm/s5l8702/uart-s5l8702.c -target/arm/s5l8702/ipod6g/serial-6g.c +target/arm/s5l8702/ipod6g/serial-ipod6g.c #endif #ifndef BOOTLOADER target/arm/s5l8702/debug-s5l8702.c target/arm/s5l8702/pcm-s5l8702.c -target/arm/s5l8702/ipod6g/audio-6g.c -target/arm/s5l8702/ipod6g/cscodec-6g.c +target/arm/s5l8702/ipod6g/audio-ipod6g.c +target/arm/s5l8702/ipod6g/cscodec-ipod6g.c #else target/arm/s5l8702/spi-s5l8702.c target/arm/s5l8702/crypto-s5l8702.c diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES index 5a1310ed65..eba5bd2cb6 100644 --- a/firmware/asm/SOURCES +++ b/firmware/asm/SOURCES @@ -15,9 +15,9 @@ mempcpy.c defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ - defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX)) && \ + defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \ !defined(SIMULATOR) -#if LCD_DEPTH == 24 +#if LCD_DEPTH >= 24 lcd-as-memframe-24bit.c #else lcd-as-memframe.c diff --git a/firmware/asm/mips/thread-mips32.c b/firmware/asm/mips/thread-mips32.c index e754df7e29..19efb6eea9 100644 --- a/firmware/asm/mips/thread-mips32.c +++ b/firmware/asm/mips/thread-mips32.c @@ -26,24 +26,23 @@ *--------------------------------------------------------------------------- */ -void start_thread(void); /* Provide C access to ASM label */ -static void USED_ATTR _start_thread(void) +static void USED_ATTR start_thread(void *addr) { - /* t1 = context */ asm volatile ( - "start_thread: \n" ".set noreorder \n" ".set noat \n" - "lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */ - "lw $29, 36($9) \n" /* Set initial sp(=$29) */ - "jalr $8 \n" /* Start the thread */ - "sw $0, 44($9) \n" /* Clear start address */ + "lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */ + "lw $sp, 40(%0) \n" /* Set initial sp(=$29) */ + "jalr $t9 \n" /* Start the thread */ + "sw $zero, 48(%0) \n" /* Clear start address */ ".set at \n" ".set reorder \n" + : : "r" (addr) : "t9" ); thread_exit(); } + /* Place context pointer in s0 slot, function pointer in s1 slot, and * start_thread pointer in context_start */ #define THREAD_STARTUP_INIT(core, thread, function) \ @@ -60,17 +59,18 @@ static inline void store_context(void* addr) asm volatile ( ".set noreorder \n" ".set noat \n" - "sw $16, 0(%0) \n" /* s0 */ - "sw $17, 4(%0) \n" /* s1 */ - "sw $18, 8(%0) \n" /* s2 */ - "sw $19, 12(%0) \n" /* s3 */ - "sw $20, 16(%0) \n" /* s4 */ - "sw $21, 20(%0) \n" /* s5 */ - "sw $22, 24(%0) \n" /* s6 */ - "sw $23, 28(%0) \n" /* s7 */ - "sw $30, 32(%0) \n" /* fp */ - "sw $29, 36(%0) \n" /* sp */ - "sw $31, 40(%0) \n" /* ra */ + "sw $s0, 0(%0) \n" /* s0 */ + "sw $s1, 4(%0) \n" /* s1 */ + "sw $s2, 8(%0) \n" /* s2 */ + "sw $s3, 12(%0) \n" /* s3 */ + "sw $s4, 16(%0) \n" /* s4 */ + "sw $s5, 20(%0) \n" /* s5 */ + "sw $s6, 24(%0) \n" /* s6 */ + "sw $s7, 28(%0) \n" /* s7 */ + "sw $gp, 32(%0) \n" /* gp */ + "sw $fp, 36(%0) \n" /* fp */ + "sw $sp, 40(%0) \n" /* sp */ + "sw $ra, 44(%0) \n" /* ra */ ".set at \n" ".set reorder \n" : : "r" (addr) @@ -86,26 +86,27 @@ static inline void load_context(const void* addr) asm volatile ( ".set noat \n" ".set noreorder \n" - "lw $8, 44(%0) \n" /* Get start address ($8 = t0) */ - "beqz $8, running \n" /* NULL -> already running */ + "lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */ + "beqz $t9, running \n" /* NULL -> already running */ "nop \n" - "jr $8 \n" - "move $9, %0 \n" /* t1 = context */ + "jr $t9 \n" + "move $a0, %0 \n" /* a0 = context branch delay slot anyway */ "running: \n" - "lw $16, 0(%0) \n" /* s0 */ - "lw $17, 4(%0) \n" /* s1 */ - "lw $18, 8(%0) \n" /* s2 */ - "lw $19, 12(%0) \n" /* s3 */ - "lw $20, 16(%0) \n" /* s4 */ - "lw $21, 20(%0) \n" /* s5 */ - "lw $22, 24(%0) \n" /* s6 */ - "lw $23, 28(%0) \n" /* s7 */ - "lw $30, 32(%0) \n" /* fp */ - "lw $29, 36(%0) \n" /* sp */ - "lw $31, 40(%0) \n" /* ra */ + "lw $s0, 0(%0) \n" /* s0 */ + "lw $s1, 4(%0) \n" /* s1 */ + "lw $s2, 8(%0) \n" /* s2 */ + "lw $s3, 12(%0) \n" /* s3 */ + "lw $s4, 16(%0) \n" /* s4 */ + "lw $s5, 20(%0) \n" /* s5 */ + "lw $s6, 24(%0) \n" /* s6 */ + "lw $s7, 28(%0) \n" /* s7 */ + "lw $gp, 32(%0) \n" /* gp */ + "lw $fp, 36(%0) \n" /* fp */ + "lw $sp, 40(%0) \n" /* sp */ + "lw $ra, 44(%0) \n" /* ra */ ".set at \n" ".set reorder \n" - : : "r" (addr) : "t0", "t1" + : : "r" (addr) : "t9" ); } diff --git a/firmware/asm/mips/thread.h b/firmware/asm/mips/thread.h index ac37560a68..42b0f7049f 100644 --- a/firmware/asm/mips/thread.h +++ b/firmware/asm/mips/thread.h @@ -19,9 +19,24 @@ * ****************************************************************************/ +/* index offset register + * 0 0 $16 s0 + * 1 4 $17 s1 + * 2 8 $18 s2 + * 3 12 $19 s3 + * 4 16 $20 s4 + * 5 20 $21 s5 + * 6 24 $22 s6 + * 7 28 $23 s7 + * 8 32 $28 gp + * 9 36 $30 s8 (s8) + * 10 40 $29 sp + * 11 44 $31 ra + * 12 48 start + */ struct regs { - uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */ + uint32_t r[10]; /* 0-32 - Registers s0-s7, gp, fp */ uint32_t sp; /* 36 - Stack pointer */ uint32_t ra; /* 40 - Return address */ uint32_t start; /* 44 - Thread start address, or NULL when started */ diff --git a/firmware/drivers/audio/rocker_codec.c b/firmware/drivers/audio/rocker_codec.c new file mode 100644 index 0000000000..23541a4ddb --- /dev/null +++ b/firmware/drivers/audio/rocker_codec.c @@ -0,0 +1,77 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * + * Copyright (c) 2018 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "audio.h" +#include "audiohw.h" +#include "system.h" +#include "panic.h" +#include "alsa-controls.h" + +static int fd_hw; + +static void hw_open(void) +{ + fd_hw = open("/dev/snd/controlC0", O_RDWR); + if(fd_hw < 0) + panicf("Cannot open '/dev/snd/controlC0'"); +} + +static void hw_close(void) +{ + close(fd_hw); +} + +void audiohw_preinit(void) +{ + long int hp = 2; + + alsa_controls_init(); + hw_open(); + + /* Output port switch set to Headphones */ + alsa_controls_set_ints("Output Port Switch", 1, &hp); +} + +void audiohw_postinit(void) +{ +} + +void audiohw_close(void) +{ + hw_close(); + alsa_controls_close(); +} + +void audiohw_set_frequency(int fsel) +{ + (void)fsel; +} + +void audiohw_set_volume(int vol_l, int vol_r) +{ + long int vol_l_hw = -vol_l/5; + long int vol_r_hw = -vol_r/5; + + alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw); + alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw); +} diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c index 092ed9d576..0585cfb7a0 100644 --- a/firmware/drivers/lcd-24bit.c +++ b/firmware/drivers/lcd-24bit.c @@ -189,7 +189,8 @@ void lcd_fillrect(int x, int y, int width, int height) enum fill_opt fillopt = OPT_NONE; fb_data *dst, *dst_end; int len, step; - fb_data bits = { 0, 0, 0 }; + fb_data bits; // = { 0, 0, 0 }; + memset(&bits, 0, sizeof(fb_data)); /******************** In viewport clipping **********************/ /* nothing to draw? */ diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 6026a3b4bd..26a1a69f95 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h @@ -216,6 +216,8 @@ struct sound_settings_info #include "codec-dx50.h" #elif defined(DX90) #include "codec-dx90.h" +#elif defined(HAVE_ROCKER_CODEC) +#include "rocker_codec.h" #endif /* convert caps into defines */ diff --git a/firmware/export/config.h b/firmware/export/config.h index 0d15ab6a33..14664257bf 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -166,6 +166,7 @@ #define SAMSUNG_YH92X_PAD 62 #define DX50_PAD 63 #define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */ +#define AGPTEK_ROCKER_PAD 65 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -279,6 +280,7 @@ #define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */ #define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */ #define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */ +#define LCD_INGENIC_LINUX 64 /* LCD_PIXELFORMAT */ #define HORIZONTAL_PACKING 1 @@ -288,6 +290,7 @@ #define RGB565 565 #define RGB565SWAPPED 3553 #define RGB888 888 +#define XRGB8888 8888 /* LCD_STRIDEFORMAT */ #define VERTICAL_STRIDE 1 @@ -601,6 +604,8 @@ Lyre prototype 1 */ #include "config/sonynwzs750.h" #elif defined(SONY_NWZE350) #include "config/sonynwze350.h" +#elif defined(AGPTEK_ROCKER) +#include "config/agptekrocker.h" #else /* no known platform */ #endif diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h new file mode 100644 index 0000000000..517448b86d --- /dev/null +++ b/firmware/export/config/agptekrocker.h @@ -0,0 +1,119 @@ +/* + * This config file is for the Agptek Rocket + */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 103//??? + +#define MODEL_NAME "Agptek Rocker" + +/* LCD dimensions */ +#define LCD_WIDTH 128 +#define LCD_HEIGHT 160 +/* sqrt(128^2 + 160^2) / 2 = 102. */ +#define LCD_DPI 102 + +#ifndef SIMULATOR +#define CONFIG_PLATFORM (PLATFORM_HOSTED) +#endif + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +/* Define this if the LCD can shut down */ +//#define HAVE_LCD_SHUTDOWN + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +#define LCD_DEPTH 32 +/* Check that but should not matter */ +#define LCD_PIXELFORMAT XRGB8888 + +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS + +/* Main LCD backlight brightness range and defaults: the backlight driver + * has levels from 0 to 2555. But 0 is off so start at 1. + */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 255 +#define DEFAULT_BRIGHTNESS_SETTING 70 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + +/* define this if you have a real-time clock */ +#define CONFIG_RTC 0 + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x80000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x100000 + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC +#define HAVE_ROCKER_CODEC + +#define HAVE_HEADPHONE_DETECTION + +/* KeyPad configuration for plugins */ +#define CONFIG_KEYPAD AGPTEK_ROCKER_PAD + +#ifndef SIMULATOR +/* We have usb power and can detect usb but it is handled by Linux */ +#define HAVE_USB_POWER +#define USB_NONE +#endif + +#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE + +/* Linux controlls charging, we can monitor */ +#define CONFIG_CHARGING CHARGING_MONITOR + +/* define this if the hardware can be powered off while charging */ +#define HAVE_POWEROFF_WHILE_CHARGING + +/* same dimensions as gigabeats */ +#define CONFIG_LCD LCD_INGENIC_LINUX + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* Define this to the CPU frequency */ +#define CPU_FREQ 532000000 + +/* No special storage */ +#define CONFIG_STORAGE (STORAGE_HOSTFS)//|STORAGE_SD) +//#define MULTIDRIVE_DIR "/mnt/sd_0" +//#define NUM_DRIVES 1 +//#define HAVE_HOTSWAP +#define HAVE_STORAGE_FLUSH + +/* Battery */ +#define BATTERY_TYPES_COUNT 1 + +/* Audio codec */ +#define HAVE_ROCKER_CODEC + +/* Battery */ +#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h index 8dc9b3a7f9..6623461639 100644 --- a/firmware/export/rbpaths.h +++ b/firmware/export/rbpaths.h @@ -41,7 +41,8 @@ #endif /* def __PCTOOL__ */ #if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ - defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) + defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \ + defined(AGPTEK_ROCKER) #if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) #define HOME_DIR "/mnt/media0" @@ -50,6 +51,8 @@ #elif defined(DX50) || defined(DX90) /* Where to put save files like recordings, playlists, screen dumps ...*/ #define HOME_DIR "/mnt/sdcard" +#elif defined(AGPTEK_ROCKER) +#define HOME_DIR "/mnt/sd_0" #else #define HOME_DIR "/" #endif diff --git a/firmware/export/rocker_codec.h b/firmware/export/rocker_codec.h new file mode 100644 index 0000000000..366900d717 --- /dev/null +++ b/firmware/export/rocker_codec.h @@ -0,0 +1,6 @@ +#ifndef __ROCKER_CODEC__ +#define __ROCKER_CODEC__ + +#define AUDIOHW_CAPS 0 +AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -1020, 0, -300, ) +#endif diff --git a/firmware/include/bitarray.h b/firmware/include/bitarray.h index 4777ccb6a4..a1e7a3fd58 100644 --- a/firmware/include/bitarray.h +++ b/firmware/include/bitarray.h @@ -44,6 +44,7 @@ /** Iterators **/ #include "config.h" #include +#include #if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX #define __BITARRAY_CTZ(wval) __builtin_ctz(wval) diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c index 29ab9db873..307be7116a 100644 --- a/firmware/kernel/thread.c +++ b/firmware/kernel/thread.c @@ -37,6 +37,9 @@ #endif #include "core_alloc.h" +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) +#include +#endif /* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */ #ifdef DEBUG #define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */ diff --git a/firmware/screendump.c b/firmware/screendump.c index 226d08a390..1acaaafba6 100644 --- a/firmware/screendump.c +++ b/firmware/screendump.c @@ -234,8 +234,8 @@ void screen_dump(void) #endif } while (dst < dst_end); -#elif LCD_DEPTH == 24 - dst_end = dst + LCD_WIDTH*3; +#elif LCD_DEPTH >= 24 + dst_end = dst + LCD_WIDTH*sizeof(fb_data); src = FBADDR(0, y); do { diff --git a/firmware/target/hosted/agptek/adc-target.h b/firmware/target/hosted/agptek/adc-target.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/firmware/target/hosted/agptek/backlight-agptek.c b/firmware/target/hosted/agptek/backlight-agptek.c new file mode 100644 index 0000000000..2f00787f72 --- /dev/null +++ b/firmware/target/hosted/agptek/backlight-agptek.c @@ -0,0 +1,64 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "backlight-target.h" +#include "sysfs.h" +#include "panic.h" + +static const char * const sysfs_bl_brightness = + "/sys/class/backlight/pwm-backlight.0/brightness"; + +static const char * const sysfs_bl_power = + "/sys/class/backlight/pwm-backlight.0/bl_power"; + +bool backlight_hw_init(void) +{ + backlight_hw_on(); + backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); + return true; +} + +void backlight_hw_on(void) +{ + sysfs_set_int(sysfs_bl_power, 0); +} + +void backlight_hw_off(void) +{ + sysfs_set_int(sysfs_bl_power, 1); +} + +void backlight_hw_brightness(int brightness) +{ + /* cap range, just in case */ + if (brightness > MAX_BRIGHTNESS_SETTING) + brightness = MAX_BRIGHTNESS_SETTING; + if (brightness < MIN_BRIGHTNESS_SETTING) + brightness = MIN_BRIGHTNESS_SETTING; + + sysfs_set_int(sysfs_bl_brightness, brightness); +} diff --git a/firmware/target/hosted/agptek/backlight-target.h b/firmware/target/hosted/agptek/backlight-target.h new file mode 100644 index 0000000000..e3b8a7bd78 --- /dev/null +++ b/firmware/target/hosted/agptek/backlight-target.h @@ -0,0 +1,36 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _BACKLIGHT_TARGET_H_ +#define _BACKLIGHT_TARGET_H_ + + +#include + + +/* See backlight.c */ +bool backlight_hw_init(void); +void backlight_hw_on(void); +void backlight_hw_off(void); +void backlight_hw_brightness(int brightness); + + +#endif + diff --git a/firmware/target/hosted/agptek/button-agptek.c b/firmware/target/hosted/agptek/button-agptek.c new file mode 100644 index 0000000000..a8b5debee5 --- /dev/null +++ b/firmware/target/hosted/agptek/button-agptek.c @@ -0,0 +1,149 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +//#include +#include +#include +#include +#include +#include +#include +#include + +#include "sysfs.h" +#include "button.h" +#include "button-target.h" +#include "panic.h" + +#define NR_POLL_DESC 2 +static struct pollfd poll_fds[NR_POLL_DESC]; + +static int button_map(int keycode) +{ + switch(keycode) + { + case KEY_LEFT: + return BUTTON_LEFT; + + case KEY_RIGHT: + return BUTTON_RIGHT; + + case KEY_UP: + return BUTTON_UP; + + case KEY_DOWN: + return BUTTON_DOWN; + + case KEY_PLAYPAUSE: + return BUTTON_SELECT; + + case KEY_VOLUMEUP: + return BUTTON_VOLUP; + + case KEY_VOLUMEDOWN: + return BUTTON_VOLDOWN; + + case KEY_POWER: + return BUTTON_POWER; + + default: + return 0; + } +} + +void button_init_device(void) +{ + const char * const input_devs[] = { + "/dev/input/event0", + "/dev/input/event1" + }; + + for(int i = 0; i < NR_POLL_DESC; i++) + { + int fd = open(input_devs[i], O_RDWR); + + if(fd < 0) + { + panicf("Cannot open input device: %s\n", input_devs[i]); + } + + poll_fds[i].fd = fd; + poll_fds[i].events = POLLIN; + poll_fds[i].revents = 0; + } +} + +int button_read_device(void) +{ + static int button_bitmap = 0; + struct input_event event; + + /* check if there are any events pending and process them */ + while(poll(poll_fds, NR_POLL_DESC, 0)) + { + for(int i = 0; i < NR_POLL_DESC; i++) + { + /* read only if non-blocking */ + if(poll_fds[i].revents & POLLIN) + { + int size = read(poll_fds[i].fd, &event, sizeof(event)); + if(size == (int)sizeof(event)) + { + int keycode = event.code; + /* event.value == 0x10000 means press + * event.value == 0 means release + */ + bool press = event.value ? true : false; + + /* map linux event code to rockbox button bitmap */ + if(press) + { + button_bitmap |= button_map(keycode); + } + else + { + button_bitmap &= ~button_map(keycode); + } + } + } + } + } + + return button_bitmap; +} + +bool headphones_inserted(void) +{ + int status = 0; + const char * const sysfs_hp_switch = "/sys/devices/switch/headset/status"; + sysfs_get_int(sysfs_hp_switch, &status); + + return status ? true : false; +} + +void button_close_device(void) +{ + /* close descriptors */ + for(int i = 0; i < NR_POLL_DESC; i++) + { + close(poll_fds[i].fd); + } +} + diff --git a/firmware/target/hosted/agptek/button-target.h b/firmware/target/hosted/agptek/button-target.h new file mode 100644 index 0000000000..b08c055895 --- /dev/null +++ b/firmware/target/hosted/agptek/button-target.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#include +#include "config.h" + +/* Main unit's buttons */ +#define BUTTON_LEFT 0x00000001 +#define BUTTON_RIGHT 0x00000002 +#define BUTTON_UP 0x00000004 +#define BUTTON_DOWN 0x00000008 +#define BUTTON_SELECT 0x00000010 +#define BUTTON_VOLDOWN 0x00000020 +#define BUTTON_VOLUP 0x00000040 +#define BUTTON_POWER 0x00000080 + +#define BUTTON_MAIN 0x000000ff + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 10 + +#endif /* _BUTTON_TARGET_H_ */ + diff --git a/firmware/target/hosted/agptek/debug-agptek.c b/firmware/target/hosted/agptek/debug-agptek.c new file mode 100644 index 0000000000..33f3ac4b97 --- /dev/null +++ b/firmware/target/hosted/agptek/debug-agptek.c @@ -0,0 +1,6 @@ +#include + +bool debug_hw_info(void) +{ + return false; +} diff --git a/firmware/target/hosted/agptek/lcd-agptek.c b/firmware/target/hosted/agptek/lcd-agptek.c new file mode 100644 index 0000000000..abf89ea9e3 --- /dev/null +++ b/firmware/target/hosted/agptek/lcd-agptek.c @@ -0,0 +1,111 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "lcd.h" +#include "lcd-target.h" +#include "backlight-target.h" +#include "panic.h" + +static int fd = -1; +static struct fb_var_screeninfo vinfo; +fb_data *framebuffer = 0; /* global variable, see lcd-target.h */ + +void lcd_init_device(void) +{ + const char * const fb_dev = "/dev/fb0"; + fd = open(fb_dev, O_RDWR); + if(fd < 0) + { + panicf("Cannot open framebuffer: %s\n", fb_dev); + } + + /* get fixed and variable information */ + struct fb_fix_screeninfo finfo; + if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) + { + panicf("Cannot read framebuffer fixed information"); + } + + if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) + { + panicf("Cannot read framebuffer variable information"); + } + +#if 0 + /* check resolution and framebuffer size */ + if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH) + { + panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, + vinfo.yres, vinfo.bits_per_pixel); + } +#endif + /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the + * values returned by the driver for line_length */ + + /* map framebuffer */ + framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if((void *)framebuffer == MAP_FAILED) + { + panicf("Cannot map framebuffer"); + } +} + +static void redraw(void) +{ + ioctl(fd, FBIOPAN_DISPLAY, &vinfo); +} + +extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, + int width, int height); + +void lcd_update(void) +{ + /* Copy the Rockbox framebuffer to the second framebuffer */ + lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0), + LCD_WIDTH*LCD_HEIGHT, 1); + redraw(); +} + +void lcd_update_rect(int x, int y, int width, int height) +{ + fb_data *dst = LCD_FRAMEBUF_ADDR(x, y); + fb_data * src = FBADDR(x,y); + + /* Copy part of the Rockbox framebuffer to the second framebuffer */ + if (width < LCD_WIDTH) + { + /* Not full width - do line-by-line */ + lcd_copy_buffer_rect(dst, src, width, height); + } + else + { + /* Full width - copy as one line */ + lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1); + } + redraw(); +} diff --git a/firmware/target/hosted/agptek/lcd-target.h b/firmware/target/hosted/agptek/lcd-target.h new file mode 100644 index 0000000000..346644bdfc --- /dev/null +++ b/firmware/target/hosted/agptek/lcd-target.h @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __LCD_TARGET_H__ +#define __LCD_TARGET_H__ + +extern fb_data *framebuffer; /* see lcd-nwz.c */ +#define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) +#endif /* __LCD_TARGET_H__ */ diff --git a/firmware/target/hosted/agptek/power-agptek.c b/firmware/target/hosted/agptek/power-agptek.c new file mode 100644 index 0000000000..7403801681 --- /dev/null +++ b/firmware/target/hosted/agptek/power-agptek.c @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include +#include + +#include "system.h" +#include "power-agptek.h" +#include "power.h" +#include "panic.h" +#include "sysfs.h" + +const char * const sysfs_bat_voltage = + "/sys/class/power_supply/battery/voltage_now"; + +const char * const sysfs_bat_status = + "/sys/class/power_supply/battery/status"; + +unsigned int agptek_power_get_status(void) +{ + char buf[12] = {0}; + sysfs_get_string(sysfs_bat_status, buf, sizeof(buf)); + + if (strncmp(buf, "Charging", 8) == 0) + { + return POWER_INPUT_USB_CHARGER; + } + else + { + return POWER_INPUT_NONE; + } +} + +unsigned int agptek_power_get_battery_voltage(void) +{ + int battery_voltage; + sysfs_get_int(sysfs_bat_voltage, &battery_voltage); + + return battery_voltage/1000; +} diff --git a/firmware/target/hosted/agptek/power-agptek.h b/firmware/target/hosted/agptek/power-agptek.h new file mode 100644 index 0000000000..16f32b76ad --- /dev/null +++ b/firmware/target/hosted/agptek/power-agptek.h @@ -0,0 +1,29 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _POWER_AGPTEK_H_ +#define _POWER_AGPTEK_H_ + +#include +#include "config.h" + +unsigned int agptek_power_get_status(void); +unsigned int agptek_power_get_battery_voltage(void); +#endif /* _POWER_AGPTEK_H_ */ + diff --git a/firmware/target/hosted/agptek/powermgmt-agptek.c b/firmware/target/hosted/agptek/powermgmt-agptek.c new file mode 100644 index 0000000000..3371d1e793 --- /dev/null +++ b/firmware/target/hosted/agptek/powermgmt-agptek.c @@ -0,0 +1,63 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "powermgmt.h" +#include "power.h" +#include "power-agptek.h" + +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 3470 +}; + +/* the OF shuts down at this voltage */ +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 3400 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled + * NOTE: not calibrated simple linear scale for now + */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + { 3400, 3480, 3560, 3640, 3720, 3800, 3880, 3960, 4040, 4120, 4200 } +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short const percent_to_volt_charge[11] = +{ + 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 +}; + +unsigned int power_input_status(void) +{ + /* POWER_INPUT_USB_CHARGER, POWER_INPUT_NONE */ + return agptek_power_get_status(); +} + +int _battery_voltage(void) +{ + return agptek_power_get_battery_voltage(); +} + +bool charging_state(void) +{ + return agptek_power_get_status() == POWER_INPUT_USB_CHARGER; +} diff --git a/firmware/target/hosted/agptek/rocker.make b/firmware/target/hosted/agptek/rocker.make new file mode 100644 index 0000000000..1e8faaac0d --- /dev/null +++ b/firmware/target/hosted/agptek/rocker.make @@ -0,0 +1,48 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# + +INCLUDES += -I$(FIRMDIR)/include -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR) + +SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS) + +# bootloader build is sligtly different +ifneq (,$(findstring bootloader,$(APPSDIR))) + +SRC += $(call preprocess, $(APPSDIR)/SOURCES) +CLEANOBJS += $(BUILDDIR)/bootloader.* + +endif #bootloader + +.SECONDEXPANSION: # $$(OBJ) is not populated until after this + +ifneq (,$(findstring bootloader,$(APPSDIR))) +# bootloader build + +$(BUILDDIR)/bootloader.elf : $$(OBJ) $(FIRMLIB) $(CORE_LIBS) + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ + -L$(BUILDDIR)/firmware -lfirmware \ + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map + +$(BUILDDIR)/$(BINARY): $(BUILDDIR)/bootloader.elf + +else +# rockbox app build + +$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ + -L$(BUILDDIR)/firmware -lfirmware \ + -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map + +$(BUILDDIR)/rockbox.rocker : $(BUILDDIR)/rockbox.elf + $(call PRINTS,OC $(@F))$(call objcopy,$^,$@) + +endif diff --git a/firmware/target/hosted/agptek/sysfs.c b/firmware/target/hosted/agptek/sysfs.c new file mode 100644 index 0000000000..ad4635ac57 --- /dev/null +++ b/firmware/target/hosted/agptek/sysfs.c @@ -0,0 +1,186 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include +#include + +#include "config.h" +#include "debug.h" +#include "sysfs.h" + + +static FILE* open_read(const char *file_name) +{ + FILE *f = fopen(file_name, "r"); + if(f == NULL) + { + DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name); + } + + return f; +} + + +static FILE* open_write(const char* file_name) +{ + FILE *f = fopen(file_name, "w"); + if(f == NULL) + { + DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name); + } + + return f; +} + + +bool sysfs_get_int(const char *path, int *value) +{ + *value = -1; + + FILE *f = open_read(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fscanf(f, "%d", value) == EOF) + { + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); + success = false; + } + + fclose(f); + return success; +} + + +bool sysfs_set_int(const char *path, int value) +{ + FILE *f = open_write(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fprintf(f, "%d", value) < 1) + { + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); + success = false; + } + + fclose(f); + return success; +} + + +bool sysfs_get_char(const char *path, char *value) +{ + *value = '\0'; + FILE *f = open_read(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fscanf(f, "%c", value) == EOF) + { + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); + success = false; + } + + fclose(f); + return success; +} + + +bool sysfs_set_char(const char *path, char value) +{ + FILE *f = open_write(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fprintf(f, "%c", value) < 1) + { + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); + success = false; + } + + fclose(f); + return success; +} + + +bool sysfs_get_string(const char *path, char *value, int size) +{ + value[0] = '\0'; + FILE *f = open_read(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fgets(value, size, f) == NULL) + { + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); + success = false; + } + else + { + size_t length = strlen(value); + if((length > 0) && value[length - 1] == '\n') + { + value[length - 1] = '\0'; + } + } + + fclose(f); + return success; +} + + +bool sysfs_set_string(const char *path, char *value) +{ + FILE *f = open_write(path); + if(f == NULL) + { + return false; + } + + bool success = true; + if(fprintf(f, "%s", value) < 1) + { + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); + success = false; + } + + fclose(f); + return success; +} diff --git a/firmware/target/hosted/agptek/sysfs.h b/firmware/target/hosted/agptek/sysfs.h new file mode 100644 index 0000000000..639cc1c409 --- /dev/null +++ b/firmware/target/hosted/agptek/sysfs.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include + +bool sysfs_get_int(const char *path, int *value); +bool sysfs_set_int(const char *path, int value); +bool sysfs_get_char(const char *path, char *value); +bool sysfs_set_char(const char *path, char value); +bool sysfs_get_string(const char *path, char *value, int size); +bool sysfs_set_string(const char *path, char *value); diff --git a/firmware/target/hosted/agptek/system-agptek.c b/firmware/target/hosted/agptek/system-agptek.c new file mode 100644 index 0000000000..7f0949daf2 --- /dev/null +++ b/firmware/target/hosted/agptek/system-agptek.c @@ -0,0 +1,184 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include +#include + +#include "system.h" +#include "mv.h" +#include "font.h" +#include "power.h" +#include "button.h" +#include "backlight-target.h" +#include "lcd.h" + +/* to make thread-internal.h happy */ +uintptr_t *stackbegin; +uintptr_t *stackend; + +static void sig_handler(int sig, siginfo_t *siginfo, void *context) +{ + /* safe guard variable - we call backtrace() only on first + * UIE call. This prevent endless loop if backtrace() touches + * memory regions which cause abort + */ + static bool triggered = false; + + lcd_set_backdrop(NULL); + lcd_set_drawmode(DRMODE_SOLID); + lcd_set_foreground(LCD_BLACK); + lcd_set_background(LCD_WHITE); + unsigned line = 0; + + lcd_setfont(FONT_SYSFIXED); + lcd_set_viewport(NULL); + lcd_clear_display(); + + /* get context info */ + ucontext_t *uc = (ucontext_t *)context; + unsigned long pc = uc->uc_mcontext.pc; + unsigned long sp = uc->uc_mcontext.gregs[29]; + + lcd_putsf(0, line++, "%s at %08x", strsignal(sig), pc); + + if(sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS || sig == SIGTRAP) + lcd_putsf(0, line++, "address 0x%08x", siginfo->si_addr); + + if(!triggered) + { + triggered = true; + rb_backtrace(pc, sp, &line); + } + +#ifdef ROCKBOX_HAS_LOGF + lcd_putsf(0, line++, "logf:"); + logf_panic_dump(&line); +#endif + + lcd_update(); + + system_exception_wait(); /* If this returns, try to reboot */ + system_reboot(); + while (1); /* halt */ +} + +void power_off(void) +{ + system("/sbin/poweroff"); +} + +void system_init(void) +{ + int *s; + /* fake stack, to make thread-internal.h happy */ + stackbegin = stackend = (uintptr_t*)&s; + /* catch some signals for easier debugging */ + struct sigaction sa; + sigfillset(&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + sa.sa_sigaction = &sig_handler; + sigaction(SIGILL, &sa, NULL); + sigaction(SIGABRT, &sa, NULL); + sigaction(SIGFPE, &sa, NULL); + sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGBUS, &sa, NULL); + sigaction(SIGTERM, &sa, NULL); +} + +void system_reboot(void) +{ + system("/sbin/reboot"); +} + +void system_exception_wait(void) +{ + backlight_hw_on(); + backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); + /* wait until button press and release */ + while(button_read_device() != 0) {} + while(button_read_device() == 0) {} + while(button_read_device() != 0) {} + while(button_read_device() == 0) {} +} + +bool hostfs_removable(IF_MD_NONVOID(int drive)) +{ +#ifdef HAVE_MULTIDRIVE + if (drive > 0) /* Active LOW */ + return true; + else +#endif + return false; /* internal: always present */ +} + +bool hostfs_present(IF_MD_NONVOID(int drive)) +{ +#ifdef HAVE_MULTIDRIVE + if (drive > 0) /* Active LOW */ + return true; //FIXME + else +#endif + return true; /* internal: always present */ +} + +#ifdef HAVE_MULTIDRIVE +int volume_drive(int drive) +{ + return drive; +} +#endif /* HAVE_MULTIDRIVE */ + +#ifdef CONFIG_STORAGE_MULTI +int hostfs_driver_type(int drive) +{ + return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM; +} +#endif /* CONFIG_STORAGE_MULTI */ + +int hostfs_init(void) +{ + return 0; +} + +int hostfs_flush(void) +{ + sync(); + return 0; +} + +#ifdef HAVE_HOTSWAP +bool volume_removable(int volume) +{ + /* don't support more than one partition yet, so volume == drive */ + return hostfs_removable(volume); +} + +bool volume_present(int volume) +{ + /* don't support more than one partition yet, so volume == drive */ + return hostfs_present(volume); +} +#endif + diff --git a/firmware/target/hosted/agptek/system-target.h b/firmware/target/hosted/agptek/system-target.h new file mode 100644 index 0000000000..830f19fde4 --- /dev/null +++ b/firmware/target/hosted/agptek/system-target.h @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef __SYSTEM_TARGET_H__ +#define __SYSTEM_TARGET_H__ + +#include "kernel-unix.h" +#include "system-hosted.h" + +#define NEED_GENERIC_BYTESWAPS +#endif /* __SYSTEM_TARGET_H__ */ diff --git a/firmware/target/hosted/alsa-controls.c b/firmware/target/hosted/alsa-controls.c index 1d6d73e751..19de7aea44 100644 --- a/firmware/target/hosted/alsa-controls.c +++ b/firmware/target/hosted/alsa-controls.c @@ -3,7 +3,7 @@ * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * * Copyright (C) 2016 Amaury Pouly diff --git a/firmware/target/hosted/alsa-controls.h b/firmware/target/hosted/alsa-controls.h index 870797c5b8..a08fc46e14 100644 --- a/firmware/target/hosted/alsa-controls.h +++ b/firmware/target/hosted/alsa-controls.h @@ -1,10 +1,19 @@ /*************************************************************************** +<<<<<<< 9a9c7f2b7c63a9db203084a3485988c07f17b86c * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ +======= + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ +>>>>>>> Agptek rocker port initial commit * * Copyright (C) 2016 Amaury Pouly * diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 64ce9f41bc..4f1019c7a1 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c @@ -48,7 +48,8 @@ static const char rbhome[] = HOME_DIR; #endif #if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \ - defined(SONY_NWZ_LINUX) || defined(DX90)) && !defined(__PCTOOL__) + defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER)) && \ + !defined(__PCTOOL__) /* Special dirs are user-accessible (and user-writable) dirs which take priority * over the ones where Rockbox is installed to. Classic example would be * $HOME/.config/rockbox.org vs /usr/share/rockbox */ diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h index d14f70bf99..1ac124c881 100644 --- a/firmware/target/hosted/sdl/sim-ui-defines.h +++ b/firmware/target/hosted/sdl/sim-ui-defines.h @@ -515,6 +515,12 @@ #define UI_LCD_POSX 78 #define UI_LCD_POSY 92 +#elif defined(AGPTEK_ROCKER) +#define UI_TITLE "Agptek Rocker" +#define UI_WIDTH 186 +#define UI_HEIGHT 380 +#define UI_LCD_POSX 29 +#define UI_LCD_POSY 25 #elif defined(SIMULATOR) #error no UI defines #endif diff --git a/lib/rbcodec/codecs/libmad/libmad.make b/lib/rbcodec/codecs/libmad/libmad.make index 16b2bd76a9..a8dedc6721 100644 --- a/lib/rbcodec/codecs/libmad/libmad.make +++ b/lib/rbcodec/codecs/libmad/libmad.make @@ -19,7 +19,8 @@ MADFLAGS += -UDEBUG -DNDEBUG -DHAVE_LIMITS_H -DHAVE_ASSERT_H ifeq ($(ARCH),arch_arm) MADFLAGS += -O1 else - MADFLAGS += -O2 +# MADFLAGS += -O2 + MADFLAGS += -O0 -g endif # MPEGplayer diff --git a/tools/configure b/tools/configure index d86c78de3a..27c1e71f23 100755 --- a/tools/configure +++ b/tools/configure @@ -867,6 +867,26 @@ androidndkcc() prefixtools $gcctarget } +mipsellinuxcc () { + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib//` + GCCOPTS="$GCCOPTS -march=mips32r2 -mno-mips16 -mno-long-calls -Umips -fPIC" + GCCOPTIMIZE='' + LDOPTS="-lasound -lpthread -lm -ldl -lrt $LDOPTS" + GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs" + SHARED_LDFLAG="-shared" + SHARED_CFLAGS='-fPIC -fvisibility=hidden' + endian="little" + app_type="rocker" + thread_support="HAVE_SIGALTSTACK_THREADS" + + # Include path + GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT" + + # Set up compiler + gccchoice="4.9.4" + prefixtools "mipsel-rockbox-linux-gnu-" +} + whichadvanced () { atype=`echo "$1" | cut -c 2-` ################################################################## @@ -1511,8 +1531,8 @@ cat <ij+j@XZN$#zkz$$T>NWjp=InA?M`08W*u0 zBj@BiHm0lPhn)N4{P@K;W^e!4?B3lsJG=MH#`Z0r0Lm3v%YoH+`WHjp1u5*{GY-vN7e$>fzO)6vlx z6yMd@@3!-wuFou(`v*^3%EpuP+MJ`G)Jbq@* zUl?gwzAJg3xO~kVK7ADx@2$-FQ`_&2{I}Wuh)P|z`rqi6#CU8h{qU{I`HkE6&Dq{Q zHGE&Rb!3b)Va#9CdkqbrFZ(KlUUzRb&M{^(X8V#g+3W6}p0bY%?C0{@mYK7xqt9E* zJ7RnnJ_gSN_N{3p&iD3@RM|>!42Iyt1;&w9Ea%u>otja@c~ahn&tEhc2M*D;w+iPg z>pQA!WWo-{pWyHHf%EtKORJk^SYg{3@dkJAJPeNY*g3~o{rKcnb+!?l51t#cJ~Hbc z7%$s%hxvu2H3P1aGNEaUwnRv6)R;McboA2n^$)1z1pOKFi>se7K0UW+<|>Y%PE&;c zW12DrA2!&L5b80pa{l1pnV8Ra8l5+K&h+fUCydW8ty=$?4s-Tw?}s*NV&5lie|Dqy z_jNw}BAz_^Qa$T2a(?&0q3P=CR?EidrE#-l=L;Y@DNw1iP3p!>ymS2{2y@^ZK;19uw#Azv9@YAFiv}kFM@+ zJEnA`lJ!_PhmW|Xv6X5Zw8Am?x9>lBp^o(!IL93N&d%`XK*UlG(AGG7rppg3bj}}H z+kthGVqqkfd<>o&R@LViGUrdM&2alEVqqkfe4u|_OT3v-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~hID=*}noY!I_rsL$CoX5m-t-O$Pa$bv#n2wWkavl@U zwemvF$$2d{VmeOF$$3mX*UAeyC+D@;i0L>vC+9KoTq`f+oSfHUBc|hdaz1(an(K?3 z?Eeq_&sny7m!Uj4pP5@q*iN>XPxM#hoSa9_`M+7lr^q=ukCgLYTehFt)Ly|jX3uaw z5$6!)GKa`5OP=a2Z>sQ}XqTKPlHfKs-pM)Z5U$;eb)TG*^H|w-^F_|dxywVW`{bOQ z$I7;wFLF-KT^?fHC+FlmR<_-Ik#lnH@(}AjIVb0_vhC)JoRf2xhgkQ?IXRD&Z8u-! zoSeHn#JW$;$$6}7yZIvL-Mb62&%R{XDA zE)TKp7s&aDjfwteHvNlD$+|9P=hmJ%dG-2}w7jN$$4CsnlXG$&1IP99&`O;Ds`M-Ked&9q7L>tHNZ1t%z$>z^Ohm+uaj+Qy^!L=joD`2mz|2>G2f)Ky?y5R#W$ZZE^W_ozopf!Ld!E5 zD~2%*a=&%&QB}tC;2igyUtBe44`|3c-ywePJ3G6~=FXj(jOWEU?tAay6VpF1NY+_j z&y|6TBbUs<(aTdA&y#c98|mTW=eDffHrHns%;l@snJ9zI49w0io1NWzsrXJfOxX_o zh5P-VnXlfaP43C<=k0yUq&S&8w|(BDV-v}DBly; J+f>Q<{{vpGTp<7e literal 0 HcmV?d00001 diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES index 6acbd94624..901b4ebd2f 100644 --- a/uisimulator/buttonmap/SOURCES +++ b/uisimulator/buttonmap/SOURCES @@ -83,5 +83,7 @@ samsung-ypr0.c creative-zen.c #elif CONFIG_KEYPAD == SONY_NWZA860_PAD sony-nwza860.c +#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD +agptek-rocker.c #endif #endif /* SIMULATOR */ diff --git a/uisimulator/buttonmap/agptek-rocker.c b/uisimulator/buttonmap/agptek-rocker.c new file mode 100644 index 0000000000..ef7abd9879 --- /dev/null +++ b/uisimulator/buttonmap/agptek-rocker.c @@ -0,0 +1,80 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2013 by Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include +#include "button.h" +#include "buttonmap.h" + +int key_to_button(int keyboard_button) +{ + int new_btn = BUTTON_NONE; + switch (keyboard_button) + { + case SDLK_KP4: + case SDLK_LEFT: + new_btn = BUTTON_LEFT; + break; + case SDLK_KP6: + case SDLK_RIGHT: + new_btn = BUTTON_RIGHT; + break; + case SDLK_KP8: + case SDLK_UP: + new_btn = BUTTON_UP; + break; + case SDLK_KP2: + case SDLK_DOWN: + new_btn = BUTTON_DOWN; + break; + case SDLK_ESCAPE: + new_btn = BUTTON_POWER; + break; + case SDLK_KP_PLUS: + case SDLK_EQUALS: + new_btn = BUTTON_VOLUP; + break; + case SDLK_KP_MINUS: + case SDLK_MINUS: + new_btn = BUTTON_VOLDOWN; + break; + case SDLK_KP_ENTER: + case SDLK_RETURN: + case SDLK_SPACE: + case SDLK_INSERT: + case SDLK_KP5: + new_btn = BUTTON_SELECT; + break; + } + return new_btn; +} + +struct button_map bm[] = { + { SDLK_LEFT, 38, 296, 20, "Left" }, + { SDLK_RIGHT, 146, 295, 20, "Right" }, + { SDLK_UP, 93, 241, 20, "Up" }, + { SDLK_DOWN, 93, 348, 20, "Down" }, + { SDLK_ESCAPE, 2, 45, 20, "Power" }, + { SDLK_RETURN, 93, 295, 40, "Select" }, + { SDLK_KP_MINUS, 182, 100, 30, "Volume -" }, + { SDLK_KP_PLUS, 182, 45, 30, "Volume +" }, + { 0, 0, 0, 0, "None" } +}; diff --git a/wps/WPSLIST b/wps/WPSLIST index d26370214f..6708d7264d 100644 --- a/wps/WPSLIST +++ b/wps/WPSLIST @@ -95,7 +95,7 @@ wps.160x128x1: cabbiev2.160x128x1.wps wps.138x110x2: cabbiev2.138x110x2.wps wps.128x128x(16|24): cabbiev2.128x128x16.wps wps.128x128x2: cabbiev2.128x128x2.wps -wps.128x160x(16|24): cabbiev2.128x160x16.wps +wps.128x160x(16|24|32): cabbiev2.128x160x16.wps wps.132x80x(16|24): cabbiev2.132x80x16.wps wps.128x96x(16|24): cabbiev2.128x96x16.wps wps.128x96x2: cabbiev2.128x96x2.wps @@ -124,7 +124,7 @@ Font.160x128x1: 12-Adobe-Helvetica.fnt Font.138x110x2: 12-Adobe-Helvetica.fnt Font.128x128x(16|24): 12-Adobe-Helvetica.fnt Font.128x128x2: 12-Adobe-Helvetica.fnt -Font.128x160x(16|24): 12-Adobe-Helvetica.fnt +Font.128x160x(16|24|32): 12-Adobe-Helvetica.fnt Font.132x80x(16|24): 11-Sazanami-Mincho.fnt Font.128x96x(16|24): 08-Rockfont.fnt Font.128x96x2: 12-Adobe-Helvetica.fnt @@ -148,7 +148,7 @@ backdrop.320x480x(16|24): backdrops/cabbiev2.320x480x16.bmp backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp -backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp +backdrop.128x160x(16|24|32): backdrops/cabbiev2.128x160x16.bmp backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp @@ -173,9 +173,9 @@ iconset.400x240x(16|24): icons/tango_icons.16x16.bmp iconset.320x480x(16|24): icons/tango_icons.24x24.bmp iconset.320x240x(16|24): icons/tango_icons.16x16.bmp iconset.128x128x(16|24): icons/tango_icons.12x12.bmp -iconset.128x160x(16|24): icons/tango_icons.12x12.bmp +iconset.128x160x(16|24|32): icons/tango_icons.12x12.bmp iconset.132x80x(16|24): icons/tango_icons.12x12.bmp -iconset.160x128x(16|24): icons/tango_icons.12x12.bmp +iconset.160x128x(16|24|32): icons/tango_icons.12x12.bmp iconset.176x132x(16|24): icons/tango_icons.12x12.bmp iconset.176x220x(16|24): icons/tango_icons.12x12.bmp iconset.220x176x(16|24): icons/tango_icons.12x12.bmp @@ -194,7 +194,7 @@ viewers iconset.320x240x(16|24): icons/tango_icons_viewers.16x16.bmp viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp -viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp +viewers iconset.160x128x(16|24|32): icons/tango_icons_viewers.12x12.bmp viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp