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

Introduce HiFi E.T MA9 port.

Change-Id: I79aadc958fd5222f26f91ed127f8c6fb2c465dc2

+1441 -5
+2
apps/SOURCES
··· 286 286 keymaps/keymap-sansa-connect.c 287 287 #elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD 288 288 keymaps/keymap-ypr0.c 289 + #elif CONFIG_KEYPAD == MA_PAD 290 + keymaps/keymap-ma.c 289 291 #endif 290 292
+237
apps/keymaps/keymap-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 + /* Button Code Definitions for HiFi E.T. MA9/MA8 reference design target */ 23 + 24 + #include "config.h" 25 + #include "action.h" 26 + #include "button.h" 27 + #include "settings.h" 28 + 29 + /* 30 + * The format of the list is as follows 31 + * { Action Code, Button code, Prereq button code } 32 + * if there's no need to check the previous button's value, use BUTTON_NONE 33 + * Insert LAST_ITEM_IN_LIST at the end of each mapping 34 + */ 35 + static const struct button_mapping button_context_standard[] = { 36 + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, 37 + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 38 + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, 39 + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 40 + 41 + { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 42 + { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, 43 + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 44 + { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, 45 + 46 + LAST_ITEM_IN_LIST 47 + }; /* button_context_standard */ 48 + 49 + static const struct button_mapping button_context_wps[] = { 50 + { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 51 + { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 52 + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, 53 + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 54 + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, 55 + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT}, 56 + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 57 + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, 58 + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, 59 + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 60 + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, 61 + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 62 + 63 + { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_BACK|BUTTON_RIGHT, BUTTON_BACK }, 64 + { ACTION_WPS_ABSETA_PREVDIR,BUTTON_BACK|BUTTON_LEFT, BUTTON_BACK }, 65 + { ACTION_WPS_ABRESET, BUTTON_BACK|BUTTON_UP, BUTTON_BACK }, 66 + 67 + { ACTION_WPS_BROWSE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, 68 + { ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, 69 + { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, 70 + { ACTION_WPS_QUICKSCREEN, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK }, 71 + 72 + #ifndef HAS_BUTTON_HOLD 73 + { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_BACK, BUTTON_MENU }, 74 + #endif 75 + 76 + LAST_ITEM_IN_LIST 77 + }; /* button_context_wps */ 78 + 79 + /** Bookmark Screen **/ 80 + static const struct button_mapping button_context_bmark[] = { 81 + { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 82 + 83 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), 84 + }; /* button_context_settings_bmark */ 85 + 86 + 87 + /** Keyboard **/ 88 + static const struct button_mapping button_context_keyboard[] = { 89 + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, 90 + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 91 + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 92 + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 93 + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, 94 + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 95 + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, 96 + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 97 + { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, 98 + { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, 99 + { ACTION_KBD_ABORT, BUTTON_BACK, BUTTON_NONE }, 100 + 101 + LAST_ITEM_IN_LIST 102 + }; /* button_context_keyboard */ 103 + 104 + /** Pitchscreen **/ 105 + static const struct button_mapping button_context_pitchscreen[] = { 106 + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, 107 + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 108 + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, 109 + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 110 + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, 111 + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, 112 + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 113 + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, 114 + { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, 115 + { ACTION_PS_RESET, BUTTON_BACK, BUTTON_NONE }, 116 + { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE }, 117 + 118 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 119 + }; /* button_context_pitchscreen */ 120 + 121 + /** Quickscreen **/ 122 + static const struct button_mapping button_context_quickscreen[] = { 123 + { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE }, 124 + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 125 + { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, 126 + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 127 + { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE }, 128 + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 129 + { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, 130 + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 131 + { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, 132 + 133 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 134 + }; /* button_context_quickscreen */ 135 + 136 + /** Settings - General Mappings **/ 137 + static const struct button_mapping button_context_settings[] = { 138 + { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE }, 139 + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, 140 + { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, 141 + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, 142 + { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, 143 + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, 144 + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 145 + { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, 146 + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 147 + 148 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 149 + }; /* button_context_settings */ 150 + 151 + /** Settings - Using Sliders **/ 152 + static const struct button_mapping button_context_settings_r_is_inc[] = { 153 + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, 154 + { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 155 + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, 156 + { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 157 + 158 + { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK}, 159 + 160 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 161 + }; /* button_context_settings_r_is_inc */ 162 + 163 + /** Tree **/ 164 + static const struct button_mapping button_context_tree[] = { 165 + { ACTION_TREE_WPS, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, 166 + { ACTION_TREE_STOP, BUTTON_BACK|BUTTON_PLAY, BUTTON_BACK }, 167 + { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_UP, BUTTON_BACK }, 168 + 169 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) 170 + }; /* button_context_tree */ 171 + 172 + static const struct button_mapping button_context_tree_scroll_lr[] = { 173 + { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, 174 + { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, 175 + { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, 176 + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, 177 + { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, 178 + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, 179 + 180 + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), 181 + }; /* button_context_tree_scroll_lr */ 182 + 183 + /** Yes/No Screen **/ 184 + static const struct button_mapping button_context_yesnoscreen[] = { 185 + { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, 186 + LAST_ITEM_IN_LIST 187 + }; /* button_context_settings_yesnoscreen */ 188 + 189 + /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ 190 + const struct button_mapping* get_context_mapping(int context) 191 + { 192 + switch (context) 193 + { 194 + /* anything that uses button_context_standard */ 195 + case CONTEXT_LIST: 196 + case CONTEXT_STD: 197 + default: 198 + return button_context_standard; 199 + 200 + /* contexts with special mapping */ 201 + case CONTEXT_BOOKMARKSCREEN: 202 + return button_context_bmark; 203 + 204 + case CONTEXT_KEYBOARD: 205 + case CONTEXT_MORSE_INPUT: 206 + return button_context_keyboard; 207 + 208 + case CONTEXT_PITCHSCREEN: 209 + return button_context_pitchscreen; 210 + 211 + case CONTEXT_QUICKSCREEN: 212 + return button_context_quickscreen; 213 + 214 + case CONTEXT_SETTINGS: 215 + case CONTEXT_SETTINGS_TIME: 216 + return button_context_settings; 217 + 218 + case CONTEXT_SETTINGS_COLOURCHOOSER: 219 + case CONTEXT_SETTINGS_EQ: 220 + case CONTEXT_SETTINGS_RECTRIGGER: 221 + return button_context_settings_r_is_inc; 222 + 223 + case CONTEXT_TREE: 224 + case CONTEXT_MAINMENU: 225 + if (global_settings.hold_lr_for_scroll_in_list) 226 + return button_context_tree_scroll_lr; 227 + /* else fall through to CONTEXT_TREE|CONTEXT_CUSTOM */ 228 + case CONTEXT_TREE|CONTEXT_CUSTOM: 229 + return button_context_tree; 230 + 231 + case CONTEXT_WPS: 232 + return button_context_wps; 233 + 234 + case CONTEXT_YESNOSCREEN: 235 + return button_context_yesnoscreen; 236 + } 237 + }
+1 -1
bootloader/SOURCES
··· 67 67 show_logo.c 68 68 #elif defined(MPIO_HD200) || defined(MPIO_HD300) 69 69 mpio_hd200_hd300.c 70 - #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) 70 + #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) || defined(MA9) 71 71 rk27xx.c 72 72 show_logo.c 73 73 #elif defined(SANSA_CONNECT)
+13
firmware/SOURCES
··· 403 403 drivers/audio/aic3x.c 404 404 #elif defined (HAVE_DUMMY_CODEC) 405 405 drivers/audio/dummy_codec.c 406 + #elif defined (HAVE_DF1704_CODEC) 407 + drivers/audio/df1704.c 406 408 #endif /* defined(HAVE_*) */ 407 409 #else /* PLATFORM_HOSTED */ 408 410 #if defined(SAMSUNG_YPR0) && defined(HAVE_AS3514) ··· 689 691 target/arm/imx31/gigabeat-s/lcd-gigabeat-s.c 690 692 #elif CONFIG_LCD == LCD_GIGABEAT || CONFIG_LCD == LCD_MINI2440 691 693 target/arm/s3c2440/lcd-s3c2440.c 694 + #elif CONFIG_LCD == LCD_ILI9342 695 + target/arm/rk27xx/ma/lcd-ma.c 692 696 #endif 693 697 694 698 /* USB Stack */ ··· 1693 1697 target/arm/rk27xx/hm801/button-hm801.c 1694 1698 target/arm/rk27xx/hm801/powermgmt-hm801.c 1695 1699 target/arm/rk27xx/hm801/power-hm801.c 1700 + #endif 1701 + 1702 + #if defined(MA9) 1703 + target/arm/rk27xx/ma/button-ma.c 1704 + target/arm/rk27xx/ma/powermgmt-ma.c 1705 + target/arm/rk27xx/ma/power-ma.c 1706 + drivers/pca9555.c 1707 + target/arm/rk27xx/ma/pca9555-ma.c 1708 + target/arm/rk27xx/ma/audio-ma.c 1696 1709 #endif 1697 1710 1698 1711 #if (CONFIG_PLATFORM & PLATFORM_ANDROID)
+115
firmware/drivers/audio/df1704.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 "system.h" 23 + #include "df1704.h" 24 + #include "config.h" 25 + #include "audio.h" 26 + #include "audiohw.h" 27 + 28 + static void df1704_write_reg(const int reg, const unsigned int value) 29 + { 30 + int i; 31 + 32 + df1704_set_ml_dir(0); 33 + df1704_set_ml(1); 34 + df1704_set_md(1); 35 + df1704_set_mc(1); 36 + 37 + for (i = (1<<15); i; i >>= 1) { 38 + udelay(40); 39 + df1704_set_mc(0); 40 + 41 + if ((reg|value) & i) { 42 + df1704_set_md(1); 43 + } else { 44 + df1704_set_md(0); 45 + } 46 + 47 + udelay(40); 48 + df1704_set_mc(1); 49 + } 50 + 51 + df1704_set_ml(0); 52 + udelay(130); 53 + df1704_set_ml(1); 54 + udelay(130); 55 + df1704_set_ml_dir(1); 56 + } 57 + 58 + static int vol_tenthdb2hw(const int tdb) 59 + { 60 + if (tdb < DF1704_VOLUME_MIN) { 61 + return 0; 62 + } else if (tdb > DF1704_VOLUME_MAX) { 63 + return 0xff; 64 + } else { 65 + return (tdb/5+0xff); 66 + } 67 + } 68 + 69 + 70 + void df1704_init(void) 71 + { 72 + df1704_write_reg(DF1704_MODE(2), 73 + DF1704_OW_24 | 74 + DF1704_IW_16_I2S | 75 + DF1704_DEM_OFF | 76 + DF1704_MUTE_OFF); 77 + df1704_write_reg(DF1704_MODE(3), 78 + DF1704_CKO_HALF | 79 + DF1704_SRO_SHARP| 80 + DF1704_LRP_H | 81 + DF1704_I2S_ON); 82 + } 83 + 84 + void df1704_mute(void) 85 + { 86 + df1704_write_reg(DF1704_MODE(2), 87 + DF1704_OW_24 | 88 + DF1704_IW_16_I2S | 89 + DF1704_DEM_OFF | 90 + DF1704_MUTE_ON); 91 + } 92 + 93 + void df1704_unmute(void) 94 + { 95 + df1704_write_reg(DF1704_MODE(2), 96 + DF1704_OW_24 | 97 + DF1704_IW_16_I2S | 98 + DF1704_DEM_OFF | 99 + DF1704_MUTE_OFF); 100 + } 101 + 102 + void audiohw_preinit(void) 103 + { 104 + } 105 + 106 + void audiohw_set_frequency(int fsel) 107 + { 108 + (void)fsel; 109 + } 110 + 111 + void audiohw_set_volume(int vol_l, int vol_r) 112 + { 113 + df1704_write_reg(DF1704_MODE(0), DF1704_LDL_ON|vol_tenthdb2hw(vol_l)); 114 + df1704_write_reg(DF1704_MODE(1), DF1704_LDR_ON|vol_tenthdb2hw(vol_r)); 115 + }
+64
firmware/drivers/pca9555.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 "i2c-rk27xx.h" 23 + #include "pca9555.h" 24 + #include "system.h" 25 + 26 + static unsigned short pca9555_out_ports; 27 + static unsigned short pca9555_config = 0xffff; 28 + 29 + unsigned short pca9555_read_input(void) 30 + { 31 + unsigned short ret; 32 + i2c_read(PCA9555_I2C_ADDR, PCA9555_IN_CMD, sizeof(ret), (void*)&ret); 33 + return letoh16(ret); 34 + } 35 + 36 + unsigned short pca9555_read_output(void) 37 + { 38 + return pca9555_out_ports; 39 + } 40 + 41 + unsigned short pca9555_read_config(void) 42 + { 43 + return pca9555_config; 44 + } 45 + 46 + void pca9555_write_output(const unsigned short data, const unsigned short mask) 47 + { 48 + unsigned short le_data = htole16((data&mask) | (pca9555_out_ports&~(mask))); 49 + i2c_write(PCA9555_I2C_ADDR, PCA9555_OUT_CMD, sizeof(le_data), (void*)&le_data); 50 + pca9555_out_ports = letoh16(le_data); 51 + } 52 + 53 + void pca9555_write_config(const unsigned short data, const unsigned short mask) 54 + { 55 + unsigned short le_data = htole16((data&mask) | (pca9555_config&~(mask))); 56 + i2c_write(PCA9555_I2C_ADDR, PCA9555_CFG_CMD, sizeof(le_data), (void*)&le_data); 57 + pca9555_config = letoh16(le_data); 58 + } 59 + 60 + 61 + void pca9555_init(void) 62 + { 63 + pca9555_target_init(); 64 + }
+2
firmware/export/audiohw.h
··· 106 106 #include "imx233-codec.h" 107 107 #elif defined(HAVE_DUMMY_CODEC) 108 108 #include "dummy_codec.h" 109 + #elif defined(HAVE_DF1704_CODEC) 110 + #include "df1704.h" 109 111 #elif (CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO\ 110 112 | PLATFORM_PANDORA | PLATFORM_SDL)) 111 113 #include "hosted_codec.h"
+4
firmware/export/config.h
··· 147 147 #define SAMSUNG_YPR0_PAD 53 148 148 #define CREATIVE_ZENXFI2_PAD 54 149 149 #define CREATIVE_ZENXFI3_PAD 55 150 + #define MA_PAD 56 150 151 151 152 /* CONFIG_REMOTE_KEYPAD */ 152 153 #define H100_REMOTE 1 ··· 248 249 #define LCD_YPR0 47 249 250 #define LCD_CREATIVEZXFI2 48 /* as used by the Creative Zen X-Fi2 */ 250 251 #define LCD_CREATIVEZXFI3 49 /* as used by the Creative Zen X-Fi3 */ 252 + #define LCD_ILI9342 50 /* as used by HiFi E.T MA9/MA8 */ 251 253 252 254 /* LCD_PIXELFORMAT */ 253 255 #define HORIZONTAL_PACKING 1 ··· 505 507 #include "config/pandora.h" 506 508 #elif defined(SAMSUNG_YPR0) 507 509 #include "config/samsungypr0.h" 510 + #elif defined(MA9) 511 + #include "config/hifietma9.h" 508 512 #else 509 513 /* no known platform */ 510 514 #endif
+153
firmware/export/config/hifietma9.h
··· 1 + /* 2 + * This config file is for HiFiMAN HM-60x reference design 3 + */ 4 + 5 + /* For Rolo and boot loader */ 6 + #define MODEL_NUMBER 83 7 + 8 + #define MODEL_NAME "HiFi E.T. MA9" 9 + 10 + /* define the bitmask of hardware sample rates */ 11 + #define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \ 12 + SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \ 13 + SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) 14 + 15 + #define HAVE_DF1704_CODEC 16 + 17 + #define CODEC_SLAVE 18 + /* define this if you have a bitmap LCD display */ 19 + #define HAVE_LCD_BITMAP 20 + 21 + /* define this if you can flip your LCD */ 22 + /* #define HAVE_LCD_FLIP */ 23 + 24 + /* define this if you have a colour LCD */ 25 + #define HAVE_LCD_COLOR 26 + 27 + /* define this if you want album art for this target */ 28 + #define HAVE_ALBUMART 29 + 30 + /* define this to enable bitmap scaling */ 31 + #define HAVE_BMP_SCALING 32 + 33 + /* define this to enable JPEG decoding */ 34 + #define HAVE_JPEG 35 + 36 + /* define this if you can invert the colours on your LCD */ 37 + /* #define HAVE_LCD_INVERT */ 38 + 39 + /* define this if you have access to the quickscreen */ 40 + #define HAVE_QUICKSCREEN 41 + 42 + /* define this if you would like tagcache to build on this target */ 43 + #define HAVE_TAGCACHE 44 + 45 + /* define this if you have a flash memory storage */ 46 + #define HAVE_FLASH_STORAGE 47 + 48 + #define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND) 49 + 50 + #define CONFIG_NAND NAND_RK27XX 51 + #define HAVE_SW_TONE_CONTROLS 52 + 53 + /* commented for now */ 54 + /* #define HAVE_HOTSWAP */ 55 + 56 + #define NUM_DRIVES 2 57 + #define SECTOR_SIZE 512 58 + 59 + /* for small(ish) SD cards */ 60 + #define HAVE_FAT16SUPPORT 61 + 62 + /* LCD dimensions */ 63 + #define LCD_WIDTH 320 64 + #define LCD_HEIGHT 240 65 + #define LCD_DEPTH 16 /* pseudo 262.144 colors */ 66 + #define LCD_PIXELFORMAT RGB565 /* rgb565 */ 67 + 68 + /* Define this if your LCD can be enabled/disabled */ 69 + #define HAVE_LCD_ENABLE 70 + 71 + #define CONFIG_KEYPAD MA_PAD 72 + 73 + /* Define this to enable morse code input */ 74 + #define HAVE_MORSE_INPUT 75 + 76 + /* Define this if you do software codec */ 77 + #define CONFIG_CODEC SWCODEC 78 + 79 + #define CONFIG_LCD LCD_ILI9342 80 + 81 + /* Define this for LCD backlight available */ 82 + #define HAVE_BACKLIGHT 83 + #define HAVE_BACKLIGHT_BRIGHTNESS 84 + #define MIN_BRIGHTNESS_SETTING 0 85 + #define MAX_BRIGHTNESS_SETTING 31 86 + #define DEFAULT_BRIGHTNESS_SETTING 31 87 + #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG 88 + 89 + /* Define this if you have a software controlled poweroff */ 90 + #define HAVE_SW_POWEROFF 91 + 92 + /* The number of bytes reserved for loadable codecs */ 93 + #define CODEC_SIZE 0x100000 94 + 95 + /* The number of bytes reserved for loadable plugins */ 96 + #define PLUGIN_BUFFER_SIZE 0x80000 97 + 98 + /* TODO: Figure out real values */ 99 + #define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */ 100 + #define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */ 101 + #define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */ 102 + #define BATTERY_CAPACITY_INC 10 /* capacity increment */ 103 + #define BATTERY_TYPES_COUNT 1 /* only one type */ 104 + 105 + #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE 106 + 107 + /* Hardware controlled charging with monitoring */ 108 + #define CONFIG_CHARGING CHARGING_MONITOR 109 + 110 + /* USB On-the-go */ 111 + #define CONFIG_USBOTG USBOTG_RK27XX 112 + 113 + /* enable these for the experimental usb stack */ 114 + #define HAVE_USBSTACK 115 + 116 + #define USE_ROCKBOX_USB 117 + #define USB_VENDOR_ID 0x071b 118 + #define USB_PRODUCT_ID 0x3202 119 + #define HAVE_BOOTLOADER_USB_MODE 120 + 121 + /* Define this if your LCD can set contrast */ 122 + /* #define HAVE_LCD_CONTRAST */ 123 + 124 + /* The exact type of CPU */ 125 + #define CONFIG_CPU RK27XX 126 + 127 + /* I2C interface */ 128 + #define CONFIG_I2C I2C_RK27XX 129 + 130 + /* Define this to the CPU frequency */ 131 + #define CPU_FREQ 200000000 132 + 133 + /* define this if the hardware can be powered off while charging */ 134 + /* #define HAVE_POWEROFF_WHILE_CHARGING */ 135 + 136 + /* Offset ( in the firmware file's header ) to the file CRC */ 137 + #define FIRMWARE_OFFSET_FILE_CRC 0 138 + 139 + /* Offset ( in the firmware file's header ) to the real data */ 140 + #define FIRMWARE_OFFSET_FILE_DATA 8 141 + 142 + #define STORAGE_NEEDS_ALIGN 143 + 144 + /* Define this if you have adjustable CPU frequency */ 145 + #define HAVE_ADJUSTABLE_CPU_FREQ 146 + 147 + /* Virtual LED (icon) */ 148 + #define CONFIG_LED LED_VIRTUAL 149 + 150 + #define RKW_FORMAT 151 + #define BOOTFILE_EXT "rkw" 152 + #define BOOTFILE "rockbox." BOOTFILE_EXT 153 + #define BOOTDIR "/.rockbox"
+94
firmware/export/df1704.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * 11 + * Copyright (c) 2013 Andrew Ryabinin 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 + #ifndef _DF1704_H 24 + #define _DF1704_H 25 + 26 + #define DF1704_VOLUME_MIN -1270 27 + #define DF1704_VOLUME_MAX 0 28 + 29 + AUDIOHW_SETTING(VOLUME, "dB", 0, 1, DF1704_VOLUME_MIN/10, DF1704_VOLUME_MAX/10, 0) 30 + 31 + #define DF1704_MODE(x) (((x)&0x03)<<9) 32 + 33 + /** 34 + * MODE0 register settings 35 + */ 36 + /* Left channel attenuation data load control */ 37 + #define DF1704_LDL_ON (1<<8) 38 + #define DF1704_LDL_OFF (0<<8) 39 + 40 + /** 41 + * MODE1 register settings 42 + */ 43 + /* Right channel attenuation data load control */ 44 + #define DF1704_LDR_ON (1<<8) 45 + #define DF1704_LDR_OFF (0<<8) 46 + 47 + /** 48 + * MODE2 register settings 49 + */ 50 + #define DF1704_MUTE_ON (0<<0) 51 + #define DF1704_MUTE_OFF (1<<0) 52 + /* Digital De-Emphasis */ 53 + #define DF1704_DEM_ON (1<<1) 54 + #define DF1704_DEM_OFF (0<<1) 55 + /* Input data format & word lengths */ 56 + #define DF1704_IW_16_I2S (0<<3) 57 + #define DF1704_IW_24_I2S (1<<3) 58 + 59 + #define DF1704_IW_16_RJ (0<<3) 60 + #define DF1704_IW_20_RJ (1<<3) 61 + #define DF1704_IW_24_RJ (2<<3) 62 + #define DF1704_IW_24_LJ (3<<3) 63 + /* Output data format & word lengths */ 64 + #define DF1704_OW_16 (0<<5) 65 + #define DF1704_OW_18 (1<<5) 66 + #define DF1704_OW_20 (2<<5) 67 + #define DF1704_OW_24 (3<<5) 68 + 69 + /** 70 + * MODE3 register settings 71 + */ 72 + #define DF1704_I2S_OFF (0<<0) 73 + #define DF1704_I2S_ON (1<<0) 74 + #define DF1704_LRP_L (0<<1) 75 + #define DF1704_LRP_H (1<<1) 76 + #define DF1704_ATC_ON (1<<2) 77 + #define DF1704_ATC_OFF (0<<2) 78 + #define DF1704_SRO_SHARP (0<<3) 79 + #define DF1704_SRO_SLOW (1<<3) 80 + /* CLKO output frequency selection */ 81 + #define DF1704_CKO_FULL (0<<5) 82 + #define DF1704_CKO_HALF (1<<5) 83 + /* Sampling freq selection for the De-Emphasis */ 84 + #define DF1704_SF_44 (0<<6) 85 + #define DF1704_SF_32 (3<<6) 86 + #define DF1704_SF_48 (2<<6) 87 + 88 + void df1704_init(void); 89 + void df1704_mute(void); 90 + void df1704_set_ml(const int); 91 + void df1704_set_mc(const int); 92 + void df1704_set_md(const int); 93 + void df1704_set_ml_dir(const int); 94 + #endif
+49
firmware/export/pca9555.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 + #ifndef _PCA9555_H 23 + #define _PCA9555_H 24 + 25 + #include "pca9555-target.h" 26 + 27 + #define PCA9555_IN0_CMD 0 28 + #define PCA9555_IN1_CMD 1 29 + #define PCA9555_OUT0_CMD 2 30 + #define PCA9555_OUT1_CMD 3 31 + #define PCA9555_POL0_INV_CMD 4 32 + #define PCA9555_POL1_INV_CMD 5 33 + #define PCA9555_CFG0_CMD 6 34 + #define PCA9555_CFG1_CMD 7 35 + 36 + #define PCA9555_IN_CMD PCA9555_IN0_CMD 37 + #define PCA9555_OUT_CMD PCA9555_OUT0_CMD 38 + #define PCA9555_POL_INV_CMD PCA9555_POL0_INV_CMD 39 + #define PCA9555_CFG_CMD PCA9555_CFG0_CMD 40 + 41 + void pca9555_target_init(void); 42 + void pca9555_init(void); 43 + unsigned short pca9555_read_input(void); 44 + unsigned short pca9555_read_output(void); 45 + unsigned short pca9555_read_config(void); 46 + void pca9555_write_output(const unsigned short data, const unsigned short mask); 47 + void pca9555_write_config(const unsigned short data, const unsigned short mask); 48 + 49 + #endif
+7
firmware/target/arm/rk27xx/backlight-rk27xx.c
··· 61 61 562, 579, 596, 616, 637, 660, 684, 711, 62 62 739, 770, 802, 837, 874, 914, 955, 1000 63 63 }; 64 + #elif defined(MA9) 65 + static const unsigned short lin_brightness[] = { 66 + 2, 4, 7, 10, 15, 21, 28, 36, 67 + 46, 58, 72, 87, 104, 124, 146, 171, 68 + 198, 227, 260, 295, 334, 376, 421, 470, 69 + 522, 578, 638, 702, 770, 842, 918, 1000 70 + }; 64 71 #endif 65 72 66 73 bool _backlight_init(void)
+1 -1
firmware/target/arm/rk27xx/debug-rk27xx.c
··· 32 32 33 33 #ifdef RK27_GENERIC 34 34 #define DEBUG_CANCEL BUTTON_VOL 35 - #elif defined(HM60X) || defined(HM801) 35 + #elif defined(HM60X) || defined(HM801) || defined(MA9) 36 36 #define DEBUG_CANCEL BUTTON_LEFT 37 37 #endif 38 38
+1 -1
firmware/target/arm/rk27xx/lcdif-rk27xx.c
··· 56 56 /* g = ((data & 0x00000300) >> 2) | ((data & 0x000000e0) >> 3); */ 57 57 g = ((data & 0x00000300) << 6) | ((data & 0x000000e0) << 5); 58 58 b = (data & 0x00000001f) << 3; 59 - #elif defined(HM60X) || defined(HM801) 59 + #elif defined(HM60X) || defined(HM801) || defined(MA9) 60 60 /* 16 bit interface */ 61 61 r = (data & 0x0000f800) << 8; 62 62 g = (data & 0x000007e0) << 5;
+85
firmware/target/arm/rk27xx/ma/audio-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 "audiohw.h" 23 + #include "df1704.h" 24 + #include "pca9555.h" 25 + #include "i2c-rk27xx.h" 26 + #include "system.h" 27 + 28 + void df1704_set_ml_dir(const int dir) 29 + { 30 + pca9555_write_config(dir<<8, (1<<8)); 31 + } 32 + 33 + void df1704_set_ml(const int val) 34 + { 35 + pca9555_write_output(val<<8, 1<<8); 36 + } 37 + 38 + void df1704_set_mc(const int val) 39 + { 40 + pca9555_write_output(val<<1, 1<<1); 41 + } 42 + 43 + void df1704_set_md(const int val) 44 + { 45 + pca9555_write_output(val<<0, 1<<0); 46 + } 47 + 48 + static void pop_ctrl(const int val) 49 + { 50 + pca9555_write_output(val<<5, 1<<5); 51 + } 52 + 53 + static void amp_enable(const int val) 54 + { 55 + pca9555_write_output(val<<3, 1<<3); 56 + } 57 + 58 + static void df1704_enable(const int val) 59 + { 60 + pca9555_write_output(val<<4, 1<<4); 61 + } 62 + 63 + 64 + void audiohw_postinit(void) 65 + { 66 + pop_ctrl(0); 67 + sleep(HZ/4); 68 + df1704_enable(1); 69 + amp_enable(1); 70 + sleep(HZ/100); 71 + df1704_init(); 72 + sleep(HZ/4); 73 + pop_ctrl(1); 74 + } 75 + 76 + void audiohw_close(void) 77 + { 78 + df1704_mute(); 79 + pop_ctrl(0); 80 + sleep(HZ/5); 81 + amp_enable(0); 82 + df1704_enable(0); 83 + sleep(HZ/5); 84 + pop_ctrl(1); 85 + }
+74
firmware/target/arm/rk27xx/ma/button-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 "config.h" 23 + #include "system.h" 24 + #include "button.h" 25 + #include "adc.h" 26 + #include "backlight.h" 27 + #include "pca9555.h" 28 + 29 + extern unsigned short pca9555_in_ports; 30 + 31 + /* upper bounds of key's voltage values */ 32 + #define ADV_KEYUP 0x05B + 0x10 33 + #define ADV_KEYDOWN 0x0F3 + 0x10 34 + #define ADV_KEYLEFT 0x190 + 0x10 35 + #define ADV_KEYRIGHT 0x22C + 0x10 36 + #define ADV_KEYMENU 0x2CA + 0x10 37 + 38 + 39 + void button_init_device(void) { 40 + GPIO_PCCON &= ~(1<<1); 41 + pca9555_init(); 42 + } 43 + 44 + int button_read_device(void) { 45 + int adc_val = adc_read(ADC_BUTTONS); 46 + int button = 0; 47 + 48 + if (adc_val < ADV_KEYLEFT) { 49 + if (adc_val < ADV_KEYDOWN) { 50 + if (adc_val < ADV_KEYUP) { 51 + button = BUTTON_UP; 52 + } else { 53 + button = BUTTON_DOWN; 54 + } 55 + } else { 56 + button = BUTTON_LEFT; 57 + } 58 + } else { 59 + if (adc_val < ADV_KEYRIGHT) { 60 + button = BUTTON_RIGHT; 61 + } else if (adc_val < ADV_KEYMENU) { 62 + button = BUTTON_MENU; 63 + } 64 + } 65 + 66 + if (GPIO_PCDR & (1<<1)) { 67 + button |= BUTTON_PLAY; 68 + } 69 + if (((GPIO_PFDR&(1<<2)) == 0) && 70 + ((pca9555_in_ports & (1<<15)) == 0)) { 71 + button |= BUTTON_BACK; 72 + } 73 + return button; 74 + }
+40
firmware/target/arm/rk27xx/ma/button-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 + #ifndef _BUTTON_TARGET_H_ 23 + #define _BUTTON_TARGET_H_ 24 + 25 + #define BUTTON_UP 0x00000001 26 + #define BUTTON_DOWN 0x00000002 27 + #define BUTTON_LEFT 0x00000004 28 + #define BUTTON_RIGHT 0x00000008 29 + #define BUTTON_PLAY 0x00000010 30 + #define BUTTON_MENU 0x00000020 31 + #define BUTTON_BACK 0x00000040 32 + 33 + #define BUTTON_MAIN (BUTTON_UP|BUTTON_DOWN| \ 34 + BUTTON_RIGHT|BUTTON_LEFT| \ 35 + BUTTON_PLAY|BUTTON_MENU|BUTTON_BACK) 36 + 37 + #define POWEROFF_BUTTON BUTTON_PLAY 38 + #define POWEROFF_COUNT 30 39 + 40 + #endif /* _BUTTON_TARGET_H_ */
+206
firmware/target/arm/rk27xx/ma/lcd-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 11 + * 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 "kernel.h" 25 + #include "lcd.h" 26 + #include "system.h" 27 + #include "cpu.h" 28 + #include "lcdif-rk27xx.h" 29 + 30 + static bool display_on = false; 31 + 32 + 33 + void lcd_display_init(void) 34 + { 35 + int i; 36 + unsigned int x, y; 37 + 38 + lcd_cmd(0x00B9); 39 + lcd_data(0x00FF); 40 + lcd_data(0x0093); 41 + lcd_data(0x0042); 42 + 43 + lcd_cmd(0x0021); /* display inversion on ??? */ 44 + 45 + /* memory access control */ 46 + lcd_cmd(0x0036); 47 + lcd_data(0x00C9); 48 + 49 + /* set 16-bit pixel format */ 50 + lcd_cmd(0x003A); 51 + lcd_data(0x0005); 52 + 53 + /* Setup color depth conversion lookup table */ 54 + lcd_cmd(0x002D); 55 + /* red */ 56 + for(i = 0; i < 32; i++) 57 + lcd_data(2*i); 58 + /* green */ 59 + for(i = 0; i < 64; i++) 60 + lcd_data(1*i); 61 + /* blue */ 62 + for(i = 0; i < 32; i++) 63 + lcd_data(2*i); 64 + 65 + /* power control settings */ 66 + lcd_cmd(0x00C0); 67 + lcd_data(0x0025); /* VREG1OUT 4.70V */ 68 + lcd_data(0x000A); /* VCOM 2.8V */ 69 + 70 + lcd_cmd(0x00C1); 71 + lcd_data(0x0001); 72 + 73 + lcd_cmd(0x00C5); 74 + lcd_data(0x002F); 75 + lcd_data(0x0027); 76 + 77 + lcd_cmd(0x00C7); 78 + lcd_data(0x00D3); 79 + 80 + lcd_cmd(0x00B8); 81 + lcd_data(0x000B); 82 + 83 + /* Positive gamma correction */ 84 + lcd_cmd(0x00E0); 85 + lcd_data(0x000F); 86 + lcd_data(0x0022); 87 + lcd_data(0x001D); 88 + lcd_data(0x000B); 89 + lcd_data(0x000F); 90 + lcd_data(0x0007); 91 + lcd_data(0x004C); 92 + lcd_data(0x0076); 93 + lcd_data(0x003C); 94 + lcd_data(0x0009); 95 + lcd_data(0x0016); 96 + lcd_data(0x0007); 97 + lcd_data(0x0012); 98 + lcd_data(0x000B); 99 + lcd_data(0x0008); 100 + 101 + /* Negative Gamma Correction */ 102 + lcd_cmd(0x00E1); 103 + lcd_data(0x0008); 104 + lcd_data(0x001F); 105 + lcd_data(0x0024); 106 + lcd_data(0x0003); 107 + lcd_data(0x000E); 108 + lcd_data(0x0003); 109 + lcd_data(0x0035); 110 + lcd_data(0x0023); 111 + lcd_data(0x0045); 112 + lcd_data(0x0001); 113 + lcd_data(0x000B); 114 + lcd_data(0x0007); 115 + lcd_data(0x002F); 116 + lcd_data(0x0036); 117 + lcd_data(0x000F); 118 + 119 + lcd_cmd(0x00F2); 120 + lcd_data(0x0000); 121 + 122 + /* exit sleep */ 123 + lcd_cmd(0x0011); 124 + udelay(5000); 125 + lcd_cmd(0x0029); 126 + 127 + lcd_cmd(0x002C); 128 + for (x = 0; x < LCD_WIDTH; x++) 129 + for(y=0; y < LCD_HEIGHT; y++) 130 + lcd_data(0x00); 131 + 132 + display_on = true; 133 + } 134 + 135 + void lcd_enable (bool on) 136 + { 137 + if (on == display_on) 138 + return; 139 + 140 + lcdctrl_bypass(1); 141 + LCDC_CTRL |= RGB24B; 142 + 143 + if (on) { 144 + lcd_cmd(0x11); 145 + } else { 146 + lcd_cmd(0x10); 147 + } 148 + udelay(5000); 149 + 150 + display_on = on; 151 + LCDC_CTRL &= ~RGB24B; 152 + } 153 + 154 + void lcd_set_gram_area(int x, int y, int width, int height) 155 + { 156 + lcdctrl_bypass(1); 157 + LCDC_CTRL |= RGB24B; 158 + 159 + lcd_cmd(0x002A); 160 + lcd_data((x&0xff00)>>8); 161 + lcd_data(x&0x00ff); 162 + lcd_data(((width-1)&0xff00)>>8); 163 + lcd_data((width-1)&0x00ff); 164 + lcd_cmd(0x002B); 165 + lcd_data((y&0xff00)>>8); 166 + lcd_data(y&0x00ff); 167 + lcd_data(((height-1)&0xff00)>>8); 168 + lcd_data((height-1)&0x00ff); 169 + 170 + lcd_cmd(0x2c); 171 + LCDC_CTRL &= ~RGB24B; 172 + } 173 + 174 + void lcd_update_rect(int x, int y, int width, int height) 175 + { 176 + int px = x, py = y; 177 + int pxmax = x + width, pymax = y + height; 178 + 179 + lcd_set_gram_area(x, y, pxmax, pymax); 180 + 181 + for (py = y; py < pymax; py++) 182 + for (px = x; px < pxmax; px++) 183 + LCD_DATA = (*FBADDR(px, py)); 184 + 185 + } 186 + 187 + 188 + bool lcd_active() 189 + { 190 + return display_on; 191 + } 192 + 193 + /* Blit a YUV bitmap directly to the LCD */ 194 + void lcd_blit_yuv(unsigned char * const src[3], 195 + int src_x, int src_y, int stride, 196 + int x, int y, int width, int height) 197 + { 198 + (void)src; 199 + (void)src_x; 200 + (void)src_y; 201 + (void)stride; 202 + (void)x; 203 + (void)y; 204 + (void)width; 205 + (void)height; 206 + }
+27
firmware/target/arm/rk27xx/ma/lcd-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 11 + * 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 + #ifndef LCD_TARGET_H 23 + #define LCD_TARGET_H 24 + 25 + #define LCD_DATABUS_WIDTH LCDIF_16BIT 26 + 27 + #endif
+93
firmware/target/arm/rk27xx/ma/pca9555-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 "system.h" 23 + #include "i2c-rk27xx.h" 24 + #include "pca9555.h" 25 + 26 + static struct semaphore pca9555_sem; 27 + static char pca9555_thread_stack[DEFAULT_STACK_SIZE]; 28 + volatile unsigned short pca9555_in_ports; 29 + 30 + void INT_GPIO1(void) 31 + { 32 + if (GPIO1_ISR & (1<<10)) { /* GPIO F2 pin */ 33 + GPIO_IEF &= ~(1<<2); 34 + GPIO_ICF |= (1<<2); 35 + semaphore_release(&pca9555_sem); 36 + } 37 + } 38 + 39 + static void pca9555_read_thread(void) 40 + { 41 + while(1) { 42 + if ((GPIO_PFDR&(1<<2)) == 0) { 43 + pca9555_in_ports = pca9555_read_input(); 44 + } else { 45 + pca9555_in_ports = (1<<15)|(1<<11); /* restore defaults */ 46 + } 47 + sleep(HZ/20); 48 + GPIO_IEF |= (1<<2); 49 + semaphore_wait(&pca9555_sem, TIMEOUT_BLOCK); 50 + } 51 + } 52 + 53 + static void pca9555_ports_init(void) 54 + { 55 + unsigned short data = 0; 56 + 57 + data = 0xf800; /* port0 - pins 0-7 output, port1 - pins 0-2 output, pins 3-7 input */ 58 + pca9555_write_config(data, 0xffff); 59 + 60 + /* 61 + * IO0-7 IO0-6 IO0-5 IO0_4 IO0_3 IO0_2 IO0_1 IO0_0 62 + * USB_SEL KP_LED POP DAC_EN AMP_EN SPI_CS SPI_CLK SPI_DATA 63 + * 1:MSD 1:OFF 1 0 0 1 1 1 64 + */ 65 + data = ((1<<7)|(1<<6)|(1<<5)|(0<<4)|(0<<3)|(1<<2)|(1<<1)|(1<<0)); 66 + 67 + /* 68 + * IO1-2 IO1_1 IO1_0 69 + * CHG_EN DAC_EN DF1704_CS 70 + * 1 0 1 71 + */ 72 + data |= ((1<<10)|(0<<9)|(1<<8)); 73 + pca9555_write_output(data, 0xffff); 74 + } 75 + 76 + void pca9555_target_init(void) 77 + { 78 + GPIO_PFCON &= ~(1<<2); /* PF2 for PCA9555 input INT */ 79 + 80 + pca9555_ports_init(); 81 + semaphore_init(&pca9555_sem, 1, 0); 82 + 83 + INTC_IMR |= IRQ_ARM_GPIO1; 84 + INTC_IECR |= IRQ_ARM_GPIO1; 85 + GPIO_ISF |= (1<<2); 86 + 87 + create_thread(pca9555_read_thread, 88 + pca9555_thread_stack, 89 + sizeof(pca9555_thread_stack), 90 + 0, 91 + "pca9555_read" IF_PRIO(, PRIORITY_SYSTEM) 92 + IF_COP(, CPU)); 93 + }
+27
firmware/target/arm/rk27xx/ma/pca9555-target.h
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright (C) 2013 Andrew Ryabinin 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 + #ifndef _PCA9555_TARGET_H 23 + #define _PCA9555_TARGET_H 24 + 25 + #define PCA9555_I2C_ADDR 0x40 26 + 27 + #endif
+58
firmware/target/arm/rk27xx/ma/power-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright © 2013 Andrew Ryabinin 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 <stdbool.h> 23 + #include "config.h" 24 + #include "inttypes.h" 25 + #include "power.h" 26 + #include "panic.h" 27 + #include "system.h" 28 + #include "usb_core.h" /* for usb_charging_maxcurrent_change */ 29 + 30 + void power_off(void) 31 + { 32 + GPIO_PCDR |= (1<<0); 33 + GPIO_PCCON &= ~(1<<0); 34 + while(1); 35 + } 36 + 37 + void power_init(void) 38 + { 39 + GPIO_PCDR |= (1<<0); 40 + GPIO_PCCON |= (1<<0); 41 + } 42 + 43 + unsigned int power_input_status(void) 44 + { 45 + unsigned int status = POWER_INPUT_NONE; 46 + 47 + if (charging_state()) 48 + status |= POWER_INPUT_MAIN_CHARGER; 49 + return status; 50 + } 51 + 52 + extern unsigned short pca9555_in_ports; 53 + 54 + bool charging_state(void) 55 + { 56 + return (((GPIO_PFDR&(1<<2)) == 0) && ((pca9555_in_ports&(1<<11)) == 0)); 57 + } 58 +
+61
firmware/target/arm/rk27xx/ma/powermgmt-ma.c
··· 1 + /*************************************************************************** 2 + * __________ __ ___. 3 + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 + * \/ \/ \/ \/ \/ 8 + * $Id$ 9 + * 10 + * Copyright © 2013 Andrew Ryabinin 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 "config.h" 23 + #include "adc.h" 24 + #include "adc-target.h" 25 + #include "powermgmt.h" 26 + 27 + /** 28 + * Battery voltage calculation and discharge/charge curves for the HiFi E.T MA9. 29 + */ 30 + 31 + const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 32 + { 33 + /* TODO: this is just an initial guess */ 34 + 6700 35 + }; 36 + 37 + const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 38 + { 39 + 6600 40 + }; 41 + 42 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 43 + const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 44 + { 45 + /* Uncalibrated curve */ 46 + { 6600, 6936, 7042, 7124, 7218, 7288, 7382, 7534, 7674, 7838, 8200 } 47 + }; 48 + 49 + /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 50 + const unsigned short percent_to_volt_charge[11] = 51 + /* TODO: simple copy of discharge curve */ 52 + { 6600, 6936, 7042, 7124, 7218, 7288, 7382, 7534, 7674, 7838, 8200 }; 53 + 54 + /* full-scale ADC readout (2^10) in millivolt */ 55 + #define BATTERY_SCALE_FACTOR 9170 56 + 57 + /* Returns battery voltage from ADC [millivolts] */ 58 + int _battery_voltage(void) 59 + { 60 + return (adc_read(ADC_BATTERY) * BATTERY_SCALE_FACTOR) >> 10; 61 + }
+2
firmware/target/arm/rk27xx/sd-rk27xx.c
··· 132 132 return !(GPIO_PCDR & 0x80); 133 133 #elif defined(HM60X) || defined(HM801) 134 134 return !(GPIO_PFDR & (1<<2)); 135 + #elif defined(MA9) 136 + return (GPIO_PCDR & 0x80); 135 137 #else 136 138 #error "Unknown target" 137 139 #endif
+25 -2
tools/configure
··· 1328 1328 201) Android ==ROCKCHIP== 1329 1329 202) Nokia N8xx 180) rk27xx generic ==HiFiMAN== 1330 1330 203) Nokia N900 190) HM-60x 1331 - 204) Pandora 191) HM-801 1332 - 205) Samsung YP-R0 1331 + 204) Pandora ==HiFi E.T.== 191) HM-801 1332 + 205) Samsung YP-R0 210) MA9 1333 1333 206) Android MIPS 1334 1334 207) Android x86 1335 1335 EOF ··· 3409 3409 t_cpu="hosted" 3410 3410 t_manufacturer="android" 3411 3411 t_model="app" 3412 + ;; 3413 + 3414 + 210|hifietma9) 3415 + target_id=83 3416 + modelname="hifietma9" 3417 + target="MA9" 3418 + memory=16 3419 + arm7ejscc 3420 + tool="$rootdir/tools/scramble -rkw -modelnum=83" 3421 + bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 3422 + bmp2rb_native="$rootdir/tools/bmp2rb -f 4" 3423 + output="rockbox.rkw" 3424 + bootoutput="bootloader.rkw" 3425 + appextra="recorder:gui" 3426 + plugins="" 3427 + swcodec="yes" 3428 + # toolset is the tools within the tools directory that we build for 3429 + # this particular target. 3430 + toolset="$genericbitmaptools" 3431 + # architecture, manufacturer and model for the target-tree build 3432 + t_cpu="arm" 3433 + t_manufacturer="rk27xx" 3434 + t_model="ma" 3412 3435 ;; 3413 3436 3414 3437 *)