diff options
Diffstat (limited to 'firmware/target')
9 files changed, 88 insertions, 148 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c index 0a1389a226..da3e2e9f44 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/adc-mr500.c | |||
@@ -23,27 +23,38 @@ | |||
23 | #include "adc.h" | 23 | #include "adc.h" |
24 | #include "adc-target.h" | 24 | #include "adc-target.h" |
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "tsc2100.h" | ||
27 | #include "button-target.h" | ||
26 | 28 | ||
27 | /* prototypes */ | 29 | void read_battery_inputs(void); |
28 | static void adc_tick(void); | ||
29 | 30 | ||
30 | void adc_init(void) | 31 | void adc_init(void) |
31 | { | 32 | { |
32 | /* attach the adc reading to the tick */ | 33 | /* Initialize the touchscreen and the battery readout */ |
33 | tick_add_task(adc_tick); | 34 | tsc2100_adc_init(); |
35 | |||
36 | /* Enable the tsc2100 interrupt */ | ||
37 | IO_INTC_EINT2 |= (1<<3); /* IRQ_GIO14 */ | ||
34 | } | 38 | } |
35 | 39 | ||
36 | /* Called to get the recent ADC reading */ | 40 | /* Touchscreen data available interupt */ |
37 | inline unsigned short adc_read(int channel) | 41 | void GIO14(void) |
38 | { | 42 | { |
39 | return (short)channel; | 43 | short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); |
44 | short adscm = (tsadc&TSADC_ADSCM_MASK)>>TSADC_ADSCM_SHIFT; | ||
45 | |||
46 | /* Always read all registers in one go to clear any missed flags */ | ||
47 | tsc2100_read_data(); | ||
48 | |||
49 | switch (adscm) | ||
50 | { | ||
51 | case 1: | ||
52 | case 2: | ||
53 | touch_read_coord(); | ||
54 | break; | ||
55 | case 0x0B: | ||
56 | read_battery_inputs(); | ||
57 | break; | ||
58 | } | ||
59 | IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */ | ||
40 | } | 60 | } |
41 | |||
42 | /* add this to the tick so that the ADC converts are done in the background */ | ||
43 | static void adc_tick(void) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | |||
48 | |||
49 | |||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/adc-target.h b/firmware/target/arm/tms320dm320/mrobe-500/adc-target.h index 58aa19afcb..45e646cbb3 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/adc-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/adc-target.h | |||
@@ -22,19 +22,4 @@ | |||
22 | #ifndef _ADC_TARGET_H_ | 22 | #ifndef _ADC_TARGET_H_ |
23 | #define _ADC_TARGET_H_ | 23 | #define _ADC_TARGET_H_ |
24 | 24 | ||
25 | /* only two channels used by the Gigabeat */ | ||
26 | #define NUM_ADC_CHANNELS 2 | ||
27 | |||
28 | #define ADC_BATTERY 0 | ||
29 | #define ADC_HPREMOTE 1 | ||
30 | #define ADC_UNKNOWN_3 2 | ||
31 | #define ADC_UNKNOWN_4 3 | ||
32 | #define ADC_UNKNOWN_5 4 | ||
33 | #define ADC_UNKNOWN_6 5 | ||
34 | #define ADC_UNKNOWN_7 6 | ||
35 | #define ADC_UNKNOWN_8 7 | ||
36 | |||
37 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
38 | #define ADC_READ_ERROR 0xFFFF | ||
39 | |||
40 | #endif | 25 | #endif |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c index bdd91e2e20..ab2289822b 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "power.h" | 28 | #include "power.h" |
29 | #include "spi-target.h" | 29 | #include "spi-target.h" |
30 | #include "lcd-target.h" | ||
30 | 31 | ||
31 | int _backlight_brightness=DEFAULT_BRIGHTNESS_SETTING; | 32 | int _backlight_brightness=DEFAULT_BRIGHTNESS_SETTING; |
32 | 33 | ||
@@ -38,15 +39,15 @@ static void _backlight_write_brightness(int brightness) | |||
38 | 39 | ||
39 | void _backlight_on(void) | 40 | void _backlight_on(void) |
40 | { | 41 | { |
41 | #ifdef HAVE_LCD_ENABLE | 42 | lcd_awake(); /* power on lcd + visible display */ |
42 | lcd_enable(true); /* power on lcd + visible display */ | 43 | |
43 | #endif | ||
44 | _backlight_write_brightness(_backlight_brightness); | 44 | _backlight_write_brightness(_backlight_brightness); |
45 | } | 45 | } |
46 | 46 | ||
47 | void _backlight_off(void) | 47 | void _backlight_off(void) |
48 | { | 48 | { |
49 | _backlight_write_brightness(0); | 49 | _backlight_write_brightness(0); |
50 | lcd_sleep(); /* HACK to get lcd_sleep called again */ | ||
50 | } | 51 | } |
51 | 52 | ||
52 | /* Assumes that the backlight has been initialized */ | 53 | /* Assumes that the backlight has been initialized */ |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 2daae7e5d5..09ff6cbd78 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -35,7 +35,10 @@ | |||
35 | #include "touchscreen.h" | 35 | #include "touchscreen.h" |
36 | 36 | ||
37 | static bool touch_available = false; | 37 | static bool touch_available = false; |
38 | static bool hold_button = false; | 38 | static bool hold_button = false; |
39 | |||
40 | static short touch_x, touch_y, touch_z1, touch_z2; | ||
41 | static long last_touch = 0; | ||
39 | 42 | ||
40 | static struct touch_calibration_point topleft, bottomright; | 43 | static struct touch_calibration_point topleft, bottomright; |
41 | 44 | ||
@@ -49,16 +52,16 @@ static struct touch_calibration_point topleft, bottomright; | |||
49 | * (640,480) = 3880, 3900 | 52 | * (640,480) = 3880, 3900 |
50 | */ | 53 | */ |
51 | 54 | ||
52 | static int touch_to_pixels(short val_x, short val_y) | 55 | static int touch_to_pixels(short *val_x, short *val_y) |
53 | { | 56 | { |
54 | short x,y; | 57 | short x,y; |
55 | 58 | ||
56 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT | 59 | #if CONFIG_ORIENTATION == SCREEN_PORTRAIT |
57 | x=val_x; | 60 | x=*val_x; |
58 | y=val_y; | 61 | y=*val_y; |
59 | #else | 62 | #else |
60 | x=val_y; | 63 | x=*val_y; |
61 | y=val_x; | 64 | y=*val_x; |
62 | #endif | 65 | #endif |
63 | 66 | ||
64 | x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x; | 67 | x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x; |
@@ -74,6 +77,8 @@ static int touch_to_pixels(short val_x, short val_y) | |||
74 | else if (y>=LCD_HEIGHT) | 77 | else if (y>=LCD_HEIGHT) |
75 | y=LCD_HEIGHT-1; | 78 | y=LCD_HEIGHT-1; |
76 | 79 | ||
80 | *val_x=x; | ||
81 | *val_y=y; | ||
77 | 82 | ||
78 | return (x<<16)|y; | 83 | return (x<<16)|y; |
79 | } | 84 | } |
@@ -103,18 +108,6 @@ void button_init_device(void) | |||
103 | 108 | ||
104 | bottomright.px_x = LCD_WIDTH; | 109 | bottomright.px_x = LCD_WIDTH; |
105 | bottomright.px_y = LCD_HEIGHT; | 110 | bottomright.px_y = LCD_HEIGHT; |
106 | |||
107 | /* Enable the touchscreen interrupt */ | ||
108 | IO_INTC_EINT2 |= (1<<3); /* IRQ_GIO14 */ | ||
109 | #if 0 | ||
110 | tsc2100_writereg(TSADC_PAGE, TSADC_ADDRESS, | ||
111 | TSADC_PSTCM| | ||
112 | (0x2<<TSADC_ADSCM_SHIFT)| /* scan x,y,z1,z2 */ | ||
113 | (0x1<<TSADC_RESOL_SHIFT) /* 8 bit resolution */ | ||
114 | ); | ||
115 | /* doesnt work for some reason... | ||
116 | setting to 8bit would probably be better than the 12bit currently */ | ||
117 | #endif | ||
118 | } | 111 | } |
119 | 112 | ||
120 | inline bool button_hold(void) | 113 | inline bool button_hold(void) |
@@ -122,46 +115,35 @@ inline bool button_hold(void) | |||
122 | return hold_button; | 115 | return hold_button; |
123 | } | 116 | } |
124 | 117 | ||
118 | /* This is called from the tsc2100 interupt handler in adc-mr500.c */ | ||
119 | void touch_read_coord(void) | ||
120 | { | ||
121 | touch_available = true; | ||
122 | tsc2100_read_touch(&touch_x, &touch_y, &touch_z1, &touch_z2); | ||
123 | } | ||
124 | |||
125 | int button_read_device(int *data) | 125 | int button_read_device(int *data) |
126 | { | 126 | { |
127 | int button_read = BUTTON_NONE; | 127 | int button_read = BUTTON_NONE; |
128 | static int button_old = BUTTON_NONE; | ||
129 | static bool hold_button_old = false; | 128 | static bool hold_button_old = false; |
130 | static long last_touch = 0; | ||
131 | 129 | ||
132 | *data = 0; | 130 | *data = 0; |
133 | 131 | ||
134 | /* Handle touchscreen */ | 132 | /* Handle touchscreen */ |
135 | if (touch_available) | 133 | if (touch_available) |
136 | { | 134 | { |
137 | short x,y; | 135 | *data = touch_to_pixels(&touch_x, &touch_y); |
138 | short last_z1, last_z2; | 136 | button_read |= touchscreen_to_pixels(touch_x, touch_y, data); |
139 | |||
140 | tsc2100_read_values(&x, &y, &last_z1, &last_z2); | ||
141 | |||
142 | *data = touch_to_pixels(x, y); | ||
143 | button_read |= touchscreen_to_pixels((*data&0xffff0000)>>16, | ||
144 | *data&0x0000ffff, data); | ||
145 | button_old = button_read; | ||
146 | 137 | ||
147 | touch_available = false; | 138 | touch_available = false; |
148 | last_touch=current_tick; | 139 | last_touch=current_tick; |
149 | } | 140 | } |
150 | else | ||
151 | { | ||
152 | /* Touch hasn't happened in a while, clear the bits */ | ||
153 | if(last_touch+3>current_tick) | ||
154 | button_old&=(0xFF); | ||
155 | } | ||
156 | 141 | ||
157 | /* Handle power button */ | 142 | /* Handle power button */ |
158 | if ((IO_GIO_BITSET0&0x01) == 0) | 143 | if ((IO_GIO_BITSET0&0x01) == 0) |
159 | { | 144 | { |
160 | button_read |= BUTTON_POWER; | 145 | button_read |= BUTTON_POWER; |
161 | button_old = button_read; | ||
162 | } | 146 | } |
163 | else | ||
164 | button_old&=~BUTTON_POWER; | ||
165 | 147 | ||
166 | /* Read data from the remote */ | 148 | /* Read data from the remote */ |
167 | button_read |= remote_read_device(); | 149 | button_read |= remote_read_device(); |
@@ -180,27 +162,8 @@ int button_read_device(int *data) | |||
180 | if (hold_button) | 162 | if (hold_button) |
181 | { | 163 | { |
182 | button_read = BUTTON_NONE; | 164 | button_read = BUTTON_NONE; |
183 | button_old = button_read; | ||
184 | } | 165 | } |
185 | 166 | ||
186 | return button_read; | 167 | return button_read; |
187 | } | 168 | } |
188 | 169 | ||
189 | /* Touchscreen data available interupt */ | ||
190 | void read_battery_inputs(void); | ||
191 | void GIO14(void) | ||
192 | { | ||
193 | short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); | ||
194 | short adscm = (tsadc&TSADC_ADSCM_MASK)>>TSADC_ADSCM_SHIFT; | ||
195 | switch (adscm) | ||
196 | { | ||
197 | case 1: | ||
198 | case 2: | ||
199 | touch_available = true; | ||
200 | break; | ||
201 | case 0xb: | ||
202 | read_battery_inputs(); | ||
203 | break; | ||
204 | } | ||
205 | IO_INTC_IRQ2 = (1<<3); /* IRQ_GIO14 == 35 */ | ||
206 | } | ||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-target.h b/firmware/target/arm/tms320dm320/mrobe-500/button-target.h index 5b888b3e0a..b3a2960e01 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-target.h | |||
@@ -30,6 +30,9 @@ bool button_hold(void); | |||
30 | void button_init_device(void); | 30 | void button_init_device(void); |
31 | int button_read_device(int *data); | 31 | int button_read_device(int *data); |
32 | 32 | ||
33 | /* This is called from the tsc2100 interupt handler in adc-mr500.c */ | ||
34 | void touch_read_coord(void); | ||
35 | |||
33 | struct touch_calibration_point { | 36 | struct touch_calibration_point { |
34 | short px_x; /* known pixel value */ | 37 | short px_x; /* known pixel value */ |
35 | short px_y; | 38 | short px_y; |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index e26a88704d..20b830b02d 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | |||
@@ -38,9 +38,8 @@ | |||
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 | #if defined(HAVE_LCD_SLEEP) | ||
41 | static bool lcd_on = true; | 42 | static bool lcd_on = true; |
42 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
43 | static bool lcd_powered = true; | ||
44 | #endif | 43 | #endif |
45 | 44 | ||
46 | /* | 45 | /* |
@@ -49,7 +48,7 @@ static bool lcd_powered = true; | |||
49 | extern unsigned fg_pattern; | 48 | extern unsigned fg_pattern; |
50 | extern unsigned bg_pattern; | 49 | extern unsigned bg_pattern; |
51 | 50 | ||
52 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 51 | #if defined(HAVE_LCD_SLEEP) |
53 | bool lcd_active(void) | 52 | bool lcd_active(void) |
54 | { | 53 | { |
55 | return lcd_on; | 54 | return lcd_on; |
@@ -59,12 +58,8 @@ bool lcd_active(void) | |||
59 | #if defined(HAVE_LCD_SLEEP) | 58 | #if defined(HAVE_LCD_SLEEP) |
60 | void lcd_sleep() | 59 | void lcd_sleep() |
61 | { | 60 | { |
62 | if (lcd_powered) | 61 | if (lcd_on) |
63 | { | 62 | { |
64 | /* "not powered" implies "disabled" */ | ||
65 | if (lcd_on) | ||
66 | lcd_enable(false); | ||
67 | |||
68 | /* Disabling these saves another ~15mA */ | 63 | /* Disabling these saves another ~15mA */ |
69 | IO_OSD_OSDWINMD0&=~(0x01); | 64 | IO_OSD_OSDWINMD0&=~(0x01); |
70 | IO_VID_ENC_VMOD&=~(0x01); | 65 | IO_VID_ENC_VMOD&=~(0x01); |
@@ -73,42 +68,29 @@ void lcd_sleep() | |||
73 | 68 | ||
74 | /* Disabling the LCD saves ~50mA */ | 69 | /* Disabling the LCD saves ~50mA */ |
75 | IO_GIO_BITCLR2=1<<4; | 70 | IO_GIO_BITCLR2=1<<4; |
76 | lcd_powered=false; | 71 | lcd_on = false; |
77 | } | 72 | } |
78 | } | 73 | } |
79 | #endif | ||
80 | 74 | ||
81 | #if defined(HAVE_LCD_ENABLE) | 75 | void lcd_awake(void) |
82 | void lcd_enable(bool state) | ||
83 | { | 76 | { |
84 | if (state == lcd_on) | 77 | /* "enabled" implies "powered" */ |
85 | return; | 78 | if (!lcd_on) |
86 | |||
87 | if(state) | ||
88 | { | 79 | { |
89 | /* "enabled" implies "powered" */ | 80 | lcd_on=true; |
90 | if (!lcd_powered) | ||
91 | { | ||
92 | lcd_powered=true; | ||
93 | |||
94 | IO_OSD_OSDWINMD0|=0x01; | ||
95 | IO_VID_ENC_VMOD|=0x01; | ||
96 | 81 | ||
97 | sleep(2); | 82 | IO_OSD_OSDWINMD0|=0x01; |
98 | IO_GIO_BITSET2=1<<4; | 83 | IO_VID_ENC_VMOD|=0x01; |
99 | /* Wait long enough for a frame to be written - yes, it | 84 | |
100 | * takes awhile. */ | 85 | sleep(2); |
101 | sleep(HZ/5); | 86 | IO_GIO_BITSET2=1<<4; |
102 | } | 87 | /* Wait long enough for a frame to be written - yes, it |
103 | 88 | * takes awhile. */ | |
104 | lcd_on = true; | 89 | sleep(HZ/5); |
90 | |||
105 | lcd_update(); | 91 | lcd_update(); |
106 | lcd_activation_call_hook(); | 92 | lcd_activation_call_hook(); |
107 | } | 93 | } |
108 | else | ||
109 | { | ||
110 | lcd_on = false; | ||
111 | } | ||
112 | } | 94 | } |
113 | #endif | 95 | #endif |
114 | 96 | ||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-target.h b/firmware/target/arm/tms320dm320/mrobe-500/lcd-target.h index 5175765bc1..2415fdb928 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-target.h +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-target.h | |||
@@ -20,4 +20,5 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | extern void lcd_enable(bool state); | 22 | extern void lcd_enable(bool state); |
23 | extern void lcd_awake(void); | ||
23 | 24 | ||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c index f3746c8c98..654ec96591 100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "tsc2100.h" | 25 | #include "tsc2100.h" |
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | 27 | ||
28 | unsigned short current_voltage = 3910; | 28 | static unsigned short current_voltage = 3910; |
29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 29 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
30 | { | 30 | { |
31 | 0 | 31 | 0 |
@@ -47,38 +47,28 @@ const unsigned short percent_to_volt_charge[11] = | |||
47 | { | 47 | { |
48 | 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320, | 48 | 100, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1320, |
49 | }; | 49 | }; |
50 | |||
50 | void read_battery_inputs(void) | 51 | void read_battery_inputs(void) |
51 | { | 52 | { |
52 | short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); | 53 | short dummy1, dummy2; |
53 | short adscm = (tsadc&TSADC_ADSCM_MASK)>>TSADC_ADSCM_SHIFT; | 54 | tsc2100_read_volt(¤t_voltage, &dummy1, &dummy2); |
54 | if (adscm == 0xb) /* battery is available */ | 55 | |
55 | { | 56 | /* Set the TSC2100 back to read touches */ |
56 | current_voltage = tsc2100_readreg(0, 5); /* BAT1 */ | 57 | tsc2100_set_mode(0x01); |
57 | tsc2100_readreg(0, 6); /* BAT2 */ | ||
58 | tsc2100_readreg(0, 7); /* AUX */ | ||
59 | /* reset the TSC2100 to read touches */ | ||
60 | tsadc &= ~(TSADC_PSTCM|TSADC_ADST|TSADC_ADSCM_MASK); | ||
61 | tsadc |= TSADC_PSTCM|(0x2<<TSADC_ADSCM_SHIFT); | ||
62 | tsc2100_writereg(TSADC_PAGE, TSADC_ADDRESS, tsadc); | ||
63 | tsc2100_writereg(TSSTAT_PAGE, TSSTAT_ADDRESS, 2<<TSSTAT_PINTDAV_SHIFT); | ||
64 | } | ||
65 | } | 58 | } |
66 | 59 | ||
67 | /* Returns battery voltage from ADC [millivolts] */ | 60 | /* Returns battery voltage from ADC [millivolts] */ |
68 | unsigned int battery_adc_voltage(void) | 61 | unsigned int battery_adc_voltage(void) |
69 | { | 62 | { |
70 | static unsigned last_tick = 0; | 63 | static unsigned last_tick = 0; |
71 | short tsadc = tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); | 64 | |
72 | if (TIME_BEFORE(last_tick+2*HZ, current_tick)) | 65 | if (TIME_BEFORE(last_tick+2*HZ, current_tick)) |
73 | { | 66 | { |
74 | tsadc &= ~(TSADC_PSTCM|TSADC_ADST|TSADC_ADSCM_MASK); | 67 | /* Set the TSC2100 to read voltages */ |
75 | tsadc |= 0xb<<TSADC_ADSCM_SHIFT; | 68 | tsc2100_set_mode(0x0B); |
76 | tsc2100_writereg(TSADC_PAGE, TSADC_ADDRESS, tsadc&(~(1<<15))); | ||
77 | tsc2100_writereg(TSSTAT_PAGE, TSSTAT_ADDRESS, 2<<TSSTAT_PINTDAV_SHIFT); | ||
78 | last_tick = current_tick; | 69 | last_tick = current_tick; |
79 | } | 70 | } |
80 | else | 71 | |
81 | read_battery_inputs(); | ||
82 | return current_voltage; | 72 | return current_voltage; |
83 | } | 73 | } |
84 | 74 | ||
diff --git a/firmware/target/arm/tms320dm320/system-dm320.c b/firmware/target/arm/tms320dm320/system-dm320.c index e8d732351f..638e378159 100644 --- a/firmware/target/arm/tms320dm320/system-dm320.c +++ b/firmware/target/arm/tms320dm320/system-dm320.c | |||
@@ -188,7 +188,11 @@ void system_reboot(void) | |||
188 | 188 | ||
189 | void system_exception_wait(void) | 189 | void system_exception_wait(void) |
190 | { | 190 | { |
191 | while (1); | 191 | /* Mask all Interrupts. */ |
192 | IO_INTC_EINT0 = 0; | ||
193 | IO_INTC_EINT1 = 0; | ||
194 | IO_INTC_EINT2 = 0; | ||
195 | while ((IO_GIO_BITSET0&0x01) != 0); /* Wait for power button */ | ||
192 | } | 196 | } |
193 | 197 | ||
194 | void system_init(void) | 198 | void system_init(void) |