diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 15 | ||||
-rw-r--r-- | firmware/drivers/audio/dummy_codec.c (renamed from firmware/drivers/audio/tda1543.c) | 0 | ||||
-rw-r--r-- | firmware/export/audiohw.h | 4 | ||||
-rw-r--r-- | firmware/export/config.h | 3 | ||||
-rw-r--r-- | firmware/export/config/hifimanhm60x.h | 2 | ||||
-rw-r--r-- | firmware/export/config/hifimanhm801.h | 171 | ||||
-rw-r--r-- | firmware/export/dummy_codec.h (renamed from firmware/export/tda1543.h) | 6 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/debug-target.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/hm801/button-hm801.c | 68 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/hm801/button-target.h | 47 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/hm801/power-hm801.c | 49 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c | 60 | ||||
-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.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/rk27xx/sd-rk27xx.c | 8 |
15 files changed, 425 insertions, 12 deletions
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 | |||
355 | drivers/audio/cs42l55.c | 355 | drivers/audio/cs42l55.c |
356 | #elif defined (HAVE_RK27XX_CODEC) | 356 | #elif defined (HAVE_RK27XX_CODEC) |
357 | drivers/audio/rk27xx_codec.c | 357 | drivers/audio/rk27xx_codec.c |
358 | #elif defined (HAVE_TDA1543) | 358 | #elif defined (HAVE_DUMMY_CODEC) |
359 | drivers/audio/tda1543.c | 359 | drivers/audio/dummy_codec.c |
360 | #endif /* defined(HAVE_*) */ | 360 | #endif /* defined(HAVE_*) */ |
361 | #elif defined(HAVE_SDL_AUDIO) | 361 | #elif defined(HAVE_SDL_AUDIO) |
362 | drivers/audio/sdl.c | 362 | drivers/audio/sdl.c |
@@ -1925,6 +1925,15 @@ thread.c | |||
1925 | target/arm/rk27xx/hm60x/button-hm60x.c | 1925 | target/arm/rk27xx/hm60x/button-hm60x.c |
1926 | target/arm/rk27xx/hm60x/powermgmt-hm60x.c | 1926 | target/arm/rk27xx/hm60x/powermgmt-hm60x.c |
1927 | target/arm/rk27xx/hm60x/power-hm60x.c | 1927 | target/arm/rk27xx/hm60x/power-hm60x.c |
1928 | target/arm/rk27xx/hm60x/lcd-hm60x.c | 1928 | target/arm/rk27xx/lcd-hifiman.c |
1929 | #endif | ||
1930 | #endif | ||
1931 | |||
1932 | #ifndef SIMULATOR | ||
1933 | #if defined(HM801) | ||
1934 | target/arm/rk27xx/hm801/button-hm801.c | ||
1935 | target/arm/rk27xx/hm801/powermgmt-hm801.c | ||
1936 | target/arm/rk27xx/hm801/power-hm801.c | ||
1937 | target/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 | |||
27 | void button_init_device(void) { | ||
28 | /* setup button gpio as input */ | ||
29 | GPIO_PCCON &= ~(POWEROFF_BUTTON); | ||
30 | } | ||
31 | |||
32 | int 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 | |||
27 | void button_init_device(void); | ||
28 | int 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 | |||
29 | void power_off(void) | ||
30 | { | ||
31 | GPIO_PCDR &= ~(1<<0); | ||
32 | while(1); | ||
33 | } | ||
34 | |||
35 | void power_init(void) | ||
36 | { | ||
37 | GPIO_PCDR |= (1<<0); | ||
38 | GPIO_PCCON |= (1<<0); | ||
39 | } | ||
40 | |||
41 | unsigned int power_input_status(void) | ||
42 | { | ||
43 | return (usb_detect() == USB_INSERTED) ? POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; | ||
44 | } | ||
45 | |||
46 | bool 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 | |||
34 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
35 | { | ||
36 | /* OF power off device when this value reached */ | ||
37 | 430 | ||
38 | }; | ||
39 | |||
40 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
41 | { | ||
42 | 425 | ||
43 | }; | ||
44 | |||
45 | /* adc values of 0%, 10%, ... 100% when charging disabled */ | ||
46 | const 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 */ | ||
53 | const 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 | |||
57 | unsigned 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 */ | ||
130 | static inline bool card_detect_target(void) | 129 | static 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 */ |