# HG changeset patch # User Mychaela Falconia # Date 1590218016 0 # Node ID 6a53de2c4fc27b8f0a400b6009afbfbc80e43426 # Parent 4f40ae165be4072dedd93bb2bd5dffa08af74557 R2D sync with Magnetite R2D is never compiled in Selenite, thus the present change has absolutely no impact on anything - but this sync is being done in order to keep the overall diff between Magnetite and Selenite to a minimum. diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/lcds/luna/r2d_luna_lcd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_luna_lcd.h Sat May 23 07:13:36 2020 +0000 @@ -0,0 +1,16 @@ +/* + * This header file provides definitions for the Luna LCD hardware interface. + */ + +/* reset control */ +#define CNTL_RST_REG (*(volatile unsigned short *)0xFFFFFD04) +#define EXT_RESET 0x0004 + +/* the LCD is connected to Calypso nCS3, with A1 line as register select */ + +#define LCD_IR (*(volatile unsigned short *)0x02000000) +#define LCD_DR (*(volatile unsigned short *)0x02000002) + +/* macro for writing first IR, then DR */ + +#define LCD_REG_WR(reg, data) {LCD_IR = (reg); LCD_DR = (data);} diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i.c Sat May 23 07:13:36 2020 +0000 @@ -0,0 +1,63 @@ +#include "r2d/lcds/luna/r2d_luna_lcd.h" + +void r2d_lcd_power_on(void) +{ +} + +void r2d_lcd_power_off(void) +{ +} + +void r2d_refresh(void) +{ + UINT16 i,j; + UINT32 v; + UINT32 *p; + INT16 x1,x2,y1,y2,de,ds; + + p=r2d_g_framebuffer->p_memory_words; + + x1=(r2d_update_ul_x>>1)<<1; //0 + x2=((r2d_update_br_x>>1)<<1)+1; //174; + + ds=(x1>>1); + de=R2D_MWWIDTH-(x2>>1)-1; // WHY -1, is formula right ???? + + y1=r2d_update_ul_y; //0 + y2=r2d_update_br_y; //219 + + /* set window area */ + LCD_REG_WR(0x36, x2); + LCD_REG_WR(0x37, x1); + LCD_REG_WR(0x38, y2); + LCD_REG_WR(0x39, y1); + /* set current write address */ + LCD_REG_WR(0x20, x1); + LCD_REG_WR(0x21, y1); + /* set up for GRAM write */ + LCD_IR = 0x22; + + p=p+y1*R2D_MWWIDTH; + + for(i=y1;i<=y2;i++) + { + p+=ds; + for(j=(x1>>1);j<=(x2>>1);j++) + { + v=*p++; + v=~v; + + /*white*/ + /*v=0xffffffff*/ + /*black*/ + /*v=0x00000000*/ + + LCD_DR = v&0x0FFFF; + LCD_DR = v>>16; + } + p+=de; + } + + //r2d_check_and_send_event(r2d_g_framebuffer); + r2d_reinit_update_region(); +} diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_bw.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_i_bw.c Sat May 23 07:13:36 2020 +0000 @@ -0,0 +1,62 @@ +#include "r2d/lcds/luna/r2d_luna_lcd.h" + +void r2d_lcd_power_on(void) +{ +} + +void r2d_lcd_power_off(void) +{ +} + +void r2d_refresh(void) +{ + UINT16 i, j, k; + UINT32 v; + UINT32 *p; + INT16 y1, y2; + + p=r2d_g_framebuffer->p_memory_words; + + y1=r2d_update_ul_y; //0 + y2=r2d_update_br_y; //219 + + /* set window area */ + LCD_REG_WR(0x36, 175); + LCD_REG_WR(0x37, 0); + LCD_REG_WR(0x38, y2); + LCD_REG_WR(0x39, y1); + /* set current write address */ + LCD_REG_WR(0x20, 0); + LCD_REG_WR(0x21, y1); + /* set up for GRAM write */ + LCD_IR = 0x22; + + p=p+y1*R2D_MWWIDTH; + + 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) + LCD_DR = 0x0000; + else + LCD_DR = 0xFFFF; + v=v>>1; + } + } + v=*p++; + for (k=0;k<16;k++) + { + if (v&1) + LCD_DR = 0x0000; + else + LCD_DR = 0xFFFF; + v=v>>1; + } + } + + r2d_reinit_update_region(); +} diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c Sat May 23 07:13:36 2020 +0000 @@ -0,0 +1,79 @@ +#include "r2d/lcds/luna/r2d_luna_lcd.h" + +#define R2D_MB_PRIM_SIZE (4000) + +static void r2d_refresh_task_init(void) +{ + /* reset pulse */ + CNTL_RST_REG |= EXT_RESET; + rvf_delay(RVF_MS_TO_TICKS(10)); + CNTL_RST_REG &= ~EXT_RESET; + /* finish the job in the running R2D refresh task */ +} + +void r2d_refresh_task_secondary_init(void) +{ + UINT32 i; + + rvf_delay(RVF_MS_TO_TICKS(50)); + /* start register init */ + LCD_REG_WR(0x0001, 0x011c); // set SS and NL bit + LCD_REG_WR(0x0002, 0x0100); // set 1 line inversion + LCD_REG_WR(0x0003, 0x1030); // set GRAM write direction and BGR=1. + LCD_REG_WR(0x0008, 0x0808); // set BP and FP + LCD_REG_WR(0x000F, 0x0901); // Set frame rate + rvf_delay(RVF_MS_TO_TICKS(10)); + LCD_REG_WR(0x0010, 0x0000); // Set SAP,DSTB,STB + LCD_REG_WR(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC + rvf_delay(RVF_MS_TO_TICKS(50)); + LCD_REG_WR(0x0012, 0x200E); // Internal reference voltage= Vci; + LCD_REG_WR(0x0013, 0x0052); // Set GVDD + LCD_REG_WR(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage + //------------- Set GRAM area ------------------// + LCD_REG_WR(0x0030, 0x0000); + LCD_REG_WR(0x0031, 0x00DB); + LCD_REG_WR(0x0032, 0x0000); + LCD_REG_WR(0x0033, 0x0000); + LCD_REG_WR(0x0034, 0x00DB); + LCD_REG_WR(0x0035, 0x0000); + LCD_REG_WR(0x0036, 0x00AF); + LCD_REG_WR(0x0037, 0x0000); + LCD_REG_WR(0x0038, 0x00DB); + LCD_REG_WR(0x0039, 0x0000); + // ----------- Adjust the Gamma Curve ----------// + LCD_REG_WR(0x0050, 0x0000); + LCD_REG_WR(0x0051, 0x0705); + LCD_REG_WR(0x0052, 0x0C0A); + LCD_REG_WR(0x0053, 0x0401); + LCD_REG_WR(0x0054, 0x040C); + LCD_REG_WR(0x0055, 0x0608); + LCD_REG_WR(0x0056, 0x0000); + LCD_REG_WR(0x0057, 0x0104); + LCD_REG_WR(0x0058, 0x0E06); + LCD_REG_WR(0x0059, 0x060E); + rvf_delay(RVF_MS_TO_TICKS(50)); + LCD_REG_WR(0x0007, 0x1017); + + /* initial hw framebuffer clearing */ + LCD_REG_WR(0x20, 0); + LCD_REG_WR(0x21, 0); + LCD_IR = 0x22; + for (i = 0; i < 176*220; i++) + LCD_DR = 0xFFFF; /* white color */ +} + +static void r2d_refresh_task_kill(void) +{ +} + +static void r2d_dithering_init(void) +{ + R2D_MALLOC(r2d_mb_id,UINT32,sizeof(UINT32)*4,r2d_g_dithering_matrix); + if (r2d_g_dithering_matrix!=NULL) + { + r2d_g_dithering_matrix[0]=0; + r2d_g_dithering_matrix[1]=2; + r2d_g_dithering_matrix[2]=3; + r2d_g_dithering_matrix[3]=1; + } +} diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/r2d_inits.c --- a/src/cs/drivers/drv_app/r2d/r2d_inits.c Sat May 23 07:03:46 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/r2d_inits.c Sat May 23 07:13:36 2020 +0000 @@ -125,11 +125,19 @@ #endif #if (R2D_EMBEDDED_LCD == R2D_BOARD_DSAMPLE) -#include "r2d/lcds/D_Sample/r2d_task_init_i.c" + #ifdef CONFIG_TARGET_LUNA + #include "r2d/lcds/luna/r2d_task_init_i.c" + #else + #include "r2d/lcds/D_Sample/r2d_task_init_i.c" + #endif #endif #if (R2D_EMBEDDED_LCD == R2D_BOARD_BW_DSAMPLE) -#include "r2d/lcds/BW_D_Sample/r2d_task_init_i.c" + #ifdef CONFIG_TARGET_LUNA + #include "r2d/lcds/luna/r2d_task_init_i.c" + #else + #include "r2d/lcds/BW_D_Sample/r2d_task_init_i.c" + #endif #endif UINT32 r2d_get_memory_bank_size() diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/r2d_refresh.c --- a/src/cs/drivers/drv_app/r2d/r2d_refresh.c Sat May 23 07:03:46 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/r2d_refresh.c Sat May 23 07:13:36 2020 +0000 @@ -102,10 +102,18 @@ #endif #if (R2D_EMBEDDED_LCD == R2D_BOARD_DSAMPLE) -#include "lcds/D_Sample/r2d_task_i.c" + #ifdef CONFIG_TARGET_LUNA + #include "lcds/luna/r2d_task_i.c" + #else + #include "lcds/D_Sample/r2d_task_i.c" + #endif #endif #if (R2D_EMBEDDED_LCD == R2D_BOARD_BW_DSAMPLE) -#include "lcds/BW_D_Sample/r2d_task_i.c" + #ifdef CONFIG_TARGET_LUNA + #include "lcds/luna/r2d_task_i_bw.c" + #else + #include "lcds/BW_D_Sample/r2d_task_i.c" + #endif #endif diff -r 4f40ae165be4 -r 6a53de2c4fc2 src/cs/drivers/drv_app/r2d/r2d_task.c --- a/src/cs/drivers/drv_app/r2d/r2d_task.c Sat May 23 07:03:46 2020 +0000 +++ b/src/cs/drivers/drv_app/r2d/r2d_task.c Sat May 23 07:13:36 2020 +0000 @@ -38,6 +38,9 @@ extern INT16 r2d_g_refresh_disabled; +/* FreeCalypso addition */ +int r2d_is_running; + /******************************************************************************* ** Function r2d_core ** @@ -45,16 +48,20 @@ ** *******************************************************************************/ T_RVM_RETURN r2d_core(void) -{ +{ BOOLEAN error_occured = FALSE; // T_R2D_EVT * msg_ptr_rx, * msg_ptr_tx; - + //r2d_start(); - - rvf_send_trace("R2D REFRESH TASK STARTED",24, NULL_PARAM, - RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID ); - + rvf_send_trace("R2D REFRESH TASK STARTED", 24, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID); +#ifdef CONFIG_TARGET_LUNA + r2d_refresh_task_secondary_init(); + rvf_send_trace("R2D secondary init complete", 27, NULL_PARAM, + RV_TRACE_LEVEL_DEBUG_HIGH, R2D_USE_ID); +#endif + r2d_is_running = 1; /* loop to process messages */ while (error_occured == FALSE)