# HG changeset patch # User Mychaela Falconia # Date 1602986590 0 # Node ID 502a0a3f6a494a07f806101fbeb7533e2a77e3a0 # Parent 09cdd5bf04e497b0af02bcfceee75bafa60a6c6c C139 LCD support reinstated in the new way diff -r 09cdd5bf04e4 -r 502a0a3f6a49 src/cs/drivers/drv_app/r2d/lcds/c139/colors.h --- a/src/cs/drivers/drv_app/r2d/lcds/c139/colors.h Sat Oct 17 22:50:15 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/c139/colors.h Sun Oct 18 02:03:10 2020 +0000 @@ -4,13 +4,7 @@ * present configuration we are telling TI's code that we have a mono display. * But the real LCD on the C139 is 16-bit color. Here we define the physical * color values to which TI's black and white will be mapped. - * - * We are also pretending to be the 84x48 pix LCD on TI's C-Sample, hence we - * are displaying a 84x48 pix UI on a physical 96x64 pix LCD. We center the - * virtual display in the physical one, and the border color is defined here - * as well. */ #define LCD16_COLOR_BLACK 0x0000 #define LCD16_COLOR_WHITE 0xFFFF -#define LCD16_COLOR_BORDER 0x5555 diff -r 09cdd5bf04e4 -r 502a0a3f6a49 src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_i.c --- a/src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_i.c Sat Oct 17 22:50:15 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_i.c Sun Oct 18 02:03:10 2020 +0000 @@ -39,42 +39,39 @@ { } -static int get_pix_from_sw_fb(UINT32 *fb, UINT16 x, UINT16 y) -{ - UINT32 *p, mask; - UINT16 yword, ybit; - - /* mirroring */ - x = R2D_WIDTH - 1 - x; - y = R2D_HEIGHT - 1 - y; - yword = y >> 5; - ybit = y & 31; - p = fb + x * R2D_MWHEIGHT + yword; - mask = 1 << ybit; - if (*p & mask) - return(1); - else - return(0); -} - void r2d_refresh(void) { - UINT16 x, y; - UINT32 *fb; + UINT16 i, j, k; + UINT32 v; + UINT32 *p; + INT16 y1, y2; - fb = r2d_g_framebuffer->p_memory_words; + p=r2d_g_framebuffer->p_memory_words; + + y1=r2d_update_ul_y; //0 + y2=r2d_update_br_y; //63 + + /* set window area */ + c139_set_lcd_addr_region(0, 95, y1, y2); + + p=p+y1*R2D_MWWIDTH; - /* set the LCD up to refresh the 84x48 area */ - c139_set_lcd_addr_region(6, 89, 8, 55); - /* send the pixels */ - for (y = 0; y < R2D_HEIGHT; y++) { - for (x = 0; x < R2D_WIDTH; x++) { - if (get_pix_from_sw_fb(fb, x, y)) - c139_lcd_send_pix(LCD16_COLOR_BLACK); - else - c139_lcd_send_pix(LCD16_COLOR_WHITE); - } - } + for (i=y1;i<=y2;i++) + { + for (j = 0; j < R2D_MWWIDTH-1; j++) + { + v=*p++; + for (k=0;k<32;k++) + { + if (v&1) + c139_lcd_send_pix(LCD16_COLOR_BLACK); + else + c139_lcd_send_pix(LCD16_COLOR_WHITE); + v=v>>1; + } + } + p++; + } r2d_reinit_update_region(); } diff -r 09cdd5bf04e4 -r 502a0a3f6a49 src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_init_i.c --- a/src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_init_i.c Sat Oct 17 22:50:15 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/c139/r2d_task_init_i.c Sun Oct 18 02:03:10 2020 +0000 @@ -1,6 +1,6 @@ #include "r2d/lcds/c139/colors.h" -#define R2D_MB_PRIM_SIZE 2000 +#define R2D_MB_PRIM_SIZE 4000 extern void c139_lcd_ctrl_cmd(UINT8 cmd, UINT8 param); extern void c139_set_lcd_addr_region(UINT8 xstart, UINT8 xend, @@ -34,7 +34,7 @@ /* initial hw framebuffer clearing */ c139_set_lcd_addr_region(0, 95, 0, 63); for (i = 0; i < 96 * 64; i++) - c139_lcd_send_pix(LCD16_COLOR_BORDER); + c139_lcd_send_pix(LCD16_COLOR_WHITE); } static void r2d_refresh_task_kill(void) diff -r 09cdd5bf04e4 -r 502a0a3f6a49 src/cs/drivers/drv_app/r2d/r2d_inits.c --- a/src/cs/drivers/drv_app/r2d/r2d_inits.c Sat Oct 17 22:50:15 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/r2d_inits.c Sun Oct 18 02:03:10 2020 +0000 @@ -92,6 +92,8 @@ #ifdef CONFIG_TARGET_LUNA #include "r2d/lcds/luna/r2d_task_init_i.c" +#elif defined(CONFIG_TARGET_C139) + #include "r2d/lcds/c139/r2d_task_init_i.c" #else #error "R2D hw init selection: unsupported target" #endif diff -r 09cdd5bf04e4 -r 502a0a3f6a49 src/cs/drivers/drv_app/r2d/r2d_refresh.c --- a/src/cs/drivers/drv_app/r2d/r2d_refresh.c Sat Oct 17 22:50:15 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/r2d_refresh.c Sun Oct 18 02:03:10 2020 +0000 @@ -73,6 +73,8 @@ #include "lcds/luna/r2d_task_i_bw.c" #elif defined(CONFIG_TARGET_LUNA) && (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW) #include "lcds/luna/r2d_task_i_96x64.c" +#elif defined(CONFIG_TARGET_C139) && (R2D_EMBEDDED_LCD == R2D_FB_96x64_BW) + #include "lcds/c139/r2d_task_i.c" #else #error "R2D refresh selection: unsupported combination" #endif