summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/adc.c34
-rw-r--r--firmware/drivers/button.c50
-rw-r--r--firmware/drivers/lcd-recorder.c31
-rw-r--r--firmware/drivers/power.c5
-rw-r--r--firmware/drivers/serial.c3
5 files changed, 121 insertions, 2 deletions
diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c
index c9ae2daca8..ad10017d85 100644
--- a/firmware/drivers/adc.c
+++ b/firmware/drivers/adc.c
@@ -294,4 +294,38 @@ void adc_init(void)
294 294
295} 295}
296 296
297#elif CONFIG_CPU == PNX0101
298
299static unsigned short adcdata[NUM_ADC_CHANNELS];
300
301unsigned short adc_read(int channel)
302{
303 return adcdata[channel];
304}
305
306static void adc_tick(void)
307{
308 if (ADCST & 0x10) {
309 adcdata[0] = ADCCH0 & 0x3ff;
310 adcdata[1] = ADCCH1 & 0x3ff;
311 adcdata[2] = ADCCH2 & 0x3ff;
312 adcdata[3] = ADCCH3 & 0x3ff;
313 adcdata[4] = ADCCH4 & 0x3ff;
314 ADCST = 0xa;
315 }
316}
317
318void adc_init(void)
319{
320 ADCR24 = 0xaaaaa;
321 ADCR28 = 0;
322 ADCST = 2;
323 ADCST = 0xa;
324
325 while (!(ADCST & 0x10));
326 adc_tick();
327
328 tick_add_task(adc_tick);
329}
330
297#endif 331#endif
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 544cfec32e..0c17fce4c6 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -61,7 +61,7 @@ static bool flipped; /* buttons can be flipped to match the LCD flip */
61#define REPEAT_INTERVAL_FINISH 5 61#define REPEAT_INTERVAL_FINISH 5
62 62
63/* the power-off button and number of repeated keys before shutting off */ 63/* the power-off button and number of repeated keys before shutting off */
64#if CONFIG_KEYPAD == IPOD_4G_PAD 64#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD)
65#define POWEROFF_BUTTON BUTTON_PLAY 65#define POWEROFF_BUTTON BUTTON_PLAY
66#define POWEROFF_COUNT 40 66#define POWEROFF_COUNT 40
67#else 67#else
@@ -731,6 +731,47 @@ static int button_read(void)
731 if (!remote_hold_button && ((data & 0x40) == 0)) 731 if (!remote_hold_button && ((data & 0x40) == 0))
732 btn |= BUTTON_RC_ON; 732 btn |= BUTTON_RC_ON;
733 733
734#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
735
736 static bool hold_button = false;
737
738 /* light handling */
739 if (hold_button && !button_hold())
740 {
741 backlight_on();
742 }
743 hold_button = button_hold();
744
745 /* normal buttons */
746 if (!button_hold())
747 {
748 data = adc_read(ADC_BUTTONS);
749
750 if (data < 0x151)
751 if (data < 0xc7)
752 if (data < 0x41)
753 btn = BUTTON_LEFT;
754 else
755 btn = BUTTON_RIGHT;
756 else
757 btn = BUTTON_SELECT;
758 else
759 if (data < 0x268)
760 if (data < 0x1d7)
761 btn = BUTTON_UP;
762 else
763 btn = BUTTON_DOWN;
764 else
765 if (data < 0x2f9)
766 btn = BUTTON_EQ;
767 else
768 if (data < 0x35c)
769 btn = BUTTON_MODE;
770 }
771
772 if (!button_hold() && (adc_read(ADC_BUTTON_PLAY) < 0x64))
773 btn |= BUTTON_PLAY;
774
734#elif CONFIG_KEYPAD == RECORDER_PAD 775#elif CONFIG_KEYPAD == RECORDER_PAD
735 776
736#ifdef HAVE_FMADC 777#ifdef HAVE_FMADC
@@ -877,6 +918,13 @@ bool remote_button_hold(void)
877} 918}
878#endif 919#endif
879 920
921#if CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
922bool button_hold(void)
923{
924 return (GPIO5_READ & 4) ? false : true;
925}
926#endif
927
880int button_status(void) 928int button_status(void)
881{ 929{
882 return lastbtn; 930 return lastbtn;
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index 081a7a5267..523e8a1c09 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -135,6 +135,24 @@ void lcd_write_data( const unsigned char* data, int count ) {
135 P2 |= 0x20; 135 P2 |= 0x20;
136 } 136 }
137} 137}
138
139#elif CONFIG_CPU == PNX0101
140
141void lcd_write_command(int cmd)
142{
143 while ((LCDSTAT & 3) != 3);
144 LCDCMD = cmd;
145}
146
147void lcd_write_data( const unsigned char* data, int count )
148{
149 int i;
150 for (i=0; i < count; i++) {
151 while ((LCDSTAT & 3) != 3);
152 LCDDATA = data[i];
153 }
154}
155
138#endif 156#endif
139 157
140/*** hardware configuration ***/ 158/*** hardware configuration ***/
@@ -145,6 +163,8 @@ int lcd_default_contrast(void)
145 return 30; 163 return 30;
146#elif CONFIG_LCD == LCD_GMINI100 164#elif CONFIG_LCD == LCD_GMINI100
147 return 31; 165 return 31;
166#elif CONFIG_LCD == LCD_IFP7XX
167 return 45;
148#else 168#else
149 return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49; 169 return (read_hw_mask() & LCD_CONTRAST_BIAS) ? 31 : 49;
150#endif 170#endif
@@ -197,7 +217,11 @@ void lcd_set_flip(bool yesno)
197 { 217 {
198 lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01); 218 lcd_write_command(LCD_SET_SEGMENT_REMAP | 0x01);
199 lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08); 219 lcd_write_command(LCD_SET_COM_OUTPUT_SCAN_DIRECTION | 0x08);
220#if CONFIG_LCD == LCD_IFP7XX
221 xoffset = 4;
222#else
200 xoffset = 0; 223 xoffset = 0;
224#endif
201 } 225 }
202#endif 226#endif
203} 227}
@@ -236,6 +260,9 @@ void lcd_init(void)
236 P2CONL |= 0x5a; 260 P2CONL |= 0x5a;
237 P2CONL &= 0x5b; 261 P2CONL &= 0x5b;
238 P2CONH |= 1; 262 P2CONH |= 1;
263#elif CONFIG_CPU == PNX0101
264 LCDREG10 = 0xf;
265 LCDREG04 = 0x4084;
239#else 266#else
240 /* Initialize PB0-3 as output pins */ 267 /* Initialize PB0-3 as output pins */
241 PBCR2 &= 0xff00; /* MD = 00 */ 268 PBCR2 &= 0xff00; /* MD = 00 */
@@ -245,7 +272,11 @@ void lcd_init(void)
245 /* inits like the original firmware */ 272 /* inits like the original firmware */
246 lcd_write_command(LCD_SOFTWARE_RESET); 273 lcd_write_command(LCD_SOFTWARE_RESET);
247 lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4); 274 lcd_write_command(LCD_SET_INTERNAL_REGULATOR_RESISTOR_RATIO + 4);
275#if CONFIG_LCD == LCD_IFP7XX
276 lcd_write_command(LCD_SET_LCD_BIAS);
277#else
248 lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */ 278 lcd_write_command(LCD_SET_1OVER4_BIAS_RATIO + 0); /* force 1/4 bias: 0 */
279#endif
249 lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7); 280 lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER + 7);
250 /* power control register: op-amp=1, regulator=1, booster=1 */ 281 /* power control register: op-amp=1, regulator=1, booster=1 */
251 lcd_write_command(LCD_SET_DISPLAY_ON); 282 lcd_write_command(LCD_SET_DISPLAY_ON);
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 141d985ee6..da97233e57 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -182,6 +182,8 @@ void ide_power_enable(bool on)
182 P1 |= 0x08; 182 P1 |= 0x08;
183 else 183 else
184 P1 &= ~0x08; 184 P1 &= ~0x08;
185#elif CONFIG_CPU == PNX0101
186 /* no ide controller */
185#else /* SH1 based archos */ 187#else /* SH1 based archos */
186 bool touched = false; 188 bool touched = false;
187#ifdef NEEDS_ATA_POWER_ON 189#ifdef NEEDS_ATA_POWER_ON
@@ -266,6 +268,9 @@ void power_off(void)
266 /* We don't turn off the ipod, we put it in a deep sleep */ 268 /* We don't turn off the ipod, we put it in a deep sleep */
267 pcf50605_standby_mode(); 269 pcf50605_standby_mode();
268#endif 270#endif
271#elif CONFIG_CPU == PNX0101
272 GPIO1_CLR = 1 << 16;
273 GPIO2_SET = 1;
269#elif defined(GMINI_ARCH) 274#elif defined(GMINI_ARCH)
270 P1 &= ~1; 275 P1 &= ~1;
271 P1CON &= ~1; 276 P1CON &= ~1;
diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c
index 4c5c5a8172..27061c299b 100644
--- a/firmware/drivers/serial.c
+++ b/firmware/drivers/serial.c
@@ -27,8 +27,9 @@
27#include "lcd.h" 27#include "lcd.h"
28#include "serial.h" 28#include "serial.h"
29 29
30#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020) 30#if (CONFIG_CPU != MCF5249) && (CONFIG_CPU != TCC730) && (CONFIG_CPU != PP5020) && (CONFIG_CPU != PNX0101)
31/* FIX: this doesn't work on iRiver or Gmini or iPod yet */ 31/* FIX: this doesn't work on iRiver or Gmini or iPod yet */
32/* iFP7xx has no remote */
32 33
33#ifndef HAVE_MMC /* MMC takes serial port 1, so don't mess with it */ 34#ifndef HAVE_MMC /* MMC takes serial port 1, so don't mess with it */
34 35