A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Agptek Rocker: Initial commit

Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b

+2343 -74
+2
apps/SOURCES
··· 315 315 keymaps/keymap-ypr1.c 316 316 #elif CONFIG_KEYPAD == DX50_PAD 317 317 keymaps/keymap-dx50.c 318 + #elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD 319 + keymaps/keymap-agptekrocker.c 318 320 #endif
+8 -2
apps/bitmaps/native/SOURCES
··· 13 13 rockboxlogo.96x30x16.bmp 14 14 #elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2) 15 15 rockboxlogo.128x42x2.bmp 16 - #elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16) 16 + #elif (LCD_WIDTH == 128) && (LCD_DEPTH >= 16) 17 17 rockboxlogo.128x40x16.bmp 18 18 #elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16) 19 19 rockboxlogo.132x40x16.bmp ··· 40 40 #endif 41 41 42 42 /* The Sony NWZ linux bootloader needs icons to display a menu */ 43 - #if defined(BOOTLOADER) && defined(SONY_NWZ_LINUX) 43 + #if defined(BOOTLOADER) 44 + #if defined(SONY_NWZ_LINUX) 44 45 rockboxicon.130x130x16.bmp 45 46 toolsicon.130x130x16.bmp 47 + #elif defined(AGPTEK_ROCKER) 48 + hibyicon.70x70x16.bmp 49 + rockboxicon.70x70x16.bmp 50 + toolsicon.70x70x16.bmp 51 + #endif 46 52 #endif 47 53 48 54 #ifndef BOOTLOADER /* We don't need these for the bootloader */
apps/bitmaps/native/hibyicon.70x70x16.bmp

This is a binary file and will not be displayed.

apps/bitmaps/native/rockboxicon.70x70x16.bmp

This is a binary file and will not be displayed.

apps/bitmaps/native/toolsicon.70x70x16.bmp

This is a binary file and will not be displayed.

+254
apps/keymaps/keymap-agptekrocker.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + 21 + #include "config.h" 22 + #include "action.h" 23 + #include "button.h" 24 + #include "settings.h" 25 + 26 + /* {Action Code, Button code, Prereq button code } */ 27 + 28 + /* 29 + * The format of the list is as follows 30 + * { Action Code, Button code, Prereq button code } 31 + * if there's no need to check the previous button's value, use BUTTON_NONE 32 + * Insert LAST_ITEM_IN_LIST at the end of each mapping 33 + */ 34 + static const struct button_mapping button_context_standard[] = { 35 + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, 36 + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 37 + 38 + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, 39 + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 40 + 41 + 42 + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, 43 + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, 44 + 45 + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, 46 + 47 + { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, 48 + 49 + { ACTION_STD_MENU, BUTTON_POWER, BUTTON_NONE }, 50 + 51 + // ACTION_STD_QUICKSCREEN, 52 + // ACTION_STD_KEYLOCK 53 + // ACTION_STD_REC 54 + // ACTION_STD_HOTKEY 55 + 56 + // { ACTION_STD_QUICKSCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, 57 + 58 + LAST_ITEM_IN_LIST 59 + }; /* button_context_standard */ 60 + 61 + 62 + static const struct button_mapping button_context_wps[] = { 63 + // { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, 64 + { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, 65 + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 66 + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 67 + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, 68 + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, 69 + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, 70 + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, 71 + { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, 72 + { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE }, 73 + { ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, 74 + { ACTION_WPS_VOLUP, BUTTON_VOLUP, BUTTON_NONE }, 75 + { ACTION_WPS_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, 76 + // ACTION_WPS_PITCHSCREEN optional 77 + // ACTION_WPS_ID3SCREEN optional 78 + { ACTION_WPS_CONTEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, 79 + { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, // optional 80 + { ACTION_WPS_MENU, BUTTON_UP|BUTTON_REL, BUTTON_UP }, /*this should be the same as ACTION_STD_MENU */ 81 + // ACTION_WPS_VIEW_PLAYLIST 82 + // ACTION_WPS_LIST_BOOKMARKS,/* optional */ 83 + // ACTION_WPS_CREATE_BOOKMARK,/* optional */ 84 + 85 + { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE }, 86 + 87 + LAST_ITEM_IN_LIST 88 + }; /* button_context_wps */ 89 + 90 + static const struct button_mapping button_context_settings[] = { 91 + { ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE }, 92 + { ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, 93 + // ACTION_SETTINGS_INCBIGSTEP 94 + { ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE }, 95 + { ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, 96 + // ACTION_SETTINGS_DECBIGSTEP 97 + { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, 98 + // ACTION_SETTINGS_SET, /* Used by touchscreen targets */ 99 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), 100 + }; /* button_context_settings */ 101 + 102 + static const struct button_mapping button_context_list[] = { 103 + // ACTION_LISTTREE_PGUP,/* optional */ 104 + // ACTION_LISTTREE_PGDOWN,/* optional */ 105 + 106 + #ifdef HAVE_VOLUME_IN_LIST 107 + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, 108 + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, 109 + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, 110 + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 111 + #endif 112 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 113 + }; /* button_context_list */ 114 + 115 + static const struct button_mapping button_context_tree[] = { 116 + // ACTION_TREE_ROOT_INIT, 117 + // ACTION_TREE_PGLEFT,/* optional */ 118 + // ACTION_TREE_PGRIGHT,/* optional */ 119 + // ACTION_TREE_STOP, 120 + // ACTION_TREE_WPS, 121 + // ACTION_TREE_HOTKEY, 122 + 123 + { ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP }, 124 + // { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, 125 + // { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC }, 126 + 127 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), 128 + }; /* button_context_tree */ 129 + 130 + static const struct button_mapping button_context_yesno[] = { 131 + { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, 132 + 133 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), 134 + }; /* button_context_settings_yesno */ 135 + 136 + static const struct button_mapping button_context_quickscreen[] = { 137 + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, 138 + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 139 + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, 140 + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 141 + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, 142 + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 143 + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, 144 + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 145 + 146 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), 147 + }; /* button_context_quickscreen */ 148 + 149 + static const struct button_mapping button_context_settings_time[] = { 150 + { ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, 151 + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 152 + { ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, 153 + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 154 + 155 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) 156 + }; /* button_context_settings_time */ 157 + 158 + static const struct button_mapping button_context_pitchscreen[] = { 159 + { ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE }, 160 + { ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, 161 + { ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE }, 162 + { ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, 163 + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, 164 + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, 165 + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 166 + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, 167 + // { ACTION_PS_TOGGLE_MODE, BUTTON_REC, BUTTON_NONE }, 168 + { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, 169 + { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, 170 + { ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE }, 171 + { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 172 + { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE }, 173 + 174 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), 175 + }; /* button_context_pitchscreen */ 176 + 177 + static const struct button_mapping button_context_keyboard[] = { 178 + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, 179 + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 180 + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 181 + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 182 + 183 + { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE }, 184 + { ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 185 + { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE }, 186 + { ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 187 + 188 + { ACTION_KBD_UP, BUTTON_VOLDOWN, BUTTON_NONE }, 189 + { ACTION_KBD_UP, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE }, 190 + { ACTION_KBD_DOWN, BUTTON_VOLUP, BUTTON_NONE }, 191 + { ACTION_KBD_DOWN, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, 192 + { ACTION_KBD_PAGE_FLIP, BUTTON_POWER|BUTTON_SELECT, BUTTON_POWER }, 193 + { ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE }, 194 + { ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 195 + { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, 196 + { ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE }, 197 + { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE }, 198 + { ACTION_KBD_MORSE_INPUT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, 199 + { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, 200 + 201 + LAST_ITEM_IN_LIST 202 + }; /* button_context_keyboard */ 203 + 204 + static const struct button_mapping button_context_bmark[] = { 205 + { ACTION_BMS_DELETE, BUTTON_LEFT, BUTTON_NONE }, 206 + 207 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), 208 + }; /* button_context_bmark */ 209 + 210 + /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ 211 + const struct button_mapping* get_context_mapping(int context) 212 + { 213 + switch (context) 214 + { 215 + case CONTEXT_STD: 216 + return button_context_standard; 217 + 218 + case CONTEXT_WPS: 219 + return button_context_wps; 220 + 221 + case CONTEXT_LIST: 222 + return button_context_list; 223 + 224 + case CONTEXT_CUSTOM|CONTEXT_TREE: 225 + return button_context_tree; 226 + 227 + case CONTEXT_SETTINGS: 228 + case CONTEXT_SETTINGS_EQ: 229 + return button_context_settings; 230 + 231 + case CONTEXT_SETTINGS_TIME: 232 + return button_context_settings_time; 233 + 234 + case CONTEXT_YESNOSCREEN: 235 + return button_context_yesno; 236 + 237 + case CONTEXT_BOOKMARKSCREEN: 238 + return button_context_bmark; 239 + 240 + case CONTEXT_QUICKSCREEN: 241 + return button_context_quickscreen; 242 + 243 + case CONTEXT_PITCHSCREEN: 244 + return button_context_pitchscreen; 245 + 246 + case CONTEXT_KEYBOARD: 247 + case CONTEXT_MORSE_INPUT: 248 + return button_context_keyboard; 249 + 250 + default: 251 + return button_context_standard; 252 + } 253 + return button_context_standard; 254 + }
+1 -1
apps/recorder/bmp.c
··· 670 670 /* Check if this fits the buffer */ 671 671 if (totalsize > maxsize) { 672 672 DEBUGF("read_bmp_fd: Bitmap too large for buffer: " 673 - "%d bytes.\n", totalsize); 673 + "%d bytes (%d max).\n", totalsize, maxsize); 674 674 return -6; 675 675 } 676 676
+2
bootloader/SOURCES
··· 73 73 mpio_hd200_hd300.c 74 74 #elif defined(SONY_NWZ_LINUX) 75 75 nwz_linux.c 76 + #elif defined(AGPTEK_ROCKER) 77 + rocker_linux.c 76 78 #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \ 77 79 || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \ 78 80 || defined(IHIFI760) || defined(IHIFI960)
+546
bootloader/rocker_linux.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * 10 + * Copyright (C) 2016 by Amaury Pouly 11 + * 2018 by Marcin Bukat 12 + * 13 + * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing 14 + * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach 15 + * 16 + * This program is free software; you can redistribute it and/or 17 + * modify it under the terms of the GNU General Public License 18 + * as published by the Free Software Foundation; either version 2 19 + * of the License, or (at your option) any later version. 20 + * 21 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 22 + * KIND, either express or implied. 23 + * 24 + ****************************************************************************/ 25 + 26 + #include "system.h" 27 + #include "lcd.h" 28 + #include "backlight.h" 29 + #include "button-target.h" 30 + #include "button.h" 31 + #include "../kernel/kernel-internal.h" 32 + #include "core_alloc.h" 33 + #include "filesystem-app.h" 34 + #include "lcd.h" 35 + #include "font.h" 36 + #include "power.h" 37 + #include <string.h> 38 + #include <stdlib.h> 39 + #include <unistd.h> 40 + #include <sys/types.h> 41 + #include <sys/stat.h> 42 + #include <fcntl.h> 43 + #include <dirent.h> 44 + #include <sys/wait.h> 45 + #include <stdarg.h> 46 + #include "version.h" 47 + 48 + /* all images must have the following size */ 49 + #define ICON_WIDTH 70 50 + #define ICON_HEIGHT 70 51 + 52 + /* images */ 53 + #include "bitmaps/rockboxicon.h" 54 + #include "bitmaps/hibyicon.h" 55 + #include "bitmaps/toolsicon.h" 56 + 57 + /* don't issue an error when parsing the file for dependencies */ 58 + #if defined(BMPWIDTH_rockboxicon) && (BMPWIDTH_rockboxicon != ICON_WIDTH || \ 59 + BMPHEIGHT_rockboxicon != ICON_HEIGHT) 60 + #error rockboxicon has the wrong resolution 61 + #endif 62 + #if defined(BMPWIDTH_hibyicon) && (BMPWIDTH_hibyicon != ICON_WIDTH || \ 63 + BMPHEIGHT_hibyicon != ICON_HEIGHT) 64 + #error hibyicon has the wrong resolution 65 + #endif 66 + #if defined(BMPWIDTH_toolsicon) && (BMPWIDTH_toolsicon != ICON_WIDTH || \ 67 + BMPHEIGHT_toolsicon != ICON_HEIGHT) 68 + #error toolsicon has the wrong resolution 69 + #endif 70 + 71 + #ifndef BUTTON_REW 72 + #define BUTTON_REW BUTTON_LEFT 73 + #endif 74 + #ifndef BUTTON_FF 75 + #define BUTTON_FF BUTTON_RIGHT 76 + #endif 77 + #ifndef BUTTON_PLAY 78 + #define BUTTON_PLAY BUTTON_SELECT 79 + #endif 80 + 81 + /* return icon y position (x is always centered) */ 82 + static int get_icon_y(void) 83 + { 84 + int h; 85 + lcd_getstringsize("X", NULL, &h); 86 + return ((LCD_HEIGHT - ICON_HEIGHT)/2) - h; 87 + } 88 + 89 + /* Important Note: this bootloader is carefully written so that in case of 90 + * error, the OF is run. This seems like the safest option since the OF is 91 + * always there and might do magic things. */ 92 + 93 + enum boot_mode 94 + { 95 + BOOT_ROCKBOX, 96 + BOOT_TOOLS, 97 + BOOT_OF, 98 + BOOT_COUNT, 99 + BOOT_USB, /* special */ 100 + BOOT_STOP, /* power down/suspend */ 101 + }; 102 + 103 + static void display_text_center(int y, const char *text) 104 + { 105 + int width; 106 + lcd_getstringsize(text, &width, NULL); 107 + lcd_putsxy(LCD_WIDTH / 2 - width / 2, y, text); 108 + } 109 + 110 + static void display_text_centerf(int y, const char *format, ...) 111 + { 112 + char buf[1024]; 113 + va_list ap; 114 + va_start(ap, format); 115 + 116 + vsnprintf(buf, sizeof(buf), format, ap); 117 + display_text_center(y, buf); 118 + } 119 + 120 + /* get timeout before taking action if the user doesn't touch the device */ 121 + static int get_inactivity_tmo(void) 122 + { 123 + #if defined(HAS_BUTTON_HOLD) 124 + if(button_hold()) 125 + return 5 * HZ; /* Inactivity timeout when on hold */ 126 + else 127 + #endif 128 + return 10 * HZ; /* Inactivity timeout when not on hold */ 129 + } 130 + 131 + /* return action on idle timeout */ 132 + static enum boot_mode inactivity_action(enum boot_mode cur_selection) 133 + { 134 + #if defined(HAS_BUTTON_HOLD) 135 + if(button_hold()) 136 + return BOOT_STOP; /* power down/suspend */ 137 + else 138 + #endif 139 + return cur_selection; /* return last choice */ 140 + } 141 + 142 + /* we store the boot mode in a file in /tmp so we can reload it between 'boots' 143 + * (since the mostly suspends instead of powering down) */ 144 + static enum boot_mode load_boot_mode(enum boot_mode mode) 145 + { 146 + int fd = open("/data/rb_bl_mode.txt", O_RDONLY); 147 + if(fd >= 0) 148 + { 149 + read(fd, &mode, sizeof(mode)); 150 + close(fd); 151 + } 152 + return mode; 153 + } 154 + 155 + static void save_boot_mode(enum boot_mode mode) 156 + { 157 + int fd = open("/data/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC); 158 + if(fd >= 0) 159 + { 160 + write(fd, &mode, sizeof(mode)); 161 + close(fd); 162 + } 163 + } 164 + 165 + static enum boot_mode get_boot_mode(void) 166 + { 167 + /* load previous mode, or start with rockbox if none */ 168 + enum boot_mode init_mode = load_boot_mode(BOOT_ROCKBOX); 169 + /* wait for user action */ 170 + enum boot_mode mode = init_mode; 171 + int last_activity = current_tick; 172 + #if defined(HAS_BUTTON_HOLD) 173 + bool hold_status = button_hold(); 174 + #endif 175 + while(true) 176 + { 177 + /* on usb detect, return to usb 178 + * FIXME this is a hack, we need proper usb detection */ 179 + if(power_input_status() & POWER_INPUT_USB_CHARGER) 180 + { 181 + /* save last choice */ 182 + save_boot_mode(mode); 183 + return BOOT_USB; 184 + } 185 + /* inactivity detection */ 186 + int timeout = last_activity + get_inactivity_tmo(); 187 + if(TIME_AFTER(current_tick, timeout)) 188 + { 189 + /* save last choice */ 190 + save_boot_mode(mode); 191 + return inactivity_action(mode); 192 + } 193 + /* redraw */ 194 + lcd_clear_display(); 195 + /* display top text */ 196 + #if defined(HAS_BUTTON_HOLD) 197 + if(button_hold()) 198 + { 199 + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); 200 + display_text_center(0, "ON HOLD!"); 201 + } 202 + else 203 + #endif 204 + { 205 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 206 + display_text_center(0, "SELECT PLAYER"); 207 + } 208 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 209 + /* display icon */ 210 + const struct bitmap *icon = (mode == BOOT_OF) ? &bm_hibyicon : 211 + (mode == BOOT_ROCKBOX) ? &bm_rockboxicon : &bm_toolsicon; 212 + lcd_bmp(icon, (LCD_WIDTH - ICON_WIDTH) / 2, get_icon_y()); 213 + /* display bottom description */ 214 + const char *desc = (mode == BOOT_OF) ? "HIBY PLAYER" : 215 + (mode == BOOT_ROCKBOX) ? "ROCKBOX" : "TOOLS"; 216 + 217 + int desc_height; 218 + lcd_getstringsize(desc, NULL, &desc_height); 219 + display_text_center(LCD_HEIGHT - 3*desc_height, desc); 220 + 221 + /* display arrows */ 222 + int arrow_width, arrow_height; 223 + lcd_getstringsize("<", &arrow_width, &arrow_height); 224 + int arrow_y = get_icon_y() + ICON_HEIGHT / 2 - arrow_height / 2; 225 + lcd_putsxy(arrow_width / 2, arrow_y, "<"); 226 + lcd_putsxy(LCD_WIDTH - 3 * arrow_width / 2, arrow_y, ">"); 227 + 228 + lcd_set_foreground(LCD_RGBPACK(0, 255, 0)); 229 + display_text_centerf(LCD_HEIGHT - arrow_height * 3 / 2, "timeout in %d sec", 230 + (timeout - current_tick + HZ - 1) / HZ); 231 + 232 + lcd_update(); 233 + 234 + /* wait for a key */ 235 + int btn = button_get_w_tmo(HZ / 10); 236 + 237 + #if defined(HAS_BUTTON_HOLD) 238 + /* record action, changing HOLD counts as action */ 239 + if(btn & BUTTON_MAIN || hold_status != button_hold()) 240 + last_activity = current_tick; 241 + 242 + hold_status = button_hold(); 243 + #else 244 + if(btn & BUTTON_MAIN) 245 + last_activity = current_tick; 246 + #endif 247 + /* ignore release, allow repeat */ 248 + if(btn & BUTTON_REL) 249 + continue; 250 + if(btn & BUTTON_REPEAT) 251 + btn &= ~BUTTON_REPEAT; 252 + /* play -> stop loop and return mode */ 253 + if(btn == BUTTON_PLAY) 254 + break; 255 + /* left/right/up/down: change mode */ 256 + if(btn == BUTTON_LEFT || btn == BUTTON_DOWN || btn == BUTTON_REW) 257 + mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT; 258 + if(btn == BUTTON_RIGHT || btn == BUTTON_UP || btn == BUTTON_FF) 259 + mode = (mode + 1) % BOOT_COUNT; 260 + } 261 + 262 + /* save mode */ 263 + save_boot_mode(mode); 264 + return mode; 265 + } 266 + 267 + void error_screen(const char *msg) 268 + { 269 + lcd_clear_display(); 270 + lcd_putsf(0, 0, msg); 271 + lcd_update(); 272 + } 273 + 274 + int choice_screen(const char *title, bool center, int nr_choices, const char *choices[]) 275 + { 276 + int choice = 0; 277 + int max_len = 0; 278 + int h; 279 + lcd_getstringsize("x", NULL, &h); 280 + for(int i = 0; i < nr_choices; i++) 281 + { 282 + int len = strlen(choices[i]); 283 + if(len > max_len) 284 + max_len = len; 285 + } 286 + char *buf = malloc(max_len + 10); 287 + int top_y = 2 * h; 288 + int nr_lines = (LCD_HEIGHT - top_y) / h; 289 + while(true) 290 + { 291 + /* make sure choice is visible */ 292 + int offset = choice - nr_lines / 2; 293 + if(offset < 0) 294 + offset = 0; 295 + lcd_clear_display(); 296 + /* display top text */ 297 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 298 + display_text_center(0, title); 299 + int line = 0; 300 + for(int i = 0; i < nr_choices && line < nr_lines; i++) 301 + { 302 + if(i < offset) 303 + continue; 304 + if(i == choice) 305 + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); 306 + else 307 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 308 + sprintf(buf, "%s", choices[i]); 309 + if(center) 310 + display_text_center(top_y + h * line, buf); 311 + else 312 + lcd_putsxy(0, top_y + h * line, buf); 313 + line++; 314 + } 315 + 316 + lcd_update(); 317 + 318 + /* wait for a key */ 319 + int btn = button_get_w_tmo(HZ / 10); 320 + /* ignore release, allow repeat */ 321 + if(btn & BUTTON_REL) 322 + continue; 323 + if(btn & BUTTON_REPEAT) 324 + btn &= ~BUTTON_REPEAT; 325 + /* play -> stop loop and return mode */ 326 + if(btn == BUTTON_PLAY || btn == BUTTON_LEFT) 327 + { 328 + free(buf); 329 + return btn == BUTTON_PLAY ? choice : -1; 330 + } 331 + /* left/right/up/down: change mode */ 332 + if(btn == BUTTON_UP) 333 + choice = (choice + nr_choices - 1) % nr_choices; 334 + if(btn == BUTTON_DOWN) 335 + choice = (choice + 1) % nr_choices; 336 + } 337 + } 338 + 339 + void run_file(const char *name) 340 + { 341 + char *dirname = "/mnt/sd_0/"; 342 + char *buf = malloc(strlen(dirname) + strlen(name) + 1); 343 + sprintf(buf, "%s%s", dirname, name); 344 + 345 + lcd_clear_display(); 346 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 347 + lcd_putsf(0, 0, "Running %s", name); 348 + lcd_update(); 349 + 350 + pid_t pid = fork(); 351 + if(pid == 0) 352 + { 353 + execlp("sh", "sh", buf, NULL); 354 + _exit(42); 355 + } 356 + int status; 357 + waitpid(pid, &status, 0); 358 + if(WIFEXITED(status)) 359 + { 360 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 361 + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); 362 + } 363 + else 364 + { 365 + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); 366 + lcd_putsf(0, 1, "an error occured: %x", status); 367 + } 368 + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); 369 + lcd_putsf(0, 3, "Press any key or wait"); 370 + lcd_update(); 371 + /* wait a small time */ 372 + sleep(HZ); 373 + /* ignore event */ 374 + while(button_get(false) != 0) {} 375 + /* wait for any key or timeout */ 376 + button_get_w_tmo(4 * HZ); 377 + } 378 + 379 + void run_script_menu(void) 380 + { 381 + const char **entries = NULL; 382 + int nr_entries = 0; 383 + DIR *dir = opendir("/mnt/sd_0"); 384 + struct dirent *ent; 385 + while((ent = readdir(dir))) 386 + { 387 + if(ent->d_type != DT_REG) 388 + continue; 389 + entries = realloc(entries, (nr_entries + 1) * sizeof(const char *)); 390 + entries[nr_entries++] = strdup(ent->d_name); 391 + } 392 + closedir(dir); 393 + int idx = choice_screen("RUN SCRIPT", false, nr_entries, entries); 394 + if(idx >= 0) 395 + run_file(entries[idx]); 396 + for(int i = 0; i < nr_entries; i++) 397 + free((char *)entries[i]); 398 + free(entries); 399 + } 400 + 401 + static void adb(int start) 402 + { 403 + pid_t pid = fork(); 404 + if(pid == 0) 405 + { 406 + execlp("/etc/init.d/K90adb", "K90adb", start ? "start" : "stop", NULL); 407 + _exit(42); 408 + } 409 + int status; 410 + waitpid(pid, &status, 0); 411 + #if 0 412 + if(WIFEXITED(status)) 413 + { 414 + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); 415 + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); 416 + } 417 + else 418 + { 419 + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); 420 + lcd_putsf(0, 1, "an error occured: %x", status); 421 + } 422 + #endif 423 + } 424 + 425 + static void tools_screen(void) 426 + { 427 + const char *choices[] = {"ADB start", "ADB stop", "Run script", "Restart", "Shutdown"}; 428 + int choice = choice_screen("TOOLS MENU", true, 5, choices); 429 + if(choice == 0) 430 + { 431 + /* run service menu */ 432 + printf("Starting ADB service...\n"); 433 + fflush(stdout); 434 + adb(1); 435 + } 436 + else if(choice == 1) 437 + { 438 + printf("Stopping ADB service...\n"); 439 + fflush(stdout); 440 + adb(0); 441 + } 442 + else if(choice == 2) 443 + { 444 + run_script_menu(); 445 + } 446 + // else if(choice == 2) 447 + // nwz_power_restart(); 448 + else if(choice == 4) 449 + power_off(); 450 + } 451 + 452 + /* open log file */ 453 + static int open_log(void) 454 + { 455 + /* open regular log file */ 456 + int fd = open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND); 457 + /* get its size */ 458 + struct stat stat; 459 + if(fstat(fd, &stat) != 0) 460 + return fd; /* on error, don't do anything */ 461 + /* if file is too large, rename it and start a new log file */ 462 + if(stat.st_size < 1000000) 463 + return fd; 464 + close(fd); 465 + /* move file */ 466 + rename("/mnt/sd_0/rockbox.log", "/mnt_sd0/rockbox.log.1"); 467 + /* re-open the file, truncate in case the move was unsuccessful */ 468 + return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC); 469 + } 470 + 471 + int main(int argc, char **argv) 472 + { 473 + (void) argc; 474 + (void) argv; 475 + /* redirect stdout and stderr to have error messages logged somewhere on the 476 + * user partition */ 477 + int fd = open_log(); 478 + if(fd >= 0) 479 + { 480 + dup2(fd, fileno(stdout)); 481 + dup2(fd, fileno(stderr)); 482 + close(fd); 483 + } 484 + /* print version */ 485 + printf("Rockbox boot loader\n"); 486 + printf("Version: %s\n", rbversion); 487 + printf("%s\n", MODEL_NAME); 488 + 489 + system_init(); 490 + core_allocator_init(); 491 + kernel_init(); 492 + paths_init(); 493 + lcd_init(); 494 + font_init(); 495 + button_init(); 496 + backlight_init(); 497 + backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); 498 + // /* try to load the extra font we install on the device */ 499 + // int font_id = font_load("/usr/local/share/rockbox/bootloader.fnt"); 500 + // if(font_id >= 0) 501 + // lcd_setfont(font_id); 502 + 503 + /* run all tools menu */ 504 + while(true) 505 + { 506 + enum boot_mode mode = get_boot_mode(); 507 + if(mode == BOOT_USB || mode == BOOT_OF) 508 + { 509 + fflush(stdout); 510 + fflush(stderr); 511 + close(fileno(stdout)); 512 + close(fileno(stderr)); 513 + /* for now the only way we have to trigger USB mode it to run the OF */ 514 + /* boot OF */ 515 + execvp("/usr/bin/hiby_player", argv); 516 + error_screen("Cannot boot OF"); 517 + sleep(5 * HZ); 518 + } 519 + else if(mode == BOOT_TOOLS) 520 + { 521 + tools_screen(); 522 + } 523 + else if(mode == BOOT_ROCKBOX) 524 + { 525 + /* Rockbox expects /.rockbox to contain themes, rocks, etc, but we 526 + * cannot easily create this symlink because the root filesystem is 527 + * mounted read-only. Although we could remount it read-write temporarily, 528 + * this is neededlessly complicated and we defer this job to the dualboot 529 + * install script */ 530 + fflush(stdout); 531 + execl("/mnt/sd_0/.rockbox/rockbox.rocker", "rockbox.rocker", NULL); 532 + printf("execvp failed: %s\n", strerror(errno)); 533 + /* fallback to OF in case of failure */ 534 + error_screen("Cannot boot Rockbox"); 535 + sleep(5 * HZ); 536 + } 537 + else 538 + { 539 + printf("suspend\n"); 540 + // nwz_power_suspend(); 541 + } 542 + } 543 + /* if we reach this point, everything failed, so return an error so that 544 + * sysmgrd knows something is wrong */ 545 + return 1; 546 + }
+33 -18
firmware/SOURCES
··· 96 96 #endif 97 97 98 98 #if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR) 99 - target/hosted/backtrace-glibc.c 100 - target/hosted/kernel-unix.c 101 - target/hosted/filesystem-unix.c 102 - target/hosted/lc-unix.c 103 99 target/hosted/sonynwz/lcd-nwz.c 104 100 target/hosted/sonynwz/button-nwz.c 105 101 target/hosted/sonynwz/system-nwz.c ··· 111 107 target/hosted/sonynwz/debug-nwz.c 112 108 target/hosted/sonynwz/nvp-nwz.c 113 109 target/hosted/sonynwz/nwz-db.c 110 + #endif 111 + 112 + #if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) 113 + target/hosted/backtrace-glibc.c 114 + target/hosted/kernel-unix.c 115 + target/hosted/filesystem-unix.c 116 + target/hosted/lc-unix.c 117 + target/hosted/alsa-controls.c 118 + target/hosted/pcm-alsa.c 119 + target/hosted/agptek/sysfs.c 120 + target/hosted/agptek/backlight-agptek.c 121 + target/hosted/agptek/button-agptek.c 122 + target/hosted/agptek/debug-agptek.c 123 + target/hosted/agptek/lcd-agptek.c 124 + target/hosted/agptek/power-agptek.c 125 + target/hosted/agptek/powermgmt-agptek.c 126 + target/hosted/agptek/system-agptek.c 114 127 #endif 115 128 116 129 #if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) ··· 250 263 #else 251 264 drivers/lcd-16bit.c 252 265 #endif 253 - #elif LCD_DEPTH == 24 266 + #elif (LCD_DEPTH == 24) || (LCD_PIXELFORMAT == XRGB8888) 254 267 drivers/lcd-24bit.c 255 268 #endif /* LCD_DEPTH */ 256 269 common/diacritic.c ··· 470 483 drivers/audio/nwzlinux-codec.c 471 484 target/hosted/alsa-controls.c 472 485 target/hosted/pcm-alsa.c 486 + #elif defined(HAVE_ROCKER_CODEC) 487 + drivers/audio/rocker_codec.c 473 488 #elif defined(HAVE_SDL_AUDIO) 474 489 drivers/audio/sdl.c 475 490 #if CONFIG_CODEC == SWCODEC ··· 1618 1633 1619 1634 #ifdef IPOD_6G 1620 1635 target/arm/ipod/button-clickwheel.c 1621 - target/arm/s5l8702/ipod6g/storage_ata-6g.c 1622 - target/arm/s5l8702/ipod6g/backlight-6g.c 1623 - target/arm/s5l8702/ipod6g/powermgmt-6g.c 1624 - target/arm/s5l8702/ipod6g/power-6g.c 1636 + target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c 1637 + target/arm/s5l8702/ipod6g/backlight-ipod6g.c 1638 + target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c 1639 + target/arm/s5l8702/ipod6g/power-ipod6g.c 1625 1640 target/arm/s5l8702/kernel-s5l8702.c 1626 1641 target/arm/s5l8702/system-s5l8702.c 1627 1642 target/arm/s5l8702/timer-s5l8702.c ··· 1629 1644 target/arm/s5l8702/pl080.c 1630 1645 target/arm/s5l8702/dma-s5l8702.c 1631 1646 target/arm/s5l8702/clocking-s5l8702.c 1632 - target/arm/s5l8702/ipod6g/lcd-6g.c 1633 - target/arm/s5l8702/ipod6g/lcd-asm-6g.S 1634 - target/arm/s5l8702/ipod6g/piezo-6g.c 1647 + target/arm/s5l8702/ipod6g/lcd-ipod6g.c 1648 + target/arm/s5l8702/ipod6g/lcd-asm-ipod6g.S 1649 + target/arm/s5l8702/ipod6g/piezo-ipod6g.c 1635 1650 #if 0 //TODO 1636 1651 target/arm/s5l8702/postmortemstub.S 1637 1652 #endif 1638 - target/arm/s5l8702/ipod6g/pmu-6g.c 1639 - target/arm/s5l8702/ipod6g/rtc-6g.c 1640 - target/arm/s5l8702/ipod6g/adc-6g.c 1653 + target/arm/s5l8702/ipod6g/pmu-ipod6g.c 1654 + target/arm/s5l8702/ipod6g/rtc-ipod6g.c 1655 + target/arm/s5l8702/ipod6g/adc-ipod6g.c 1641 1656 #if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE) 1642 1657 target/arm/s5l8702/usb-s5l8702.c 1643 1658 #endif 1644 1659 #ifdef HAVE_SERIAL 1645 1660 target/arm/uc870x.c 1646 1661 target/arm/s5l8702/uart-s5l8702.c 1647 - target/arm/s5l8702/ipod6g/serial-6g.c 1662 + target/arm/s5l8702/ipod6g/serial-ipod6g.c 1648 1663 #endif 1649 1664 #ifndef BOOTLOADER 1650 1665 target/arm/s5l8702/debug-s5l8702.c 1651 1666 target/arm/s5l8702/pcm-s5l8702.c 1652 - target/arm/s5l8702/ipod6g/audio-6g.c 1653 - target/arm/s5l8702/ipod6g/cscodec-6g.c 1667 + target/arm/s5l8702/ipod6g/audio-ipod6g.c 1668 + target/arm/s5l8702/ipod6g/cscodec-ipod6g.c 1654 1669 #else 1655 1670 target/arm/s5l8702/spi-s5l8702.c 1656 1671 target/arm/s5l8702/crypto-s5l8702.c
+2 -2
firmware/asm/SOURCES
··· 15 15 defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ 16 16 defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ 17 17 defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ 18 - defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX)) && \ 18 + defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \ 19 19 !defined(SIMULATOR) 20 - #if LCD_DEPTH == 24 20 + #if LCD_DEPTH >= 24 21 21 lcd-as-memframe-24bit.c 22 22 #else 23 23 lcd-as-memframe.c
+36 -35
firmware/asm/mips/thread-mips32.c
··· 26 26 *--------------------------------------------------------------------------- 27 27 */ 28 28 29 - void start_thread(void); /* Provide C access to ASM label */ 30 - static void USED_ATTR _start_thread(void) 29 + static void USED_ATTR start_thread(void *addr) 31 30 { 32 - /* t1 = context */ 33 31 asm volatile ( 34 - "start_thread: \n" 35 32 ".set noreorder \n" 36 33 ".set noat \n" 37 - "lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */ 38 - "lw $29, 36($9) \n" /* Set initial sp(=$29) */ 39 - "jalr $8 \n" /* Start the thread */ 40 - "sw $0, 44($9) \n" /* Clear start address */ 34 + "lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */ 35 + "lw $sp, 40(%0) \n" /* Set initial sp(=$29) */ 36 + "jalr $t9 \n" /* Start the thread */ 37 + "sw $zero, 48(%0) \n" /* Clear start address */ 41 38 ".set at \n" 42 39 ".set reorder \n" 40 + : : "r" (addr) : "t9" 43 41 ); 44 42 thread_exit(); 45 43 } 44 + 46 45 47 46 /* Place context pointer in s0 slot, function pointer in s1 slot, and 48 47 * start_thread pointer in context_start */ ··· 60 59 asm volatile ( 61 60 ".set noreorder \n" 62 61 ".set noat \n" 63 - "sw $16, 0(%0) \n" /* s0 */ 64 - "sw $17, 4(%0) \n" /* s1 */ 65 - "sw $18, 8(%0) \n" /* s2 */ 66 - "sw $19, 12(%0) \n" /* s3 */ 67 - "sw $20, 16(%0) \n" /* s4 */ 68 - "sw $21, 20(%0) \n" /* s5 */ 69 - "sw $22, 24(%0) \n" /* s6 */ 70 - "sw $23, 28(%0) \n" /* s7 */ 71 - "sw $30, 32(%0) \n" /* fp */ 72 - "sw $29, 36(%0) \n" /* sp */ 73 - "sw $31, 40(%0) \n" /* ra */ 62 + "sw $s0, 0(%0) \n" /* s0 */ 63 + "sw $s1, 4(%0) \n" /* s1 */ 64 + "sw $s2, 8(%0) \n" /* s2 */ 65 + "sw $s3, 12(%0) \n" /* s3 */ 66 + "sw $s4, 16(%0) \n" /* s4 */ 67 + "sw $s5, 20(%0) \n" /* s5 */ 68 + "sw $s6, 24(%0) \n" /* s6 */ 69 + "sw $s7, 28(%0) \n" /* s7 */ 70 + "sw $gp, 32(%0) \n" /* gp */ 71 + "sw $fp, 36(%0) \n" /* fp */ 72 + "sw $sp, 40(%0) \n" /* sp */ 73 + "sw $ra, 44(%0) \n" /* ra */ 74 74 ".set at \n" 75 75 ".set reorder \n" 76 76 : : "r" (addr) ··· 86 86 asm volatile ( 87 87 ".set noat \n" 88 88 ".set noreorder \n" 89 - "lw $8, 44(%0) \n" /* Get start address ($8 = t0) */ 90 - "beqz $8, running \n" /* NULL -> already running */ 89 + "lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */ 90 + "beqz $t9, running \n" /* NULL -> already running */ 91 91 "nop \n" 92 - "jr $8 \n" 93 - "move $9, %0 \n" /* t1 = context */ 92 + "jr $t9 \n" 93 + "move $a0, %0 \n" /* a0 = context branch delay slot anyway */ 94 94 "running: \n" 95 - "lw $16, 0(%0) \n" /* s0 */ 96 - "lw $17, 4(%0) \n" /* s1 */ 97 - "lw $18, 8(%0) \n" /* s2 */ 98 - "lw $19, 12(%0) \n" /* s3 */ 99 - "lw $20, 16(%0) \n" /* s4 */ 100 - "lw $21, 20(%0) \n" /* s5 */ 101 - "lw $22, 24(%0) \n" /* s6 */ 102 - "lw $23, 28(%0) \n" /* s7 */ 103 - "lw $30, 32(%0) \n" /* fp */ 104 - "lw $29, 36(%0) \n" /* sp */ 105 - "lw $31, 40(%0) \n" /* ra */ 95 + "lw $s0, 0(%0) \n" /* s0 */ 96 + "lw $s1, 4(%0) \n" /* s1 */ 97 + "lw $s2, 8(%0) \n" /* s2 */ 98 + "lw $s3, 12(%0) \n" /* s3 */ 99 + "lw $s4, 16(%0) \n" /* s4 */ 100 + "lw $s5, 20(%0) \n" /* s5 */ 101 + "lw $s6, 24(%0) \n" /* s6 */ 102 + "lw $s7, 28(%0) \n" /* s7 */ 103 + "lw $gp, 32(%0) \n" /* gp */ 104 + "lw $fp, 36(%0) \n" /* fp */ 105 + "lw $sp, 40(%0) \n" /* sp */ 106 + "lw $ra, 44(%0) \n" /* ra */ 106 107 ".set at \n" 107 108 ".set reorder \n" 108 - : : "r" (addr) : "t0", "t1" 109 + : : "r" (addr) : "t9" 109 110 ); 110 111 } 111 112
+16 -1
firmware/asm/mips/thread.h
··· 19 19 * 20 20 ****************************************************************************/ 21 21 22 + /* index offset register 23 + * 0 0 $16 s0 24 + * 1 4 $17 s1 25 + * 2 8 $18 s2 26 + * 3 12 $19 s3 27 + * 4 16 $20 s4 28 + * 5 20 $21 s5 29 + * 6 24 $22 s6 30 + * 7 28 $23 s7 31 + * 8 32 $28 gp 32 + * 9 36 $30 s8 (s8) 33 + * 10 40 $29 sp 34 + * 11 44 $31 ra 35 + * 12 48 start 36 + */ 22 37 struct regs 23 38 { 24 - uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */ 39 + uint32_t r[10]; /* 0-32 - Registers s0-s7, gp, fp */ 25 40 uint32_t sp; /* 36 - Stack pointer */ 26 41 uint32_t ra; /* 40 - Return address */ 27 42 uint32_t start; /* 44 - Thread start address, or NULL when started */
+77
firmware/drivers/audio/rocker_codec.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * 11 + * Copyright (c) 2018 Marcin Bukat 12 + * 13 + * This program is free software; you can redistribute it and/or 14 + * modify it under the terms of the GNU General Public License 15 + * as published by the Free Software Foundation; either version 2 16 + * of the License, or (at your option) any later version. 17 + * 18 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 + * KIND, either express or implied. 20 + * 21 + ****************************************************************************/ 22 + 23 + #include "config.h" 24 + #include "audio.h" 25 + #include "audiohw.h" 26 + #include "system.h" 27 + #include "panic.h" 28 + #include "alsa-controls.h" 29 + 30 + static int fd_hw; 31 + 32 + static void hw_open(void) 33 + { 34 + fd_hw = open("/dev/snd/controlC0", O_RDWR); 35 + if(fd_hw < 0) 36 + panicf("Cannot open '/dev/snd/controlC0'"); 37 + } 38 + 39 + static void hw_close(void) 40 + { 41 + close(fd_hw); 42 + } 43 + 44 + void audiohw_preinit(void) 45 + { 46 + long int hp = 2; 47 + 48 + alsa_controls_init(); 49 + hw_open(); 50 + 51 + /* Output port switch set to Headphones */ 52 + alsa_controls_set_ints("Output Port Switch", 1, &hp); 53 + } 54 + 55 + void audiohw_postinit(void) 56 + { 57 + } 58 + 59 + void audiohw_close(void) 60 + { 61 + hw_close(); 62 + alsa_controls_close(); 63 + } 64 + 65 + void audiohw_set_frequency(int fsel) 66 + { 67 + (void)fsel; 68 + } 69 + 70 + void audiohw_set_volume(int vol_l, int vol_r) 71 + { 72 + long int vol_l_hw = -vol_l/5; 73 + long int vol_r_hw = -vol_r/5; 74 + 75 + alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw); 76 + alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw); 77 + }
+2 -1
firmware/drivers/lcd-24bit.c
··· 189 189 enum fill_opt fillopt = OPT_NONE; 190 190 fb_data *dst, *dst_end; 191 191 int len, step; 192 - fb_data bits = { 0, 0, 0 }; 192 + fb_data bits; // = { 0, 0, 0 }; 193 + memset(&bits, 0, sizeof(fb_data)); 193 194 194 195 /******************** In viewport clipping **********************/ 195 196 /* nothing to draw? */
+2
firmware/export/audiohw.h
··· 216 216 #include "codec-dx50.h" 217 217 #elif defined(DX90) 218 218 #include "codec-dx90.h" 219 + #elif defined(HAVE_ROCKER_CODEC) 220 + #include "rocker_codec.h" 219 221 #endif 220 222 221 223 /* convert caps into defines */
+5
firmware/export/config.h
··· 166 166 #define SAMSUNG_YH92X_PAD 62 167 167 #define DX50_PAD 63 168 168 #define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */ 169 + #define AGPTEK_ROCKER_PAD 65 169 170 170 171 /* CONFIG_REMOTE_KEYPAD */ 171 172 #define H100_REMOTE 1 ··· 279 280 #define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */ 280 281 #define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */ 281 282 #define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */ 283 + #define LCD_INGENIC_LINUX 64 282 284 283 285 /* LCD_PIXELFORMAT */ 284 286 #define HORIZONTAL_PACKING 1 ··· 288 290 #define RGB565 565 289 291 #define RGB565SWAPPED 3553 290 292 #define RGB888 888 293 + #define XRGB8888 8888 291 294 292 295 /* LCD_STRIDEFORMAT */ 293 296 #define VERTICAL_STRIDE 1 ··· 601 604 #include "config/sonynwzs750.h" 602 605 #elif defined(SONY_NWZE350) 603 606 #include "config/sonynwze350.h" 607 + #elif defined(AGPTEK_ROCKER) 608 + #include "config/agptekrocker.h" 604 609 #else 605 610 /* no known platform */ 606 611 #endif
+119
firmware/export/config/agptekrocker.h
··· 1 + /* 2 + * This config file is for the Agptek Rocket 3 + */ 4 + 5 + /* For Rolo and boot loader */ 6 + #define MODEL_NUMBER 103//??? 7 + 8 + #define MODEL_NAME "Agptek Rocker" 9 + 10 + /* LCD dimensions */ 11 + #define LCD_WIDTH 128 12 + #define LCD_HEIGHT 160 13 + /* sqrt(128^2 + 160^2) / 2 = 102. */ 14 + #define LCD_DPI 102 15 + 16 + #ifndef SIMULATOR 17 + #define CONFIG_PLATFORM (PLATFORM_HOSTED) 18 + #endif 19 + 20 + /* define this if you have a bitmap LCD display */ 21 + #define HAVE_LCD_BITMAP 22 + 23 + /* define this if you have a colour LCD */ 24 + #define HAVE_LCD_COLOR 25 + 26 + /* Define this if the LCD can shut down */ 27 + //#define HAVE_LCD_SHUTDOWN 28 + 29 + /* define this if you want album art for this target */ 30 + #define HAVE_ALBUMART 31 + 32 + /* define this to enable bitmap scaling */ 33 + #define HAVE_BMP_SCALING 34 + 35 + /* define this to enable JPEG decoding */ 36 + #define HAVE_JPEG 37 + 38 + /* define this if you have access to the quickscreen */ 39 + #define HAVE_QUICKSCREEN 40 + 41 + /* define this if you would like tagcache to build on this target */ 42 + #define HAVE_TAGCACHE 43 + 44 + #define LCD_DEPTH 32 45 + /* Check that but should not matter */ 46 + #define LCD_PIXELFORMAT XRGB8888 47 + 48 + #define HAVE_BACKLIGHT 49 + #define HAVE_BACKLIGHT_BRIGHTNESS 50 + 51 + /* Main LCD backlight brightness range and defaults: the backlight driver 52 + * has levels from 0 to 2555. But 0 is off so start at 1. 53 + */ 54 + #define MIN_BRIGHTNESS_SETTING 1 55 + #define MAX_BRIGHTNESS_SETTING 255 56 + #define DEFAULT_BRIGHTNESS_SETTING 70 57 + 58 + /* Which backlight fading type? */ 59 + #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING 60 + 61 + /* define this if you have a real-time clock */ 62 + #define CONFIG_RTC 0 63 + 64 + /* The number of bytes reserved for loadable codecs */ 65 + #define CODEC_SIZE 0x80000 66 + 67 + /* The number of bytes reserved for loadable plugins */ 68 + #define PLUGIN_BUFFER_SIZE 0x100000 69 + 70 + /* Define this if you do software codec */ 71 + #define CONFIG_CODEC SWCODEC 72 + #define HAVE_ROCKER_CODEC 73 + 74 + #define HAVE_HEADPHONE_DETECTION 75 + 76 + /* KeyPad configuration for plugins */ 77 + #define CONFIG_KEYPAD AGPTEK_ROCKER_PAD 78 + 79 + #ifndef SIMULATOR 80 + /* We have usb power and can detect usb but it is handled by Linux */ 81 + #define HAVE_USB_POWER 82 + #define USB_NONE 83 + #endif 84 + 85 + #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE 86 + 87 + /* Linux controlls charging, we can monitor */ 88 + #define CONFIG_CHARGING CHARGING_MONITOR 89 + 90 + /* define this if the hardware can be powered off while charging */ 91 + #define HAVE_POWEROFF_WHILE_CHARGING 92 + 93 + /* same dimensions as gigabeats */ 94 + #define CONFIG_LCD LCD_INGENIC_LINUX 95 + 96 + /* Define this if you have a software controlled poweroff */ 97 + #define HAVE_SW_POWEROFF 98 + 99 + /* Define this to the CPU frequency */ 100 + #define CPU_FREQ 532000000 101 + 102 + /* No special storage */ 103 + #define CONFIG_STORAGE (STORAGE_HOSTFS)//|STORAGE_SD) 104 + //#define MULTIDRIVE_DIR "/mnt/sd_0" 105 + //#define NUM_DRIVES 1 106 + //#define HAVE_HOTSWAP 107 + #define HAVE_STORAGE_FLUSH 108 + 109 + /* Battery */ 110 + #define BATTERY_TYPES_COUNT 1 111 + 112 + /* Audio codec */ 113 + #define HAVE_ROCKER_CODEC 114 + 115 + /* Battery */ 116 + #define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ 117 + #define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */ 118 + #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ 119 + #define BATTERY_CAPACITY_INC 0 /* capacity increment */
+4 -1
firmware/export/rbpaths.h
··· 41 41 #endif /* def __PCTOOL__ */ 42 42 43 43 #if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ 44 - defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) 44 + defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \ 45 + defined(AGPTEK_ROCKER) 45 46 46 47 #if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) 47 48 #define HOME_DIR "/mnt/media0" ··· 50 51 #elif defined(DX50) || defined(DX90) 51 52 /* Where to put save files like recordings, playlists, screen dumps ...*/ 52 53 #define HOME_DIR "/mnt/sdcard" 54 + #elif defined(AGPTEK_ROCKER) 55 + #define HOME_DIR "/mnt/sd_0" 53 56 #else 54 57 #define HOME_DIR "/" 55 58 #endif
+6
firmware/export/rocker_codec.h
··· 1 + #ifndef __ROCKER_CODEC__ 2 + #define __ROCKER_CODEC__ 3 + 4 + #define AUDIOHW_CAPS 0 5 + AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -1020, 0, -300, ) 6 + #endif
+1
firmware/include/bitarray.h
··· 44 44 /** Iterators **/ 45 45 #include "config.h" 46 46 #include <stdint.h> 47 + #include <limits.h> 47 48 48 49 #if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX 49 50 #define __BITARRAY_CTZ(wval) __builtin_ctz(wval)
+3
firmware/kernel/thread.c
··· 37 37 #endif 38 38 #include "core_alloc.h" 39 39 40 + #if (CONFIG_PLATFORM & PLATFORM_HOSTED) 41 + #include <errno.h> 42 + #endif 40 43 /* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */ 41 44 #ifdef DEBUG 42 45 #define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */
+2 -2
firmware/screendump.c
··· 234 234 #endif 235 235 } 236 236 while (dst < dst_end); 237 - #elif LCD_DEPTH == 24 238 - dst_end = dst + LCD_WIDTH*3; 237 + #elif LCD_DEPTH >= 24 238 + dst_end = dst + LCD_WIDTH*sizeof(fb_data); 239 239 src = FBADDR(0, y); 240 240 do 241 241 {
firmware/target/hosted/agptek/adc-target.h

This is a binary file and will not be displayed.

+64
firmware/target/hosted/agptek/backlight-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___ 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #include <sys/types.h> 21 + #include <sys/stat.h> 22 + #include <fcntl.h> 23 + #include <stdbool.h> 24 + #include <unistd.h> 25 + #include <string.h> 26 + #include <stdio.h> 27 + #include "config.h" 28 + #include "backlight-target.h" 29 + #include "sysfs.h" 30 + #include "panic.h" 31 + 32 + static const char * const sysfs_bl_brightness = 33 + "/sys/class/backlight/pwm-backlight.0/brightness"; 34 + 35 + static const char * const sysfs_bl_power = 36 + "/sys/class/backlight/pwm-backlight.0/bl_power"; 37 + 38 + bool backlight_hw_init(void) 39 + { 40 + backlight_hw_on(); 41 + backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); 42 + return true; 43 + } 44 + 45 + void backlight_hw_on(void) 46 + { 47 + sysfs_set_int(sysfs_bl_power, 0); 48 + } 49 + 50 + void backlight_hw_off(void) 51 + { 52 + sysfs_set_int(sysfs_bl_power, 1); 53 + } 54 + 55 + void backlight_hw_brightness(int brightness) 56 + { 57 + /* cap range, just in case */ 58 + if (brightness > MAX_BRIGHTNESS_SETTING) 59 + brightness = MAX_BRIGHTNESS_SETTING; 60 + if (brightness < MIN_BRIGHTNESS_SETTING) 61 + brightness = MIN_BRIGHTNESS_SETTING; 62 + 63 + sysfs_set_int(sysfs_bl_brightness, brightness); 64 + }
+36
firmware/target/hosted/agptek/backlight-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___ 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + 21 + #ifndef _BACKLIGHT_TARGET_H_ 22 + #define _BACKLIGHT_TARGET_H_ 23 + 24 + 25 + #include <stdbool.h> 26 + 27 + 28 + /* See backlight.c */ 29 + bool backlight_hw_init(void); 30 + void backlight_hw_on(void); 31 + void backlight_hw_off(void); 32 + void backlight_hw_brightness(int brightness); 33 + 34 + 35 + #endif 36 +
+149
firmware/target/hosted/agptek/button-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___ 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #include <poll.h> 21 + //#include <dir.h> 22 + #include <errno.h> 23 + #include <unistd.h> 24 + #include <sys/types.h> 25 + #include <linux/input.h> 26 + #include <fcntl.h> 27 + #include <string.h> 28 + #include <stdlib.h> 29 + 30 + #include "sysfs.h" 31 + #include "button.h" 32 + #include "button-target.h" 33 + #include "panic.h" 34 + 35 + #define NR_POLL_DESC 2 36 + static struct pollfd poll_fds[NR_POLL_DESC]; 37 + 38 + static int button_map(int keycode) 39 + { 40 + switch(keycode) 41 + { 42 + case KEY_LEFT: 43 + return BUTTON_LEFT; 44 + 45 + case KEY_RIGHT: 46 + return BUTTON_RIGHT; 47 + 48 + case KEY_UP: 49 + return BUTTON_UP; 50 + 51 + case KEY_DOWN: 52 + return BUTTON_DOWN; 53 + 54 + case KEY_PLAYPAUSE: 55 + return BUTTON_SELECT; 56 + 57 + case KEY_VOLUMEUP: 58 + return BUTTON_VOLUP; 59 + 60 + case KEY_VOLUMEDOWN: 61 + return BUTTON_VOLDOWN; 62 + 63 + case KEY_POWER: 64 + return BUTTON_POWER; 65 + 66 + default: 67 + return 0; 68 + } 69 + } 70 + 71 + void button_init_device(void) 72 + { 73 + const char * const input_devs[] = { 74 + "/dev/input/event0", 75 + "/dev/input/event1" 76 + }; 77 + 78 + for(int i = 0; i < NR_POLL_DESC; i++) 79 + { 80 + int fd = open(input_devs[i], O_RDWR); 81 + 82 + if(fd < 0) 83 + { 84 + panicf("Cannot open input device: %s\n", input_devs[i]); 85 + } 86 + 87 + poll_fds[i].fd = fd; 88 + poll_fds[i].events = POLLIN; 89 + poll_fds[i].revents = 0; 90 + } 91 + } 92 + 93 + int button_read_device(void) 94 + { 95 + static int button_bitmap = 0; 96 + struct input_event event; 97 + 98 + /* check if there are any events pending and process them */ 99 + while(poll(poll_fds, NR_POLL_DESC, 0)) 100 + { 101 + for(int i = 0; i < NR_POLL_DESC; i++) 102 + { 103 + /* read only if non-blocking */ 104 + if(poll_fds[i].revents & POLLIN) 105 + { 106 + int size = read(poll_fds[i].fd, &event, sizeof(event)); 107 + if(size == (int)sizeof(event)) 108 + { 109 + int keycode = event.code; 110 + /* event.value == 0x10000 means press 111 + * event.value == 0 means release 112 + */ 113 + bool press = event.value ? true : false; 114 + 115 + /* map linux event code to rockbox button bitmap */ 116 + if(press) 117 + { 118 + button_bitmap |= button_map(keycode); 119 + } 120 + else 121 + { 122 + button_bitmap &= ~button_map(keycode); 123 + } 124 + } 125 + } 126 + } 127 + } 128 + 129 + return button_bitmap; 130 + } 131 + 132 + bool headphones_inserted(void) 133 + { 134 + int status = 0; 135 + const char * const sysfs_hp_switch = "/sys/devices/switch/headset/status"; 136 + sysfs_get_int(sysfs_hp_switch, &status); 137 + 138 + return status ? true : false; 139 + } 140 + 141 + void button_close_device(void) 142 + { 143 + /* close descriptors */ 144 + for(int i = 0; i < NR_POLL_DESC; i++) 145 + { 146 + close(poll_fds[i].fd); 147 + } 148 + } 149 +
+43
firmware/target/hosted/agptek/button-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 by Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #ifndef _BUTTON_TARGET_H_ 21 + #define _BUTTON_TARGET_H_ 22 + 23 + #include <stdbool.h> 24 + #include "config.h" 25 + 26 + /* Main unit's buttons */ 27 + #define BUTTON_LEFT 0x00000001 28 + #define BUTTON_RIGHT 0x00000002 29 + #define BUTTON_UP 0x00000004 30 + #define BUTTON_DOWN 0x00000008 31 + #define BUTTON_SELECT 0x00000010 32 + #define BUTTON_VOLDOWN 0x00000020 33 + #define BUTTON_VOLUP 0x00000040 34 + #define BUTTON_POWER 0x00000080 35 + 36 + #define BUTTON_MAIN 0x000000ff 37 + 38 + /* Software power-off */ 39 + #define POWEROFF_BUTTON BUTTON_POWER 40 + #define POWEROFF_COUNT 10 41 + 42 + #endif /* _BUTTON_TARGET_H_ */ 43 +
+6
firmware/target/hosted/agptek/debug-agptek.c
··· 1 + #include <stdbool.h> 2 + 3 + bool debug_hw_info(void) 4 + { 5 + return false; 6 + }
+111
firmware/target/hosted/agptek/lcd-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * Copyright (C) 2016 Amaury Pouly 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + #include <stdlib.h> 23 + #include <unistd.h> 24 + #include <stdio.h> 25 + #include <linux/fb.h> 26 + #include <sys/mman.h> 27 + #include <sys/ioctl.h> 28 + #include <fcntl.h> 29 + #include "lcd.h" 30 + #include "lcd-target.h" 31 + #include "backlight-target.h" 32 + #include "panic.h" 33 + 34 + static int fd = -1; 35 + static struct fb_var_screeninfo vinfo; 36 + fb_data *framebuffer = 0; /* global variable, see lcd-target.h */ 37 + 38 + void lcd_init_device(void) 39 + { 40 + const char * const fb_dev = "/dev/fb0"; 41 + fd = open(fb_dev, O_RDWR); 42 + if(fd < 0) 43 + { 44 + panicf("Cannot open framebuffer: %s\n", fb_dev); 45 + } 46 + 47 + /* get fixed and variable information */ 48 + struct fb_fix_screeninfo finfo; 49 + if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) 50 + { 51 + panicf("Cannot read framebuffer fixed information"); 52 + } 53 + 54 + if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) 55 + { 56 + panicf("Cannot read framebuffer variable information"); 57 + } 58 + 59 + #if 0 60 + /* check resolution and framebuffer size */ 61 + if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH) 62 + { 63 + panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, 64 + vinfo.yres, vinfo.bits_per_pixel); 65 + } 66 + #endif 67 + /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the 68 + * values returned by the driver for line_length */ 69 + 70 + /* map framebuffer */ 71 + framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 72 + if((void *)framebuffer == MAP_FAILED) 73 + { 74 + panicf("Cannot map framebuffer"); 75 + } 76 + } 77 + 78 + static void redraw(void) 79 + { 80 + ioctl(fd, FBIOPAN_DISPLAY, &vinfo); 81 + } 82 + 83 + extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, 84 + int width, int height); 85 + 86 + void lcd_update(void) 87 + { 88 + /* Copy the Rockbox framebuffer to the second framebuffer */ 89 + lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0), 90 + LCD_WIDTH*LCD_HEIGHT, 1); 91 + redraw(); 92 + } 93 + 94 + void lcd_update_rect(int x, int y, int width, int height) 95 + { 96 + fb_data *dst = LCD_FRAMEBUF_ADDR(x, y); 97 + fb_data * src = FBADDR(x,y); 98 + 99 + /* Copy part of the Rockbox framebuffer to the second framebuffer */ 100 + if (width < LCD_WIDTH) 101 + { 102 + /* Not full width - do line-by-line */ 103 + lcd_copy_buffer_rect(dst, src, width, height); 104 + } 105 + else 106 + { 107 + /* Full width - copy as one line */ 108 + lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1); 109 + } 110 + redraw(); 111 + }
+26
firmware/target/hosted/agptek/lcd-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2016 Amaury Pouly 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + 21 + #ifndef __LCD_TARGET_H__ 22 + #define __LCD_TARGET_H__ 23 + 24 + extern fb_data *framebuffer; /* see lcd-nwz.c */ 25 + #define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) 26 + #endif /* __LCD_TARGET_H__ */
+59
firmware/target/hosted/agptek/power-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 by Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #include <sys/types.h> 21 + #include <fcntl.h> 22 + #include <string.h> 23 + #include <unistd.h> 24 + #include <stdio.h> 25 + 26 + #include "system.h" 27 + #include "power-agptek.h" 28 + #include "power.h" 29 + #include "panic.h" 30 + #include "sysfs.h" 31 + 32 + const char * const sysfs_bat_voltage = 33 + "/sys/class/power_supply/battery/voltage_now"; 34 + 35 + const char * const sysfs_bat_status = 36 + "/sys/class/power_supply/battery/status"; 37 + 38 + unsigned int agptek_power_get_status(void) 39 + { 40 + char buf[12] = {0}; 41 + sysfs_get_string(sysfs_bat_status, buf, sizeof(buf)); 42 + 43 + if (strncmp(buf, "Charging", 8) == 0) 44 + { 45 + return POWER_INPUT_USB_CHARGER; 46 + } 47 + else 48 + { 49 + return POWER_INPUT_NONE; 50 + } 51 + } 52 + 53 + unsigned int agptek_power_get_battery_voltage(void) 54 + { 55 + int battery_voltage; 56 + sysfs_get_int(sysfs_bat_voltage, &battery_voltage); 57 + 58 + return battery_voltage/1000; 59 + }
+29
firmware/target/hosted/agptek/power-agptek.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 by Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #ifndef _POWER_AGPTEK_H_ 21 + #define _POWER_AGPTEK_H_ 22 + 23 + #include <stdbool.h> 24 + #include "config.h" 25 + 26 + unsigned int agptek_power_get_status(void); 27 + unsigned int agptek_power_get_battery_voltage(void); 28 + #endif /* _POWER_AGPTEK_H_ */ 29 +
+63
firmware/target/hosted/agptek/powermgmt-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * 11 + * This program is free software; you can redistribute it and/or 12 + * modify it under the terms of the GNU General Public License 13 + * as published by the Free Software Foundation; either version 2 14 + * of the License, or (at your option) any later version. 15 + * 16 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 + * KIND, either express or implied. 18 + * 19 + ****************************************************************************/ 20 + #include "powermgmt.h" 21 + #include "power.h" 22 + #include "power-agptek.h" 23 + 24 + const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 25 + { 26 + 3470 27 + }; 28 + 29 + /* the OF shuts down at this voltage */ 30 + const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 31 + { 32 + 3400 33 + }; 34 + 35 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled 36 + * NOTE: not calibrated simple linear scale for now 37 + */ 38 + const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 39 + { 40 + { 3400, 3480, 3560, 3640, 3720, 3800, 3880, 3960, 4040, 4120, 4200 } 41 + }; 42 + 43 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 44 + const unsigned short const percent_to_volt_charge[11] = 45 + { 46 + 3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200 47 + }; 48 + 49 + unsigned int power_input_status(void) 50 + { 51 + /* POWER_INPUT_USB_CHARGER, POWER_INPUT_NONE */ 52 + return agptek_power_get_status(); 53 + } 54 + 55 + int _battery_voltage(void) 56 + { 57 + return agptek_power_get_battery_voltage(); 58 + } 59 + 60 + bool charging_state(void) 61 + { 62 + return agptek_power_get_status() == POWER_INPUT_USB_CHARGER; 63 + }
+48
firmware/target/hosted/agptek/rocker.make
··· 1 + # __________ __ ___. 2 + # Open \______ \ ____ ____ | | _\_ |__ _______ ___ 3 + # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 4 + # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 + # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 + # \/ \/ \/ \/ \/ 7 + # $Id$ 8 + # 9 + 10 + INCLUDES += -I$(FIRMDIR)/include -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR) 11 + 12 + SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS) 13 + 14 + # bootloader build is sligtly different 15 + ifneq (,$(findstring bootloader,$(APPSDIR))) 16 + 17 + SRC += $(call preprocess, $(APPSDIR)/SOURCES) 18 + CLEANOBJS += $(BUILDDIR)/bootloader.* 19 + 20 + endif #bootloader 21 + 22 + .SECONDEXPANSION: # $$(OBJ) is not populated until after this 23 + 24 + ifneq (,$(findstring bootloader,$(APPSDIR))) 25 + # bootloader build 26 + 27 + $(BUILDDIR)/bootloader.elf : $$(OBJ) $(FIRMLIB) $(CORE_LIBS) 28 + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ 29 + -L$(BUILDDIR)/firmware -lfirmware \ 30 + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ 31 + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map 32 + 33 + $(BUILDDIR)/$(BINARY): $(BUILDDIR)/bootloader.elf 34 + 35 + else 36 + # rockbox app build 37 + 38 + $(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) 39 + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ 40 + -L$(BUILDDIR)/firmware -lfirmware \ 41 + -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ 42 + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ 43 + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map 44 + 45 + $(BUILDDIR)/rockbox.rocker : $(BUILDDIR)/rockbox.elf 46 + $(call PRINTS,OC $(@F))$(call objcopy,$^,$@) 47 + 48 + endif
+186
firmware/target/hosted/agptek/sysfs.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___ 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 10 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port 11 + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features 12 + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features 13 + * 14 + * This program is free software; you can redistribute it and/or 15 + * modify it under the terms of the GNU General Public License 16 + * as published by the Free Software Foundation; either version 2 17 + * of the License, or (at your option) any later version. 18 + * 19 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20 + * KIND, either express or implied. 21 + * 22 + ****************************************************************************/ 23 + 24 + 25 + #include <stdio.h> 26 + #include <string.h> 27 + 28 + #include "config.h" 29 + #include "debug.h" 30 + #include "sysfs.h" 31 + 32 + 33 + static FILE* open_read(const char *file_name) 34 + { 35 + FILE *f = fopen(file_name, "r"); 36 + if(f == NULL) 37 + { 38 + DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name); 39 + } 40 + 41 + return f; 42 + } 43 + 44 + 45 + static FILE* open_write(const char* file_name) 46 + { 47 + FILE *f = fopen(file_name, "w"); 48 + if(f == NULL) 49 + { 50 + DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name); 51 + } 52 + 53 + return f; 54 + } 55 + 56 + 57 + bool sysfs_get_int(const char *path, int *value) 58 + { 59 + *value = -1; 60 + 61 + FILE *f = open_read(path); 62 + if(f == NULL) 63 + { 64 + return false; 65 + } 66 + 67 + bool success = true; 68 + if(fscanf(f, "%d", value) == EOF) 69 + { 70 + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); 71 + success = false; 72 + } 73 + 74 + fclose(f); 75 + return success; 76 + } 77 + 78 + 79 + bool sysfs_set_int(const char *path, int value) 80 + { 81 + FILE *f = open_write(path); 82 + if(f == NULL) 83 + { 84 + return false; 85 + } 86 + 87 + bool success = true; 88 + if(fprintf(f, "%d", value) < 1) 89 + { 90 + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); 91 + success = false; 92 + } 93 + 94 + fclose(f); 95 + return success; 96 + } 97 + 98 + 99 + bool sysfs_get_char(const char *path, char *value) 100 + { 101 + *value = '\0'; 102 + FILE *f = open_read(path); 103 + if(f == NULL) 104 + { 105 + return false; 106 + } 107 + 108 + bool success = true; 109 + if(fscanf(f, "%c", value) == EOF) 110 + { 111 + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); 112 + success = false; 113 + } 114 + 115 + fclose(f); 116 + return success; 117 + } 118 + 119 + 120 + bool sysfs_set_char(const char *path, char value) 121 + { 122 + FILE *f = open_write(path); 123 + if(f == NULL) 124 + { 125 + return false; 126 + } 127 + 128 + bool success = true; 129 + if(fprintf(f, "%c", value) < 1) 130 + { 131 + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); 132 + success = false; 133 + } 134 + 135 + fclose(f); 136 + return success; 137 + } 138 + 139 + 140 + bool sysfs_get_string(const char *path, char *value, int size) 141 + { 142 + value[0] = '\0'; 143 + FILE *f = open_read(path); 144 + if(f == NULL) 145 + { 146 + return false; 147 + } 148 + 149 + bool success = true; 150 + if(fgets(value, size, f) == NULL) 151 + { 152 + DEBUGF("ERROR %s: Read failed for %s.", __func__, path); 153 + success = false; 154 + } 155 + else 156 + { 157 + size_t length = strlen(value); 158 + if((length > 0) && value[length - 1] == '\n') 159 + { 160 + value[length - 1] = '\0'; 161 + } 162 + } 163 + 164 + fclose(f); 165 + return success; 166 + } 167 + 168 + 169 + bool sysfs_set_string(const char *path, char *value) 170 + { 171 + FILE *f = open_write(path); 172 + if(f == NULL) 173 + { 174 + return false; 175 + } 176 + 177 + bool success = true; 178 + if(fprintf(f, "%s", value) < 1) 179 + { 180 + DEBUGF("ERROR %s: Write failed for %s.", __func__, path); 181 + success = false; 182 + } 183 + 184 + fclose(f); 185 + return success; 186 + }
+31
firmware/target/hosted/agptek/sysfs.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___ 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50 10 + * Copyright (C) 2014 by Mario Basister: iBasso DX90 port 11 + * Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features 12 + * Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features 13 + * 14 + * This program is free software; you can redistribute it and/or 15 + * modify it under the terms of the GNU General Public License 16 + * as published by the Free Software Foundation; either version 2 17 + * of the License, or (at your option) any later version. 18 + * 19 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20 + * KIND, either express or implied. 21 + * 22 + ****************************************************************************/ 23 + 24 + #include <stdbool.h> 25 + 26 + bool sysfs_get_int(const char *path, int *value); 27 + bool sysfs_set_int(const char *path, int value); 28 + bool sysfs_get_char(const char *path, char *value); 29 + bool sysfs_set_char(const char *path, char value); 30 + bool sysfs_get_string(const char *path, char *value, int size); 31 + bool sysfs_set_string(const char *path, char *value);
+184
firmware/target/hosted/agptek/system-agptek.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * Copyright (C) 2016 Amaury Pouly 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + #include <unistd.h> 22 + #include <signal.h> 23 + #include <string.h> 24 + #include <ucontext.h> 25 + #include <backtrace.h> 26 + 27 + #include "system.h" 28 + #include "mv.h" 29 + #include "font.h" 30 + #include "power.h" 31 + #include "button.h" 32 + #include "backlight-target.h" 33 + #include "lcd.h" 34 + 35 + /* to make thread-internal.h happy */ 36 + uintptr_t *stackbegin; 37 + uintptr_t *stackend; 38 + 39 + static void sig_handler(int sig, siginfo_t *siginfo, void *context) 40 + { 41 + /* safe guard variable - we call backtrace() only on first 42 + * UIE call. This prevent endless loop if backtrace() touches 43 + * memory regions which cause abort 44 + */ 45 + static bool triggered = false; 46 + 47 + lcd_set_backdrop(NULL); 48 + lcd_set_drawmode(DRMODE_SOLID); 49 + lcd_set_foreground(LCD_BLACK); 50 + lcd_set_background(LCD_WHITE); 51 + unsigned line = 0; 52 + 53 + lcd_setfont(FONT_SYSFIXED); 54 + lcd_set_viewport(NULL); 55 + lcd_clear_display(); 56 + 57 + /* get context info */ 58 + ucontext_t *uc = (ucontext_t *)context; 59 + unsigned long pc = uc->uc_mcontext.pc; 60 + unsigned long sp = uc->uc_mcontext.gregs[29]; 61 + 62 + lcd_putsf(0, line++, "%s at %08x", strsignal(sig), pc); 63 + 64 + if(sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS || sig == SIGTRAP) 65 + lcd_putsf(0, line++, "address 0x%08x", siginfo->si_addr); 66 + 67 + if(!triggered) 68 + { 69 + triggered = true; 70 + rb_backtrace(pc, sp, &line); 71 + } 72 + 73 + #ifdef ROCKBOX_HAS_LOGF 74 + lcd_putsf(0, line++, "logf:"); 75 + logf_panic_dump(&line); 76 + #endif 77 + 78 + lcd_update(); 79 + 80 + system_exception_wait(); /* If this returns, try to reboot */ 81 + system_reboot(); 82 + while (1); /* halt */ 83 + } 84 + 85 + void power_off(void) 86 + { 87 + system("/sbin/poweroff"); 88 + } 89 + 90 + void system_init(void) 91 + { 92 + int *s; 93 + /* fake stack, to make thread-internal.h happy */ 94 + stackbegin = stackend = (uintptr_t*)&s; 95 + /* catch some signals for easier debugging */ 96 + struct sigaction sa; 97 + sigfillset(&sa.sa_mask); 98 + sa.sa_flags = SA_SIGINFO; 99 + sa.sa_sigaction = &sig_handler; 100 + sigaction(SIGILL, &sa, NULL); 101 + sigaction(SIGABRT, &sa, NULL); 102 + sigaction(SIGFPE, &sa, NULL); 103 + sigaction(SIGSEGV, &sa, NULL); 104 + sigaction(SIGPIPE, &sa, NULL); 105 + sigaction(SIGTERM, &sa, NULL); 106 + sigaction(SIGBUS, &sa, NULL); 107 + sigaction(SIGTERM, &sa, NULL); 108 + } 109 + 110 + void system_reboot(void) 111 + { 112 + system("/sbin/reboot"); 113 + } 114 + 115 + void system_exception_wait(void) 116 + { 117 + backlight_hw_on(); 118 + backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING); 119 + /* wait until button press and release */ 120 + while(button_read_device() != 0) {} 121 + while(button_read_device() == 0) {} 122 + while(button_read_device() != 0) {} 123 + while(button_read_device() == 0) {} 124 + } 125 + 126 + bool hostfs_removable(IF_MD_NONVOID(int drive)) 127 + { 128 + #ifdef HAVE_MULTIDRIVE 129 + if (drive > 0) /* Active LOW */ 130 + return true; 131 + else 132 + #endif 133 + return false; /* internal: always present */ 134 + } 135 + 136 + bool hostfs_present(IF_MD_NONVOID(int drive)) 137 + { 138 + #ifdef HAVE_MULTIDRIVE 139 + if (drive > 0) /* Active LOW */ 140 + return true; //FIXME 141 + else 142 + #endif 143 + return true; /* internal: always present */ 144 + } 145 + 146 + #ifdef HAVE_MULTIDRIVE 147 + int volume_drive(int drive) 148 + { 149 + return drive; 150 + } 151 + #endif /* HAVE_MULTIDRIVE */ 152 + 153 + #ifdef CONFIG_STORAGE_MULTI 154 + int hostfs_driver_type(int drive) 155 + { 156 + return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM; 157 + } 158 + #endif /* CONFIG_STORAGE_MULTI */ 159 + 160 + int hostfs_init(void) 161 + { 162 + return 0; 163 + } 164 + 165 + int hostfs_flush(void) 166 + { 167 + sync(); 168 + return 0; 169 + } 170 + 171 + #ifdef HAVE_HOTSWAP 172 + bool volume_removable(int volume) 173 + { 174 + /* don't support more than one partition yet, so volume == drive */ 175 + return hostfs_removable(volume); 176 + } 177 + 178 + bool volume_present(int volume) 179 + { 180 + /* don't support more than one partition yet, so volume == drive */ 181 + return hostfs_present(volume); 182 + } 183 + #endif 184 +
+28
firmware/target/hosted/agptek/system-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * 9 + * Copyright (C) 2017 Marcin Bukat 10 + * Copyright (C) 2016 Amaury Pouly 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + #ifndef __SYSTEM_TARGET_H__ 22 + #define __SYSTEM_TARGET_H__ 23 + 24 + #include "kernel-unix.h" 25 + #include "system-hosted.h" 26 + 27 + #define NEED_GENERIC_BYTESWAPS 28 + #endif /* __SYSTEM_TARGET_H__ */
+1 -1
firmware/target/hosted/alsa-controls.c
··· 3 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 7 * \/ \/ \/ \/ \/ 8 8 * 9 9 * Copyright (C) 2016 Amaury Pouly
+9
firmware/target/hosted/alsa-controls.h
··· 1 1 /*************************************************************************** 2 + <<<<<<< 9a9c7f2b7c63a9db203084a3485988c07f17b86c 2 3 * __________ __ ___. 3 4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 8 * \/ \/ \/ \/ \/ 9 + ======= 10 + * __________ __ ___. 11 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 12 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 13 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 14 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 15 + * \/ \/ \/ \/ \/ 16 + >>>>>>> Agptek rocker port initial commit 8 17 * 9 18 * Copyright (C) 2016 Amaury Pouly 10 19 *
+2 -1
firmware/target/hosted/filesystem-app.c
··· 48 48 #endif 49 49 50 50 #if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \ 51 - defined(SONY_NWZ_LINUX) || defined(DX90)) && !defined(__PCTOOL__) 51 + defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER)) && \ 52 + !defined(__PCTOOL__) 52 53 /* Special dirs are user-accessible (and user-writable) dirs which take priority 53 54 * over the ones where Rockbox is installed to. Classic example would be 54 55 * $HOME/.config/rockbox.org vs /usr/share/rockbox */
+6
firmware/target/hosted/sdl/sim-ui-defines.h
··· 515 515 #define UI_LCD_POSX 78 516 516 #define UI_LCD_POSY 92 517 517 518 + #elif defined(AGPTEK_ROCKER) 519 + #define UI_TITLE "Agptek Rocker" 520 + #define UI_WIDTH 186 521 + #define UI_HEIGHT 380 522 + #define UI_LCD_POSX 29 523 + #define UI_LCD_POSY 25 518 524 #elif defined(SIMULATOR) 519 525 #error no UI defines 520 526 #endif
+2 -1
lib/rbcodec/codecs/libmad/libmad.make
··· 19 19 ifeq ($(ARCH),arch_arm) 20 20 MADFLAGS += -O1 21 21 else 22 - MADFLAGS += -O2 22 + # MADFLAGS += -O2 23 + MADFLAGS += -O0 -g 23 24 endif 24 25 25 26 # MPEGplayer
+45 -2
tools/configure
··· 867 867 prefixtools $gcctarget 868 868 } 869 869 870 + mipsellinuxcc () { 871 + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib//` 872 + GCCOPTS="$GCCOPTS -march=mips32r2 -mno-mips16 -mno-long-calls -Umips -fPIC" 873 + GCCOPTIMIZE='' 874 + LDOPTS="-lasound -lpthread -lm -ldl -lrt $LDOPTS" 875 + GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs" 876 + SHARED_LDFLAG="-shared" 877 + SHARED_CFLAGS='-fPIC -fvisibility=hidden' 878 + endian="little" 879 + app_type="rocker" 880 + thread_support="HAVE_SIGALTSTACK_THREADS" 881 + 882 + # Include path 883 + GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT" 884 + 885 + # Set up compiler 886 + gccchoice="4.9.4" 887 + prefixtools "mipsel-rockbox-linux-gnu-" 888 + } 889 + 870 890 whichadvanced () { 871 891 atype=`echo "$1" | cut -c 2-` 872 892 ################################################################## ··· 1511 1531 207) Android x86 230) 760 223) NWZ-E460 series 1512 1532 208) Samsung YP-R1 231) 960 224) NWZ-E470 series 1513 1533 225) NWZ-E580 series 1514 - ==iBasso== 226) NWZ-A10 series 1515 - 232) DX50 227) NW-A20 series 1534 + ==iBasso== ==Agptek== 226) NWZ-A10 series 1535 + 232) DX50 240) Rocker 227) NW-A20 series 1516 1536 233) DX90 228) NWZ-A860 series 1517 1537 229) NWZ-S750 series 1518 1538 EOF ··· 4171 4191 t_cpu="hosted" 4172 4192 t_manufacturer="ibasso" 4173 4193 t_model="dx90" 4194 + ;; 4195 + 4196 + 240|agptekrocker) 4197 + application="yes" 4198 + target_id=97 4199 + modelname="agptekrocker" 4200 + target="AGPTEK_ROCKER" 4201 + memory=6 4202 + tool="cp " 4203 + boottool="cp " 4204 + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 4205 + bmp2rb_native="$rootdir/tools/bmp2rb -f 10" 4206 + output="rockbox.rocker" 4207 + bootoutput="bootloader.rocker" 4208 + appextra="recorder:gui:hosted" 4209 + plugins="" 4210 + swcodec="yes" 4211 + # architecture, manufacturer and model for the target-tree build 4212 + t_cpu="hosted" 4213 + t_manufacturer="agptek" 4214 + t_model="rocker" 4215 + rbdir='/mnt/sd_0/.rockbox' 4216 + mipsellinuxcc 4174 4217 ;; 4175 4218 4176 4219 *)
+6
tools/root.make
··· 103 103 ifneq (,$(findstring bootloader,$(APPSDIR))) 104 104 ifneq (,$(findstring sonynwz,$(APP_TYPE))) 105 105 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make 106 + else ifneq (,$(findstring rocker,$(APP_TYPE))) 107 + include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make 106 108 else 107 109 include $(APPSDIR)/bootloader.make 108 110 endif ··· 141 143 142 144 ifneq (,$(findstring sonynwz,$(APP_TYPE))) 143 145 include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make 146 + endif 147 + 148 + ifneq (,$(findstring rocker,$(APP_TYPE))) 149 + include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make 144 150 endif 145 151 146 152 ifneq (,$(findstring android_ndk, $(APP_TYPE)))
uisimulator/bitmaps/UI-agptekrocker.bmp

This is a binary file and will not be displayed.

+2
uisimulator/buttonmap/SOURCES
··· 83 83 creative-zen.c 84 84 #elif CONFIG_KEYPAD == SONY_NWZA860_PAD 85 85 sony-nwza860.c 86 + #elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD 87 + agptek-rocker.c 86 88 #endif 87 89 #endif /* SIMULATOR */
+80
uisimulator/buttonmap/agptek-rocker.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 by Amaury Pouly 11 + * 12 + * This program is free software; you can redistribute it and/or 13 + * modify it under the terms of the GNU General Public License 14 + * as published by the Free Software Foundation; either version 2 15 + * of the License, or (at your option) any later version. 16 + * 17 + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 + * KIND, either express or implied. 19 + * 20 + ****************************************************************************/ 21 + 22 + 23 + #include <SDL.h> 24 + #include "button.h" 25 + #include "buttonmap.h" 26 + 27 + int key_to_button(int keyboard_button) 28 + { 29 + int new_btn = BUTTON_NONE; 30 + switch (keyboard_button) 31 + { 32 + case SDLK_KP4: 33 + case SDLK_LEFT: 34 + new_btn = BUTTON_LEFT; 35 + break; 36 + case SDLK_KP6: 37 + case SDLK_RIGHT: 38 + new_btn = BUTTON_RIGHT; 39 + break; 40 + case SDLK_KP8: 41 + case SDLK_UP: 42 + new_btn = BUTTON_UP; 43 + break; 44 + case SDLK_KP2: 45 + case SDLK_DOWN: 46 + new_btn = BUTTON_DOWN; 47 + break; 48 + case SDLK_ESCAPE: 49 + new_btn = BUTTON_POWER; 50 + break; 51 + case SDLK_KP_PLUS: 52 + case SDLK_EQUALS: 53 + new_btn = BUTTON_VOLUP; 54 + break; 55 + case SDLK_KP_MINUS: 56 + case SDLK_MINUS: 57 + new_btn = BUTTON_VOLDOWN; 58 + break; 59 + case SDLK_KP_ENTER: 60 + case SDLK_RETURN: 61 + case SDLK_SPACE: 62 + case SDLK_INSERT: 63 + case SDLK_KP5: 64 + new_btn = BUTTON_SELECT; 65 + break; 66 + } 67 + return new_btn; 68 + } 69 + 70 + struct button_map bm[] = { 71 + { SDLK_LEFT, 38, 296, 20, "Left" }, 72 + { SDLK_RIGHT, 146, 295, 20, "Right" }, 73 + { SDLK_UP, 93, 241, 20, "Up" }, 74 + { SDLK_DOWN, 93, 348, 20, "Down" }, 75 + { SDLK_ESCAPE, 2, 45, 20, "Power" }, 76 + { SDLK_RETURN, 93, 295, 40, "Select" }, 77 + { SDLK_KP_MINUS, 182, 100, 30, "Volume -" }, 78 + { SDLK_KP_PLUS, 182, 45, 30, "Volume +" }, 79 + { 0, 0, 0, 0, "None" } 80 + };
+6 -6
wps/WPSLIST
··· 95 95 wps.138x110x2: cabbiev2.138x110x2.wps 96 96 wps.128x128x(16|24): cabbiev2.128x128x16.wps 97 97 wps.128x128x2: cabbiev2.128x128x2.wps 98 - wps.128x160x(16|24): cabbiev2.128x160x16.wps 98 + wps.128x160x(16|24|32): cabbiev2.128x160x16.wps 99 99 wps.132x80x(16|24): cabbiev2.132x80x16.wps 100 100 wps.128x96x(16|24): cabbiev2.128x96x16.wps 101 101 wps.128x96x2: cabbiev2.128x96x2.wps ··· 124 124 Font.138x110x2: 12-Adobe-Helvetica.fnt 125 125 Font.128x128x(16|24): 12-Adobe-Helvetica.fnt 126 126 Font.128x128x2: 12-Adobe-Helvetica.fnt 127 - Font.128x160x(16|24): 12-Adobe-Helvetica.fnt 127 + Font.128x160x(16|24|32): 12-Adobe-Helvetica.fnt 128 128 Font.132x80x(16|24): 11-Sazanami-Mincho.fnt 129 129 Font.128x96x(16|24): 08-Rockfont.fnt 130 130 Font.128x96x2: 12-Adobe-Helvetica.fnt ··· 148 148 backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp 149 149 backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp 150 150 backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp 151 - backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp 151 + backdrop.128x160x(16|24|32): backdrops/cabbiev2.128x160x16.bmp 152 152 backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp 153 153 backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp 154 154 backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp ··· 173 173 iconset.320x480x(16|24): icons/tango_icons.24x24.bmp 174 174 iconset.320x240x(16|24): icons/tango_icons.16x16.bmp 175 175 iconset.128x128x(16|24): icons/tango_icons.12x12.bmp 176 - iconset.128x160x(16|24): icons/tango_icons.12x12.bmp 176 + iconset.128x160x(16|24|32): icons/tango_icons.12x12.bmp 177 177 iconset.132x80x(16|24): icons/tango_icons.12x12.bmp 178 - iconset.160x128x(16|24): icons/tango_icons.12x12.bmp 178 + iconset.160x128x(16|24|32): icons/tango_icons.12x12.bmp 179 179 iconset.176x132x(16|24): icons/tango_icons.12x12.bmp 180 180 iconset.176x220x(16|24): icons/tango_icons.12x12.bmp 181 181 iconset.220x176x(16|24): icons/tango_icons.12x12.bmp ··· 194 194 viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp 195 195 viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp 196 196 viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp 197 - viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp 197 + viewers iconset.160x128x(16|24|32): icons/tango_icons_viewers.12x12.bmp 198 198 viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp 199 199 viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp 200 200 viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp