summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/keymaps/keymap-hm801.c108
-rw-r--r--bootloader/SOURCES2
-rw-r--r--firmware/SOURCES15
-rw-r--r--firmware/drivers/audio/dummy_codec.c (renamed from firmware/drivers/audio/tda1543.c)0
-rw-r--r--firmware/export/audiohw.h4
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/export/config/hifimanhm60x.h2
-rw-r--r--firmware/export/config/hifimanhm801.h171
-rw-r--r--firmware/export/dummy_codec.h (renamed from firmware/export/tda1543.h)6
-rw-r--r--firmware/target/arm/rk27xx/debug-target.h2
-rw-r--r--firmware/target/arm/rk27xx/hm801/button-hm801.c68
-rw-r--r--firmware/target/arm/rk27xx/hm801/button-target.h47
-rw-r--r--firmware/target/arm/rk27xx/hm801/power-hm801.c49
-rw-r--r--firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c60
-rw-r--r--firmware/target/arm/rk27xx/lcd-hifiman.c (renamed from firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c)0
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.c2
-rw-r--r--firmware/target/arm/rk27xx/sd-rk27xx.c8
-rwxr-xr-xtools/configure24
19 files changed, 560 insertions, 13 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 78a1bfeb5d..0734d3475a 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -327,5 +327,7 @@ keymaps/keymap-fuzeplus.c
327keymaps/keymap-rk27xx-generic.c 327keymaps/keymap-rk27xx-generic.c
328#elif CONFIG_KEYPAD == HM60X_PAD 328#elif CONFIG_KEYPAD == HM60X_PAD
329keymaps/keymap-hm60x.c 329keymaps/keymap-hm60x.c
330#elif CONFIG_KEYPAD == HM801_PAD
331keymaps/keymap-hm801.c
330#endif 332#endif
331 333
diff --git a/apps/keymaps/keymap-hm801.c b/apps/keymaps/keymap-hm801.c
new file mode 100644
index 0000000000..78221e5fee
--- /dev/null
+++ b/apps/keymaps/keymap-hm801.c
@@ -0,0 +1,108 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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 HiFiMAN HM-801 reference design target */
23
24#include "config.h"
25#include "action.h"
26#include "button.h"
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 */
34static 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 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
38 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
39
40 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
41 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
42 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
43 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
44 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
45 { ACTION_STD_MENU, BUTTON_RIGHT, BUTTON_NONE },
46
47 LAST_ITEM_IN_LIST
48}; /* button_context_standard */
49
50static const struct button_mapping button_context_wps[] = {
51 { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
52 { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
53 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
54 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
56 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
57 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
59
60 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
61 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
62 { ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
63 { ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
64 { ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
65 { ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
66 { ACTION_WPS_SEEKFWD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
67 { ACTION_WPS_STOPSEEK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT },
68
69 { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
70 { ACTION_WPS_CONTEXT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
71 { ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
72 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
73
74 LAST_ITEM_IN_LIST
75}; /* button_context_wps */
76
77static const struct button_mapping button_context_yesnoscreen[] = {
78 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
79 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
80 LAST_ITEM_IN_LIST
81}; /* button_context_settings_yesnoscreen */
82
83
84
85
86/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
87const struct button_mapping* get_context_mapping(int context)
88{
89 switch (context)
90 {
91 case CONTEXT_STD:
92 return button_context_standard;
93 case CONTEXT_WPS:
94 return button_context_wps;
95 case CONTEXT_YESNOSCREEN:
96 return button_context_yesnoscreen;
97
98 case CONTEXT_TREE:
99 case CONTEXT_LIST:
100 case CONTEXT_MAINMENU:
101
102 case CONTEXT_SETTINGS:
103 case CONTEXT_SETTINGS|CONTEXT_REMOTE:
104 default:
105 return button_context_standard;
106 }
107 return button_context_standard;
108}
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index d1d659837d..1725939fa3 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -67,7 +67,7 @@ main-pp.c
67show_logo.c 67show_logo.c
68#elif defined(MPIO_HD200) || defined(MPIO_HD300) 68#elif defined(MPIO_HD200) || defined(MPIO_HD300)
69mpio_hd200_hd300.c 69mpio_hd200_hd300.c
70#elif defined(RK27_GENERIC) || defined(HM60X) 70#elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801)
71rk27xx.c 71rk27xx.c
72show_logo.c 72show_logo.c
73#endif 73#endif
diff --git a/firmware/SOURCES b/firmware/SOURCES
index b729a9b064..e7d882082c 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -355,8 +355,8 @@ drivers/audio/uda1341.c
355drivers/audio/cs42l55.c 355drivers/audio/cs42l55.c
356#elif defined (HAVE_RK27XX_CODEC) 356#elif defined (HAVE_RK27XX_CODEC)
357drivers/audio/rk27xx_codec.c 357drivers/audio/rk27xx_codec.c
358#elif defined (HAVE_TDA1543) 358#elif defined (HAVE_DUMMY_CODEC)
359drivers/audio/tda1543.c 359drivers/audio/dummy_codec.c
360#endif /* defined(HAVE_*) */ 360#endif /* defined(HAVE_*) */
361#elif defined(HAVE_SDL_AUDIO) 361#elif defined(HAVE_SDL_AUDIO)
362drivers/audio/sdl.c 362drivers/audio/sdl.c
@@ -1925,6 +1925,15 @@ thread.c
1925target/arm/rk27xx/hm60x/button-hm60x.c 1925target/arm/rk27xx/hm60x/button-hm60x.c
1926target/arm/rk27xx/hm60x/powermgmt-hm60x.c 1926target/arm/rk27xx/hm60x/powermgmt-hm60x.c
1927target/arm/rk27xx/hm60x/power-hm60x.c 1927target/arm/rk27xx/hm60x/power-hm60x.c
1928target/arm/rk27xx/hm60x/lcd-hm60x.c 1928target/arm/rk27xx/lcd-hifiman.c
1929#endif
1930#endif
1931
1932#ifndef SIMULATOR
1933#if defined(HM801)
1934target/arm/rk27xx/hm801/button-hm801.c
1935target/arm/rk27xx/hm801/powermgmt-hm801.c
1936target/arm/rk27xx/hm801/power-hm801.c
1937target/arm/rk27xx/lcd-hifiman.c
1929#endif 1938#endif
1930#endif 1939#endif
diff --git a/firmware/drivers/audio/tda1543.c b/firmware/drivers/audio/dummy_codec.c
index ca51d95265..ca51d95265 100644
--- a/firmware/drivers/audio/tda1543.c
+++ b/firmware/drivers/audio/dummy_codec.c
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index e40ee6ee79..6bf4d71810 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -74,8 +74,8 @@
74#include "cs42l55.h" 74#include "cs42l55.h"
75#elif defined(HAVE_IMX233_CODEC) 75#elif defined(HAVE_IMX233_CODEC)
76#include "imx233-codec.h" 76#include "imx233-codec.h"
77#elif defined(HAVE_TDA1543) 77#elif defined(HAVE_DUMMY_CODEC)
78#include "tda1543.h" 78#include "dummy_codec.h"
79#endif 79#endif
80#if (CONFIG_PLATFORM & PLATFORM_HOSTED) 80#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
81/* #include <SDL_audio.h> gives errors in other code areas, 81/* #include <SDL_audio.h> gives errors in other code areas,
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0d0617bb13..65c27ce5e0 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -141,6 +141,7 @@
141#define SANSA_FUZEPLUS_PAD 48 141#define SANSA_FUZEPLUS_PAD 48
142#define RK27XX_GENERIC_PAD 49 142#define RK27XX_GENERIC_PAD 49
143#define HM60X_PAD 50 143#define HM60X_PAD 50
144#define HM801_PAD 51
144 145
145/* CONFIG_REMOTE_KEYPAD */ 146/* CONFIG_REMOTE_KEYPAD */
146#define H100_REMOTE 1 147#define H100_REMOTE 1
@@ -463,6 +464,8 @@ Lyre prototype 1 */
463#include "config/rk27generic.h" 464#include "config/rk27generic.h"
464#elif defined(HM60X) 465#elif defined(HM60X)
465#include "config/hifimanhm60x.h" 466#include "config/hifimanhm60x.h"
467#elif defined(HM801)
468#include "config/hifimanhm801.h"
466#elif defined(SDLAPP) 469#elif defined(SDLAPP)
467#include "config/sdlapp.h" 470#include "config/sdlapp.h"
468#elif defined(ANDROID) 471#elif defined(ANDROID)
diff --git a/firmware/export/config/hifimanhm60x.h b/firmware/export/config/hifimanhm60x.h
index 88af364bc9..6ac43803f3 100644
--- a/firmware/export/config/hifimanhm60x.h
+++ b/firmware/export/config/hifimanhm60x.h
@@ -17,7 +17,7 @@
17 SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \ 17 SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \
18 SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8) 18 SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
19 19
20#define HAVE_TDA1543 20#define HAVE_DUMMY_CODEC
21#define CODEC_SLAVE 21#define CODEC_SLAVE
22/* define this if you have a bitmap LCD display */ 22/* define this if you have a bitmap LCD display */
23#define HAVE_LCD_BITMAP 23#define HAVE_LCD_BITMAP
diff --git a/firmware/export/config/hifimanhm801.h b/firmware/export/config/hifimanhm801.h
new file mode 100644
index 0000000000..d0e805d7c6
--- /dev/null
+++ b/firmware/export/config/hifimanhm801.h
@@ -0,0 +1,171 @@
1/*
2 * This config file is for HiFiMAN HM-60x reference design
3 */
4#define TARGET_TREE /* this target is using the target tree system */
5
6/* For Rolo and boot loader */
7#define MODEL_NUMBER 80
8
9#define MODEL_NAME "HiFiMAN HM-801"
10
11
12/* define the bitmask of hardware sample rates */
13#define HW_SAMPR_CAPS (SAMPR_CAP_96 | SAMPR_CAP_48 | SAMPR_CAP_44 | \
14 SAMPR_CAP_32 | SAMPR_CAP_24 | SAMPR_CAP_22 | \
15 SAMPR_CAP_16 | SAMPR_CAP_12 | SAMPR_CAP_11 | SAMPR_CAP_8)
16
17#define HAVE_DUMMY_CODEC
18#define CODEC_SLAVE
19/* define this if you have a bitmap LCD display */
20#define HAVE_LCD_BITMAP
21
22/* define this if you can flip your LCD */
23/* #define HAVE_LCD_FLIP */
24
25/* define this if you have a colour LCD */
26#define HAVE_LCD_COLOR
27
28/* define this if you want album art for this target */
29#define HAVE_ALBUMART
30
31/* define this to enable bitmap scaling */
32#define HAVE_BMP_SCALING
33
34/* define this to enable JPEG decoding */
35#define HAVE_JPEG
36
37/* define this if you can invert the colours on your LCD */
38/* #define HAVE_LCD_INVERT */
39
40/* define this if you have access to the quickscreen */
41#define HAVE_QUICKSCREEN
42
43/* define this if you have access to the pitchscreen */
44#define HAVE_PITCHSCREEN
45
46/* define this if you would like tagcache to build on this target */
47#define HAVE_TAGCACHE
48
49/* define this if you have a flash memory storage */
50#define HAVE_FLASH_STORAGE
51
52#define CONFIG_STORAGE (STORAGE_SD | STORAGE_NAND)
53
54#define CONFIG_NAND NAND_RK27XX
55#define HAVE_SW_TONE_CONTROLS
56
57/* commented for now */
58/* #define HAVE_HOTSWAP */
59
60#define NUM_DRIVES 2
61#define SECTOR_SIZE 512
62
63/* for small(ish) SD cards */
64#define HAVE_FAT16SUPPORT
65
66/* LCD dimensions */
67#define LCD_WIDTH 220
68#define LCD_HEIGHT 176
69#define LCD_DEPTH 16 /* pseudo 262.144 colors */
70#define LCD_PIXELFORMAT RGB565 /* rgb565 */
71
72/* Define this if the LCD can shut down */
73/* #define HAVE_LCD_SHUTDOWN */
74
75/* Define this if your LCD can be enabled/disabled */
76/* #define HAVE_LCD_ENABLE */
77
78/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
79 should be defined as well. */
80#ifndef BOOTLOADER
81/* TODO: #define HAVE_LCD_SLEEP */
82/* TODO: #define HAVE_LCD_SLEEP_SETTING */
83#endif
84
85#define CONFIG_KEYPAD HM801_PAD
86
87/* Define this to enable morse code input */
88#define HAVE_MORSE_INPUT
89
90/* Define this if you do software codec */
91#define CONFIG_CODEC SWCODEC
92
93#define CONFIG_LCD LCD_HX8340B
94
95/* #define HAVE_PCM_DMA_ADDRESS */
96
97/* Define this for LCD backlight available */
98#define HAVE_BACKLIGHT
99#define HAVE_BACKLIGHT_BRIGHTNESS
100#define MIN_BRIGHTNESS_SETTING 0
101#define MAX_BRIGHTNESS_SETTING 31
102#define DEFAULT_BRIGHTNESS_SETTING 20
103#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
104
105/* Define this if you have a software controlled poweroff */
106#define HAVE_SW_POWEROFF
107
108/* The number of bytes reserved for loadable codecs */
109#define CODEC_SIZE 0x100000
110
111/* The number of bytes reserved for loadable plugins */
112#define PLUGIN_BUFFER_SIZE 0x80000
113
114/* TODO: Figure out real values */
115#define BATTERY_CAPACITY_DEFAULT 4000 /* default battery capacity */
116#define BATTERY_CAPACITY_MIN 3000 /* min. capacity selectable */
117#define BATTERY_CAPACITY_MAX 4100 /* max. capacity selectable */
118#define BATTERY_CAPACITY_INC 50 /* capacity increment */
119#define BATTERY_TYPES_COUNT 1 /* only one type */
120
121/* Hardware controlled charging with monitoring */
122#define CONFIG_CHARGING CHARGING_MONITOR
123
124/* define current usage levels */
125/* TODO: #define CURRENT_NORMAL
126 * TODO: #define CURRENT_BACKLIGHT 23
127 */
128
129/* define this if the unit can be powered or charged via USB */
130#define HAVE_USB_POWER
131
132/* USB On-the-go */
133#define CONFIG_USBOTG USBOTG_RK27XX
134
135/* enable these for the experimental usb stack */
136#define HAVE_USBSTACK
137
138#define USE_ROCKBOX_USB
139#define USB_VENDOR_ID 0x071b
140#define USB_PRODUCT_ID 0x3202
141#define HAVE_BOOTLOADER_USB_MODE
142
143/* Define this if your LCD can set contrast */
144/* #define HAVE_LCD_CONTRAST */
145
146/* The exact type of CPU */
147#define CONFIG_CPU RK27XX
148
149/* I2C interface */
150#define CONFIG_I2C I2C_RK27XX
151
152/* Define this to the CPU frequency */
153#define CPU_FREQ 200000000
154
155/* define this if the hardware can be powered off while charging */
156/* #define HAVE_POWEROFF_WHILE_CHARGING */
157
158/* Offset ( in the firmware file's header ) to the file CRC */
159#define FIRMWARE_OFFSET_FILE_CRC 0
160
161/* Offset ( in the firmware file's header ) to the real data */
162#define FIRMWARE_OFFSET_FILE_DATA 8
163
164#define STORAGE_NEEDS_ALIGN
165
166/* Define this if you have adjustable CPU frequency */
167/* #define HAVE_ADJUSTABLE_CPU_FREQ */
168
169#define BOOTFILE_EXT "rk27"
170#define BOOTFILE "rockbox." BOOTFILE_EXT
171#define BOOTDIR "/.rockbox"
diff --git a/firmware/export/tda1543.h b/firmware/export/dummy_codec.h
index 6561f0823a..b85ec8fb0e 100644
--- a/firmware/export/tda1543.h
+++ b/firmware/export/dummy_codec.h
@@ -19,11 +19,11 @@
19 * KIND, either express or implied. 19 * KIND, either express or implied.
20 * 20 *
21 ****************************************************************************/ 21 ****************************************************************************/
22#ifndef __TDA1543_H_ 22#ifndef __DUMMY_CODEC_H_
23#define __TDA1543_H_ 23#define __DUMMY_CODEC_H_
24 24
25#define VOLUME_MIN -1 25#define VOLUME_MIN -1
26#define VOLUME_MAX 0 26#define VOLUME_MAX 0
27 27
28 28
29#endif /* __TDA1543_H_ */ 29#endif /* __DUMMY_CODEC_H_ */
diff --git a/firmware/target/arm/rk27xx/debug-target.h b/firmware/target/arm/rk27xx/debug-target.h
index c083b9282a..fb4abaeed7 100644
--- a/firmware/target/arm/rk27xx/debug-target.h
+++ b/firmware/target/arm/rk27xx/debug-target.h
@@ -26,7 +26,7 @@
26 26
27#ifdef RK27_GENERIC 27#ifdef RK27_GENERIC
28#define DEBUG_CANCEL BUTTON_VOL 28#define DEBUG_CANCEL BUTTON_VOL
29#elif defined(HM60X) 29#elif defined(HM60X) || defined(HM801)
30#define DEBUG_CANCEL BUTTON_LEFT 30#define DEBUG_CANCEL BUTTON_LEFT
31#endif 31#endif
32 32
diff --git a/firmware/target/arm/rk27xx/hm801/button-hm801.c b/firmware/target/arm/rk27xx/hm801/button-hm801.c
new file mode 100644
index 0000000000..8e3d46bf0d
--- /dev/null
+++ b/firmware/target/arm/rk27xx/hm801/button-hm801.c
@@ -0,0 +1,68 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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
27void button_init_device(void) {
28 /* setup button gpio as input */
29 GPIO_PCCON &= ~(POWEROFF_BUTTON);
30}
31
32int button_read_device(void) {
33 int adc_val = adc_read(ADC_BUTTONS);
34 int button = 0;
35
36 if (adc_val < 480) { /* middle */
37 if (adc_val < 200) { /* 200 - 0 */
38 if (adc_val < 30) {
39 button = BUTTON_UP;
40 } else {
41 button = BUTTON_RIGHT; /* 30 - 200 */
42 }
43 } else { /* 200 - 480 */
44 if (adc_val < 370) {
45 button = BUTTON_SELECT;
46 } else {
47 button = BUTTON_DOWN;
48 }
49 }
50 } else { /* > 480 */
51 if (adc_val < 690) { /* 480 - 690 */
52 if (adc_val < 580) {
53 button = BUTTON_LEFT;
54 } else {
55 button = BUTTON_NEXT;
56 }
57 } else { /* > 680 */
58 if (adc_val < 840) {
59 button = BUTTON_PREV;
60 } else {
61 if (adc_val < 920) {
62 button = BUTTON_PLAY;
63 }
64 }
65 }
66 }
67 return button | (GPIO_PCDR & POWEROFF_BUTTON);
68}
diff --git a/firmware/target/arm/rk27xx/hm801/button-target.h b/firmware/target/arm/rk27xx/hm801/button-target.h
new file mode 100644
index 0000000000..4af054b07c
--- /dev/null
+++ b/firmware/target/arm/rk27xx/hm801/button-target.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2011 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#ifndef _BUTTON_TARGET_H_
22#define _BUTTON_TARGET_H_
23
24#include <stdbool.h>
25#include "config.h"
26
27void button_init_device(void);
28int button_read_device(void);
29
30
31#define BUTTON_UP 0x00000001
32#define BUTTON_DOWN 0x00000004
33#define BUTTON_LEFT 0x00000008
34#define BUTTON_RIGHT 0x00000010
35#define BUTTON_SELECT 0x00000020
36#define BUTTON_NEXT 0x00000040
37#define BUTTON_PREV 0x00000080
38#define BUTTON_PLAY 0x00000100
39
40
41#define BUTTON_REMOTE 0
42
43
44#define POWEROFF_BUTTON 0x02
45#define POWEROFF_COUNT 30
46
47#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/rk27xx/hm801/power-hm801.c b/firmware/target/arm/rk27xx/hm801/power-hm801.c
new file mode 100644
index 0000000000..18a0566a78
--- /dev/null
+++ b/firmware/target/arm/rk27xx/hm801/power-hm801.c
@@ -0,0 +1,49 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2009 Bertrik Sikken
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 <stdbool.h>
22#include "config.h"
23#include "inttypes.h"
24#include "power.h"
25#include "panic.h"
26#include "system.h"
27#include "usb_core.h" /* for usb_charging_maxcurrent_change */
28
29void power_off(void)
30{
31 GPIO_PCDR &= ~(1<<0);
32 while(1);
33}
34
35void power_init(void)
36{
37 GPIO_PCDR |= (1<<0);
38 GPIO_PCCON |= (1<<0);
39}
40
41unsigned int power_input_status(void)
42{
43 return (usb_detect() == USB_INSERTED) ? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
44}
45
46bool charging_state(void)
47{
48 return true;
49}
diff --git a/firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c b/firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c
new file mode 100644
index 0000000000..a815d893b2
--- /dev/null
+++ b/firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c
@@ -0,0 +1,60 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2011 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/* Battery voltage calculation and discharge/charge curves for the HiFiMAN HM-801.
28
29 I don't know how to calculate battery voltage, so all values represented here is just
30 values from adc battery channel, not millivolts.
31 Discharge and charge curves have not been calibrated yet.
32*/
33
34const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
35{
36 /* OF power off device when this value reached */
37 430
38};
39
40const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
41{
42 425
43};
44
45/* adc values of 0%, 10%, ... 100% when charging disabled */
46const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
47{
48 /* TODO: simple uncalibrated curve */
49 { 425, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520 }
50};
51
52/* adc values of 0%, 10%, ... 100% when charging enabled */
53const unsigned short percent_to_volt_charge[11] =
54 /* TODO: simple uncalibrated curve */
55 { 425, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520 };
56
57unsigned int battery_adc_voltage(void)
58{
59 return adc_read(ADC_BATTERY);
60}
diff --git a/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
index 932154da8d..932154da8d 100644
--- a/firmware/target/arm/rk27xx/hm60x/lcd-hm60x.c
+++ b/firmware/target/arm/rk27xx/lcd-hifiman.c
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
index aeee63ee7e..a5e18b0800 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
@@ -37,7 +37,7 @@ unsigned int lcd_data_transform(unsigned int data)
37 /* g = ((data & 0x00000300) >> 2) | ((data & 0x000000e0) >> 3); */ 37 /* g = ((data & 0x00000300) >> 2) | ((data & 0x000000e0) >> 3); */
38 g = ((data & 0x00000300) << 6) | ((data & 0x000000e0) << 5); 38 g = ((data & 0x00000300) << 6) | ((data & 0x000000e0) << 5);
39 b = (data & 0x00000001f) << 3; 39 b = (data & 0x00000001f) << 3;
40#elif defined(HM60X) 40#elif defined(HM60X) || defined(HM801)
41 /* 16 bit interface */ 41 /* 16 bit interface */
42 r = (data & 0x0000f800) << 8; 42 r = (data & 0x0000f800) << 8;
43 g = (data & 0x000007e0) << 5; 43 g = (data & 0x000007e0) << 5;
diff --git a/firmware/target/arm/rk27xx/sd-rk27xx.c b/firmware/target/arm/rk27xx/sd-rk27xx.c
index 1742852c16..f3081d2d7d 100644
--- a/firmware/target/arm/rk27xx/sd-rk27xx.c
+++ b/firmware/target/arm/rk27xx/sd-rk27xx.c
@@ -126,10 +126,16 @@ static void mmu_buff_reset(void)
126 MMU_CTRL |= MMU_BUFII_RESET | MMU_BUFI_RESET; 126 MMU_CTRL |= MMU_BUFII_RESET | MMU_BUFI_RESET;
127} 127}
128 128
129/* My generic device uses PC7 pin, active low */
130static inline bool card_detect_target(void) 129static inline bool card_detect_target(void)
131{ 130{
131#if defined(RK27_GENERIC)
132/* My generic device uses PC7 pin, active low */
132 return !(GPIO_PCDR & 0x80); 133 return !(GPIO_PCDR & 0x80);
134#elif defined(HM60X) || defined(HM801)
135 return !(GPIO_PFDR & (1<<2));
136#else
137#error "Unknown target"
138#endif
133} 139}
134 140
135/* Send command to the SD card. Command finish is signaled in ISR */ 141/* Send command to the SD card. Command finish is signaled in ISR */
diff --git a/tools/configure b/tools/configure
index 5b84f8774e..42cd2f8b07 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1292,6 +1292,7 @@ cat <<EOF
1292 202) Nokia N8xx 1292 202) Nokia N8xx
1293 203) Nokia N900 ==ROCKCHIP== ==HiFiMAN== 1293 203) Nokia N900 ==ROCKCHIP== ==HiFiMAN==
1294 204) Pandora 180) rk27xx generic 190) HM-60x 1294 204) Pandora 180) rk27xx generic 190) HM-60x
1295 191) HM-801
1295 1296
1296EOF 1297EOF
1297 1298
@@ -3054,6 +3055,29 @@ fi
3054 t_model="hm60x" 3055 t_model="hm60x"
3055 ;; 3056 ;;
3056 3057
3058 191|hifimanhm801)
3059 target_id=80
3060 modelname="hifimanhm801"
3061 target="-DHM801"
3062 memory=16
3063 arm7ejscc
3064 tool="$rootdir/tools/scramble -add=rk27"
3065 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
3066 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
3067 output="rockbox.rk27"
3068 bootoutput="bootloader.rk27"
3069 appextra="recorder:gui"
3070 plugins="yes"
3071 swcodec="yes"
3072 # toolset is the tools within the tools directory that we build for
3073 # this particular target.
3074 toolset="$genericbitmaptools"
3075 # architecture, manufacturer and model for the target-tree build
3076 t_cpu="arm"
3077 t_manufacturer="rk27xx"
3078 t_model="hm801"
3079 ;;
3080
3057 200|sdlapp) 3081 200|sdlapp)
3058 application="yes" 3082 application="yes"
3059 target_id=73 3083 target_id=73