Index: firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c =================================================================== --- firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c (revision 19404) +++ firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c (working copy) @@ -115,6 +115,7 @@ static void lcd_write_cmd(int cmd) { + disable_irq(); /* Write register */ DBOP_CTRL &= ~(1<<14); @@ -126,10 +127,12 @@ while ((DBOP_STAT & (1<<10)) == 0); DBOP_TIMPOL_23 = 0xa167e06f; + enable_irq(); } void lcd_write_data(const fb_data* p_bytes, int count) { + disable_irq(); while (count--) { DBOP_DOUT = *p_bytes++; @@ -137,6 +140,7 @@ /* Wait for fifo to empty */ while ((DBOP_STAT & (1<<10)) == 0); } + enable_irq(); } static void lcd_write_reg(int reg, int value) @@ -288,7 +292,7 @@ ams3525_dbop_init(); /* Init GPIOs the same as the OF */ - +/* GPIOA_DIR |= (1<<5); GPIOA_PIN(5) = 0; @@ -298,8 +302,8 @@ GPIOA_PIN(3) = (1<<3); - GPIOA_PIN(4) = 0; /*c80b0040 := 0;*/ - + GPIOA_PIN(4) = 0; */ /*c80b0040 := 0;*/ +/* GPIOA_DIR |= (1<<7); GPIOA_PIN(7) = 0; @@ -308,7 +312,7 @@ GPIOA_PIN(5) = (1<<5); lcd_delay(1); - +*/ _display_on(); } @@ -390,6 +394,9 @@ if (!display_on) return; + lcd_update(); + return; + if (x + width > LCD_WIDTH) width = LCD_WIDTH - x; /* Clip right */ if (x < 0) Index: firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c =================================================================== --- firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c (revision 19404) +++ firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c (working copy) @@ -82,42 +82,59 @@ afsel_save_b = GPIOB_AFSEL; dir_save_c = GPIOC_DIR; afsel_save_c = GPIOC_AFSEL; - + + GPIOC_AFSEL = 0; + GPIOC_DIR = 0xff; + + GPIOC_PIN(0) |= (1<<0); + GPIOC_PIN(1) |= (1<<1); + GPIOC_PIN(2) |= (1<<2); + GPIOC_PIN(3) |= (1<<3); + GPIOC_PIN(4) |= (1<<4); + GPIOC_PIN(5) |= (1<<5); + GPIOC_PIN(6) |= (1<<6); + GPIOC_PIN(7) |= (1<<7); + + GPIOB_AFSEL = 0; GPIOB_DIR = 0; - GPIOB_AFSEL = 0; + GPIOC_DIR = 0; - GPIOC_AFSEL = 0; - - /* These should not be needed with button event interupts */ - /* they are necessary now to clear out lcd data */ - GPIOC_PIN(0) |= 1; - GPIOC_PIN(1) |= 1; - GPIOC_PIN(2) |= 1; - GPIOC_PIN(3) |= 1; - GPIOC_PIN(4) |= 1; - GPIOC_PIN(5) |= 1; - GPIOC_PIN(6) |= 1; - GPIOC_PIN(7) |= 1; - + + int delay = 50; + while(delay >0) delay--; + + /* direct GPIO connections */ + if (!GPIOC_PIN(3)) + { + int_btn |= BUTTON_LEFT; + } + if (!GPIOC_PIN(2)) + { + int_btn |= BUTTON_UP; + } + if (!GPIOC_PIN(6)) + { + int_btn |= BUTTON_DOWN; + } if (GPIOB_PIN(4)) + { int_btn |= BUTTON_POWER; - if (!GPIOC_PIN(6)) - int_btn |= BUTTON_DOWN; + } if (!GPIOC_PIN(5)) + { int_btn |= BUTTON_RIGHT; + } if (!GPIOC_PIN(4)) + { int_btn |= BUTTON_SELECT; - if (!GPIOC_PIN(3)) - int_btn |= BUTTON_LEFT; - if (!GPIOC_PIN(2)) - int_btn |= BUTTON_UP; - + } /* return to settings needed for lcd */ GPIOB_DIR = dir_save_b; GPIOB_AFSEL = afsel_save_b; GPIOC_DIR = dir_save_c; GPIOC_AFSEL = afsel_save_c; + } /* @@ -129,6 +146,7 @@ /* Read buttons directly in the bootloader */ button_int(); #else + button_int(); /* light handling */ if (hold_button != hold_button_old) {