summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-h100-remote.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-h100-remote.c')
-rw-r--r--firmware/drivers/lcd-h100-remote.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/firmware/drivers/lcd-h100-remote.c b/firmware/drivers/lcd-h100-remote.c
index 75d42f8371..0592f60e00 100644
--- a/firmware/drivers/lcd-h100-remote.c
+++ b/firmware/drivers/lcd-h100-remote.c
@@ -147,7 +147,7 @@ static inline void _write_byte(unsigned data)
147 "move.l (%[gpo1]), %%d0 \n" /* Get current state of data line */ 147 "move.l (%[gpo1]), %%d0 \n" /* Get current state of data line */
148 "and.l %[dbit], %%d0 \n" 148 "and.l %[dbit], %%d0 \n"
149 "beq.s 1f \n" /* and set it as previous-state bit */ 149 "beq.s 1f \n" /* and set it as previous-state bit */
150 "bset #8, %[data] \n" 150 "bset #8, %[data] \n"
151 "1: \n" 151 "1: \n"
152 "move.l %[data], %%d0 \n" /* Compute the 'bit derivative', i.e. a value */ 152 "move.l %[data], %%d0 \n" /* Compute the 'bit derivative', i.e. a value */
153 "lsr.l #1, %%d0 \n" /* with 1's where the data changes from the */ 153 "lsr.l #1, %%d0 \n" /* with 1's where the data changes from the */
@@ -241,10 +241,10 @@ static inline void _write_fast(unsigned data)
241 "eor.l %%d1, %[data] \n" /* previous state, and 0's where it doesn't */ 241 "eor.l %%d1, %[data] \n" /* previous state, and 0's where it doesn't */
242 "swap %[data] \n" /* Shift data to upper byte */ 242 "swap %[data] \n" /* Shift data to upper byte */
243 "lsl.l #8, %[data] \n" 243 "lsl.l #8, %[data] \n"
244 244
245 "move.l (%[gpo0]), %%d1 \n" /* Get current state of clock port */ 245 "move.l (%[gpo0]), %%d1 \n" /* Get current state of clock port */
246 "move.l %[cbit], %%d2 \n" /* Precalculate opposite state of clock line */ 246 "move.l %[cbit], %%d2 \n" /* Precalculate opposite state of clock line */
247 "eor.l %%d1, %%d2 \n" 247 "eor.l %%d1, %%d2 \n"
248 248
249 "lsl.l #1,%[data] \n" /* Shift out MSB */ 249 "lsl.l #1,%[data] \n" /* Shift out MSB */
250 "bcc.s 1f \n" 250 "bcc.s 1f \n"
@@ -466,17 +466,17 @@ static void remote_lcd_init(void)
466 lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x6); 466 lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x6);
467 sleep(1); 467 sleep(1);
468 lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x7); 468 lcd_remote_write_command(LCD_REMOTE_CNTL_POWER_CONTROL | 0x7);
469 469
470 lcd_remote_write_command(LCD_REMOTE_CNTL_SELECT_REGULATOR | 0x4); // 0x4 Select regulator @ 5.0 (default); 470 lcd_remote_write_command(LCD_REMOTE_CNTL_SELECT_REGULATOR | 0x4); // 0x4 Select regulator @ 5.0 (default);
471 471
472 sleep(1); 472 sleep(1);
473 473
474 lcd_remote_write_command(LCD_REMOTE_CNTL_INIT_LINE | 0x0); // init line 474 lcd_remote_write_command(LCD_REMOTE_CNTL_INIT_LINE | 0x0); // init line
475 lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | 0x0); // page address 475 lcd_remote_write_command(LCD_REMOTE_CNTL_SET_PAGE_ADDRESS | 0x0); // page address
476 lcd_remote_write_command_ex(0x10, 0x00); // Column MSB + LSB 476 lcd_remote_write_command_ex(0x10, 0x00); // Column MSB + LSB
477 477
478 lcd_remote_write_command(LCD_REMOTE_CNTL_DISPLAY_ON_OFF | 1); 478 lcd_remote_write_command(LCD_REMOTE_CNTL_DISPLAY_ON_OFF | 1);
479 479
480 remote_initialized = true; 480 remote_initialized = true;
481 481
482 lcd_remote_set_flip(cached_flip); 482 lcd_remote_set_flip(cached_flip);
@@ -511,7 +511,7 @@ static void remote_tick(void)
511 /* Count down until it gets negative */ 511 /* Count down until it gets negative */
512 if (countdown >= 0) 512 if (countdown >= 0)
513 countdown--; 513 countdown--;
514 514
515 if (current_status) 515 if (current_status)
516 { 516 {
517 if (!(countdown % 8)) 517 if (!(countdown % 8))
@@ -520,7 +520,7 @@ static void remote_tick(void)
520 level = set_irq_level(HIGHEST_IRQ_LEVEL); 520 level = set_irq_level(HIGHEST_IRQ_LEVEL);
521 val = adc_scan(ADC_REMOTEDETECT); 521 val = adc_scan(ADC_REMOTEDETECT);
522 set_irq_level(level); 522 set_irq_level(level);
523 523
524 if (val < ADCVAL_H100_LCD_REMOTE_HOLD) 524 if (val < ADCVAL_H100_LCD_REMOTE_HOLD)
525 { 525 {
526 if (val < ADCVAL_H100_LCD_REMOTE) 526 if (val < ADCVAL_H100_LCD_REMOTE)
@@ -581,7 +581,7 @@ void lcd_remote_init(void)
581#ifdef IRIVER_H300_SERIES 581#ifdef IRIVER_H300_SERIES
582 or_l(0x10010000, &GPIO_FUNCTION); /* GPIO16: RS 582 or_l(0x10010000, &GPIO_FUNCTION); /* GPIO16: RS
583 GPIO28: CLK */ 583 GPIO28: CLK */
584 584
585 or_l(0x00040006, &GPIO1_FUNCTION); /* GPO33: Backlight 585 or_l(0x00040006, &GPIO1_FUNCTION); /* GPO33: Backlight
586 GPIO34: CS 586 GPIO34: CS
587 GPIO50: Data */ 587 GPIO50: Data */
@@ -591,7 +591,7 @@ void lcd_remote_init(void)
591 or_l(0x10010800, &GPIO_FUNCTION); /* GPIO11: Backlight 591 or_l(0x10010800, &GPIO_FUNCTION); /* GPIO11: Backlight
592 GPIO16: RS 592 GPIO16: RS
593 GPIO28: CLK */ 593 GPIO28: CLK */
594 594
595 or_l(0x00040004, &GPIO1_FUNCTION); /* GPIO34: CS 595 or_l(0x00040004, &GPIO1_FUNCTION); /* GPIO34: CS
596 GPIO50: Data */ 596 GPIO50: Data */
597 or_l(0x10010800, &GPIO_ENABLE); 597 or_l(0x10010800, &GPIO_ENABLE);
@@ -614,10 +614,10 @@ void lcd_remote_update(void) ICODE_ATTR;
614void lcd_remote_update(void) 614void lcd_remote_update(void)
615{ 615{
616 int y; 616 int y;
617 617
618 if (!remote_initialized) 618 if (!remote_initialized)
619 return; 619 return;
620 620
621#ifdef HAVE_REMOTE_LCD_TICKING 621#ifdef HAVE_REMOTE_LCD_TICKING
622 /* Adjust byte delay for emi reduction. */ 622 /* Adjust byte delay for emi reduction. */
623 byte_delay = emireduce ? cpu_frequency / 197600 + 28: 0; 623 byte_delay = emireduce ? cpu_frequency / 197600 + 28: 0;
@@ -735,7 +735,7 @@ lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8] = {
735 flippixel, nopixel, setpixel, setpixel, 735 flippixel, nopixel, setpixel, setpixel,
736 nopixel, clearpixel, nopixel, clearpixel 736 nopixel, clearpixel, nopixel, clearpixel
737}; 737};
738 738
739static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) 739static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
740 ICODE_ATTR; 740 ICODE_ATTR;
741static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) 741static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits)
@@ -762,7 +762,7 @@ static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
762static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits) 762static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits)
763{ 763{
764 unsigned data = *address; 764 unsigned data = *address;
765 765
766 bits ^= data; 766 bits ^= data;
767 *address = data ^ (bits & mask); 767 *address = data ^ (bits & mask);
768} 768}
@@ -793,7 +793,7 @@ static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
793static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits) 793static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits)
794{ 794{
795 unsigned data = *address; 795 unsigned data = *address;
796 796
797 bits = ~bits ^ data; 797 bits = ~bits ^ data;
798 *address = data ^ (bits & mask); 798 *address = data ^ (bits & mask);
799} 799}
@@ -907,18 +907,18 @@ void lcd_remote_hline(int x1, int x2, int y)
907 x1 = x2; 907 x1 = x2;
908 x2 = x; 908 x2 = x;
909 } 909 }
910 910
911 /* nothing to draw? */ 911 /* nothing to draw? */
912 if (((unsigned)y >= LCD_REMOTE_HEIGHT) || (x1 >= LCD_REMOTE_WIDTH) 912 if (((unsigned)y >= LCD_REMOTE_HEIGHT) || (x1 >= LCD_REMOTE_WIDTH)
913 || (x2 < 0)) 913 || (x2 < 0))
914 return; 914 return;
915 915
916 /* clipping */ 916 /* clipping */
917 if (x1 < 0) 917 if (x1 < 0)
918 x1 = 0; 918 x1 = 0;
919 if (x2 >= LCD_REMOTE_WIDTH) 919 if (x2 >= LCD_REMOTE_WIDTH)
920 x2 = LCD_REMOTE_WIDTH-1; 920 x2 = LCD_REMOTE_WIDTH-1;
921 921
922 bfunc = lcd_remote_blockfuncs[drawmode]; 922 bfunc = lcd_remote_blockfuncs[drawmode];
923 dst = &lcd_remote_framebuffer[y>>3][x1]; 923 dst = &lcd_remote_framebuffer[y>>3][x1];
924 mask = 1 << (y & 7); 924 mask = 1 << (y & 7);
@@ -946,16 +946,16 @@ void lcd_remote_vline(int x, int y1, int y2)
946 } 946 }
947 947
948 /* nothing to draw? */ 948 /* nothing to draw? */
949 if (((unsigned)x >= LCD_REMOTE_WIDTH) || (y1 >= LCD_REMOTE_HEIGHT) 949 if (((unsigned)x >= LCD_REMOTE_WIDTH) || (y1 >= LCD_REMOTE_HEIGHT)
950 || (y2 < 0)) 950 || (y2 < 0))
951 return; 951 return;
952 952
953 /* clipping */ 953 /* clipping */
954 if (y1 < 0) 954 if (y1 < 0)
955 y1 = 0; 955 y1 = 0;
956 if (y2 >= LCD_REMOTE_HEIGHT) 956 if (y2 >= LCD_REMOTE_HEIGHT)
957 y2 = LCD_REMOTE_HEIGHT-1; 957 y2 = LCD_REMOTE_HEIGHT-1;
958 958
959 bfunc = lcd_remote_blockfuncs[drawmode]; 959 bfunc = lcd_remote_blockfuncs[drawmode];
960 dst = &lcd_remote_framebuffer[y1>>3][x]; 960 dst = &lcd_remote_framebuffer[y1>>3][x];
961 ny = y2 - (y1 & ~7); 961 ny = y2 - (y1 & ~7);
@@ -998,7 +998,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height)
998 bool fillopt = false; 998 bool fillopt = false;
999 999
1000 /* nothing to draw? */ 1000 /* nothing to draw? */
1001 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH) 1001 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH)
1002 || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0)) 1002 || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0))
1003 return; 1003 return;
1004 1004
@@ -1017,7 +1017,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height)
1017 width = LCD_REMOTE_WIDTH - x; 1017 width = LCD_REMOTE_WIDTH - x;
1018 if (y + height > LCD_REMOTE_HEIGHT) 1018 if (y + height > LCD_REMOTE_HEIGHT)
1019 height = LCD_REMOTE_HEIGHT - y; 1019 height = LCD_REMOTE_HEIGHT - y;
1020 1020
1021 if (drawmode & DRMODE_INVERSEVID) 1021 if (drawmode & DRMODE_INVERSEVID)
1022 { 1022 {
1023 if (drawmode & DRMODE_BG) 1023 if (drawmode & DRMODE_BG)
@@ -1093,10 +1093,10 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1093 lcd_remote_blockfunc_type *bfunc; 1093 lcd_remote_blockfunc_type *bfunc;
1094 1094
1095 /* nothing to draw? */ 1095 /* nothing to draw? */
1096 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH) 1096 if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH)
1097 || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0)) 1097 || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0))
1098 return; 1098 return;
1099 1099
1100 /* clipping */ 1100 /* clipping */
1101 if (x < 0) 1101 if (x < 0)
1102 { 1102 {
@@ -1170,7 +1170,7 @@ void lcd_remote_bitmap_part(const unsigned char *src, int src_x, int src_y,
1170 fb_remote_data *dst_col = dst++; 1170 fb_remote_data *dst_col = dst++;
1171 unsigned mask_col = mask; 1171 unsigned mask_col = mask;
1172 unsigned data = 0; 1172 unsigned data = 0;
1173 1173
1174 for (y = ny; y >= 8; y -= 8) 1174 for (y = ny; y >= 8; y -= 8)
1175 { 1175 {
1176 data |= *src_col << shift; 1176 data |= *src_col << shift;
@@ -1228,7 +1228,7 @@ static void lcd_remote_putsxyofs(int x, int y, int ofs, const unsigned char *str
1228 1228
1229 lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, 1229 lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs,
1230 pf->height); 1230 pf->height);
1231 1231
1232 x += width - ofs; 1232 x += width - ofs;
1233 ofs = 0; 1233 ofs = 0;
1234 } 1234 }
@@ -1336,8 +1336,8 @@ void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *string, int
1336void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) 1336void lcd_remote_puts_scroll_offset(int x, int y, const unsigned char *string, int offset)
1337{ 1337{
1338 lcd_remote_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); 1338 lcd_remote_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset);
1339} 1339}
1340 1340
1341void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string, 1341void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1342 int style, int offset) 1342 int style, int offset)
1343{ 1343{
@@ -1428,7 +1428,7 @@ static void scroll_thread(void)
1428 remote_lcd_init(); 1428 remote_lcd_init();
1429 lcd_remote_update(); 1429 lcd_remote_update();
1430 break; 1430 break;
1431 1431
1432 case REMOTE_DEINIT_LCD: 1432 case REMOTE_DEINIT_LCD:
1433 CLK_LO; 1433 CLK_LO;
1434 CS_HI; 1434 CS_HI;