diff options
Diffstat (limited to 'firmware')
41 files changed, 217 insertions, 113 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index 1ec8bf0933..8f5116b769 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #ifdef HAVE_REMOTE_LCD | 37 | #ifdef HAVE_REMOTE_LCD |
38 | #include "lcd-remote.h" | 38 | #include "lcd-remote.h" |
39 | #endif | 39 | #endif |
40 | #if defined(TARGET_TREE) && !defined(SIMULATOR) | 40 | #ifndef SIMULATOR |
41 | #include "backlight-target.h" | 41 | #include "backlight-target.h" |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -58,39 +58,9 @@ static inline void __backlight_set_brightness(int val) | |||
58 | (void)val; | 58 | (void)val; |
59 | } | 59 | } |
60 | #endif | 60 | #endif |
61 | |||
62 | #else | ||
63 | /* Basic low-level code that simply switches backlight on or off. Probably | ||
64 | * a nice candidate for inclusion in the target/ dir. */ | ||
65 | #ifndef TARGET_TREE | ||
66 | static inline void __backlight_on(void) | ||
67 | { | ||
68 | #if CONFIG_BACKLIGHT == BL_RTC | ||
69 | /* Enable square wave */ | ||
70 | rtc_write(0x0a, rtc_read(0x0a) | 0x40); | ||
71 | #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */ | ||
72 | and_b(~0x40, &PADRH); /* drive and set low */ | ||
73 | or_b(0x40, &PAIORH); | ||
74 | #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */ | ||
75 | or_b(0x40, &PADRH); /* drive it high */ | ||
76 | #endif | ||
77 | } | ||
78 | |||
79 | static inline void __backlight_off(void) | ||
80 | { | ||
81 | #if CONFIG_BACKLIGHT == BL_RTC | ||
82 | /* Disable square wave */ | ||
83 | rtc_write(0x0a, rtc_read(0x0a) & ~0x40); | ||
84 | #elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */ | ||
85 | and_b(~0x40, &PAIORH); /* let it float (up) */ | ||
86 | #elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */ | ||
87 | and_b(~0x40, &PADRH); /* drive it low */ | ||
88 | #endif | ||
89 | } | ||
90 | #endif | ||
91 | #endif /* SIMULATOR */ | 61 | #endif /* SIMULATOR */ |
92 | 62 | ||
93 | #if CONFIG_BACKLIGHT && !defined(BOOTLOADER) | 63 | #if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) |
94 | 64 | ||
95 | const signed char backlight_timeout_value[19] = | 65 | const signed char backlight_timeout_value[19] = |
96 | { | 66 | { |
@@ -558,23 +528,15 @@ void backlight_init(void) | |||
558 | queue_init(&backlight_queue, true); | 528 | queue_init(&backlight_queue, true); |
559 | queue_set_irq_safe(&backlight_queue, true); | 529 | queue_set_irq_safe(&backlight_queue, true); |
560 | 530 | ||
561 | #ifdef SIMULATOR | 531 | #ifndef SIMULATOR |
562 | /* do nothing */ | ||
563 | #elif defined(__BACKLIGHT_INIT) | ||
564 | /* Remove the __BACKLIGHT_INIT references when __backlight_init is | ||
565 | available on all backlighted targets. Take them out of the | ||
566 | backlight-target.h files as well */ | ||
567 | if (__backlight_init()) | 532 | if (__backlight_init()) |
568 | { | 533 | { |
569 | # if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) | 534 | # ifdef HAVE_BACKLIGHT_PWM_FADING |
570 | /* If backlight is already on, don't fade in. */ | 535 | /* If backlight is already on, don't fade in. */ |
571 | bl_dim_current = BL_PWM_COUNT; | 536 | bl_dim_current = BL_PWM_COUNT; |
572 | bl_dim_target = BL_PWM_COUNT; | 537 | bl_dim_target = BL_PWM_COUNT; |
573 | # endif | 538 | # endif |
574 | } | 539 | } |
575 | #elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI | ||
576 | PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ | ||
577 | or_b(0x40, &PAIORH); /* ..and output */ | ||
578 | #endif | 540 | #endif |
579 | backlight_on(); | 541 | backlight_on(); |
580 | #ifdef HAVE_REMOTE_LCD | 542 | #ifdef HAVE_REMOTE_LCD |
@@ -806,16 +768,14 @@ void backlight_set_brightness(int val) | |||
806 | } | 768 | } |
807 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | 769 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
808 | 770 | ||
809 | #else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER) | 771 | #else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER) |
810 | -- no backlight, empty dummy functions */ | 772 | -- no backlight, empty dummy functions */ |
811 | 773 | ||
812 | #if defined(BOOTLOADER) && CONFIG_BACKLIGHT | 774 | #if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT) |
813 | void backlight_init(void) | 775 | void backlight_init(void) |
814 | { | 776 | { |
815 | #ifdef __BACKLIGHT_INIT | ||
816 | __backlight_init(); | 777 | __backlight_init(); |
817 | __backlight_on(); | 778 | __backlight_on(); |
818 | #endif | ||
819 | } | 779 | } |
820 | #endif | 780 | #endif |
821 | 781 | ||
@@ -832,4 +792,4 @@ bool is_remote_backlight_on(void) {return true;} | |||
832 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 792 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
833 | void backlight_set_brightness(int val) { (void)val; } | 793 | void backlight_set_brightness(int val) { (void)val; } |
834 | #endif | 794 | #endif |
835 | #endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */ | 795 | #endif /* defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) */ |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 889c7a688d..b20afe13f6 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -52,12 +52,12 @@ static long last_read; /* Last button status, for debouncing/filtering */ | |||
52 | #ifdef HAVE_LCD_BITMAP | 52 | #ifdef HAVE_LCD_BITMAP |
53 | static bool flipped; /* buttons can be flipped to match the LCD flip */ | 53 | static bool flipped; /* buttons can be flipped to match the LCD flip */ |
54 | #endif | 54 | #endif |
55 | #if CONFIG_BACKLIGHT | 55 | #ifdef HAVE_BACKLIGHT |
56 | static bool filter_first_keypress; | 56 | static bool filter_first_keypress; |
57 | #ifdef HAVE_REMOTE_LCD | 57 | #ifdef HAVE_REMOTE_LCD |
58 | static bool remote_filter_first_keypress; | 58 | static bool remote_filter_first_keypress; |
59 | #endif | 59 | #endif |
60 | #endif /* CONFIG_BACKLIGHT */ | 60 | #endif /* HAVE_BACKLIGHT */ |
61 | #ifdef HAVE_HEADPHONE_DETECTION | 61 | #ifdef HAVE_HEADPHONE_DETECTION |
62 | bool phones_present = false; | 62 | bool phones_present = false; |
63 | #endif | 63 | #endif |
@@ -80,7 +80,7 @@ static void button_tick(void) | |||
80 | static int repeat_count = 0; | 80 | static int repeat_count = 0; |
81 | static bool repeat = false; | 81 | static bool repeat = false; |
82 | static bool post = false; | 82 | static bool post = false; |
83 | #if CONFIG_BACKLIGHT | 83 | #ifdef HAVE_BACKLIGHT |
84 | static bool skip_release = false; | 84 | static bool skip_release = false; |
85 | #ifdef HAVE_REMOTE_LCD | 85 | #ifdef HAVE_REMOTE_LCD |
86 | static bool skip_remote_release = false; | 86 | static bool skip_remote_release = false; |
@@ -121,7 +121,7 @@ static void button_tick(void) | |||
121 | diff = btn ^ lastbtn; | 121 | diff = btn ^ lastbtn; |
122 | if(diff && (btn & diff) == 0) | 122 | if(diff && (btn & diff) == 0) |
123 | { | 123 | { |
124 | #if CONFIG_BACKLIGHT | 124 | #ifdef HAVE_BACKLIGHT |
125 | #ifdef HAVE_REMOTE_LCD | 125 | #ifdef HAVE_REMOTE_LCD |
126 | if(diff & BUTTON_REMOTE) | 126 | if(diff & BUTTON_REMOTE) |
127 | if(!skip_remote_release) | 127 | if(!skip_remote_release) |
@@ -211,7 +211,7 @@ static void button_tick(void) | |||
211 | if (queue_empty(&button_queue)) | 211 | if (queue_empty(&button_queue)) |
212 | { | 212 | { |
213 | queue_post(&button_queue, BUTTON_REPEAT | btn, 0); | 213 | queue_post(&button_queue, BUTTON_REPEAT | btn, 0); |
214 | #if CONFIG_BACKLIGHT | 214 | #ifdef HAVE_BACKLIGHT |
215 | #ifdef HAVE_REMOTE_LCD | 215 | #ifdef HAVE_REMOTE_LCD |
216 | skip_remote_release = false; | 216 | skip_remote_release = false; |
217 | #endif | 217 | #endif |
@@ -222,7 +222,7 @@ static void button_tick(void) | |||
222 | } | 222 | } |
223 | else | 223 | else |
224 | { | 224 | { |
225 | #if CONFIG_BACKLIGHT | 225 | #ifdef HAVE_BACKLIGHT |
226 | #ifdef HAVE_REMOTE_LCD | 226 | #ifdef HAVE_REMOTE_LCD |
227 | if (btn & BUTTON_REMOTE) { | 227 | if (btn & BUTTON_REMOTE) { |
228 | if (!remote_filter_first_keypress || is_remote_backlight_on() | 228 | if (!remote_filter_first_keypress || is_remote_backlight_on() |
@@ -347,7 +347,7 @@ void button_init(void) | |||
347 | #ifdef HAVE_LCD_BITMAP | 347 | #ifdef HAVE_LCD_BITMAP |
348 | flipped = false; | 348 | flipped = false; |
349 | #endif | 349 | #endif |
350 | #if CONFIG_BACKLIGHT | 350 | #ifdef HAVE_BACKLIGHT |
351 | filter_first_keypress = false; | 351 | filter_first_keypress = false; |
352 | #ifdef HAVE_REMOTE_LCD | 352 | #ifdef HAVE_REMOTE_LCD |
353 | remote_filter_first_keypress = false; | 353 | remote_filter_first_keypress = false; |
@@ -419,7 +419,7 @@ void button_set_flip(bool flip) | |||
419 | } | 419 | } |
420 | #endif /* HAVE_LCD_BITMAP */ | 420 | #endif /* HAVE_LCD_BITMAP */ |
421 | 421 | ||
422 | #if CONFIG_BACKLIGHT | 422 | #ifdef HAVE_BACKLIGHT |
423 | void set_backlight_filter_keypress(bool value) | 423 | void set_backlight_filter_keypress(bool value) |
424 | { | 424 | { |
425 | filter_first_keypress = value; | 425 | filter_first_keypress = value; |
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h index 2873666dd8..4b164c63d2 100644 --- a/firmware/export/backlight.h +++ b/firmware/export/backlight.h | |||
@@ -26,7 +26,7 @@ void backlight_on(void); | |||
26 | void backlight_off(void); | 26 | void backlight_off(void); |
27 | void backlight_set_timeout(int index); | 27 | void backlight_set_timeout(int index); |
28 | 28 | ||
29 | #if CONFIG_BACKLIGHT | 29 | #ifdef HAVE_BACKLIGHT |
30 | void backlight_init(void); | 30 | void backlight_init(void); |
31 | 31 | ||
32 | #if defined(IAUDIO_X5) && !defined(SIMULATOR) | 32 | #if defined(IAUDIO_X5) && !defined(SIMULATOR) |
@@ -54,9 +54,9 @@ void lcd_set_sleep_after_backlight_off(int index); | |||
54 | extern const signed char lcd_sleep_timeout_value[]; | 54 | extern const signed char lcd_sleep_timeout_value[]; |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #else /* CONFIG_BACKLIGHT == 0 */ | 57 | #else /* !HAVE_BACKLIGHT */ |
58 | #define backlight_init() | 58 | #define backlight_init() |
59 | #endif /* CONFIG_BACKLIGHT */ | 59 | #endif /* !HAVE_BACKLIGHT */ |
60 | 60 | ||
61 | #ifdef HAVE_REMOTE_LCD | 61 | #ifdef HAVE_REMOTE_LCD |
62 | void remote_backlight_on(void); | 62 | void remote_backlight_on(void); |
diff --git a/firmware/export/button.h b/firmware/export/button.h index ea3effcaba..f675824c3d 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -33,7 +33,7 @@ void button_clear_queue(void); | |||
33 | #ifdef HAVE_LCD_BITMAP | 33 | #ifdef HAVE_LCD_BITMAP |
34 | void button_set_flip(bool flip); /* turn 180 degrees */ | 34 | void button_set_flip(bool flip); /* turn 180 degrees */ |
35 | #endif | 35 | #endif |
36 | #if CONFIG_BACKLIGHT | 36 | #ifdef HAVE_BACKLIGHT |
37 | void set_backlight_filter_keypress(bool value); | 37 | void set_backlight_filter_keypress(bool value); |
38 | #ifdef HAVE_REMOTE_LCD | 38 | #ifdef HAVE_REMOTE_LCD |
39 | void set_remote_backlight_filter_keypress(bool value); | 39 | void set_remote_backlight_filter_keypress(bool value); |
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index efcb7ebfd5..ccff38dbf2 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h | |||
@@ -69,8 +69,7 @@ | |||
69 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ | 69 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ |
70 | 70 | ||
71 | /* Define this for LCD backlight available */ | 71 | /* Define this for LCD backlight available */ |
72 | #define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary | 72 | #define HAVE_BACKLIGHT |
73 | because of 'target' stuff */ | ||
74 | 73 | ||
75 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ | 74 | #define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */ |
76 | 75 | ||
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index e753808897..211dccb183 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h | |||
@@ -52,7 +52,7 @@ | |||
52 | #define HAVE_SPDIF_IN | 52 | #define HAVE_SPDIF_IN |
53 | 53 | ||
54 | /* Define this for LCD backlight available */ | 54 | /* Define this for LCD backlight available */ |
55 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 55 | #define HAVE_BACKLIGHT |
56 | 56 | ||
57 | #define CONFIG_I2C I2C_PLAYREC | 57 | #define CONFIG_I2C I2C_PLAYREC |
58 | 58 | ||
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 9b56a1a616..ef6d8243b8 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h | |||
@@ -42,7 +42,7 @@ | |||
42 | #define CONFIG_RTC RTC_S3C2440 | 42 | #define CONFIG_RTC RTC_S3C2440 |
43 | 43 | ||
44 | /* Define this for LCD backlight available */ | 44 | /* Define this for LCD backlight available */ |
45 | #define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */ | 45 | #define HAVE_BACKLIGHT |
46 | 46 | ||
47 | #define HAVE_LCD_ENABLE | 47 | #define HAVE_LCD_ENABLE |
48 | 48 | ||
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 2b7f965294..4d372143f8 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h | |||
@@ -78,8 +78,7 @@ | |||
78 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ | 78 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ |
79 | 79 | ||
80 | /* Define this for LCD backlight available */ | 80 | /* Define this for LCD backlight available */ |
81 | #define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary | 81 | #define HAVE_BACKLIGHT |
82 | because of 'target' stuff */ | ||
83 | 82 | ||
84 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ | 83 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */ |
85 | 84 | ||
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index dbb499f3af..cc2bfd7178 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h | |||
@@ -56,7 +56,7 @@ | |||
56 | #define CONFIG_LCD LCD_S1D15E06 | 56 | #define CONFIG_LCD LCD_S1D15E06 |
57 | 57 | ||
58 | /* Define this for LCD backlight available */ | 58 | /* Define this for LCD backlight available */ |
59 | #define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ | 59 | #define HAVE_BACKLIGHT |
60 | 60 | ||
61 | /* We can fade the backlight by using PWM */ | 61 | /* We can fade the backlight by using PWM */ |
62 | #define HAVE_BACKLIGHT_PWM_FADING | 62 | #define HAVE_BACKLIGHT_PWM_FADING |
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index bbf3f2ffe6..3b3cebb8fb 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h | |||
@@ -72,8 +72,7 @@ | |||
72 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ | 72 | #define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */ |
73 | 73 | ||
74 | /* Define this for LCD backlight available */ | 74 | /* Define this for LCD backlight available */ |
75 | #define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary | 75 | #define HAVE_BACKLIGHT |
76 | because of target tree stuff */ | ||
77 | 76 | ||
78 | #define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ | 77 | #define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */ |
79 | 78 | ||
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index f957f450d0..a0ad638fa2 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h | |||
@@ -51,7 +51,7 @@ | |||
51 | #define CONFIG_LCD LCD_S1D15E06 | 51 | #define CONFIG_LCD LCD_S1D15E06 |
52 | 52 | ||
53 | /* Define this for LCD backlight available */ | 53 | /* Define this for LCD backlight available */ |
54 | #define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */ | 54 | #define HAVE_BACKLIGHT |
55 | 55 | ||
56 | /* We can fade the backlight by using PWM */ | 56 | /* We can fade the backlight by using PWM */ |
57 | #define HAVE_BACKLIGHT_PWM_FADING | 57 | #define HAVE_BACKLIGHT_PWM_FADING |
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index ad80191885..0b2406bee7 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h | |||
@@ -51,7 +51,7 @@ | |||
51 | #define HAVE_REMOTE_LCD | 51 | #define HAVE_REMOTE_LCD |
52 | 52 | ||
53 | /* Define this for LCD backlight available */ | 53 | /* Define this for LCD backlight available */ |
54 | #define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */ | 54 | #define HAVE_BACKLIGHT |
55 | 55 | ||
56 | /* Define this if you have a software controlled poweroff */ | 56 | /* Define this if you have a software controlled poweroff */ |
57 | #define HAVE_SW_POWEROFF | 57 | #define HAVE_SW_POWEROFF |
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index bce3c47e5c..bcc843f125 100644 --- a/firmware/export/config-iaudiom5.h +++ b/firmware/export/config-iaudiom5.h | |||
@@ -64,7 +64,7 @@ | |||
64 | #define CONFIG_LCD LCD_S1D15E06 | 64 | #define CONFIG_LCD LCD_S1D15E06 |
65 | 65 | ||
66 | /* Define this for LCD backlight available */ | 66 | /* Define this for LCD backlight available */ |
67 | #define CONFIG_BACKLIGHT BL_M5 /* PCF50606 I2C */ | 67 | #define HAVE_BACKLIGHT |
68 | 68 | ||
69 | /* Define this if you have a software controlled poweroff */ | 69 | /* Define this if you have a software controlled poweroff */ |
70 | #define HAVE_SW_POWEROFF | 70 | #define HAVE_SW_POWEROFF |
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 57f8a68134..43c02a0ee5 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h | |||
@@ -66,7 +66,7 @@ | |||
66 | #define CONFIG_LCD LCD_X5 | 66 | #define CONFIG_LCD LCD_X5 |
67 | 67 | ||
68 | /* Define this for LCD backlight available */ | 68 | /* Define this for LCD backlight available */ |
69 | #define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */ | 69 | #define HAVE_BACKLIGHT |
70 | #define HAVE_BACKLIGHT_BRIGHTNESS | 70 | #define HAVE_BACKLIGHT_BRIGHTNESS |
71 | 71 | ||
72 | /* Define this if you have a software controlled poweroff */ | 72 | /* Define this if you have a software controlled poweroff */ |
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index 1b0ea17984..435b6ef984 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h | |||
@@ -77,7 +77,7 @@ | |||
77 | #define ROM_START 0x00000000 | 77 | #define ROM_START 0x00000000 |
78 | 78 | ||
79 | /* Define this for LCD backlight available */ | 79 | /* Define this for LCD backlight available */ |
80 | #define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */ | 80 | #define HAVE_BACKLIGHT |
81 | 81 | ||
82 | /* Define this to the CPU frequency */ | 82 | /* Define this to the CPU frequency */ |
83 | #define CPU_FREQ 48000000 | 83 | #define CPU_FREQ 48000000 |
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index f3877cfdbc..ff91bcff49 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h | |||
@@ -64,7 +64,7 @@ | |||
64 | #define HAVE_SW_TONE_CONTROLS | 64 | #define HAVE_SW_TONE_CONTROLS |
65 | 65 | ||
66 | /* Define this for LCD backlight available */ | 66 | /* Define this for LCD backlight available */ |
67 | #define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */ | 67 | #define HAVE_BACKLIGHT |
68 | 68 | ||
69 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | 69 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ |
70 | 70 | ||
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index ab172afd2e..4a8d4f1bf2 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -70,7 +70,7 @@ | |||
70 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 70 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
71 | 71 | ||
72 | /* Define this for LCD backlight available */ | 72 | /* Define this for LCD backlight available */ |
73 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ | 73 | #define HAVE_BACKLIGHT |
74 | 74 | ||
75 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ | 75 | #define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */ |
76 | 76 | ||
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 5e3e5c3d62..41277041f1 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -61,7 +61,7 @@ | |||
61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
62 | 62 | ||
63 | /* Define this for LCD backlight available */ | 63 | /* Define this for LCD backlight available */ |
64 | #define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */ | 64 | #define HAVE_BACKLIGHT |
65 | 65 | ||
66 | #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ | 66 | #define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */ |
67 | 67 | ||
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 40987d6b2c..7fba883c9c 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 67 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
68 | 68 | ||
69 | /* Define this for LCD backlight available */ | 69 | /* Define this for LCD backlight available */ |
70 | #define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ | 70 | #define HAVE_BACKLIGHT |
71 | 71 | ||
72 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ | 72 | #define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */ |
73 | 73 | ||
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 80e2820339..55831c4cb3 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 67 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
68 | 68 | ||
69 | /* Define this for LCD backlight available */ | 69 | /* Define this for LCD backlight available */ |
70 | #define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */ | 70 | #define HAVE_BACKLIGHT |
71 | 71 | ||
72 | /* We can fade the backlight by using PWM */ | 72 | /* We can fade the backlight by using PWM */ |
73 | #define HAVE_BACKLIGHT_PWM_FADING | 73 | #define HAVE_BACKLIGHT_PWM_FADING |
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index d32e45d17f..74bfe34d0f 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -61,7 +61,7 @@ | |||
61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
62 | 62 | ||
63 | /* Define this for LCD backlight available */ | 63 | /* Define this for LCD backlight available */ |
64 | #define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */ | 64 | #define HAVE_BACKLIGHT |
65 | 65 | ||
66 | /* We can fade the backlight by using PWM */ | 66 | /* We can fade the backlight by using PWM */ |
67 | #define HAVE_BACKLIGHT_PWM_FADING | 67 | #define HAVE_BACKLIGHT_PWM_FADING |
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index f9cc50d520..e10a7f9e55 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -61,7 +61,7 @@ | |||
61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE | 61 | #define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE |
62 | 62 | ||
63 | /* Define this for LCD backlight available */ | 63 | /* Define this for LCD backlight available */ |
64 | #define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */ | 64 | #define HAVE_BACKLIGHT |
65 | 65 | ||
66 | /* We can fade the backlight by using PWM */ | 66 | /* We can fade the backlight by using PWM */ |
67 | #define HAVE_BACKLIGHT_PWM_FADING | 67 | #define HAVE_BACKLIGHT_PWM_FADING |
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 0e691b70e3..c168ecf588 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define CONFIG_CODEC MAS3587F | 40 | #define CONFIG_CODEC MAS3587F |
41 | 41 | ||
42 | /* Enable this if you have done the backlight mod */ | 42 | /* Enable this if you have done the backlight mod */ |
43 | //#define CONFIG_BACKLIGHT BL_PA14_HI | 43 | //#define HAVE_BACKLIGHT |
44 | 44 | ||
45 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ | 45 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ |
46 | 46 | ||
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index da723413ec..1d3e98ac0a 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h | |||
@@ -33,7 +33,7 @@ | |||
33 | #define CONFIG_CODEC MAS3539F | 33 | #define CONFIG_CODEC MAS3539F |
34 | 34 | ||
35 | /* Enable this if you have done the backlight mod */ | 35 | /* Enable this if you have done the backlight mod */ |
36 | //#define CONFIG_BACKLIGHT BL_PA14_HI | 36 | //#define HAVE_BACKLIGHT |
37 | 37 | ||
38 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ | 38 | #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ |
39 | 39 | ||
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 580831c861..0256db137f 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define HAVE_DAC3550A | 25 | #define HAVE_DAC3550A |
26 | 26 | ||
27 | /* Define this for LCD backlight available */ | 27 | /* Define this for LCD backlight available */ |
28 | #define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */ | 28 | #define HAVE_BACKLIGHT |
29 | 29 | ||
30 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ | 30 | #define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */ |
31 | 31 | ||
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index d8bd0bed2f..3fe7365d3c 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h | |||
@@ -46,7 +46,7 @@ | |||
46 | #define HAVE_SPDIF_IN | 46 | #define HAVE_SPDIF_IN |
47 | 47 | ||
48 | /* Define this for LCD backlight available */ | 48 | /* Define this for LCD backlight available */ |
49 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 49 | #define HAVE_BACKLIGHT |
50 | 50 | ||
51 | #define CONFIG_I2C I2C_PLAYREC | 51 | #define CONFIG_I2C I2C_PLAYREC |
52 | 52 | ||
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index 0e6e00c167..8211994275 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h | |||
@@ -49,7 +49,7 @@ | |||
49 | #define HAVE_SPDIF_IN | 49 | #define HAVE_SPDIF_IN |
50 | 50 | ||
51 | /* Define this for LCD backlight available */ | 51 | /* Define this for LCD backlight available */ |
52 | #define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */ | 52 | #define HAVE_BACKLIGHT |
53 | 53 | ||
54 | #define CONFIG_I2C I2C_PLAYREC | 54 | #define CONFIG_I2C I2C_PLAYREC |
55 | 55 | ||
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h index 5837b0f01f..02e7319cfe 100644 --- a/firmware/export/config-tpj1022.h +++ b/firmware/export/config-tpj1022.h | |||
@@ -55,8 +55,7 @@ | |||
55 | #define AB_REPEAT_ENABLE 1 | 55 | #define AB_REPEAT_ENABLE 1 |
56 | 56 | ||
57 | /* Define this for LCD backlight available */ | 57 | /* Define this for LCD backlight available */ |
58 | #define CONFIG_BACKLIGHT BL_TPJ1022 /* TODO: figure this out, probably not necessary | 58 | #define HAVE_BACKLIGHT |
59 | because of 'target' stuff */ | ||
60 | 59 | ||
61 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity | 60 | #define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity |
62 | TODO: check this, probably different | 61 | TODO: check this, probably different |
diff --git a/firmware/export/config.h b/firmware/export/config.h index 2d7b3e131a..0ad94e06b1 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -113,24 +113,6 @@ | |||
113 | #define RGB565 565 | 113 | #define RGB565 565 |
114 | #define RGB565SWAPPED 3553 | 114 | #define RGB565SWAPPED 3553 |
115 | 115 | ||
116 | /* CONFIG_BACKLIGHT */ | ||
117 | #define BL_PA14_LO 1 /* Player, PA14 low active */ | ||
118 | #define BL_RTC 2 /* Recorder, RTC square wave output */ | ||
119 | #define BL_PA14_HI 3 /* Ondio, PA14 high active */ | ||
120 | #define BL_IRIVER_H100 4 /* IRiver GPIO */ | ||
121 | #define BL_IPOD4G 5 /* Apple iPod 4G */ | ||
122 | #define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/ | ||
123 | #define BL_IPOD3G 7 /* Apple iPod 3g with dock */ | ||
124 | #define BL_IRIVER_H300 8 /* IRiver PWM */ | ||
125 | #define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */ | ||
126 | #define BL_IPODMINI 10 /* Apple iPod Mini */ | ||
127 | #define BL_GIGABEAT 11 /* Toshiba Gigabeat */ | ||
128 | #define BL_H10 12 /* iriver H10 */ | ||
129 | #define BL_X5 13 /* iAudio X5 PCF50606 I2C */ | ||
130 | #define BL_H10_5GB 14 /* iriver H10 5/6GB */ | ||
131 | #define BL_TPJ1022 15 /* Tatung Elio TPJ-1022 */ | ||
132 | #define BL_M5 16 /* iAudio M5 PCF50606 I2C */ | ||
133 | |||
134 | /* CONFIG_I2C */ | 116 | /* CONFIG_I2C */ |
135 | #define I2C_PLAYREC 1 /* Archos Player/Recorder style */ | 117 | #define I2C_PLAYREC 1 /* Archos Player/Recorder style */ |
136 | #define I2C_ONDIO 2 /* Ondio style */ | 118 | #define I2C_ONDIO 2 /* Ondio style */ |
@@ -235,10 +217,6 @@ | |||
235 | #define CONFIG_LED 0 | 217 | #define CONFIG_LED 0 |
236 | #endif | 218 | #endif |
237 | 219 | ||
238 | #ifndef CONFIG_BACKLIGHT | ||
239 | #define CONFIG_BACKLIGHT 0 | ||
240 | #endif | ||
241 | |||
242 | #ifndef CONFIG_CHARGING | 220 | #ifndef CONFIG_CHARGING |
243 | #define CONFIG_CHARGING 0 | 221 | #define CONFIG_CHARGING 0 |
244 | #endif | 222 | #endif |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index e1ec1a6017..3d87773394 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -708,7 +708,7 @@ static int runcurrent(void) | |||
708 | current = CURRENT_USB; | 708 | current = CURRENT_USB; |
709 | } | 709 | } |
710 | 710 | ||
711 | #if CONFIG_BACKLIGHT && !defined(BOOTLOADER) | 711 | #if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) |
712 | if (backlight_get_current_timeout() == 0) /* LED always on */ | 712 | if (backlight_get_current_timeout() == 0) /* LED always on */ |
713 | current += CURRENT_BACKLIGHT; | 713 | current += CURRENT_BACKLIGHT; |
714 | #endif | 714 | #endif |
diff --git a/firmware/target/arm/ipod/backlight-target.h b/firmware/target/arm/ipod/backlight-target.h index d35dccdc4a..f4e34cb53a 100644 --- a/firmware/target/arm/ipod/backlight-target.h +++ b/firmware/target/arm/ipod/backlight-target.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __backlight_init() true | ||
22 | void __backlight_on(void); | 23 | void __backlight_on(void); |
23 | void __backlight_off(void); | 24 | void __backlight_off(void); |
24 | 25 | ||
diff --git a/firmware/target/arm/iriver/backlight-target.h b/firmware/target/arm/iriver/backlight-target.h index d35dccdc4a..f4e34cb53a 100644 --- a/firmware/target/arm/iriver/backlight-target.h +++ b/firmware/target/arm/iriver/backlight-target.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __backlight_init() true | ||
22 | void __backlight_on(void); | 23 | void __backlight_on(void); |
23 | void __backlight_off(void); | 24 | void __backlight_off(void); |
24 | 25 | ||
diff --git a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h index 5b96ae5e7e..16a02a4d11 100644 --- a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h +++ b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __backlight_init() true | ||
22 | void __backlight_on(void); | 23 | void __backlight_on(void); |
23 | void __backlight_off(void); | 24 | void __backlight_off(void); |
24 | void __backlight_set_brightness(int brightness); | 25 | void __backlight_set_brightness(int brightness); |
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-target.h b/firmware/target/arm/tatung/tpj1022/backlight-target.h index b5fe2f7c5d..079a8ce8aa 100644 --- a/firmware/target/arm/tatung/tpj1022/backlight-target.h +++ b/firmware/target/arm/tatung/tpj1022/backlight-target.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #ifndef BACKLIGHT_TARGET_H | 22 | #ifndef BACKLIGHT_TARGET_H |
23 | #define BACKLIGHT_TARGET_H | 23 | #define BACKLIGHT_TARGET_H |
24 | 24 | ||
25 | #define __backlight_init() true | ||
25 | void __backlight_on(void); | 26 | void __backlight_on(void); |
26 | void __backlight_off(void); | 27 | void __backlight_off(void); |
27 | 28 | ||
diff --git a/firmware/target/coldfire/iaudio/m5/backlight-target.h b/firmware/target/coldfire/iaudio/m5/backlight-target.h index d9c116803e..824810baa1 100644 --- a/firmware/target/coldfire/iaudio/m5/backlight-target.h +++ b/firmware/target/coldfire/iaudio/m5/backlight-target.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __BACKLIGHT_INIT | ||
23 | bool __backlight_init(void); | 22 | bool __backlight_init(void); |
24 | void __backlight_on(void); | 23 | void __backlight_on(void); |
25 | void __backlight_off(void); | 24 | void __backlight_off(void); |
diff --git a/firmware/target/coldfire/iaudio/x5/backlight-target.h b/firmware/target/coldfire/iaudio/x5/backlight-target.h index e70bea08e4..6e03aaa76f 100644 --- a/firmware/target/coldfire/iaudio/x5/backlight-target.h +++ b/firmware/target/coldfire/iaudio/x5/backlight-target.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __BACKLIGHT_INIT | ||
23 | bool __backlight_init(void); | 22 | bool __backlight_init(void); |
24 | void __backlight_on(void); | 23 | void __backlight_on(void); |
25 | void __backlight_off(void); | 24 | void __backlight_off(void); |
diff --git a/firmware/target/coldfire/iriver/backlight-target.h b/firmware/target/coldfire/iriver/backlight-target.h index e653fa1ffb..30a57e4fbc 100644 --- a/firmware/target/coldfire/iriver/backlight-target.h +++ b/firmware/target/coldfire/iriver/backlight-target.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #ifndef BACKLIGHT_TARGET_H | 19 | #ifndef BACKLIGHT_TARGET_H |
20 | #define BACKLIGHT_TARGET_H | 20 | #define BACKLIGHT_TARGET_H |
21 | 21 | ||
22 | #define __BACKLIGHT_INIT | ||
23 | bool __backlight_init(void); /* Returns backlight current state (true=ON). */ | 22 | bool __backlight_init(void); /* Returns backlight current state (true=ON). */ |
24 | void __backlight_on(void); | 23 | void __backlight_on(void); |
25 | void __backlight_off(void); | 24 | void __backlight_off(void); |
diff --git a/firmware/target/sh/archos/fm_v2/backlight-target.h b/firmware/target/sh/archos/fm_v2/backlight-target.h new file mode 100644 index 0000000000..834d10bdc6 --- /dev/null +++ b/firmware/target/sh/archos/fm_v2/backlight-target.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "rtc.h" | ||
24 | |||
25 | #define __backlight_init() true | ||
26 | |||
27 | static inline void __backlight_on(void) | ||
28 | { | ||
29 | /* Enable square wave */ | ||
30 | rtc_write(0x0a, rtc_read(0x0a) | 0x40); | ||
31 | } | ||
32 | |||
33 | static inline void __backlight_off(void) | ||
34 | { | ||
35 | /* Disable square wave */ | ||
36 | rtc_write(0x0a, rtc_read(0x0a) & ~0x40); | ||
37 | } | ||
38 | |||
39 | #endif | ||
diff --git a/firmware/target/sh/archos/ondio/backlight-target.h b/firmware/target/sh/archos/ondio/backlight-target.h new file mode 100644 index 0000000000..9be66bd6a0 --- /dev/null +++ b/firmware/target/sh/archos/ondio/backlight-target.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "cpu.h" | ||
24 | |||
25 | #ifdef HAVE_BACKLIGHT | ||
26 | /* A stock Ondio has no backlight, it needs a hardware mod. */ | ||
27 | |||
28 | static inline bool __backlight_init(void) | ||
29 | { | ||
30 | PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ | ||
31 | or_b(0x40, &PADRH); /* drive it high */ | ||
32 | or_b(0x40, &PAIORH); /* ..and output */ | ||
33 | return true; | ||
34 | } | ||
35 | |||
36 | static inline void __backlight_on(void) | ||
37 | { | ||
38 | or_b(0x40, &PADRH); /* drive it high */ | ||
39 | } | ||
40 | |||
41 | static inline void __backlight_off(void) | ||
42 | { | ||
43 | and_b(~0x40, &PADRH); /* drive it low */ | ||
44 | } | ||
45 | #endif /* HAVE_BACKLIGHT */ | ||
46 | |||
47 | #endif | ||
diff --git a/firmware/target/sh/archos/player/backlight-target.h b/firmware/target/sh/archos/player/backlight-target.h new file mode 100644 index 0000000000..d3bb7f39ed --- /dev/null +++ b/firmware/target/sh/archos/player/backlight-target.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "cpu.h" | ||
24 | |||
25 | static inline bool __backlight_init(void) | ||
26 | { | ||
27 | PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */ | ||
28 | and_b(~0x40, &PADRH); /* drive and set low */ | ||
29 | or_b(0x40, &PAIORH); /* ..and output */ | ||
30 | return true; | ||
31 | } | ||
32 | |||
33 | static inline void __backlight_on(void) | ||
34 | { | ||
35 | and_b(~0x40, &PADRH); /* drive and set low */ | ||
36 | or_b(0x40, &PAIORH); | ||
37 | } | ||
38 | |||
39 | static inline void __backlight_off(void) | ||
40 | { | ||
41 | and_b(~0x40, &PAIORH); /* let it float (up) */ | ||
42 | } | ||
43 | |||
44 | #endif | ||
diff --git a/firmware/target/sh/archos/recorder/backlight-target.h b/firmware/target/sh/archos/recorder/backlight-target.h new file mode 100644 index 0000000000..834d10bdc6 --- /dev/null +++ b/firmware/target/sh/archos/recorder/backlight-target.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jens Arnold | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "rtc.h" | ||
24 | |||
25 | #define __backlight_init() true | ||
26 | |||
27 | static inline void __backlight_on(void) | ||
28 | { | ||
29 | /* Enable square wave */ | ||
30 | rtc_write(0x0a, rtc_read(0x0a) | 0x40); | ||
31 | } | ||
32 | |||
33 | static inline void __backlight_off(void) | ||
34 | { | ||
35 | /* Disable square wave */ | ||
36 | rtc_write(0x0a, rtc_read(0x0a) & ~0x40); | ||
37 | } | ||
38 | |||
39 | #endif | ||