diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index cdba4c8118..1126f35149 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -38,7 +38,11 @@ | |||
38 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, | 38 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, |
39 | int width, int height); | 39 | int width, int height); |
40 | 40 | ||
41 | static volatile bool lcd_on = true; | 41 | static bool lcd_on = true; |
42 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
43 | static bool lcd_powered = true; | ||
44 | #endif | ||
45 | |||
42 | volatile bool lcd_poweroff = false; | 46 | volatile bool lcd_poweroff = false; |
43 | /* | 47 | /* |
44 | ** These are imported from lcd-16bit.c | 48 | ** These are imported from lcd-16bit.c |
@@ -46,10 +50,55 @@ volatile bool lcd_poweroff = false; | |||
46 | extern unsigned fg_pattern; | 50 | extern unsigned fg_pattern; |
47 | extern unsigned bg_pattern; | 51 | extern unsigned bg_pattern; |
48 | 52 | ||
53 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
49 | bool lcd_active(void) | 54 | bool lcd_active(void) |
50 | { | 55 | { |
51 | return lcd_on; | 56 | return lcd_on; |
52 | } | 57 | } |
58 | #endif | ||
59 | |||
60 | #if defined(HAVE_LCD_SLEEP) | ||
61 | void lcd_sleep() | ||
62 | { | ||
63 | if (lcd_powered) | ||
64 | { | ||
65 | /* "not powered" implies "disabled" */ | ||
66 | if (lcd_on) | ||
67 | lcd_enable(false); | ||
68 | IO_GIO_BITCLR2=1<<4; | ||
69 | lcd_powered=false; | ||
70 | } | ||
71 | } | ||
72 | #endif | ||
73 | |||
74 | #if defined(HAVE_LCD_ENABLE) | ||
75 | void lcd_enable(bool state) | ||
76 | { | ||
77 | if (state == lcd_on) | ||
78 | return; | ||
79 | |||
80 | if(state) | ||
81 | { | ||
82 | /* "enabled" implies "powered" */ | ||
83 | if (!lcd_powered) | ||
84 | { | ||
85 | lcd_powered=true; | ||
86 | IO_GIO_BITSET2=1<<4; | ||
87 | /* Wait long enough for a frame to be written - yes, it | ||
88 | * takes awhile. */ | ||
89 | sleep(HZ/5); | ||
90 | } | ||
91 | |||
92 | lcd_on = true; | ||
93 | lcd_update(); | ||
94 | lcd_activation_call_hook(); | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | lcd_on = false; | ||
99 | } | ||
100 | } | ||
101 | #endif | ||
53 | 102 | ||
54 | /* LCD init - based on code from ingenient-bsp/bootloader/board/dm320/splash.c | 103 | /* LCD init - based on code from ingenient-bsp/bootloader/board/dm320/splash.c |
55 | * and code by Catalin Patulea from the M:Robe 500i linux port | 104 | * and code by Catalin Patulea from the M:Robe 500i linux port |
@@ -80,6 +129,9 @@ void lcd_init_device(void) | |||
80 | IO_OSD_OSDWIN0YP=0; | 129 | IO_OSD_OSDWIN0YP=0; |
81 | IO_OSD_OSDWIN0XL=480; | 130 | IO_OSD_OSDWIN0XL=480; |
82 | IO_OSD_OSDWIN0YL=640; | 131 | IO_OSD_OSDWIN0YL=640; |
132 | |||
133 | /* Set pin 36 to an output */ | ||
134 | IO_GIO_DIR2&=!(1<<4); | ||
83 | } | 135 | } |
84 | 136 | ||
85 | /* Update a fraction of the display. */ | 137 | /* Update a fraction of the display. */ |
@@ -138,11 +190,6 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
138 | #endif | 190 | #endif |
139 | } | 191 | } |
140 | 192 | ||
141 | void lcd_enable(bool state) | ||
142 | { | ||
143 | (void)state; | ||
144 | } | ||
145 | |||
146 | /* Update the display. | 193 | /* Update the display. |
147 | This must be called after all other LCD functions that change the display. */ | 194 | This must be called after all other LCD functions that change the display. */ |
148 | void lcd_update(void) | 195 | void lcd_update(void) |