summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitreview5
-rw-r--r--apps/SOURCES8
-rw-r--r--apps/action.c92
-rw-r--r--apps/action.h12
-rw-r--r--apps/debug_menu.c53
-rw-r--r--apps/filetree.c22
-rw-r--r--apps/filetree.h2
-rw-r--r--apps/gui/bitmap/list.c2
-rw-r--r--apps/gui/skin_engine/skin_parser.c27
-rw-r--r--apps/gui/skin_engine/skin_touchsupport.c33
-rw-r--r--apps/gui/skin_engine/wps_internals.h2
-rw-r--r--apps/gui/wps.c6
-rw-r--r--apps/gui/yesno.c5
-rw-r--r--apps/iap/iap-lingo4.c3
-rw-r--r--apps/keymaps/keymap-c100.c400
-rw-r--r--apps/keymaps/keymap-erosq.c40
-rw-r--r--apps/keymaps/keymap-fiiom3k.c82
-rw-r--r--apps/keymaps/keymap-iaudio67.c330
-rw-r--r--apps/keymaps/keymap-ifp7xx.c185
-rw-r--r--apps/keymaps/keymap-logikdax.c318
-rw-r--r--apps/lang/english-us.lang22
-rw-r--r--apps/lang/english.lang23
-rw-r--r--apps/lang/italiano.lang6
-rw-r--r--apps/lang/nederlands.lang6
-rw-r--r--apps/lang/polski.lang42
-rw-r--r--apps/lang/russian.lang6
-rw-r--r--apps/lang/slovak.lang6
-rw-r--r--apps/lang/srpski.lang6
-rw-r--r--apps/main.c11
-rw-r--r--apps/menu.c2
-rw-r--r--apps/menus/playlist_menu.c62
-rw-r--r--apps/menus/settings_menu.c3
-rw-r--r--apps/onplay.c1
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h1
-rw-r--r--apps/plugins/battery_bench.c14
-rw-r--r--apps/plugins/blackjack.c20
-rw-r--r--apps/plugins/calculator.c188
-rw-r--r--apps/plugins/calendar.c10
-rw-r--r--apps/plugins/chessbox/chessbox_pgn.h14
-rw-r--r--apps/plugins/chessclock.c21
-rw-r--r--apps/plugins/chopper.c6
-rw-r--r--apps/plugins/clix.c8
-rw-r--r--apps/plugins/cube.c20
-rw-r--r--apps/plugins/doom/doomdef.c2
-rw-r--r--apps/plugins/doom/doomdef.h2
-rw-r--r--apps/plugins/doom/i_video.c10
-rw-r--r--apps/plugins/doom/m_misc.c2
-rw-r--r--apps/plugins/fractals/fractal.h14
-rw-r--r--apps/plugins/greyscale.c8
-rw-r--r--apps/plugins/imageviewer/imageviewer_button.h11
-rw-r--r--apps/plugins/invadrox.c7
-rw-r--r--apps/plugins/jewels.c20
-rw-r--r--apps/plugins/lib/grey_core.c1
-rw-r--r--apps/plugins/lib/pluginlib_actions.c22
-rw-r--r--apps/plugins/lua/include_lua/create_kbd_layout.lua107
-rw-r--r--apps/plugins/lua/include_lua/menubuttons.lua59
-rw-r--r--apps/plugins/lua/include_lua/menucoresettings.lua78
-rw-r--r--apps/plugins/lua/include_lua/print.lua14
-rw-r--r--apps/plugins/lua/include_lua/printmenus.lua91
-rw-r--r--apps/plugins/lua/include_lua/printsubmenu.lua314
-rw-r--r--apps/plugins/lua/include_lua/printtable.lua61
-rw-r--r--apps/plugins/lua/include_lua/rbsettings.lua7
-rw-r--r--apps/plugins/lua/include_lua/temploader.lua63
-rw-r--r--apps/plugins/lua/lauxlib.c37
-rw-r--r--apps/plugins/lua/loadlib.c4
-rw-r--r--apps/plugins/lua/lparser.c5
-rw-r--r--apps/plugins/lua/lua.make13
-rwxr-xr-xapps/plugins/lua/rbdefines_helper.pl2
-rw-r--r--apps/plugins/lua/rockaux.c80
-rw-r--r--apps/plugins/lua/rocklib.c16
-rw-r--r--apps/plugins/lua_scripts/print_buttons.lua70
-rw-r--r--apps/plugins/lua_scripts/print_lua_func.lua72
-rw-r--r--apps/plugins/lua_scripts/submenu_demo.lua121
-rw-r--r--apps/plugins/midi/midiplay.c8
-rw-r--r--apps/plugins/mp3_encoder.c6
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c8
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c9
-rw-r--r--apps/plugins/pacbox/pacbox.h12
-rw-r--r--apps/plugins/pegbox.c17
-rw-r--r--apps/plugins/pictureflow/pictureflow.c19
-rw-r--r--apps/plugins/plugin.lds19
-rw-r--r--apps/plugins/pong.c8
-rw-r--r--apps/plugins/reversi/reversi-gui.h9
-rw-r--r--apps/plugins/rockblox.c22
-rw-r--r--apps/plugins/rockboy/cpu.c50
-rw-r--r--apps/plugins/rockboy/rockboy.c10
-rw-r--r--apps/plugins/sokoban.c14
-rw-r--r--apps/plugins/stopwatch.c17
-rw-r--r--apps/plugins/sudoku/sudoku.h10
-rw-r--r--apps/plugins/text_viewer/tv_button.h23
-rw-r--r--apps/plugins/xobox.c9
-rw-r--r--apps/plugins/zxbox/keymaps.h16
-rw-r--r--apps/plugins/zxbox/zxbox_keyb.c77
-rw-r--r--apps/settings.c1
-rw-r--r--apps/settings.h1
-rw-r--r--apps/settings_list.c2
-rw-r--r--apps/tagcache.c7
-rw-r--r--apps/tree.c2
-rw-r--r--bootloader/SOURCES4
-rw-r--r--bootloader/fat32format.c1
-rw-r--r--bootloader/fiiom3k.c309
-rw-r--r--bootloader/main-e200r-installer.c4
-rw-r--r--bootloader/main-pp.c4
-rw-r--r--bootloader/sansaconnect.c196
-rw-r--r--docs/CREDITS7
-rw-r--r--firmware/SOURCES115
-rw-r--r--firmware/common/crc32-mi4.c110
-rw-r--r--firmware/common/crc32.c30
-rw-r--r--firmware/common/timefuncs.c16
-rw-r--r--firmware/common/ucl_decompress.c192
-rw-r--r--firmware/common/vuprintf.c11
-rw-r--r--firmware/drivers/ata.c110
-rw-r--r--firmware/drivers/ata_flash.c484
-rw-r--r--firmware/drivers/audio/aic3x.c8
-rw-r--r--firmware/drivers/audio/ak4376.c70
-rw-r--r--firmware/drivers/axp-pmu.c670
-rw-r--r--firmware/drivers/axp173.c419
-rw-r--r--firmware/drivers/fat.c57
-rw-r--r--firmware/drivers/ft6x06.c115
-rw-r--r--firmware/drivers/lcd-16bit-common.c17
-rw-r--r--firmware/drivers/rtc/rtc_d2.c2
-rw-r--r--firmware/drivers/rtc/rtc_ds1339_ds3231.c2
-rw-r--r--firmware/drivers/rtc/rtc_e8564.c2
-rw-r--r--firmware/drivers/rtc/rtc_mr100.c2
-rw-r--r--firmware/drivers/rtc/rtc_pcf50605.c2
-rw-r--r--firmware/drivers/rtc/rtc_pcf50606.c3
-rw-r--r--firmware/drivers/rtc/rtc_rx5x348ab.c2
-rw-r--r--firmware/drivers/rtc/rtc_s35380a.c2
-rw-r--r--firmware/drivers/rtc/rtc_s35390a.c2
-rw-r--r--firmware/drivers/rtc/rtc_s3c2440.c2
-rw-r--r--firmware/drivers/rtc/rtc_tcc77x.c81
-rw-r--r--firmware/drivers/synaptics-mep.c5
-rw-r--r--firmware/drivers/tuner/lv24020lp.c10
-rw-r--r--firmware/drivers/usb-designware.c13
-rw-r--r--firmware/export/ak4376.h42
-rw-r--r--firmware/export/axp-pmu.h151
-rw-r--r--firmware/export/axp173.h94
-rw-r--r--firmware/export/config.h44
-rw-r--r--firmware/export/config/aigoerosq.h1
-rw-r--r--firmware/export/config/fiiom3k.h18
-rw-r--r--firmware/export/config/iaudio7.h164
-rw-r--r--firmware/export/config/ibassodx50.h6
-rw-r--r--firmware/export/config/ibassodx90.h6
-rw-r--r--firmware/export/config/iriverifp7xx.h129
-rw-r--r--firmware/export/config/logikdax.h152
-rw-r--r--firmware/export/config/sansac100.h130
-rw-r--r--firmware/export/config/sansaconnect.h16
-rw-r--r--firmware/export/config/sansam200.h139
-rw-r--r--firmware/export/cpu.h6
-rw-r--r--firmware/export/dm320.h17
-rw-r--r--firmware/export/ft6x06.h (renamed from firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c)59
-rw-r--r--firmware/export/gdb_api.h3
-rw-r--r--firmware/export/ifp_usb_serial.h30
-rw-r--r--firmware/export/installer.h31
-rw-r--r--firmware/export/tcc77x.h262
-rw-r--r--firmware/export/ucl_decompress.h32
-rw-r--r--firmware/export/usb_ch9.h17
-rw-r--r--firmware/export/x1000.h72
-rw-r--r--firmware/ifp_usb_serial.c1121
-rw-r--r--firmware/include/crc32-mi4.h25
-rw-r--r--firmware/include/crc32.h1
-rw-r--r--firmware/include/timefuncs.h1
-rw-r--r--firmware/rolo.c22
-rw-r--r--firmware/target/arm/ata-nand-telechips.c9
-rw-r--r--firmware/target/arm/lcd-ssd1815.c75
-rw-r--r--firmware/target/arm/pcm-telechips.c18
-rw-r--r--firmware/target/arm/pnx0101/app.lds144
-rw-r--r--firmware/target/arm/pnx0101/backlight-target.h28
-rw-r--r--firmware/target/arm/pnx0101/crt0-pnx0101.S225
-rw-r--r--firmware/target/arm/pnx0101/debug-pnx0101.c5
-rw-r--r--firmware/target/arm/pnx0101/i2c-pnx0101.c24
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/adc-ifp7xx.c59
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/adc-target.h31
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c35
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c90
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/button-target.h49
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c224
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c76
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c55
-rw-r--r--firmware/target/arm/pnx0101/iriver-ifp7xx/system-target.h36
-rw-r--r--firmware/target/arm/pnx0101/kernel-pnx0101.c45
-rw-r--r--firmware/target/arm/pnx0101/pcm-pnx0101.c207
-rw-r--r--firmware/target/arm/pnx0101/system-pnx0101.c317
-rw-r--r--firmware/target/arm/pnx0101/timer-pnx0101.c81
-rw-r--r--firmware/target/arm/pp/mi4-loader.c5
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c2
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/rtc-6g.c2
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c47
-rw-r--r--firmware/target/arm/system-arm.h2
-rw-r--r--firmware/target/arm/tcc77x/adc-tcc77x.c121
-rw-r--r--firmware/target/arm/tcc77x/app.lds99
-rw-r--r--firmware/target/arm/tcc77x/ata-nand-target.h33
-rw-r--r--firmware/target/arm/tcc77x/boot.lds63
-rw-r--r--firmware/target/arm/tcc77x/c100/adc-target.h26
-rw-r--r--firmware/target/arm/tcc77x/c100/backlight-target.h40
-rw-r--r--firmware/target/arm/tcc77x/c100/button-c100.c64
-rw-r--r--firmware/target/arm/tcc77x/c100/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/c100/lcd-S6B33B2.c286
-rw-r--r--firmware/target/arm/tcc77x/c100/power-c100.c43
-rw-r--r--firmware/target/arm/tcc77x/crt0.S230
-rw-r--r--firmware/target/arm/tcc77x/debug-tcc77x.c77
-rw-r--r--firmware/target/arm/tcc77x/i2c-target.h39
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/ata2501.c110
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/ata2501.h27
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c94
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/backlight-target.h48
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/button-iaudio7.c93
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/button-target.h47
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/lcd-iaudio7.c260
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/power-iaudio7.c149
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c84
-rw-r--r--firmware/target/arm/tcc77x/kernel-tcc77x.c47
-rw-r--r--firmware/target/arm/tcc77x/logikdax/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/logikdax/audio-logikdax.c40
-rw-r--r--firmware/target/arm/tcc77x/logikdax/backlight-target.h40
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-logikdax.c100
-rw-r--r--firmware/target/arm/tcc77x/logikdax/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/logikdax/power-logikdax.c44
-rw-r--r--firmware/target/arm/tcc77x/m200/adc-target.h28
-rw-r--r--firmware/target/arm/tcc77x/m200/audio-m200.c38
-rw-r--r--firmware/target/arm/tcc77x/m200/backlight-target.h44
-rw-r--r--firmware/target/arm/tcc77x/m200/button-m200.c99
-rw-r--r--firmware/target/arm/tcc77x/m200/button-target.h45
-rw-r--r--firmware/target/arm/tcc77x/m200/power-m200.c43
-rw-r--r--firmware/target/arm/tcc77x/powermgmt-tcc77x.c66
-rw-r--r--firmware/target/arm/tcc77x/system-target.h59
-rw-r--r--firmware/target/arm/tcc77x/system-tcc77x.c326
-rw-r--r--firmware/target/arm/tcc77x/timer-tcc77x.c69
-rw-r--r--firmware/target/arm/tms320dm320/boot.lds12
-rw-r--r--firmware/target/arm/tms320dm320/crt0.S6
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c468
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.h1
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c1
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c14
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c65
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/tnetv105_cppi.c1044
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/tnetv105_cppi.h144
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c1521
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.h335
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/usb-sansaconnect.c67
-rw-r--r--firmware/target/arm/tms320dm320/sdmmc-dm320.c96
-rw-r--r--firmware/target/arm/tms320dm320/system-dm320.c7
-rw-r--r--firmware/target/arm/tms320dm320/system-target.h1
-rw-r--r--firmware/target/arm/wmcodec-telechips.c2
-rw-r--r--firmware/target/hosted/sdl/sim-ui-defines.h14
-rw-r--r--firmware/target/mips/ingenic_jz47xx/app.lds3
-rw-r--r--firmware/target/mips/ingenic_jz47xx/boot.lds9
-rw-r--r--firmware/target/mips/ingenic_x1000/aic-x1000.c132
-rw-r--r--firmware/target/mips/ingenic_x1000/aic-x1000.h130
-rw-r--r--firmware/target/mips/ingenic_x1000/app.lds38
-rw-r--r--firmware/target/mips/ingenic_x1000/boot.lds6
-rw-r--r--firmware/target/mips/ingenic_x1000/clk-x1000.c236
-rw-r--r--firmware/target/mips/ingenic_x1000/clk-x1000.h6
-rw-r--r--firmware/target/mips/ingenic_x1000/crt0.S33
-rw-r--r--firmware/target/mips/ingenic_x1000/debug-x1000.c8
-rw-r--r--firmware/target/mips/ingenic_x1000/dma-x1000.h5
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c68
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c1
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/boot.make30
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c228
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/gpio-target.h26
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/i2c-target.h4
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/installer-fiiom3k.c338
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/installer-fiiom3k.h51
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c25
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/nand-fiiom3k.c53
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/nand-target.h42
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c41
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c190
-rw-r--r--firmware/target/mips/ingenic_x1000/fiiom3k/spl-target.h29
-rw-r--r--firmware/target/mips/ingenic_x1000/gpio-x1000.c106
-rw-r--r--firmware/target/mips/ingenic_x1000/gpio-x1000.h170
-rw-r--r--firmware/target/mips/ingenic_x1000/i2c-x1000.c18
-rw-r--r--firmware/target/mips/ingenic_x1000/lcd-x1000.c61
-rw-r--r--firmware/target/mips/ingenic_x1000/lcd-x1000.h23
-rw-r--r--firmware/target/mips/ingenic_x1000/msc-x1000.c77
-rw-r--r--firmware/target/mips/ingenic_x1000/msc-x1000.h9
-rw-r--r--firmware/target/mips/ingenic_x1000/nand-x1000-err.h18
-rw-r--r--firmware/target/mips/ingenic_x1000/nand-x1000.c663
-rw-r--r--firmware/target/mips/ingenic_x1000/nand-x1000.h217
-rw-r--r--firmware/target/mips/ingenic_x1000/pcm-x1000.c98
-rw-r--r--firmware/target/mips/ingenic_x1000/pwm-x1000.c50
-rw-r--r--firmware/target/mips/ingenic_x1000/sd-x1000.c3
-rw-r--r--firmware/target/mips/ingenic_x1000/sfc-x1000.c44
-rw-r--r--firmware/target/mips/ingenic_x1000/sfc-x1000.h2
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-start.S97
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000-defs.h66
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000.c119
-rw-r--r--firmware/target/mips/ingenic_x1000/spl-x1000.h23
-rw-r--r--firmware/target/mips/ingenic_x1000/spl.lds37
-rw-r--r--firmware/target/mips/ingenic_x1000/system-target.h25
-rw-r--r--firmware/target/mips/ingenic_x1000/system-x1000.c11
-rw-r--r--firmware/target/mips/ingenic_x1000/usb-x1000.c211
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/aic.h270
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/cpm.h534
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/efuse.h173
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/pcm.h251
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/ssi.h323
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000/uart.h390
-rw-r--r--firmware/target/mips/ingenic_x1000/x1000boot.make53
-rw-r--r--firmware/target/mips/mipsr2-endian.h7
-rw-r--r--firmware/target/mips/mmu-mips.h17
-rw-r--r--firmware/usb.c2
-rw-r--r--firmware/usbstack/usb_serial.c222
-rw-r--r--firmware/usbstack/usb_storage.c4
-rw-r--r--gdb/Makefile2
-rw-r--r--gdb/arm-stub.c2
-rw-r--r--gdb/linker.cfg2
-rw-r--r--lib/microtar/LICENSE19
-rw-r--r--lib/microtar/README.md128
-rw-r--r--lib/microtar/SOURCES6
-rw-r--r--lib/microtar/microtar.make21
-rw-r--r--lib/microtar/src/Makefile91
-rw-r--r--lib/microtar/src/microtar-rockbox.c100
-rw-r--r--lib/microtar/src/microtar-stdio.c65
-rw-r--r--lib/microtar/src/microtar.c403
-rw-r--r--lib/microtar/src/microtar.h108
-rw-r--r--lib/rbcodec/codecs/libopus/README.rockbox16
-rw-r--r--lib/rbcodec/codecs/libopus/SOURCES2
-rw-r--r--lib/rbcodec/codecs/libopus/analysis.c945
-rw-r--r--lib/rbcodec/codecs/libopus/analysis.h102
-rw-r--r--lib/rbcodec/codecs/libopus/celt/_kiss_fft_guts.h21
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arch.h66
-rwxr-xr-xlib/rbcodec/codecs/libopus/celt/arm/arm2gnu.pl353
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/arm_celt_map.c160
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/armcpu.c185
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/armcpu.h77
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/armopts.s.in37
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/celt_fft_ne10.c173
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/celt_mdct_ne10.c258
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/celt_neon_intr.c211
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/celt_pitch_xcorr_arm.s551
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fft_arm.h71
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fixed_arm64.h35
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fixed_armv4.h6
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/fixed_armv5e.h4
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/mdct_arm.h59
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/pitch_arm.h160
-rw-r--r--lib/rbcodec/codecs/libopus/celt/arm/pitch_neon_intr.c290
-rw-r--r--lib/rbcodec/codecs/libopus/celt/bands.c351
-rw-r--r--lib/rbcodec/codecs/libopus/celt/bands.h26
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt.c44
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt.h44
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt_decoder.c263
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt_encoder.c2607
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt_lpc.c73
-rw-r--r--lib/rbcodec/codecs/libopus/celt/celt_lpc.h18
-rw-r--r--lib/rbcodec/codecs/libopus/celt/cpu_support.h20
-rw-r--r--lib/rbcodec/codecs/libopus/celt/cwrs.c8
-rw-r--r--lib/rbcodec/codecs/libopus/celt/dump_modes/Makefile32
-rw-r--r--lib/rbcodec/codecs/libopus/celt/dump_modes/dump_modes.c353
-rw-r--r--lib/rbcodec/codecs/libopus/celt/dump_modes/dump_modes_arch.h45
-rw-r--r--lib/rbcodec/codecs/libopus/celt/dump_modes/dump_modes_arm_ne10.c152
-rw-r--r--lib/rbcodec/codecs/libopus/celt/entcode.c2
-rw-r--r--lib/rbcodec/codecs/libopus/celt/entcode.h4
-rw-r--r--lib/rbcodec/codecs/libopus/celt/entdec.h2
-rw-r--r--lib/rbcodec/codecs/libopus/celt/entenc.c2
-rw-r--r--lib/rbcodec/codecs/libopus/celt/entenc.h2
-rw-r--r--lib/rbcodec/codecs/libopus/celt/fixed_c5x.h79
-rw-r--r--lib/rbcodec/codecs/libopus/celt/fixed_c6x.h70
-rw-r--r--lib/rbcodec/codecs/libopus/celt/fixed_debug.h791
-rw-r--r--lib/rbcodec/codecs/libopus/celt/fixed_generic.h27
-rw-r--r--lib/rbcodec/codecs/libopus/celt/float_cast.h16
-rw-r--r--lib/rbcodec/codecs/libopus/celt/kiss_fft.c91
-rw-r--r--lib/rbcodec/codecs/libopus/celt/kiss_fft.h67
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mathops.c7
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mathops.h40
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mdct.c38
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mdct.h56
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/celt_mipsr1.h151
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/fixed_generic_mipsr1.h126
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/kiss_fft_mipsr1.h167
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/mdct_mipsr1.h288
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/pitch_mipsr1.h161
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mips/vq_mipsr1.h122
-rw-r--r--lib/rbcodec/codecs/libopus/celt/modes.c10
-rw-r--r--lib/rbcodec/codecs/libopus/celt/opus_custom_demo.c210
-rw-r--r--lib/rbcodec/codecs/libopus/celt/os_support.h6
-rw-r--r--lib/rbcodec/codecs/libopus/celt/pitch.c138
-rw-r--r--lib/rbcodec/codecs/libopus/celt/pitch.h65
-rw-r--r--lib/rbcodec/codecs/libopus/celt/quant_bands.c13
-rw-r--r--lib/rbcodec/codecs/libopus/celt/rate.c17
-rw-r--r--lib/rbcodec/codecs/libopus/celt/rate.h4
-rw-r--r--lib/rbcodec/codecs/libopus/celt/static_modes_fixed.h65
-rw-r--r--lib/rbcodec/codecs/libopus/celt/static_modes_fixed_arm_ne10.h388
-rw-r--r--lib/rbcodec/codecs/libopus/celt/static_modes_float.h888
-rw-r--r--lib/rbcodec/codecs/libopus/celt/static_modes_float_arm_ne10.h404
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_cwrs32.c161
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_dft.c179
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_entropy.c383
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_laplace.c93
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_mathops.c266
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_mdct.c227
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_rotation.c86
-rw-r--r--lib/rbcodec/codecs/libopus/celt/tests/test_unit_types.c50
-rw-r--r--lib/rbcodec/codecs/libopus/celt/vq.c130
-rw-r--r--lib/rbcodec/codecs/libopus/celt/vq.h29
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/celt_lpc_sse.h66
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/celt_lpc_sse4_1.c89
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/pitch_sse.c185
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/pitch_sse.h192
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/pitch_sse2.c95
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/pitch_sse4_1.c195
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/vq_sse.h50
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/vq_sse2.c217
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/x86_celt_map.c167
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/x86cpu.c157
-rw-r--r--lib/rbcodec/codecs/libopus/celt/x86/x86cpu.h95
-rw-r--r--lib/rbcodec/codecs/libopus/mapping_matrix.c378
-rw-r--r--lib/rbcodec/codecs/libopus/mapping_matrix.h133
-rw-r--r--lib/rbcodec/codecs/libopus/mlp.c144
-rw-r--r--lib/rbcodec/codecs/libopus/mlp.h60
-rw-r--r--lib/rbcodec/codecs/libopus/mlp_data.c672
-rw-r--r--lib/rbcodec/codecs/libopus/ogg/crctable.h278
-rw-r--r--lib/rbcodec/codecs/libopus/ogg/framing.c1294
-rw-r--r--lib/rbcodec/codecs/libopus/ogg/ogg.h1
-rw-r--r--lib/rbcodec/codecs/libopus/opus.c14
-rw-r--r--lib/rbcodec/codecs/libopus/opus.h9
-rw-r--r--lib/rbcodec/codecs/libopus/opus_compare.c382
-rw-r--r--lib/rbcodec/codecs/libopus/opus_decoder.c134
-rw-r--r--lib/rbcodec/codecs/libopus/opus_defines.h90
-rw-r--r--lib/rbcodec/codecs/libopus/opus_demo.c892
-rw-r--r--lib/rbcodec/codecs/libopus/opus_encoder.c2754
-rw-r--r--lib/rbcodec/codecs/libopus/opus_header.c117
-rw-r--r--lib/rbcodec/codecs/libopus/opus_header.h4
-rw-r--r--lib/rbcodec/codecs/libopus/opus_multistream.c92
-rw-r--r--lib/rbcodec/codecs/libopus/opus_multistream.h660
-rw-r--r--lib/rbcodec/codecs/libopus/opus_multistream_decoder.c549
-rw-r--r--lib/rbcodec/codecs/libopus/opus_multistream_encoder.c1328
-rw-r--r--lib/rbcodec/codecs/libopus/opus_private.h96
-rw-r--r--lib/rbcodec/codecs/libopus/opus_projection.h568
-rw-r--r--lib/rbcodec/codecs/libopus/opus_projection_decoder.c258
-rw-r--r--lib/rbcodec/codecs/libopus/opus_projection_encoder.c468
-rw-r--r--lib/rbcodec/codecs/libopus/opus_types.h27
-rw-r--r--lib/rbcodec/codecs/libopus/repacketizer.c349
-rw-r--r--lib/rbcodec/codecs/libopus/repacketizer_demo.c217
-rw-r--r--lib/rbcodec/codecs/libopus/silk/A2NLSF.c267
-rw-r--r--lib/rbcodec/codecs/libopus/silk/API.h6
-rw-r--r--lib/rbcodec/codecs/libopus/silk/CNG.c83
-rw-r--r--lib/rbcodec/codecs/libopus/silk/HP_variable_cutoff.c77
-rw-r--r--lib/rbcodec/codecs/libopus/silk/LPC_analysis_filter.c29
-rw-r--r--lib/rbcodec/codecs/libopus/silk/LPC_fit.c81
-rw-r--r--lib/rbcodec/codecs/libopus/silk/LPC_inv_pred_gain.c99
-rw-r--r--lib/rbcodec/codecs/libopus/silk/LP_variable_cutoff.c135
-rw-r--r--lib/rbcodec/codecs/libopus/silk/MacroCount.h10
-rw-r--r--lib/rbcodec/codecs/libopus/silk/MacroDebug.h3
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF2A.c59
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_VQ.c76
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_VQ_weights_laroia.c4
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_decode.c22
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_del_dec_quant.c215
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_encode.c124
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NLSF_stabilize.c2
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NSQ.c437
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NSQ.h101
-rw-r--r--lib/rbcodec/codecs/libopus/silk/NSQ_del_dec.c733
-rw-r--r--lib/rbcodec/codecs/libopus/silk/PLC.c28
-rw-r--r--lib/rbcodec/codecs/libopus/silk/PLC.h3
-rw-r--r--lib/rbcodec/codecs/libopus/silk/SigProc_FIX.h80
-rw-r--r--lib/rbcodec/codecs/libopus/silk/VAD.c360
-rw-r--r--lib/rbcodec/codecs/libopus/silk/VQ_WMat_EC.c131
-rw-r--r--lib/rbcodec/codecs/libopus/silk/ana_filt_bank_1.c74
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/LPC_inv_pred_gain_arm.h57
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/LPC_inv_pred_gain_neon_intr.c280
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/NSQ_del_dec_arm.h100
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/NSQ_del_dec_neon_intr.c1124
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/NSQ_neon.c112
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/NSQ_neon.h114
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/arm_silk_map.c123
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/biquad_alt_arm.h68
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/biquad_alt_neon_intr.c156
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/macros_arm64.h39
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/macros_armv4.h13
-rw-r--r--lib/rbcodec/codecs/libopus/silk/arm/macros_armv5e.h9
-rw-r--r--lib/rbcodec/codecs/libopus/silk/biquad_alt.c121
-rw-r--r--lib/rbcodec/codecs/libopus/silk/bwexpander.c2
-rw-r--r--lib/rbcodec/codecs/libopus/silk/check_control_input.c106
-rw-r--r--lib/rbcodec/codecs/libopus/silk/code_signs.c2
-rw-r--r--lib/rbcodec/codecs/libopus/silk/control.h8
-rw-r--r--lib/rbcodec/codecs/libopus/silk/control_SNR.c113
-rw-r--r--lib/rbcodec/codecs/libopus/silk/control_audio_bandwidth.c132
-rw-r--r--lib/rbcodec/codecs/libopus/silk/control_codec.c423
-rw-r--r--lib/rbcodec/codecs/libopus/silk/debug.c170
-rw-r--r--lib/rbcodec/codecs/libopus/silk/debug.h266
-rw-r--r--lib/rbcodec/codecs/libopus/silk/dec_API.c11
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_core.c13
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_frame.c16
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_indices.c2
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_parameters.c4
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_pitch.c4
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decode_pulses.c6
-rw-r--r--lib/rbcodec/codecs/libopus/silk/decoder_set_fs.c8
-rw-r--r--lib/rbcodec/codecs/libopus/silk/define.h19
-rw-r--r--lib/rbcodec/codecs/libopus/silk/enc_API.c576
-rw-r--r--lib/rbcodec/codecs/libopus/silk/encode_indices.c181
-rw-r--r--lib/rbcodec/codecs/libopus/silk/encode_pulses.c206
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/LTP_analysis_filter_FIX.c90
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/LTP_scale_ctrl_FIX.c53
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/apply_sine_window_FIX.c101
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/arm/warped_autocorrelation_FIX_arm.h68
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/arm/warped_autocorrelation_FIX_neon_intr.c260
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/autocorr_FIX.c48
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/burg_modified_FIX.c280
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/corrMatrix_FIX.c150
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/encode_frame_FIX.c448
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/find_LPC_FIX.c151
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/find_LTP_FIX.c99
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/find_pitch_lags_FIX.c143
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/find_pred_coefs_FIX.c145
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/k2a_FIX.c54
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/k2a_Q16_FIX.c54
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/main_FIX.h244
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/mips/noise_shape_analysis_FIX_mipsr1.h336
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/mips/prefilter_FIX_mipsr1.h184
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/mips/warped_autocorrelation_FIX_mipsr1.h166
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/noise_shape_analysis_FIX.c407
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/pitch_analysis_core_FIX.c721
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/process_gains_FIX.c117
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/regularize_correlations_FIX.c47
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/residual_energy16_FIX.c103
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/residual_energy_FIX.c98
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/schur64_FIX.c93
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/schur_FIX.c107
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/structs_FIX.h116
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/vector_ops_FIX.c102
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/warped_autocorrelation_FIX.c90
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/x86/burg_modified_FIX_sse4_1.c377
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/x86/prefilter_FIX_sse.c160
-rw-r--r--lib/rbcodec/codecs/libopus/silk/fixed/x86/vector_ops_FIX_sse4_1.c88
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/LPC_analysis_filter_FLP.c249
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/LPC_inv_pred_gain_FLP.c73
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/LTP_analysis_filter_FLP.c75
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/LTP_scale_ctrl_FLP.c52
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/SigProc_FLP.h197
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/apply_sine_window_FLP.c81
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/autocorrelation_FLP.c52
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/burg_modified_FLP.c186
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/bwexpander_FLP.c49
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/corrMatrix_FLP.c93
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/encode_frame_FLP.c435
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/energy_FLP.c59
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/find_LPC_FLP.c104
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/find_LTP_FLP.c64
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/find_pitch_lags_FLP.c132
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/find_pred_coefs_FLP.c116
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/inner_product_FLP.c59
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/k2a_FLP.c54
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/main_FLP.h286
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/noise_shape_analysis_FLP.c350
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/pitch_analysis_core_FLP.c630
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/process_gains_FLP.c103
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/regularize_correlations_FLP.c48
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/residual_energy_FLP.c117
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/scale_copy_vector_FLP.c57
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/scale_vector_FLP.c56
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/schur_FLP.c70
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/sort_FLP.c83
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/structs_FLP.h112
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/warped_autocorrelation_FLP.c73
-rw-r--r--lib/rbcodec/codecs/libopus/silk/float/wrappers_FLP.c207
-rw-r--r--lib/rbcodec/codecs/libopus/silk/gain_quant.c5
-rw-r--r--lib/rbcodec/codecs/libopus/silk/init_decoder.c1
-rw-r--r--lib/rbcodec/codecs/libopus/silk/init_encoder.c64
-rw-r--r--lib/rbcodec/codecs/libopus/silk/inner_prod_aligned.c47
-rw-r--r--lib/rbcodec/codecs/libopus/silk/interpolate.c51
-rw-r--r--lib/rbcodec/codecs/libopus/silk/lin2log.c46
-rw-r--r--lib/rbcodec/codecs/libopus/silk/log2lin.c6
-rw-r--r--lib/rbcodec/codecs/libopus/silk/macros.h29
-rw-r--r--lib/rbcodec/codecs/libopus/silk/main.h108
-rw-r--r--lib/rbcodec/codecs/libopus/silk/mips/NSQ_del_dec_mipsr1.h410
-rw-r--r--lib/rbcodec/codecs/libopus/silk/mips/macros_mipsr1.h92
-rw-r--r--lib/rbcodec/codecs/libopus/silk/mips/sigproc_fix_mipsr1.h60
-rw-r--r--lib/rbcodec/codecs/libopus/silk/process_NLSFs.c107
-rw-r--r--lib/rbcodec/codecs/libopus/silk/quant_LTP_gains.c132
-rw-r--r--lib/rbcodec/codecs/libopus/silk/resampler.c10
-rw-r--r--lib/rbcodec/codecs/libopus/silk/resampler_down2.c74
-rw-r--r--lib/rbcodec/codecs/libopus/silk/resampler_down2_3.c103
-rw-r--r--lib/rbcodec/codecs/libopus/silk/resampler_private_down_FIR.c2
-rw-r--r--lib/rbcodec/codecs/libopus/silk/resampler_rom.c54
-rw-r--r--lib/rbcodec/codecs/libopus/silk/shell_coder.c4
-rw-r--r--lib/rbcodec/codecs/libopus/silk/sigm_Q15.c76
-rw-r--r--lib/rbcodec/codecs/libopus/silk/sort.c18
-rw-r--r--lib/rbcodec/codecs/libopus/silk/stereo_LR_to_MS.c229
-rw-r--r--lib/rbcodec/codecs/libopus/silk/stereo_encode_pred.c62
-rw-r--r--lib/rbcodec/codecs/libopus/silk/stereo_find_predictor.c79
-rw-r--r--lib/rbcodec/codecs/libopus/silk/stereo_quant_pred.c73
-rw-r--r--lib/rbcodec/codecs/libopus/silk/structs.h8
-rw-r--r--lib/rbcodec/codecs/libopus/silk/sum_sqr_shift.c51
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tables.h14
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tables_LTP.c8
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_NB_MB.c36
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tables_NLSF_CB_WB.c36
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tables_other.c14
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tests/test_unit_LPC_inv_pred_gain.c129
-rw-r--r--lib/rbcodec/codecs/libopus/silk/tuning_parameters.h155
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/NSQ_del_dec_sse4_1.c859
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/NSQ_sse4_1.c719
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/SigProc_FIX_sse.h94
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/VAD_sse4_1.c277
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/VQ_WMat_EC_sse4_1.c142
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/main_sse.h248
-rw-r--r--lib/rbcodec/codecs/libopus/silk/x86/x86_silk_map.c164
-rw-r--r--lib/rbcodec/codecs/libopus/tansig_table.h45
-rw-r--r--lib/rbcodec/metadata/asf.c16
-rw-r--r--lib/rbcodec/metadata/mp3data.c27
-rw-r--r--manual/configure_rockbox/playlist_options.tex7
-rwxr-xr-xmanual/configure_rockbox/system_options.tex2
-rw-r--r--manual/getting_started/main.tex2
-rw-r--r--rbutil/ipodpatcher/ipodpatcher.c32
-rw-r--r--rbutil/jztool/Makefile26
-rw-r--r--rbutil/jztool/README.md118
-rw-r--r--rbutil/jztool/include/jztool.h37
-rw-r--r--rbutil/jztool/jztool.c162
-rw-r--r--rbutil/jztool/src/context.c10
-rw-r--r--rbutil/jztool/src/device_info.c29
-rw-r--r--rbutil/jztool/src/fiiom3k.c373
-rw-r--r--rbutil/jztool/src/identify_file.c50
-rw-r--r--rbutil/jztool/src/paramlist.c135
-rw-r--r--rbutil/jztool/src/usb.c64
-rw-r--r--rbutil/jztool/src/x1000.c193
-rw-r--r--rbutil/libtools.make6
-rw-r--r--tools/builds.pm22
-rwxr-xr-xtools/configure187
-rw-r--r--tools/rbspeex/Makefile4
-rwxr-xr-xtools/rockboxdev.sh47
-rw-r--r--tools/root.make15
-rw-r--r--tools/scramble.c32
-rw-r--r--uisimulator/bitmaps/UI-iaudio7.bmpbin422918 -> 0 bytes
-rw-r--r--uisimulator/bitmaps/UI-iriverifp7xx.bmpbin233562 -> 0 bytes
-rw-r--r--uisimulator/buttonmap/SOURCES4
-rw-r--r--uisimulator/buttonmap/erosq.c2
-rw-r--r--uisimulator/buttonmap/iriver-ifp7xx.c71
-rw-r--r--utils/MTP/Makefile4
-rw-r--r--utils/MTP/beastpatcher/Makefile12
-rw-r--r--utils/MTP/beastpatcher/beastpatcher.c2
-rw-r--r--utils/MTP/beastpatcher/md5.c246
-rw-r--r--utils/MTP/beastpatcher/md5.h25
-rw-r--r--utils/MTP/beastpatcher/mknkboot.c61
-rw-r--r--utils/MTP/beastpatcher/mknkboot.h1
-rw-r--r--utils/MTP/beastpatcher/mtp_libmtp.c2
-rw-r--r--utils/MTP/sendfirm.c1
-rwxr-xr-xutils/fiio_m3k_tools/nand_patcher.py69
-rw-r--r--utils/reggen-ng/x1000.reggen421
-rw-r--r--wps/cabbiev2.112x64x1.wps4
-rw-r--r--wps/cabbiev2.128x128x16.wps4
-rw-r--r--wps/cabbiev2.128x128x2.wps4
-rw-r--r--wps/cabbiev2.128x160x16.wps4
-rw-r--r--wps/cabbiev2.128x64x1.wps2
-rw-r--r--wps/cabbiev2.128x96x16.wps4
-rw-r--r--wps/cabbiev2.128x96x2.wps2
-rw-r--r--wps/cabbiev2.132x80x16.wps4
-rw-r--r--wps/cabbiev2.138x110x2.wps4
-rw-r--r--wps/cabbiev2.160x128x1.wps2
-rw-r--r--wps/cabbiev2.160x128x16.wps4
-rw-r--r--wps/cabbiev2.160x128x2.wps4
-rw-r--r--wps/cabbiev2.176x132x16.wps4
-rw-r--r--wps/cabbiev2.176x220x16.wps6
-rw-r--r--wps/cabbiev2.220x176x16.wps4
-rw-r--r--wps/cabbiev2.240x320x16.mini2440.wps8
-rw-r--r--wps/cabbiev2.240x320x16.wps8
-rw-r--r--wps/cabbiev2.240x400x16.wps8
-rw-r--r--wps/cabbiev2.320x240x16.mrobe500.wps8
-rw-r--r--wps/cabbiev2.320x240x16.wps8
-rw-r--r--wps/cabbiev2.320x480x16.wps8
-rw-r--r--wps/cabbiev2.400x240x16.wps8
-rw-r--r--wps/cabbiev2.480x800x16.wps8
-rw-r--r--wps/cabbiev2.800x480x16.wps8
-rw-r--r--wps/cabbiev2.96x96x16.wps4
670 files changed, 62980 insertions, 15584 deletions
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000000..d7ac04740e
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=gerrit.rockbox.org
+port=29418
+project=rockbox.git
+defaultbranch=master
diff --git a/apps/SOURCES b/apps/SOURCES
index 80133ebd27..5c49f0bbbc 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -197,8 +197,6 @@ keymaps/keymap-gigabeat.c
keymaps/keymap-gigabeat-s.c
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
keymaps/keymap-h10.c
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-keymaps/keymap-ifp7xx.c
#elif CONFIG_KEYPAD == SANSA_E200_PAD
keymaps/keymap-e200.c
#elif CONFIG_KEYPAD == SANSA_C200_PAD
@@ -231,12 +229,6 @@ keymaps/keymap-sa9200.c
keymaps/keymap-hdd1630.c
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
keymaps/keymap-hdd6330.c
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-keymaps/keymap-iaudio67.c
-#elif CONFIG_KEYPAD == SANSA_C100_PAD
-keymaps/keymap-c100.c
-#elif CONFIG_KEYPAD == LOGIK_DAX_PAD
-keymaps/keymap-logikdax.c
#elif CONFIG_KEYPAD == SANSA_FUZE_PAD
keymaps/keymap-fuze.c
#elif CONFIG_KEYPAD == ONDAVX747_PAD
diff --git a/apps/action.c b/apps/action.c
index 34897b938c..5533c00241 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -128,21 +128,25 @@ static bool is_action_filtered(int action, unsigned int mask, int context)
case ACTION_FM_PLAY:
match = has_flag(mask, SEL_ACTION_PLAY);
break;
- case ACTION_STD_PREVREPEAT:
- case ACTION_STD_NEXTREPEAT:
+ //case ACTION_STD_PREVREPEAT: // seek not exempted outside of WPS
+ //case ACTION_STD_NEXTREPEAT:
case ACTION_WPS_SEEKBACK:
case ACTION_WPS_SEEKFWD:
case ACTION_WPS_STOPSEEK:
match = has_flag(mask, SEL_ACTION_SEEK);
break;
- case ACTION_STD_PREV:
- case ACTION_STD_NEXT:
+ //case ACTION_STD_PREV: // skip/scrollwheel not exempted outside of WPS
+ //case ACTION_STD_NEXT:
case ACTION_WPS_SKIPNEXT:
case ACTION_WPS_SKIPPREV:
case ACTION_FM_NEXT_PRESET:
case ACTION_FM_PREV_PRESET:
match = has_flag(mask, SEL_ACTION_SKIP);
break;
+#ifdef HAVE_VOLUME_IN_LIST
+ case ACTION_LIST_VOLUP: // volume exempted outside of WPS if the device supports it
+ case ACTION_LIST_VOLDOWN:
+#endif
case ACTION_WPS_VOLUP:
case ACTION_WPS_VOLDOWN:
match = has_flag(mask, SEL_ACTION_VOL);
@@ -586,6 +590,13 @@ static inline void action_code_lookup(action_last_t *last, action_cur_t *cur)
cur->is_prebutton = false;
+#ifdef HAVE_LOCKED_ACTIONS
+ /* This only applies to the first context, to allow locked contexts to
+ * specify a fall through to their non-locked version */
+ if (is_keys_locked())
+ context |= CONTEXT_LOCKED;
+#endif
+
for(;;)
{
/* logf("context = %x",context); */
@@ -672,6 +683,20 @@ static inline int do_auto_softlock(action_last_t *last, action_cur_t *cur)
if (is_timeout)
{
do_key_lock(true);
+
+#if defined(HAVE_TOUCHPAD)
+ /* if the touchpad is supposed to be off and the current buttonpress
+ * is from the touchpad, nullify both button and action. */
+ if (!has_flag(action_last.softlock_mask, SEL_ACTION_ENABLED) ||
+ has_flag(action_last.softlock_mask, SEL_ACTION_NOTOUCH))
+ {
+ cur->button = touchpad_filter(cur->button);
+ if (cur->button == BUTTON_NONE)
+ {
+ action = ACTION_NONE;
+ }
+ }
+#endif
}
else if (action == ACTION_STD_KEYLOCK)
{
@@ -724,8 +749,11 @@ static inline void do_softlock(action_last_t *last, action_cur_t *cur)
#else
int action = cur->action;
- if (!last->screen_has_lock)
- { /* no need to check softlock return immediately */
+ /* check to make sure we don't get stuck without a way to unlock - if locked,
+ * we can still use unlock_combo to unlock */
+ if (!last->screen_has_lock && !last->keys_locked)
+ {
+ /* no need to check softlock return immediately */
return;
}
@@ -1169,7 +1197,7 @@ void set_selective_backlight_actions(bool selective, unsigned int mask,
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void)
{
- return (action_last.screen_has_lock && action_last.keys_locked);
+ return (action_last.keys_locked);
}
/* Enable selected actions to bypass a locked state */
@@ -1185,7 +1213,57 @@ void set_selective_softlock_actions(bool selective, unsigned int mask)
action_last.softlock_mask = SEL_ACTION_NONE;
}
}
+
+
+void action_autosoftlock_init(void)
+{
+ action_cur_t cur;
+ int i = 0;
+
+ if (action_last.unlock_combo == BUTTON_NONE)
+ {
+ /* search CONTEXT_WPS, should be here */
+ cur.items = get_context_mapping(CONTEXT_WPS);
+ while (cur.items[i].button_code != BUTTON_NONE)
+ {
+ if (cur.items[i].action_code == ACTION_STD_KEYLOCK)
+ {
+ action_last.unlock_combo = cur.items[i].button_code;
+ break;
+ }
+ i = i + 1;
+ }
+
+ /* not there... let's try std
+ * I doubt any targets will need this, but... */
+ if (action_last.unlock_combo == BUTTON_NONE)
+ {
+ i = 0;
+ cur.items = get_context_mapping(CONTEXT_STD);
+ while (cur.items[i].button_code != BUTTON_NONE)
+ {
+ if (cur.items[i].action_code == ACTION_STD_KEYLOCK)
+ {
+ action_last.unlock_combo = cur.items[i].button_code;
+ break;
+ }
+ i = i + 1;
+ }
+ }
+ }
+
+ /* if we have autolock and alwaysautolock, go ahead and arm it */
+ if (has_flag(action_last.softlock_mask, SEL_ACTION_AUTOLOCK) &&
+ has_flag(action_last.softlock_mask, SEL_ACTION_ALWAYSAUTOLOCK) &&
+ (action_last.unlock_combo != BUTTON_NONE))
+ {
+ action_last.softlock_mask = action_last.softlock_mask | SEL_ACTION_ALOCK_OK;
+ }
+
+ return;
+}
#endif /* !HAS_BUTTON_HOLD */
+
/*
*******************************************************************************
* END EXPORTED ACTION FUNCTIONS ***********************************************
diff --git a/apps/action.h b/apps/action.h
index e4ad29504b..ad91f31535 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -32,6 +32,9 @@
#define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */
#define CONTEXT_CUSTOM2 0x20000000 /* as above */
#define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */
+#ifdef HAVE_LOCKED_ACTIONS
+#define CONTEXT_LOCKED 0x04000000 /* flag to use alternate keymap when screen is locked */
+#endif
#define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE }
#define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }
@@ -65,10 +68,17 @@
#if !defined(HAS_BUTTON_HOLD)
/* returns true if keys_locked and screen_has_lock */
bool is_keys_locked(void);
+
/* Enable selected actions to bypass a locked state
* mask is combination of Selective action selection flags */
void set_selective_softlock_actions(bool selective, unsigned int mask);
-#endif
+
+/* search the standard and wps contexts for ACTION_STD_KEYLOCK,
+ * load it into unlock_combo if we find it,
+ * also arm autolock if enabled. */
+void action_autosoftlock_init(void);
+
+#endif /* !defined(HAS_BUTTON_HOLD) */
#if defined(HAVE_BACKLIGHT)
/* Enable selected actions to leave the backlight off
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 42d16a4e82..9bbbfaec99 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -126,10 +126,6 @@
#include "bootdata.h"
#endif
-#ifdef FIIO_M3K
-#include "installer.h"
-#endif
-
static const char* threads_getname(int selected_item, void *data,
char *buffer, size_t buffer_len)
{
@@ -2495,52 +2491,6 @@ static bool dbg_boot_data(void)
}
#endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */
-#if defined(FIIO_M3K) && !defined(SIMULATOR)
-/* Note: this is temporary and should NOT be merged, ensure it is removed */
-static int fiio_debug_menu_action_callback(int action, struct gui_synclist *lists)
-{
- if(action == ACTION_REDRAW) {
- simplelist_set_line_count(0);
- simplelist_addline("Back to menu");
- simplelist_addline("Install bootloader");
- simplelist_addline("Dump bootloader");
- action = ACTION_REDRAW;
- }
-
- if(action == ACTION_STD_OK) {
- int sel = gui_synclist_get_sel_pos(lists);
- int rc = 0;
- switch(sel) {
- case 1:
- rc = install_bootloader("/boot.install");
- break;
- case 2:
- rc = dump_bootloader("/boot.dump");
- break;
- default:
- break;
- }
-
- if(sel == 1 || sel == 2) {
- const char* msg = installer_strerror(rc);
- splashf(3*HZ, "(%d) %s", rc, msg);
- }
-
- action = ACTION_STD_CANCEL;
- }
-
- return action;
-}
-
-static bool dbg_fiio_menu(void)
-{
- struct simplelist_info info;
- simplelist_info_init(&info, "FiiO debug menu", 3, NULL);
- info.action_callback = fiio_debug_menu_action_callback;
- return simplelist_show_list(&info);
-}
-#endif
-
/****** The menu *********/
static const struct {
unsigned char *desc; /* string or ID */
@@ -2648,9 +2598,6 @@ static const struct {
#if defined(HAVE_BOOTDATA) && !defined(SIMULATOR)
{"Boot data", dbg_boot_data },
#endif
-#if defined(FIIO_M3K) && !defined(SIMULATOR)
- {"FiiO debug menu", dbg_fiio_menu},
-#endif
};
static int menu_action_callback(int btn, struct gui_synclist *lists)
diff --git a/apps/filetree.c b/apps/filetree.c
index f8a1263e7f..5c6443cc34 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -86,12 +86,12 @@ int ft_build_playlist(struct tree_context* c, int start_index)
* or started via bookmark autoload, true otherwise.
*
* Pointers to both the full pathname and the separated parts needed to
- * avoid allocating yet another path buffer on the stack (and save some
+ * avoid allocating yet another path buffer on the stack (and save some
* code; the caller typically needs to create the full pathname anyway)...
*/
-bool ft_play_playlist(char* pathname, char* dirname, char* filename)
+bool ft_play_playlist(char* pathname, char* dirname, char* filename, bool skip_dyn_warning)
{
- if (global_settings.party_mode && audio_status())
+ if (global_settings.party_mode && audio_status())
{
splash(HZ, ID2P(LANG_PARTY_MODE));
return false;
@@ -105,9 +105,13 @@ bool ft_play_playlist(char* pathname, char* dirname, char* filename)
splash(0, ID2P(LANG_WAIT));
/* about to create a new current playlist...
- allow user to cancel the operation */
- if (!warn_on_pl_erase())
- return false;
+ * allow user to cancel the operation.
+ * Do not show if skip_dyn_warning is true */
+ if (!skip_dyn_warning)
+ {
+ if (!warn_on_pl_erase())
+ return false;
+ }
if (playlist_create(dirname, filename) != -1)
{
@@ -115,11 +119,11 @@ bool ft_play_playlist(char* pathname, char* dirname, char* filename)
{
playlist_shuffle(current_tick, -1);
}
-
+
playlist_start(0, 0, 0);
return true;
}
-
+
return false;
}
@@ -465,7 +469,7 @@ int ft_enter(struct tree_context* c)
switch ( file_attr & FILE_ATTR_MASK ) {
case FILE_ATTR_M3U:
- play = ft_play_playlist(buf, c->currdir, file->name);
+ play = ft_play_playlist(buf, c->currdir, file->name, false);
if (play)
{
diff --git a/apps/filetree.h b/apps/filetree.h
index fb329813c1..178ba0e973 100644
--- a/apps/filetree.h
+++ b/apps/filetree.h
@@ -26,6 +26,6 @@ int ft_load(struct tree_context* c, const char* tempdir);
int ft_enter(struct tree_context* c);
int ft_exit(struct tree_context* c);
int ft_build_playlist(struct tree_context* c, int start_index);
-bool ft_play_playlist(char* pathname, char* dirname, char* filename);
+bool ft_play_playlist(char* pathname, char* dirname, char* filename, bool skip_dyn_warning);
#endif
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 6f6a8c1f7f..a82595fb37 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -734,7 +734,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * list)
if (list_display_title(list, screen))
line -= 1; /* adjust for the list title */
}
- if (line >= list->nb_items)
+ if (list_start_item+line >= list->nb_items)
return ACTION_NONE;
list->selected_item = list_start_item+line;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 7f3f4d62e1..7bcd25d258 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1148,7 +1148,6 @@ static int parse_progressbar_tag(struct skin_element* element,
{
struct touchregion *region = skin_buffer_alloc(sizeof(*region));
struct skin_token_list *item;
- int wpad, hpad;
if (!region)
return 0;
@@ -1163,24 +1162,24 @@ static int parse_progressbar_tag(struct skin_element* element,
/* try to add some extra space on either end to make pressing the
* full bar easier. ~5% on either side
*/
- wpad = pb->width * 5 / 100;
- if (wpad > 10)
- wpad = 10;
- hpad = pb->height * 5 / 100;
- if (hpad > 10)
- hpad = 10;
-
- region->x = pb->x - wpad;
+ region->wpad = pb->width * 5 / 100;
+ if (region->wpad > 10)
+ region->wpad = 10;
+ region->hpad = pb->height * 5 / 100;
+ if (region->hpad > 10)
+ region->hpad = 10;
+
+ region->x = pb->x;
if (region->x < 0)
region->x = 0;
- region->width = pb->width + 2 * wpad;
+ region->width = pb->width;
if (region->x + region->width > curr_vp->vp.x + curr_vp->vp.width)
region->width = curr_vp->vp.x + curr_vp->vp.width - region->x;
- region->y = pb->y - hpad;
+ region->y = pb->y;
if (region->y < 0)
region->y = 0;
- region->height = pb->height + 2 * hpad;
+ region->height = pb->height;
if (region->y + region->height > curr_vp->vp.y + curr_vp->vp.height)
region->height = curr_vp->vp.y + curr_vp->vp.height - region->y;
@@ -1541,6 +1540,10 @@ static int parse_touchregion(struct skin_element *element,
/* should probably do some bounds checking here with the viewport... but later */
region->action = ACTION_NONE;
+ /* padding is only for bars, user defined regions have no need of it */
+ region->wpad = 0;
+ region->hpad = 0;
+
if (get_param(element, 0)->type == STRING)
{
region->label = PTRTOSKINOFFSET(skin_buffer, get_param_text(element, 0));
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index 7a03e83c36..045bc809c8 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -92,6 +92,18 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
* are relative to a preceding viewport */
vx = x - wvp->vp.x;
vy = y - wvp->vp.y;
+
+ /* project touches in the padding region so they clamp to the
+ * edge of the region instead */
+ if(r->x - r->wpad <= vx && vx < r->x)
+ vx = r->x;
+ else if(r->x + r->width <= vx && vx < r->x + r->width + r->wpad)
+ vx = r->x + r->width - 1;
+ if(r->y - r->hpad <= vy && vy < r->y)
+ vy = r->y;
+ else if(r->y + r->height <= vy && vy < r->y + r->height + r->hpad)
+ vy = r->y + r->height - 1;
+
/* now see if the point is inside this region */
if (vx >= r->x && vx < r->x+r->width &&
vy >= r->y && vy < r->y+r->height)
@@ -109,12 +121,21 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
{
struct progressbar *bar =
SKINOFFSETTOPTR(skin_buffer, r->bar);
- if(r->width > r->height)
- *edge_offset = vx*100/r->width;
- else /* vertical bars are bottom-up by default */
- *edge_offset = 100 - vy*100/r->height;
+ if(r->width > r->height) {
+ if(r->width > 1)
+ *edge_offset = vx*1000/(r->width - 1);
+ else
+ *edge_offset = 0;
+ } else {
+ /* vertical bars are bottom-up by default */
+ if(r->height > 1)
+ *edge_offset = 1000 - vy*1000/(r->height - 1);
+ else
+ *edge_offset = 0;
+ }
+
if (r->reverse_bar || (bar && bar->invert_fill_direction))
- *edge_offset = 100 - *edge_offset;
+ *edge_offset = 1000 - *edge_offset;
}
temp = r;
returncode = r->action;
@@ -294,7 +315,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
{
int val, count;
get_setting_info_for_bar(bar->setting_id, &count, &val);
- val = *edge_offset * count / 100;
+ val = *edge_offset * count / 1000;
update_setting_value_from_touch(bar->setting_id, val);
}
}
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index dcad598dab..bf368bc4f3 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -201,6 +201,8 @@ struct touchregion {
short int y; /* y-pos */
short int width; /* width */
short int height; /* height */
+ short int wpad; /* padding to width */
+ short int hpad; /* padding to height */
bool reverse_bar; /* if true 0% is the left or top */
bool allow_while_locked;
enum {
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index b42e386a91..35716087c2 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -182,7 +182,7 @@ static int skintouch_to_wps(struct wps_data *data)
return ACTION_WPS_HOTKEY;
#endif
case ACTION_TOUCH_SCROLLBAR:
- skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100;
+ skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/1000;
audio_pre_ff_rewind();
audio_ff_rewind(skin_get_global_state()->id3->elapsed);
return ACTION_TOUCHSCREEN;
@@ -190,8 +190,10 @@ static int skintouch_to_wps(struct wps_data *data)
{
const int min_vol = sound_min(SOUND_VOLUME);
const int max_vol = sound_max(SOUND_VOLUME);
- global_settings.volume = (offset * (max_vol - min_vol)) / 100;
+ const int step_vol = sound_steps(SOUND_VOLUME);
+ global_settings.volume = (offset * (max_vol - min_vol)) / 1000;
global_settings.volume += min_vol;
+ global_settings.volume -= (global_settings.volume % step_vol);
setvol();
}
return ACTION_TOUCHSCREEN;
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index a50b2f1921..669f8ca09a 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -201,8 +201,13 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
result=YESNO_YES;
break;
case ACTION_NONE:
+ case ACTION_UNKNOWN:
case SYS_CHARGER_DISCONNECTED:
case SYS_BATTERY_UPDATE:
+ case SYS_TIMEOUT:
+#if CONFIG_CHARGING
+ case SYS_CHARGER_CONNECTED:
+#endif
/* ignore some SYS events that can happen */
continue;
default:
diff --git a/apps/iap/iap-lingo4.c b/apps/iap/iap-lingo4.c
index b601501b3d..4ec5c462a1 100644
--- a/apps/iap/iap-lingo4.c
+++ b/apps/iap/iap-lingo4.c
@@ -108,7 +108,8 @@ static void seek_to_playlist(unsigned long index)
MAX_PATH);
ft_play_playlist(selected_playlist,
global_settings.playlist_catalog_dir,
- strrchr(selected_playlist, '/') + 1);
+ strrchr(selected_playlist, '/') + 1,
+ false);
}
static unsigned long nbr_total_playlists(void)
diff --git a/apps/keymaps/keymap-c100.c b/apps/keymaps/keymap-c100.c
deleted file mode 100644
index 9949f0c1c2..0000000000
--- a/apps/keymaps/keymap-c100.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2007 Mark Arigo
- *
- * 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.
- *
- ****************************************************************************/
-/* Button Code Definitions for Sandisk c100 target */
-
-#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_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_standard */
-
-
-static const struct button_mapping button_context_wps[] = {
- { ACTION_WPS_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
-
- { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL,BUTTON_RIGHT|BUTTON_REPEAT },
-
- { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_POWER|BUTTON_RIGHT, BUTTON_POWER },
- { ACTION_WPS_ABSETA_PREVDIR,BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER },
- { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER },
-
- { ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
- { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_VOLUP, BUTTON_SELECT },
- { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_VOLDOWN, BUTTON_SELECT },
- { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_WPS_HOTKEY, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
- { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_wps */
-
-static const struct button_mapping button_context_settings[] = {
- { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
- { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings */
-
-static const struct button_mapping button_context_list[] = {
-#ifdef HAVE_VOLUME_IN_LIST
- { ACTION_LIST_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_LIST_VOLUP, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_LIST_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_LIST_VOLDOWN, BUTTON_VOLDOWN|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_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_TREE_HOTKEY, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_tree */
-
-static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
- { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
- { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_without_combo */
-
-static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_TREE_ROOT_INIT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_REC|BUTTON_LEFT },
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_with_combo */
-
-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_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
- { 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_right_is_inc[] = {
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings_right_is_inc */
-
-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_RESET, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_PS_EXIT, BUTTON_POWER, 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 */
-
-/** FM Radio Screen **/
-#if CONFIG_TUNER
-static const struct button_mapping button_context_radio[] = {
- { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_FM_PRESET, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
- { ACTION_FM_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
- { ACTION_FM_MODE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
- { ACTION_FM_EXIT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
- { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
-}; /* button_context_radio */
-#endif
-
-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_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- { ACTION_KBD_UP, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
-
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
-// { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
-
- { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_keyboard */
-
-static const struct button_mapping button_context_bmark[] = {
-// { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_bmark */
-
-#ifdef USB_ENABLE_HID
-static const struct button_mapping button_context_usb_hid[] = {
- { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_usb_hid */
-
-static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
- { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
-}; /* button_context_usb_hid_mode_multimedia */
-
-static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
- { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
- { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
- { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
- { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
- { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
-}; /* button_context_usb_hid_mode_presentation */
-
-static const struct button_mapping button_context_usb_hid_mode_browser[] = {
- { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
- { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
- { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
- { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
- { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN },
- { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
- { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
- { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
- { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
-}; /* button_context_usb_hid_mode_browser */
-
-#ifdef HAVE_USB_HID_MOUSE
-static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
- { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOLUP, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOLDOWN, BUTTON_NONE },
- { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
-}; /* button_context_usb_hid_mode_mouse */
-#endif
-#endif
-
-/* 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_TREE:
- case CONTEXT_MAINMENU:
- if (global_settings.hold_lr_for_scroll_in_list)
- return button_context_listtree_scroll_without_combo;
- else
- return button_context_listtree_scroll_with_combo;
- case CONTEXT_CUSTOM|CONTEXT_TREE:
- return button_context_tree;
-
- case CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_TIME:
- return button_context_settings;
- case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_COLOURCHOOSER:
- case CONTEXT_SETTINGS_EQ:
- return button_context_settings_right_is_inc;
-
- case CONTEXT_YESNOSCREEN:
- return button_context_yesno;
-#if CONFIG_TUNER
- case CONTEXT_FM:
- return button_context_radio;
-#endif
- case CONTEXT_BOOKMARKSCREEN:
- return button_context_bmark;
- case CONTEXT_QUICKSCREEN:
- return button_context_quickscreen;
- case CONTEXT_PITCHSCREEN:
- return button_context_pitchscreen;
-#ifdef HAVE_RECORDING
- case CONTEXT_RECSCREEN:
- return button_context_recscreen;
-#endif
- case CONTEXT_KEYBOARD:
- return button_context_keyboard;
-#ifdef USB_ENABLE_HID
- case CONTEXT_USB_HID:
- return button_context_usb_hid;
- case CONTEXT_USB_HID_MODE_MULTIMEDIA:
- return button_context_usb_hid_mode_multimedia;
- case CONTEXT_USB_HID_MODE_PRESENTATION:
- return button_context_usb_hid_mode_presentation;
- case CONTEXT_USB_HID_MODE_BROWSER:
- return button_context_usb_hid_mode_browser;
-#ifdef HAVE_USB_HID_MOUSE
- case CONTEXT_USB_HID_MODE_MOUSE:
- return button_context_usb_hid_mode_mouse;
-#endif
-#endif
- default:
- return button_context_standard;
- }
- return button_context_standard;
-}
diff --git a/apps/keymaps/keymap-erosq.c b/apps/keymaps/keymap-erosq.c
index 71c9b39171..59b70d24ca 100644
--- a/apps/keymaps/keymap-erosq.c
+++ b/apps/keymaps/keymap-erosq.c
@@ -39,16 +39,11 @@ static const struct button_mapping button_context_standard[] = {
{ ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE },
{ ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, // release just because it feels better to use
+ { ACTION_STD_HOTKEY, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
{ ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
- { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
-
-/* ACTION_STD_QUICKSCREEN,
- * ACTION_STD_KEYLOCK
- * ACTION_STD_REC
- * ACTION_STD_HOTKEY
- */
+ { ACTION_STD_KEYLOCK, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_standard */
@@ -67,34 +62,32 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
{ ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
{ ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
- { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_HOTKEY, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_WPS_HOTKEY, BUTTON_SCROLL_FWD, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
/* ACTION_WPS_ID3SCREEN optional */
{ ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
-// { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, /* 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 },
+ { ACTION_STD_KEYLOCK, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
+ { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
static const struct button_mapping button_context_settings[] = {
{ ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
-// { ACTION_SETTINGS_INCREPEAT, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_INCBIGSTEP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
-// { ACTION_SETTINGS_DECREPEAT, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DECBIGSTEP, BUTTON_VOL_DOWN, BUTTON_NONE },
-/* ACTION_SETTINGS_DECBIGSTEP */
{ ACTION_SETTINGS_RESET, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
-/* ACTION_SETTINGS_SET, Used by touchscreen targets */
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
}; /* button_context_settings */
@@ -117,9 +110,9 @@ static const struct button_mapping button_context_tree[] = {
/*
{ ACTION_TREE_WPS, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
- { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
*/
- { ACTION_STD_MENU, BUTTON_MENU, BUTTON_MENU },
+ { ACTION_TREE_HOTKEY, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */
@@ -133,10 +126,10 @@ static const struct button_mapping button_context_yesno[] = {
static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_TOP, BUTTON_PREV|BUTTON_REL, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_QS_DOWN, BUTTON_SCROLL_FWD|BUTTON_REL, BUTTON_NONE },
- { ACTION_QS_LEFT, BUTTON_SCROLL_BACK|BUTTON_REL, BUTTON_NONE },
- { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
- { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_QS_RIGHT, BUTTON_SCROLL_FWD, BUTTON_NONE },
+ { ACTION_QS_LEFT, BUTTON_SCROLL_BACK, BUTTON_NONE },
+ { ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_QS_DOWN, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
LAST_ITEM_IN_LIST
@@ -150,12 +143,9 @@ static const struct button_mapping button_context_settings_time[] = {
{ ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
{ ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
-// { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
-// { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
- //LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
}; /* button_context_settings_time */
static const struct button_mapping button_context_pitchscreen[] = {
@@ -164,9 +154,7 @@ static const struct button_mapping button_context_pitchscreen[] = {
{ ACTION_PS_DEC_SMALL, BUTTON_SCROLL_BACK, BUTTON_NONE },
{ ACTION_PS_DEC_BIG, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_PS_NUDGE_LEFT, BUTTON_PREV, BUTTON_NONE },
-/* { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, */
{ ACTION_PS_NUDGE_RIGHT, BUTTON_NEXT, BUTTON_NONE },
-/* { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, */
{ ACTION_PS_TOGGLE_MODE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_PS_RESET, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
diff --git a/apps/keymaps/keymap-fiiom3k.c b/apps/keymaps/keymap-fiiom3k.c
index e562443227..94d2dbc172 100644
--- a/apps/keymaps/keymap-fiiom3k.c
+++ b/apps/keymaps/keymap-fiiom3k.c
@@ -76,6 +76,16 @@ static const struct button_mapping button_context_wps[] = {
LAST_ITEM_IN_LIST
}; /* button_context_wps */
+static const struct button_mapping button_context_wps_locked[] = {
+ {ACTION_WPS_SKIPNEXT, BUTTON_VOL_UP|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_UP},
+ {ACTION_WPS_SEEKFWD, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_WPS_STOPSEEK, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_UP|BUTTON_REPEAT},
+ {ACTION_WPS_SKIPPREV, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_DOWN},
+ {ACTION_WPS_SEEKBACK, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_WPS_STOPSEEK, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_PLAY|BUTTON_VOL_DOWN|BUTTON_REPEAT},
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_WPS)
+}; /* button_context_wps_locked */
+
static const struct button_mapping button_context_tree[] = {
{ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
{ACTION_TREE_WPS, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK},
@@ -185,10 +195,74 @@ static const struct button_mapping button_context_keyboard[] = {
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
+static const struct button_mapping button_context_usb_hid[] = {
+ {ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER, BUTTON_NONE},
+ LAST_ITEM_IN_LIST,
+}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
+ {ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_VOL_DOWN|BUTTON_PLAY, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
+ {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
+ {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT, BUTTON_NONE},
+ {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT, BUTTON_NONE},
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_multimedia */
+
+static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
+ {ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
+ {ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
+ {ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT},
+ {ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
+ {ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT},
+ {ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT},
+ {ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_VOL_UP, BUTTON_NONE},
+ {ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_VOL_DOWN, BUTTON_NONE},
+ {ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_MENU, BUTTON_NONE},
+ {ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BACK, BUTTON_NONE},
+ {ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
+ {ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_presentation */
+
+static const struct button_mapping button_context_usb_hid_mode_browser[] = {
+ {ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE},
+ {ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
+ {ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT},
+ {ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
+ {ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
+ {ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT},
+ {ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT},
+ {ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_browser */
+
const struct button_mapping* get_context_mapping(int context)
{
switch (context)
{
+ case CONTEXT_WPS|CONTEXT_LOCKED:
+ return button_context_wps_locked;
+ default:
+ context &= ~CONTEXT_LOCKED;
+ break;
+ }
+
+ switch (context)
+ {
default:
case CONTEXT_STD:
return button_context_standard;
@@ -215,5 +289,13 @@ const struct button_mapping* get_context_mapping(int context)
return button_context_yesnoscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
+ case CONTEXT_USB_HID:
+ return button_context_usb_hid;
+ case CONTEXT_USB_HID_MODE_MULTIMEDIA:
+ return button_context_usb_hid_mode_multimedia;
+ case CONTEXT_USB_HID_MODE_PRESENTATION:
+ return button_context_usb_hid_mode_presentation;
+ case CONTEXT_USB_HID_MODE_BROWSER:
+ return button_context_usb_hid_mode_browser;
}
}
diff --git a/apps/keymaps/keymap-iaudio67.c b/apps/keymaps/keymap-iaudio67.c
deleted file mode 100644
index 5c62a73dd0..0000000000
--- a/apps/keymaps/keymap-iaudio67.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2007 Mark Arigo
- *
- * 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.
- *
- ****************************************************************************/
-/* Button Code Definitions for Iaudio[67] target */
-
-#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_RIGHT|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_NEXT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_STOP|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
-
- { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
- { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
-// { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_PLAY, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_standard */
-
-
-static const struct button_mapping button_context_wps[] = {
-
- { 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_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
- { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
-
- { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
-
- { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
-
- { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
-#ifdef HAVE_HOTKEY
- { ACTION_WPS_HOTKEY, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
-#else
- { ACTION_WPS_VIEW_PLAYLIST, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
-#endif
- { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_wps */
-
-static const struct button_mapping button_context_settings[] = {
- { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
-// { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
-
- { ACTION_SETTINGS_INC, BUTTON_VOLUP|BUTTON_REL, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_PREV, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_PREVREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_NEXT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
- { ACTION_STD_NEXTREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings */
-
-static const struct button_mapping button_context_list[] = {
-#ifdef HAVE_VOLUME_IN_LIST
- { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REL, BUTTON_NONE },
-
- { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REL, 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_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC },
- // { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP },
-#ifdef HAVE_HOTKEY
- // { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
-#endif
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_tree */
-
-static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
-#if 0
- { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
- { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-#endif
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_without_combo */
-
-static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_TREE_ROOT_INIT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_REC|BUTTON_LEFT },
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_with_combo */
-
-static const struct button_mapping button_context_yesno[] = {
-// { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings_yesno */
-
-static const struct button_mapping button_context_quickscreen[] = {
-#if 0
- { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
-
- { ACTION_QS_TOP, BUTTON_VOLUP|BUTTON_REL, BUTTON_NONE },
- { ACTION_QS_TOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_QS_DOWN, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_NONE },
- { ACTION_QS_DOWN, BUTTON_VOLDOWN|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 },
-#endif
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_quickscreen */
-
-static const struct button_mapping button_context_settings_right_is_inc[] = {
-#if 0
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
-#endif
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings_right_is_inc */
-
-static const struct button_mapping button_context_pitchscreen[] = {
-#if 0
- { 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_RESET, BUTTON_PLAY, BUTTON_NONE },
- { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE },
-
- { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
-#endif
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_pitchscreen */
-
-/** Recording Screen **/
-#ifdef HAVE_RECORDING
-static const struct button_mapping button_context_recscreen[] = {
- { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
- { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
-// { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
-
- { ACTION_SETTINGS_INC, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
-}; /* button_context_recscreen */
-#endif
-
-/** FM Radio Screen **/
-#if CONFIG_TUNER
-static const struct button_mapping button_context_radio[] = {
- { ACTION_FM_MENU, BUTTON_MENU | BUTTON_REL, BUTTON_MENU },
- { ACTION_FM_MODE, BUTTON_MENU | BUTTON_REPEAT, BUTTON_MENU },
- { ACTION_FM_PRESET, BUTTON_STOP, BUTTON_NONE },
- { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_NONE },
- { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
-}; /* button_context_radio */
-#endif
-
-static const struct button_mapping button_context_keyboard[] = {
- { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
- { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
- { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
-// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REL, BUTTON_NONE },
- { ACTION_KBD_UP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
-
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
-
-// { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_PLAY, BUTTON_REC },
-
- { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
- { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
- { ACTION_KBD_ABORT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_keyboard */
-
-static const struct button_mapping button_context_bmark[] = {
-// { ACTION_BMS_DELETE, BUTTON_REC, 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_TREE:
- case CONTEXT_MAINMENU:
- if (global_settings.hold_lr_for_scroll_in_list)
- return button_context_listtree_scroll_without_combo;
- else
- return button_context_listtree_scroll_with_combo;
- case CONTEXT_CUSTOM|CONTEXT_TREE:
- return button_context_tree;
-
- case CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_TIME:
- return button_context_settings;
- case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_COLOURCHOOSER:
- case CONTEXT_SETTINGS_EQ:
- return button_context_settings_right_is_inc;
-
- case CONTEXT_YESNOSCREEN:
- return button_context_yesno;
-#if CONFIG_TUNER
- case CONTEXT_FM:
- return button_context_radio;
-#endif
- case CONTEXT_BOOKMARKSCREEN:
- return button_context_bmark;
- case CONTEXT_QUICKSCREEN:
- return button_context_quickscreen;
- case CONTEXT_PITCHSCREEN:
- return button_context_pitchscreen;
-#ifdef HAVE_RECORDING
- case CONTEXT_RECSCREEN:
- return button_context_recscreen;
-#endif
- case CONTEXT_KEYBOARD:
- return button_context_keyboard;
-
- default:
- return button_context_standard;
- }
-
- return button_context_standard;
-}
diff --git a/apps/keymaps/keymap-ifp7xx.c b/apps/keymaps/keymap-ifp7xx.c
deleted file mode 100644
index c89b60e747..0000000000
--- a/apps/keymaps/keymap-ifp7xx.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 Tomasz Malesinski
- *
- * 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.
- *
- ****************************************************************************/
-
-/* Button Code Definitions for iriver iFP7xx target */
-
-#include "config.h"
-#include "action.h"
-#include "button.h"
-
-/*
- * 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_CANCEL, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
- { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT },
-
- { ACTION_STD_QUICKSCREEN, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
- { ACTION_STD_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_standard */
-
-static const struct button_mapping button_context_wps[] = {
- { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
- { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { 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_ABSETB_NEXTDIR, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
- { ACTION_WPS_ABSETA_PREVDIR, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
- { ACTION_WPS_STOP, BUTTON_EQ, BUTTON_NONE },
- { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
- { ACTION_WPS_QUICKSCREEN, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
- { ACTION_WPS_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_SELECT, BUTTON_PLAY },
- { ACTION_WPS_HOTKEY, BUTTON_PLAY|BUTTON_MODE, BUTTON_PLAY },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_wps */
-
-static const struct button_mapping button_context_settings[] = {
- { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
-}; /* button_context_settings */
-
-static const struct button_mapping button_context_settings_r_is_inc[] = {
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { 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 },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
-}; /* button_context_settingsgraphical */
-
-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_bmark[] = {
- { ACTION_BMS_DELETE, BUTTON_MODE, BUTTON_NONE },
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_settings_bmark */
-
-static const struct button_mapping button_context_quickscreen[] = {
- { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
- { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_QS_RIGHT, BUTTON_RIGHT, 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_pitchscreen[] = {
- { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
- { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_PS_DEC_BIG, BUTTON_DOWN|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_RESET, BUTTON_MODE, BUTTON_NONE },
- { ACTION_PS_EXIT, BUTTON_PLAY, 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_pitchcreen */
-
-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_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_KBD_DONE, BUTTON_MODE, BUTTON_NONE },
- { ACTION_KBD_ABORT, BUTTON_PLAY, BUTTON_NONE },
- { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
- { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_keyboard */
-
-/* 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_CUSTOM|CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_EQ:
- case CONTEXT_SETTINGS_COLOURCHOOSER:
- case CONTEXT_SETTINGS_TIME:
- return button_context_settings_r_is_inc;
- case CONTEXT_SETTINGS:
- return button_context_settings;
- 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:
- return button_context_keyboard;
- }
- return button_context_standard;
-}
diff --git a/apps/keymaps/keymap-logikdax.c b/apps/keymaps/keymap-logikdax.c
deleted file mode 100644
index 20c23031ef..0000000000
--- a/apps/keymaps/keymap-logikdax.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2008 Dave Chapman
- *
- * 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.
- *
- ****************************************************************************/
-/* Button Code Definitions for Sandisk c200 target */
-
-#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_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
-// { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_standard */
-
-
-static const struct button_mapping button_context_wps[] = {
- { ACTION_WPS_PLAY, BUTTON_POWERPLAY|BUTTON_REL, BUTTON_POWERPLAY },
- { ACTION_WPS_STOP, BUTTON_POWERPLAY|BUTTON_REPEAT, BUTTON_POWERPLAY },
-
- { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
-
- { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
-
- { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_MODE|BUTTON_RIGHT, BUTTON_MODE },
- { ACTION_WPS_ABSETA_PREVDIR,BUTTON_MODE|BUTTON_LEFT, BUTTON_MODE },
- { ACTION_WPS_ABRESET, BUTTON_MODE|BUTTON_UP, BUTTON_MODE },
-
- { ACTION_WPS_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
-#if 0
- { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
- { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
- { ACTION_WPS_CONTEXT, BUTTON_VOLDOWN|BUTTON_REL, BUTTON_VOLDOWN },
- { ACTION_WPS_QUICKSCREEN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_VOLDOWN },
-#endif
-
- LAST_ITEM_IN_LIST
-}; /* button_context_wps */
-
-static const struct button_mapping button_context_settings[] = {
- { ACTION_STD_CANCEL, BUTTON_REC, BUTTON_NONE },
- { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
-
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { 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 },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings */
-
-static const struct button_mapping button_context_list[] = {
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
-}; /* button_context_list */
-
-static const struct button_mapping button_context_tree[] = {
- // { ACTION_TREE_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC },
- // { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_tree */
-
-static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
- { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
- { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
- { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
- { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_without_combo */
-
-static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_TREE_ROOT_INIT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_REC|BUTTON_LEFT },
-// { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
-}; /* button_context_listtree_scroll_with_combo */
-
-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_NONE, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_STD_CANCEL, BUTTON_MODE|BUTTON_REL, BUTTON_NONE },
-
- { 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_right_is_inc[] = {
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_STD_CANCEL, BUTTON_MODE, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
-}; /* button_context_settings_right_is_inc */
-
-static const struct button_mapping button_context_pitchscreen[] = {
- { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
- { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
-
- { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_PS_DEC_BIG, BUTTON_DOWN|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_RESET, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_PS_EXIT, BUTTON_MODE, 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 */
-
-/** Recording Screen **/
-#ifdef HAVE_RECORDING
-static const struct button_mapping button_context_recscreen[] = {
- { ACTION_STD_MENU, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_REC_PAUSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
- { ACTION_STD_CANCEL, BUTTON_MODE|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
-
- { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
-}; /* button_context_recscreen */
-#endif
-
-/** FM Radio Screen **/
-#if CONFIG_TUNER
-static const struct button_mapping button_context_radio[] = {
- { ACTION_NONE, BUTTON_UP, BUTTON_NONE },
- { ACTION_FM_MENU, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_FM_PRESET, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_FM_STOP, BUTTON_POWERPLAY|BUTTON_REPEAT, BUTTON_POWERPLAY },
- { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE },
- { ACTION_FM_EXIT, BUTTON_MODE|BUTTON_REL, BUTTON_MODE },
- { ACTION_FM_PLAY, BUTTON_POWERPLAY|BUTTON_REL, BUTTON_POWERPLAY },
- { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
- { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
-}; /* button_context_radio */
-#endif
-
-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_REC|BUTTON_LEFT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_LEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_NONE },
-// { ACTION_KBD_CURSOR_RIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
-
- { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
- { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
- { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
-
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN, BUTTON_NONE },
-// { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_VOLDOWN|BUTTON_REPEAT,BUTTON_NONE },
-
-// { ACTION_KBD_PAGE_FLIP, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
-
- { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
- { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
- { ACTION_KBD_ABORT, BUTTON_MODE, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST
-}; /* button_context_keyboard */
-
-static const struct button_mapping button_context_bmark[] = {
-// { ACTION_BMS_DELETE, BUTTON_REC, 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_TREE:
- case CONTEXT_MAINMENU:
- if (global_settings.hold_lr_for_scroll_in_list)
- return button_context_listtree_scroll_without_combo;
- else
- return button_context_listtree_scroll_with_combo;
- case CONTEXT_CUSTOM|CONTEXT_TREE:
- return button_context_tree;
-
- case CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_TIME:
- return button_context_settings;
- case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
- case CONTEXT_SETTINGS_COLOURCHOOSER:
- case CONTEXT_SETTINGS_EQ:
- return button_context_settings_right_is_inc;
-
- case CONTEXT_YESNOSCREEN:
- return button_context_yesno;
-#if CONFIG_TUNER
- case CONTEXT_FM:
- return button_context_radio;
-#endif
- case CONTEXT_BOOKMARKSCREEN:
- return button_context_bmark;
- case CONTEXT_QUICKSCREEN:
- return button_context_quickscreen;
- case CONTEXT_PITCHSCREEN:
- return button_context_pitchscreen;
-#ifdef HAVE_RECORDING
- case CONTEXT_RECSCREEN:
- return button_context_recscreen;
-#endif
- case CONTEXT_KEYBOARD:
- return button_context_keyboard;
-
- default:
- return button_context_standard;
- }
- return button_context_standard;
-}
diff --git a/apps/lang/english-us.lang b/apps/lang/english-us.lang
index 8ddf4a82d0..9439236b9c 100644
--- a/apps/lang/english-us.lang
+++ b/apps/lang/english-us.lang
@@ -5992,12 +5992,10 @@
<source>
*: "Battery: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Batt: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</source>
<dest>
*: "Battery: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Batt: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</dest>
<voice>
*: "Battery level"
@@ -15080,7 +15078,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15095,7 +15093,7 @@
<dest>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15110,7 +15108,7 @@
<voice>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15704,3 +15702,17 @@
*: "Always Autolock"
</voice>
</phrase>
+<phrase>
+ id: LANG_PLAYLIST_RELOAD_AFTER_SAVE
+ desc: reload playlist after saving
+ user: core
+ <source>
+ *: "Reload After Saving"
+ </source>
+ <dest>
+ *: "Reload After Saving"
+ </dest>
+ <voice>
+ *: "Reload After Saving"
+ </voice>
+</phrase>
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 9ca4c84430..4cbc6f30f6 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -57,7 +57,6 @@
# H120/H140 iriverh120
# H320/H340 iriverh300
# H10 iriverh10
-# IFP 7XX iriverifp7xx
# iaudio/Cowon
# X5 iaudiox5
# M5 iaudiom5
@@ -6069,12 +6068,10 @@
<source>
*: "Battery: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Batt: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</source>
<dest>
*: "Battery: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Batt: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</dest>
<voice>
*: "Battery level"
@@ -15239,7 +15236,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15254,7 +15251,7 @@
<dest>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15269,7 +15266,7 @@
<voice>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15781,3 +15778,17 @@
*: "Always Autolock"
</voice>
</phrase>
+<phrase>
+ id: LANG_PLAYLIST_RELOAD_AFTER_SAVE
+ desc: reload playlist after saving
+ user: core
+ <source>
+ *: "Reload After Saving"
+ </source>
+ <dest>
+ *: "Reload After Saving"
+ </dest>
+ <voice>
+ *: "Reload After Saving"
+ </voice>
+</phrase>
diff --git a/apps/lang/italiano.lang b/apps/lang/italiano.lang
index dc8cd4be1d..559b53127d 100644
--- a/apps/lang/italiano.lang
+++ b/apps/lang/italiano.lang
@@ -15031,7 +15031,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15046,7 +15046,7 @@
<dest>
*: "Premere LEFT per annullare."
android,hifietma*,zenvision: "Premere BACK per annullare."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Premere POWER per annullare."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Premere POWER per annullare."
ihifi760,ihifi960: "Premere due volte RETURN per annullare."
ihifi770,ihifi770c,ihifi800: "Premere HOME per annullare."
iriverh10,samsungyh*: "Premere due volte LEFT per annullare."
@@ -15061,7 +15061,7 @@
<voice>
*: "Premere LEFT per annullare."
android,hifietma*,zenvision: "Premere BACK per annullare."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Premere POWER per annullare."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Premere POWER per annullare."
ihifi760,ihifi960: "Premere due volte RETURN per annullare."
ihifi770,ihifi770c,ihifi800: "Premere HOME per annullare."
iriverh10,samsungyh*: "Premere due volte LEFT per annullare."
diff --git a/apps/lang/nederlands.lang b/apps/lang/nederlands.lang
index a6a68ed1e6..3e7abc613d 100644
--- a/apps/lang/nederlands.lang
+++ b/apps/lang/nederlands.lang
@@ -15104,7 +15104,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15120,7 +15120,7 @@
*: "Druk op LINKS om te annuleren."
android: "Druk op RECHTS om te annuleren."
hifietma*,zenvision: "Druk op BACK om te annuleren."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Druk op POWER om te annuleren."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Druk op POWER om te annuleren."
ihifi760,ihifi960: "Dubbeltik op RETURN om te annuleren."
ihifi770,ihifi770c,ihifi800: "Druk op HOME om te annuleren."
iriverh10,samsungyh*: "Dubbeltik op LINKS om te annuleren."
@@ -15136,7 +15136,7 @@
*: "Druk op LINKS om te annuleren."
android: "Druk op RECHTS om te annuleren."
hifietma*,zenvision: "Druk op BACK om te annuleren."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Druk op POWER om te annuleren."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Druk op POWER om te annuleren."
ihifi760,ihifi960: "Dubbeltik op RETURN om te annuleren."
ihifi770,ihifi770c,ihifi800: "Druk op HOME om te annuleren."
iriverh10,samsungyh*: "Dubbeltik op LINKS om te annuleren."
diff --git a/apps/lang/polski.lang b/apps/lang/polski.lang
index 6832ccdc87..ea426691a7 100644
--- a/apps/lang/polski.lang
+++ b/apps/lang/polski.lang
@@ -6001,12 +6001,10 @@
<source>
*: "Battery: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Batt: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</source>
<dest>
*: "Bateria: %d%% %dh %dm"
ipodmini1g,ipodmini2g,iriverh10: "Bateria: %d%% %dh %dm"
- iriverifp7xx: "%d%% %dh %dm"
</dest>
<voice>
*: "Poziom baterii"
@@ -9620,15 +9618,15 @@
user: core
<source>
*: none
- gigabeatfx,sansafuzeplus: "Touchpad Sensitivity"
+ fiiom3k,gigabeatfx,sansafuzeplus: "Touchpad Sensitivity"
</source>
<dest>
*: none
- gigabeatfx,sansafuzeplus: "Czułość panelu dotykowego"
+ fiiom3k,gigabeatfx,sansafuzeplus: "Czułość panelu dotykowego"
</dest>
<voice>
*: none
- gigabeatfx,sansafuzeplus: "Czułość panelu dotykowego"
+ fiiom3k,gigabeatfx,sansafuzeplus: "Czułość panelu dotykowego"
</voice>
</phrase>
<phrase>
@@ -15038,7 +15036,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15053,7 +15051,7 @@
<dest>
*: "Wciśnij LEFT, aby anulować."
android,hifietma*,zenvision: "Wciśnij BACK, aby anulować."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Wciśnij POWER, aby anulować."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Wciśnij POWER, aby anulować."
ihifi760,ihifi960: "Podwójnie stuknij RETURN, aby anulować."
ihifi770,ihifi770c,ihifi800: "Wciśnij HOME, aby anulować."
iriverh10,samsungyh*: "Podwójnie stuknij LEFT, aby anulować."
@@ -15068,7 +15066,7 @@
<voice>
*: "Wciśnij left, aby anulować."
android,hifietma*,zenvision: "Wciśnij bak, aby anulować."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Wciśnij pałer, aby anulować."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Wciśnij pałer, aby anulować."
ihifi760,ihifi960: "Podwójnie stuknij ritern, aby anulować."
ihifi770,ihifi770c,ihifi800: "Wciśnij hołm, aby anulować."
iriverh10,samsungyh*: "Podwójnie stuknij left, aby anulować."
@@ -15699,3 +15697,31 @@
*: "Zwolnij głośność"
</voice>
</phrase>
+<phrase>
+ id: LANG_ACTION_ALWAYSAUTOLOCK
+ desc: always prime autolock
+ user: core
+ <source>
+ *: "Always Autolock"
+ </source>
+ <dest>
+ *: "Zawsze automatycznie blokuj"
+ </dest>
+ <voice>
+ *: "Zawsze automatycznie blokuj"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_PLAYLIST_RELOAD_AFTER_SAVE
+ desc: reload playlist after saving
+ user: core
+ <source>
+ *: "Reload After Saving"
+ </source>
+ <dest>
+ *: "Załaduj ponownie po zapisaniu"
+ </dest>
+ <voice>
+ *: "Załaduj ponownie po zapisaniu"
+ </voice>
+</phrase>
diff --git a/apps/lang/russian.lang b/apps/lang/russian.lang
index 6364c71c0b..9d71ad819c 100644
--- a/apps/lang/russian.lang
+++ b/apps/lang/russian.lang
@@ -15161,7 +15161,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15176,7 +15176,7 @@
<dest>
*: "Нажмите ВЛЕВО для отмены."
android,hifietma*,zenvision: "Нажмите НАЗАД для отмены."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Нажмите ВКЛ. для отмены."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Нажмите ВКЛ. для отмены."
ihifi760,ihifi960: "Дважды нажмите ВОЗВРАТ для отмены."
ihifi770,ihifi770c,ihifi800: "Нажмите ДОМОЙ для отмены."
iriverh10,samsungyh*: "Дважды нажмите ВЛЕВО для отмены."
@@ -15191,7 +15191,7 @@
<voice>
*: "Нажмите кнопку Влево для отмены."
android,hifietma*,zenvision: "Нажмите кнопку Назад для отмены."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Нажмите кнопку включения для отмены."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Нажмите кнопку включения для отмены."
ihifi760,ihifi960: "Дважды нажмите кнопку Назад для отмены."
ihifi770,ihifi770c,ihifi800: "Нажмите кнопку Домой для отмены."
iriverh10,samsungyh*: "Дважды нажмите кнопку Влево для отмены."
diff --git a/apps/lang/slovak.lang b/apps/lang/slovak.lang
index 65015a5990..00f98ecd35 100644
--- a/apps/lang/slovak.lang
+++ b/apps/lang/slovak.lang
@@ -15056,7 +15056,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15071,7 +15071,7 @@
<dest>
*: "Stlačte LEFT pre zrušenie"
android: "Stlačte späť pre zrušenie"
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Stlačte POWER pre zrušenie"
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Stlačte POWER pre zrušenie"
hifietma*,zenvision: "Stlačte BACK Pre zrušenie"
ihifi760,ihifi960: "Poklepte RETURN pre zrušenie"
ihifi770,ihifi770c,ihifi800: "Stlačte HOME pre zrušenie"
@@ -15087,7 +15087,7 @@
<voice>
*: "Stlačte LEFT pre zrušenie"
android: "Stlačte späť pre zrušenie"
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Stlačte POWER pre zrušenie"
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Stlačte POWER pre zrušenie"
hifietma*,zenvision: "Stlačte BACK Pre zrušenie"
ihifi760,ihifi960: "Poklepte RETURN pre zrušenie"
ihifi770,ihifi770c,ihifi800: "Stlačte HOME pre zrušenie"
diff --git a/apps/lang/srpski.lang b/apps/lang/srpski.lang
index db93124c8f..95063ca0c0 100644
--- a/apps/lang/srpski.lang
+++ b/apps/lang/srpski.lang
@@ -15318,7 +15318,7 @@
<source>
*: "Press LEFT to cancel."
android,hifietma*,zenvision: "Press BACK to cancel."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Press POWER to cancel."
ihifi760,ihifi960: "Double tap RETURN to cancel."
ihifi770,ihifi770c,ihifi800: "Press HOME to cancel."
iriverh10,samsungyh*: "Double tap LEFT to cancel."
@@ -15333,7 +15333,7 @@
<dest>
*: "Притисните LEFT за прекид."
android,hifietma*,zenvision: "Притисните BACK за прекид."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Притисните POWER за прекид."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Притисните POWER за прекид."
ihifi760,ihifi960: "Дупли тап RETURN за прекид."
ihifi770,ihifi770c,ihifi800: "Притисните HOME за прекид."
iriverh10,samsungyh*: "Дупли тап LEFT за прекид."
@@ -15348,7 +15348,7 @@
<voice>
*: "Притисните LEFT за прекид."
android,hifietma*,zenvision: "Притисните BACK за прекид."
- cowond2,creativezenxfi2,iaudio7,ibassodx50,ibassodx90,mrobe500,ondavx747: "Притисните POWER за прекид."
+ cowond2,creativezenxfi2,ibassodx50,ibassodx90,mrobe500,ondavx747: "Притисните POWER за прекид."
ihifi760,ihifi960: "Дупли тап RETURN за прекид."
ihifi770,ihifi770c,ihifi800: "Притисните HOME за прекид."
iriverh10,samsungyh*: "Дупли тап LEFT за прекид."
diff --git a/apps/main.c b/apps/main.c
index 3c549a8e63..c7b223faea 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -321,10 +321,6 @@ static void init(void)
global_status.font_id[i] = FONT_SYSFIXED;
font_init();
show_logo();
-#ifndef USB_NONE
- usb_init();
- usb_start_monitoring();
-#endif
button_init();
powermgmt_init();
backlight_init();
@@ -374,6 +370,13 @@ static void init(void)
audio_init();
talk_announce_voice_invalid(); /* notify user w/ voice prompt if voice file invalid */
settings_apply_skins();
+
+/* do USB last so prompt (if enabled) can work correctly if USB was inserted with device off,
+ * also doesn't hurt that it will display the nice pretty backdrop this way too. */
+#ifndef USB_NONE
+ usb_init();
+ usb_start_monitoring();
+#endif
}
#else /* CONFIG_PLATFORM & PLATFORM_HOSTED */
diff --git a/apps/menu.c b/apps/menu.c
index b25aa46a2c..6279ec10a6 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -394,7 +394,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
int new_audio_status;
redraw_lists = false;
keyclick_set_callback(gui_synclist_keyclick_callback, &lists);
- action = get_action(CONTEXT_MAINMENU,
+ action = get_action(CONTEXT_MAINMENU|ALLOW_SOFTLOCK,
list_do_action_timeout(&lists, HZ));
/* query audio status to see if it changed */
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c
index 3122a4090f..b84abe0b37 100644
--- a/apps/menus/playlist_menu.c
+++ b/apps/menus/playlist_menu.c
@@ -38,9 +38,19 @@
#include "talk.h"
#include "playlist_catalog.h"
#include "splash.h"
+#include "filetree.h"
+/* load a screen to save the playlist passed in (or current playlist if NULL is passed) */
int save_playlist_screen(struct playlist_info* playlist)
{
+
+ char directoryonly[MAX_PATH+3];
+ char *filename;
+
+ int resume_index;
+ uint32_t resume_elapsed;
+ uint32_t resume_offset;
+
char temp[MAX_PATH+1], *dot;
int len;
@@ -71,6 +81,55 @@ int save_playlist_screen(struct playlist_info* playlist)
/* reload in case playlist was saved to cwd */
reload_directory();
+
+ /* only reload newly saved playlist if:
+ * playlist is null AND setting is turned on
+ *
+ * if playlist is null, we should be dealing with the current playlist,
+ * and thus we got here from the wps screen. That means we want to reload
+ * the current playlist so the user can make bookmarks. */
+ if ((global_settings.playlist_reload_after_save == true) &&
+ (playlist == NULL))
+ {
+
+ /* at least one slash exists in temp */
+ if (strrchr(temp, '/') != NULL)
+ {
+ filename = strrchr(temp, '/') + 1;
+
+ if (temp[0] == '/') /* most common situation - first char is a slash */
+ {
+ strcpy(directoryonly, temp);
+ directoryonly[filename - temp] = '\0';
+ } else /* there is a slash, but not at the beginning of temp - prepend one */
+ {
+ directoryonly[0] = '/';
+
+ strcpy(directoryonly+1, temp);
+ directoryonly[filename - temp + 1] = '\0';
+ }
+ } else /* temp doesn't contain any slashes, uncommon? */
+ {
+ directoryonly[0] = '/';
+ directoryonly[1] = '\0';
+ filename = temp;
+ }
+
+ /* can't trust index from id3 (don't know why), get it from playlist */
+ resume_index = playlist_get_current()->index;
+
+ struct mp3entry* id3 = audio_current_track();
+
+ /* record elapsed and offset so they don't change when we load new playlist */
+ resume_elapsed = id3->elapsed;
+ resume_offset = id3->offset;
+
+ ft_play_playlist(temp, directoryonly, filename, true);
+ playlist_start(resume_index, resume_elapsed, resume_offset);
+ }
+ /* cancelled out of name selection */
+ } else {
+ return 1;
}
return 0;
@@ -112,9 +171,10 @@ MAKE_MENU(viewer_settings_menu, ID2P(LANG_PLAYLISTVIEWER_SETTINGS),
MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL);
MENUITEM_SETTING(show_shuffled_adding_options, &global_settings.show_shuffled_adding_options, NULL);
MENUITEM_SETTING(show_queue_options, &global_settings.show_queue_options, NULL);
+MENUITEM_SETTING(playlist_reload_after_save, &global_settings.playlist_reload_after_save, NULL);
MAKE_MENU(currentplaylist_settings_menu, ID2P(LANG_CURRENT_PLAYLIST),
NULL, Icon_Playlist,
- &warn_on_erase, &show_shuffled_adding_options, &show_queue_options);
+ &warn_on_erase, &show_shuffled_adding_options, &show_queue_options, &playlist_reload_after_save);
MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLISTS), NULL,
Icon_Playlist,
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 4202298fa3..a5e747651a 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -73,6 +73,7 @@ static int selectivesoftlock_callback(int action,
set_selective_softlock_actions(
global_settings.bt_selective_softlock_actions,
global_settings.bt_selective_softlock_actions_mask);
+ action_autosoftlock_init();
break;
}
@@ -400,7 +401,7 @@ MENUITEM_SETTING(governor, &global_settings.governor, NULL);
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
0, Icon_System_menu,
-#if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1)
+#if (BATTERY_CAPACITY_INC > 0) || (BATTERY_TYPES_COUNT > 1) || defined(HAVE_USB_CHARGING_ENABLE)
&battery_menu,
#endif
#if defined(HAVE_DIRCACHE) || defined(HAVE_DISK_STORAGE)
diff --git a/apps/onplay.c b/apps/onplay.c
index d72f592f2e..0942d69d3f 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -456,6 +456,7 @@ static bool shuffle_playlist(void)
}
static bool save_playlist(void)
{
+ /* save_playlist_screen should load the newly saved playlist and resume */
save_playlist_screen(NULL);
return false;
}
diff --git a/apps/plugin.c b/apps/plugin.c
index 32cecc320f..a3970a88a7 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -792,6 +792,7 @@ static const struct plugin_api rockbox_api = {
#ifdef PLUGIN_USE_IRAM
audio_hard_stop,
#endif
+ crc_32r,
/* new stuff at the end, sort into place next time
the API gets incompatible */
diff --git a/apps/plugin.h b/apps/plugin.h
index 394a4dbbfd..64ced00bfa 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -919,6 +919,7 @@ struct plugin_api {
#ifdef PLUGIN_USE_IRAM
void (*audio_hard_stop)(void);
#endif
+ uint32_t (*crc_32r)(const void *src, uint32_t len, uint32_t crc32);
/* new stuff at the end, sort into place next time
the API gets incompatible */
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index f8269f5c3b..2534e3bebe 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -61,13 +61,6 @@
#define BATTERY_ON_TXT "SELECT - start"
#define BATTERY_OFF_TXT "POWER"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-#define BATTERY_ON BUTTON_SELECT
-#define BATTERY_OFF BUTTON_PLAY
-#define BATTERY_ON_TXT "SELECT - start"
-#define BATTERY_OFF_TXT "PLAY"
-
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
@@ -141,13 +134,6 @@
#define BATTERY_OFF BUTTON_POWER
#define BATTERY_OFF_TXT "POWER"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define BATTERY_OFF BUTTON_POWER
-#define BATTERY_OFF_TXT "POWER"
-#define BATTERY_ON BUTTON_PLAY
-#define BATTERY_ON_TXT "PLAY - start"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define BATTERY_ON BUTTON_PLAY
#define BATTERY_ON_TXT "PLAY - start"
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c
index 0667c31ef6..4242f5a89f 100644
--- a/apps/plugins/blackjack.c
+++ b/apps/plugins/blackjack.c
@@ -104,22 +104,6 @@ enum {
#define BJACK_RIGHT BUTTON_RIGHT
#define BJACK_LEFT BUTTON_LEFT
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define BJACK_SELECT_NAME "MODE"
-#define BJACK_STAY_NAME "MODE"
-#define BJACK_QUIT_NAME "PLAY"
-#define BJACK_DOUBLE_NAME "SELECT"
-#define BJACK_SELECT BUTTON_MODE
-#define BJACK_QUIT BUTTON_PLAY
-#define BJACK_MAX (BUTTON_EQ|BUTTON_UP)
-#define BJACK_MIN (BUTTON_EQ|BUTTON_DOWN)
-#define BJACK_STAY BUTTON_MODE
-#define BJACK_DOUBLEDOWN BUTTON_SELECT
-#define BJACK_UP BUTTON_UP
-#define BJACK_DOWN BUTTON_DOWN
-#define BJACK_RIGHT BUTTON_RIGHT
-#define BJACK_LEFT BUTTON_LEFT
-
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define BJACK_SELECT_NAME "SELECT"
#define BJACK_STAY_NAME "VOL-"
@@ -1085,7 +1069,7 @@ static void blackjack_savegame(struct game_context* bj) {
/*****************************************************************************
* blackjack_get_yes_no() gets a yes/no answer from the user
******************************************************************************/
-static unsigned int blackjack_get_yes_no(char message[20]) {
+static unsigned int blackjack_get_yes_no(const char *message) {
int button;
unsigned int w, h, b, choice = 0;
bool breakout = false;
@@ -1146,7 +1130,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) {
/*****************************************************************************
* blackjack_get_amount() gets an amount from the player to be used
******************************************************************************/
-static signed int blackjack_get_amount(const char message[20],
+static signed int blackjack_get_amount(const char *message,
signed int lower_limit,
signed int upper_limit,
signed int start) {
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 4d1b6fa594..cbaea8aa7e 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -269,19 +269,6 @@ F3: equal to "="
#define CALCULATOR_QUIT BUTTON_POWER
#define CALCULATOR_CLEAR BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define CALCULATOR_LEFT BUTTON_LEFT
-#define CALCULATOR_RIGHT BUTTON_RIGHT
-#define CALCULATOR_UP BUTTON_VOLUP
-#define CALCULATOR_DOWN BUTTON_VOLDOWN
-#define CALCULATOR_QUIT BUTTON_POWER
-#define CALCULATOR_INPUT BUTTON_PLAY
-#define CALCULATOR_CALC BUTTON_MENU
-#define CALCULATOR_CLEAR BUTTON_STOP
-
-#define CALCULATOR_RC_QUIT (BUTTON_MENU|BUTTON_PLAY)
-
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
#define CALCULATOR_LEFT BUTTON_LEFT
@@ -733,6 +720,8 @@ static void doMultiple(double* operandOne, int* powerOne,
double operandTwo, int powerTwo);
static void doAdd (double* operandOne, int* powerOne,
double operandTwo, int powerTwo);
+static void doExponent(double* operandOne, int* powerOne,
+ double operandTwo, int powerTwo);
static void printResult(void);
static void formatResult(void);
static void oneOperand(void);
@@ -740,6 +729,75 @@ static void oneOperand(void);
static void drawLines(void);
static void drawButtons(int group);
+double strtod(const char *nptr, char **endptr);
+long long atoll(const char *nptr);
+
+/* -----------------------------------------------------------------------
+Standard library function
+----------------------------------------------------------------------- */
+double strtod(const char *nptr, char **endptr)
+{
+ double out;
+ long mantissa;
+ int length=0, end=0;
+ mantissa=atoll(nptr);
+ while(!end)
+ {
+ switch(*nptr)
+ {
+ case '\0':
+ end=1;
+ break;
+ case ',':
+ case '.':
+ case '\'':
+ end=1;
+ default:
+ nptr++;
+ }
+ }
+ out=atoll(nptr);
+ while( (*nptr == '0')||(*nptr == '1')||(*nptr == '2')||(*nptr == '3')||(*nptr == '4')||
+ (*nptr == '5')||(*nptr == '6')||(*nptr == '7')||(*nptr == '8')||(*nptr == '9') )
+ {
+ nptr++;
+ length++;
+ }
+ for(;length;length--)
+ out /= 10;
+ out += mantissa;
+ if(endptr != NULL)
+ *endptr=(char *) nptr;
+ return out;
+}
+
+// WARNING Unsafe: Use strtoll instead
+long long atoll(const char *nptr)
+{
+ long long result=0;
+ char negative=0;
+ while( (*nptr == ' ') || (*nptr == '\f') || (*nptr == '\n')||
+ (*nptr == '\r') || (*nptr == '\t') || (*nptr == '\v') )
+ nptr++;
+ if(*nptr == '+')
+ nptr++;
+ if(*nptr == '-')
+ {
+ negative++;
+ nptr++;
+ }
+ while (*nptr)
+ {
+ if( (*nptr < '0') || (*nptr > '9') )
+ break;
+ result *=10;
+ result+= (*(nptr++) -'0');
+ }
+ if(negative)
+ result = 0 - result;
+ return result;
+}
+
/* -----------------------------------------------------------------------
Handy functions
----------------------------------------------------------------------- */
@@ -1062,6 +1120,93 @@ static void doMultiple(double* operandOne, int* powerOne,
}
/* -----------------------------------------------------------------------
+exponentiate in scientific number format
+----------------------------------------------------------------------- */
+static void doExponent(double* operandOne, int* powerOne,
+ double operandTwo, int powerTwo)
+{
+ char negative=0;
+ char *lastDigit;
+ char negativeBuffer[25];
+ if (*operandOne == 0)
+ {
+ if (operandTwo == 0)
+ {
+ calStatus=cal_error; // result is undefined
+ }
+ else{
+ *powerOne = 0;
+ *operandOne = 0;
+ }
+ return;
+ }
+ if (operandTwo == 0)
+ {
+ *powerOne = 1;
+ *operandOne = 0.1;
+ return;
+ }
+ if (operandTwo < 0)
+ {
+ negative+=2;
+ operandTwo= ABS(operandTwo);
+ }
+ if (*operandOne < 0)
+ {
+#if MEMORYSIZE < 8
+ (void)negativeBuffer;
+ (void)lastDigit;
+ calStatus=cal_error;
+ return;
+#else
+ if(powerTwo < 0)
+ {
+ calStatus=cal_error; // result is imaginary
+ return;
+ }
+
+ /*Truncate operandTwo to three places past the radix
+ in order to eliminate floating point artifacts
+ (function should set error if truncating a non-integer) */
+ rb->snprintf(negativeBuffer, 25, "%.*f", powerTwo+3, operandTwo);
+ operandTwo = strtod(negativeBuffer, NULL);
+
+ /*Truncate operandTwo to powerTwo digits by way of string
+ in order to confirm operandTwo *10^powerTwo is an integer*/
+ rb->snprintf(negativeBuffer, 25, "%.*f", powerTwo, operandTwo);
+
+ if(strtod(negativeBuffer, &lastDigit) != operandTwo)
+ {
+ calStatus=cal_error; // result is imaginary
+ return;
+ }
+ if(rb->atoi(lastDigit-1) % 2)
+ negative++;
+#endif
+ }
+ (*operandOne) = myLn(ABS(*operandOne)) + (double) (*powerOne) * 2.302585092994046;
+ (*powerOne) = 0;
+ doMultiple(operandOne, powerOne, ABS(operandTwo), powerTwo);
+ while(*powerOne)
+ {
+ if(*powerOne > 0)
+ {
+ (*operandOne) *= 10;
+ (*powerOne) --;
+ }
+ else{
+ (*operandOne) /= 10;
+ (*powerOne) ++;
+ }
+ }
+ (*operandOne) = myExp(*operandOne);
+ if(negative & 2)
+ (*operandOne) = 1/(*operandOne);
+ if(negative & 1)
+ *operandOne = -(*operandOne);
+}
+
+/* -----------------------------------------------------------------------
Handles all one operand calculations
----------------------------------------------------------------------- */
static void oneOperand(void)
@@ -1205,6 +1350,9 @@ static void twoOperands(void)
else
calStatus = cal_error;
break;
+ case '^':
+ doExponent(&operand, &operandPower, result, power);
+ break;
default: /* ' ' */
switchOperands(); /* counter switchOperands() below */
break;
@@ -1697,7 +1845,9 @@ static void basicButtonsProcess(void){
#ifdef CALCULATOR_OPERATORS
case_cycle_operators: /* F2 shortkey entrance */
#endif
- calStatus = cal_normal;
+ if (calStatus == cal_typing ||
+ calStatus == cal_dotted)
+ calStatus = cal_normal;
formatResult();
operand = result;
operandPower = power;
@@ -1753,8 +1903,14 @@ static void sciButtonsProcess(void){
break;
case sci_xy:
- /*Not implemented yet
- Maybe it could use x^y = exp(y*ln(x))*/
+ if(!operInputted) {twoOperands(); operInputted = true;}
+ oper = '^';
+ if (calStatus == cal_typing ||
+ calStatus == cal_dotted)
+ calStatus = cal_normal;
+ formatResult();
+ operand = result;
+ operandPower = power;
break;
case sci_sci:
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 54173fde1c..e7f221a3c9 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -68,16 +68,6 @@
#define CALENDAR_NEXT_MONTH BUTTON_VOL_DOWN
#define CALENDAR_PREV_MONTH BUTTON_VOL_UP
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CALENDAR_QUIT BUTTON_PLAY
-#define CALENDAR_SELECT BUTTON_SELECT
-#define CALENDAR_NEXT_WEEK BUTTON_DOWN
-#define CALENDAR_PREV_WEEK BUTTON_UP
-#define CALENDAR_NEXT_DAY BUTTON_RIGHT
-#define CALENDAR_PREV_DAY BUTTON_LEFT
-#define CALENDAR_NEXT_MONTH BUTTON_MODE
-#define CALENDAR_PREV_MONTH BUTTON_EQ
-
#elif CONFIG_KEYPAD == SANSA_E200_PAD
#define CALENDAR_QUIT BUTTON_POWER
#define CALENDAR_SELECT BUTTON_SELECT
diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h
index 5bfce10ec5..827f045a4b 100644
--- a/apps/plugins/chessbox/chessbox_pgn.h
+++ b/apps/plugins/chessbox/chessbox_pgn.h
@@ -70,20 +70,6 @@
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CB_SELECT BUTTON_SELECT
-#define CB_UP BUTTON_UP
-#define CB_DOWN BUTTON_DOWN
-#define CB_LEFT BUTTON_LEFT
-#define CB_RIGHT BUTTON_RIGHT
-#define CB_PLAY BUTTON_PLAY
-#define CB_LEVEL BUTTON_EQ
-#define CB_MENU BUTTON_MODE
-#define CB_SCROLL_UP (BUTTON_UP|BUTTON_REPEAT)
-#define CB_SCROLL_DOWN (BUTTON_DOWN|BUTTON_REPEAT)
-#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
-#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
-
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
#define CB_SELECT BUTTON_SELECT
#define CB_UP BUTTON_UP
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 9a30dee984..91b04e713a 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -46,16 +46,6 @@
#define CHC_SETTINGS_OK BUTTON_SELECT
#define CHC_SETTINGS_CANCEL BUTTON_MENU
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CHC_QUIT BUTTON_PLAY
-#define CHC_STARTSTOP BUTTON_MODE
-#define CHC_RESET BUTTON_EQ
-#define CHC_MENU BUTTON_SELECT
-#define CHC_SETTINGS_INC BUTTON_RIGHT
-#define CHC_SETTINGS_DEC BUTTON_LEFT
-#define CHC_SETTINGS_OK BUTTON_SELECT
-#define CHC_SETTINGS_CANCEL BUTTON_PLAY
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define CHC_QUIT BUTTON_REC
#define CHC_STARTSTOP BUTTON_PLAY
@@ -157,17 +147,6 @@
#define CHC_SETTINGS_DEC BUTTON_MINUS
#define CHC_SETTINGS_CANCEL BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define CHC_QUIT BUTTON_POWER
-#define CHC_STARTSTOP BUTTON_PLAY
-#define CHC_RESET BUTTON_LEFT
-#define CHC_MENU BUTTON_MENU
-#define CHC_SETTINGS_INC BUTTON_VOLUP
-#define CHC_SETTINGS_DEC BUTTON_VOLDOWN
-#define CHC_SETTINGS_OK BUTTON_PLAY
-#define CHC_SETTINGS_OK2 BUTTON_LEFT
-#define CHC_SETTINGS_CANCEL BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define CHC_QUIT BUTTON_BACK
#define CHC_STARTSTOP BUTTON_PLAY
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c
index ab8f7b5540..70763a1b67 100644
--- a/apps/plugins/chopper.c
+++ b/apps/plugins/chopper.c
@@ -108,12 +108,6 @@ Still To do:
#define QUIT BUTTON_POWER
#define ACTION2 BUTTON_PLUS
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define QUIT BUTTON_POWER
-#define ACTION BUTTON_PLAY
-#define ACTION2 BUTTON_STOP
-#define ACTIONTEXT "PLAY"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
#define ACTION BUTTON_UP
diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c
index f1f21f6312..c127a300f2 100644
--- a/apps/plugins/clix.c
+++ b/apps/plugins/clix.c
@@ -100,14 +100,6 @@
#define CLIX_BUTTON_UP BUTTON_SCROLL_UP
#define CLIX_BUTTON_DOWN BUTTON_SCROLL_DOWN
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define CLIX_BUTTON_QUIT BUTTON_POWER
-#define CLIX_BUTTON_LEFT BUTTON_LEFT
-#define CLIX_BUTTON_RIGHT BUTTON_RIGHT
-#define CLIX_BUTTON_CLICK BUTTON_PLAY
-#define CLIX_BUTTON_UP BUTTON_STOP
-#define CLIX_BUTTON_DOWN BUTTON_PLAY
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define CLIX_BUTTON_QUIT BUTTON_POWER
#define CLIX_BUTTON_LEFT BUTTON_LEFT
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 6587fdcb65..857f2415d4 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -62,16 +62,6 @@
#define CUBE_HIGHSPEED_PRE BUTTON_SELECT
#define CUBE_HIGHSPEED (BUTTON_SELECT | BUTTON_REL)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define CUBE_QUIT BUTTON_PLAY
-#define CUBE_NEXT BUTTON_RIGHT
-#define CUBE_PREV BUTTON_LEFT
-#define CUBE_INC BUTTON_UP
-#define CUBE_DEC BUTTON_DOWN
-#define CUBE_MODE BUTTON_MODE
-#define CUBE_PAUSE BUTTON_SELECT
-#define CUBE_HIGHSPEED BUTTON_EQ
-
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
#define CUBE_QUIT BUTTON_POWER
#define CUBE_NEXT BUTTON_RIGHT
@@ -171,16 +161,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define CUBE_QUIT BUTTON_POWER
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
-#define CUBE_QUIT BUTTON_POWER
-#define CUBE_NEXT BUTTON_RIGHT
-#define CUBE_PREV BUTTON_LEFT
-#define CUBE_INC BUTTON_VOLUP
-#define CUBE_DEC BUTTON_VOLDOWN
-#define CUBE_MODE BUTTON_MENU
-#define CUBE_PAUSE BUTTON_PLAY
-#define CUBE_HIGHSPEED BUTTON_STOP
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define CUBE_QUIT BUTTON_BACK
#define CUBE_NEXT BUTTON_RIGHT
diff --git a/apps/plugins/doom/doomdef.c b/apps/plugins/doom/doomdef.c
index 3facfbb299..6ae4bb6894 100644
--- a/apps/plugins/doom/doomdef.c
+++ b/apps/plugins/doom/doomdef.c
@@ -34,7 +34,7 @@
// Location for any defines turned variables.
#if(LCD_HEIGHT>LCD_WIDTH)
-bool rotate_screen=0;
+int rotate_screen=0;
int SCREENWIDTH;
int SCREENHEIGHT;
#endif
diff --git a/apps/plugins/doom/doomdef.h b/apps/plugins/doom/doomdef.h
index 05346cd443..43114f75ef 100644
--- a/apps/plugins/doom/doomdef.h
+++ b/apps/plugins/doom/doomdef.h
@@ -94,7 +94,7 @@ typedef unsigned Language_t;
// when multiple screen sizes are supported
#if(LCD_HEIGHT>LCD_WIDTH)
-extern bool rotate_screen;
+extern int rotate_screen;
// proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH LCD_HEIGHT
#define MAX_SCREENHEIGHT LCD_HEIGHT
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index bb04194acc..2381a7614d 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -316,16 +316,6 @@ void I_ShutdownGraphics(void)
#define DOOMBUTTON_ENTER BUTTON_MENU
#define DOOMBUTTON_WEAPON BUTTON_DISPLAY
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define DOOMBUTTON_ESC BUTTON_POWER
-#define DOOMBUTTON_UP BUTTON_STOP
-#define DOOMBUTTON_DOWN BUTTON_PLAY
-#define DOOMBUTTON_LEFT BUTTON_LEFT
-#define DOOMBUTTON_RIGHT BUTTON_RIGHT
-#define DOOMBUTTON_SHOOT BUTTON_VOLUP
-#define DOOMBUTTON_OPEN BUTTON_VOLDOWN
-#define DOOMBUTTON_ENTER BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c
index 586a4a1c2f..0318c9d741 100644
--- a/apps/plugins/doom/m_misc.c
+++ b/apps/plugins/doom/m_misc.c
@@ -308,7 +308,7 @@ default_t defaults[] =
{"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200,
def_int,ss_none, 0, 0},*/
#if(LCD_HEIGHT>LCD_WIDTH)
- {"rotate_screen",{(void *)&rotate_screen, NULL},{0, NULL},0,1,
+ {"rotate_screen",{&rotate_screen, NULL},{0, NULL},0,1,
def_bool,ss_none, 0, 0}, /* kwk - rotate the screen 90 degrees */
#endif
{"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1,
diff --git a/apps/plugins/fractals/fractal.h b/apps/plugins/fractals/fractal.h
index 28172aed9f..b64bf942fe 100644
--- a/apps/plugins/fractals/fractal.h
+++ b/apps/plugins/fractals/fractal.h
@@ -155,20 +155,6 @@
#define FRACTAL_PRECISION_DEC BUTTON_REW
#define FRACTAL_RESET (BUTTON_PLAY | BUTTON_REW)
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define FRACTAL_QUIT BUTTON_EQ
-#define FRACTAL_UP BUTTON_UP
-#define FRACTAL_DOWN BUTTON_DOWN
-#define FRACTAL_LEFT BUTTON_LEFT
-#define FRACTAL_RIGHT BUTTON_RIGHT
-#define FRACTAL_ZOOM_IN_PRE BUTTON_SELECT
-#define FRACTAL_ZOOM_IN (BUTTON_SELECT | BUTTON_REL)
-#define FRACTAL_ZOOM_OUT_PRE BUTTON_SELECT
-#define FRACTAL_ZOOM_OUT (BUTTON_SELECT | BUTTON_REPEAT)
-#define FRACTAL_PRECISION_INC (BUTTON_PLAY | BUTTON_RIGHT)
-#define FRACTAL_PRECISION_DEC (BUTTON_PLAY | BUTTON_LEFT)
-#define FRACTAL_RESET BUTTON_MODE
-
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
#define FRACTAL_QUIT BUTTON_BACK
#define FRACTAL_UP BUTTON_UP
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c
index c44b1f77c0..d9cb7436de 100644
--- a/apps/plugins/greyscale.c
+++ b/apps/plugins/greyscale.c
@@ -57,14 +57,6 @@
#define GREYSCALE_RIGHT BUTTON_RIGHT
#define GREYSCALE_OFF BUTTON_MENU
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define GREYSCALE_SHIFT BUTTON_PLAY
-#define GREYSCALE_UP BUTTON_UP
-#define GREYSCALE_DOWN BUTTON_DOWN
-#define GREYSCALE_LEFT BUTTON_LEFT
-#define GREYSCALE_RIGHT BUTTON_RIGHT
-#define GREYSCALE_OFF BUTTON_EQ
-
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
#define GREYSCALE_SHIFT BUTTON_RC_PLAY /* somewhat dangerous... */
#define GREYSCALE_UP BUTTON_RC_VOL_UP
diff --git a/apps/plugins/imageviewer/imageviewer_button.h b/apps/plugins/imageviewer/imageviewer_button.h
index cfb9a2969b..d588de95ca 100644
--- a/apps/plugins/imageviewer/imageviewer_button.h
+++ b/apps/plugins/imageviewer/imageviewer_button.h
@@ -207,17 +207,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define IMGVIEW_ZOOM_IN BUTTON_VOLUP
-#define IMGVIEW_ZOOM_OUT BUTTON_VOLDOWN
-#define IMGVIEW_UP BUTTON_STOP
-#define IMGVIEW_DOWN BUTTON_PLAY
-#define IMGVIEW_LEFT BUTTON_LEFT
-#define IMGVIEW_RIGHT BUTTON_RIGHT
-#define IMGVIEW_NEXT (BUTTON_PLAY|BUTTON_VOLUP)
-#define IMGVIEW_PREVIOUS (BUTTON_PLAY|BUTTON_VOLDOWN)
-#define IMGVIEW_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define IMGVIEW_ZOOM_IN BUTTON_PLAY
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 8b0519d9d0..c28ab7e830 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -163,13 +163,6 @@
#define RIGHT BUTTON_PLUS
#define FIRE BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define QUIT BUTTON_POWER
-#define LEFT BUTTON_LEFT
-#define RIGHT BUTTON_RIGHT
-#define FIRE BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c
index 83a44eea02..7f7965b07d 100644
--- a/apps/plugins/jewels.c
+++ b/apps/plugins/jewels.c
@@ -63,16 +63,6 @@
#define HK_SELECT "SELECT"
#define HK_CANCEL "MENU"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define JEWELS_UP BUTTON_UP
-#define JEWELS_DOWN BUTTON_DOWN
-#define JEWELS_LEFT BUTTON_LEFT
-#define JEWELS_RIGHT BUTTON_RIGHT
-#define JEWELS_SELECT BUTTON_SELECT
-#define JEWELS_CANCEL BUTTON_PLAY
-#define HK_SELECT "SELECT"
-#define HK_CANCEL "PLAY"
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define JEWELS_UP BUTTON_UP
#define JEWELS_DOWN BUTTON_DOWN
@@ -201,16 +191,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define JEWELS_CANCEL BUTTON_POWER
#define HK_CANCEL "POWER"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define JEWELS_UP BUTTON_STOP
-#define JEWELS_DOWN BUTTON_PLAY
-#define JEWELS_LEFT BUTTON_LEFT
-#define JEWELS_RIGHT BUTTON_RIGHT
-#define JEWELS_SELECT BUTTON_MENU
-#define JEWELS_CANCEL BUTTON_POWER
-#define HK_SELECT "MENU"
-#define HK_CANCEL "POWER"
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define JEWELS_UP BUTTON_UP
#define JEWELS_DOWN BUTTON_DOWN
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index e3543aeba2..b025ef8eaa 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -294,7 +294,6 @@ static const unsigned char lcdlinear[256] = {
#define LCD_SCANRATE 73 /* Hz */
#else /* not yet calibrated targets - generic linear mapping */
-/* TODO: calibrate iFP7xx */
static const unsigned char lcdlinear[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c
index b1bcd06ee6..028472d9a8 100644
--- a/apps/plugins/lib/pluginlib_actions.c
+++ b/apps/plugins/lib/pluginlib_actions.c
@@ -91,7 +91,6 @@ const struct button_mapping pla_main_ctx[] =
|| (CONFIG_KEYPAD == IRIVER_H300_PAD) \
|| (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_PAD) \
- || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) \
|| (CONFIG_KEYPAD == SANSA_C200_PAD) \
|| (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == MROBE100_PAD) \
@@ -161,15 +160,6 @@ const struct button_mapping pla_main_ctx[] =
{ PLA_DOWN_REPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
{ PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
- { PLA_UP, BUTTON_STOP, BUTTON_NONE },
- { PLA_DOWN, BUTTON_PLAY, BUTTON_NONE },
- { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
- { PLA_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
- { PLA_UP_REPEAT, BUTTON_STOP|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_DOWN_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_LEFT_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
- { PLA_RIGHT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
{ PLA_UP, BUTTON_UP, BUTTON_NONE},
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE},
@@ -357,12 +347,6 @@ const struct button_mapping pla_main_ctx[] =
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
-#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
- {PLA_CANCEL, BUTTON_EQ|BUTTON_REL, BUTTON_EQ},
- {PLA_EXIT, BUTTON_EQ|BUTTON_REPEAT, BUTTON_NONE},
- {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
- {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
- {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == MROBE500_PAD)
{PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
{PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
@@ -394,12 +378,6 @@ const struct button_mapping pla_main_ctx[] =
{PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
{PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE},
-#elif (CONFIG_KEYPAD == IAUDIO67_PAD)
- {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
- {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE},
- {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE},
- {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
- {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT BUTTON_NONE},
#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
{PLA_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK},
{PLA_EXIT, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE},
diff --git a/apps/plugins/lua/include_lua/create_kbd_layout.lua b/apps/plugins/lua/include_lua/create_kbd_layout.lua
new file mode 100644
index 0000000000..7d0792a667
--- /dev/null
+++ b/apps/plugins/lua/include_lua/create_kbd_layout.lua
@@ -0,0 +1,107 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * 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.
+ *
+ ****************************************************************************/
+]]
+--create keyboard layout
+--BILGUS 4/2021
+-- create_kbd_layout = require("create_kbd_layout")
+-- local layout = create_kbd_layout("abcd")
+
+local function encode_short(n)
+ return string.char(bit.band(0x00FF, n), bit.rshift(bit.band(0xFF00, n), 8))
+end
+
+local function utf8decode(str)
+ local INVALID = 0xfffd
+ local t = {}
+ local function check_char(c)
+ local tail = false
+ local code
+ c = string.byte(c)
+ if (c <= 0x7f) or (c >= 0xc2) then
+ -- Start of new character
+ if (c < 0x80) then -- U-00000000 - U-0000007F, 1 string.byte
+ code = c;
+ elseif (c < 0xe0) then -- U-00000080 - U-000007FF, 2 string.bytes
+ tail = 1;
+ code = bit.band(c, 0x1f)
+ elseif (c < 0xf0) then -- U-00000800 - U-0000FFFF, 3 string.bytes
+ tail = 2;
+ code = bit.band(c, 0x0f)
+ elseif (c < 0xf5) then -- U-00010000 - U-001FFFFF, 4 string.bytes
+ tail = 3;
+ code = bit.band(c, 0x07)
+ else
+ -- Invalid size
+ code = INVALID;
+ end
+
+ while tail and c ~= 0 do
+ tail = tail - 1
+ if bit.band(c, 0xc0) == 0x80 then
+ -- Valid continuation character
+ code = bit.bor(bit.lshift(code, 6),bit.band(c, 0x3f))
+ else
+ -- Invalid continuation char
+ code = INVALID;
+ break;
+ end
+ end
+ else
+ -- Invalid UTF-8 char
+ code = INVALID;
+ end
+ -- currently we don't support chars above U-FFFF
+ t[#t + 1 ] = encode_short((code < 0x10000) and code or INVALID)
+ end
+ str:gsub(".", check_char) -- run check function for every char
+ return table.concat(t)
+end
+
+local function create_keyboard_layout(s_layout)
+ local insert = table.insert
+ lines = {}
+
+ for str in string.gmatch(s_layout, "([^\n]+)") do
+ local len = string.len(str)
+ lines[#lines + 1] =
+ table.concat({encode_short(len), utf8decode(str)})
+ end
+ lines[#lines + 1] = encode_short(0xFEFF)
+
+ return table.concat(lines)
+end
+
+
+--[[
+local name = "Test_KBD_LAYOUT_" .. tostring(1)
+local test = create_keyboard_layout("ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\n0123456789")
+local file = io.open('/' .. name, "w+") -- overwrite, rb ignores the 'b' flag
+file:write(test)-- write the layout to the file now
+file:close()
+
+if not file then
+ rb.splash(rb.HZ, "Error opening /" .. name)
+ return
+end
+rb.kbd_input(name, test)
+]]
+return create_keyboard_layout
diff --git a/apps/plugins/lua/include_lua/menubuttons.lua b/apps/plugins/lua/include_lua/menubuttons.lua
new file mode 100644
index 0000000000..7c19592bbe
--- /dev/null
+++ b/apps/plugins/lua/include_lua/menubuttons.lua
@@ -0,0 +1,59 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * 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.
+ *
+ ****************************************************************************/
+]]
+-- Bilgus 4/2021
+local oldrb = rb
+local tmploader = require("temploader")
+
+local a_is_loaded = (package.loaded.actions ~= nil)
+local rbold = rb
+
+if not a_is_loaded then
+ --replace the rb table so we can keep the defines out of the namespace
+ rb = {}
+end
+
+--require("actions") -- Contains rb.actions & rb.contexts
+local actions, err = tmploader("actions")
+if err then
+ error(err)
+end
+
+-- Menu Button definitions --
+local button_t = {
+ CANCEL = rb.actions.PLA_CANCEL,
+ DOWN = rb.actions.PLA_DOWN,
+ DOWNR = rb.actions.PLA_DOWN_REPEAT,
+ EXIT = rb.actions.PLA_EXIT,
+ LEFT = rb.actions.PLA_LEFT,
+ LEFTR = rb.actions.PLA_LEFT_REPEAT,
+ RIGHT = rb.actions.PLA_RIGHT,
+ RIGHTR = rb.actions.PLA_RIGHT_REPEAT,
+ SEL = rb.actions.PLA_SELECT,
+ SELREL = rb.actions.PLA_SELECT_REL,
+ SELR = rb.actions.PLA_SELECT_REPEAT,
+ UP = rb.actions.PLA_UP,
+ UPR = rb.actions.PLA_UP_REPEAT,
+}
+
+rb = oldrb
+return button_t
diff --git a/apps/plugins/lua/include_lua/menucoresettings.lua b/apps/plugins/lua/include_lua/menucoresettings.lua
new file mode 100644
index 0000000000..27d5e86ca1
--- /dev/null
+++ b/apps/plugins/lua/include_lua/menucoresettings.lua
@@ -0,0 +1,78 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * 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.
+ *
+ ****************************************************************************/
+]]
+--menu core settings loaded from rockbox user settings
+--Bilgus 4/2021
+
+local function get_core_settings()
+ local tmploader = require("temploader")
+ -- rbsettings is a large module to have sitting in RAM
+ -- if user already has it in RAM then use that
+ local rbs_is_loaded = (package.loaded.rbsettings ~= nil)
+ local s_is_loaded = (package.loaded.settings ~= nil)
+ local rbold = rb
+
+ if not rbs_is_loaded then
+ --replace the rb table so we can keep the defines out of the namespace
+ rb = { global_settings = rb.global_settings,
+ global_status = rb.global_status}
+ end
+
+ tmploader("rbsettings")
+ tmploader("settings")
+ -- these are exact matches color and talk are wildcard matches
+ local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
+ local function filterfn(struct, k)
+ k = k or ""
+ --rbold.splash(100, struct .. " " .. k)
+ return (k:find("color") or k:find("talk") or list_settings:find(k))
+ end
+ local rb_settings = rb.settings.dump('global_settings', "system", nil, nil, filterfn)
+
+ local color_table = {}
+ local talk_table = {}
+ local list_settings_table = {}
+
+ for key, value in pairs(rb_settings) do
+ key = key or ""
+ if (key:find("color")) then
+ color_table[key]=value
+ elseif (key:find("talk")) then
+ talk_table[key]=value
+ else --if (list_settings:find(key)) then
+ list_settings_table[key]=value
+ end
+ end
+
+ if not s_is_loaded then
+ rb.settings = nil
+ end
+
+ rb = rbold
+ rb.core_color_table = color_table
+ rb.core_talk_table = talk_table
+ rb.core_list_settings_table = list_settings_table
+end
+get_core_settings()
+get_core_settings = nil
+package.loaded.menucoresettings = nil
+collectgarbage("collect")
diff --git a/apps/plugins/lua/include_lua/print.lua b/apps/plugins/lua/include_lua/print.lua
index 3b4c389848..6f2010422a 100644
--- a/apps/plugins/lua/include_lua/print.lua
+++ b/apps/plugins/lua/include_lua/print.lua
@@ -343,20 +343,15 @@ local _print = {} do
tld.line_end_color = line_end_color
end
- line_separator = ld.line_separator
-
+ line_separator = ld.line_separator or o.drawsep
+ local indent = line_indent < 0 and 0 or line_indent --rb scroller doesn't like negative offset!
if o.line == 1 and o.header then
- --rb scroller doesn't like negative offset!
- local indent = line_indent < 0 and 0 or line_indent
set_desc(ld, true, 1, false, rb.STYLE_DEFAULT,
indent, o.fg_pattern, o.bg_pattern, o.bg_pattern)
ld.show_cursor = false
elseif s_lines[o.line] then
--/* Display line selector */
local style = show_cursor == true and rb.STYLE_DEFAULT or linestyle
-
- local indent = line_indent < 0 and 0 or line_indent
- --rb scroller doesn't like negative offset!
local ovfl = (o.ovfl == "auto" and w >= o.width and x == 0)
set_desc(ld, ovfl, 0, true, style, indent,
o.bg_pattern, o.sel_pattern, o.sel_pattern)
@@ -377,7 +372,9 @@ local _print = {} do
if ld.selected == true then
rb.set_viewport(o) -- revert drawmode if selected
end
- rb.lcd_drawline(0, line * h, o.width, line * h)
+ if not o.header then
+ rb.lcd_drawline(0, line * h, o.width, line * h)
+ end
rb.lcd_drawline(0, line * h + h, o.width, line * h + h) --only to add the last line
-- but we don't have an idea which line is the last line here so every line is the last line!
end
@@ -457,6 +454,7 @@ local _print = {} do
_print.opt.line = set_line
_print.opt.linedesc = set_linedesc
_print.opt.autoupdate = set_update
+ _print.selected = function() return s_lines end
_print.clear = clear
_print.f = printf
diff --git a/apps/plugins/lua/include_lua/printmenus.lua b/apps/plugins/lua/include_lua/printmenus.lua
index 3e8f870104..938d99a5ed 100644
--- a/apps/plugins/lua/include_lua/printmenus.lua
+++ b/apps/plugins/lua/include_lua/printmenus.lua
@@ -23,74 +23,18 @@
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
require("printtable")
+require("menucoresettings") --loads user settings from rockbox
local _clr = require("color")
+
local _LCD = rb.lcd_framebuffer()
--[[ -- dpad requires:
-require("actions") -- Contains rb.actions & rb.contexts
+local BUTTON = require("menubuttons")
local _timer = require("timer")
--- Button definitions --
-local CANCEL_BUTTON = rb.actions.PLA_CANCEL
-local DOWN_BUTTON = rb.actions.PLA_DOWN
-local DOWNR_BUTTON = rb.actions.PLA_DOWN_REPEAT
-local EXIT_BUTTON = rb.actions.PLA_EXIT
-local LEFT_BUTTON = rb.actions.PLA_LEFT
-local LEFTR_BUTTON = rb.actions.PLA_LEFT_REPEAT
-local RIGHT_BUTTON = rb.actions.PLA_RIGHT
-local RIGHTR_BUTTON = rb.actions.PLA_RIGHT_REPEAT
-local SEL_BUTTON = rb.actions.PLA_SELECT
-local SELREL_BUTTON = rb.actions.PLA_SELECT_REL
-local SELR_BUTTON = rb.actions.PLA_SELECT_REPEAT
-local UP_BUTTON = rb.actions.PLA_UP
-local UPR_BUTTON = rb.actions.PLA_UP_REPEAT
]]
--------------------------------------------------------------------------------
-local function get_core_settings()
- if rb.core_color_table ~= nil and rb.core_talk_table ~= nil and
- rb.core_list_settings_table ~= nil then return end
-
- local rbs_is_loaded = (package.loaded.rbsettings ~= nil)
- local s_is_loaded = (package.loaded.settings ~= nil)
-
- require("rbsettings")
- require("settings")
- rb.metadata = nil -- remove track metadata settings
-
- local rb_settings = rb.settings.dump('global_settings', "system")
- local color_table = {}
- local talk_table = {}
- local list_settings_table = {}
- local list_settings = "cursor_style|show_icons|statusbar|scrollbar|scrollbar_width|list_separator_height|backdrop_file|"
- for key, value in pairs(rb_settings) do
- key = key or ""
- if (key:find("color")) then
- color_table[key]=value
- elseif (key:find("talk")) then
- talk_table[key]=value
- elseif (list_settings:find(key)) then
- list_settings_table[key]=value
- end
- end
-
- if not s_is_loaded then
- rb.settings = nil
- package.loaded.settings = nil
- end
-
- if not rbs_is_loaded then
- rb.system = nil
- rb.metadata = nil
- package.loaded.rbsettings = nil
- end
-
- rb.core_color_table = color_table
- rb.core_talk_table = talk_table
- rb.core_list_settings_table = list_settings_table
- collectgarbage("collect")
-end
-
--[[ cursor style button routine
-- left / right are x, xi is increment xir is increment when repeat
-- up / down are y, yi is increment yir is increment when repeat
@@ -112,44 +56,44 @@ local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
while true do
button = rb.get_plugin_action(timeout)
- if button == CANCEL_BUTTON then
+ if button == BUTTON.CANCEL then
cancel = 1
break;
- elseif button == EXIT_BUTTON then
+ elseif button == BUTTON.EXIT then
cancel = 1
break;
- elseif button == SEL_BUTTON then
+ elseif button == BUTTON.SEL then
select = 1
timeout = timeout + 1
- elseif button == SELR_BUTTON then
+ elseif button == BUTTON.SELR then
select = 2
timeout = timeout + 1
- elseif button == SELREL_BUTTON then
+ elseif button == BUTTON.SELREL then
select = -1
timeout = timeout + 1
- elseif button == LEFT_BUTTON then
+ elseif button == BUTTON.LEFT then
x_chg = x_chg - xi
if scroll_is_fixed then
cancel = 1
break;
end
- elseif button == LEFTR_BUTTON then
+ elseif button == BUTTON.LEFTR then
x_chg = x_chg - xir
- elseif button == RIGHT_BUTTON then
+ elseif button == BUTTON.RIGHT then
x_chg = x_chg + xi
if scroll_is_fixed then
select = 1
timeout = timeout + 1
end
- elseif button == RIGHTR_BUTTON then
+ elseif button == BUTTON.RIGHTR then
x_chg = x_chg + xir
- elseif button == UP_BUTTON then
+ elseif button == BUTTON.UP then
y_chg = y_chg + yi
- elseif button == UPR_BUTTON then
+ elseif button == BUTTON.UPR then
y_chg = y_chg + yir
- elseif button == DOWN_BUTTON then
+ elseif button == BUTTON.DOWN then
y_chg = y_chg - yi
- elseif button == DOWNR_BUTTON then
+ elseif button == BUTTON.DOWNR then
y_chg = y_chg - yir
elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
break;
@@ -175,7 +119,6 @@ function print_menu(menu_t, func_t, selected, settings, copy_screen)
if selected then vcur = selected + 1 end
if vcur and vcur <= 1 then vcur = 2 end
- get_core_settings()
local c_table = rb.core_color_table or {}
if not settings then
@@ -239,7 +182,7 @@ function print_menu(menu_t, func_t, selected, settings, copy_screen)
if copy_screen == true then _LCD:copy(screen_img) end
if func_t and func_t[i] then
- if func_t[i](i, menu_t) == true then break end
+ if func_t[i](i, menu_t, func_t) == true then break end
else
break
end
diff --git a/apps/plugins/lua/include_lua/printsubmenu.lua b/apps/plugins/lua/include_lua/printsubmenu.lua
new file mode 100644
index 0000000000..f4b93db98d
--- /dev/null
+++ b/apps/plugins/lua/include_lua/printsubmenu.lua
@@ -0,0 +1,314 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * 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.
+ *
+ ****************************************************************************/
+]]
+if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
+--GLOBALS
+menu_ctx = {}
+submenu_insert = table.insert
+submenu_remove = table.remove
+
+local last_ctx = false
+local p_settings
+local function empty_fn() end
+
+--[[root menu tables
+expanded menus get inserted / removed
+and context menus replace them but unless you
+want a new root menu they are never overwritten
+func_t functions get 3 variables passed by the menu_system
+func_t[i] =function sample(i, menu_t, func_t]
+this function gets run on user selection
+for every function in func_t:
+'i' is the selected item
+'menu_t' is the current strings table
+'func_t' is the current function table
+
+menu_t[i] will returnm the text of the item user selected and
+func_t[i] will return the function we are currently in
+]]
+
+menu_t = {}
+func_t = {}
+
+require("printmenus")
+
+local BUTTON = require("menubuttons")
+local last_sel = 0
+
+local function display_context_menu() end -- forward declaration
+
+local function dpad(x, xi, xir, y, yi, yir, timeout, overflow, selected)
+ local scroll_is_fixed = overflow ~= "manual"
+ if timeout == nil then timeout = -1 end
+ local cancel, select = 0, 0
+ local x_chg, y_chg = 0, 0
+ local button
+ while true do
+ button = rb.get_plugin_action(timeout)
+
+ if button == BUTTON.CANCEL then
+ cancel = 1
+ break;
+ elseif button == BUTTON.EXIT then
+ cancel = 1
+ break;
+ elseif button == BUTTON.SEL then
+ last_sel = 1
+ timeout = timeout + 1
+ elseif button == BUTTON.SELR then
+ last_sel = 2
+ if display_context_menu(selected or -1) == true then
+ select = 1
+ break;
+ end
+ timeout = timeout + 1
+ elseif button == BUTTON.SELREL then
+ if last_sel == 1 then
+ select = 1
+ end
+ last_sel = 0
+ timeout = timeout + 1
+ elseif button == BUTTON.LEFT then
+ x_chg = x_chg - xi
+ if scroll_is_fixed then
+ cancel = 1
+ break;
+ end
+ elseif button == BUTTON.LEFTR then
+ x_chg = x_chg - xir
+ elseif button == BUTTON.RIGHT then
+ x_chg = x_chg + xi
+ if scroll_is_fixed then
+ select = 1
+ timeout = timeout + 1
+ end
+ elseif button == BUTTON.RIGHTR then
+ x_chg = x_chg + xir
+ elseif button == BUTTON.UP then
+ y_chg = y_chg + yi
+ elseif button == BUTTON.UPR then
+ y_chg = y_chg + yir
+ elseif button == BUTTON.DOWN then
+ y_chg = y_chg - yi
+ elseif button == BUTTON.DOWNR then
+ y_chg = y_chg - yir
+ elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
+ break;
+ end
+
+ if x_chg ~= 0 or y_chg ~= 0 then
+ timeout = timeout + 1
+ end
+ end
+
+ x = x + x_chg
+ y = y + y_chg
+
+ return cancel, select, x_chg, x, y_chg, y, 0xffff
+end -- dpad
+
+local function ctx_loop()
+ local loopfn = ctx_loop
+ ctx_loop = empty_fn() --prevent another execution
+ local mt, ft = get_menu()
+ local i
+ repeat
+ if menu_ctx.update then mt, ft = get_menu(); menu_ctx.update = false end
+ _, i = print_menu(mt, ft, menu_ctx.start, p_settings)
+ until menu_ctx.quit
+
+ ctx_loop = loopfn --restore for another run
+end
+
+--[[ push_ctx() save surrent menu and load another ]]
+local function push_ctx(new_getmenu)
+ last_ctx = last_ctx or {}
+ submenu_insert(last_ctx, menu_ctx)
+ menu_ctx.getmenu = get_menu
+ menu_ctx.settings = p_settings
+ --menu_ctx is a new variable after this point
+ submenu_set_defaults()
+ menu_ctx.update = true
+ if type(new_getmenu) == 'function' then
+ get_menu = new_getmenu
+ end
+end
+
+--[[ pop_ctx() restore last menu ]]
+local function pop_ctx()
+ menu_ctx = submenu_remove(last_ctx)
+ if menu_ctx then
+ get_menu = menu_ctx.getmenu
+ p_settings = menu_ctx.settings
+ if menu_ctx.restorefn then
+ menu_ctx.restorefn(menu_t, func_t)
+ menu_ctx.restorefn = nil
+ end
+ menu_ctx.getmenu = nil
+ menu_ctx.settings = nil
+ menu_ctx.update = true
+ return true
+ end
+end
+
+--[[ display_context_menu_internal() supplies a new get_menu function that returns
+ the context menu 'user_context_fn' supplied by set_menu()
+ this menu is immediately displayed and when finished will
+ automatically restore the last menu
+]]
+local function display_context_menu_internal(sel)
+ if sel <= 0 or not menu_ctx.user_context_fn then return false end
+ local parent = submenu_get_parent() or 0
+ local user_context_fn = menu_ctx.user_context_fn
+
+ local function display_context_menu(i, menu_t, func_t)
+ local function new_getmenu()
+ local mt, ft = user_context_fn(parent, i, menu_t, func_t)
+ ft[0] = pop_ctx --set back fn
+ return mt, ft
+ end
+ push_ctx(new_getmenu)
+ return true
+ end
+
+ --save the current function in closure restore_fn for later
+ local funct = func_t[sel]
+ local function restore_fn(mt, ft)
+ ft[sel] = funct
+ menu_ctx.start = sel - 1
+ end
+
+ menu_ctx.restorefn = restore_fn
+ -- insert into the current fn table so it gets execd by the menu
+ func_t[sel] = display_context_menu
+
+ return true
+end
+
+--[[ submenu_get_parent() gets the parent of the top most level
+ if lv is supplied it instead gets the parent of that level ]]
+function submenu_get_parent(lv)
+ lv = lv or #menu_ctx.collapse_fn or 1
+ collectgarbage("step")
+ local t = menu_ctx.collapse_fn[lv] or {}
+ return t[2] or -1, lv
+end
+
+--[[ submenu_collapse() collapses submenu till level or ROOT is reached ]]
+function submenu_collapse(parent, lv)
+ local lv_out, menu_sz = 0, 0
+ local item_out = -1
+ local items_removed = 0
+ if lv <= #menu_ctx.collapse_fn then
+ repeat
+ local collapse_fn = submenu_remove(menu_ctx.collapse_fn)
+ if collapse_fn then
+ lv_out, item_out, menu_sz = collapse_fn[1](parent, menu_t, func_t)
+ items_removed = items_removed + menu_sz
+ end
+
+ until not collapse_fn or lv >= lv_out
+ end
+ return lv_out, item_out, items_removed
+end
+
+--[[ submenu_create() supply level of submenu > 0, ROOT is lv 0
+ supply menu strings table and function table
+ closure returned run this function to expand the menu
+]]
+function submenu_create(lv, mt, ft)
+ if lv < 1 then error("Level < 1") end
+ if type(mt) ~= 'table' or type(ft) ~= 'table' then
+ error("mt and ft must be tables")
+ end
+
+ -- everything in lua is 1 based menu level is no exception
+ local lv_tab = string.rep ("\t", lv)
+ local function submenu_closure(i, m, f)
+ menu_ctx.lv = lv
+ local lv_out, menusz_out, start_item
+ local item_in, item_out = i, i
+ if lv <= #menu_ctx.collapse_fn then --something else expanded??
+ repeat
+ local collapse_fn = submenu_remove(menu_ctx.collapse_fn)
+ if collapse_fn then
+ lv_out, item_out, menusz_out = collapse_fn[1](i, m, f)
+ -- if the item i is below this menu, it needs to shift too
+ if item_in > item_out then i = i - (menusz_out) end
+ end
+ until not collapse_fn or lv >= lv_out
+ menu_ctx.start = i
+ if item_out == item_in then return end
+ end
+
+ local menu_sz = #mt
+ menu_ctx.start = i
+ start_item = i
+ menu_ctx.update = true
+ for item, _ in ipairs(mt) do
+ i = i + 1
+ submenu_insert(m, i, lv_tab .. mt[item])
+ submenu_insert(f, i, ft[item])
+ end
+
+ local function collapse_closure(i, m, f)
+ --creates a closure around lv, start_item and menu_sz
+ for j = 1, menu_sz, 1 do
+ submenu_remove(m, start_item + 1)
+ submenu_remove(f, start_item + 1)
+ end
+ return lv, start_item, menu_sz
+ end
+
+ submenu_insert(menu_ctx.collapse_fn, lv, {collapse_closure, start_item})
+ return true
+ end
+
+ return submenu_closure
+end
+
+--
+function submenu_set_defaults(settings, ctx)
+ p_settings = settings or {wrap = true, hasheader = true, justify = "left", dpad_fn = dpad}
+ menu_ctx = ctx or {collapse_fn = {}, lv = 0, update = false, start = 1}
+end
+
+--[[ get_menu() returns the ROOT string and fn tables]]
+function get_menu()
+ return menu_t, func_t
+end
+
+--[[ set_menu() set your menu and the menu has now been entered ]]
+function set_menu(mt, ft, user_context_fn, settings)
+
+ submenu_set_defaults(settings)
+ if type(user_context_fn) == 'function' then
+ display_context_menu = display_context_menu_internal
+ menu_ctx.user_context_fn = user_context_fn
+ else
+ display_context_menu = empty_fn
+ menu_ctx.user_context_fn = false
+ end
+ p_settings = settings or p_settings
+ menu_t, func_t = mt, ft
+ ctx_loop()
+end
diff --git a/apps/plugins/lua/include_lua/printtable.lua b/apps/plugins/lua/include_lua/printtable.lua
index c23d801f83..c70fc1343f 100644
--- a/apps/plugins/lua/include_lua/printtable.lua
+++ b/apps/plugins/lua/include_lua/printtable.lua
@@ -22,28 +22,12 @@
]]
if not rb.lcd_framebuffer then rb.splash(rb.HZ, "No Support!") return nil end
-require("actions") -- Contains rb.actions & rb.contexts
-
local _clr = require("color")
local _print = require("print")
local _timer = require("timer")
+local BUTTON = require("menubuttons")
local sb_width = 5
--- Button definitions --
-local CANCEL_BUTTON = rb.actions.PLA_CANCEL
-local DOWN_BUTTON = rb.actions.PLA_DOWN
-local DOWNR_BUTTON = rb.actions.PLA_DOWN_REPEAT
-local EXIT_BUTTON = rb.actions.PLA_EXIT
-local LEFT_BUTTON = rb.actions.PLA_LEFT
-local LEFTR_BUTTON = rb.actions.PLA_LEFT_REPEAT
-local RIGHT_BUTTON = rb.actions.PLA_RIGHT
-local RIGHTR_BUTTON = rb.actions.PLA_RIGHT_REPEAT
-local SEL_BUTTON = rb.actions.PLA_SELECT
-local SELREL_BUTTON = rb.actions.PLA_SELECT_REL
-local SELR_BUTTON = rb.actions.PLA_SELECT_REPEAT
-local UP_BUTTON = rb.actions.PLA_UP
-local UPR_BUTTON = rb.actions.PLA_UP_REPEAT
-
-- clamps value to >= min and <= max
local function clamp(iVal, iMin, iMax)
if iMin > iMax then
@@ -71,7 +55,7 @@ end
-- time since last button press is returned in ticks..
-- make xi, xir, yi, yir negative to flip direction...
]]
-local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
+local function dpad(x, xi, xir, y, yi, yir, timeout, overflow, selected)
local scroll_is_fixed = overflow ~= "manual"
_timer("dpad") -- start a persistant timer; keeps time between button events
if timeout == nil then timeout = -1 end
@@ -81,44 +65,44 @@ local function dpad(x, xi, xir, y, yi, yir, timeout, overflow)
while true do
button = rb.get_plugin_action(timeout)
- if button == CANCEL_BUTTON then
+ if button == BUTTON.CANCEL then
cancel = 1
break;
- elseif button == EXIT_BUTTON then
+ elseif button == BUTTON.EXIT then
cancel = 1
break;
- elseif button == SEL_BUTTON then
+ elseif button == BUTTON.SEL then
select = 1
timeout = timeout + 1
- elseif button == SELR_BUTTON then
+ elseif button == BUTTON.SELR then
select = 2
timeout = timeout + 1
- elseif button == SELREL_BUTTON then
+ elseif button == BUTTON.SELREL then
select = -1
timeout = timeout + 1
- elseif button == LEFT_BUTTON then
+ elseif button == BUTTON.LEFT then
x_chg = x_chg - xi
if scroll_is_fixed then
cancel = 1
break;
end
- elseif button == LEFTR_BUTTON then
+ elseif button == BUTTON.LEFTR then
x_chg = x_chg - xir
- elseif button == RIGHT_BUTTON then
+ elseif button == BUTTON.RIGHT then
x_chg = x_chg + xi
if scroll_is_fixed then
select = 1
timeout = timeout + 1
end
- elseif button == RIGHTR_BUTTON then
+ elseif button == BUTTON.RIGHTR then
x_chg = x_chg + xir
- elseif button == UP_BUTTON then
+ elseif button == BUTTON.UP then
y_chg = y_chg + yi
- elseif button == UPR_BUTTON then
+ elseif button == BUTTON.UPR then
y_chg = y_chg + yir
- elseif button == DOWN_BUTTON then
+ elseif button == BUTTON.DOWN then
y_chg = y_chg - yi
- elseif button == DOWNR_BUTTON then
+ elseif button == BUTTON.DOWNR then
y_chg = y_chg - yir
elseif timeout >= 0 then--and rb.button_queue_count() < 1 then
break;
@@ -247,7 +231,8 @@ function print_table(t, t_count, settings)
rb.lcd_update()
local quit, select, x_chg, xi, y_chg, yi, timeb =
- dpad_fn(t_p.col, -1, -t_p.col_scrl, t_p.row, -1, -t_p.row_scrl, nil, overflow)
+ dpad_fn(t_p.col, -1, -t_p.col_scrl, t_p.row, -1, -t_p.row_scrl,
+ nil, overflow, (t_p.row + t_p.vcursor - 1))
t_p.vcursor = t_p.vcursor + y_chg
@@ -316,7 +301,7 @@ function print_table(t, t_count, settings)
if t[i] == nil then
rb.splash(1, string.format("ERROR %d is nil", i))
t[i] = "???"
- if rb.get_plugin_action(10) == CANCEL_BUTTON then return 0 end
+ if rb.get_plugin_action(10) == BUTTON.CANCEL then return 0 end
end
if m_sel == true and t[i]:sub(-1) == "\0" then
@@ -351,6 +336,16 @@ function print_table(t, t_count, settings)
table_p = init_position(15, 5)
line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2)
+
+ if (curpos or 0) > maxline then
+ local c = maxline / 2
+ start = (start or 1) + curpos - maxline
+ curpos = maxline
+ while start + maxline <= t_count and curpos > c do
+ curpos = curpos - 1
+ start = start + 1
+ end
+ end
maxline = math.min(maxline, t_count)
-- allow user to start at a position other than the beginning
diff --git a/apps/plugins/lua/include_lua/rbsettings.lua b/apps/plugins/lua/include_lua/rbsettings.lua
index defdb11b77..995e5023c9 100644
--- a/apps/plugins/lua/include_lua/rbsettings.lua
+++ b/apps/plugins/lua/include_lua/rbsettings.lua
@@ -151,12 +151,15 @@ function rb.settings.read(s_settings, s_var, s_groupname)
return data
end
-function rb.settings.dump(s_settings, s_groupname, s_structname, t_output)
+function rb.settings.dump(s_settings, s_groupname, s_structname, t_output, fn_filter)
t_output = t_output or {}
+ fn_filter = fn_filter or function(s,k) return true end
local tgroup = rb[s_groupname]
s_structname = s_structname or s_settings
for k, v in pairs(tgroup[s_structname]) do
- t_output[k] = rb.settings.read(s_settings, v, s_groupname)
+ if fn_filter(s_structname, k) then
+ t_output[k] = rb.settings.read(s_settings, v, s_groupname)
+ end
end
return t_output
end
diff --git a/apps/plugins/lua/include_lua/temploader.lua b/apps/plugins/lua/include_lua/temploader.lua
new file mode 100644
index 0000000000..7fd58aee99
--- /dev/null
+++ b/apps/plugins/lua/include_lua/temploader.lua
@@ -0,0 +1,63 @@
+--[[
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 William Wilgus
+ *
+ * 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.
+ *
+ ****************************************************************************/
+--
+temp_loader allows some (pure) lua requires to be loaded and later garbage collected
+unfortunately the 'required' module needs to be formatted in such a way to
+pass back a reference to a function or call table in order to keep the functions
+within from being garbage collected too early
+
+modules that add things to _G table are unaffected by using this function
+except if later you use require or temp_loader those tables will again
+be reloaded with fresh data since nothing was recorded about the module being loaded
+
+modulename - same as require()
+newinstance == true -- get a new copy (from disk) of the module
+... other args for the module
+
+BE AWARE this bypasses the module loader
+which would allow code reuse so if you aren't careful this memory saving tool
+could spell disaster for free RAM if you load the same code multiple times
+--]]
+
+local function tempload(modulename, newinstance, ...)
+ --http://lua-users.org/wiki/LuaModulesLoader
+ local errmsg = ""
+ -- Is there current a loaded module by this name?
+ if package.loaded[modulename] ~= nil and not newinstance then
+ return require(modulename)
+ end
+ -- Find source
+ local modulepath = string.gsub(modulename, "%.", "/")
+ for path in string.gmatch(package.path, "([^;]+)") do
+ local filename = string.gsub(path, "%?", modulepath)
+ --attempt to open and compile module
+ local file, err = loadfile(filename)
+ if file then
+ -- execute the compiled chunk
+ return file(... or modulename)
+ end
+ errmsg = table.concat({errmsg, "\n\tno file '", filename, "' (temp loader)"})
+ end
+ return nil, errmsg
+end
+
+return tempload
diff --git a/apps/plugins/lua/lauxlib.c b/apps/plugins/lua/lauxlib.c
index acd7e0e636..b8332427f0 100644
--- a/apps/plugins/lua/lauxlib.c
+++ b/apps/plugins/lua/lauxlib.c
@@ -268,7 +268,8 @@ static int latebind_func_index(lua_State *L)
const char *name = lua_tostring(L, -1);
lua_pushstring (L, "__latebind");/* basetable;name;__latebind;*/
- lua_rawget (L, -3);/* basetable;name;__latebind(t);*/
+ if(lua_istable(L, -3))
+ lua_rawget (L, -3);/* basetable;name;__latebind(t);*/
luaL_argcheck(L, lua_istable(L, -3) && lua_istable(L, -1), 1,
"__latebind table expected");
@@ -324,25 +325,31 @@ static int latebind_func_pairs(lua_State *L)
{
/* basetable @ top of stack 1(basetable)-1 */
luaL_argcheck(L, lua_istable(L, 1), 1, "table expected");
- lua_getglobal(L, "pairs"); /* function to be called / returned (btable;pairs) */
- lua_createtable(L, 0, 15); /* btable;pairs;newtable; */
- /* clone base table */
+#if 0
+ lua_getglobal(L, "next"); /* function to be called / returned (btable;next) */
+ lua_createtable(L, 0, 15); /* btable;next;newtable; */
+ lua_pushnil(L); /* nil name retrieves all unbound latebound functions */
lua_pushnil(L); /* first key */
- while(lua_next(L, 1) != 0) {
- /* (btable;pairs;ntable;k;v) */
+#else
+ /* this way is more RAM efficient in testing */
+ if(luaL_dostring(L, "return next, {}, nil, nil")!= 0)
+ lua_error(L);
+#endif
+ /* (btable;next;ntable;nil;nil) */
+ /* clone base table */
+ while(lua_next(L, 1) > 0) {
+ /* (btable;next;ntable;nil;k;v) */
lua_pushvalue(L, -2); /* dupe key Stk = (..;k;v -> ..k;v;k)*/
lua_insert(L, -2); /* Stk = (..k;k;v) */
- lua_rawset(L, 3); /* btable;pairs;ntable;k */
+ lua_rawset(L, -5); /* btable;next;ntable;nil;k */
}
-
- lua_pushnil(L); /*nil name retrieves all unbound late bound functions */
- latebind_func_index(L);/* (btable;pairs;ntable;nil) -> (btable;pairs;ntable) */
-
- /* (btable;pairs;ntable) */
- lua_call(L, 1, 3); /* pairs(ntable) -> (btable;iter;state;value) */
-
- return 3;
+ /* fill the new table with all the latebound functions */
+ /* nil name retrieves all unbound latebound functions */
+ latebind_func_index(L);/* (btable;next;ntable;nil) -> (btable;next;ntable) */
+ lua_pushnil(L); /*nil initial key for next*/
+ /* stack = (btable;next;ntable;nil) */
+ return 3; /*(next,ntable,nil)*/
}
diff --git a/apps/plugins/lua/loadlib.c b/apps/plugins/lua/loadlib.c
index 1e310beed1..732ad707b5 100644
--- a/apps/plugins/lua/loadlib.c
+++ b/apps/plugins/lua/loadlib.c
@@ -130,9 +130,11 @@ static int ll_require (lua_State *L) {
lua_pushliteral(L, ""); /* error message accumulator */
for (i=1; ; i++) {
lua_rawgeti(L, -2, i); /* get a loader */
- if (lua_isnil(L, -1))
+ if (lua_isnil(L, -1)) {
+ lua_setfield(L, 2, name); /* _LOADED[name] = nil */
luaL_error(L, "module " LUA_QS " not found:%s",
name, lua_tostring(L, -2));
+ }
lua_pushstring(L, name);
lua_call(L, 1, 1); /* call it */
if (lua_isfunction(L, -1)) /* did it find module? */
diff --git a/apps/plugins/lua/lparser.c b/apps/plugins/lua/lparser.c
index 8b93237918..23d3972036 100644
--- a/apps/plugins/lua/lparser.c
+++ b/apps/plugins/lua/lparser.c
@@ -603,7 +603,12 @@ static void parlist (LexState *ls) {
} while (!f->is_vararg && testnext(ls, ','));
}
adjustlocalvars(ls, nparams);
+ //f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
+#if defined(LUA_COMPAT_VARARG)
f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG));
+#else
+ f->numparams = cast_byte(fs->nactvar);
+#endif
luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */
}
diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make
index 1e74277549..60dfd24cdd 100644
--- a/apps/plugins/lua/lua.make
+++ b/apps/plugins/lua/lua.make
@@ -16,11 +16,14 @@ LUA_OBJ := $(call c2obj, $(LUA_SRC))
OTHER_SRC += $(LUA_SRC)
LUA_INCLUDEDIR := $(LUA_SRCDIR)/include_lua
-LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua draw.lua draw_floodfill.lua draw_poly.lua \
- draw_num.lua draw_text.lua files.lua image.lua image_save.lua lcd.lua math_ex.lua \
- print.lua timer.lua playlist.lua pcm.lua sound.lua printmenus.lua\
- rbcompat.lua rbsettings.lua poly_points.lua printtable.lua)
-
+LUA_INCLUDELIST := $(addprefix $(LUA_BUILDDIR)/,audio.lua blit.lua color.lua \
+ draw.lua draw_floodfill.lua draw_poly.lua draw_num.lua \
+ draw_text.lua files.lua image.lua image_save.lua lcd.lua \
+ math_ex.lua print.lua timer.lua playlist.lua pcm.lua \
+ sound.lua rbcompat.lua rbsettings.lua poly_points.lua \
+ printtable.lua printmenus.lua printsubmenu.lua \
+ menubuttons.lua menucoresettings.lua create_kbd_layout.lua \
+ temploader.lua)
ifndef APP_TYPE
ROCKS += $(LUA_BUILDDIR)/lua.rock
diff --git a/apps/plugins/lua/rbdefines_helper.pl b/apps/plugins/lua/rbdefines_helper.pl
index eca09187fa..e788855e87 100755
--- a/apps/plugins/lua/rbdefines_helper.pl
+++ b/apps/plugins/lua/rbdefines_helper.pl
@@ -47,7 +47,7 @@ if ($def_type eq "rb_defines") {
'^PLAYLIST_(INSERT|PREPEND|REPLACE)',
'^TOUCHSCREEN_(POINT|BUTTON)$',
'^SYS_CHARGER_(DIS|)CONNECTED$',
- '^SYS_(TIMEOUT|POWEROFF)$',
+ '^SYS_(TIMEOUT|POWEROFF|BATTERY_UPDATE)$',
'^SYS_USB_(DIS|)CONNECTED$',
'^HOME_DIR$',
'^PLUGIN_DIR$',
diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c
index 25bace3451..929dea798b 100644
--- a/apps/plugins/lua/rockaux.c
+++ b/apps/plugins/lua/rockaux.c
@@ -52,6 +52,8 @@ char *strerror(int errnum)
*/
int splash_scroller(int timeout, const char* str)
{
+ if (!str)
+ str = "[nil]";
int w, ch_w, ch_h;
rb->lcd_getstringsize("W", &ch_w, &ch_h);
@@ -104,7 +106,8 @@ int splash_scroller(int timeout, const char* str)
{
brk = strpbrk_n(ch+1, max_ch, break_chars);
chars_next_break = (brk - ch);
- if (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w)
+ if (brk &&
+ (chars_next_break < 2 || w + (ch_w * chars_next_break) > max_w))
{
if (!isprint(line[linepos]))
{
@@ -133,28 +136,32 @@ int splash_scroller(int timeout, const char* str)
}
rb->lcd_update();
-
- action = rb->get_action(CONTEXT_STD, timeout);
- switch(action)
+ if (timeout >= TIMEOUT_BLOCK)
{
- case ACTION_STD_OK:
- case ACTION_STD_CANCEL:
- cycles--;
- /* Fall Through */
- case ACTION_NONE:
- cycles--;
- break;
- case ACTION_STD_PREV:
- timeout = TIMEOUT_BLOCK; /* disable timeout */
- if(firstline > 0)
- firstline--;
- break;
- case ACTION_STD_NEXT:
- timeout = TIMEOUT_BLOCK; /* disable timeout */
- if (linesdisp == max_lines)
- firstline++;
- break;
+ action = rb->get_action(CONTEXT_STD, timeout);
+ switch(action)
+ {
+ case ACTION_STD_OK:
+ case ACTION_STD_CANCEL:
+ cycles--;
+ /* Fall Through */
+ case ACTION_NONE:
+ cycles--;
+ break;
+ case ACTION_STD_PREV:
+ timeout = TIMEOUT_BLOCK; /* disable timeout */
+ if(firstline > 0)
+ firstline--;
+ break;
+ case ACTION_STD_NEXT:
+ timeout = TIMEOUT_BLOCK; /* disable timeout */
+ if (linesdisp == max_lines)
+ firstline++;
+ break;
+ }
}
+ else
+ break;
}
return action;
}
@@ -220,7 +227,7 @@ int get_current_path(lua_State *L, int level)
}
}
- lua_pushnil(L);
+ lua_pushnil(L);
return 1;
}
@@ -244,25 +251,32 @@ int filetol(int fd, long *num)
while (rb->read(fd, &chbuf, 1) == 1)
{
- if(!isspace(chbuf) || retn == 1)
+ if(retn || !isspace(chbuf))
{
- if(chbuf == '0') /* strip preceeding zeros */
- {
- *num = 0;
- retn = 1;
- }
- else if(chbuf == '-' && retn != 1)
- neg = true;
- else
+ switch(chbuf)
{
- rb->lseek(fd, -1, SEEK_CUR);
- break;
+ case '-':
+ {
+ if (retn) /* 0 preceeds, this negative sign must be in error */
+ goto get_digits;
+ neg = true;
+ continue;
+ }
+ case '0': /* strip preceeding zeros */
+ {
+ *num = 0;
+ retn = 1;
+ continue;
+ }
+ default:
+ goto get_digits;
}
}
}
while (rb->read(fd, &chbuf, 1) == 1)
{
+get_digits:
if(!isdigit(chbuf))
{
rb->lseek(fd, -1, SEEK_CUR);
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 81b6f4ce2a..2672d446fc 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -143,10 +143,17 @@ RB_WRAP(touchscreen_mode)
RB_WRAP(kbd_input)
{
+ /*kbd_input(text, layout)*
+ note: layout needs special formatting
+ see includes/create_kbd_layout.lua
+ or lib/kbd_helper.c
+ */
luaL_Buffer b;
luaL_buffinit(L, &b);
const char *input = lua_tostring(L, 1);
+ size_t layout_len;
+ const unsigned char *layout = lua_tolstring(L, 2, &layout_len);
char *buffer = luaL_prepbuffer(&b);
if(input != NULL)
@@ -154,7 +161,14 @@ RB_WRAP(kbd_input)
else
buffer[0] = '\0';
- if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, NULL))
+ if(layout_len <= 2 ||
+ layout[layout_len - 1] != 0xFE ||
+ layout[layout_len - 2] != 0xFF)
+ {
+ layout = NULL;
+ }
+
+ if(!rb->kbd_input(buffer, LUAL_BUFFERSIZE, (unsigned short *)layout))
{
luaL_addstring(&b, buffer);
luaL_pushresult(&b);
diff --git a/apps/plugins/lua_scripts/print_buttons.lua b/apps/plugins/lua_scripts/print_buttons.lua
new file mode 100644
index 0000000000..1b488ddd64
--- /dev/null
+++ b/apps/plugins/lua_scripts/print_buttons.lua
@@ -0,0 +1,70 @@
+-- bilgus 4/2021
+require "buttons"
+local BUTTON_NONE = 0
+
+local function decode_ord_btn(btn)
+ local btntxt = ""
+ for k, v in pairs(rb.buttons) do
+ if btn > BUTTON_NONE and v ~= BUTTON_NONE and bit.band(btn, v) == v then
+ if #btntxt > 0 then
+ btntxt = btntxt .. " | "
+ end
+ btntxt = btntxt .. k
+ end
+ end
+ if btntxt == "" then return nil end
+ return btntxt
+end
+
+local _, w, h = rb.font_getstringsize("W", rb.FONT_UI)
+local max_lines = rb.LCD_HEIGHT / h - 1
+
+button_text = {}
+for k, v in pairs(rb.buttons) do
+ button_text[v] = k
+end
+
+--Add the system button codes to the button_text table
+for k, v in pairs(rb) do
+ if string.find(k or "", "SYS_", 1, true) and type(v) == "number" then
+ button_text[v] = k
+ end
+end
+
+local s = {[1] = "Buttons Found:"}
+for k, v in pairs(button_text) do
+ table.insert(s, tostring(k) .. " : " .. tostring(v))
+end
+rb.splash_scroller(rb.HZ, table.concat(s, "\n"))
+
+button_text[BUTTON_NONE] = " "
+
+local lastbtn = BUTTON_NONE
+local lastkey = BUTTON_NONE
+local s_t = {"Press same button 3x to exit"}
+local keyrpt = 0
+
+repeat
+
+ local btn
+ if lastbtn == BUTTON_NONE then
+ btn = rb.button_get(true)
+ else
+ btn = rb.button_get_w_tmo(rb.HZ)
+ end
+
+ if btn ~= lastkey then
+ table.insert(s_t, 1, (button_text[btn] or decode_ord_btn(btn) or "unknown " .. tostring (btn)))
+ end
+
+ if btn == lastbtn then keyrpt = keyrpt + 1 end
+ if button_text[btn] then lastbtn = btn end
+ lastkey = btn
+
+ rb.splash_scroller(-2, table.concat(s_t, "\n"))
+
+ if #s_t > max_lines then
+ table.remove(s_t)
+ end
+
+until keyrpt >= 2
diff --git a/apps/plugins/lua_scripts/print_lua_func.lua b/apps/plugins/lua_scripts/print_lua_func.lua
index ef0290bbd8..8519914d5f 100644
--- a/apps/plugins/lua_scripts/print_lua_func.lua
+++ b/apps/plugins/lua_scripts/print_lua_func.lua
@@ -1,23 +1,26 @@
+
--RB LUA show all global variables; BILGUS
-require "actions"
-require "audio"
-require "buttons"
-require "color"
-require "draw"
-require "draw_floodfill"
-require "draw_poly"
-require "draw_text"
-
-require "image"
-require "image_save"
-
-require "lcd"
-require "math_ex"
-require "pcm"
-require "playlist"
-require "print"
---require "settings" --uses a lot of memory
-require "sound"
+if not ... then --if executed directly this is nil
+ require "actions"
+ require "audio"
+ require "buttons"
+ require "color"
+ require "draw"
+ require "draw_floodfill"
+ require "draw_poly"
+ require "draw_text"
+
+ require "image"
+ require "image_save"
+
+ require "lcd"
+ require "math_ex"
+ require "pcm"
+ require "playlist"
+ require "print"
+ --require "settings" --uses a lot of memory
+ require "sound"
+end
collectgarbage("collect")
local sDumpFile = "/rb-lua_functions.txt"
@@ -276,8 +279,9 @@ end
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- reuse table
end
end
-
- tcBase= nil tkSortCbase= nil
+ if ... then
+ tcBase= nil tkSortCbase= nil
+ end
tWriteBuf[#tWriteBuf + 1] = "\r\n"
tWriteBuf[#tWriteBuf + 1] = dtTag("?")
tWriteBuf[#tWriteBuf + 1] = "\r\n\r\n"
@@ -306,5 +310,29 @@ end
filehandle:write(table.concat(tWriteBuf))
for i=1, #tWriteBuf do tWriteBuf[i] = _NIL end -- empty table
filehandle:close()
- rb.splash(rb.HZ * 5, n .. " Items dumped to : " .. sDumpFile)
+ --rb.splash((rb.HZ or 100) * 5, n .. " Items dumped to : " .. sDumpFile)
--rb.splash(500, collectgarbage("count"))
+if not ... then
+ local lu = collectgarbage("collect")
+ local used, allocd, free = rb.mem_stats()
+ local lu = collectgarbage("count")
+ local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end
+ local s_t = {}
+ s_t[1] = n
+ s_t[2] = " Items dumped to:\n"
+ s_t[3] = sDumpFile
+ s_t[4] = "\n\nLoaded Modules:\n"
+ n = 0
+ for k, v in pairsByPairs(tcBase, tkSortCbase ) do
+ n = n + 1
+ if n ~= 1 then
+ s_t[#s_t + 1] = ", "
+ end
+ s_t[#s_t + 1] = tostring(k)
+ if n >= 3 then -- split loaded modules to multiple lines
+ n = 0
+ s_t[#s_t + 1] = "\n"
+ end
+ end
+ rb.splash_scroller(5 * (rb.HZ or 100), table.concat(s_t))
+end
diff --git a/apps/plugins/lua_scripts/submenu_demo.lua b/apps/plugins/lua_scripts/submenu_demo.lua
new file mode 100644
index 0000000000..8eac825474
--- /dev/null
+++ b/apps/plugins/lua_scripts/submenu_demo.lua
@@ -0,0 +1,121 @@
+--Bilgus 4/2021 Menu with subitems and context demo
+require("printsubmenu")
+
+local scrpath = rb.current_path()
+
+local function get_ctx_menu(parent, sel, menu_t, func_t)
+ local mt = {"Context menu " .. (menu_t[parent] or "ROOT") ..
+ " : " .. menu_t[sel], "Quit", "Action 1", "Action 2"}
+ local ft = {false, function() menu_ctx.quit = true return true end}
+ return mt, ft
+end
+
+local function ITEM_MENU()
+
+ local function flung(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "flung " .. (menu_t[parent] or "?"))
+ end
+
+ local function foo(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "FOO " .. menu_t[parent])
+ end
+
+ local function far(i, menu_t, func_t)
+ local parent = submenu_get_parent() or 0
+ rb.splash(100, "far" .. menu_t[parent])
+ end
+
+ return {"Flung", "FOO", "Far"},
+ {flung, foo, far}
+end
+
+local function USERITEMS()
+ local lv = 2
+ local mt = {"Item_1", "Item_2", "Item_3"}
+ local ft = {}
+
+ local function insert_item(i, name, func) --closure
+ submenu_insert(mt, i, name)
+ submenu_insert(ft, i, func)
+ end
+
+ for i = 1, #mt, 1 do
+ ft[i] = submenu_create(lv, ITEM_MENU())
+ end
+
+ local function add_new(i, menu_t, func_t)
+ local parent, lv = submenu_get_parent(lv - 1)
+ local last = #mt
+ local name = "Item_" .. tostring(last)
+ local func = submenu_create(lv + 1, ITEM_MENU())
+
+ local lv_out, item_out, removed = submenu_collapse(parent, lv + 1)-- collapse others
+ submenu_collapse(parent, lv) -- collapse the parent
+
+ insert_item(last, name, func)
+
+ func_t[parent](parent, menu_t, func_t) -- reopen parent
+ menu_ctx.start = i - removed
+ return true
+ end
+
+ local next = #mt + 1
+ insert_item(next, "Add New", add_new)
+ return mt, ft
+end
+
+local function MAIN_MENU()
+
+ local function go_back(i, m, f)
+ local parent = submenu_get_parent() or 0
+ if parent > 0 then
+ f[parent](parent, m, f)
+ else
+ menu_ctx.quit = true
+ end
+ menu_ctx.start = parent - 1
+ return true
+ end
+
+ local mt = {
+ [1] = "lua Menu Demo",
+ [2] = "Items",
+ [3] = "Back",
+ }
+
+ local ft = {
+ [0] = go_back, --if user cancels do this function
+ [1] = false, -- shouldn't happen title occupies this slot
+ [2] = submenu_create(1, USERITEMS()),
+ [3] = go_back,
+ }
+ return mt, ft, get_ctx_menu
+end
+
+function ShowMain()
+ set_menu(MAIN_MENU())
+end
+
+--ShowMainMenu()
+ShowMain()
+rb.lcd_clear_display()
+rb.lcd_update()
+local lu = collectgarbage("collect")
+local used, allocd, free = rb.mem_stats()
+local lu = collectgarbage("count")
+local fmt = function(t, v) return string.format("%s: %d Kb\n", t, v /1024) end
+
+-- this is how lua recommends to concat strings rather than ..
+local s_t = {}
+s_t[1] = "rockbox:\n"
+s_t[2] = fmt("Used ", used)
+s_t[3] = fmt("Allocd ", allocd)
+s_t[4] = fmt("Free ", free)
+s_t[5] = "\nlua:\n"
+s_t[6] = fmt("Used", lu * 1024)
+s_t[7] = "\n\nNote that the rockbox used count is a high watermark"
+rb.splash_scroller(5 * rb.HZ, table.concat(s_t))
+--require("print_lua_func")
+os.exit(1, "Goodbye")
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c
index f07cdd4dcf..a28d1d3862 100644
--- a/apps/plugins/midi/midiplay.c
+++ b/apps/plugins/midi/midiplay.c
@@ -140,14 +140,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MIDI_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MIDI_QUIT BUTTON_POWER
-#define MIDI_FFWD BUTTON_RIGHT
-#define MIDI_REWIND BUTTON_LEFT
-#define MIDI_VOL_UP BUTTON_STOP
-#define MIDI_VOL_DOWN BUTTON_PLAY
-#define MIDI_PLAYPAUSE BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MIDI_QUIT BUTTON_BACK
#define MIDI_FFWD BUTTON_RIGHT
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 7c5084529b..db10185c91 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -2443,12 +2443,6 @@ static void get_mp3_filename(const char *wav_name)
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MP3ENC_DONE BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MP3ENC_PREV BUTTON_LEFT
-#define MP3ENC_NEXT BUTTON_RIGHT
-#define MP3ENC_DONE BUTTON_POWER
-#define MP3ENC_SELECT BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MP3ENC_PREV BUTTON_UP
#define MP3ENC_NEXT BUTTON_DOWN
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index d59797eaa7..505f3aa33d 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -142,14 +142,6 @@ struct mpeg_settings settings;
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define MPEG_START_TIME_EXIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MPEG_START_TIME_SELECT BUTTON_MENU
-#define MPEG_START_TIME_LEFT BUTTON_LEFT
-#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
-#define MPEG_START_TIME_UP BUTTON_STOP
-#define MPEG_START_TIME_DOWN BUTTON_PLAY
-#define MPEG_START_TIME_EXIT BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MPEG_START_TIME_SELECT BUTTON_SELECT
#define MPEG_START_TIME_LEFT BUTTON_LEFT
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 6b18e4fa3a..34eafd5d9c 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -254,15 +254,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define MPEG_VOLDOWN BUTTON_MINUS
#define MPEG_VOLUP BUTTON_PLUS
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define MPEG_MENU BUTTON_MENU
-#define MPEG_STOP BUTTON_STOP
-#define MPEG_PAUSE BUTTON_PLAY
-#define MPEG_VOLDOWN BUTTON_VOLDOWN
-#define MPEG_VOLUP BUTTON_VOLUP
-#define MPEG_RW BUTTON_LEFT
-#define MPEG_FF BUTTON_RIGHT
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define MPEG_MENU BUTTON_MENU
#define MPEG_STOP BUTTON_BACK
diff --git a/apps/plugins/pacbox/pacbox.h b/apps/plugins/pacbox/pacbox.h
index c1a1c6b9e5..a3d42b099c 100644
--- a/apps/plugins/pacbox/pacbox.h
+++ b/apps/plugins/pacbox/pacbox.h
@@ -169,18 +169,6 @@
#define PACMAN_MENU (BUTTON_MENU|BUTTON_REL)
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define PACMAN_UP BUTTON_STOP
-#define PACMAN_DOWN BUTTON_PLAY
-#define PACMAN_LEFT BUTTON_LEFT
-#define PACMAN_RIGHT BUTTON_RIGHT
-#define PACMAN_1UP BUTTON_VOLDOWN
-#define PACMAN_2UP BUTTON_VOLUP
-#define PACMAN_COIN_PRE BUTTON_MENU
-#define PACMAN_COIN (BUTTON_MENU | BUTTON_PLAY)
-#define PACMAN_MENU BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define PACMAN_UP BUTTON_UP
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index 498aa36357..f089c38023 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -95,23 +95,6 @@
#define LVL_UP_TEXT "PLAY"
#define LVL_DOWN_TEXT "-"
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define PEGBOX_SELECT BUTTON_MODE
-#define PEGBOX_QUIT BUTTON_PLAY
-#define PEGBOX_RESTART (BUTTON_EQ|BUTTON_MODE)
-#define PEGBOX_LVL_UP (BUTTON_EQ|BUTTON_UP)
-#define PEGBOX_LVL_DOWN (BUTTON_EQ|BUTTON_DOWN)
-#define PEGBOX_UP BUTTON_UP
-#define PEGBOX_DOWN BUTTON_DOWN
-#define PEGBOX_RIGHT BUTTON_RIGHT
-#define PEGBOX_LEFT BUTTON_LEFT
-
-#define SELECT_TEXT "MODE"
-#define QUIT_TEXT "PLAY"
-#define RESTART_TEXT "EQ+MODE"
-#define LVL_UP_TEXT "EQ+UP"
-#define LVL_DOWN_TEXT "EQ+DOWN"
-
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define PEGBOX_SELECT BUTTON_PLAY
#define PEGBOX_QUIT BUTTON_POWER
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c
index 42930f0ff6..9731d92d35 100644
--- a/apps/plugins/pictureflow/pictureflow.c
+++ b/apps/plugins/pictureflow/pictureflow.c
@@ -103,10 +103,8 @@ const struct button_mapping pf_context_buttons[] =
{PF_SELECT, BUTTON_CENTER, BUTTON_NONE},
{PF_BACK, BUTTON_BOTTOMRIGHT, BUTTON_NONE},
#endif
-#if CONFIG_KEYPAD == SANSA_C100_PAD
- {PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
-#elif CONFIG_KEYPAD == CREATIVEZV_PAD || CONFIG_KEYPAD == CREATIVEZVM_PAD || \
- CONFIG_KEYPAD == PHILIPS_HDD1630_PAD || CONFIG_KEYPAD == IAUDIO67_PAD || \
+#if CONFIG_KEYPAD == CREATIVEZV_PAD || CONFIG_KEYPAD == CREATIVEZVM_PAD || \
+ CONFIG_KEYPAD == PHILIPS_HDD1630_PAD || \
CONFIG_KEYPAD == GIGABEAT_PAD || CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == MROBE100_PAD || CONFIG_KEYPAD == MROBE500_PAD || \
CONFIG_KEYPAD == PHILIPS_SA9200_PAD || CONFIG_KEYPAD == SANSA_CLIP_PAD || \
@@ -130,15 +128,11 @@ const struct button_mapping pf_context_buttons[] =
#endif
#elif CONFIG_KEYPAD == SANSA_E200_PAD
{PF_QUIT, BUTTON_POWER, BUTTON_NONE},
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
- {PF_QUIT, BUTTON_EQ, BUTTON_NONE},
#elif (CONFIG_KEYPAD == IPOD_1G2G_PAD) \
|| (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (CONFIG_KEYPAD == IPOD_4G_PAD) \
|| (CONFIG_KEYPAD == MPIO_HD300_PAD)
{PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
-#elif CONFIG_KEYPAD == LOGIK_DAX_PAD
- {PF_QUIT, BUTTON_POWERPLAY|BUTTON_REPEAT, BUTTON_POWERPLAY},
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
{PF_QUIT, BUTTON_RC_REC, BUTTON_NONE},
#elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
@@ -154,6 +148,15 @@ const struct button_mapping pf_context_buttons[] =
{PF_CONTEXT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_FFWD},
{PF_TRACKLIST, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD},
{PF_WPS, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
+#elif CONFIG_KEYPAD == FIIO_M3K_PAD
+ {PF_PREV, BUTTON_LEFT, BUTTON_NONE},
+ {PF_PREV_REPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_NEXT, BUTTON_RIGHT, BUTTON_NONE},
+ {PF_NEXT_REPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE},
+ {PF_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER},
+ {PF_QUIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER},
+ {PF_CONTEXT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU},
+ {PF_TRACKLIST, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
#endif
#if CONFIG_KEYPAD == IAUDIO_M3_PAD
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD|CONTEXT_REMOTE)
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 5931b6b0a5..cc0be3abd5 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -54,7 +54,7 @@ OUTPUT_FORMAT(elf32-littlemips)
#elif CONFIG_CPU==S3C2440
#include "cpu.h"
/* must be 16Kb (0x4000) aligned */
-#define TTB_SIZE (0x4000)
+#define TTB_SIZE (0x4000)
#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE
#elif CONFIG_CPU==TCC7801
@@ -77,9 +77,9 @@ OUTPUT_FORMAT(elf32-littlemips)
#include "cpu.h"
#define DRAMSIZE (DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE - FRAME_SIZE - TTB_SIZE)
#elif CONFIG_CPU==X1000
-#include "config.h"
+#include "cpu.h"
#undef STUBOFFSET
-#define STUBOFFSET 0x4000
+#define DRAMSIZE (X1000_DRAM_SIZE - PLUGIN_BUFFER_SIZE - CODEC_SIZE)
#endif
/* default to full RAM (minus codecs&plugins) unless specified otherwise */
@@ -127,7 +127,7 @@ OUTPUT_FORMAT(elf32-littlemips)
/* The bit of IRAM that is available is used in the core */
#define IRAMSIZE 0
-#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
+#elif defined(CPU_TCC780X)
#define DRAMORIG 0x20000000
#if CONFIG_CPU==TCC7801
#define IRAMORIG 0x1000c000
@@ -179,7 +179,7 @@ OUTPUT_FORMAT(elf32-littlemips)
/* The bit of IRAM that is available is used in the core */
#elif CONFIG_CPU == X1000
-#define DRAMORIG (0x80000000 + STUBOFFSET)
+#define DRAMORIG X1000_DRAM_BASE
#define IRAM DRAM
#define IRAMSIZE 0
@@ -272,7 +272,7 @@ SECTIONS
*(.idata)
#endif
} > PLUGIN_RAM
-
+
#if NOCACHE_BASE != 0
.ncdata . + NOCACHE_BASE :
{
@@ -281,7 +281,7 @@ SECTIONS
. = ALIGN(CACHEALIGN_SIZE);
/* EABI currently needs these defined here, otherwise .iram and .bss can
sometimes have an incorrect load address, breaking codecs and plugins. */
- bssaddr = . - NOCACHE_BASE;
+ bssaddr = . - NOCACHE_BASE;
#if defined(IRAMSIZE) && IRAMSIZE != 0
iramcopy = . - NOCACHE_BASE;
#endif
@@ -299,6 +299,7 @@ SECTIONS
{
*(.eh_frame)
#ifdef CPU_MIPS
+ *(.MIPS.abiflags)
*(.rel.dyn)
#endif
}
@@ -314,7 +315,7 @@ SECTIONS
*(COMMON)
. = ALIGN(0x4);
} > PLUGIN_RAM
-
+
#if NOCACHE_BASE != 0
.ncbss . + NOCACHE_BASE (NOLOAD) :
{
@@ -354,7 +355,7 @@ SECTIONS
. = ALIGN(0x4);
iend = .;
} > PLUGIN_IRAM
-
+
loadendaddr = MAX(plugin_end_addr, LOADADDR(.iram) + SIZEOF(.iram));
#else
loadendaddr = plugin_end_addr;
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index b06789af6b..22484d0bc9 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -139,14 +139,6 @@
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
#define PONG_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define PONG_QUIT BUTTON_POWER
-#define PONG_PAUSE BUTTON_MENU
-#define PONG_LEFT_UP BUTTON_VOLUP
-#define PONG_LEFT_DOWN BUTTON_VOLDOWN
-#define PONG_RIGHT_UP BUTTON_RIGHT
-#define PONG_RIGHT_DOWN BUTTON_LEFT
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define PONG_QUIT BUTTON_BACK
#define PONG_LEFT_UP BUTTON_UP
diff --git a/apps/plugins/reversi/reversi-gui.h b/apps/plugins/reversi/reversi-gui.h
index fd60b23927..7e031e6103 100644
--- a/apps/plugins/reversi/reversi-gui.h
+++ b/apps/plugins/reversi/reversi-gui.h
@@ -136,15 +136,6 @@
#define REVERSI_BUTTON_QUIT BUTTON_POWER
#define REVERSI_BUTTON_MENU BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define REVERSI_BUTTON_QUIT BUTTON_POWER
-#define REVERSI_BUTTON_UP BUTTON_STOP
-#define REVERSI_BUTTON_DOWN BUTTON_PLAY
-#define REVERSI_BUTTON_LEFT BUTTON_LEFT
-#define REVERSI_BUTTON_RIGHT BUTTON_RIGHT
-#define REVERSI_BUTTON_MAKE_MOVE BUTTON_VOLUP
-#define REVERSI_BUTTON_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define REVERSI_BUTTON_QUIT BUTTON_BACK
#define REVERSI_BUTTON_UP BUTTON_UP
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 9c36f8f62f..07a15bfb62 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -152,17 +152,6 @@
#define ROCKBLOX_DROP BUTTON_SELECT
#define ROCKBLOX_RESTART BUTTON_A
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-#define ROCKBLOX_OFF BUTTON_PLAY
-#define ROCKBLOX_ROTATE_CCW BUTTON_UP
-#define ROCKBLOX_ROTATE_CW BUTTON_SELECT
-#define ROCKBLOX_DOWN BUTTON_DOWN
-#define ROCKBLOX_LEFT BUTTON_LEFT
-#define ROCKBLOX_RIGHT BUTTON_RIGHT
-#define ROCKBLOX_DROP BUTTON_MODE
-#define ROCKBLOX_RESTART BUTTON_EQ
-
#elif CONFIG_KEYPAD == MROBE500_PAD
#define ROCKBLOX_OFF BUTTON_POWER
@@ -205,17 +194,6 @@
#define ROCKBLOX_OFF BUTTON_POWER
#define ROCKBLOX_RESTART BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define ROCKBLOX_OFF BUTTON_POWER
-#define ROCKBLOX_ROTATE_CCW BUTTON_VOLDOWN
-#define ROCKBLOX_ROTATE_CW BUTTON_VOLUP
-#define ROCKBLOX_DOWN BUTTON_STOP
-#define ROCKBLOX_LEFT BUTTON_LEFT
-#define ROCKBLOX_RIGHT BUTTON_RIGHT
-#define ROCKBLOX_DROP BUTTON_PLAY
-#define ROCKBLOX_RESTART BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define ROCKBLOX_OFF BUTTON_BACK
#define ROCKBLOX_ROTATE_CCW BUTTON_UP
diff --git a/apps/plugins/rockboy/cpu.c b/apps/plugins/rockboy/cpu.c
index 392dd49b5f..037ea1bc37 100644
--- a/apps/plugins/rockboy/cpu.c
+++ b/apps/plugins/rockboy/cpu.c
@@ -13,7 +13,6 @@
#include "asm.h"
#endif
-
struct cpu cpu IBSS_ATTR;
bool plugbuf;
@@ -764,25 +763,32 @@ next:
__JR:
JR; break;
case 0x20: /* JR NZ */
- if (!(F&FZ)) goto __JR; NOJR; break;
+ if (!(F&FZ)) goto __JR;
+ NOJR; break;
case 0x28: /* JR Z */
- if (F&FZ) goto __JR; NOJR; break;
+ if (F&FZ) goto __JR;
+ NOJR; break;
case 0x30: /* JR NC */
- if (!(F&FC)) goto __JR; NOJR; break;
+ if (!(F&FC)) goto __JR;
+ NOJR; break;
case 0x38: /* JR C */
- if (F&FC) goto __JR; NOJR; break;
-
+ if (F&FC) goto __JR;
+ NOJR; break;
case 0xC3: /* JP */
__JP:
JP; break;
case 0xC2: /* JP NZ */
- if (!(F&FZ)) goto __JP; NOJP; break;
+ if (!(F&FZ)) goto __JP;
+ NOJP; break;
case 0xCA: /* JP Z */
- if (F&FZ) goto __JP; NOJP; break;
+ if (F&FZ) goto __JP;
+ NOJP; break;
case 0xD2: /* JP NC */
- if (!(F&FC)) goto __JP; NOJP; break;
+ if (!(F&FC)) goto __JP;
+ NOJP; break;
case 0xDA: /* JP C */
- if (F&FC) goto __JP; NOJP; break;
+ if (F&FC) goto __JP;
+ NOJP; break;
case 0xE9: /* JP HL */
PC = HL; break;
@@ -790,13 +796,17 @@ next:
__RET:
RET; break;
case 0xC0: /* RET NZ */
- if (!(F&FZ)) goto __RET; NORET; break;
+ if (!(F&FZ)) goto __RET;
+ NORET; break;
case 0xC8: /* RET Z */
- if (F&FZ) goto __RET; NORET; break;
+ if (F&FZ) goto __RET;
+ NORET; break;
case 0xD0: /* RET NC */
- if (!(F&FC)) goto __RET; NORET; break;
+ if (!(F&FC)) goto __RET;
+ NORET; break;
case 0xD8: /* RET C */
- if (F&FC) goto __RET; NORET; break;
+ if (F&FC) goto __RET;
+ NORET; break;
case 0xD9: /* RETI */
IME = IMA = 1; goto __RET;
@@ -804,13 +814,17 @@ next:
__CALL:
CALL; break;
case 0xC4: /* CALL NZ */
- if (!(F&FZ)) goto __CALL; NOCALL; break;
+ if (!(F&FZ)) goto __CALL;
+ NOCALL; break;
case 0xCC: /* CALL Z */
- if (F&FZ) goto __CALL; NOCALL; break;
+ if (F&FZ) goto __CALL;
+ NOCALL; break;
case 0xD4: /* CALL NC */
- if (!(F&FC)) goto __CALL; NOCALL; break;
+ if (!(F&FC)) goto __CALL;
+ NOCALL; break;
case 0xDC: /* CALL C */
- if (F&FC) goto __CALL; NOCALL; break;
+ if (F&FC) goto __CALL;
+ NOCALL; break;
case 0xC7: /* RST 0 */
b = 0x00; goto __RST;
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index 6dd010961e..d2c56ff6cc 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -122,16 +122,6 @@ static void setoptions (void)
options.SELECT = BUTTON_NONE;
options.MENU = (BUTTON_SELECT | BUTTON_REPEAT);
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
- options.UP = BUTTON_UP;
- options.DOWN = BUTTON_DOWN;
-
- options.A = BUTTON_PLAY;
- options.B = BUTTON_EQ;
- options.START = BUTTON_MODE;
- options.SELECT = (BUTTON_SELECT | BUTTON_REL);
- options.MENU = (BUTTON_SELECT | BUTTON_REPEAT);
-
#elif CONFIG_KEYPAD == GIGABEAT_PAD
options.UP = BUTTON_UP;
options.DOWN = BUTTON_DOWN;
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 9d57d7428c..41c671a38c 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -312,20 +312,6 @@
#define SOKOBAN_LEVEL_UP BUTTON_PLUS
#define SOKOBAN_MENU_NAME "[MENU]"
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define SOKOBAN_LEFT BUTTON_LEFT
-#define SOKOBAN_RIGHT BUTTON_RIGHT
-#define SOKOBAN_UP BUTTON_STOP
-#define SOKOBAN_DOWN BUTTON_PLAY
-#define SOKOBAN_MENU BUTTON_MENU
-#define SOKOBAN_UNDO BUTTON_VOLDOWN
-#define SOKOBAN_REDO BUTTON_VOLUP
-#define SOKOBAN_PAUSE (BUTTON_MENU|BUTTON_LEFT)
-#define BUTTON_SAVE (BUTTON_MENU|BUTTON_PLAY)
-#define BUTTON_SAVE_NAME "MENU+PLAY"
-
-#define SOKOBAN_RC_MENU (BUTTON_MENU|BUTTON_STOP)
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define SOKOBAN_LEFT BUTTON_LEFT
#define SOKOBAN_RIGHT BUTTON_RIGHT
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c
index 5259d0d616..bb96b8a44b 100644
--- a/apps/plugins/stopwatch.c
+++ b/apps/plugins/stopwatch.c
@@ -51,14 +51,6 @@
#define STOPWATCH_SCROLL_UP BUTTON_SCROLL_FWD
#define STOPWATCH_SCROLL_DOWN BUTTON_SCROLL_BACK
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define STOPWATCH_QUIT BUTTON_PLAY
-#define STOPWATCH_START_STOP BUTTON_MODE
-#define STOPWATCH_RESET_TIMER BUTTON_EQ
-#define STOPWATCH_LAP_TIMER BUTTON_SELECT
-#define STOPWATCH_SCROLL_UP BUTTON_UP
-#define STOPWATCH_SCROLL_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define STOPWATCH_QUIT BUTTON_POWER
#define STOPWATCH_START_STOP BUTTON_PLAY
@@ -133,15 +125,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define STOPWATCH_QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define STOPWATCH_QUIT BUTTON_MENU
-#define STOPWATCH_START_STOP BUTTON_PLAY
-#define STOPWATCH_RESET_TIMER BUTTON_STOP
-#define STOPWATCH_LAP_TIMER BUTTON_LEFT
-#define STOPWATCH_SCROLL_UP BUTTON_VOLUP
-#define STOPWATCH_SCROLL_DOWN BUTTON_VOLDOWN
-#define STOPWATCH_RC_QUIT BUTTON_POWER
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define STOPWATCH_QUIT BUTTON_BACK
#define STOPWATCH_START_STOP BUTTON_PLAY
diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h
index 6ee3eb33ee..1332a9a80f 100644
--- a/apps/plugins/sudoku/sudoku.h
+++ b/apps/plugins/sudoku/sudoku.h
@@ -181,16 +181,6 @@
#define SUDOKU_BUTTON_QUIT BUTTON_POWER
#define SUDOKU_BUTTON_MENU BUTTON_MENU
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define SUDOKU_BUTTON_QUIT BUTTON_POWER
-#define SUDOKU_BUTTON_UP BUTTON_STOP
-#define SUDOKU_BUTTON_DOWN BUTTON_PLAY
-#define SUDOKU_BUTTON_LEFT BUTTON_LEFT
-#define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
-#define SUDOKU_BUTTON_TOGGLE BUTTON_VOLUP
-#define SUDOKU_BUTTON_MENU BUTTON_MENU
-#define SUDOKU_BUTTON_POSSIBLE BUTTON_VOLDOWN
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define SUDOKU_BUTTON_QUIT BUTTON_BACK
#define SUDOKU_BUTTON_UP BUTTON_UP
diff --git a/apps/plugins/text_viewer/tv_button.h b/apps/plugins/text_viewer/tv_button.h
index bea8f829ef..d9a57d114f 100644
--- a/apps/plugins/text_viewer/tv_button.h
+++ b/apps/plugins/text_viewer/tv_button.h
@@ -75,17 +75,6 @@
#define TV_AUTOSCROLL BUTTON_PLAY
#define TV_BOOKMARK BUTTON_SELECT
-/* iFP7xx keys */
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define TV_QUIT BUTTON_PLAY
-#define TV_SCROLL_UP BUTTON_UP
-#define TV_SCROLL_DOWN BUTTON_DOWN
-#define TV_SCREEN_LEFT BUTTON_LEFT
-#define TV_SCREEN_RIGHT BUTTON_RIGHT
-#define TV_MENU BUTTON_MODE
-#define TV_AUTOSCROLL BUTTON_SELECT
-#define TV_BOOKMARK (BUTTON_LEFT|BUTTON_SELECT)
-
/* iAudio X5/M5 keys */
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
#define TV_QUIT BUTTON_POWER
@@ -247,18 +236,6 @@
#define TV_SCROLL_DOWN BUTTON_PLUS
#define TV_BOOKMARK (BUTTON_MENU|BUTTON_PLUS)
-/* Cowon iAudio 7 keys */
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define TV_QUIT BUTTON_POWER
-#define TV_SCROLL_UP BUTTON_VOLUP
-#define TV_SCROLL_DOWN BUTTON_VOLDOWN
-#define TV_SCREEN_LEFT BUTTON_LEFT
-#define TV_SCREEN_RIGHT BUTTON_RIGHT
-#define TV_MENU BUTTON_MENU
-#define TV_AUTOSCROLL BUTTON_PLAY
-#define TV_RC_QUIT BUTTON_STOP
-#define TV_BOOKMARK (BUTTON_LEFT|BUTTON_PLAY)
-
/* Creative Zen Vision:M keys */
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define TV_QUIT BUTTON_BACK
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 36aae071cb..cf959ad7f5 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -146,15 +146,6 @@
#define QUIT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define QUIT BUTTON_POWER
-#define LEFT BUTTON_LEFT
-#define RIGHT BUTTON_RIGHT
-#define UP BUTTON_STOP
-#define DOWN BUTTON_PLAY
-#define PAUSE BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define QUIT BUTTON_BACK
diff --git a/apps/plugins/zxbox/keymaps.h b/apps/plugins/zxbox/keymaps.h
index dbebc3b1d9..e9316a301b 100644
--- a/apps/plugins/zxbox/keymaps.h
+++ b/apps/plugins/zxbox/keymaps.h
@@ -47,14 +47,6 @@
#define ZX_SELECT BUTTON_SELECT
#define ZX_MENU BUTTON_PLAY
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-#define ZX_SELECT BUTTON_SELECT
-#define ZX_MENU BUTTON_PLAY
-#define ZX_LEFT BUTTON_LEFT
-#define ZX_RIGHT BUTTON_RIGHT
-#define ZX_UP BUTTON_UP
-#define ZX_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
#define ZX_SELECT BUTTON_REW
#define ZX_MENU BUTTON_FF
@@ -110,14 +102,6 @@
#elif CONFIG_KEYPAD == COWON_D2_PAD
#define ZX_MENU (BUTTON_MENU|BUTTON_REL)
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define ZX_UP BUTTON_STOP
-#define ZX_DOWN BUTTON_PLAY
-#define ZX_LEFT BUTTON_LEFT
-#define ZX_RIGHT BUTTON_RIGHT
-#define ZX_SELECT BUTTON_VOLUP
-#define ZX_MENU BUTTON_MENU
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define ZX_UP BUTTON_UP
#define ZX_DOWN BUTTON_DOWN
diff --git a/apps/plugins/zxbox/zxbox_keyb.c b/apps/plugins/zxbox/zxbox_keyb.c
index dd517e01e7..6e0997c339 100644
--- a/apps/plugins/zxbox/zxbox_keyb.c
+++ b/apps/plugins/zxbox/zxbox_keyb.c
@@ -32,17 +32,6 @@
#define KBD_UP BUTTON_SCROLL_BACK
#define KBD_DOWN BUTTON_SCROLL_FWD
-#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
-
-/* TODO: Check keyboard mappings */
-
-#define KBD_SELECT BUTTON_SELECT
-#define KBD_ABORT BUTTON_PLAY
-#define KBD_LEFT BUTTON_LEFT
-#define KBD_RIGHT BUTTON_RIGHT
-#define KBD_UP BUTTON_UP
-#define KBD_DOWN BUTTON_DOWN
-
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
/* TODO: Check keyboard mappings */
@@ -113,15 +102,6 @@
#define KBD_ABORT BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-
-#define KBD_SELECT BUTTON_MENU
-#define KBD_ABORT BUTTON_POWER
-#define KBD_LEFT BUTTON_LEFT
-#define KBD_RIGHT BUTTON_RIGHT
-#define KBD_UP BUTTON_STOP
-#define KBD_DOWN BUTTON_PLAY
-
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
#define KBD_SELECT BUTTON_SELECT
@@ -512,27 +492,27 @@ int zx_kbd_input(char* text/*, int buflen*/)
len_utf8 = rb->utf8length(text);
#endif
FOR_NB_SCREENS(l)
+ {
rb->screens[l]->clear_display();
+ }
-
- /* draw page */
- FOR_NB_SCREENS(l)
- {
- rb->screens[l]->setfont(param[l].curfont);
- k = param[l].page*param[l].max_chars*param[l].lines;
- for (i=j=0; j < param[l].lines && k < param[l].nchars; k++) {
- utf8 = rb->utf8encode(param[l].kbd_buf[k], outline);
- *utf8 = 0;
- rb->screens[l]->getstringsize(outline, &w, NULL);
- rb->screens[l]->putsxy(i*param[l].font_w + (param[l].font_w-w)/2, j*param[l].font_h
- + statusbar_size, outline);
- if (++i == param[l].max_chars) {
- i = 0;
- j++;
- }
+ /* draw page */
+ FOR_NB_SCREENS(l)
+ {
+ rb->screens[l]->setfont(param[l].curfont);
+ k = param[l].page*param[l].max_chars*param[l].lines;
+ for (i=j=0; j < param[l].lines && k < param[l].nchars; k++) {
+ utf8 = rb->utf8encode(param[l].kbd_buf[k], outline);
+ *utf8 = 0;
+ rb->screens[l]->getstringsize(outline, &w, NULL);
+ rb->screens[l]->putsxy(i*param[l].font_w + (param[l].font_w-w)/2, j*param[l].font_h
+ + statusbar_size, outline);
+ if (++i == param[l].max_chars) {
+ i = 0;
+ j++;
}
}
-
+ }
/* separator */
FOR_NB_SCREENS(l)
@@ -581,19 +561,20 @@ int zx_kbd_input(char* text/*, int buflen*/)
}
cur_blink = !cur_blink;
-
- /* highlight the key that has focus */
- FOR_NB_SCREENS(l)
- {
- rb->screens[l]->set_drawmode(DRMODE_COMPLEMENT);
- rb->screens[l]->fillrect(param[l].font_w * param[l].x,
- statusbar_size + param[l].font_h * param[l].y,
- param[l].font_w, param[l].font_h);
- rb->screens[l]->set_drawmode(DRMODE_SOLID);
- }
+ /* highlight the key that has focus */
+ FOR_NB_SCREENS(l)
+ {
+ rb->screens[l]->set_drawmode(DRMODE_COMPLEMENT);
+ rb->screens[l]->fillrect(param[l].font_w * param[l].x,
+ statusbar_size + param[l].font_h * param[l].y,
+ param[l].font_w, param[l].font_h);
+ rb->screens[l]->set_drawmode(DRMODE_SOLID);
+ }
FOR_NB_SCREENS(l)
- rb->screens[l]->update();
+ {
+ rb->screens[l]->update();
+ }
button = rb->button_get_w_tmo(HZ/2);
diff --git a/apps/settings.c b/apps/settings.c
index 99cede382b..f89fc581ca 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -1010,6 +1010,7 @@ void settings_apply(bool read_disk)
set_selective_softlock_actions(
global_settings.bt_selective_softlock_actions,
global_settings.bt_selective_softlock_actions_mask);
+ action_autosoftlock_init();
#endif
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
diff --git a/apps/settings.h b/apps/settings.h
index 5d6d4cb717..fedec8e025 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -576,6 +576,7 @@ struct user_settings
bool constrain_next_folder; /* whether next_folder is constrained to
directories within start_directory */
int recursive_dir_insert; /* should directories be inserted recursively */
+ bool playlist_reload_after_save; /* reload and resume playlist after saving */
bool fade_on_stop; /* fade on pause/unpause/stop */
bool playlist_shuffle;
bool warnon_erase_dynplaylist; /* warn when erasing dynamic playlist */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 4a0bf96864..c13df734e6 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1277,6 +1277,8 @@ const struct settings_list settings[] = {
CHOICE_SETTING(0, recursive_dir_insert, LANG_RECURSE_DIRECTORY , RECURSE_ON,
"recursive directory insert", off_on_ask, NULL , 3 ,
ID2P(LANG_OFF), ID2P(LANG_ON), ID2P(LANG_ASK)),
+ OFFON_SETTING(0, playlist_reload_after_save, LANG_PLAYLIST_RELOAD_AFTER_SAVE,
+ false, "reload after saving playlist", NULL),
/* bookmarks */
CHOICE_SETTING(0, autocreatebookmark, LANG_BOOKMARK_SETTINGS_AUTOCREATE,
BOOKMARK_NO, "autocreate bookmarks",
diff --git a/apps/tagcache.c b/apps/tagcache.c
index bff1550059..e6a4e8e3c4 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -2239,7 +2239,7 @@ static bool build_numeric_indices(struct tagcache_header *h, int tmpfd)
masterfd_pos = lseek(masterfd, tcmh.tch.entry_count * sizeof(struct index_entry),
SEEK_CUR);
- if (masterfd_pos == filesize(masterfd))
+ if (masterfd_pos < 0)
{
logf("we can't append!");
close(masterfd);
@@ -2988,12 +2988,7 @@ static bool commit(void)
}
if (tch.entry_count == 0)
- {
logf("nothing to commit");
- close(tmpfd);
- remove(TAGCACHE_FILE_TEMP);
- return true;
- }
/* Fully initialize existing headers (if any) before going further. */
tc_stat.ready = check_all_headers();
diff --git a/apps/tree.c b/apps/tree.c
index 9e4aafccfe..88ccff5e37 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -646,7 +646,7 @@ static int dirbrowse(void)
tc.dirlevel = 0; /* shouldnt be needed.. this code needs work! */
keyclick_set_callback(gui_synclist_keyclick_callback, &tree_lists);
- button = get_action(CONTEXT_TREE,
+ button = get_action(CONTEXT_TREE|ALLOW_SOFTLOCK,
list_do_action_timeout(&tree_lists, HZ/2));
oldbutton = button;
gui_synclist_do_button(&tree_lists, &button,LIST_WRAP_UNLESS_HELD);
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 446bdac0e1..57c23b115c 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -41,7 +41,7 @@ iriver_h1x0.c
iriver_h300.c
#elif defined(MROBE_500)
mrobe500.c
-#elif defined(CPU_TCC77X) || defined(CPU_TCC780X)
+#elif defined(CPU_TCC780X)
telechips.c
show_logo.c
#elif defined(MEIZU_M6SL)
@@ -89,6 +89,6 @@ show_logo.c
#elif defined(SANSA_CONNECT)
sansaconnect.c
show_logo.c
-#elif defined(FIIO_M3K) && !defined(BOOTLOADER_SPL)
+#elif defined(FIIO_M3K)
fiiom3k.c
#endif
diff --git a/bootloader/fat32format.c b/bootloader/fat32format.c
index 540ee89b54..a885a5fced 100644
--- a/bootloader/fat32format.c
+++ b/bootloader/fat32format.c
@@ -44,7 +44,6 @@
#include "storage.h"
#include "button.h"
#include "disk.h"
-#include "crc32-mi4.h"
#include <string.h>
#include "i2c.h"
#include "backlight-target.h"
diff --git a/bootloader/fiiom3k.c b/bootloader/fiiom3k.c
index 93010e86d2..3d42ba7314 100644
--- a/bootloader/fiiom3k.c
+++ b/bootloader/fiiom3k.c
@@ -20,17 +20,25 @@
****************************************************************************/
#include "system.h"
+#include "core_alloc.h"
#include "kernel/kernel-internal.h"
#include "i2c.h"
#include "power.h"
#include "lcd.h"
+#include "font.h"
#include "backlight.h"
+#include "backlight-target.h"
#include "button.h"
#include "storage.h"
#include "file_internal.h"
#include "disk.h"
+#include "usb.h"
#include "rb-loader.h"
#include "loader_strerror.h"
+#include "version.h"
+#include "installer-fiiom3k.h"
+#include "spl-x1000.h"
+#include "x1000/cpm.h"
/* Load address where the binary needs to be placed */
extern unsigned char loadaddress[];
@@ -53,46 +61,309 @@ void exec(void* dst, const void* src, int bytes)
__builtin_unreachable();
}
-static void error(const char* msg)
+static bool lcd_inited = false;
+static bool usb_inited = false;
+static bool disk_inited = false;
+
+static void init_lcd(void)
{
- /* Initialization of the LCD/buttons only if needed */
+ if(lcd_inited)
+ return;
+
lcd_init();
+ font_init();
+ lcd_setfont(FONT_SYSFIXED);
+
+ /* Clear screen before turning backlight on, otherwise we might
+ * display random garbage on the screen */
+ lcd_clear_display();
+ lcd_update();
+
backlight_init();
- button_init();
+ lcd_inited = true;
+}
+
+static void put_version(void)
+{
+ lcd_putsxy((LCD_WIDTH - (SYSFONT_WIDTH * strlen(rbversion))) / 2,
+ (LCD_HEIGHT - SYSFONT_HEIGHT), rbversion);
+}
+
+static void do_splash2(int delay, const char* msg, const char* msg2)
+{
+ init_lcd();
lcd_clear_display();
- lcd_puts(0, 0, msg);
- lcd_puts(0, 2, "Press POWER to power off");
+ lcd_putsxy((LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2,
+ (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg);
+ if(msg2) {
+ lcd_putsxy((LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg2))) / 2,
+ (LCD_HEIGHT + 2*SYSFONT_HEIGHT) / 2, msg2);
+ }
+
+ put_version();
lcd_update();
+ sleep(delay);
+}
+
+static void do_splash(int delay, const char* msg)
+{
+ do_splash2(delay, msg, NULL);
+}
+
+static void do_usb(void)
+{
+ if(!usb_inited) {
+ usb_init();
+ usb_start_monitoring();
+ usb_inited = true;
+ }
+ do_splash2(0, "Waiting for USB", "Press POWER to go back");
+
+ int btn;
+ while(1) {
+ btn = button_get(true);
+ if(btn == SYS_USB_CONNECTED)
+ break;
+ else if(btn == BUTTON_POWER)
+ return;
+ }
+
+ do_splash(0, "USB mode");
+ usb_acknowledge(SYS_USB_CONNECTED_ACK);
+ while(button_get(true) != SYS_USB_DISCONNECTED);
+
+ do_splash(3*HZ, "USB disconnected");
+}
+
+static int init_disk(void)
+{
+ if(disk_inited)
+ return 0;
+
+ while(!storage_present(0)) {
+ do_splash2(0, "Insert SD card", "Press POWER for recovery");
+ int btn = button_get_w_tmo(HZ);
+ if(btn == BUTTON_POWER)
+ return 1;
+ }
+
+ if(disk_mount_all() <= 0) {
+ do_splash(5*HZ, "Cannot mount filesystem");
+ return 1;
+ }
+
+ disk_inited = true;
+ return 0;
+}
+
+static void do_boot(void)
+{
+ if(init_disk() != 0)
+ return;
+
+ int loadsize = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
+ if(loadsize <= 0) {
+ do_splash2(5*HZ, "Error loading Rockbox",
+ loader_strerror(loadsize));
+ do_usb();
+ return;
+ }
+
+ if(lcd_inited)
+ backlight_hw_off();
+
+ disable_irq();
+ exec(loadaddress, loadbuffer, loadsize);
+}
+
+#define INSTALL 0
+#define BACKUP 1
+#define RESTORE 2
+
+static void do_install(int which)
+{
+ int rc = init_disk();
+ if(rc != 0) {
+ do_splash2(5*HZ, "Install aborted", "No SD card present");
+ return;
+ }
+
+ const char* msg;
+ if(rc == INSTALL)
+ msg = "Installing";
+ else if(rc == BACKUP)
+ msg = "Backing up";
+ else
+ msg = "Restoring backup";
+
+ do_splash(0, msg);
+
+ if(which == INSTALL)
+ rc = install_boot("/bootloader.m3k");
+ else if(which == BACKUP)
+ rc = backup_boot("/fiiom3k-boot.bin");
+ else
+ rc = restore_boot("/fiiom3k-boot.bin");
+
+ char buf[32];
+ snprintf(buf, sizeof(buf), "Failed! Error: %d", rc);
+ const char* msg1 = rc == 0 ? "Success" : buf;
+ const char* msg2 = "Press POWER to continue";
+ do_splash2(0, msg1, msg2);
+
+ button_clear_queue();
while(button_get(true) != BUTTON_POWER);
- power_off();
+}
+
+static void recovery_menu(void)
+{
+ static const char* items[] = {
+ "--- Rockbox recovery menu ---",
+ "[System]",
+ " Start Rockbox",
+ " USB mode",
+ " Shutdown",
+ " Reboot",
+ "[Bootloader]",
+ " Install or update",
+ " Backup",
+ " Restore",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "VOL+/VOL- move cursor",
+ "PLAY select item",
+ "POWER power off",
+ };
+
+ static const int nitems = sizeof(items) / sizeof(char*);
+
+ init_lcd();
+
+ int selection = 2;
+ do {
+ /* Draw menu */
+ lcd_clear_display();
+
+ for(int i = 0; i < nitems; ++i)
+ lcd_puts(0, i, items[i]);
+
+ if(items[selection][0] == ' ')
+ lcd_puts(0, selection, "=>");
+
+ put_version();
+ lcd_update();
+
+ /* Clear queue to avoid accidental input */
+ button_clear_queue();
+
+ /* Get the button */
+ int btn = button_get(true);
+
+ /* Process user input */
+ if(btn == BUTTON_VOL_UP) {
+ for(int i = selection-1; i >= 0; --i) {
+ if(items[i][0] == ' ') {
+ selection = i;
+ break;
+ }
+ }
+
+ continue;
+ } else if(btn == BUTTON_VOL_DOWN) {
+ for(int i = selection+1; i < nitems; ++i) {
+ if(items[i][0] == ' ') {
+ selection = i;
+ break;
+ }
+ }
+
+ continue;
+ } else if(btn == BUTTON_POWER) {
+ selection = 4; /* Shutdown */
+ } else if(btn != BUTTON_PLAY) {
+ continue;
+ }
+
+ /* User pressed PLAY so decide what action to take */
+ switch(selection) {
+ case 2: /* Start rockbox */
+ do_boot();
+ break;
+
+ case 3: /* USB mode */
+ do_usb();
+ break;
+
+ case 4: /* Shutdown */
+ do_splash(HZ, "Shutting down");
+ power_off();
+ break;
+
+ case 5: /* Reboot */
+ do_splash(HZ, "Rebooting");
+ system_reboot();
+ break;
+
+ case 7: /* Install bootloader */
+ do_install(INSTALL);
+ break;
+
+ case 8: /* Backup bootloader */
+ do_install(BACKUP);
+ break;
+
+ case 9: /* Restore bootloader */
+ do_install(RESTORE);
+ break;
+
+ default:
+ break;
+ }
+ } while(1);
}
void main(void)
{
+ bool recovery_mode = false;
+
+ /* This hack is needed because when USB booting, we cannot initialize
+ * clocks in the SPL -- it may break the mask ROM's USB code. So if the
+ * SPL has not already initialized the clocks, we need to do that now.
+ *
+ * Also use this as a sign that we should enter the recovery menu since
+ * this is probably the expected result if the user is USB booting...
+ */
+ if(jz_readf(CPM_MPCR, ENABLE)) {
+ spl_handle_pre_boot(0);
+ recovery_mode = true;
+ }
+
system_init();
+ core_allocator_init();
kernel_init();
i2c_init();
power_init();
+ button_init();
enable_irq();
- if(storage_init() < 0)
- error("Storage initialization failed");
+ if(storage_init() < 0) {
+ do_splash(3*HZ, "Failed to init storage");
+ power_off();
+ }
filesystem_init();
- if(!storage_present(0))
- error("No SD card present");
+ if(button_read_device() & BUTTON_VOL_UP)
+ recovery_mode = true;
- if(disk_mount_all() <= 0)
- error("Unable to mount filesystem");
+ if(!recovery_mode)
+ do_boot();
- int loadsize = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE);
- if(loadsize <= 0)
- error(loader_strerror(loadsize));
-
- disable_irq();
-
- exec(loadaddress, loadbuffer, loadsize);
+ /* If boot fails or user holds Vol+, go to recovery menu */
+ recovery_menu();
}
diff --git a/bootloader/main-e200r-installer.c b/bootloader/main-e200r-installer.c
index 5d1bff7b37..63b3fcb142 100644
--- a/bootloader/main-e200r-installer.c
+++ b/bootloader/main-e200r-installer.c
@@ -35,7 +35,7 @@
#include "file.h"
#include "button.h"
#include "disk.h"
-#include "crc32-mi4.h"
+#include "crc32.h"
#include <string.h>
#include "i2c.h"
#include "backlight-target.h"
@@ -138,7 +138,7 @@ void* main(void)
storage_read_sectors(pinfo.start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK,
1 , sector);
- crc32 = chksum_crc32 (sector, 512);
+ crc32 = crc_32r (sector, 512, 0);
#if 0 /* not needed in release builds */
printf("--- Hack Status ---");
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index ef766455b6..08b5ea3ef5 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -37,7 +37,7 @@
#include "adc.h"
#include "button.h"
#include "disk.h"
-#include "crc32-mi4.h"
+#include "crc32.h"
#include "mi4-loader.h"
#include "loader_strerror.h"
#include <string.h>
@@ -169,7 +169,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
(mi4header.mi4size-MI4_HEADER_SIZE)/512, buf);
/* Check CRC32 to see if we have a valid file */
- sum = chksum_crc32 (buf,mi4header.mi4size-MI4_HEADER_SIZE);
+ sum = crc_32r (buf,mi4header.mi4size-MI4_HEADER_SIZE,0);
printf("Calculated CRC32: %x", sum);
diff --git a/bootloader/sansaconnect.c b/bootloader/sansaconnect.c
index a6559fee55..a60fa71800 100644
--- a/bootloader/sansaconnect.c
+++ b/bootloader/sansaconnect.c
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id: $
*
-* Copyright (C) 2011 by Tomasz Moń
+* Copyright (C) 2011-2021 by Tomasz Moń
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
@@ -32,6 +32,188 @@
#include "uart-target.h"
#include "power.h"
#include "loader_strerror.h"
+#include "usb.h"
+
+#define FLASH_BASE 0x00100000
+#define PARAMETERS_FLASH_OFFSET 0x00010000
+#define PARAMETERS_SIZE_BYTES 0x00010000
+#define PARAMETERS_NUM 32
+
+#define FLASH_WRITE(addr, val) *(volatile uint16_t *)(FLASH_BASE + addr) = val
+#define FLASH_READ(addr) *(volatile uint16_t *)(FLASH_BASE + addr)
+
+#define PARAMETER_TYPE_BINARY 0xF00FB00B
+#define PARAMETER_TYPE_LONGBIN 0xBEADFEAD
+#define PARAMETER_TYPE_STRING 0xBEEFFACE
+
+typedef struct
+{
+ uint32_t magic;
+ char name[60];
+ char value[192];
+} parameter_t;
+
+/* Cache all parameters because parameters are stored on a single erase block */
+static union
+{
+ parameter_t entry[PARAMETERS_NUM];
+ /* raw consists of parameter_t array and bootloader graphics */
+ uint16_t raw[PARAMETERS_SIZE_BYTES/sizeof(uint16_t)];
+} parameters;
+
+static void parameters_load_from_flash(void)
+{
+ uint32_t offset = PARAMETERS_FLASH_OFFSET;
+ uint16_t *dst = parameters.raw;
+
+ while (offset < (PARAMETERS_FLASH_OFFSET + PARAMETERS_SIZE_BYTES))
+ {
+ *dst++ = FLASH_READ(offset);
+ offset += sizeof(uint16_t);
+ }
+}
+
+void parameters_erase(void) __attribute__ ((section(".icode")));
+void parameters_erase(void)
+{
+ uint32_t offset = PARAMETERS_FLASH_OFFSET;
+
+ while (offset < (PARAMETERS_FLASH_OFFSET + PARAMETERS_SIZE_BYTES))
+ {
+ if (FLASH_READ(offset) != 0xFFFF)
+ {
+ /* Found programmed halfword */
+ break;
+ }
+ offset += sizeof(uint16_t);
+ }
+
+ if (offset >= (PARAMETERS_FLASH_OFFSET + PARAMETERS_SIZE_BYTES))
+ {
+ /* Flash is already erased */
+ return;
+ }
+
+ /* Execute Block Erase sequence */
+ FLASH_WRITE(0xAAA, 0xAA);
+ FLASH_WRITE(0x554, 0x55);
+ FLASH_WRITE(0xAAA, 0x80);
+ FLASH_WRITE(0xAAA, 0xAA);
+ FLASH_WRITE(0x554, 0x55);
+ FLASH_WRITE(PARAMETERS_FLASH_OFFSET, 0x30);
+
+ /* Erase finishes once we read 0xFFFF on previously programmed halfword
+ * Typical block erase time is 0.7 s, maximum 15 s. Do not check the
+ * timeout here because we have to wait until the erase finishes as most
+ * of Rockbox bootloader code executes from flash.
+ */
+ do
+ {
+ /* Discard caches to force reads from memory */
+ commit_discard_idcache();
+ }
+ while (FLASH_READ(offset) != 0xFFFF);
+}
+
+void parameters_write_to_flash(void) __attribute__ ((section(".icode")));
+void parameters_write_to_flash(void)
+{
+ uint16_t *src = parameters.raw;
+ uint32_t offset = PARAMETERS_FLASH_OFFSET;
+
+ while (offset < (PARAMETERS_FLASH_OFFSET + PARAMETERS_SIZE_BYTES))
+ {
+ if (FLASH_READ(offset) != *src)
+ {
+ /* Program halfword */
+ FLASH_WRITE(0xAAA, 0xAA);
+ FLASH_WRITE(0x554, 0x55);
+ FLASH_WRITE(0xAAA, 0xA0);
+ FLASH_WRITE(offset, *src);
+
+ /* Word programming time typical is 14 us, maximum 330 us */
+ do
+ {
+ /* Discard caches to force reads from memory */
+ commit_discard_idcache();
+ }
+ while (FLASH_READ(offset) != *src);
+ }
+ offset += sizeof(uint16_t);
+ src++;
+ }
+}
+
+static void clear_recoverzap(void)
+{
+ int i;
+ bool needs_reflash = false;
+
+ parameters_load_from_flash();
+ for (i = 0; i < PARAMETERS_NUM; i++)
+ {
+ if ((parameters.entry[i].magic == PARAMETER_TYPE_STRING) &&
+ (!strcmp("recoverzap", parameters.entry[i].name)))
+ {
+ memset(&parameters.entry[i], 0xFF, sizeof(parameter_t));
+ needs_reflash = true;
+ }
+ }
+
+ if (needs_reflash)
+ {
+ int cpsr = disable_interrupt_save(IRQ_FIQ_STATUS);
+ printf("Erasing OF parameters memory");
+ parameters_erase();
+ printf("Flashing OF parameters");
+ parameters_write_to_flash();
+ printf("Cleared recoverzap parameter");
+ restore_interrupt(cpsr);
+ }
+}
+
+static void handle_usb(int connect_timeout)
+{
+ long end_tick = 0;
+
+ if (usb_detect() != USB_INSERTED)
+ {
+ return;
+ }
+
+ usb_init();
+ usb_start_monitoring();
+
+ printf("USB: Connecting");
+
+ if (connect_timeout != TIMEOUT_BLOCK)
+ {
+ end_tick = current_tick + connect_timeout;
+ }
+
+ while (usb_detect() == USB_INSERTED)
+ {
+ if (button_get_w_tmo(HZ/2) == SYS_USB_CONNECTED)
+ {
+ printf("Bootloader USB mode");
+ usb_acknowledge(SYS_USB_CONNECTED_ACK);
+ while (button_get_w_tmo(HZ/2) != SYS_USB_DISCONNECTED)
+ {
+ storage_spin();
+ }
+ break;
+ }
+
+ if (connect_timeout != TIMEOUT_BLOCK &&
+ TIME_AFTER(current_tick, end_tick))
+ {
+ printf("USB: Timed out");
+ break;
+ }
+ }
+
+ usb_close();
+}
extern void show_logo(void);
@@ -64,21 +246,25 @@ void main(void)
reset_screen();
show_logo();
- btn = button_read_device();
-
printf("Rockbox boot loader");
printf("Version %s", rbversion);
+ clear_recoverzap();
+
ret = storage_init();
if(ret)
printf("SD error: %d", ret);
filesystem_init();
+ handle_usb(2*HZ);
+
ret = disk_mount_all();
if (ret <= 0)
error(EDISK, ret, true);
+ btn = button_read_device();
+
if (btn & BUTTON_PREV)
{
printf("Loading OF firmware...");
@@ -129,8 +315,8 @@ void main(void)
ret = kernel_entry();
printf("FAILED!");
}
-
+
storage_sleepnow();
-
+
while(1);
}
diff --git a/docs/CREDITS b/docs/CREDITS
index 720c3a99db..7dee2ce527 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -703,6 +703,9 @@ Georg Gadinger
Wolfram Sang
Aidan MacDonald
Caleb Connolly
+Spencer Brennessel
+Dana Conrad
+Albert Song
The libmad team
The wavpack team
@@ -730,7 +733,6 @@ The libpng team
The Pure Data team (Miller Puckette and others)
The MikMod team
Michael McTernan (The ARM unwinder author)
-Albert Song
The New RAW team (Piotr Padkowski and others)
The Fabother World team (Fabien Sanglard and others)
The sgt-puzzles team (Simon Tatham and others)
@@ -743,5 +745,4 @@ The Pocket Quake team (Dan East and others)
The bzip2 team
The bsdiff team
The libtomcrypt team
-Spencer Brennessel
-Dana Conrad
+The microtar team (rxi and others)
diff --git a/firmware/SOURCES b/firmware/SOURCES
index d306f0b8e8..dc1ed865dd 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -242,9 +242,6 @@ common/crc32.c
#ifdef MODEL_NUMBER
common/loader_strerror.c
#endif
-#ifdef MI4_FORMAT
-common/crc32-mi4.c
-#endif
#ifdef RKW_FORMAT
common/crc32-rkw.c
#endif
@@ -336,9 +333,6 @@ drivers/touchscreen.c
/* Storage */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
-#if (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_IFP7XX)
-drivers/ata_flash.c
-#endif
#if (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_TCC)
target/arm/ata-nand-telechips.c
#endif
@@ -392,8 +386,6 @@ drivers/rtc/rtc_rx5x348ab.c
drivers/rtc/rtc_mr100.c
#elif (CONFIG_RTC == RTC_MC13783)
drivers/rtc/rtc_mc13783.c
-#elif (CONFIG_RTC == RTC_TCC77X)
-drivers/rtc/rtc_tcc77x.c
#elif (CONFIG_RTC == RTC_JZ4740)
drivers/rtc/rtc_jz4740.c
#elif (CONFIG_RTC == RTC_JZ4760)
@@ -603,7 +595,7 @@ target/arm/ipod/powermgmt-ipod-pcf.c
target/arm/pp/i2c-pp.c
#elif CONFIG_I2C == I2C_PNX0101
target/arm/pnx0101/i2c-pnx0101.c
-#elif CONFIG_I2C == I2C_TCC780X || CONFIG_I2C == I2C_TCC77X
+#elif CONFIG_I2C == I2C_TCC780X
target/arm/i2c-telechips.c
#elif CONFIG_I2C == I2C_S3C2440
target/arm/s3c2440/i2c-s3c2440.c
@@ -749,8 +741,6 @@ target/arm/pnx0101/crt0-pnx0101.S
target/arm/tms320dm320/crt0.S
#elif CONFIG_CPU==S3C2440
target/arm/s3c2440/crt0.S
-#elif defined(CPU_TCC77X)
-target/arm/tcc77x/crt0.S
#elif defined(CPU_TCC780X)
target/arm/tcc780x/crt0.S
#elif CONFIG_CPU==IMX31L
@@ -897,28 +887,8 @@ target/arm/s5l8700/ipodnano2g/adc-nano2g.c
target/arm/s5l8700/adc-s5l8700.c
# endif
-#elif CONFIG_I2C == I2C_TCC77X
-target/arm/tcc77x/adc-tcc77x.c
-
#endif /* CONFIG_I2C */
-#ifdef CPU_TCC77X
-target/arm/usb-tcc.c
-target/arm/tcc77x/kernel-tcc77x.c
-target/arm/tcc77x/system-tcc77x.c
-target/arm/tcc77x/timer-tcc77x.c
-# ifndef IAUDIO7
-target/arm/tcc77x/powermgmt-tcc77x.c
-# endif /* !IAUDIO7 */
-# ifndef BOOTLOADER
-# ifndef SANSA_C100
-target/arm/wmcodec-telechips.c
-# endif /* !C100 */
-target/arm/pcm-telechips.c
-target/arm/tcc77x/debug-tcc77x.c
-# endif /* !BOOTLOADER */
-#endif /* CPU_TCC77X */
-
#if CONFIG_CPU == S5L8700 || CONFIG_CPU == S5L8701
target/arm/s5l8700/kernel-s5l8700.c
target/arm/s5l8700/system-s5l8700.c
@@ -1063,12 +1033,9 @@ target/coldfire/iaudio/audio-iaudio.c
#endif
#endif /* IAUDIO_M3 */
-#ifdef IRIVER_IFP7XX_SERIES
#ifdef STUB
-ifp_usb_serial.c
libc/sscanf.c
#endif /* STUB */
-#endif /* IRIVER_IFP7XX_SERIES */
#if defined(IRIVER_H300_SERIES) || defined(IRIVER_H100_SERIES)
target/coldfire/iriver/ata-iriver.c
@@ -1293,7 +1260,8 @@ target/arm/tms320dm320/sansa-connect/crt0-board.S
target/arm/tms320dm320/sansa-connect/lcd-sansaconnect.c
target/arm/tms320dm320/sansa-connect/adc-sansaconnect.c
target/arm/tms320dm320/sansa-connect/power-sansaconnect.c
-target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c
+target/arm/tms320dm320/sansa-connect/tnetv105_cppi.c
+target/arm/tms320dm320/sansa-connect/tnetv105_usb_drv.c
target/arm/tms320dm320/sansa-connect/usb-sansaconnect.c
target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
target/arm/tms320dm320/sansa-connect/backlight-sansaconnect.c
@@ -1373,47 +1341,6 @@ target/arm/ipod/button-mini1g.c
target/arm/ipod/button-clickwheel.c
#endif /* IPOD_MINI2G */
-#ifdef IRIVER_IFP7XX
-target/arm/pnx0101/iriver-ifp7xx/adc-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c
-target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c
-#ifndef BOOTLOADER
-target/arm/pnx0101/pcm-pnx0101.c
-#endif /* BOOTLOADER */
-#endif /* IRIVER_IFP7XX */
-
-#ifdef LOGIK_DAX
-drivers/nand_id.c
-target/arm/tcc77x/logikdax/button-logikdax.c
-target/arm/tcc77x/logikdax/power-logikdax.c
-#ifndef BOOTLOADER
-target/arm/tcc77x/logikdax/audio-logikdax.c
-#endif /* BOOTLOADER */
-#endif /* LOGIK_DAX */
-
-#ifdef SANSA_M200
-drivers/nand_id.c
-target/arm/tcc77x/m200/button-m200.c
-target/arm/tcc77x/m200/power-m200.c
-#ifndef BOOTLOADER
-target/arm/tcc77x/m200/audio-m200.c
-#endif /* BOOTLOADER */
-#endif /* SANSA_M200 */
-
-#ifdef SANSA_C100
-drivers/nand_id.c
-target/arm/tcc77x/c100/lcd-S6B33B2.c
-target/arm/tcc77x/c100/button-c100.c
-target/arm/tcc77x/c100/power-c100.c
-#ifndef BOOTLOADER
-target/arm/tcc77x/c100/audio-c100.c
-#endif /* BOOTLOADER */
-#endif /* SANSA_C100 */
-
#ifdef SANSA_CLIPPLUS
target/arm/as3525/sansa-clipplus/lcd-clip-plus.c
target/arm/as3525/sansa-clipplus/button-clip.c
@@ -1525,19 +1452,6 @@ target/arm/as3525/sansa-clipzip/powermgmt-clipzip.c
#endif /* !BOOTLOADER */
#endif /* SANSA_CLIPZIP */
-#ifdef IAUDIO_7
-drivers/nand_id.c
-drivers/pcf50606.c
-target/arm/tcc77x/iaudio7/lcd-iaudio7.c
-target/arm/tcc77x/iaudio7/power-iaudio7.c
-target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c
-target/arm/tcc77x/iaudio7/button-iaudio7.c
-target/arm/tcc77x/iaudio7/ata2501.c
-#ifndef BOOTLOADER
-target/arm/tcc77x/iaudio7/audio-iaudio7.c
-#endif /* BOOTLOADER */
-#endif /* IAUDIO_7 */
-
#ifdef COWON_D2
drivers/lcd-memframe.c
drivers/nand_id.c
@@ -1741,15 +1655,18 @@ target/mips/ingenic_x1000/pwm-x1000.c
target/mips/ingenic_x1000/sfc-x1000.c
target/mips/ingenic_x1000/system-x1000.c
target/mips/ingenic_x1000/timer-x1000.c
+#ifndef USB_NONE
+target/mips/ingenic_x1000/usb-x1000.c
+#endif
#if (CONFIG_STORAGE & (STORAGE_SD|STORAGE_MMC|STORAGE_ATA))
target/mips/ingenic_x1000/msc-x1000.c
#endif
#if (CONFIG_STORAGE & STORAGE_SD)
target/mips/ingenic_x1000/sd-x1000.c
#endif
-#ifdef BOOTLOADER_SPL
+target/mips/ingenic_x1000/spl-start.S
target/mips/ingenic_x1000/spl-x1000.c
-#endif
+common/ucl_decompress.c
#endif /* CONFIG_CPU == X1000 */
#if defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX777)
@@ -1779,12 +1696,11 @@ target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c
target/mips/ingenic_x1000/fiiom3k/audiohw-fiiom3k.c
target/mips/ingenic_x1000/fiiom3k/backlight-fiiom3k.c
target/mips/ingenic_x1000/fiiom3k/button-fiiom3k.c
-target/mips/ingenic_x1000/fiiom3k/installer-fiiom3k.c
target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c
-target/mips/ingenic_x1000/fiiom3k/nand-fiiom3k.c
target/mips/ingenic_x1000/fiiom3k/power-fiiom3k.c
-#ifdef BOOTLOADER_SPL
target/mips/ingenic_x1000/fiiom3k/spl-fiiom3k.c
+#ifdef BOOTLOADER
+target/mips/ingenic_x1000/fiiom3k/installer-fiiom3k.c
#endif
#endif /* FIIO_M3K */
@@ -2009,12 +1925,17 @@ target/hosted/sdl/filesystem-sdl.c
drivers/touchpad.c
#endif
+/* Hardware drivers */
+#ifndef SIMULATOR
#ifdef HAVE_I2C_ASYNC
drivers/i2c-async.c
#endif
-
-#ifdef HAVE_AXP173
-drivers/axp173.c
+#ifdef HAVE_AXP_PMU
+drivers/axp-pmu.c
+#endif
+#ifdef HAVE_FT6x06
+drivers/ft6x06.c
+#endif
#endif
/* firmware/kernel section */
diff --git a/firmware/common/crc32-mi4.c b/firmware/common/crc32-mi4.c
deleted file mode 100644
index e1a5769018..0000000000
--- a/firmware/common/crc32-mi4.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id: crc32.c 10464 2006-08-05 20:19:10Z miipekk $
- *
- * Copyright (C) 2007 Barry Wardell
- *
- * 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.
- *
- ****************************************************************************/
-
-/*
- * We can't use the CRC32 implementation in the firmware library as it uses a
- * different polynomial. The polynomial needed is 0xEDB88320L
- *
- * CRC32 implementation taken from:
- *
- * efone - Distributed internet phone system.
- *
- * (c) 1999,2000 Krzysztof Dabrowski
- * (c) 1999,2000 ElysiuM deeZine
- *
- * 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.
- *
- */
-
-/* based on implementation by Finn Yannick Jacobs */
-
-#include "crc32-mi4.h"
-
-/* crc_tab[] -- this crcTable is being build by chksum_crc32GenTab().
- * so make sure, you call it before using the other
- * functions!
- */
-static const unsigned int crc_tab[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
-};
-
-/* chksum_crc() -- to a given block, this one calculates the
- * crc32-checksum until the length is
- * reached. the crc32-checksum will be
- * the result.
- */
-unsigned int chksum_crc32 (unsigned char *block, unsigned int length)
-{
- register unsigned long crc;
- unsigned long i;
-
- crc = 0;
- for (i = 0; i < length; i++)
- {
- crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) & 0xFF];
- }
- return (crc);
-}
diff --git a/firmware/common/crc32.c b/firmware/common/crc32.c
index c8c70e415c..1a9bc4faea 100644
--- a/firmware/common/crc32.c
+++ b/firmware/common/crc32.c
@@ -61,3 +61,33 @@ uint32_t crc_32(const void *src, uint32_t len, uint32_t crc32)
return crc32;
}
+
+/* crc_32r (derived from tinf crc32 which was taken from zlib)
+ * CRC32 algorithm taken from the zlib source, which is
+ * Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
+ */
+
+/* Tool function to calculate a CRC32 (reversed polynomial) across some buffer */
+/* third argument is either the starting value or value from last piece */
+uint32_t crc_32r(const void *src, uint32_t len, uint32_t crc32)
+{
+ const unsigned char* buf = src;
+
+ /* reversed polynomial from other crc32 function -- 0xEDB88320 */
+ static const unsigned crc32_lookup[16] =
+ {
+ 0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC,
+ 0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C,
+ 0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C,
+ 0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C
+ };
+
+ for(uint32_t i = 0; i < len; i++)
+ {
+ crc32 ^= buf[i];
+ crc32 = crc32_lookup[crc32 & 0x0F] ^ (crc32 >> 4);
+ crc32 = crc32_lookup[crc32 & 0x0F] ^ (crc32 >> 4);
+ }
+
+ return crc32;
+}
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 50addad27a..108431753a 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -135,5 +135,21 @@ void set_day_of_week(struct tm *tm)
if(m == 0 || m == 1) y--;
tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7;
}
+
+void set_day_of_year(struct tm *tm)
+{
+ int y=tm->tm_year+1900;
+ int d=tm->tm_mday;
+ int m=tm->tm_mon;
+ d+=m*30;
+ if( ( (m>1) && !(y%4) ) && ( (y%100) || !(y%400) ) )
+ d++;
+ if(m>6)
+ {
+ d+=4;
+ m-=7;
+ }
+ tm->tm_yday = d + ((m+1) /2);
+}
#endif /* CONFIG_RTC */
diff --git a/firmware/common/ucl_decompress.c b/firmware/common/ucl_decompress.c
new file mode 100644
index 0000000000..3b43d76f9d
--- /dev/null
+++ b/firmware/common/ucl_decompress.c
@@ -0,0 +1,192 @@
+/* Standalone version of ucl_nrv2e_decompress_8 from UCL library
+ * Original copyright notice:
+ */
+/* n2e_d.c -- implementation of the NRV2E decompression algorithm
+
+ This file is part of the UCL data compression library.
+
+ Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
+ All Rights Reserved.
+
+ The UCL library 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.
+
+ The UCL library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the UCL library; see the file COPYING.
+ If not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Markus F.X.J. Oberhumer
+ <markus@oberhumer.com>
+ http://www.oberhumer.com/opensource/ucl/
+ */
+
+#include "ucl_decompress.h"
+
+#define UCL_UINT32_C(c) c ## U
+#define fail(x, r) do if(x) { *dst_len = olen; return r; } while(0)
+
+#define getbit(bb) \
+ (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
+
+int ucl_nrv2e_decompress_8(const uint8_t* src, uint32_t src_len,
+ uint8_t* dst, uint32_t* dst_len)
+{
+ uint32_t bb = 0;
+ uint32_t ilen = 0, olen = 0, last_m_off = 1;
+ uint32_t oend = *dst_len;
+
+ for (;;)
+ {
+ uint32_t m_off, m_len;
+
+ while (getbit(bb))
+ {
+ fail(ilen >= src_len, UCL_E_INPUT_OVERRUN);
+ fail(olen >= oend, UCL_E_OUTPUT_OVERRUN);
+ dst[olen++] = src[ilen++];
+ }
+ m_off = 1;
+ for (;;)
+ {
+ m_off = m_off*2 + getbit(bb);
+ fail(ilen >= src_len, UCL_E_INPUT_OVERRUN);
+ fail(m_off > UCL_UINT32_C(0xffffff) + 3, UCL_E_LOOKBEHIND_OVERRUN);
+ if (getbit(bb)) break;
+ m_off = (m_off-1)*2 + getbit(bb);
+ }
+ if (m_off == 2)
+ {
+ m_off = last_m_off;
+ m_len = getbit(bb);
+ }
+ else
+ {
+ fail(ilen >= src_len, UCL_E_INPUT_OVERRUN);
+ m_off = (m_off-3)*256 + src[ilen++];
+ if (m_off == UCL_UINT32_C(0xffffffff))
+ break;
+ m_len = (m_off ^ UCL_UINT32_C(0xffffffff)) & 1;
+ m_off >>= 1;
+ last_m_off = ++m_off;
+ }
+ if (m_len)
+ m_len = 1 + getbit(bb);
+ else if (getbit(bb))
+ m_len = 3 + getbit(bb);
+ else
+ {
+ m_len++;
+ do {
+ m_len = m_len*2 + getbit(bb);
+ fail(ilen >= src_len, UCL_E_INPUT_OVERRUN);
+ fail(m_len >= oend, UCL_E_OUTPUT_OVERRUN);
+ } while (!getbit(bb));
+ m_len += 3;
+ }
+ m_len += (m_off > 0x500);
+ fail(olen + m_len > oend, UCL_E_OUTPUT_OVERRUN);
+ fail(m_off > olen, UCL_E_LOOKBEHIND_OVERRUN);
+ {
+ const uint8_t *m_pos;
+ m_pos = dst + olen - m_off;
+ dst[olen++] = *m_pos++;
+ do dst[olen++] = *m_pos++; while (--m_len > 0);
+ }
+ }
+ *dst_len = olen;
+ return ilen == src_len ? UCL_E_OK : (ilen < src_len ? UCL_E_INPUT_NOT_CONSUMED : UCL_E_INPUT_OVERRUN);
+}
+
+static uint32_t xread32(const uint8_t* d)
+{
+ uint32_t r = 0;
+ r |= d[0] << 24;
+ r |= d[1] << 16;
+ r |= d[2] << 8;
+ r |= d[3] << 0;
+ return r;
+}
+
+/* From uclpack.c */
+int ucl_unpack(const uint8_t* src, uint32_t src_len,
+ uint8_t* dst, uint32_t* dst_len)
+{
+ static const uint8_t magic[8] =
+ {0x00, 0xe9, 0x55, 0x43, 0x4c, 0xff, 0x01, 0x1a};
+
+ /* make sure there are enough bytes for the header */
+ if(src_len < 18)
+ return UCL_E_BAD_MAGIC;
+
+ /* avoid memcmp for reasons of code size */
+ for(size_t i = 0; i < sizeof(magic); ++i)
+ if(src[i] != magic[i])
+ return UCL_E_BAD_MAGIC;
+
+ /* read the other header fields */
+ /* uint32_t flags = xread32(&src[8]); */
+ uint8_t method = src[12];
+ /* uint8_t level = src[13]; */
+ uint32_t block_size = xread32(&src[14]);
+
+ /* check supported compression method */
+ if(method != 0x2e)
+ return UCL_E_UNSUPPORTED_METHOD;
+
+ /* validate */
+ if(block_size < 1024 || block_size > 8*1024*1024)
+ return UCL_E_BAD_BLOCK_SIZE;
+
+ /* process the blocks */
+ src += 18;
+ src_len -= 18;
+ uint32_t dst_ilen = *dst_len;
+ while(1) {
+ if(src_len < 4)
+ return UCL_E_TRUNCATED;
+
+ uint32_t out_len = xread32(src); src += 4, src_len -= 4;
+ if(out_len == 0)
+ break;
+
+ if(src_len < 4)
+ return UCL_E_TRUNCATED;
+
+ uint32_t in_len = xread32(src); src += 4, src_len -= 4;
+ if(in_len > block_size || out_len > block_size ||
+ in_len == 0 || in_len > out_len)
+ return UCL_E_CORRUPTED;
+
+ if(src_len < in_len)
+ return UCL_E_TRUNCATED;
+
+ if(in_len < out_len) {
+ uint32_t actual_out_len = dst_ilen;
+ int rc = ucl_nrv2e_decompress_8(src, in_len, dst, &actual_out_len);
+ if(rc != UCL_E_OK)
+ return rc;
+ if(actual_out_len != out_len)
+ return UCL_E_CORRUPTED;
+ } else {
+ for(size_t i = 0; i < in_len; ++i)
+ dst[i] = src[i];
+ }
+
+ src += in_len;
+ src_len -= in_len;
+ dst += out_len;
+ dst_ilen -= out_len;
+ }
+
+ /* subtract leftover number of bytes to get size of compressed output */
+ *dst_len -= dst_ilen;
+ return UCL_E_OK;
+}
diff --git a/firmware/common/vuprintf.c b/firmware/common/vuprintf.c
index fb053ae7da..6a3b29388b 100644
--- a/firmware/common/vuprintf.c
+++ b/firmware/common/vuprintf.c
@@ -30,13 +30,10 @@
#ifndef BOOTLOADER
-/* Only the Quake plugin needs float formatting */
-#if defined(HAVE_LCD_COLOR) && \
- (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE)) && \
- (PLUGIN_BUFFER_SIZE > 0x14000) && (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(CPU_ARM)
-/* turn everything on */
-#define FMT_LENMOD (0xffffffff)
-#define FMT_RADIX (0xffffffff)
+/* Turn everything on if we have enough RAM. */
+#if MEMORYSIZE >= 8
+# define FMT_LENMOD (0xffffffff)
+# define FMT_RADIX (0xffffffff)
#endif
#endif
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 3514511270..ec99239169 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -36,14 +36,6 @@
#include "storage.h"
#include "logf.h"
-/* The FC1307A ATA->SD chipset (used by the common iFlash adapters)
- doesn't support mandatory ATA power management commands. Unfortunately
- simply gating off the SLEEP command isn't sufficient; we need to
- disable advanced powersaving entirely because otherwise we might
- kill power before the device has finished flusing writes.
-*/
-//#define FC1307A_WORKAROUND
-
#define SELECT_DEVICE1 0x10
#define SELECT_LBA 0x40
@@ -58,10 +50,14 @@
#define CMD_WRITE_MULTIPLE 0xC5
#define CMD_WRITE_MULTIPLE_EXT 0x39
#define CMD_SET_MULTIPLE_MODE 0xC6
+#ifdef HAVE_ATA_SMART
+#define CMD_SMART 0xB0
+#endif
#define CMD_STANDBY_IMMEDIATE 0xE0
#define CMD_STANDBY 0xE2
#define CMD_IDENTIFY 0xEC
#define CMD_SLEEP 0xE6
+#define CMD_FLUSH_CACHE 0xE7
#define CMD_SET_FEATURES 0xEF
#define CMD_SECURITY_FREEZE_LOCK 0xF5
#ifdef HAVE_ATA_DMA
@@ -75,7 +71,6 @@
#ifdef HAVE_ATA_POWER_OFF
#define ATA_POWER_OFF_TIMEOUT 2*HZ
-#define ATA_POWER_OFF_TIMEOUT_NOPM 5*HZ
#endif
#if defined(HAVE_USBSTACK)
@@ -160,12 +155,7 @@ static inline bool ata_sleep_timed_out(void)
static inline void schedule_ata_power_off(void)
{
#ifdef HAVE_ATA_POWER_OFF
- power_off_tick = current_tick;
- /* If our device doesn't support SLEEP give a bit more time to flush */
- if (!(identify_info[82] & (1 << 3)))
- power_off_tick += ATA_POWER_OFF_TIMEOUT_NOPM;
- else
- power_off_tick += ATA_POWER_OFF_TIMEOUT;
+ power_off_tick = current_tick + ATA_POWER_OFF_TIMEOUT;
#endif
}
@@ -239,12 +229,6 @@ static int ata_perform_wakeup(int state)
static int ata_perform_sleep(void)
{
- /* Don't issue the sleep command if the device
- doesn't support (mandatory!) ATA power management commands!
- */
- if (!(identify_info[82] & (1 << 3)))
- return 0;
-
logf("ata SLEEP %ld", current_tick);
ATA_OUT8(ATA_SELECT, ata_device);
@@ -254,10 +238,25 @@ static int ata_perform_sleep(void)
return -1;
}
- ATA_OUT8(ATA_COMMAND, CMD_SLEEP);
+ /* STANDBY IMMEDIATE
+ - writes all cached data
+ - transitions to PM2:Standby
+ - enters Standby_z power condition
- if (!wait_for_rdy())
- {
+ This places the device into a state where power-off is safe, but
+ it is not the lowest-theoretical power state -- that is SLEEP, but
+ that is bugged on some SSDs (FC1307A-based).
+
+ TODO: Is there a practical downside to using STANDBY_IMMEDIATE instead
+ of SLEEP, assuming the former spins down the drive?
+ */
+ if (ata_disk_isssd()) {
+ ATA_OUT8(ATA_COMMAND, CMD_STANDBY_IMMEDIATE);
+ } else {
+ ATA_OUT8(ATA_COMMAND, CMD_SLEEP);
+ }
+
+ if (!wait_for_rdy()) {
DEBUGF("ata_perform_sleep() - CMD failed\n");
return -2;
}
@@ -265,6 +264,34 @@ static int ata_perform_sleep(void)
return 0;
}
+static int ata_perform_flush_cache(void)
+{
+ /* Don't issue the flush cache command if the device
+ doesn't support it, even though it's mandatory.
+ */
+ if (!(identify_info[83] & (1 << 12)))
+ return 0;
+
+ logf("ata FLUSH CACHE %ld", current_tick);
+
+ ATA_OUT8(ATA_SELECT, ata_device);
+
+ if(!wait_for_rdy()) {
+ DEBUGF("ata_perform_flush_cache() - not RDY\n");
+ return -1;
+ }
+
+ ATA_OUT8(ATA_COMMAND, CMD_FLUSH_CACHE);
+
+ if (!wait_for_rdy()) {
+ DEBUGF("ata_perform_flush_cache() - CMD failed\n");
+ return -2;
+ }
+
+ return 0;
+}
+
+
static ICODE_ATTR int wait_for_start_of_transfer(void)
{
if (!wait_for_bsy())
@@ -361,15 +388,27 @@ static ICODE_ATTR void copy_write_sectors(const unsigned char* buf,
int ata_disk_isssd(void)
{
- /* offset 217 is "Nominal Rotation rate"
+ /*
+ offset 217 is "Nominal Rotation rate"
0x0000 == Not reported
0x0001 == Solid State
0x0401 -> 0xffe == RPM
All others reserved
- Some CF cards return 0x0100 (ie byteswapped 0x0001) so accept either
+ Some CF cards return 0x0100 (ie byteswapped 0x0001) so accept either.
+
+ However, this is a very recent change, and we can't rely on it,
+ especially for the FC1307A CF->SD adapters.
+
+ So we have to resort to other heuristics.
+
+ offset 83 b2 is set to show device implementes CFA commands
+ offset 0 is 0x848a for CF, but that's not guaranteed, because reasons.
+
+ These don't guarantee this is an SSD but it's better than nothing.
*/
- return (identify_info[217] == 0x0001 || identify_info[217] == 0x0100);
+ return (identify_info[83] & (1<<2) ||
+ identify_info[217] == 0x0001 || identify_info[217] == 0x0100);
}
static int ata_transfer_sectors(unsigned long start,
@@ -836,29 +875,16 @@ void ata_spindown(int seconds)
bool ata_disk_is_active(void)
{
-#ifdef FC1307A_WORKAROUND
- /* "active" == "spinning" in this context.
- without power management this becomes moot */
- if (!(identify_info[82] & (1 << 3)))
- return false;
-#endif
-
return ata_state >= ATA_SPINUP;
}
void ata_sleepnow(void)
{
-#ifdef FC1307A_WORKAROUND
- /* Completely disable all power management */
- if (!(identify_info[82] & (1 << 3)))
- return;
-#endif
-
if (ata_state >= ATA_SPINUP) {
logf("ata SLEEPNOW %ld", current_tick);
mutex_lock(&ata_mtx);
if (ata_state == ATA_ON) {
- if (!ata_perform_sleep()) {
+ if (!ata_perform_flush_cache() && !ata_perform_sleep()) {
ata_state = ATA_SLEEPING;
schedule_ata_power_off();
}
@@ -1093,7 +1119,7 @@ static int set_features(void)
unsigned char parameter;
} features[] = {
{ 83, 14, 0x03, 0 }, /* force PIO mode */
- { 83, 3, 0x05, 0x80 }, /* adv. power management: lowest w/o standby */
+ { 83, 3, 0x05, 0x80 }, /* adv. power management: lowest w/o standby */ // TODO: What about FC1307A that doesn't advertise this properly?
{ 83, 9, 0x42, 0x80 }, /* acoustic management: lowest noise */
{ 82, 6, 0xaa, 0 }, /* enable read look-ahead */
#ifdef HAVE_ATA_DMA
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
deleted file mode 100644
index fbdd7f04ee..0000000000
--- a/firmware/drivers/ata_flash.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2005 Tomasz Malesinski
- *
- * 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 "storage.h"
-#include <stdbool.h>
-#include <string.h>
-
-#if CONFIG_CPU == PNX0101
-#include "pnx0101.h"
-#endif
-
-/*
-#include "kernel.h"
-#include "thread.h"
-#include "led.h"
-#include "cpu.h"
-#include "system.h"
-#include "debug.h"
-#include "panic.h"
-#include "usb.h"
-#include "power.h"
-#include "string.h"
-*/
-
-#define SECTOR_SIZE (512)
-
-static long last_disk_activity = -1;
-
-#if CONFIG_FLASH == FLASH_IFP7XX
-static unsigned char flash_ce[4] = {0x20, 0x02, 0x10, 0x08};
-
-#define FLASH_IO_BASE 0x28000000
-#define FLASH_REG_DATA (*((volatile unsigned char*)(FLASH_IO_BASE)))
-#define FLASH_REG_CMD (*((volatile unsigned char*)(FLASH_IO_BASE + 4)))
-#define FLASH_REG_ADDR (*((volatile unsigned char*)(FLASH_IO_BASE + 8)))
-
-#define SEGMENT_SIZE 1000
-#define MAX_N_SEGMENTS 8
-
-#endif
-
-#define FLASH_MODEL_NONE 0
-#define FLASH_MODEL_256 1
-#define FLASH_MODEL_512 2
-
-struct flash_disk
-{
- unsigned short block_map[MAX_N_SEGMENTS][SEGMENT_SIZE];
- short cur_block;
- int cur_phblock_start;
- int n_chips;
- unsigned char chip_no[4];
- unsigned char model;
-};
-
-static struct flash_disk flash_disk;
-
-static void flash_select_chip(int no, int sel)
-{
-#if CONFIG_FLASH == FLASH_IFP7XX
- if (sel)
- GPIO5_CLR = flash_ce[no];
- else
- GPIO5_SET = flash_ce[no];
-#endif
-}
-
-static inline unsigned char flash_read_data(void)
-{
- return FLASH_REG_DATA;
-}
-
-static inline void flash_write_data(unsigned char data)
-{
- FLASH_REG_DATA = data;
-}
-
-/* TODO: these two doesn't work when inlined, probably some
- delay is required */
-
-static void flash_write_cmd(unsigned char cmd)
-{
- FLASH_REG_CMD = cmd;
-}
-
-static void flash_write_addr(unsigned char addr)
-{
- FLASH_REG_ADDR = addr;
-}
-
-static void flash_wait_ready(void)
-{
- int i;
- for (i = 0; i < 5; i++)
- while ((GPIO6_READ & 8) == 0);
-}
-
-static unsigned char model_n_sectors_order[] = {0, 19, 20};
-
-static int flash_map_sector(int sector, int* chip, int* chip_sector)
-{
- int ord, c;
- if (flash_disk.model == FLASH_MODEL_NONE)
- return -1;
-
- ord = model_n_sectors_order[flash_disk.model];
- c = sector >> ord;
- *chip_sector = sector & ((1 << ord) - 1);
-
- if (c >= flash_disk.n_chips)
- return -1;
-
- *chip = flash_disk.chip_no[c];
- return 0;
-}
-
-static int flash_read_id(int no) {
- int id;
-
- flash_select_chip(no, 1);
- flash_write_cmd(0x90);
- flash_write_addr(0);
-
- flash_read_data();
- id = flash_read_data();
-
- flash_select_chip(no, 0);
- return id;
-}
-
-static int flash_read_sector(int sector, unsigned char* buf,
- unsigned char* oob)
-{
- unsigned long *bufl = (unsigned long *)buf;
- int chip, chip_sector;
- int i;
-
- if (flash_map_sector(sector, &chip, &chip_sector) < 0)
- return -1;
-
- flash_select_chip(chip, 1);
-
- flash_write_cmd(0x00);
- flash_write_addr(0);
- flash_write_addr((chip_sector << 1) & 7);
- flash_write_addr((chip_sector >> 2) & 0xff);
- flash_write_addr((chip_sector >> 10) & 0xff);
- flash_write_addr((chip_sector >> 18) & 0xff);
- flash_write_cmd(0x30);
-
- flash_wait_ready();
-
- if ((unsigned long)buf & 3)
- {
- for (i = 0; i < 512; i++)
- buf[i] = flash_read_data();
- }
- else
- {
- for (i = 0; i < 512 / 4; i++) {
- unsigned long v;
-#ifdef ROCKBOX_LITTLE_ENDIAN
- v = flash_read_data();
- v |= (unsigned long)flash_read_data() << 8;
- v |= (unsigned long)flash_read_data() << 16;
- v |= (unsigned long)flash_read_data() << 24;
-#else
- v = (unsigned long)flash_read_data() << 24;
- v |= (unsigned long)flash_read_data() << 16;
- v |= (unsigned long)flash_read_data() << 8;
- v |= flash_read_data();
-#endif
- bufl[i] = v;
- }
- }
-
- flash_write_cmd(0x05);
- flash_write_addr((chip_sector & 3) * 0x10);
- flash_write_addr(8);
- flash_write_cmd(0xe0);
-
- for (i = 0; i < 16; i++)
- oob[i] = flash_read_data();
-
- flash_select_chip(chip, 0);
- return 0;
-}
-
-static int flash_read_sector_oob(int sector, unsigned char* oob)
-{
- int chip, chip_sector;
- int i;
-
- if (flash_map_sector(sector, &chip, &chip_sector) < 0)
- return -1;
-
- flash_select_chip(chip, 1);
-
- flash_write_cmd(0x00);
- flash_write_addr((chip_sector & 3) * 0x10);
- flash_write_addr(8);
- flash_write_addr((chip_sector >> 2) & 0xff);
- flash_write_addr((chip_sector >> 10) & 0xff);
- flash_write_addr((chip_sector >> 18) & 0xff);
- flash_write_cmd(0x30);
-
- flash_wait_ready();
-
- for (i = 0; i < 16; i++)
- oob[i] = flash_read_data();
-
- flash_select_chip(chip, 0);
- return 0;
-}
-
-static unsigned char model_n_segments[] = {0, 2, 4};
-
-static inline int flash_get_n_segments(void)
-{
- return model_n_segments[flash_disk.model] * flash_disk.n_chips;
-}
-
-static inline int flash_get_n_phblocks(void)
-{
- return 1024;
-}
-
-static int model_n_sectors_in_block[] = {0, 256, 256};
-
-static int flash_get_n_sectors_in_block(void)
-{
- return model_n_sectors_in_block[flash_disk.model];
-}
-
-static int flash_phblock_to_sector(int segment, int block)
-{
- return (segment * flash_get_n_phblocks() + block)
- * flash_get_n_sectors_in_block();
-}
-
-static int flash_is_bad_block(unsigned char* oob)
-{
- /* TODO: should we check two pages? (see datasheet) */
- return oob[0] != 0xff;
-}
-
-static int count_1(int n) {
- int r = 0;
- while (n != 0) {
- r += (n & 1);
- n >>= 1;
- }
- return r;
-}
-
-static int flash_get_logical_block_no(unsigned char* oob)
-{
- int no1, no2;
- no1 = oob[6] + (oob[7] << 8);
- no2 = oob[11] + (oob[12] << 8);
-
- if (no1 == no2 && (no1 & 0xf000) == 0x1000)
- return (no1 & 0xfff) >> 1;
-
- if (count_1(no1 ^ no2) > 1)
- return -1;
-
- if ((no1 & 0xf000) == 0x1000
- && (count_1(no1) & 1) == 0)
- return (no1 & 0xfff) >> 1;
-
- if ((no2 & 0xf000) == 0x1000
- && (count_1(no2) & 1) == 0)
- return (no2 & 0xfff) >> 1;
-
- return -1;
-}
-
-static int flash_disk_scan(void)
-{
- int n_segments, n_phblocks;
- unsigned char oob[16];
- int s, b;
-
- /* TODO: checking for double blocks */
-
- n_segments = flash_get_n_segments();
- n_phblocks = flash_get_n_phblocks();
-
- flash_disk.cur_block = -1;
- flash_disk.cur_phblock_start = -1;
-
- for (s = 0; s < n_segments; s++)
- {
- for (b = 0; b < n_phblocks; b++)
- {
- int r;
- r = flash_read_sector_oob(flash_phblock_to_sector(s, b),
- oob);
- if (r >= 0 && !flash_is_bad_block(oob))
- {
- int lb;
- lb = flash_get_logical_block_no(oob);
- if (lb >= 0 && lb < SEGMENT_SIZE)
- flash_disk.block_map[s][lb] = b;
- }
- }
- }
- return 0;
-}
-
-static int flash_disk_find_block(int block)
-{
- int seg, bmod, phb;
- unsigned char oob[16];
- int r;
-
- if (block >= SEGMENT_SIZE * flash_get_n_segments())
- return -1;
-
- if (block == flash_disk.cur_block)
- return flash_disk.cur_phblock_start;
-
- seg = block / SEGMENT_SIZE;
- bmod = block % SEGMENT_SIZE;
-
- phb = flash_disk.block_map[seg][bmod];
- r = flash_read_sector_oob(flash_phblock_to_sector(seg, phb), oob);
- if (r < 0)
- return -1;
- if (flash_is_bad_block(oob))
- return -1;
- if (flash_get_logical_block_no(oob) != bmod)
- return -1;
-
- flash_disk.cur_block = block;
- flash_disk.cur_phblock_start = flash_phblock_to_sector(seg, phb);
- return flash_disk.cur_phblock_start;
-}
-
-static int flash_disk_read_sectors(unsigned long start,
- int count,
- void* buf)
-{
- int block, secmod, done;
- int phb;
- char oob[16];
-
- block = start / flash_get_n_sectors_in_block();
- secmod = start % flash_get_n_sectors_in_block();
-
- phb = flash_disk_find_block(block);
- done = 0;
- while (count > 0 && secmod < flash_get_n_sectors_in_block())
- {
- if (phb >= 0)
- flash_read_sector(phb + secmod, buf, oob);
- else
- memset(buf, 0, SECTOR_SIZE);
-
- buf += SECTOR_SIZE;
- count--;
- secmod++;
- done++;
- }
- return done;
-}
-
-int nand_read_sectors(IF_MD(int drive,)
- unsigned long start,
- int incount,
- void* inbuf)
-{
- while (incount > 0)
- {
- int done = flash_disk_read_sectors(start, incount, inbuf);
- if (done < 0)
- return -1;
- start += done;
- incount -= done;
- inbuf += SECTOR_SIZE * done;
- }
- return 0;
-}
-
-int nand_write_sectors(IF_MD(int drive,)
- unsigned long start,
- int count,
- const void* buf)
-{
- (void)start;
- (void)count;
- (void)buf;
- return -1;
-}
-
-int nand_init(void)
-{
- int i, id, id2;
-
- id = flash_read_id(0);
- switch (id)
- {
- case 0xda:
- flash_disk.model = FLASH_MODEL_256;
- break;
- case 0xdc:
- flash_disk.model = FLASH_MODEL_512;
- break;
- default:
- flash_disk.model = FLASH_MODEL_NONE;
- return -1;
- }
-
- flash_disk.n_chips = 1;
- flash_disk.chip_no[0] = 0;
- for (i = 1; i < 4; i++)
- {
- id2 = flash_read_id(i);
- if (id2 == id)
- flash_disk.chip_no[flash_disk.n_chips++] = i;
- }
-
- if (flash_disk_scan() < 0)
- return -2;
-
- return 0;
-}
-
-long nand_last_disk_activity(void)
-{
- return last_disk_activity;
-}
-
-#ifdef STORAGE_GET_INFO
-void nand_get_info(struct storage_info *info)
-{
- unsigned long blocks;
- int i;
-
- /* firmware version */
- info->revision="0.00";
-
- /* vendor field, need better name? */
- info->vendor="Rockbox";
- /* model field, need better name? */
- info->product="TNFL";
-
- /* blocks count */
- info->num_sectors = 0;
- info->sector_size=SECTOR_SIZE;
-
- info->serial=0;
-}
-#endif
-
-#ifdef CONFIG_STORAGE_MULTI
-int nand_num_drives(int first_drive)
-{
- /* We don't care which logical drive number(s) we have been assigned */
- (void)first_drive;
-
- return 1;
-}
-#endif
-
diff --git a/firmware/drivers/audio/aic3x.c b/firmware/drivers/audio/aic3x.c
index 9b705db7f5..39576e9f47 100644
--- a/firmware/drivers/audio/aic3x.c
+++ b/firmware/drivers/audio/aic3x.c
@@ -305,8 +305,8 @@ void aic3x_switch_output(bool stereo)
{
if (stereo)
{
- /* mute MONO_LOP/M */
- aic3x_change_reg(AIC3X_MONO_LOP_M_LVL, 0x00, 0xF6);
+ /* MONO_LOP/M not fully powered up */
+ aic3x_change_reg(AIC3X_MONO_LOP_M_LVL, 0x00, 0xFE);
/* HPLOUT fully powered up */
aic3x_change_reg(AIC3X_HPLOUT_LVL, 0x01, 0xFF);
/* HPROUT fully powered up */
@@ -316,8 +316,8 @@ void aic3x_switch_output(bool stereo)
}
else
{
- /* MONO_LOP/M not muted */
- aic3x_change_reg(AIC3X_MONO_LOP_M_LVL, 0x09, 0xFF);
+ /* MONO_LOP/M fully powered up */
+ aic3x_change_reg(AIC3X_MONO_LOP_M_LVL, 0x01, 0xFF);
/* HPLOUT not fully powered up */
aic3x_change_reg(AIC3X_HPLOUT_LVL, 0x00, 0xFE);
/* HPROUT not fully powered up */
diff --git a/firmware/drivers/audio/ak4376.c b/firmware/drivers/audio/ak4376.c
index 494bbabfa4..11714b210d 100644
--- a/firmware/drivers/audio/ak4376.c
+++ b/firmware/drivers/audio/ak4376.c
@@ -27,6 +27,18 @@
#include "system.h"
#include "i2c-async.h"
+/* sample rates supported by the hardware */
+#define CAPS (SAMPR_CAP_192 | SAMPR_CAP_176 | \
+ SAMPR_CAP_96 | SAMPR_CAP_88 | SAMPR_CAP_64 | \
+ SAMPR_CAP_48 | SAMPR_CAP_44 | SAMPR_CAP_32 | \
+ SAMPR_CAP_24 | SAMPR_CAP_22 | SAMPR_CAP_16 | \
+ SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
+
+/* future proofing */
+#if (HW_SAMPR_CAPS & ~CAPS) != 0
+# error "incorrect HW_SAMPR_CAPS"
+#endif
+
#ifndef HAVE_SW_VOLUME_CONTROL
# error "AK4376 requires HAVE_SW_VOLUME_CONTROL!"
#endif
@@ -40,7 +52,7 @@
*/
/* Converts HW_FREQ_XX constants to register values */
-static const int ak4376_fsel_to_hw[] = {
+static const uint8_t ak4376_fsel_to_hw[] = {
HW_HAVE_192_(AK4376_FS_192,)
HW_HAVE_176_(AK4376_FS_176,)
HW_HAVE_96_(AK4376_FS_96,)
@@ -57,19 +69,13 @@ static const int ak4376_fsel_to_hw[] = {
HW_HAVE_8_(AK4376_FS_8,)
};
-static struct ak4376 {
- int fsel;
- int low_mode;
- int regs[AK4376_NUM_REGS];
-} ak4376;
+static int ak4376_regs[AK4376_NUM_REGS];
-void ak4376_init(void)
+void ak4376_open(void)
{
/* Initialize DAC state */
- ak4376.fsel = HW_FREQ_48;
- ak4376.low_mode = 0;
for(int i = 0; i < AK4376_NUM_REGS; ++i)
- ak4376.regs[i] = -1;
+ ak4376_regs[i] = -1;
/* Initial reset after power-on */
ak4376_set_pdn_pin(0);
@@ -102,9 +108,6 @@ void ak4376_init(void)
/* Write initial configuration prior to power-up */
for(size_t i = 0; i < ARRAYLEN(init_config); i += 2)
ak4376_write(init_config[i], init_config[i+1]);
-
- /* Initial frequency setting, also handles DAC/amp power-up */
- audiohw_set_frequency(HW_FREQ_48);
}
void ak4376_close(void)
@@ -121,22 +124,22 @@ void ak4376_close(void)
void ak4376_write(int reg, int value)
{
/* Ensure value is sensible and differs from the last set value */
- if((value & 0xff) == value && ak4376.regs[reg] != value) {
+ if((value & 0xff) == value && ak4376_regs[reg] != value) {
int r = i2c_reg_write1(AK4376_BUS, AK4376_ADDR, reg, value);
if(r == I2C_STATUS_OK)
- ak4376.regs[reg] = value;
+ ak4376_regs[reg] = value;
else
- ak4376.regs[reg] = -1;
+ ak4376_regs[reg] = -1;
}
}
int ak4376_read(int reg)
{
/* Only read from I2C if we don't already know the value */
- if(ak4376.regs[reg] < 0)
- ak4376.regs[reg] = i2c_reg_read1(AK4376_BUS, AK4376_ADDR, reg);
+ if(ak4376_regs[reg] < 0)
+ ak4376_regs[reg] = i2c_reg_read1(AK4376_BUS, AK4376_ADDR, reg);
- return ak4376.regs[reg];
+ return ak4376_regs[reg];
}
static int round_step_up(int x, int step)
@@ -180,7 +183,7 @@ static int amp_vol_to_hw(int vol)
return (vol - AK4376_AMP_VOLUME_MIN) / AK4376_AMP_VOLUME_STEP + 1;
}
-void audiohw_set_volume(int vol_l, int vol_r)
+void ak4376_set_volume(int vol_l, int vol_r)
{
int amp;
int mix_l = AK4376_MIX_LCH, dig_l, sw_l;
@@ -210,7 +213,7 @@ void audiohw_set_volume(int vol_l, int vol_r)
pcm_set_master_volume(sw_l, sw_r);
}
-void audiohw_set_filter_roll_off(int val)
+void ak4376_set_filter_roll_off(int val)
{
int reg = ak4376_read(AK4376_REG_FILTER);
reg &= ~0xc0;
@@ -218,11 +221,8 @@ void audiohw_set_filter_roll_off(int val)
ak4376_write(AK4376_REG_FILTER, reg);
}
-void audiohw_set_frequency(int fsel)
+void ak4376_set_freqmode(int fsel, int mult, int power_mode)
{
- /* Determine master clock multiplier */
- int mult = ak4376_set_mclk_freq(fsel, false);
-
/* Calculate clock mode for frequency. Multipliers of 32/64 are only
* for rates >= 256 KHz which are not supported by Rockbox, so they
* are commented out -- but they're in the correct place. */
@@ -248,27 +248,11 @@ void audiohw_set_frequency(int fsel)
/* Handle the DSMLP bit in the MODE_CTRL register */
int mode_ctrl = 0x00;
- if(ak4376.low_mode || hw_freq_sampr[fsel] <= SAMPR_12)
+ if(power_mode || hw_freq_sampr[fsel] <= SAMPR_12)
mode_ctrl |= 0x40;
/* Program the new settings */
ak4376_write(AK4376_REG_CLOCK_MODE, clock_mode);
ak4376_write(AK4376_REG_MODE_CTRL, mode_ctrl);
- ak4376_write(AK4376_REG_PWR3, ak4376.low_mode ? 0x11 : 0x01);
-
- /* Enable the master clock */
- ak4376_set_mclk_freq(fsel, true);
-
- /* Remember the frequency */
- ak4376.fsel = fsel;
-}
-
-void audiohw_set_power_mode(int mode)
-{
- /* This is handled via audiohw_set_frequency() since changing LPMODE
- * bit requires power-down/power-up & changing other bits as well */
- if(ak4376.low_mode != mode) {
- ak4376.low_mode = mode;
- audiohw_set_frequency(ak4376.fsel);
- }
+ ak4376_write(AK4376_REG_PWR3, power_mode ? 0x11 : 0x01);
}
diff --git a/firmware/drivers/axp-pmu.c b/firmware/drivers/axp-pmu.c
new file mode 100644
index 0000000000..fd1126dbbf
--- /dev/null
+++ b/firmware/drivers/axp-pmu.c
@@ -0,0 +1,670 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 Aidan MacDonald
+ *
+ * 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 "axp-pmu.h"
+#include "power.h"
+#include "system.h"
+#include "i2c-async.h"
+#include <string.h>
+
+/* Headers for the debug menu */
+#ifndef BOOTLOADER
+# include "action.h"
+# include "list.h"
+# include <stdio.h>
+#endif
+
+struct axp_adc_info {
+ uint8_t reg;
+ uint8_t en_reg;
+ uint8_t en_bit;
+};
+
+struct axp_supply_info {
+ uint8_t volt_reg;
+ uint8_t volt_reg_mask;
+ uint8_t en_reg;
+ uint8_t en_bit;
+ int min_mV;
+ int max_mV;
+ int step_mV;
+};
+
+static const struct axp_adc_info axp_adc_info[NUM_ADC_CHANNELS] = {
+ {0x56, AXP_REG_ADCENABLE1, 5}, /* ACIN_VOLTAGE */
+ {0x58, AXP_REG_ADCENABLE1, 4}, /* ACIN_CURRENT */
+ {0x5a, AXP_REG_ADCENABLE1, 3}, /* VBUS_VOLTAGE */
+ {0x5c, AXP_REG_ADCENABLE1, 2}, /* VBUS_CURRENT */
+ {0x5e, AXP_REG_ADCENABLE2, 7}, /* INTERNAL_TEMP */
+ {0x62, AXP_REG_ADCENABLE1, 1}, /* TS_INPUT */
+ {0x78, AXP_REG_ADCENABLE1, 7}, /* BATTERY_VOLTAGE */
+ {0x7a, AXP_REG_ADCENABLE1, 6}, /* CHARGE_CURRENT */
+ {0x7c, AXP_REG_ADCENABLE1, 6}, /* DISCHARGE_CURRENT */
+ {0x7e, AXP_REG_ADCENABLE1, 1}, /* APS_VOLTAGE */
+ {0x70, 0xff, 0}, /* BATTERY_POWER */
+};
+
+static const struct axp_supply_info axp_supply_info[AXP_NUM_SUPPLIES] = {
+#if HAVE_AXP_PMU == 192
+ [AXP_SUPPLY_DCDC1] = {
+ .volt_reg = 0x26,
+ .volt_reg_mask = 0x7f,
+ .en_reg = 0x12,
+ .en_bit = 0,
+ .min_mV = 700,
+ .max_mV = 3500,
+ .step_mV = 25,
+ },
+ [AXP_SUPPLY_DCDC2] = {
+ .volt_reg = 0x23,
+ .volt_reg_mask = 0x3f,
+ .en_reg = 0x10,
+ .en_bit = 0,
+ .min_mV = 700,
+ .max_mV = 2275,
+ .step_mV = 25,
+ },
+ [AXP_SUPPLY_DCDC3] = {
+ .volt_reg = 0x27,
+ .volt_reg_mask = 0x7f,
+ .en_reg = 0x12,
+ .en_bit = 1,
+ .min_mV = 700,
+ .max_mV = 3500,
+ .step_mV = 25,
+ },
+ /*
+ * NOTE: LDO1 is always on, and we can't query it or change voltages
+ */
+ [AXP_SUPPLY_LDO2] = {
+ .volt_reg = 0x28,
+ .volt_reg_mask = 0xf0,
+ .en_reg = 0x12,
+ .en_bit = 2,
+ .min_mV = 1800,
+ .max_mV = 3300,
+ .step_mV = 100,
+ },
+ [AXP_SUPPLY_LDO3] = {
+ .volt_reg = 0x28,
+ .volt_reg_mask = 0x0f,
+ .en_reg = 0x12,
+ .en_bit = 3,
+ .min_mV = 1800,
+ .max_mV = 3300,
+ .step_mV = 100,
+ },
+ [AXP_SUPPLY_LDO_IO0] = {
+ .volt_reg = 0x91,
+ .volt_reg_mask = 0xf0,
+ .en_reg = 0x90,
+ .en_bit = 0xff, /* this one requires special handling */
+ .min_mV = 1800,
+ .max_mV = 3300,
+ .step_mV = 100,
+ },
+#else
+# error "Untested AXP chip"
+#endif
+};
+
+static struct axp_driver {
+ int adc_enable;
+ int chargecurrent_setting;
+ int chip_id;
+} axp;
+
+static void axp_init_enabled_adcs(void)
+{
+ axp.adc_enable = 0;
+
+ /* Read chip ID, so we can display it on the debug screen.
+ * This is undocumented but there's Linux driver code floating around
+ * which suggests this should work for many AXP chips. */
+ axp.chip_id = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_CHIP_ID);
+
+ /* Read enabled ADCs from the hardware */
+ uint8_t regs[2];
+ int rc = i2c_reg_read(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_ADCENABLE1, 2, &regs[0]);
+ if(rc != I2C_STATUS_OK)
+ return;
+
+ /* Parse registers to set ADC enable bits */
+ const struct axp_adc_info* info = axp_adc_info;
+ for(int i = 0; i < NUM_ADC_CHANNELS; ++i) {
+ if(info[i].en_reg == 0xff)
+ continue;
+
+ if(regs[info[i].en_reg - AXP_REG_ADCENABLE1] & info[i].en_bit)
+ axp.adc_enable |= 1 << i;
+ }
+
+ /* Handle battery power ADC */
+ if((axp.adc_enable & (1 << ADC_BATTERY_VOLTAGE)) &&
+ (axp.adc_enable & (1 << ADC_DISCHARGE_CURRENT))) {
+ axp.adc_enable |= (1 << ADC_BATTERY_POWER);
+ }
+}
+
+void axp_init(void)
+{
+ axp_init_enabled_adcs();
+
+ /* We need discharge current ADC to reliably poll for a full battery */
+ int bits = axp.adc_enable;
+ bits |= (1 << ADC_DISCHARGE_CURRENT);
+ axp_adc_set_enabled(bits);
+
+ /* Read the maximum charging current */
+ int value = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_CHARGECONTROL1);
+ axp.chargecurrent_setting = (value < 0) ? -1 : (value & 0xf);
+}
+
+void axp_supply_set_voltage(int supply, int voltage)
+{
+ const struct axp_supply_info* info = &axp_supply_info[supply];
+ if(info->volt_reg == 0 || info->volt_reg_mask == 0)
+ return;
+
+ if(voltage > 0 && info->step_mV != 0) {
+ if(voltage < info->min_mV || voltage > info->max_mV)
+ return;
+
+ int regval = (voltage - info->min_mV) / info->step_mV;
+ i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR, info->volt_reg,
+ info->volt_reg_mask, regval, NULL);
+ }
+
+ if(info->en_bit != 0xff) {
+ i2c_reg_setbit1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ info->en_reg, info->en_bit,
+ voltage > 0 ? 1 : 0, NULL);
+ }
+}
+
+int axp_supply_get_voltage(int supply)
+{
+ const struct axp_supply_info* info = &axp_supply_info[supply];
+ if(info->volt_reg == 0)
+ return AXP_SUPPLY_NOT_PRESENT;
+
+ if(info->en_reg != 0) {
+ int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, info->en_reg);
+ if(r < 0)
+ return AXP_SUPPLY_DISABLED;
+
+#if HAVE_AXP_PMU == 192
+ if(supply == AXP_SUPPLY_LDO_IO0) {
+ if((r & 7) != 2)
+ return AXP_SUPPLY_DISABLED;
+ } else
+#endif
+ {
+ if(r & (1 << info->en_bit) == 0)
+ return AXP_SUPPLY_DISABLED;
+ }
+ }
+
+ /* Hack, avoid undefined shift below. Can be useful too... */
+ if(info->volt_reg_mask == 0)
+ return info->min_mV;
+
+ int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, info->volt_reg);
+ if(r < 0)
+ return 0;
+
+ int bit = find_first_set_bit(info->volt_reg_mask);
+ int val = (r & info->volt_reg_mask) >> bit;
+ return info->min_mV + (val * info->step_mV);
+}
+
+/* TODO: this can STILL indicate some false positives! */
+int axp_battery_status(void)
+{
+ int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_POWERSTATUS);
+ if(r >= 0) {
+ /* Charging bit indicates we're currently charging */
+ if((r & 0x04) != 0)
+ return AXP_BATT_CHARGING;
+
+ /* Not plugged in means we're discharging */
+ if((r & 0xf0) == 0)
+ return AXP_BATT_DISCHARGING;
+ } else {
+ /* Report discharging if we can't find out power status */
+ return AXP_BATT_DISCHARGING;
+ }
+
+ /* If the battery is full and not in use, the charging bit will be 0,
+ * there will be an external power source, AND the discharge current
+ * will be zero. Seems to rule out all false positives. */
+ int d = axp_adc_read_raw(ADC_DISCHARGE_CURRENT);
+ if(d == 0)
+ return AXP_BATT_FULL;
+
+ return AXP_BATT_DISCHARGING;
+}
+
+int axp_input_status(void)
+{
+#ifdef HAVE_BATTERY_SWITCH
+ int input_status = 0;
+#else
+ int input_status = AXP_INPUT_BATTERY;
+#endif
+
+ int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_POWERSTATUS);
+ if(r < 0)
+ return input_status;
+
+ /* Check for AC input */
+ if(r & 0x80)
+ input_status |= AXP_INPUT_AC;
+
+ /* Only report USB if ACIN and VBUS are not shorted */
+ if((r & 0x20) != 0 && (r & 0x02) == 0)
+ input_status |= AXP_INPUT_USB;
+
+#ifdef HAVE_BATTERY_SWITCH
+ /* Check for battery presence if target defines it as removable */
+ r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_CHARGESTATUS);
+ if(r >= 0 && (r & 0x20) != 0)
+ input_status |= AXP_INPUT_BATTERY;
+#endif
+
+ return input_status;
+}
+
+int axp_adc_read(int adc)
+{
+ int value = axp_adc_read_raw(adc);
+ if(value == INT_MIN)
+ return INT_MIN;
+
+ return axp_adc_conv_raw(adc, value);
+}
+
+int axp_adc_read_raw(int adc)
+{
+ /* Don't give a reading if the ADC is not enabled */
+ if((axp.adc_enable & (1 << adc)) == 0)
+ return INT_MIN;
+
+ /* Read the ADC */
+ uint8_t buf[3];
+ int count = (adc == ADC_BATTERY_POWER) ? 3 : 2;
+ uint8_t reg = axp_adc_info[adc].reg;
+ int rc = i2c_reg_read(AXP_PMU_BUS, AXP_PMU_ADDR, reg, count, &buf[0]);
+ if(rc != I2C_STATUS_OK)
+ return INT_MIN;
+
+ /* Parse the value */
+ if(adc == ADC_BATTERY_POWER)
+ return (buf[0] << 16) | (buf[1] << 8) | buf[2];
+ else if(adc == ADC_CHARGE_CURRENT || adc == ADC_DISCHARGE_CURRENT)
+ return (buf[0] << 5) | (buf[1] & 0x1f);
+ else
+ return (buf[0] << 4) | (buf[1] & 0xf);
+}
+
+int axp_adc_conv_raw(int adc, int value)
+{
+ switch(adc) {
+ case ADC_ACIN_VOLTAGE:
+ case ADC_VBUS_VOLTAGE:
+ /* 0 mV ... 6.9615 mV, step 1.7 mV */
+ return value * 17 / 10;
+ case ADC_ACIN_CURRENT:
+ /* 0 mA ... 2.5594 A, step 0.625 mA */
+ return value * 5 / 8;
+ case ADC_VBUS_CURRENT:
+ /* 0 mA ... 1.5356 A, step 0.375 mA */
+ return value * 3 / 8;
+ case ADC_INTERNAL_TEMP:
+ /* -144.7 C ... 264.8 C, step 0.1 C */
+ return value - 1447;
+ case ADC_TS_INPUT:
+ /* 0 mV ... 3.276 V, step 0.8 mV */
+ return value * 4 / 5;
+ case ADC_BATTERY_VOLTAGE:
+ /* 0 mV ... 4.5045 V, step 1.1 mV */
+ return value * 11 / 10;
+ case ADC_CHARGE_CURRENT:
+ case ADC_DISCHARGE_CURRENT:
+ /* 0 mA to 4.095 A, step 0.5 mA */
+ return value / 2;
+ case ADC_APS_VOLTAGE:
+ /* 0 mV to 5.733 V, step 1.4 mV */
+ return value * 7 / 5;
+ case ADC_BATTERY_POWER:
+ /* 0 uW to 23.6404 W, step 0.55 uW */
+ return value * 11 / 20;
+ default:
+ /* Shouldn't happen */
+ return INT_MIN;
+ }
+}
+
+int axp_adc_get_enabled(void)
+{
+ return axp.adc_enable;
+}
+
+void axp_adc_set_enabled(int adc_bits)
+{
+ /* Ignore no-op */
+ if(adc_bits == axp.adc_enable)
+ return;
+
+ /* Compute the new register values */
+ const struct axp_adc_info* info = axp_adc_info;
+ uint8_t regs[2] = {0, 0};
+ for(int i = 0; i < NUM_ADC_CHANNELS; ++i) {
+ if(info[i].en_reg == 0xff)
+ continue;
+
+ if(adc_bits & (1 << i))
+ regs[info[i].en_reg - 0x82] |= 1 << info[i].en_bit;
+ }
+
+ /* These ADCs share an enable bit */
+ if(adc_bits & ((1 << ADC_CHARGE_CURRENT)|(1 << ADC_DISCHARGE_CURRENT))) {
+ adc_bits |= (1 << ADC_CHARGE_CURRENT);
+ adc_bits |= (1 << ADC_DISCHARGE_CURRENT);
+ }
+
+ /* Enable required bits for battery power ADC */
+ if(adc_bits & (1 << ADC_BATTERY_POWER)) {
+ regs[0] |= 1 << info[ADC_DISCHARGE_CURRENT].en_bit;
+ regs[0] |= 1 << info[ADC_BATTERY_VOLTAGE].en_bit;
+ }
+
+ /* Update the configuration */
+ i2c_reg_write(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_ADCENABLE1, 2, &regs[0]);
+ axp.adc_enable = adc_bits;
+}
+
+int axp_adc_get_rate(void)
+{
+ int r = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_ADCSAMPLERATE);
+ if(r < 0)
+ return AXP_ADC_RATE_100HZ; /* an arbitrary value */
+
+ return (r >> 6) & 3;
+}
+
+void axp_adc_set_rate(int rate)
+{
+ i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR, AXP_REG_ADCSAMPLERATE,
+ 0xc0, (rate & 3) << 6, NULL);
+}
+
+static uint32_t axp_cc_parse(const uint8_t* buf)
+{
+ return ((uint32_t)buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
+}
+
+void axp_cc_read(uint32_t* charge, uint32_t* discharge)
+{
+ uint8_t buf[8];
+ int rc = i2c_reg_read(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_COULOMBCOUNTERBASE, 8, &buf[0]);
+ if(rc != I2C_STATUS_OK) {
+ if(charge)
+ *charge = 0;
+ if(discharge)
+ *discharge = 0;
+ return;
+ }
+
+ if(charge)
+ *charge = axp_cc_parse(&buf[0]);
+ if(discharge)
+ *discharge = axp_cc_parse(&buf[4]);
+}
+
+void axp_cc_clear(void)
+{
+ i2c_reg_setbit1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_COULOMBCOUNTERCTRL, 5, 1, NULL);
+}
+
+void axp_cc_enable(bool en)
+{
+ i2c_reg_setbit1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_COULOMBCOUNTERCTRL, 7, en ? 1 : 0, NULL);
+}
+
+bool axp_cc_is_enabled(void)
+{
+ int reg = i2c_reg_read1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_COULOMBCOUNTERCTRL);
+ return reg >= 0 && (reg & 0x40) != 0;
+}
+
+static const int chargecurrent_tbl[] = {
+ 100, 190, 280, 360,
+ 450, 550, 630, 700,
+ 780, 880, 960, 1000,
+ 1080, 1160, 1240, 1320,
+};
+
+static const int chargecurrent_tblsz = sizeof(chargecurrent_tbl)/sizeof(int);
+
+void axp_set_charge_current(int maxcurrent)
+{
+ /* Find the charge current just higher than maxcurrent */
+ int value = 0;
+ while(value < chargecurrent_tblsz &&
+ chargecurrent_tbl[value] <= maxcurrent)
+ ++value;
+
+ /* Select the next lower current, the greatest current <= maxcurrent */
+ if(value >= chargecurrent_tblsz)
+ value = chargecurrent_tblsz - 1;
+ else if(value > 0)
+ --value;
+
+ /* Don't issue i2c write if desired setting is already in use */
+ if(value == axp.chargecurrent_setting)
+ return;
+
+ /* Update register */
+ i2c_reg_modify1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_CHARGECONTROL1, 0x0f, value, NULL);
+ axp.chargecurrent_setting = value;
+}
+
+int axp_get_charge_current(void)
+{
+ if(axp.chargecurrent_setting < 0)
+ return chargecurrent_tbl[0];
+ else
+ return chargecurrent_tbl[axp.chargecurrent_setting];
+}
+
+void axp_power_off(void)
+{
+ /* Set the shutdown bit */
+ i2c_reg_setbit1(AXP_PMU_BUS, AXP_PMU_ADDR,
+ AXP_REG_SHUTDOWNLEDCTRL, 7, 1, NULL);
+}
+
+#ifndef BOOTLOADER
+enum {
+ AXP_DEBUG_CHIP_ID,
+ AXP_DEBUG_BATTERY_STATUS,
+ AXP_DEBUG_INPUT_STATUS,
+ AXP_DEBUG_CHARGE_CURRENT,
+ AXP_DEBUG_COULOMB_COUNTERS,
+ AXP_DEBUG_ADC_RATE,
+ AXP_DEBUG_FIRST_ADC,
+ AXP_DEBUG_FIRST_SUPPLY = AXP_DEBUG_FIRST_ADC + NUM_ADC_CHANNELS,
+ AXP_DEBUG_NUM_ENTRIES = AXP_DEBUG_FIRST_SUPPLY + AXP_NUM_SUPPLIES,
+};
+
+static int axp_debug_menu_cb(int action, struct gui_synclist* lists)
+{
+ (void)lists;
+
+ if(action == ACTION_NONE)
+ action = ACTION_REDRAW;
+
+ return action;
+}
+
+static const char* axp_debug_menu_get_name(int item, void* data,
+ char* buf, size_t buflen)
+{
+ (void)data;
+
+ static const char* const adc_names[] = {
+ "V_acin", "I_acin", "V_vbus", "I_vbus", "T_int",
+ "V_ts", "V_batt", "I_chrg", "I_dchg", "V_aps", "P_batt"
+ };
+
+ static const char* const adc_units[] = {
+ "mV", "mA", "mV", "mA", "C", "mV", "mV", "mA", "mA", "mV", "uW",
+ };
+
+ static const char* const supply_names[] = {
+ "DCDC1", "DCDC2", "DCDC3",
+ "LDO1", "LDO2", "LDO3", "LDO_IO0",
+ };
+
+ int adc = item - AXP_DEBUG_FIRST_ADC;
+ if(item >= AXP_DEBUG_FIRST_ADC && adc < NUM_ADC_CHANNELS) {
+ int raw_value = axp_adc_read_raw(adc);
+ if(raw_value == INT_MIN) {
+ snprintf(buf, buflen, "%s: [Disabled]", adc_names[adc]);
+ return buf;
+ }
+
+ int value = axp_adc_conv_raw(adc, raw_value);
+ if(adc == ADC_INTERNAL_TEMP) {
+ snprintf(buf, buflen, "%s: %d.%d %s", adc_names[adc],
+ value/10, value%10, adc_units[adc]);
+ } else {
+ snprintf(buf, buflen, "%s: %d %s", adc_names[adc],
+ value, adc_units[adc]);
+ }
+
+ return buf;
+ }
+
+ int supply = item - AXP_DEBUG_FIRST_SUPPLY;
+ if(item >= AXP_DEBUG_FIRST_SUPPLY && supply < AXP_NUM_SUPPLIES) {
+ int voltage = axp_supply_get_voltage(supply);
+ if(voltage == AXP_SUPPLY_NOT_PRESENT)
+ snprintf(buf, buflen, "%s: [Not Present]", supply_names[supply]);
+ else if(voltage == AXP_SUPPLY_DISABLED)
+ snprintf(buf, buflen, "%s: [Disabled]", supply_names[supply]);
+ else
+ snprintf(buf, buflen, "%s: %d mV", supply_names[supply], voltage);
+
+ return buf;
+ }
+
+ switch(item) {
+ case AXP_DEBUG_CHIP_ID: {
+ snprintf(buf, buflen, "Chip ID: %d (%02x) [Driver: AXP%d]",
+ axp.chip_id, axp.chip_id, HAVE_AXP_PMU);
+ return buf;
+ } break;
+
+ case AXP_DEBUG_BATTERY_STATUS: {
+ switch(axp_battery_status()) {
+ case AXP_BATT_FULL:
+ return "Battery: Full";
+ case AXP_BATT_CHARGING:
+ return "Battery: Charging";
+ case AXP_BATT_DISCHARGING:
+ return "Battery: Discharging";
+ default:
+ return "Battery: Unknown";
+ }
+ } break;
+
+ case AXP_DEBUG_INPUT_STATUS: {
+ int s = axp_input_status();
+ const char* ac = (s & AXP_INPUT_AC) ? " AC" : "";
+ const char* usb = (s & AXP_INPUT_USB) ? " USB" : "";
+ const char* batt = (s & AXP_INPUT_BATTERY) ? " Battery" : "";
+ snprintf(buf, buflen, "Inputs:%s%s%s", ac, usb, batt);
+ return buf;
+ } break;
+
+ case AXP_DEBUG_CHARGE_CURRENT: {
+ int current = axp_get_charge_current();
+ snprintf(buf, buflen, "Max charge current: %d mA", current);
+ return buf;
+ } break;
+
+ case AXP_DEBUG_COULOMB_COUNTERS: {
+ uint32_t charge, discharge;
+ axp_cc_read(&charge, &discharge);
+
+ snprintf(buf, buflen, "Coulomb counters: +%lu / -%lu",
+ (unsigned long)charge, (unsigned long)discharge);
+ return buf;
+ } break;
+
+ case AXP_DEBUG_ADC_RATE: {
+ int rate = 25 << axp_adc_get_rate();
+ snprintf(buf, buflen, "ADC sample rate: %d Hz", rate);
+ return buf;
+ } break;
+
+ default:
+ return "---";
+ }
+}
+
+bool axp_debug_menu(void)
+{
+ struct simplelist_info info;
+ simplelist_info_init(&info, "AXP debug", AXP_DEBUG_NUM_ENTRIES, NULL);
+ info.action_callback = axp_debug_menu_cb;
+ info.get_name = axp_debug_menu_get_name;
+ return simplelist_show_list(&info);
+}
+#endif /* !BOOTLOADER */
+
+/* This is basically the only valid implementation, so define it here */
+unsigned int power_input_status(void)
+{
+ unsigned int state = 0;
+ int input_status = axp_input_status();
+
+ if(input_status & AXP_INPUT_AC)
+ state |= POWER_INPUT_MAIN_CHARGER;
+
+ if(input_status & AXP_INPUT_USB)
+ state |= POWER_INPUT_USB_CHARGER;
+
+#ifdef HAVE_BATTERY_SWITCH
+ if(input_status & AXP_INPUT_BATTERY)
+ state |= POWER_INPUT_BATTERY;
+#endif
+
+ return state;
+}
diff --git a/firmware/drivers/axp173.c b/firmware/drivers/axp173.c
deleted file mode 100644
index 22417650fc..0000000000
--- a/firmware/drivers/axp173.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2021 Aidan MacDonald
- *
- * 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 "axp173.h"
-#include "power.h"
-#include "i2c-async.h"
-
-/* Headers for the debug menu */
-#ifndef BOOTLOADER
-# include "action.h"
-# include "list.h"
-# include <stdio.h>
-#endif
-
-static const struct axp173_adc_info {
- uint8_t reg;
- uint8_t en_reg;
- uint8_t en_bit;
-} axp173_adc_info[NUM_ADC_CHANNELS] = {
- {0x56, 0x82, 5}, /* ACIN_VOLTAGE */
- {0x58, 0x82, 4}, /* ACIN_CURRENT */
- {0x5a, 0x82, 3}, /* VBUS_VOLTAGE */
- {0x5c, 0x82, 2}, /* VBUS_CURRENT */
- {0x5e, 0x83, 7}, /* INTERNAL_TEMP */
- {0x62, 0x82, 1}, /* TS_INPUT */
- {0x78, 0x82, 7}, /* BATTERY_VOLTAGE */
- {0x7a, 0x82, 6}, /* CHARGE_CURRENT */
- {0x7c, 0x82, 6}, /* DISCHARGE_CURRENT */
- {0x7e, 0x82, 1}, /* APS_VOLTAGE */
- {0x70, 0xff, 0}, /* BATTERY_POWER */
-};
-
-static struct axp173 {
- int adc_enable;
-} axp173;
-
-static void axp173_init_enabled_adcs(void)
-{
- axp173.adc_enable = 0;
-
- /* Read enabled ADCs from the hardware */
- uint8_t regs[2];
- int rc = i2c_reg_read(AXP173_BUS, AXP173_ADDR, 0x82, 2, &regs[0]);
- if(rc != I2C_STATUS_OK)
- return;
-
- /* Parse registers to set ADC enable bits */
- const struct axp173_adc_info* info = axp173_adc_info;
- for(int i = 0; i < NUM_ADC_CHANNELS; ++i) {
- if(info[i].en_reg == 0xff)
- continue;
-
- if(regs[info[i].en_reg - 0x82] & info[i].en_bit)
- axp173.adc_enable |= 1 << i;
- }
-
- /* Handle battery power ADC */
- if((axp173.adc_enable & (1 << ADC_BATTERY_VOLTAGE)) &&
- (axp173.adc_enable & (1 << ADC_DISCHARGE_CURRENT))) {
- axp173.adc_enable |= (1 << ADC_BATTERY_POWER);
- }
-}
-
-void axp173_init(void)
-{
- axp173_init_enabled_adcs();
-
- /* We need discharge current ADC to reliably poll for a full battery */
- int bits = axp173.adc_enable;
- bits |= (1 << ADC_DISCHARGE_CURRENT);
- axp173_adc_set_enabled(bits);
-}
-
-/* TODO: this can STILL indicate some false positives! */
-int axp173_battery_status(void)
-{
- int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, 0x00);
- if(r >= 0) {
- /* Charging bit indicates we're currently charging */
- if((r & 0x04) != 0)
- return AXP173_BATT_CHARGING;
-
- /* Not plugged in means we're discharging */
- if((r & 0xf0) == 0)
- return AXP173_BATT_DISCHARGING;
- } else {
- /* Report discharging if we can't find out power status */
- return AXP173_BATT_DISCHARGING;
- }
-
- /* If the battery is full and not in use, the charging bit will be 0,
- * there will be an external power source, AND the discharge current
- * will be zero. Seems to rule out all false positives. */
- int d = axp173_adc_read_raw(ADC_DISCHARGE_CURRENT);
- if(d == 0)
- return AXP173_BATT_FULL;
-
- return AXP173_BATT_DISCHARGING;
-}
-
-int axp173_input_status(void)
-{
-#ifdef HAVE_BATTERY_SWITCH
- int input_status = 0;
-#else
- int input_status = AXP173_INPUT_BATTERY;
-#endif
-
- int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, 0x00);
- if(r < 0)
- return input_status;
-
- /* Check for AC input */
- if(r & 0x80)
- input_status |= AXP173_INPUT_AC;
-
- /* Only report USB if ACIN and VBUS are not shorted */
- if((r & 0x20) != 0 && (r & 0x02) == 0)
- input_status |= AXP173_INPUT_USB;
-
-#ifdef HAVE_BATTERY_SWITCH
- /* Check for battery presence if target defines it as removable */
- r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, 0x01);
- if(r >= 0 && (r & 0x20) != 0)
- input_status |= AXP173_INPUT_BATTERY;
-#endif
-
- return input_status;
-}
-
-int axp173_adc_read(int adc)
-{
- int value = axp173_adc_read_raw(adc);
- if(value == INT_MIN)
- return INT_MIN;
-
- return axp173_adc_conv_raw(adc, value);
-}
-
-int axp173_adc_read_raw(int adc)
-{
- /* Don't give a reading if the ADC is not enabled */
- if((axp173.adc_enable & (1 << adc)) == 0)
- return INT_MIN;
-
- /* Read the ADC */
- uint8_t buf[3];
- int count = (adc == ADC_BATTERY_POWER) ? 3 : 2;
- uint8_t reg = axp173_adc_info[adc].reg;
- int rc = i2c_reg_read(AXP173_BUS, AXP173_ADDR, reg, count, &buf[0]);
- if(rc != I2C_STATUS_OK)
- return INT_MIN;
-
- /* Parse the value */
- if(adc == ADC_BATTERY_POWER)
- return (buf[0] << 16) | (buf[1] << 8) | buf[2];
- else if(adc == ADC_CHARGE_CURRENT || adc == ADC_DISCHARGE_CURRENT)
- return (buf[0] << 5) | (buf[1] & 0x1f);
- else
- return (buf[0] << 4) | (buf[1] & 0xf);
-}
-
-int axp173_adc_conv_raw(int adc, int value)
-{
- switch(adc) {
- case ADC_ACIN_VOLTAGE:
- case ADC_VBUS_VOLTAGE:
- /* 0 mV ... 6.9615 mV, step 1.7 mV */
- return value * 17 / 10;
- case ADC_ACIN_CURRENT:
- /* 0 mA ... 2.5594 A, step 0.625 mA */
- return value * 5 / 8;
- case ADC_VBUS_CURRENT:
- /* 0 mA ... 1.5356 A, step 0.375 mA */
- return value * 3 / 8;
- case ADC_INTERNAL_TEMP:
- /* -144.7 C ... 264.8 C, step 0.1 C */
- return value - 1447;
- case ADC_TS_INPUT:
- /* 0 mV ... 3.276 V, step 0.8 mV */
- return value * 4 / 5;
- case ADC_BATTERY_VOLTAGE:
- /* 0 mV ... 4.5045 V, step 1.1 mV */
- return value * 11 / 10;
- case ADC_CHARGE_CURRENT:
- case ADC_DISCHARGE_CURRENT:
- /* 0 mA to 4.095 A, step 0.5 mA */
- return value / 2;
- case ADC_APS_VOLTAGE:
- /* 0 mV to 5.733 V, step 1.4 mV */
- return value * 7 / 5;
- case ADC_BATTERY_POWER:
- /* 0 uW to 23.6404 W, step 0.55 uW */
- return value * 11 / 20;
- default:
- /* Shouldn't happen */
- return INT_MIN;
- }
-}
-
-int axp173_adc_get_enabled(void)
-{
- return axp173.adc_enable;
-}
-
-void axp173_adc_set_enabled(int adc_bits)
-{
- /* Ignore no-op */
- if(adc_bits == axp173.adc_enable)
- return;
-
- /* Compute the new register values */
- const struct axp173_adc_info* info = axp173_adc_info;
- uint8_t regs[2] = {0, 0};
- for(int i = 0; i < NUM_ADC_CHANNELS; ++i) {
- if(info[i].en_reg == 0xff)
- continue;
-
- if(adc_bits & (1 << i))
- regs[info[i].en_reg - 0x82] |= 1 << info[i].en_bit;
- }
-
- /* These ADCs share an enable bit */
- if(adc_bits & ((1 << ADC_CHARGE_CURRENT)|(1 << ADC_DISCHARGE_CURRENT))) {
- adc_bits |= (1 << ADC_CHARGE_CURRENT);
- adc_bits |= (1 << ADC_DISCHARGE_CURRENT);
- }
-
- /* Enable required bits for battery power ADC */
- if(adc_bits & (1 << ADC_BATTERY_POWER)) {
- regs[0] |= 1 << info[ADC_DISCHARGE_CURRENT].en_bit;
- regs[0] |= 1 << info[ADC_BATTERY_VOLTAGE].en_bit;
- }
-
- /* Update the configuration */
- i2c_reg_write(AXP173_BUS, AXP173_ADDR, 0x82, 2, &regs[0]);
- axp173.adc_enable = adc_bits;
-}
-
-int axp173_adc_get_rate(void)
-{
- int r = i2c_reg_read1(AXP173_BUS, AXP173_ADDR, 0x84);
- if(r < 0)
- return AXP173_ADC_RATE_100HZ; /* an arbitrary value */
-
- return (r >> 6) & 3;
-}
-
-void axp173_adc_set_rate(int rate)
-{
- i2c_reg_modify1(AXP173_BUS, AXP173_ADDR, 0x84,
- 0xc0, (rate & 3) << 6, NULL);
-}
-
-static uint32_t axp173_cc_parse(const uint8_t* buf)
-{
- return ((uint32_t)buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
-}
-
-void axp173_cc_read(uint32_t* charge, uint32_t* discharge)
-{
- uint8_t buf[8];
- int rc = i2c_reg_read(AXP173_BUS, AXP173_ADDR, 0xb0, 8, &buf[0]);
- if(rc != I2C_STATUS_OK) {
- if(charge)
- *charge = 0;
- if(discharge)
- *discharge = 0;
- return;
- }
-
- if(charge)
- *charge = axp173_cc_parse(&buf[0]);
- if(discharge)
- *discharge = axp173_cc_parse(&buf[4]);
-}
-
-void axp173_cc_clear(void)
-{
- i2c_reg_setbit1(AXP173_BUS, AXP173_ADDR, 0xb8, 5, 1, NULL);
-}
-
-void axp173_cc_enable(bool en)
-{
- i2c_reg_setbit1(AXP173_BUS, AXP173_ADDR, 0xb8, 7, en ? 1 : 0, NULL);
-}
-
-#ifndef BOOTLOADER
-#define AXP173_DEBUG_BATTERY_STATUS 0
-#define AXP173_DEBUG_INPUT_STATUS 1
-#define AXP173_DEBUG_ADC_RATE 2
-#define AXP173_DEBUG_FIRST_ADC 3
-#define AXP173_DEBUG_ENTRIES (AXP173_DEBUG_FIRST_ADC + NUM_ADC_CHANNELS)
-
-static int axp173_debug_menu_cb(int action, struct gui_synclist* lists)
-{
- (void)lists;
-
- if(action == ACTION_NONE)
- action = ACTION_REDRAW;
-
- return action;
-}
-
-static const char* axp173_debug_menu_get_name(int item, void* data,
- char* buf, size_t buflen)
-{
- (void)data;
-
- static const char* const adc_names[] = {
- "V_acin", "I_acin", "V_vbus", "I_vbus", "T_int",
- "V_ts", "V_batt", "I_chrg", "I_dchg", "V_aps", "P_batt"
- };
-
- static const char* const adc_units[] = {
- "mV", "mA", "mV", "mA", "C", "mV", "mV", "mA", "mA", "mV", "uW",
- };
-
- int adc = item - AXP173_DEBUG_FIRST_ADC;
- if(item >= AXP173_DEBUG_FIRST_ADC && adc < NUM_ADC_CHANNELS) {
- int raw_value = axp173_adc_read_raw(adc);
- if(raw_value == INT_MIN) {
- snprintf(buf, buflen, "%s: [Disabled]", adc_names[adc]);
- return buf;
- }
-
- int value = axp173_adc_conv_raw(adc, raw_value);
- if(adc == ADC_INTERNAL_TEMP) {
- snprintf(buf, buflen, "%s: %d.%d %s", adc_names[adc],
- value/10, value%10, adc_units[adc]);
- } else {
- snprintf(buf, buflen, "%s: %d %s", adc_names[adc],
- value, adc_units[adc]);
- }
-
- return buf;
- }
-
- switch(item) {
- case AXP173_DEBUG_BATTERY_STATUS: {
- switch(axp173_battery_status()) {
- case AXP173_BATT_FULL:
- return "Battery: Full";
- case AXP173_BATT_CHARGING:
- return "Battery: Charging";
- case AXP173_BATT_DISCHARGING:
- return "Battery: Discharging";
- default:
- return "Battery: Unknown";
- }
- } break;
-
- case AXP173_DEBUG_INPUT_STATUS: {
- int s = axp173_input_status();
- const char* ac = (s & AXP173_INPUT_AC) ? " AC" : "";
- const char* usb = (s & AXP173_INPUT_USB) ? " USB" : "";
- const char* batt = (s & AXP173_INPUT_BATTERY) ? " Battery" : "";
- snprintf(buf, buflen, "Inputs:%s%s%s", ac, usb, batt);
- return buf;
- } break;
-
- case AXP173_DEBUG_ADC_RATE: {
- int rate = 25 << axp173_adc_get_rate();
- snprintf(buf, buflen, "ADC sample rate: %d Hz", rate);
- return buf;
- } break;
-
- default:
- return "---";
- }
-}
-
-bool axp173_debug_menu(void)
-{
- struct simplelist_info info;
- simplelist_info_init(&info, "AXP173 debug", AXP173_DEBUG_ENTRIES, NULL);
- info.action_callback = axp173_debug_menu_cb;
- info.get_name = axp173_debug_menu_get_name;
- return simplelist_show_list(&info);
-}
-#endif /* !BOOTLOADER */
-
-/* This is basically the only valid implementation, so define it here */
-unsigned int power_input_status(void)
-{
- unsigned int state = 0;
- int input_status = axp173_input_status();
-
- if(input_status & AXP173_INPUT_AC)
- state |= POWER_INPUT_MAIN_CHARGER;
-
- if(input_status & AXP173_INPUT_USB)
- state |= POWER_INPUT_USB_CHARGER;
-
-#ifdef HAVE_BATTERY_SWITCH
- if(input_status & AXP173_INPUT_BATTERY)
- state |= POWER_INPUT_BATTERY;
-#endif
-
- return state;
-}
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 50619983e9..337e29a1bc 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -2384,44 +2384,43 @@ static long transfer(struct bpb *fat_bpb, unsigned long start, long count,
panicf("Write %ld after data\n",
start + count - fat_bpb->totalsectors);
}
- else
- {
- rc = storage_write_sectors(IF_MD(fat_bpb->drive,)
- start + fat_bpb->startsector, count, buf);
- }
}
- else
- {
- void* xferbuf = buf;
-#ifdef STORAGE_NEEDS_BOUNCE_BUFFER
- int remain = count;
- int xferred = 0;
- int aligned = 1;
- if(STORAGE_OVERLAP((uintptr_t)buf)) {
- xferbuf = FAT_BOUNCE_BUFFER(fat_bpb);
- aligned = 0;
- count = MIN(remain, FAT_BOUNCE_SECTORS);
- }
- while(remain > 0) {
-#endif
- rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
- start + fat_bpb->startsector, count, xferbuf);
#ifdef STORAGE_NEEDS_BOUNCE_BUFFER
+ if(UNLIKELY(STORAGE_OVERLAP((uintptr_t)buf))) {
+ void* xfer_buf = FAT_BOUNCE_BUFFER(fat_bpb);
+ while(count > 0) {
+ int xfer_count = MIN(count, FAT_BOUNCE_SECTORS);
+
+ if(write) {
+ memcpy(xfer_buf, buf, xfer_count * SECTOR_SIZE);
+ rc = storage_write_sectors(IF_MD(fat_bpb->drive,)
+ start + fat_bpb->startsector, xfer_count, xfer_buf);
+ } else {
+ rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
+ start + fat_bpb->startsector, xfer_count, xfer_buf);
+ memcpy(buf, xfer_buf, xfer_count * SECTOR_SIZE);
+ }
+
if(rc < 0)
break;
- if(LIKELY(aligned))
- break;
- memcpy(buf, xferbuf, count * SECTOR_SIZE);
- buf += count * SECTOR_SIZE;
- xferred += count;
- start += count;
- remain -= count;
- count = MIN(remain, FAT_BOUNCE_SECTORS);
+ buf += xfer_count * SECTOR_SIZE;
+ start += xfer_count;
+ count -= xfer_count;
}
+ } else {
#endif
+ if(write) {
+ rc = storage_write_sectors(IF_MD(fat_bpb->drive,)
+ start + fat_bpb->startsector, count, buf);
+ } else {
+ rc = storage_read_sectors(IF_MD(fat_bpb->drive,)
+ start + fat_bpb->startsector, count, buf);
+ }
+#ifdef STORAGE_NEEDS_BOUNCE_BUFFER
}
+#endif
if (rc < 0)
{
diff --git a/firmware/drivers/ft6x06.c b/firmware/drivers/ft6x06.c
new file mode 100644
index 0000000000..538ca10480
--- /dev/null
+++ b/firmware/drivers/ft6x06.c
@@ -0,0 +1,115 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 Aidan MacDonald
+ *
+ * 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 "ft6x06.h"
+#include "kernel.h"
+#include "i2c-async.h"
+#include <string.h>
+
+struct ft6x06_driver {
+ /* i2c bus data */
+ int i2c_cookie;
+ i2c_descriptor i2c_desc;
+
+ /* callback for touch events */
+ ft6x06_event_cb event_cb;
+
+ /* buffer for I2C transfers */
+ uint8_t raw_data[6];
+};
+
+static struct ft6x06_driver ft_drv;
+struct ft6x06_state ft6x06_state;
+
+static void ft6x06_i2c_callback(int status, i2c_descriptor* desc)
+{
+ (void)desc;
+ if(status != I2C_STATUS_OK)
+ return;
+
+ int evt = ft_drv.raw_data[1] >> 6;
+ int tx = ft_drv.raw_data[2] | ((ft_drv.raw_data[1] & 0xf) << 8);
+ int ty = ft_drv.raw_data[4] | ((ft_drv.raw_data[3] & 0xf) << 8);
+
+ ft6x06_state.event = evt;
+#ifdef FT6x06_SWAP_AXES
+ ft6x06_state.pos_x = ty;
+ ft6x06_state.pos_y = tx;
+#else
+ ft6x06_state.pos_x = tx;
+ ft6x06_state.pos_y = ty;
+#endif
+
+ ft_drv.event_cb(evt, ft6x06_state.pos_x, ft6x06_state.pos_y);
+}
+
+static void ft6x06_dummy_event_cb(int evt, int tx, int ty)
+{
+ (void)evt;
+ (void)tx;
+ (void)ty;
+}
+
+void ft6x06_init(void)
+{
+ /* Initialize stuff */
+ memset(&ft_drv, 0, sizeof(ft_drv));
+ ft_drv.event_cb = ft6x06_dummy_event_cb;
+
+ ft6x06_state.event = FT6x06_EVT_NONE;
+ ft6x06_state.pos_x = 0;
+ ft6x06_state.pos_y = 0;
+
+ /* Reserve bus management cookie */
+ ft_drv.i2c_cookie = i2c_async_reserve_cookies(FT6x06_BUS, 1);
+
+ /* Prep an I2C descriptor to read touch data */
+ ft_drv.i2c_desc.slave_addr = FT6x06_ADDR;
+ ft_drv.i2c_desc.bus_cond = I2C_START | I2C_STOP;
+ ft_drv.i2c_desc.tran_mode = I2C_READ;
+ ft_drv.i2c_desc.buffer[0] = &ft_drv.raw_data[5];
+ ft_drv.i2c_desc.count[0] = 1;
+ ft_drv.i2c_desc.buffer[1] = &ft_drv.raw_data[0];
+ ft_drv.i2c_desc.count[1] = 5;
+ ft_drv.i2c_desc.callback = ft6x06_i2c_callback;
+ ft_drv.i2c_desc.arg = 0;
+ ft_drv.i2c_desc.next = NULL;
+
+ /* Set I2C register address */
+ ft_drv.raw_data[5] = 0x02;
+}
+
+void ft6x06_set_event_cb(ft6x06_event_cb cb)
+{
+ ft_drv.event_cb = cb ? cb : ft6x06_dummy_event_cb;
+}
+
+void ft6x06_enable(bool en)
+{
+ i2c_reg_write1(FT6x06_BUS, FT6x06_ADDR, 0xa5, en ? 0 : 3);
+}
+
+void ft6x06_irq_handler(void)
+{
+ /* We don't care if this fails, there's not much we can do about it */
+ i2c_async_queue(FT6x06_BUS, TIMEOUT_NOBLOCK, I2C_Q_ONCE,
+ ft_drv.i2c_cookie, &ft_drv.i2c_desc);
+}
diff --git a/firmware/drivers/lcd-16bit-common.c b/firmware/drivers/lcd-16bit-common.c
index 5ec142c855..dbfea50dd7 100644
--- a/firmware/drivers/lcd-16bit-common.c
+++ b/firmware/drivers/lcd-16bit-common.c
@@ -341,12 +341,18 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
if (y + height > LCD_HEIGHT)
height = LCD_HEIGHT - y;
#endif
-
src += stride * (src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
src_end = src + width;
dst_col = FBADDR(x, y);
+ /* 'Bugfix' mono_bitmap_part reads ahead in the buffer,
+ * if the height is <= char bit pixels other memory gets read
+ * the other option is to check in the hot code path but this appears
+ * sufficient
+ */
+ if (height <= CHAR_BIT)
+ stride = 0;
if (drmode & DRMODE_INVERSEVID)
{
@@ -462,14 +468,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x,
/* Draw a full monochrome bitmap */
void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int height)
{
- int stride = width;
-
- /* 'Bugfix' mono_bitmap_part reads ahead in the buffer,
- * if the height is <= char bit pixels other memory gets read
- */
- if (height <= CHAR_BIT)
- stride = 0;
- lcd_mono_bitmap_part(src, 0, 0, stride, x, y, width, height);
+ lcd_mono_bitmap_part(src, 0, 0, width, x, y, width, height);
}
diff --git a/firmware/drivers/rtc/rtc_d2.c b/firmware/drivers/rtc/rtc_d2.c
index 1d202410e2..726564a255 100644
--- a/firmware/drivers/rtc/rtc_d2.c
+++ b/firmware/drivers/rtc/rtc_d2.c
@@ -53,9 +53,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[4];
tm->tm_mon = buf[5] - 1;
tm->tm_year = buf[6] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return rc;
}
diff --git a/firmware/drivers/rtc/rtc_ds1339_ds3231.c b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
index 8f2a531e5f..b77e059595 100644
--- a/firmware/drivers/rtc/rtc_ds1339_ds3231.c
+++ b/firmware/drivers/rtc/rtc_ds1339_ds3231.c
@@ -126,9 +126,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = BCD2DEC(buf[4] & 0x3f);
tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1;
tm->tm_year = BCD2DEC(buf[6]) + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return rc;
}
diff --git a/firmware/drivers/rtc/rtc_e8564.c b/firmware/drivers/rtc/rtc_e8564.c
index 4bb61410db..775ff86728 100644
--- a/firmware/drivers/rtc/rtc_e8564.c
+++ b/firmware/drivers/rtc/rtc_e8564.c
@@ -86,9 +86,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = BCD2DEC(buf[3] & 0x3f);
tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1;
tm->tm_year = BCD2DEC(buf[6]) + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return read;
}
diff --git a/firmware/drivers/rtc/rtc_mr100.c b/firmware/drivers/rtc/rtc_mr100.c
index 6e1b0b5f40..2f44137e38 100644
--- a/firmware/drivers/rtc/rtc_mr100.c
+++ b/firmware/drivers/rtc/rtc_mr100.c
@@ -144,9 +144,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[2];
tm->tm_mon = buf[1] - 1;
tm->tm_year = buf[0] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return rc;
}
diff --git a/firmware/drivers/rtc/rtc_pcf50605.c b/firmware/drivers/rtc/rtc_pcf50605.c
index daa35fb13f..42ea15ff2e 100644
--- a/firmware/drivers/rtc/rtc_pcf50605.c
+++ b/firmware/drivers/rtc/rtc_pcf50605.c
@@ -52,9 +52,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[4];
tm->tm_mon = buf[5] - 1;
tm->tm_year = buf[6] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return rc;
}
diff --git a/firmware/drivers/rtc/rtc_pcf50606.c b/firmware/drivers/rtc/rtc_pcf50606.c
index 540ebfff06..16ae5a3e9c 100644
--- a/firmware/drivers/rtc/rtc_pcf50606.c
+++ b/firmware/drivers/rtc/rtc_pcf50606.c
@@ -56,7 +56,7 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_hour = buf[2];
tm->tm_mday = buf[4];
tm->tm_mon = buf[5] - 1;
- tm->tm_yday = 0; /* Not implemented for now */
+
#ifdef IRIVER_H300_SERIES
/* Special kludge to coexist with the iriver firmware. The iriver firmware
stores the date as 1965+nn, and allows a range of 1980..2064. We use
@@ -68,6 +68,7 @@ int rtc_read_datetime(struct tm *tm)
#endif /* IRIVER_H300_SERIES */
set_day_of_week(tm);
+ set_day_of_year(tm);
return rc;
}
diff --git a/firmware/drivers/rtc/rtc_rx5x348ab.c b/firmware/drivers/rtc/rtc_rx5x348ab.c
index 6d7b78b281..d95186e8be 100644
--- a/firmware/drivers/rtc/rtc_rx5x348ab.c
+++ b/firmware/drivers/rtc/rtc_rx5x348ab.c
@@ -52,9 +52,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[4];
tm->tm_mon = buf[5] - 1;
tm->tm_year = buf[6] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return 1;
}
diff --git a/firmware/drivers/rtc/rtc_s35380a.c b/firmware/drivers/rtc/rtc_s35380a.c
index f32c431990..6deaed6354 100644
--- a/firmware/drivers/rtc/rtc_s35380a.c
+++ b/firmware/drivers/rtc/rtc_s35380a.c
@@ -192,9 +192,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[TIME_DAY];
tm->tm_mon = buf[TIME_MONTH] - 1;
tm->tm_year = buf[TIME_YEAR] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return ret;
}
diff --git a/firmware/drivers/rtc/rtc_s35390a.c b/firmware/drivers/rtc/rtc_s35390a.c
index b82029a114..6e69073254 100644
--- a/firmware/drivers/rtc/rtc_s35390a.c
+++ b/firmware/drivers/rtc/rtc_s35390a.c
@@ -79,9 +79,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = buf[2];
tm->tm_mon = buf[1] - 1;
tm->tm_year = buf[0] + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return ret;
}
diff --git a/firmware/drivers/rtc/rtc_s3c2440.c b/firmware/drivers/rtc/rtc_s3c2440.c
index 6cd34f0e23..71f99ac6f4 100644
--- a/firmware/drivers/rtc/rtc_s3c2440.c
+++ b/firmware/drivers/rtc/rtc_s3c2440.c
@@ -39,9 +39,9 @@ int rtc_read_datetime(struct tm *tm)
tm->tm_mday = BCD2DEC(BCDDATE);
tm->tm_mon = BCD2DEC(BCDMON) - 1;
tm->tm_year = BCD2DEC(BCDYEAR) + 100;
- tm->tm_yday = 0; /* Not implemented for now */
set_day_of_week(tm);
+ set_day_of_year(tm);
return 1;
}
diff --git a/firmware/drivers/rtc/rtc_tcc77x.c b/firmware/drivers/rtc/rtc_tcc77x.c
deleted file mode 100644
index a85c93d65a..0000000000
--- a/firmware/drivers/rtc/rtc_tcc77x.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2008 by Dave Chapman
- *
- * 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 "rtc.h"
-#include "system.h"
-#include <stdbool.h>
-
-void rtc_init(void)
-{
-}
-
-int rtc_read_datetime(struct tm *tm)
-{
- (void)tm;
- return 0;
-}
-
-int rtc_write_datetime(const struct tm *tm)
-{
- (void)tm;
- return 1;
-}
-
-#ifdef HAVE_RTC_ALARM
-/**
- * Checks to see if an alarm interrupt has triggered since last we checked.
- */
-bool rtc_check_alarm_flag(void)
-{
-}
-
-/**
- * Enables or disables the alarm.
- */
-void rtc_enable_alarm(bool enable)
-{
-}
-
-/**
- * Check if alarm caused unit to start.
- */
-bool rtc_check_alarm_started(bool release_alarm)
-{
-}
-
-void rtc_set_alarm(int h, int m)
-{
- /* Convert to BCD */
-// pcf50605_write(0x12, ((m/10) << 4) | m%10);
-// pcf50605_write(0x13, ((h/10) << 4) | h%10);
-}
-
-void rtc_get_alarm(int *h, int *m)
-{
- char buf[2];
-
- /* Convert from BCD */
-// *m = ((buf[0] >> 4) & 0x7)*10 + (buf[0] & 0x0f);
-// *h = ((buf[1] >> 4) & 0x3)*10 + (buf[1] & 0x0f);
-}
-#endif /* HAVE_RTC_ALARM */
-
-
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c
index 01845bfe0c..bae17e08c7 100644
--- a/firmware/drivers/synaptics-mep.c
+++ b/firmware/drivers/synaptics-mep.c
@@ -560,7 +560,10 @@ int touchpad_read_device(char *data, int len)
{
/* for HDD6330 an absolute packet will follow for sensor nr 0 which we ignore */
#if defined(PHILIPS_HDD6330)
- if ((data[3]>>6) == 0) syn_read(tmp, 4);
+ if ((data[3]>>6) == 0)
+ syn_read(tmp, 4);
+ else
+ tmp[1] = 0x0; /* Initialize explicitly */
// relay tap gesture packet
if (tmp[1]==0x02) { data[1]=0x02; data[2]=0x00; data[3]=0x00; }
#endif
diff --git a/firmware/drivers/tuner/lv24020lp.c b/firmware/drivers/tuner/lv24020lp.c
index bb137d60ff..2fbf88b01b 100644
--- a/firmware/drivers/tuner/lv24020lp.c
+++ b/firmware/drivers/tuner/lv24020lp.c
@@ -80,16 +80,6 @@ static int fd_log = -1;
#define FM_CLOCK_PIN 4
#define FM_DATA_PIN 5
-#elif defined(IAUDIO_7)
-#define TUNER_GPIO_INPUT_VAL GPIOA
-#define TUNER_GPIO_OUTPUT_EN_SET(mask) (GPIOA_DIR |= (mask))
-#define TUNER_GPIO_OUTPUT_EN_CLEAR(mask) (GPIOA_DIR &= ~(mask))
-#define TUNER_GPIO_OUTPUT_VAL_SET(mask) (GPIOA |= (mask))
-#define TUNER_GPIO_OUTPUT_VAL_CLEAR(mask) (GPIOA &= ~(mask))
-#define FM_CLOCK_PIN 5
-#define FM_DATA_PIN 6
-#define FM_NRW_PIN 7
-
#elif defined(COWON_D2)
#define TUNER_GPIO_INPUT_VAL GPIOC
#define TUNER_GPIO_OUTPUT_EN_SET(mask) (GPIOC_DIR |= (mask))
diff --git a/firmware/drivers/usb-designware.c b/firmware/drivers/usb-designware.c
index 24c6055434..375fd8be74 100644
--- a/firmware/drivers/usb-designware.c
+++ b/firmware/drivers/usb-designware.c
@@ -53,6 +53,15 @@
#define COMMIT_DCACHE_RANGE(b,s) commit_dcache_range(b,s)
#endif
+/* On some platforms, virtual addresses must be mangled to
+ * get a physical address for DMA
+ */
+#if CONFIG_CPU == X1000
+# define DMA_ADDR2PHYS(x) PHYSADDR(x)
+#else
+# define DMA_ADDR2PHYS(x) x
+#endif
+
#ifndef USB_DW_TOUTCAL
#define USB_DW_TOUTCAL 0
#endif
@@ -449,7 +458,7 @@ static void usb_dw_nptx_unqueue(int epnum)
dw_ep->addr -= (bytesinfifo + 3) >> 2;
#else
(void) bytesinfifo;
- DWC_DIEPDMA(ep) = (uint32_t)(dw_ep->addr) + sentbytes;
+ DWC_DIEPDMA(ep) = DMA_ADDR2PHYS((uint32_t)(dw_ep->addr) + sentbytes);
#endif
DWC_DIEPTSIZ(ep) = PKTCNT(packetsleft) | (dw_ep->size - sentbytes);
@@ -676,7 +685,7 @@ static void usb_dw_start_xfer(int epnum,
/* Set up data source */
dw_ep->addr = (uint32_t*)buf;
#ifndef USB_DW_ARCH_SLAVE
- DWC_EPDMA(epnum, epdir) = (uint32_t)buf;
+ DWC_EPDMA(epnum, epdir) = DMA_ADDR2PHYS((uint32_t)buf);
#endif
if (epdir == USB_DW_EPDIR_IN)
diff --git a/firmware/export/ak4376.h b/firmware/export/ak4376.h
index eb06755e92..eab0bc24f3 100644
--- a/firmware/export/ak4376.h
+++ b/firmware/export/ak4376.h
@@ -104,10 +104,12 @@ AUDIOHW_SETTING(POWER_MODE, "", 0, 1, 0, 1, 0)
#define AK4376_FS_176 17
#define AK4376_FS_192 18
-/* Functions to power on / off the DAC which should be called from
- * the target's audiohw_init() / audiohw_close() implementation.
+/* Functions to power on / off the DAC.
+ *
+ * NOTE: Target must call ak4376_set_frequency() after ak4376_open() to
+ * finish the power-up sequence of the headphone amp.
*/
-extern void ak4376_init(void);
+extern void ak4376_open(void);
extern void ak4376_close(void);
/* Register read/write. Cached to avoid redundant reads/writes. */
@@ -117,16 +119,17 @@ extern int ak4376_read(int reg);
/* Target-specific function to set the PDN pin level. */
extern void ak4376_set_pdn_pin(int level);
-/* Target-specific function to control the external master clock frequency.
- * This is called by the ak4376's audiohw implementation when switching to
- * or from a frequency that is configured to use this clock source.
- *
- * - hw_freq is the new sample rate -- one of the HW_FREQ_XX constants.
- * - enabled is true if clock should be output, false if not.
+/* Set overall output volume */
+extern void ak4376_set_volume(int vol_l, int vol_r);
+
+/* Set the roll-off filter */
+extern void ak4376_set_filter_roll_off(int val);
+
+/* Set audio sampling frequency and power mode.
*
- * The return value is the master clock rate as a multiple of the sampling
- * frequency. The allowed multiples depend on the sampling frequency, shown
- * in the table below.
+ * If the I2S master clock is being supplied externally, the caller must also
+ * give the master clock multiplier 'mult'. The accepted values depend on the
+ * sampling rate, see below:
*
* +-----------+------------------------+
* | frequency | master clock rate |
@@ -137,16 +140,13 @@ extern void ak4376_set_pdn_pin(int level);
* | 128 - 192 | 128fs |
* +-----------+------------------------+
*
- * For example, at 48 KHz you could return either 256 or 512 depending on
- * the rate you decided to actually use.
- *
- * You need to return a valid master multiplier for supported frequencies
- * even when enabled = false, since the driver needs to know the multiplier
- * _before_ enabling the clock.
+ * Switching between high-power and low-power mode requires the same registers
+ * and power-up / power-down sequences as a frequency switch, so both settings
+ * are controlled by this function.
*
- * For unsupported frequencies you don't need to return a valid master
- * multiplier, because the DAC doesn't need the return value in such cases.
+ * high power mode -- use power_mode=0
+ * low power mode -- use power_mode=1
*/
-extern int ak4376_set_mclk_freq(int hw_freq, bool enabled);
+extern void ak4376_set_freqmode(int fsel, int mult, int power_mode);
#endif /* __AK4376_H__ */
diff --git a/firmware/export/axp-pmu.h b/firmware/export/axp-pmu.h
new file mode 100644
index 0000000000..457f746e8c
--- /dev/null
+++ b/firmware/export/axp-pmu.h
@@ -0,0 +1,151 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 Aidan MacDonald
+ *
+ * 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 __AXP_PMU_H__
+#define __AXP_PMU_H__
+
+#include "config.h"
+#include <stdbool.h>
+#include <stdint.h>
+
+/* ADC channels */
+#define ADC_ACIN_VOLTAGE 0
+#define ADC_ACIN_CURRENT 1
+#define ADC_VBUS_VOLTAGE 2
+#define ADC_VBUS_CURRENT 3
+#define ADC_INTERNAL_TEMP 4
+#define ADC_TS_INPUT 5
+#define ADC_BATTERY_VOLTAGE 6
+#define ADC_CHARGE_CURRENT 7
+#define ADC_DISCHARGE_CURRENT 8
+#define ADC_APS_VOLTAGE 9
+#define ADC_BATTERY_POWER 10
+#define NUM_ADC_CHANNELS 11
+
+/* ADC sampling rates */
+#define AXP_ADC_RATE_25HZ 0
+#define AXP_ADC_RATE_50HZ 1
+#define AXP_ADC_RATE_100HZ 2
+#define AXP_ADC_RATE_200HZ 3
+
+/* Return values of axp_battery_status() */
+#define AXP_BATT_DISCHARGING 0
+#define AXP_BATT_CHARGING 1
+#define AXP_BATT_FULL 2
+
+/* Bits returned by axp_input_status() */
+#define AXP_INPUT_AC (1 << 0)
+#define AXP_INPUT_USB (1 << 1)
+#define AXP_INPUT_BATTERY (1 << 2)
+#define AXP_INPUT_EXTERNAL (AXP_INPUT_AC|AXP_INPUT_USB)
+
+/* Power supplies known by this driver. Not every chip has all supplies! */
+#define AXP_SUPPLY_DCDC1 0
+#define AXP_SUPPLY_DCDC2 1
+#define AXP_SUPPLY_DCDC3 2
+#define AXP_SUPPLY_LDO1 3
+#define AXP_SUPPLY_LDO2 4
+#define AXP_SUPPLY_LDO3 5
+#define AXP_SUPPLY_LDO_IO0 6
+#define AXP_NUM_SUPPLIES 7
+
+/* Special values returned by axp_supply_get_voltage */
+#define AXP_SUPPLY_NOT_PRESENT INT_MIN
+#define AXP_SUPPLY_DISABLED (-1)
+
+/* Registers -- common to AXP173 and AXP192 (incomplete listing) */
+#define AXP_REG_POWERSTATUS 0x00
+#define AXP_REG_CHARGESTATUS 0x01
+#define AXP_REG_CHIP_ID 0x03
+#define AXP_REG_PWROUTPUTCTRL1 0x10
+#define AXP_REG_PWROUTPUTCTRL2 0x12
+#define AXP_REG_SHUTDOWNLEDCTRL 0x32
+#define AXP_REG_CHARGECONTROL1 0x33
+#define AXP_REG_DCDCWORKINGMODE 0x80
+#define AXP_REG_ADCENABLE1 0x82
+#define AXP_REG_ADCENABLE2 0x83
+#define AXP_REG_ADCSAMPLERATE 0x84
+#define AXP_REG_COULOMBCOUNTERBASE 0xb0
+#define AXP_REG_COULOMBCOUNTERCTRL 0xb8
+
+/* AXP192-only registers (incomplete listing) */
+#define AXP192_REG_GPIO0FUNCTION 0x90
+#define AXP192_REG_GPIO1FUNCTION 0x92
+#define AXP192_REG_GPIO2FUNCTION 0x93
+#define AXP192_REG_GPIOSTATE1 0x94
+
+/* Must be called from power_init() to initialize the driver state */
+extern void axp_init(void);
+
+/* - axp_supply_set_voltage(): set a supply voltage to the given value
+ * in millivolts. Pass a voltage of AXP_SUPPLY_DISABLED to shut off
+ * the supply. Any invalid supply or voltage will make the call a no-op.
+ *
+ * - axp_supply_get_voltage() returns a supply voltage in millivolts.
+ * If the supply is powered off, returns AXP_SUPPLY_DISABLED.
+ * If the chip does not have the supply, returns AXP_SUPPLY_NOT_PRESENT.
+ */
+extern void axp_supply_set_voltage(int supply, int voltage);
+extern int axp_supply_get_voltage(int supply);
+
+/* Basic battery and power supply status */
+extern int axp_battery_status(void);
+extern int axp_input_status(void);
+
+/* ADC access -- ADCs which are not enabled will return INT_MIN if read.
+ * The output of axp_adc_read() is normalized to appropriate units:
+ *
+ * - for voltages, the scale is millivolts
+ * - for currents, the scale is milliamps
+ * - for temperatures, the scale is tenths of a degree Celsius
+ * - for power, the scale is microwatts
+ *
+ * See the comment in axp_adc_conv_raw() for raw value precision/scale.
+ */
+extern int axp_adc_read(int adc);
+extern int axp_adc_read_raw(int adc);
+extern int axp_adc_conv_raw(int adc, int value);
+extern int axp_adc_get_enabled(void);
+extern void axp_adc_set_enabled(int adc_bits);
+extern int axp_adc_get_rate(void);
+extern void axp_adc_set_rate(int rate);
+
+/* - axp_cc_read() reads the coulomb counters
+ * - axp_cc_clear() resets both counters to zero
+ * - axp_cc_enable() will stop/start the counters running
+ * - axp_cc_is_enabled() returns true if the counters are running
+ */
+extern void axp_cc_read(uint32_t* charge, uint32_t* discharge);
+extern void axp_cc_clear(void);
+extern void axp_cc_enable(bool en);
+extern bool axp_cc_is_enabled(void);
+
+/* Set/get maximum charging current in milliamps */
+extern void axp_set_charge_current(int maxcurrent);
+extern int axp_get_charge_current(void);
+
+/* Set the shutdown bit */
+extern void axp_power_off(void);
+
+/* Debug menu */
+extern bool axp_debug_menu(void);
+
+#endif /* __AXP_PMU_H__ */
diff --git a/firmware/export/axp173.h b/firmware/export/axp173.h
deleted file mode 100644
index 60519138e1..0000000000
--- a/firmware/export/axp173.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2021 Aidan MacDonald
- *
- * 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 __AXP173_H__
-#define __AXP173_H__
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#define ADC_ACIN_VOLTAGE 0
-#define ADC_ACIN_CURRENT 1
-#define ADC_VBUS_VOLTAGE 2
-#define ADC_VBUS_CURRENT 3
-#define ADC_INTERNAL_TEMP 4
-#define ADC_TS_INPUT 5
-#define ADC_BATTERY_VOLTAGE 6
-#define ADC_CHARGE_CURRENT 7
-#define ADC_DISCHARGE_CURRENT 8
-#define ADC_APS_VOLTAGE 9
-#define ADC_BATTERY_POWER 10
-#define NUM_ADC_CHANNELS 11
-
-/* ADC sampling rates */
-#define AXP173_ADC_RATE_25HZ 0
-#define AXP173_ADC_RATE_50HZ 1
-#define AXP173_ADC_RATE_100HZ 2
-#define AXP173_ADC_RATE_200HZ 3
-
-/* Return values of axp173_battery_status() */
-#define AXP173_BATT_DISCHARGING 0
-#define AXP173_BATT_CHARGING 1
-#define AXP173_BATT_FULL 2
-
-/* Bits returned by axp173_input_status() */
-#define AXP173_INPUT_AC (1 << 0)
-#define AXP173_INPUT_USB (1 << 1)
-#define AXP173_INPUT_BATTERY (1 << 2)
-#define AXP173_INPUT_EXTERNAL (AXP173_INPUT_AC|AXP173_INPUT_USB)
-
-/* Must be called from power_init() to initialize the driver state */
-extern void axp173_init(void);
-
-/* Basic battery and power supply status */
-extern int axp173_battery_status(void);
-extern int axp173_input_status(void);
-
-/* ADC access -- ADCs which are not enabled will return INT_MIN if read.
- * The output of axp173_adc_read() is normalized to appropriate units:
- *
- * - for voltages, the scale is millivolts
- * - for currents, the scale is milliamps
- * - for temperatures, the scale is tenths of a degree Celsius
- * - for power, the scale is microwatts
- *
- * See the comment in axp173_adc_conv_raw() for raw value precision/scale.
- */
-extern int axp173_adc_read(int adc);
-extern int axp173_adc_read_raw(int adc);
-extern int axp173_adc_conv_raw(int adc, int value);
-extern int axp173_adc_get_enabled(void);
-extern void axp173_adc_set_enabled(int adc_bits);
-extern int axp173_adc_get_rate(void);
-extern void axp173_adc_set_rate(int rate);
-
-/* - axp173_cc_read() reads the coulomb counters
- * - axp173_cc_clear() resets both counters to zero
- * - axp173_cc_enable() will stop/start the counters running
- */
-extern void axp173_cc_read(uint32_t* charge, uint32_t* discharge);
-extern void axp173_cc_clear(void);
-extern void axp173_cc_enable(bool en);
-
-/* Debug menu */
-extern bool axp173_debug_menu(void);
-
-#endif /* __AXP173_H__ */
diff --git a/firmware/export/config.h b/firmware/export/config.h
index db1c589043..623ef8b4ff 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -68,9 +68,6 @@
#define DSC25 25
#define DM320 320
#define IMX31L 31
-#define TCC770 770
-#define TCC771L 771
-#define TCC773L 773
#define TCC7801 7801
#define S5L8700 8700
#define S5L8701 8701
@@ -104,7 +101,6 @@
#define IPOD_4G_PAD 7
#define IPOD_3G_PAD 8
#define IPOD_1G2G_PAD 9
-#define IRIVER_IFP7XX_PAD 10
#define GIGABEAT_PAD 11
#define IRIVER_H10_PAD 12
#define SANSA_E200_PAD 13
@@ -113,15 +109,12 @@
#define MROBE100_PAD 17
#define MROBE500_PAD 18
#define GIGABEAT_S_PAD 19
-#define LOGIK_DAX_PAD 20
-#define IAUDIO67_PAD 21
#define COWON_D2_PAD 22
#define IAUDIO_M3_PAD 23
#define CREATIVEZVM_PAD 24
#define SANSA_M200_PAD 25
#define CREATIVEZV_PAD 26
#define PHILIPS_SA9200_PAD 27
-#define SANSA_C100_PAD 28
#define PHILIPS_HDD1630_PAD 29
#define MEIZU_M6SL_PAD 30
#define ONDAVX747_PAD 31
@@ -228,7 +221,6 @@
#define LCD_IPODVIDEO 8 /* as used by iPod Video */
#define LCD_IPOD2BPP 9 /* as used by all fullsize greyscale iPods */
#define LCD_IPODMINI 10 /* as used by iPod Mini g1/g2 */
-#define LCD_IFP7XX 11 /* as used by iRiver iFP 7xx/8xx */
#define LCD_GIGABEAT 12
#define LCD_H10_20GB 13 /* as used by iriver H10 20Gb */
#define LCD_H10_5GB 14 /* as used by iriver H10 5Gb */
@@ -236,13 +228,11 @@
#define LCD_C200 17 /* as used by Sandisk Sansa c200 */
#define LCD_MROBE500 18 /* as used by Olympus M:Robe 500i */
#define LCD_MROBE100 19 /* as used by Olympus M:Robe 100 */
-#define LCD_LOGIKDAX 20 /* as used by Logik DAX - SSD1815 */
-#define LCD_IAUDIO67 21 /* as used by iAudio 6/7 - unknown */
#define LCD_CREATIVEZVM 22 /* as used by Creative Zen Vision:M */
#define LCD_TL0350A 23 /* as used by the iAudio M3 remote, treated as main LCD */
#define LCD_COWOND2 24 /* as used by Cowon D2 - LTV250QV, TCC7801 driver */
#define LCD_SA9200 25 /* as used by the Philips SA9200 */
-#define LCD_S6B33B2 26 /* as used by the Sansa c100 */
+#define LCD_S6B33B2 26 /* as used by the Samsumg YH820 */
#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */
#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */
#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */
@@ -314,7 +304,6 @@ Lyre prototype 1 */
#define I2C_S3C2440 7
#define I2C_PP5024 8 /* PP5024 style */
#define I2C_IMX31L 9
-#define I2C_TCC77X 10
#define I2C_TCC780X 11
#define I2C_DM320 12 /* DM320 style */
#define I2C_S5L8700 13
@@ -331,7 +320,6 @@ Lyre prototype 1 */
/* else HW controlled LED (iRiver H1x0) */
/* CONFIG_NAND */
-#define NAND_IFP7XX 1
#define NAND_TCC 2
#define NAND_SAMSUNG 3
#define NAND_CC 4 /* ChinaChip */
@@ -347,7 +335,6 @@ Lyre prototype 1 */
#define RTC_DS1339_DS3231 7 /* h1x0 RTC mod */
#define RTC_IMX31L 8
#define RTC_RX5X348AB 9
-#define RTC_TCC77X 10
#define RTC_TCC780X 11
#define RTC_MR100 12
#define RTC_MC13783 13 /* Freescale MC13783 PMIC */
@@ -420,8 +407,6 @@ Lyre prototype 1 */
#include "config/ipodnano2g.h"
#elif defined(IPOD_6G)
#include "config/ipod6g.h"
-#elif defined(IRIVER_IFP7XX)
-#include "config/iriverifp7xx.h"
#elif defined(GIGABEAT_F)
#include "config/gigabeatfx.h"
#elif defined(GIGABEAT_S)
@@ -438,18 +423,12 @@ Lyre prototype 1 */
#include "config/sansae200.h"
#elif defined(SANSA_C200)
#include "config/sansac200.h"
-#elif defined(SANSA_M200)
-#include "config/sansam200.h"
#elif defined(TATUNG_TPJ1022)
#include "config/tatungtpj1022.h"
#elif defined(MROBE_100)
#include "config/mrobe100.h"
#elif defined(MROBE_500)
#include "config/mrobe500.h"
-#elif defined(LOGIK_DAX)
-#include "config/logikdax.h"
-#elif defined(IAUDIO_7)
-#include "config/iaudio7.h"
#elif defined(COWON_D2)
#include "config/cowond2.h"
#elif defined(CREATIVE_ZVM)
@@ -468,8 +447,6 @@ Lyre prototype 1 */
#include "config/gogearhdd1630.h"
#elif defined(PHILIPS_HDD6330)
#include "config/gogearhdd6330.h"
-#elif defined(SANSA_C100)
-#include "config/sansac100.h"
#elif defined(MEIZU_M6SL)
#include "config/meizum6sl.h"
#elif defined(MEIZU_M6SP)
@@ -666,11 +643,6 @@ Lyre prototype 1 */
#define CPU_S5L870X
#endif
-/* define for all cpus from TCC77X family */
-#if (CONFIG_CPU == TCC771L) || (CONFIG_CPU == TCC773L) || (CONFIG_CPU == TCC770)
-#define CPU_TCC77X
-#endif
-
/* define for all cpus from TCC780 family */
#if (CONFIG_CPU == TCC7801)
#define CPU_TCC780X
@@ -930,6 +902,10 @@ Lyre prototype 1 */
#define INCLUDE_TIMEOUT_API
#define USB_DRIVER_CLOSE
#endif
+#if defined(HAVE_USBSTACK) && CONFIG_USBOTG == USBOTG_TNETV105
+#define INCLUDE_TIMEOUT_API
+#define USB_DRIVER_CLOSE
+#endif
#endif
#else /* !BOOTLOADER */
@@ -966,6 +942,9 @@ Lyre prototype 1 */
#define USB_DETECT_BY_REQUEST
#elif CONFIG_USBOTG == USBOTG_RK27XX
#define USB_DETECT_BY_REQUEST
+#elif CONFIG_USBOTG == USBOTG_TNETV105
+#define USB_STATUS_BY_EVENT
+#define USB_DETECT_BY_REQUEST
#endif /* CONFIG_USB == */
#endif /* HAVE_USBSTACK */
@@ -1199,10 +1178,11 @@ Lyre prototype 1 */
(CONFIG_USBOTG == USBOTG_M66591) || \
(CONFIG_USBOTG == USBOTG_DESIGNWARE) || \
(CONFIG_USBOTG == USBOTG_AS3525) || \
- (CONFIG_USBOTG == USBOTG_RK27XX)
+ (CONFIG_USBOTG == USBOTG_RK27XX) || \
+ (CONFIG_USBOTG == USBOTG_TNETV105)
#define USB_HAS_BULK
#define USB_HAS_INTERRUPT
-#elif defined(CPU_TCC780X) || defined(CPU_TCC77X)
+#elif defined(CPU_TCC780X)
#define USB_HAS_BULK
#elif CONFIG_USBOTG == USBOTG_S3C6400X
#define USB_HAS_BULK
@@ -1219,7 +1199,7 @@ Lyre prototype 1 */
/* enable usb storage for targets that do bootloader usb */
#if defined(HAVE_BOOTLOADER_USB_MODE) || \
- defined(CREATIVE_ZVx) || defined(CPU_TCC77X) || defined(CPU_TCC780X) || \
+ defined(CREATIVE_ZVx) || defined(CPU_TCC780X) || \
CONFIG_USBOTG == USBOTG_JZ4740 || CONFIG_USBOTG == USBOTG_AS3525 || \
CONFIG_USBOTG == USBOTG_S3C6400X || CONFIG_USBOTG == USBOTG_DESIGNWARE || \
CONFIG_USBOTG == USBOTG_JZ4760
diff --git a/firmware/export/config/aigoerosq.h b/firmware/export/config/aigoerosq.h
index 2d0f7a0cdf..bfaa323968 100644
--- a/firmware/export/config/aigoerosq.h
+++ b/firmware/export/config/aigoerosq.h
@@ -15,6 +15,7 @@
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
+#define HAVE_HOTKEY
#define HAVE_HEADPHONE_DETECTION
#define HAVE_LINEOUT_DETECTION
diff --git a/firmware/export/config/fiiom3k.h b/firmware/export/config/fiiom3k.h
index 115532dc39..849aa9c0a6 100644
--- a/firmware/export/config/fiiom3k.h
+++ b/firmware/export/config/fiiom3k.h
@@ -22,6 +22,8 @@
/* Drivers */
#define HAVE_I2C_ASYNC
+#define HAVE_FT6x06
+#define FT6x06_SWAP_AXES
/* Buffer for plugins and codecs. */
#define PLUGIN_BUFFER_SIZE 0x200000 /* 2 MiB */
@@ -90,7 +92,7 @@
#define HAVE_SW_POWEROFF
#ifndef SIMULATOR
-#define HAVE_AXP173
+#define HAVE_AXP_PMU 192
#define HAVE_POWEROFF_WHILE_CHARGING
#endif
@@ -101,9 +103,18 @@
#define BATTERY_CAPACITY_INC 0
#define BATTERY_TYPES_COUNT 1
-/* USB is still TODO. */
+/* USB support */
#ifndef SIMULATOR
-#define USB_NONE
+#define CONFIG_USBOTG USBOTG_DESIGNWARE
+#define USB_DW_ARCH_SLAVE
+#define USB_DW_TURNAROUND 5
+#define HAVE_USBSTACK
+#define USB_VENDOR_ID 0x2972
+#define USB_PRODUCT_ID 0x0003
+#define USB_DEVBSS_ATTR __attribute__((aligned(32)))
+#define HAVE_USB_POWER
+#define HAVE_USB_CHARGING_ENABLE
+#define HAVE_BOOTLOADER_USB_MODE
#endif
/* Rockbox capabilities */
@@ -115,4 +126,5 @@
#define HAVE_VOLUME_IN_LIST
#define HAVE_QUICKSCREEN
#define HAVE_HOTKEY
+#define HAVE_LOCKED_ACTIONS
#define AB_REPEAT_ENABLE
diff --git a/firmware/export/config/iaudio7.h b/firmware/export/config/iaudio7.h
deleted file mode 100644
index 698ff13724..0000000000
--- a/firmware/export/config/iaudio7.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * This config file is for the Iaudio7 series
- */
-
-/* For Rolo and boot loader */
-#define MODEL_NUMBER 32
-#define MODEL_NAME "Cowon iAudio7"
-
-/* define this if you have recording possibility */
-#define HAVE_RECORDING
-
-/* Define bitmask of input sources - recordable bitmask can be defined
- explicitly if different */
-#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)
-
-/* FM Tuner */
-#define CONFIG_TUNER LV24020LP
-#define HAVE_TUNER_PWR_CTRL
-
-/* Define this for FM radio input available */
-#define HAVE_FMRADIO_IN
-
-/* define hardware samples rate caps mask */
-#define HW_SAMPR_CAPS (/*SAMPR_CAP_88 | */SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
-
-/* define the bitmask of recording sample rates */
-#define REC_SAMPR_CAPS (SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
-
-
-
-
-/* define this if you have a colour LCD */
-#define HAVE_LCD_COLOR
-
-/* define this if you can flip your LCD */
-//#define HAVE_LCD_FLIP
-
-/* define this if you can invert the colours on your LCD */
-//#define HAVE_LCD_INVERT
-
-/* 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 have LCD enable function */
-#define HAVE_LCD_ENABLE
-
-/* define this if you would like tagcache to build on this target */
-#define HAVE_TAGCACHE
-
-#define HAVE_FAT16SUPPORT
-
-#if 0 && !defined(SIMULATOR) /* Enable for USB driver test */
-#define HAVE_USBSTACK
-#define USB_VENDOR_ID 0x0e21
-#define USB_PRODUCT_ID 0x0750
-#endif
-
-/* define this if you have a flash memory storage */
-#define HAVE_FLASH_STORAGE
-
-#define CONFIG_STORAGE STORAGE_NAND
-
-#define CONFIG_NAND NAND_TCC
-
-/* LCD dimensions */
-#define LCD_WIDTH 160
-#define LCD_HEIGHT 128
-/* sqrt(160^2 + 128^2) / 1.3 = 157.6 */
-#define LCD_DPI 158
-/* 16bits for now... */
-#define LCD_DEPTH 16 /* 262144 colours */
-#define LCD_PIXELFORMAT RGB565 /*rgb565*/
-
-/*#define LCD_PIXELFORMAT VERTICAL_PACKING*/
-
-/* define this to indicate your device's keypad */
-#define CONFIG_KEYPAD IAUDIO67_PAD
-
-/* #define HAVE_BUTTON_DATA */
-
-/* define this if you have a real-time clock */
-#define CONFIG_RTC RTC_PCF50606
-
-/* define this if you have RTC RAM available for settings */
-//#define HAVE_RTC_RAM
-
-/* Define this if you have a software controlled poweroff */
-#define HAVE_SW_POWEROFF
-
-/* Reduce Tremor's ICODE usage */
-#define ICODE_ATTR_TREMOR_NOT_MDCT
-
-/* The number of bytes reserved for loadable codecs */
-#define CODEC_SIZE 0x100000
-
-/* The number of bytes reserved for loadable plugins */
-#define PLUGIN_BUFFER_SIZE 0x80000
-
-#define AB_REPEAT_ENABLE
-
-
-
-
-/* The iaudio7 uses built-in WM8731 codec */
-#define HAVE_WM8731
-/* Codec is slave on serial bus */
-#define CODEC_SLAVE
-
-/* WM8731 has no tone controls, so we use the software ones */
-#define HAVE_SW_TONE_CONTROLS
-
-/* Define this for LCD backlight available */
-#define HAVE_BACKLIGHT
-
-#define CONFIG_I2C I2C_TCC77X
-
-#define BATTERY_CAPACITY_DEFAULT 540 /* default battery capacity */
-#define BATTERY_CAPACITY_MIN 540 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 540 /* max. capacity selectable */
-#define BATTERY_CAPACITY_INC 50 /* capacity increment */
-#define BATTERY_TYPES_COUNT 1 /* only one type */
-
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
-
-#define CONFIG_CHARGING CHARGING_SIMPLE
-
-/* Define this if you have a TCC770 */
-#define CONFIG_CPU TCC770
-
-/* Define this if you have ATA power-off control */
-#define HAVE_ATA_POWER_OFF
-
-/* Define this to the CPU frequency */
-#define CPU_FREQ 120000000
-
-/* Offset ( in the firmware file's header ) to the file CRC */
-#define FIRMWARE_OFFSET_FILE_CRC 0
-
-/* Offset ( in the firmware file's header ) to the real data */
-#define FIRMWARE_OFFSET_FILE_DATA 8
-
-#define CONFIG_LCD LCD_IAUDIO67
-
-#define BOOTFILE_EXT "iaudio"
-#define BOOTFILE "rockbox." BOOTFILE_EXT
-#define BOOTDIR "/.rockbox"
-
-#ifdef BOOTLOADER
-#define TCCBOOT
-#endif
-
-#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
-
-/* Define this if a programmable hotkey is mapped */
-//#define HAVE_HOTKEY
diff --git a/firmware/export/config/ibassodx50.h b/firmware/export/config/ibassodx50.h
index bb4b2809e5..2161d9f3e3 100644
--- a/firmware/export/config/ibassodx50.h
+++ b/firmware/export/config/ibassodx50.h
@@ -97,11 +97,9 @@
/* Which backlight fading type? */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
-
-
#define HAVE_SW_TONE_CONTROLS
#define HAVE_SW_VOLUME_CONTROL
-#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
+#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192
//#define HAVE_MULTIMEDIA_KEYS
#define CONFIG_KEYPAD DX50_PAD
@@ -111,7 +109,7 @@
#define BATTERY_CAPACITY_DEFAULT 2100 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 1700 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
+#define BATTERY_CAPACITY_MAX 7300 /* max. capacity selectable */
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
diff --git a/firmware/export/config/ibassodx90.h b/firmware/export/config/ibassodx90.h
index cd7ddf78cd..570a8d2a35 100644
--- a/firmware/export/config/ibassodx90.h
+++ b/firmware/export/config/ibassodx90.h
@@ -96,11 +96,9 @@
/* Which backlight fading type? */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
-
-
#define HAVE_SW_TONE_CONTROLS
#define HAVE_SW_VOLUME_CONTROL
-#define HW_SAMPR_CAPS SAMPR_CAP_ALL_96
+#define HW_SAMPR_CAPS SAMPR_CAP_ALL_192
//#define HAVE_MULTIMEDIA_KEYS
#define CONFIG_KEYPAD DX50_PAD
@@ -110,7 +108,7 @@
#define BATTERY_CAPACITY_DEFAULT 2100 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 1700 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
+#define BATTERY_CAPACITY_MAX 7300 /* max. capacity selectable */
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
diff --git a/firmware/export/config/iriverifp7xx.h b/firmware/export/config/iriverifp7xx.h
deleted file mode 100644
index 0db9a7810d..0000000000
--- a/firmware/export/config/iriverifp7xx.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * This config file is for iriver iFP-799
- */
-
-#define IRIVER_IFP7XX_SERIES 1
-
-#define MODEL_NAME "iriver iFP-799"
-
-/* For Rolo and boot loader */
-#define MODEL_NUMBER 6
-
-/* define this if you have recording possibility */
-/*#define HAVE_RECORDING*/
-
-
-
-
-/* define this if you would like tagcache to build on this target */
-/* #define HAVE_TAGCACHE */
-
-/* LCD dimensions */
-#define LCD_WIDTH 128
-#define LCD_HEIGHT 64
-/* sqrt(128^2 + 64^2) / 1.0 = 143.1 */
-#define LCD_DPI 143
-#define LCD_DEPTH 1
-
-#define LCD_PIXELFORMAT VERTICAL_PACKING
-
-/* Display colours, for screenshots and sim (0xRRGGBB) */
-#define LCD_DARKCOLOR 0x000000
-#define LCD_BRIGHTCOLOR 0x5e6854
-#define LCD_BL_DARKCOLOR 0x000000
-#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
-
-#define CONFIG_KEYPAD IRIVER_IFP7XX_PAD
-
-#define CONFIG_STORAGE STORAGE_NAND
-
-#define CONFIG_NAND NAND_IFP7XX
-
-#define HAVE_FAT16SUPPORT
-
-
-
-
-/* Define this if you have a software controlled poweroff */
-#define HAVE_SW_POWEROFF
-
-/* The number of bytes reserved for loadable codecs */
-#define CODEC_SIZE 0x38000
-
-/* The number of bytes reserved for loadable plugins */
-#define PLUGIN_BUFFER_SIZE 0x10000
-
-/* Define this if you have the WM8975 audio codec */
-/* #define HAVE_WM8975 */
-
-#define HAVE_LCD_CONTRAST
-
-#define MIN_CONTRAST_SETTING 5
-#define MAX_CONTRAST_SETTING 63
-#define DEFAULT_CONTRAST_SETTING 40
-
-/* define this if you have a flash memory storage */
-#define HAVE_FLASH_STORAGE
-
-#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
-#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 2800 /* max. capacity selectable */
-#define BATTERY_CAPACITY_INC 50 /* capacity increment */
-#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
-
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
-
-/* define this if the unit should not shut down on low battery. */
-#define NO_LOW_BATTERY_SHUTDOWN
-
-/* Define this if you have a Philips PNX0101 */
-#define CONFIG_CPU PNX0101
-
-/* Define this if you want to use the PNX0101 i2c interface */
-#define CONFIG_I2C I2C_PNX0101
-
-/* The start address index for ROM builds */
-#define ROM_START 0x00000000
-
-/* Define this for LCD backlight available */
-#define HAVE_BACKLIGHT
-
-/* Define this to the CPU frequency */
-#define CPU_FREQ 48000000
-
-#define CONFIG_LCD LCD_IFP7XX
-
-/* Offset ( in the firmware file's header ) to the file length */
-#define FIRMWARE_OFFSET_FILE_LENGTH 0
-
-/* Offset ( in the firmware file's header ) to the file CRC */
-#define FIRMWARE_OFFSET_FILE_CRC 0
-
-/* Offset ( in the firmware file's header ) to the real data */
-#define FIRMWARE_OFFSET_FILE_DATA 8
-
-#define USB_ISP1582
-
-#define HAVE_GDB_API
-
-/* Define this if you have adjustable CPU frequency */
-#define HAVE_ADJUSTABLE_CPU_FREQ
-
-#define BOOTFILE_EXT "iriver"
-#define BOOTFILE "rockbox." BOOTFILE_EXT
-#define BOOTDIR "/.rockbox"
-
-#define IBSS_ATTR_VOICE_STACK
-#define ICODE_ATTR_TREMOR_NOT_MDCT
-#define ICODE_ATTR_TREMOR_MDCT
-#define ICODE_ATTR_FLAC
-#define IBSS_ATTR_FLAC_DECODED0
-#define ICONST_ATTR_MPA_HUFFMAN
-#define IBSS_ATTR_MPC_SAMPLE_BUF
-#define ICODE_ATTR_ALAC
-#define IBSS_ATTR_SHORTEN_DECODED0
-
-#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
-
-/* Define this if a programmable hotkey is mapped */
-#define HAVE_HOTKEY
diff --git a/firmware/export/config/logikdax.h b/firmware/export/config/logikdax.h
deleted file mode 100644
index 47229f7a1d..0000000000
--- a/firmware/export/config/logikdax.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * This config file is for the Logik DAX MP3/DAB
- */
-
-/* For Rolo and boot loader */
-#define MODEL_NUMBER 33
-
-#define MODEL_NAME "Logik DAX MP3/DAB"
-
-/* define this if you have recording possibility */
-//#define HAVE_RECORDING
-
-/* Define bitmask of input sources - recordable bitmask can be defined
- explicitly if different */
-//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF)
-
-#if 0 /* Enable for USB driver test */
-#define HAVE_USBSTACK
-#define USB_VENDOR_ID 0x13d1
-#define USB_PRODUCT_ID 0x1002
-#endif
-
-
-
-
-
-/* define this if you can flip your LCD */
-#define HAVE_LCD_FLIP
-
-/* define this if you can invert the colours on your LCD */
-#define HAVE_LCD_INVERT
-
-/* 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 HAVE_FAT16SUPPORT
-
-/* define this if you have a flash memory storage */
-#define HAVE_FLASH_STORAGE
-
-#define CONFIG_STORAGE STORAGE_NAND
-
-#define CONFIG_NAND NAND_TCC
-
-/* LCD dimensions */
-#define LCD_WIDTH 128
-#define LCD_HEIGHT 64
-/* sqrt(128^2 + 64^2) / 1.0 = 143.1 */
-#define LCD_DPI 143
-#define LCD_DEPTH 1
-
-#define LCD_PIXELFORMAT VERTICAL_PACKING
-
-/* Display colours, for screenshots and sim (0xRRGGBB) */
-#define LCD_DARKCOLOR 0x000000
-#define LCD_BRIGHTCOLOR 0x5a915a
-#define LCD_BL_DARKCOLOR 0x000000
-#define LCD_BL_BRIGHTCOLOR 0x82b4fa
-
-/* define this to indicate your device's keypad */
-#define CONFIG_KEYPAD LOGIK_DAX_PAD
-
-/* define this if you have a real-time clock */
-#define CONFIG_RTC RTC_TCC77X
-
-/* define this if you have RTC RAM available for settings */
-//#define HAVE_RTC_RAM
-
-/* Define this if you have a software controlled poweroff */
-#define HAVE_SW_POWEROFF
-
-/* The number of bytes reserved for loadable codecs */
-#define CODEC_SIZE 0x38000
-
-/* The number of bytes reserved for loadable plugins */
-#define PLUGIN_BUFFER_SIZE 0x10000
-
-#define AB_REPEAT_ENABLE
-
-
-
-
-/* The DAX uses built-in WM8731 codec */
-#define HAVE_WM8731
-/* Codec is slave on serial bus */
-#define CODEC_SLAVE
-/* WM8731 has no tone controls, so we use the software ones */
-#define HAVE_SW_TONE_CONTROLS
-
-/* Define this for LCD backlight available */
-#define HAVE_BACKLIGHT
-
-#define CONFIG_I2C I2C_TCC77X
-
-#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
-#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
-#define BATTERY_CAPACITY_INC 50 /* capacity increment */
-#define BATTERY_TYPES_COUNT 1 /* only one type */
-
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
-
-/* define this if the unit should not shut down on low battery. */
-#define NO_LOW_BATTERY_SHUTDOWN
-
-/* Define this if you have a TCC773L */
-#define CONFIG_CPU TCC773L
-
-/* Define this if you have ATA power-off control */
-#define HAVE_ATA_POWER_OFF
-
-#define HAVE_FAT16SUPPORT
-
-/* Define this to the CPU frequency */
-#define CPU_FREQ 120000000
-
-/* Offset ( in the firmware file's header ) to the file length */
-#define FIRMWARE_OFFSET_FILE_LENGTH 0
-
-/* Offset ( in the firmware file's header ) to the file CRC */
-#define FIRMWARE_OFFSET_FILE_CRC 4
-
-/* Offset ( in the firmware file's header ) to the real data */
-#define FIRMWARE_OFFSET_FILE_DATA 6
-
-/* The start address index for ROM builds */
-/* #define ROM_START 0x11010 for behind original Archos */
-#define ROM_START 0x7010 /* for behind BootBox */
-
-#define CONFIG_LCD LCD_SSD1815
-
-#define BOOTFILE_EXT "logik"
-#define BOOTFILE "rockbox." BOOTFILE_EXT
-#define BOOTDIR "/"
-
-#define IBSS_ATTR_VOICE_STACK
-#define ICODE_ATTR_TREMOR_NOT_MDCT
-#define ICODE_ATTR_TREMOR_MDCT
-#define ICODE_ATTR_FLAC
-#define IBSS_ATTR_FLAC_DECODED0
-#define ICONST_ATTR_MPA_HUFFMAN
-#define IBSS_ATTR_MPC_SAMPLE_BUF
-#define ICODE_ATTR_ALAC
-#define IBSS_ATTR_SHORTEN_DECODED0
-
-#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
-
-/* Define this if a programmable hotkey is mapped */
-//#define HAVE_HOTKEY
diff --git a/firmware/export/config/sansac100.h b/firmware/export/config/sansac100.h
deleted file mode 100644
index c2956eed12..0000000000
--- a/firmware/export/config/sansac100.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * This config file is for the Sansa C100 series
- */
-
-#define MODEL_NAME "Sandisk Sansa c100 series"
-
-/* For Rolo and bootloader */
-#define MODEL_NUMBER 30
-
-/* define hardware samples rate caps mask */
-#define HW_SAMPR_CAPS (/*SAMPR_CAP_88 | */SAMPR_CAP_44/* | SAMPR_CAP_22 | SAMPR_CAP_11*/)
-
-
-
-
-/* define this if you have a colour LCD */
-#define HAVE_LCD_COLOR
-
-/* define this if you can flip your LCD */
-/*#define HAVE_LCD_FLIP*/
-
-/* define this if you can invert the colours on your LCD */
-/*#define HAVE_LCD_INVERT*/
-
-/* 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 this if you have a flash memory storage */
-#define HAVE_FLASH_STORAGE
-
-/* Only v1 */
-#define CONFIG_STORAGE STORAGE_NAND
-#define CONFIG_NAND NAND_TCC
-
-/* c100's with direct-to-NAND access are FAT16 */
-#define HAVE_FAT16SUPPORT
-
-/* LCD dimensions */
-#define LCD_WIDTH 128
-#define LCD_HEIGHT 64
-/* sqrt(128^2 + 64^2) / 1.7 = 84.2 */
-#define LCD_DPI 84
-#define LCD_DEPTH 16 /* 65536 colours */
-#define LCD_PIXELFORMAT RGB565 /*rgb565*/
-
-/*#define LCD_PIXELFORMAT VERTICAL_PACKING*/
-
-/* define this to indicate your device's keypad */
-#define CONFIG_KEYPAD SANSA_C100_PAD
-
-/* define this if you have a real-time clock */
-#define CONFIG_RTC RTC_TCC77X
-
-/* define this if you have RTC RAM available for settings */
-//#define HAVE_RTC_RAM
-
-/* Define this if you have a software controlled poweroff */
-#define HAVE_SW_POWEROFF
-
-/* The number of bytes reserved for loadable codecs */
-#define CODEC_SIZE 0x50000
-
-/* The number of bytes reserved for loadable plugins */
-#define PLUGIN_BUFFER_SIZE 0x50000
-
-#define AB_REPEAT_ENABLE
-
-
-
-
-/* Define this if you have the TLV320 audio codec */
-#define HAVE_TLV320
-
-/*#define CONFIG_TUNER TEA5767*/
-
-/* TLV320 has no tone controls, so we use the software ones */
-#define HAVE_SW_TONE_CONTROLS
-
-/* Define this for LCD backlight available */
-#define HAVE_BACKLIGHT
-
-#define CONFIG_I2C I2C_TCC77X
-
-#define BATTERY_CAPACITY_DEFAULT 540 /* default battery capacity */
-#define BATTERY_CAPACITY_MIN 540 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 540 /* max. capacity selectable */
-#define BATTERY_CAPACITY_INC 50 /* capacity increment */
-#define BATTERY_TYPES_COUNT 1 /* only one type */
-
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
-
-/* define this if the unit should not shut down on low battery. */
-#define NO_LOW_BATTERY_SHUTDOWN
-
-/* Define this if you have a TCC770 */
-#define CONFIG_CPU TCC770
-
-/* Define this if you have ATA power-off control */
-#define HAVE_ATA_POWER_OFF
-
-/* Define this to the CPU frequency */
-#define CPU_FREQ 120000000
-
-/* Offset ( in the firmware file's header ) to the file CRC */
-#define FIRMWARE_OFFSET_FILE_CRC 0
-
-/* Offset ( in the firmware file's header ) to the real data */
-#define FIRMWARE_OFFSET_FILE_DATA 8
-
-/* The start address index for ROM builds */
-/* #define ROM_START 0x11010 for behind original Archos */
-#define ROM_START 0x7010 /* for behind BootBox */
-
-#define CONFIG_LCD LCD_S6B33B2
-
-#define BOOTFILE_EXT "c100"
-#define BOOTFILE "rockbox." BOOTFILE_EXT
-#define BOOTDIR "/.rockbox"
-
-#ifdef BOOTLOADER
-#define TCCBOOT
-#endif
-
-#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
-
-/* Define this if a programmable hotkey is mapped */
-#define HAVE_HOTKEY
diff --git a/firmware/export/config/sansaconnect.h b/firmware/export/config/sansaconnect.h
index 465a576664..5909d3bf84 100644
--- a/firmware/export/config/sansaconnect.h
+++ b/firmware/export/config/sansaconnect.h
@@ -147,7 +147,7 @@
#define BATTERY_CAPACITY_INC 100 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
+#define CONFIG_BATTERY_MEASURE PERCENTAGE_MEASURE
/* define current usage levels */
#if 0
@@ -156,9 +156,6 @@
#define CURRENT_BACKLIGHT 200
#endif
-/* Hardware controlled charging with monitoring */
-//#define CONFIG_CHARGING CHARGING_MONITOR
-
#define CONFIG_CPU DM320
#define CONFIG_I2C I2C_DM320
@@ -182,11 +179,18 @@
/* Offset ( in the firmware file's header ) to the real data */
#define FIRMWARE_OFFSET_FILE_DATA 8
-#if 0
+/* Hardware controlled charging */
+#define CONFIG_CHARGING CHARGING_MONITOR
+
+#define CONFIG_USBOTG USBOTG_TNETV105
+
#define HAVE_USBSTACK
+#define HAVE_USB_POWER
+#define HAVE_USB_CHARGING_ENABLE
+#define HAVE_BOOTLOADER_USB_MODE
#define USB_VENDOR_ID 0x0781
#define USB_PRODUCT_ID 0x7480
-#endif
+#define USB_NUM_ENDPOINTS 5
#define INCLUDE_TIMEOUT_API
diff --git a/firmware/export/config/sansam200.h b/firmware/export/config/sansam200.h
deleted file mode 100644
index 95647013e7..0000000000
--- a/firmware/export/config/sansam200.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * This config file is for the Sansa M200 series
- */
-
-/* For Rolo and boot loader */
-#define MODEL_NUMBER 29
-
-#define MODEL_NAME "Sandisk Sansa m200 series"
-
-/* Enable FAT16 support */
-#define HAVE_FAT16SUPPORT
-
-/* define this if you have recording possibility */
-//#define HAVE_RECORDING
-
-/* Define bitmask of input sources - recordable bitmask can be defined
- explicitly if different */
-//#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_SPDIF)
-
-
-
-
-/* define this if you can flip your LCD */
-#define HAVE_LCD_FLIP
-
-/* define this if you can invert the colours on your LCD */
-#define HAVE_LCD_INVERT
-
-/* 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 this if you have a flash memory storage */
-#define HAVE_FLASH_STORAGE
-
-#define CONFIG_STORAGE STORAGE_NAND
-
-#define CONFIG_NAND NAND_TCC
-
-/* LCD dimensions */
-#define LCD_WIDTH 128
-#define LCD_HEIGHT 64
-/* sqrt(128^2 + 64^2) / 1.8 = 79.5 */
-#define LCD_DPI 80
-#define LCD_DEPTH 1
-
-#define LCD_PIXELFORMAT VERTICAL_PACKING
-
-/* Display colours, for screenshots and sim (0xRRGGBB) */
-#define LCD_BARKCOLOR 0x000000
-#define LCD_BRIGHTCOLOR 0x5e6854
-#define LCD_BL_DARKCOLOR 0x000000
-#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
-
-/* define this to indicate your device's keypad */
-#define CONFIG_KEYPAD SANSA_M200_PAD
-
-/* Define this to enable morse code input */
-#define HAVE_MORSE_INPUT
-
-/* define this if you have a real-time clock */
-#define CONFIG_RTC RTC_TCC77X
-
-/* define this if you have RTC RAM available for settings */
-//#define HAVE_RTC_RAM
-
-/* Define this if you have a software controlled poweroff */
-#define HAVE_SW_POWEROFF
-
-/* The number of bytes reserved for loadable codecs */
-#define CODEC_SIZE 0x38000
-
-/* The number of bytes reserved for loadable plugins */
-#define PLUGIN_BUFFER_SIZE 0x10000
-
-#define AB_REPEAT_ENABLE
-
-
-
-
-/* Define this if you have the TLV320 audio codec */
-#define HAVE_TLV320
-
-/* TLV320 has no tone controls, so we use the software ones */
-#define HAVE_SW_TONE_CONTROLS
-
-/* Define this for LCD backlight available */
-#define HAVE_BACKLIGHT
-
-#define CONFIG_I2C I2C_TCC77X
-
-#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
-#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
-#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
-#define BATTERY_CAPACITY_INC 50 /* capacity increment */
-#define BATTERY_TYPES_COUNT 1 /* only one type */
-
-#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
-
-/* define this if the unit should not shut down on low battery. */
-#define NO_LOW_BATTERY_SHUTDOWN
-
-/* Define this if you have a TCC770 */
-#define CONFIG_CPU TCC770
-
-/* Define this if you have ATA power-off control */
-#define HAVE_ATA_POWER_OFF
-
-/* Define this to the CPU frequency */
-#define CPU_FREQ 120000000
-
-/* Offset ( in the firmware file's header ) to the file CRC */
-#define FIRMWARE_OFFSET_FILE_CRC 0
-
-/* Offset ( in the firmware file's header ) to the real data */
-#define FIRMWARE_OFFSET_FILE_DATA 8
-
-#define CONFIG_LCD LCD_SSD1815
-
-#define BOOTFILE_EXT "m200"
-#define BOOTFILE "rockbox." BOOTFILE_EXT
-#define BOOTDIR "/"
-
-#define IBSS_ATTR_VOICE_STACK
-#define ICODE_ATTR_TREMOR_NOT_MDCT
-#define ICODE_ATTR_TREMOR_MDCT
-#define ICODE_ATTR_FLAC
-#define IBSS_ATTR_FLAC_DECODED0
-#define ICONST_ATTR_MPA_HUFFMAN
-#define IBSS_ATTR_MPC_SAMPLE_BUF
-#define ICODE_ATTR_ALAC
-#define IBSS_ATTR_SHORTEN_DECODED0
-
-#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
-
-/* Define this if a programmable hotkey is mapped */
-#define HAVE_HOTKEY
diff --git a/firmware/export/cpu.h b/firmware/export/cpu.h
index aade199dd2..67509141aa 100644
--- a/firmware/export/cpu.h
+++ b/firmware/export/cpu.h
@@ -50,9 +50,6 @@
#if CONFIG_CPU == IMX31L
#include "imx31l.h"
#endif
-#ifdef CPU_TCC77X
-#include "tcc77x.h"
-#endif
#ifdef CPU_TCC780X
#include "tcc780x.h"
#endif
@@ -80,3 +77,6 @@
#if CONFIG_CPU == RK27XX
#include "rk27xx.h"
#endif
+#if CONFIG_CPU == X1000
+#include "x1000.h"
+#endif
diff --git a/firmware/export/dm320.h b/firmware/export/dm320.h
index def8508b0b..01f206bfc9 100644
--- a/firmware/export/dm320.h
+++ b/firmware/export/dm320.h
@@ -930,11 +930,27 @@ extern unsigned long _ttbstart;
#define MMC_ST1_DXFULL (1 << 3)
#define MMC_ST1_DAT3ST (1 << 4)
+#define MMC_IE_EDATDNE (1 << 0)
+#define MMC_IE_EBSYDNE (1 << 1)
+#define MMC_IE_ERSPDNE (1 << 2)
+#define MMC_IE_ETOUTRD (1 << 3)
+#define MMC_IE_ETOUTRS (1 << 4)
+#define MMC_IE_ECRCWR (1 << 5)
+#define MMC_IE_ECRCRD (1 << 6)
+#define MMC_IE_ECRCRS (1 << 7)
+#define MMC_IE_EDXRDY (1 << 9)
+#define MMC_IE_EDRRDY (1 << 10)
+#define MMC_IE_EDATED (1 << 11)
+
#define MMC_DMAMODE_RD_WORDSWAP (1 << 10)
#define MMC_DMAMODE_WR_WORDSWAP (1 << 11)
#define MMC_DMAMODE_WRITE (1 << 12)
#define MMC_DMAMODE_ENABLE (1 << 13)
#define MMC_DMAMODE_TIMEOUTIRQ_EN (1 << 14)
+
+#define MMC_DMASTAT1_RUNST (1 << 12)
+#define MMC_DMASTAT1_TOUTDT (1 << 13)
+
/*
* IO_EINTx bits
*/
@@ -1001,6 +1017,7 @@ extern unsigned long _ttbstart;
#define INTR_IRQ1_EXT0 INTR_EINT1_EXT0
#define INTR_IRQ1_EXT2 INTR_EINT1_EXT2
#define INTR_IRQ1_EXT7 INTR_EINT1_EXT7
+#define INTR_IRQ1_MMCSDMS0 INTR_EINT1_MMCSDMS0
#define INTR_IRQ1_MTC0 INTR_EINT1_MTC0
/*
diff --git a/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c b/firmware/export/ft6x06.h
index 0bfcdf3b1a..de1fdd0979 100644
--- a/firmware/target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c
+++ b/firmware/export/ft6x06.h
@@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
- * Copyright (C) 2006 by Barry Wardell
+ * Copyright (C) 2021 Aidan MacDonald
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -18,32 +18,33 @@
* KIND, either express or implied.
*
****************************************************************************/
+
+#ifndef __FT6x06_H__
+#define __FT6x06_H__
+
#include "config.h"
-#include "cpu.h"
-#include "kernel.h"
-#include "thread.h"
-#include "system.h"
-#include "debug.h"
-#include "ata.h"
-#include "disk.h"
-#include "panic.h"
-#include "lcd.h"
-#include "usb.h"
-#include "button.h"
-#include "string.h"
-
-void usb_init_device(void)
-{
-}
-
-int usb_detect(void)
-{
- /* TODO: Implement USB_ISP1582 */
- return USB_EXTRACTED;
-}
-
-void usb_enable(bool on)
-{
- /* TODO: Implement USB_ISP1582 */
- (void)on;
-}
+#include <stdbool.h>
+
+typedef void(*ft6x06_event_cb)(int, int, int);
+
+struct ft6x06_state {
+ int event;
+ int pos_x;
+ int pos_y;
+};
+
+enum ft6x06_event {
+ FT6x06_EVT_NONE = -1,
+ FT6x06_EVT_PRESS = 0,
+ FT6x06_EVT_RELEASE = 1,
+ FT6x06_EVT_CONTACT = 2,
+};
+
+extern struct ft6x06_state ft6x06_state;
+
+void ft6x06_init(void);
+void ft6x06_set_event_cb(ft6x06_event_cb fn);
+void ft6x06_enable(bool en);
+void ft6x06_irq_handler(void);
+
+#endif /* __FT6x06_H__ */
diff --git a/firmware/export/gdb_api.h b/firmware/export/gdb_api.h
index 1836c5992e..d2358ee3bb 100644
--- a/firmware/export/gdb_api.h
+++ b/firmware/export/gdb_api.h
@@ -25,9 +25,6 @@
#include "config.h"
#define GDB_API_MAGIC 0x6db570b
-#ifdef IRIVER_IFP7XX_SERIES
-#define GDB_API_ADDRESS 0xc06000
-#endif
struct gdb_api
{
diff --git a/firmware/export/ifp_usb_serial.h b/firmware/export/ifp_usb_serial.h
deleted file mode 100644
index b56e5fff86..0000000000
--- a/firmware/export/ifp_usb_serial.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Tomasz Malesinski
- *
- * 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 _USB_SERIAL_H_
-#define _USB_SERIAL_H_
-
-void usb_serial_init(void);
-void usb_serial_put_byte(int b);
-int usb_serial_get_byte(void);
-int usb_serial_try_put_byte(int b);
-int usb_serial_try_get_byte(void);
-
-#endif
diff --git a/firmware/export/installer.h b/firmware/export/installer.h
deleted file mode 100644
index 802798618d..0000000000
--- a/firmware/export/installer.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2021 Aidan MacDonald
- *
- * 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 _INSTALLER_H_
-#define _INSTALLER_H_
-
-/* Provisional interface for installing/dumping a bootloader */
-
-extern int install_bootloader(const char* path);
-extern int dump_bootloader(const char* path);
-extern const char* installer_strerror(int rc);
-
-#endif /* _INSTALLER_H_ */
diff --git a/firmware/export/tcc77x.h b/firmware/export/tcc77x.h
deleted file mode 100644
index 3c457c5b38..0000000000
--- a/firmware/export/tcc77x.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2007 Dave Chapman
- *
- * 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 __TCC77X_H__
-#define __TCC77X_H__
-
-#define CACHEALIGN_BITS (5)
-
-/* General-purpose IO */
-
-#define GPIOA (*(volatile unsigned long *)0x80000300)
-#define GPIOB (*(volatile unsigned long *)0x80000310)
-#define GPIOC (*(volatile unsigned long *)0x80000320)
-#define GPIOD (*(volatile unsigned long *)0x80000330)
-#define GPIOE (*(volatile unsigned long *)0x80000340)
-
-#define GPIOA_DIR (*(volatile unsigned long *)0x80000304)
-#define GPIOB_DIR (*(volatile unsigned long *)0x80000314)
-#define GPIOC_DIR (*(volatile unsigned long *)0x80000324)
-#define GPIOD_DIR (*(volatile unsigned long *)0x80000334)
-#define GPIOE_DIR (*(volatile unsigned long *)0x80000344)
-
-#define GPIOA_FUNC (*(volatile unsigned long *)0x80000308)
-#define GPIOB_FUNC (*(volatile unsigned long *)0x80000318)
-#define GPIOC_FUNC (*(volatile unsigned long *)0x80000328)
-#define GPIOD_FUNC (*(volatile unsigned long *)0x80000338)
-#define GPIOE_FUNC (*(volatile unsigned long *)0x80000348)
-
-#define BMI (*(volatile unsigned long *)0x80000364)
-
-/* Clock Generator */
-
-#define CLKCTRL (*(volatile unsigned long *)0x80000400)
-#define PLL0CFG (*(volatile unsigned long *)0x80000404)
-#define CLKDIVC (*(volatile unsigned long *)0x8000040c)
-#define MODECTR (*(volatile unsigned long *)0x80000410)
-#define BCLKCTR (*(volatile unsigned long *)0x80000414)
-#define SWRESET (*(volatile unsigned long *)0x80000418)
-#define PCLKCFG0 (*(volatile unsigned long *)0x8000041c)
-#define PCLKCFG1 (*(volatile unsigned long *)0x80000420)
-#define PCLKCFG2 (*(volatile unsigned long *)0x80000424)
-#define PCLKCFG3 (*(volatile unsigned long *)0x80000428)
-#define PCLKCFG4 (*(volatile unsigned long *)0x8000042c)
-#define PCLKCFG5 (*(volatile unsigned long *)0x80000430)
-#define PCLKCFG6 (*(volatile unsigned long *)0x80000434)
-
-#define PCLK_DAI PCLKCFG6
-
-/* Device bits for SWRESET & BCLKCTR */
-
-#define DEV_DAI (1<<0)
-#define DEV_USBD (1<<4)
-#define DEV_ECC (1<<9)
-#define DEV_NAND (1<<16)
-
-/* ADC */
-
-#define ADCCON (*(volatile unsigned long *)0x80000a00)
-#define ADCDATA (*(volatile unsigned long *)0x80000a04)
-#define ADCCONA (*(volatile unsigned long *)0x80000a80)
-#define ADCSTATUS (*(volatile unsigned long *)0x80000a84)
-#define ADCCFG (*(volatile unsigned long *)0x80000a88)
-
-
-/* Memory Controller */
-#define SDCFG (*(volatile unsigned long *)0xf0000000)
-#define SDFSM (*(volatile unsigned long *)0xf0000004)
-#define MCFG (*(volatile unsigned long *)0xf0000008)
-#define TST (*(volatile unsigned long *)0xf000000c)
-#define CSCFG0 (*(volatile unsigned long *)0xf0000010)
-#define CSCFG1 (*(volatile unsigned long *)0xf0000014)
-#define CSCFG2 (*(volatile unsigned long *)0xf0000018)
-#define CSCFG3 (*(volatile unsigned long *)0xf000001c)
-#define CLKCFG (*(volatile unsigned long *)0xf0000020)
-#define SDCMD (*(volatile unsigned long *)0xf0000024)
-
-
-/* IRQ Controller */
-#define EXT0_IRQ_MASK (1<<0)
-#define EXT1_IRQ_MASK (1<<1)
-#define EXT2_IRQ_MASK (1<<2)
-#define EXT3_IRQ_MASK (1<<3)
-#define I2SR_IRQ_MASK (1<<4)
-#define I2ST_IRQ_MASK (1<<5)
-#define TIMER0_IRQ_MASK (1<<6)
-#define USBD_IRQ_MASK (1<<8) /* USB 2.0 device */
-#define USBH_IRQ_MASK (1<<10) /* USB 1.1 host */
-#define ADC_IRQ_MASK (1<<16)
-#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
-#define ECC_IRQ_MASK (1<<27)
-
-#define DAI_RX_IRQ_MASK I2SR_IRQ_MASK
-#define DAI_TX_IRQ_MASK I2ST_IRQ_MASK
-
-#define USB_DMA_IRQ_MASK (1<<26) /* USB DMA */
-
-#define IEN (*(volatile unsigned long *)0x80000100)
-#define CREQ (*(volatile unsigned long *)0x80000104)
-#define IREQ (*(volatile unsigned long *)0x80000108)
-#define IRQSEL (*(volatile unsigned long *)0x8000010c)
-#define ICFG (*(volatile unsigned long *)0x80000110)
-#define MREQ (*(volatile unsigned long *)0x80000114)
-#define TSTREQ (*(volatile unsigned long *)0x80000118)
-#define IRQ (*(volatile unsigned long *)0x80000120)
-#define FIQ (*(volatile unsigned long *)0x80000124)
-#define MIRQ (*(volatile unsigned long *)0x80000128)
-#define MFIQ (*(volatile unsigned long *)0x8000012c)
-#define TMODE (*(volatile unsigned long *)0x80000130)
-#define SYNC (*(volatile unsigned long *)0x80000134)
-#define WKUP (*(volatile unsigned long *)0x80000138)
-
-/* Timer Controller */
-
-#define TCFG0 (*(volatile unsigned long *)0x80000200)
-#define TCNT0 (*(volatile unsigned long *)0x80000204)
-#define TREF0 (*(volatile unsigned long *)0x80000208)
-#define TMREF0 (*(volatile unsigned long *)0x8000020c)
-#define TCFG1 (*(volatile unsigned long *)0x80000210)
-#define TCNT1 (*(volatile unsigned long *)0x80000214)
-#define TREF1 (*(volatile unsigned long *)0x80000218)
-#define TMREF1 (*(volatile unsigned long *)0x8000021c)
-#define TCFG2 (*(volatile unsigned long *)0x80000220)
-#define TCNT2 (*(volatile unsigned long *)0x80000224)
-#define TREF2 (*(volatile unsigned long *)0x80000228)
-#define TMREF2 (*(volatile unsigned long *)0x8000022c)
-#define TCFG3 (*(volatile unsigned long *)0x80000230)
-#define TCNT3 (*(volatile unsigned long *)0x80000234)
-#define TREF3 (*(volatile unsigned long *)0x80000238)
-#define TMREF3 (*(volatile unsigned long *)0x8000023c)
-#define TCFG4 (*(volatile unsigned long *)0x80000240)
-#define TCNT4 (*(volatile unsigned long *)0x80000244)
-#define TREF4 (*(volatile unsigned long *)0x80000248)
-#define TCFG5 (*(volatile unsigned long *)0x80000250)
-#define TCNT5 (*(volatile unsigned long *)0x80000254)
-#define TREF5 (*(volatile unsigned long *)0x80000258)
-#define TIREQ (*(volatile unsigned long *)0x80000260)
-#define TWDCFG (*(volatile unsigned long *)0x80000270)
-#define TWDCLR (*(volatile unsigned long *)0x80000274)
-#define TC32EN (*(volatile unsigned long *)0x80000280)
-#define TC32LDV (*(volatile unsigned long *)0x80000284)
-#define TC32CMP0 (*(volatile unsigned long *)0x80000288)
-#define TC32CMP1 (*(volatile unsigned long *)0x8000028c)
-#define TC32PCNT (*(volatile unsigned long *)0x80000290)
-#define TC32MCNT (*(volatile unsigned long *)0x80000294)
-#define TC32IRQ (*(volatile unsigned long *)0x80000298)
-
-/* TIREQ flags */
-#define TF0 (1<<8) /* Timer 0 reference value reached */
-#define TF1 (1<<9) /* Timer 1 reference value reached */
-#define TI0 (1<<0) /* Timer 0 IRQ flag */
-#define TI1 (1<<1) /* Timer 1 IRQ flag */
-
-/* NAND Flash Controller */
-
-#define NFC_CMD (*(volatile unsigned long *)0x90000000)
-#define NFC_SADDR (*(volatile unsigned long *)0x9000000C)
-#define NFC_SDATA (*(volatile unsigned long *)0x90000040)
-#define NFC_WDATA (*(volatile unsigned long *)0x90000010)
-#define NFC_CTRL (*(volatile unsigned long *)0x90000050)
- #define NFC_16BIT (1<<26)
- #define NFC_CS0 (1<<23)
- #define NFC_CS1 (1<<22)
- #define NFC_READY (1<<20)
-#define NFC_IREQ (*(volatile unsigned long *)0x90000060)
-#define NFC_RST (*(volatile unsigned long *)0x90000064)
-
-
-/* ECC controller */
-
-#define ECC_CTRL (*(volatile unsigned long *)0x80000900)
- #define ECC_DMA_REQ (1<<28)
- #define ECC_ENC (1<<27) /* MLC ECC3/4 */
- #define ECC_READY (1<<26)
- #define ECC_IEN (1<<25)
- #define ECC_MANUAL (1<<22)
- #define ECC_WCNT (1<<12) /* [21:12] */
- #define ECC_HOLD (1<<7)
- #define ECC_M4EN (1<<6)
- #define ECC_ZERO (1<<5)
- #define ECC_M3EN (1<<4)
- #define ECC_CNT_MASK (7<<1)
- #define ECC_CNT (1<<1)
- #define ECC_SLC (1<<0)
-
-#define ECC_BASE (*(volatile unsigned long *)0x80000904)
-#define ECC_MASK (*(volatile unsigned long *)0x80000908)
-#define ECC_CLR (*(volatile unsigned long *)0x8000090c)
-#define SLC_ECC0 (*(volatile unsigned long *)0x80000910)
-#define SLC_ECC1 (*(volatile unsigned long *)0x80000914)
-#define SLC_ECC2 (*(volatile unsigned long *)0x80000918)
-#define SLC_ECC3 (*(volatile unsigned long *)0x8000091c)
-#define SLC_ECC4 (*(volatile unsigned long *)0x80000920)
-#define SLC_ECC5 (*(volatile unsigned long *)0x80000924)
-#define SLC_ECC6 (*(volatile unsigned long *)0x80000928)
-#define SLC_ECC7 (*(volatile unsigned long *)0x8000092c)
-#define MLC_ECC0W (*(volatile unsigned long *)0x80000930)
-#define MLC_ECC1W (*(volatile unsigned long *)0x80000934)
-#define MLC_ECC2W (*(volatile unsigned long *)0x80000938)
-#define MLC_ECC0R (*(volatile unsigned long *)0x80000940)
-#define MLC_ECC1R (*(volatile unsigned long *)0x80000944)
-#define MLC_ECC2R (*(volatile unsigned long *)0x80000948)
-#define ECC_CORR_START (*(volatile unsigned long *)0x8000094c)
-#define ECC_ERRADDR(x) (*(volatile unsigned long *)(0x80000950+4*(x)))
-#define ECC_ERRDATA(x) (*(volatile unsigned long *)(0x80000960+4*(x)))
-#define ECC_ERR_NUM (*(volatile unsigned long *)0x80000970)
-
-
-/* Digital Audio Interface */
-#define DADI_L0 (*(volatile unsigned long *)0x80000000)
-#define DADI_R0 (*(volatile unsigned long *)0x80000004)
-#define DADI_L1 (*(volatile unsigned long *)0x80000008)
-#define DADI_R1 (*(volatile unsigned long *)0x8000000C)
-#define DADI_L2 (*(volatile unsigned long *)0x80000010)
-#define DADI_R2 (*(volatile unsigned long *)0x80000014)
-#define DADI_L3 (*(volatile unsigned long *)0x80000018)
-#define DADI_R3 (*(volatile unsigned long *)0x8000001c)
-
-#define DADO_L0 (*(volatile unsigned long *)0x80000020)
-#define DADO_R0 (*(volatile unsigned long *)0x80000024)
-#define DADO_L1 (*(volatile unsigned long *)0x80000028)
-#define DADO_R1 (*(volatile unsigned long *)0x8000002C)
-#define DADO_L2 (*(volatile unsigned long *)0x80000030)
-#define DADO_R2 (*(volatile unsigned long *)0x80000034)
-#define DADO_L3 (*(volatile unsigned long *)0x80000038)
-#define DADO_R3 (*(volatile unsigned long *)0x8000003c)
-
-#define DAMR (*(volatile unsigned long *)0x80000040)
-#define DAVC (*(volatile unsigned long *)0x80000044)
-
-#define DADI_L(x) (*(volatile unsigned long *)(0x80000000 + (x) * 8))
-#define DADI_R(x) (*(volatile unsigned long *)(0x80000004 + (x) * 8))
-#define DADO_L(x) (*(volatile unsigned long *)(0x80000020 + (x) * 8))
-#define DADO_R(x) (*(volatile unsigned long *)(0x80000024 + (x) * 8))
-
-/* USB 2.0 device system MMR base address */
-#define USB_BASE 0x90000b00
-
-#define USB_NUM_ENDPOINTS 3
-#define USB_DEVBSS_ATTR IBSS_ATTR
-
-/* Timer frequency */
-/* timers are based on XIN (12Mhz) */
-#define TIMER_FREQ (12000000)
-
-#endif
diff --git a/firmware/export/ucl_decompress.h b/firmware/export/ucl_decompress.h
new file mode 100644
index 0000000000..bea7564a94
--- /dev/null
+++ b/firmware/export/ucl_decompress.h
@@ -0,0 +1,32 @@
+/* Standalone UCL decompressor and uclpack-compatible unpacker,
+ * adapted for Rockbox from the libucl code.
+ *
+ * Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer
+ * All Rights Reserved.
+ *
+ * See firmware/common/ucl_decompress.c for full copyright notice
+ */
+#ifndef UCL_DECOMPRESS_H
+#define UCL_DECOMPRESS_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#define UCL_E_OK 0
+#define UCL_E_INPUT_OVERRUN 1
+#define UCL_E_OUTPUT_OVERRUN 2
+#define UCL_E_LOOKBEHIND_OVERRUN 3
+#define UCL_E_INPUT_NOT_CONSUMED 4
+#define UCL_E_BAD_MAGIC 5
+#define UCL_E_BAD_BLOCK_SIZE 6
+#define UCL_E_UNSUPPORTED_METHOD 7
+#define UCL_E_TRUNCATED 8
+#define UCL_E_CORRUPTED 9
+
+extern int ucl_nrv2e_decompress_8(const uint8_t* src, uint32_t src_len,
+ uint8_t* dst, uint32_t* dst_len);
+
+extern int ucl_unpack(const uint8_t* src, uint32_t src_len,
+ uint8_t* dst, uint32_t* dst_len);
+
+#endif /* UCL_DECOMPRESS_H */
diff --git a/firmware/export/usb_ch9.h b/firmware/export/usb_ch9.h
index c11775b893..659bcca101 100644
--- a/firmware/export/usb_ch9.h
+++ b/firmware/export/usb_ch9.h
@@ -391,6 +391,23 @@ struct usb_debug_descriptor {
} __attribute__((packed));
/*-------------------------------------------------------------------------*/
+
+/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
+struct usb_interface_assoc_descriptor {
+ uint8_t bLength;
+ uint8_t bDescriptorType;
+
+ uint8_t bFirstInterface;
+ uint8_t bInterfaceCount;
+ uint8_t bFunctionClass;
+ uint8_t bFunctionSubClass;
+ uint8_t bFunctionProtocol;
+ uint8_t iFunction;
+} __attribute__ ((packed));
+
+#define USB_DT_INTERFACE_ASSOCIATION_SIZE 8
+
+/*-------------------------------------------------------------------------*/
/* USB 2.0 defines three speeds, here's how Linux identifies them */
enum usb_device_speed {
diff --git a/firmware/export/x1000.h b/firmware/export/x1000.h
new file mode 100644
index 0000000000..102d4ec978
--- /dev/null
+++ b/firmware/export/x1000.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2021 Aidan MacDonald
+ *
+ * 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 __X1000_H__
+#define __X1000_H__
+
+#include "config.h"
+
+/* Frequency of external oscillator EXCLK */
+//#define X1000_EXCLK_FREQ 24000000
+
+/* Maximum CPU frequency that can be achieved on the target */
+//#define CPU_FREQ 1008000000
+
+/* Only 24 MHz and 26 MHz external oscillators are supported by the X1000 */
+#if X1000_EXCLK_FREQ == 24000000
+# define X1000_EXCLK_24MHZ
+#elif X1000_EXCLK_FREQ == 26000000
+# define X1000_EXCLK_26MHZ
+#else
+# error "Unsupported EXCLK freq"
+#endif
+
+/* On-chip TCSM (tightly coupled shared memory), aka IRAM */
+#define X1000_TCSM_BASE 0xf4000000
+#define X1000_TCSM_SIZE (16 * 1024)
+
+/* External SDRAM */
+#define X1000_SDRAM_BASE 0x80000000
+#define X1000_SDRAM_SIZE (MEMORYSIZE * 1024 * 1024)
+
+/* Memory definitions for Rockbox */
+#define X1000_IRAM_BASE X1000_SDRAM_BASE
+#define X1000_IRAM_SIZE (16 * 1024)
+#define X1000_IRAM_END (X1000_IRAM_BASE + X1000_IRAM_SIZE)
+#define X1000_DRAM_BASE X1000_IRAM_END
+#define X1000_DRAM_SIZE (X1000_SDRAM_SIZE - X1000_IRAM_SIZE)
+#define X1000_DRAM_END (X1000_DRAM_BASE + X1000_DRAM_SIZE)
+#define X1000_STACKSIZE 0x1e00
+#define X1000_IRQSTACKSIZE 0x300
+
+/* Convert kseg0 address to physical address or uncached address */
+#define PHYSADDR(x) ((unsigned long)(x) & 0x1fffffff)
+#define UNCACHEDADDR(x) (PHYSADDR(x) | 0xa0000000)
+
+/* Defines for usb-designware driver */
+#define OTGBASE 0xb3500000
+#define USB_NUM_ENDPOINTS 9
+
+/* CPU cache parameters */
+#define CACHEALIGN_BITS 5
+#define CACHE_SIZE (16 * 1024)
+
+#endif /* __X1000_H__ */
diff --git a/firmware/ifp_usb_serial.c b/firmware/ifp_usb_serial.c
deleted file mode 100644
index f7e3a51858..0000000000
--- a/firmware/ifp_usb_serial.c
+++ /dev/null
@@ -1,1121 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Tomasz Malesinski
- *
- * 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.
- *
- ****************************************************************************/
-
-/*
-#define LCD_DEBUG
-#define BUTTONS
-*/
-
-/* #include "config.h" */
-#include <stdlib.h>
-#include "pnx0101.h"
-#include "ifp_usb_serial.h"
-
-#ifdef BUTTONS
-#include "kernel.h"
-#include "button.h"
-#include "system.h"
-#endif
-
-#ifdef LCD_DEBUG
-#include "lcd.h"
-#endif
-
-
-#define ISP1582_BASE (0x24100000)
-#define ISP1582_ADDRESS (*(volatile unsigned char *)ISP1582_BASE)
-#define ISP1582_MODE (*(volatile unsigned short *)(ISP1582_BASE + 0xc))
-#define ISP1582_INTCONF (*(volatile unsigned char *)(ISP1582_BASE + 0x10))
-#define ISP1582_OTG (*(volatile unsigned char *)(ISP1582_BASE + 0x12))
-#define ISP1582_INTEN (*(volatile unsigned long *)(ISP1582_BASE + 0x14))
-
-#define ISP1582_EPINDEX (*(volatile unsigned char *)(ISP1582_BASE + 0x2c))
-#define ISP1582_CTRLFUN (*(volatile unsigned char *)(ISP1582_BASE + 0x28))
-#define ISP1582_DATA (*(volatile unsigned short *)(ISP1582_BASE + 0x20))
-#define ISP1582_BUFLEN (*(volatile unsigned short *)(ISP1582_BASE + 0x1c))
-#define ISP1582_BUFSTAT (*(volatile unsigned char *)(ISP1582_BASE + 0x1e))
-#define ISP1582_MAXPKSZ (*(volatile unsigned short *)(ISP1582_BASE + 0x04))
-#define ISP1582_EPTYPE (*(volatile unsigned short *)(ISP1582_BASE + 0x08))
-
-#define ISP1582_INT (*(volatile unsigned long *)(ISP1582_BASE + 0x18))
-#define ISP1582_CHIPID (*(volatile unsigned long *)(ISP1582_BASE + 0x70))
-#define ISP1582_FRAMENO (*(volatile unsigned short *)(ISP1582_BASE + 0x74))
-#define ISP1582_UNLOCK (*(volatile unsigned short *)(ISP1582_BASE + 0x7c))
-
-#define ISP1582_UNLOCK_CODE 0xaa37
-
-#define TYPE_BULK 2
-
-#define STATE_DEFAULT 0
-#define STATE_ADDRESS 1
-#define STATE_CONFIGURED 2
-
-#define N_ENDPOINTS 2
-
-struct usb_endpoint
-{
- unsigned char *out_buf;
- short out_len;
- short out_ptr;
- void (*out_done)(int, unsigned char *, int);
- unsigned char out_in_progress;
-
- unsigned char *in_buf;
- short in_min_len;
- short in_max_len;
- short in_ptr;
- void (*in_done)(int, unsigned char *, int);
- unsigned char in_ack;
-
- unsigned char halt[2];
- unsigned char enabled[2];
- short max_pkt_size[2];
-};
-
-static char usb_connect_state;
-
-static struct usb_endpoint endpoints[N_ENDPOINTS];
-
-static unsigned char setup_pkt_buf[8];
-static unsigned char setup_out_buf[8];
-static unsigned char usb_state;
-static unsigned char usb_remote_wakeup;
-
-#ifdef LCD_DEBUG
-static unsigned char int_count[32];
-
-static int log_pos_x = 0;
-static int log_pos_y = 3;
-#endif
-
-static void nop_f(void)
-{
-}
-
-#ifdef LCD_DEBUG
-static void log_char(char c)
-{
- char s[2];
-
- s[0] = c;
- s[1] = 0;
-
- lcd_puts(log_pos_x, log_pos_y, s);
- lcd_update();
- log_pos_x++;
- if (log_pos_x >= 16)
- {
- log_pos_x = 0;
- log_pos_y++;
- if (log_pos_y > 5)
- log_pos_y = 3;
- }
-}
-#else
-#define log_char(c)
-#endif
-
-#define SERIAL_BUF_SIZE 1024
-
-struct serial_fifo
-{
- unsigned char buf[SERIAL_BUF_SIZE];
- short head, tail;
-};
-
-static struct serial_fifo serial_in_fifo;
-static struct serial_fifo serial_out_fifo;
-static unsigned char serial_in_pkt[64];
-
-static unsigned char device_descriptor[18] = {
- 0x12, /* length */
- 0x01, /* descriptor type */
- 0x10, 0x01, /* USB version (1.1) */
- 0xff, 0xff, /* class and subclass */
- 0xff, /* protocol */
- 0x40, /* max packet size 0 */
- 0x02, 0x41, /* vendor (iRiver) */
- 0x07, 0xee, /* product (0xee07) */
- 0x01, 0x00, /* device version */
- 0x01, /* manufacturer string */
- 0x02, /* product string */
- 0x00, /* serial number string */
- 0x01 /* number of configurations */
-};
-
-static unsigned char cfg_descriptor[32] = {
- 0x09, /* length */
- 0x02, /* descriptor type */
- 0x20, 0x00, /* total length */
- 0x01, /* number of interfaces */
- 0x01, /* configuration value */
- 0x00, /* configuration string */
- 0x80, /* attributes (none) */
- 0x32, /* max power (100 mA) */
- /* interface descriptor */
- 0x09, /* length */
- 0x04, /* descriptor type */
- 0x00, /* interface number */
- 0x00, /* alternate setting */
- 0x02, /* number of endpoints */
- 0xff, /* interface class */
- 0xff, /* interface subclass */
- 0xff, /* interface protocol */
- 0x00, /* interface string */
- /* endpoint IN */
- 0x07, /* length */
- 0x05, /* descriptor type */
- 0x81, /* endpoint 1 IN */
- 0x02, /* attributes (bulk) */
- 0x40, 0x00, /* max packet size */
- 0x00, /* interval */
- /* endpoint OUT */
- 0x07, /* length */
- 0x05, /* descriptor type */
- 0x01, /* endpoint 1 IN */
- 0x02, /* attributes (bulk) */
- 0x40, 0x00, /* max packet size */
- 0x00 /* interval */
-};
-
-static unsigned char lang_descriptor[4] = {
- 0x04, /* length */
- 0x03, /* descriptor type */
- 0x09, 0x04 /* English (US) */
-};
-
-#define N_STRING_DESCRIPTORS 2
-
-static unsigned char string_descriptor_vendor[] = {
- 0x2e, 0x03,
- 'i', 0, 'R', 0, 'i', 0, 'v', 0, 'e', 0, 'r', 0, ' ', 0, 'L', 0,
- 't', 0, 'd', 0, ' ', 0, 'a', 0, 'n', 0, 'd', 0, ' ', 0, 'R', 0,
- 'o', 0, 'c', 0, 'k', 0, 'b', 0, 'o', 0, 'x', 0};
-
-static unsigned char string_descriptor_product[] = {
- 0x1c, 0x03,
- 'i', 0, 'R', 0, 'i', 0, 'v', 0, 'e', 0, 'r', 0, ' ', 0, 'i', 0,
- 'F', 0, 'P', 0, '7', 0, '0', 0, '0', 0};
-
-static unsigned char *string_descriptor[N_STRING_DESCRIPTORS] = {
- string_descriptor_vendor,
- string_descriptor_product
-};
-
-static inline int ep_index(int n, int dir)
-{
- return (n << 1) | dir;
-}
-
-static inline int epidx_dir(int idx)
-{
- return idx & 1;
-}
-
-static inline int epidx_n(int idx)
-{
- return idx >> 1;
-}
-
-int usb_connected(void)
-{
- return GPIO7_READ & 1;
-}
-
-static inline void usb_select_endpoint(int idx)
-{
- ISP1582_EPINDEX = idx;
-}
-
-static inline void usb_select_setup_endpoint(void)
-{
- ISP1582_EPINDEX = 0x20;
-}
-
-static void usb_setup_endpoint(int idx, int max_pkt_size, int type)
-{
- struct usb_endpoint *ep;
-
- usb_select_endpoint(idx);
- ISP1582_MAXPKSZ = max_pkt_size;
- /* |= is in the original firmware */
- ISP1582_EPTYPE |= 0x1c | type;
- /* clear buffer */
- ISP1582_CTRLFUN |= 0x10;
- ISP1582_INTEN |= (1 << (10 + idx));
-
- ep = &(endpoints[epidx_n(idx)]);
- ep->halt[epidx_dir(idx)] = 0;
- ep->enabled[epidx_dir(idx)] = 1;
- ep->out_in_progress = 0;
- ep->in_min_len = -1;
- ep->in_ack = 0;
- ep->max_pkt_size[epidx_dir(idx)] = max_pkt_size;
-}
-
-static void usb_disable_endpoint(int idx)
-{
- usb_select_endpoint(idx);
- ISP1582_EPTYPE &= 8;
- ISP1582_INTEN &= ~(1 << (10 + idx));
- endpoints[epidx_n(idx)].enabled[epidx_dir(idx)] = 1;
-}
-
-void usb_reconnect(void)
-{
- int i;
- ISP1582_MODE &= ~1; /* SOFTCT off */
- for (i = 0; i < 10000; i++)
- nop_f();
- ISP1582_MODE |= 1; /* SOFTCT on */
-}
-
-static void usb_cleanup(void)
-{
- ISP1582_MODE &= ~1; /* SOFTCT off */
-}
-
-static void usb_setup(int reset)
-{
- int i;
-
- for (i = 0; i < N_ENDPOINTS; i++)
- endpoints[i].enabled[0] = endpoints[i].enabled[1] = 0;
-
- ISP1582_UNLOCK = ISP1582_UNLOCK_CODE;
- if (!reset)
- ISP1582_MODE = 0x88; /* CLKAON | GLINTENA */
- ISP1582_INTCONF = 0x57;
- ISP1582_INTEN = 0xd39;
-
- ISP1582_ADDRESS = reset ? 0x80: 0;
-
- usb_setup_endpoint(ep_index(0, DIR_RX), 64, 0);
- usb_setup_endpoint(ep_index(0, DIR_TX), 64, 0);
-
- ISP1582_MODE |= 1; /* SOFTCT on */
-
- usb_state = STATE_DEFAULT;
- usb_remote_wakeup = 0;
-}
-
-static int usb_get_packet(unsigned char *buf, int max_len)
-{
- int len, i;
- len = ISP1582_BUFLEN;
-
- if (max_len < 0 || max_len > len)
- max_len = len;
-
- i = 0;
- while (i < len)
- {
- unsigned short d = ISP1582_DATA;
- if (i < max_len)
- buf[i] = d & 0xff;
- i++;
- if (i < max_len)
- buf[i] = (d >> 8) & 0xff;
- i++;
- }
- return max_len;
-}
-
-static void usb_receive(int n)
-{
- int len;
-
- if (endpoints[n].halt[DIR_RX]
- || !endpoints[n].enabled[DIR_RX]
- || endpoints[n].in_min_len < 0
- || !endpoints[n].in_ack)
- return;
-
- endpoints[n].in_ack = 0;
-
- usb_select_endpoint(ep_index(n, DIR_RX));
-
- len = usb_get_packet(endpoints[n].in_buf + endpoints[n].in_ptr,
- endpoints[n].in_max_len - endpoints[n].in_ptr);
- endpoints[n].in_ptr += len;
- if (endpoints[n].in_ptr >= endpoints[n].in_min_len) {
- endpoints[n].in_min_len = -1;
- if (endpoints[n].in_done)
- (*(endpoints[n].in_done))(n, endpoints[n].in_buf,
- endpoints[n].in_ptr);
- }
-}
-
-static int usb_out_buffer_full(int ep)
-{
- usb_select_endpoint(ep_index(ep, DIR_TX));
- if (ISP1582_EPTYPE & 4)
- return (ISP1582_BUFSTAT & 3) == 3;
- else
- return (ISP1582_BUFSTAT & 3) != 0;
-}
-
-static void usb_send(int n)
-{
- int max_pkt_size, len;
- int i;
- unsigned char *p;
-
-#ifdef LCD_DEBUG
- if (endpoints[n].halt[DIR_TX])
- log_char('H');
- if (!endpoints[n].out_in_progress)
- log_char('$');
-#endif
-
- if (endpoints[n].halt[DIR_TX]
- || !endpoints[n].enabled[DIR_TX]
- || !endpoints[n].out_in_progress)
- return;
-
- if (endpoints[n].out_ptr < 0)
- {
- endpoints[n].out_in_progress = 0;
- if (endpoints[n].out_done)
- (*(endpoints[n].out_done))(n, endpoints[n].out_buf,
- endpoints[n].out_len);
- return;
- }
-
- if (usb_out_buffer_full(n))
- {
- log_char('F');
- return;
- }
-
- usb_select_endpoint(ep_index(n, DIR_TX));
- max_pkt_size = endpoints[n].max_pkt_size[DIR_TX];
- len = endpoints[n].out_len - endpoints[n].out_ptr;
- if (len > max_pkt_size)
- len = max_pkt_size;
-
- log_char('0' + (len % 10));
- ISP1582_BUFLEN = len;
- p = endpoints[n].out_buf + endpoints[n].out_ptr;
- i = 0;
- while (len - i >= 2) {
- ISP1582_DATA = p[i] | (p[i + 1] << 8);
- i += 2;
- }
- if (i < len)
- ISP1582_DATA = p[i];
-
- endpoints[n].out_ptr += len;
-
-/*
- if (endpoints[n].out_ptr == endpoints[n].out_len
- && len < max_pkt_size)
-*/
- if (endpoints[n].out_ptr == endpoints[n].out_len)
- endpoints[n].out_ptr = -1;
-}
-
-static void usb_stall_endpoint(int idx)
-{
- usb_select_endpoint(idx);
- ISP1582_CTRLFUN |= 1;
- endpoints[epidx_n(idx)].halt[epidx_dir(idx)] = 1;
-}
-
-static void usb_unstall_endpoint(int idx)
-{
- usb_select_endpoint(idx);
- ISP1582_CTRLFUN &= ~1;
- ISP1582_EPTYPE &= ~8;
- ISP1582_EPTYPE |= 8;
- ISP1582_CTRLFUN |= 0x10;
- if (epidx_dir(idx) == DIR_TX)
- endpoints[epidx_n(idx)].out_in_progress = 0;
- else
- {
- endpoints[epidx_n(idx)].in_min_len = -1;
- endpoints[epidx_n(idx)].in_ack = 0;
- }
- endpoints[epidx_n(idx)].halt[epidx_dir(idx)] = 0;
-}
-
-static void usb_status_ack(int dir)
-{
- log_char(dir ? '@' : '#');
- usb_select_endpoint(ep_index(0, dir));
- ISP1582_CTRLFUN |= 2;
-}
-
-static void usb_set_address(int adr)
-{
- ISP1582_ADDRESS = adr | 0x80;
-}
-
-static void usb_data_stage_enable(int dir)
-{
- usb_select_endpoint(ep_index(0, dir));
- ISP1582_CTRLFUN |= 4;
-}
-
-static void usb_request_error(void)
-{
- usb_stall_endpoint(ep_index(0, DIR_TX));
- usb_stall_endpoint(ep_index(0, DIR_RX));
-}
-
-static void usb_receive_block(unsigned char *buf, int min_len,
- int max_len,
- void (*in_done)(int, unsigned char *, int),
- int ep)
-{
- endpoints[ep].in_done = in_done;
- endpoints[ep].in_buf = buf;
- endpoints[ep].in_max_len = max_len;
- endpoints[ep].in_min_len = min_len;
- endpoints[ep].in_ptr = 0;
- usb_receive(ep);
-}
-
-static void usb_send_block(unsigned char *buf, int len,
- void (*done)(int, unsigned char *, int),
- int ep)
-{
- endpoints[ep].out_done = done;
- endpoints[ep].out_buf = buf;
- endpoints[ep].out_len = len;
- endpoints[ep].out_ptr = 0;
- endpoints[ep].out_in_progress = 1;
- usb_send(ep);
-}
-
-static void out_send_status(int n, unsigned char *buf, int len)
-{
- (void)n;
- (void)buf;
- (void)len;
- usb_status_ack(DIR_RX);
-}
-
-static void usb_send_block_and_status(unsigned char *buf, int len, int ep)
-{
- usb_send_block(buf, len, out_send_status, ep);
-}
-
-static void usb_setup_set_address(int adr)
-{
- usb_set_address(adr);
- usb_state = adr ? STATE_ADDRESS : STATE_DEFAULT;
- usb_status_ack(DIR_TX);
-}
-
-static void usb_send_descriptor(unsigned char *device_descriptor,
- int descriptor_len, int buffer_len)
-{
- int len = descriptor_len < buffer_len ? descriptor_len : buffer_len;
- usb_send_block_and_status(device_descriptor, len, 0);
-}
-
-static void usb_setup_get_descriptor(int type, int index, int lang, int len)
-{
- (void)lang;
- usb_data_stage_enable(DIR_TX);
- switch (type)
- {
- case 1:
- if (index == 0)
- usb_send_descriptor(device_descriptor,
- sizeof(device_descriptor), len);
- else
- usb_request_error();
- break;
- case 2:
- if (index == 0)
- usb_send_descriptor(cfg_descriptor,
- sizeof(cfg_descriptor), len);
- else
- usb_request_error();
- break;
- case 3:
- if (index == 0)
- usb_send_descriptor(lang_descriptor,
- sizeof(lang_descriptor), len);
- else if (index <= N_STRING_DESCRIPTORS)
- usb_send_descriptor(string_descriptor[index - 1],
- string_descriptor[index - 1][0],
- len);
- else
- usb_request_error();
- break;
- default:
- usb_request_error();
- }
-}
-
-static void usb_setup_get_configuration(void)
-{
- setup_out_buf[0] = (usb_state == STATE_CONFIGURED) ? 1 : 0;
- usb_data_stage_enable(DIR_TX);
- usb_send_block_and_status(setup_out_buf, 1, 0);
-}
-
-static void usb_setup_interface(void)
-{
- usb_setup_endpoint(ep_index(1, DIR_RX), 64, TYPE_BULK);
- usb_setup_endpoint(ep_index(1, DIR_TX), 64, TYPE_BULK);
-}
-
-static void usb_setup_set_configuration(int value)
-{
- switch (value)
- {
- case 0:
- usb_disable_endpoint(ep_index(1, DIR_RX));
- usb_disable_endpoint(ep_index(1, DIR_TX));
- usb_state = STATE_ADDRESS;
- usb_status_ack(DIR_TX);
- break;
- case 1:
- usb_setup_interface();
- usb_state = STATE_CONFIGURED;
- usb_status_ack(DIR_TX);
- break;
- default:
- usb_request_error();
- }
-}
-
-static void usb_send_status(void)
-{
- usb_data_stage_enable(DIR_TX);
- usb_send_block_and_status(setup_out_buf, 2, 0);
-}
-
-static void usb_setup_get_device_status(void)
-{
- setup_out_buf[0] = (usb_remote_wakeup != 0) ? 2 : 0;
- setup_out_buf[1] = 0;
- usb_send_status();
-}
-
-static void usb_setup_clear_device_feature(int feature)
-{
- if (feature == 1) {
- usb_remote_wakeup = 0;
- usb_status_ack(DIR_TX);
- } else
- usb_request_error();
-}
-
-static void usb_setup_set_device_feature(int feature)
-{
- if (feature == 1) {
- usb_remote_wakeup = 1;
- usb_status_ack(DIR_TX);
- } else
- usb_request_error();
-}
-
-static void usb_setup_clear_endpoint_feature(int endpoint, int feature)
-{
- if (usb_state != STATE_CONFIGURED || feature != 0)
- usb_request_error();
- else if ((endpoint & 0xf) == 1)
- {
- usb_unstall_endpoint(ep_index(endpoint & 0xf, endpoint >> 7));
- usb_status_ack(DIR_TX);
- }
- else
- usb_request_error();
-}
-
-static void usb_setup_set_endpoint_feature(int endpoint, int feature)
-{
- if (usb_state != STATE_CONFIGURED || feature != 0)
- usb_request_error();
- else if ((endpoint & 0xf) == 1)
- {
- usb_stall_endpoint(ep_index(endpoint & 0xf, endpoint >> 7));
- usb_status_ack(DIR_TX);
- }
- else
- usb_request_error();
-}
-
-static void usb_setup_get_interface_status(int interface)
-{
- if (usb_state != STATE_CONFIGURED || interface != 0)
- usb_request_error();
- else
- {
- setup_out_buf[0] = setup_out_buf[1] = 0;
- usb_send_status();
- }
-}
-
-static void usb_setup_get_endpoint_status(int endpoint)
-{
- if ((usb_state == STATE_CONFIGURED && (endpoint & 0xf) <= 1)
- || (usb_state == STATE_ADDRESS && (endpoint & 0xf) == 0))
- {
- setup_out_buf[0] = endpoints[endpoint & 0xf].halt[endpoint >> 7];
- setup_out_buf[1] = 0;
- usb_send_status();
- }
- else
- usb_request_error();
-}
-
-static void usb_setup_get_interface(int interface)
-{
- if (usb_state != STATE_CONFIGURED || interface != 0)
- usb_request_error();
- else
- {
- setup_out_buf[0] = 0;
- usb_data_stage_enable(DIR_TX);
- usb_send_block_and_status(setup_out_buf, 1, 0);
- }
-}
-
-static void usb_setup_set_interface(int interface, int setting)
-{
- if (usb_state != STATE_CONFIGURED || interface != 0 || setting != 0)
- usb_request_error();
- else
- {
- usb_setup_interface();
- usb_status_ack(DIR_TX);
- }
-}
-
-static void usb_handle_setup_pkt(unsigned char *pkt)
-{
- switch ((pkt[0] << 8) | pkt[1])
- {
- case 0x0005:
- log_char('A');
- usb_setup_set_address(pkt[2]);
- break;<