📄 r2d_task_i.c
字号:
#if 0
MI_dbgPrintf("zhq: XOR result, CompareFramebuffer_result = %x", CompareFramebuffer_result);
//X address set
/*
main_lcd_sendcommand( XADDRESS_AREA_SET );
main_lcd_sendcommand( 0x0 );
main_lcd_sendcommand( 0x9f );
*/
//Y address set
/*
main_lcd_sendcommand( YADDRESS_AREA_SET );
main_lcd_sendcommand( 0x0 );
main_lcd_sendcommand( 0x7f );
*/
i=0;
while ( i < R2D_HEIGHT )
{
j=0;
while ( j < (R2D_MWWIDTH) )
{
if(!(Compare_result[i/XOR_SIZE] & (1L<<(j/XOR_SIZE))))
{/* zhq, this XOR_BLOCK match. */
j += XOR_SIZE;
pPmemory_Words_Pointer += (R2D_MWWIDTH);
continue;
}
else
{
if(((i)%16) == 0)
{
main_lcd_sendcommand( XADDRESS_AREA_SET );
main_lcd_sendcommand(i);
main_lcd_sendcommand(i+15);
main_lcd_sendcommand( YADDRESS_AREA_SET );
main_lcd_sendcommand( 0x0 );
main_lcd_sendcommand( 0x7f );
}
}
Lcd_Temp = *pPmemory_Words_Pointer++;
#if 1
Lcd_Byte_1 = Lcd_Temp & 0x0000ffff;
Lcd_Byte_2 = (Lcd_Temp & 0xffff0000) >> 16;
main_lcd_senddata(Lcd_Byte_1);
main_lcd_senddata(Lcd_Byte_2);
#else
*((volatile UINT16 *) MAIN_LCD_DATA_ADDR) = (UINT16)Lcd_Temp & 0x0000ffff;
*((volatile UINT16 *) MAIN_LCD_DATA_ADDR) = (UINT16)(Lcd_Temp & 0xffff0000) >> 16;
#endif
j++;
}
//pPmemory_Words_Pointer++;
i++;
}
#endif
#elif( LCDC_DRV_CHIP == 1 )
UINT32 addr1;
UINT16 *pframeBuf;
/*
if(pCamConfig.m_nCurAction == CAMERA_MODE)
return;
pframeBuf=( UINT16 *)r2d_g_framebuffer->p_memory_words;
addr1=GetStartAddress(cl_MAIN_WINDOW);
halWriteData(2, addr1,pframeBuf, R2D_HEIGHT*R2D_WIDTH*2);
clStartOneFrameTransfer();
*/
unsigned char i,j;
UINT32 Lcd_Temp,*pPmemory_Words_Pointer;
UINT16 Lcd_Byte_1,Lcd_Byte_2;
UINT16 Lcd_Byte_temp;
extern CAMCONFIG pCamConfig;
if(pCamConfig.m_nCurAction == CAMERA_MODE)
return;
pPmemory_Words_Pointer=r2d_g_framebuffer->p_memory_words;
//X address set
main_lcd_sendcommand( 0x2a );
main_lcd_senddata( 0x04 );
main_lcd_senddata( 0x83 );
//Y address set
main_lcd_sendcommand( 0x2b );
main_lcd_senddata( 0x04 );
main_lcd_senddata( 0x83 );
main_lcd_sendcommand( 0x2c );
i=0;
while ( i < 128 )
{
j=0;
while ( j < (R2D_MWWIDTH) )
{
Lcd_Temp = *pPmemory_Words_Pointer++;
#if 1
Lcd_Byte_1 = Lcd_Temp & 0x0000ffff;
Lcd_Byte_2 = (Lcd_Temp & 0xffff0000) >> 16;
main_lcd_senddata8((Lcd_Byte_1>>8 )& 0x00ff);
main_lcd_senddata8(Lcd_Byte_1 & 0x00ff);
main_lcd_senddata8((Lcd_Byte_2>>8 )& 0x00ff);
main_lcd_senddata8(Lcd_Byte_2 & 0x00ff);
#else
*((volatile UINT16 *) MAIN_LCD_DATA_ADDR) = (UINT16)Lcd_Temp & 0x0000ffff;
*((volatile UINT16 *) MAIN_LCD_DATA_ADDR) = (UINT16)(Lcd_Temp & 0xffff0000) >> 16;
#endif
j++;
}
//pPmemory_Words_Pointer++;
i++;
}
#endif
r2d_reinit_update_region();
#if (R2D_BENCHMARKING == R2D_ON)
if ( r2d_g_tick==0 )
{
time=rvf_get_tick_count()-time;
r2d_g_tick=1;
rvf_send_trace("R2D : Nb refreshs",17,R2D_REFRESH_LOOP,
RV_TRACE_LEVEL_ERROR, TRACE_R2D );
rvf_send_trace("R2D : Ms=",9,time*10,
RV_TRACE_LEVEL_ERROR, TRACE_R2D );
}
#endif
}
#if( LCMS_DRV_CHIP == 0 )
#define SUBLCD_PAGES 8
#define SUBLCD_COLUMNS 96
#define SUBLCD_BYTESPER_PAGE 96
#define DIV8(v) ((v)>>3)
#define MOD8(v) ((v) & 0x07)
#define DISPLAY_SELECT_COMMAND 0xa4
#define DISPLAY_LINE_COMMAND 0x40
static unsigned char temp_frame[64*12];
#elif(LCMS_DRV_CHIP == 1)
#define SUBLCD_PAGES 8
#define SUBLCD_COLUMNS 96
#define SUBLCD_BYTESPER_PAGE 96
#define DIV8(v) ((v)>>3)
#define MOD8(v) ((v) & 0x07)
#define DISPLAY_SELECT_COMMAND 0xa4
#define DISPLAY_LINE_COMMAND 0x40
static unsigned char temp_frame[64*12];
//#define SUBLCD_PAGES 5
//#define SUBLCD_COLUMNS 96
//#define SUBLCD_BYTESPER_PAGE 96
#elif(LCMS_DRV_CHIP == 2)
#define SUBLCD_PAGES 16
#define SUBLCD_COLUMNS 96
#define SUBLCD_BYTESPER_PAGE 96
#endif
void r2d_sub_refresh(void)
{
#if( LCMS_DRV_CHIP == 0 )
UINT16 iPage, iCol, iBytes, iBits, iPageBase;
UINT8 *oPixels, *nPixels, val, *p_temp_frame;
UINT16* pbuffer;
UINT8 byte = 0x00;
int i,j;
//pbuffer = r2d_g_subframebuffer->p_memory_words;
p_temp_frame = temp_frame;
for( i = 0; i < R2D_SUB_HEIGHT; i++ )
{
//pbuffer = (UINT16*)( i * (R2D_MWWIDTH-1) + r2d_g_subframebuffer->p_memory_words);
pbuffer = (UINT16*)( i * (R2D_MWWIDTH) + r2d_g_subframebuffer->p_memory_words);
for(j = 0; j < (R2D_SUB_WIDTH >> 3); j++)
{
byte = 0x00;
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 7);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 6);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 5);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 4);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 3);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 2);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 1);
byte |= (UINT8)(((*pbuffer++) & 0x0001) << 0);
*p_temp_frame++ = ~byte;
}
}
oPixels = temp_frame;
sub_lcd_sendcommand(DISPLAY_LINE_COMMAND);
for ( iPage = 0; iPage < SUBLCD_PAGES; iPage ++ )
{
iPageBase = SUBLCD_BYTESPER_PAGE * iPage;
/*page address set*/
sub_lcd_sendcommand( 0xb0 | iPage);
/*column address set*/
sub_lcd_sendcommand( 0x00 );
sub_lcd_sendcommand( 0x10 );
for ( iCol = 0; iCol < SUBLCD_COLUMNS; iCol ++ )
{
/*Get Data for Updating*/
val = 0;
iBytes = iPageBase + DIV8(iCol);
iBits = MOD8(iCol);
val = val |((((0x80>>iBits) & oPixels[iBytes]) << iBits)>>7);
val = val |((((0x80>>iBits) & oPixels[iBytes + 12]) << iBits)>>6);
val = val |((((0x80>>iBits) & oPixels[iBytes + 24]) << iBits)>>5);
val = val |((((0x80>>iBits) & oPixels[iBytes + 36]) << iBits)>>4);
val = val |((((0x80>>iBits) & oPixels[iBytes + 48]) << iBits)>>3);
val = val |((((0x80>>iBits) & oPixels[iBytes + 60]) << iBits)>>2);
val = val |((((0x80>>iBits) & oPixels[iBytes + 72]) << iBits)>>1);
val = val |((((0x80>>iBits) & oPixels[iBytes + 84]) << iBits)>>0);
/*Get Data OK!*/
/*Send the Data to Physical Screen*/
sub_lcd_senddata(val);
}
}
#elif( LCMS_DRV_CHIP == 1 )
UINT16 *pbuffer;
char i,j;
UINT8 byte;
UINT8 page=0xb1;
UINT8 H_col=0x11;
UINT8 L_col=0x04;
for(i=0;i<5;i++)
{
pbuffer = (UINT16*)( i*8*(R2D_MWWIDTH) + r2d_g_subframebuffer->p_memory_words);
i2c_setaddress(page, L_col, H_col );
i2c_senddata_continue_cmd();
for(j=0;j<96;j++)
{
byte = 0;
byte |= (UINT8)(((*pbuffer) & 0x0001) << 0);
byte |= (UINT8)(((*(pbuffer+2*R2D_MWWIDTH)) & 0x0001) << 1);
byte |= (UINT8)(((*(pbuffer+4*R2D_MWWIDTH)) & 0x0001) << 2);
byte |= (UINT8)(((*(pbuffer+6*R2D_MWWIDTH)) & 0x0001) << 3);
byte |= (UINT8)(((*(pbuffer+8*R2D_MWWIDTH)) & 0x0001) << 4);
byte |= (UINT8)(((*(pbuffer+10*R2D_MWWIDTH)) & 0x0001) << 5);
byte |= (UINT8)(((*(pbuffer+12*R2D_MWWIDTH)) & 0x0001) << 6);
byte |= (UINT8)(((*(pbuffer+14*R2D_MWWIDTH)) & 0x0001) << 7);
*pbuffer++;
i2c_senddata_continue_data(~byte);
//i2c_senddata(~byte);
//i2c_senddata(0xcc);
}
i2c_end();
page++;
}
#elif( LCMS_DRV_CHIP == 2 ) //for PHILIPS (PCF8820) (M288S)
UINT16 *pbuffer;
UINT8 byte = 0x00;
int iPage,iCol;
int page=0x41;
int col =0x80;
for ( iPage = 0; iPage < SUBLCD_PAGES; iPage ++ )
{
pbuffer = (UINT16*)( iPage*4*(R2D_MWWIDTH) + r2d_g_subframebuffer->p_memory_words);
/*page address set*/
i2c_setaddress(page, col );
i2c_senddata_continue_cmd();
for ( iCol = 0; iCol < SUBLCD_COLUMNS; iCol ++ )
{
/*Get Data for Updating*/
byte = 0;
byte |= (UINT8)(((*pbuffer) & 0x0003) << 0);
byte |= (UINT8)(((*(pbuffer+2*R2D_MWWIDTH)) & 0x0003) << 2);
byte |= (UINT8)(((*(pbuffer+4*R2D_MWWIDTH)) & 0x0003) << 4);
byte |= (UINT8)(((*(pbuffer+6*R2D_MWWIDTH)) & 0x0003) << 6);
*pbuffer++;
i2c_senddata_continue_data(~byte);
}
page++;
i2c_end();
}
#endif
}
#else
/*
Convert LCD format framebuffer to windows 32bit ARGB data buffer,
applications that use this function must allocate enough memory
pointed by buf before invoke it
*/
#define lcd2win_red(lcdPixel,lcdStat) (UINT32)(((lcdPixel & 0xf800) << 8) >> lcdStat)
#define lcd2win_green(lcdPixel,lcdStat) (UINT32)(((lcdPixel & 0x07e0) << 5) >> lcdStat)
#define lcd2win_blue(lcdPixel,lcdStat) (UINT32)(((lcdPixel & 0x001f) << 3) >> lcdStat)
void GetAndConvertR2DGC(char * buf, int lcdStatus, int sub)
{
UINT32 *memoryWordPtr, *desBuf;
int row, col, ls;
UINT16 firstPixel, secondPixel;
if(buf == NULL)
return;
desBuf = (UINT32*)buf;
if(sub == 1) /* get sub LCD framebuffer */
{
ls = 0;
for(row = 0; row < 64; row++)
{
memoryWordPtr = r2d_g_subframebuffer->p_memory_words + row * R2D_MWWIDTH;
for(col = 0; col < 48; col++)
{
firstPixel = (UINT16)(*memoryWordPtr & 0x0000ffff);
secondPixel = (UINT16)((*memoryWordPtr & 0xffff0000) >> 16);
*desBuf = 0;
*desBuf |= lcd2win_red(firstPixel,ls) | lcd2win_green(firstPixel,ls) | lcd2win_blue(firstPixel,ls);
desBuf ++;
*desBuf = 0;
*desBuf |= lcd2win_red(secondPixel,ls) | lcd2win_green(secondPixel,ls) | lcd2win_blue(secondPixel,ls);
desBuf ++;
memoryWordPtr++;
}
}
}
else
{
memoryWordPtr = r2d_g_framebuffer->p_memory_words;
for(row = 0; row < R2D_HEIGHT; row++)
{
// robert.chen modified, 2004-07-30, for compatiable with new R2D framebuffer (jpeg codec directly refresh LCD)
// for(col = 0; col < R2D_MWWIDTH - 1; col++)
for(col = 0; col < R2D_MWWIDTH; col++)
{
firstPixel = (UINT16)(*memoryWordPtr & 0x0000ffff);
secondPixel = (UINT16)((*memoryWordPtr & 0xffff0000) >> 16);
if(lcdStatus)
ls = 0;
else
ls = 1;
*desBuf = 0;
*desBuf |= lcd2win_red(firstPixel,ls) | lcd2win_green(firstPixel,ls) | lcd2win_blue(firstPixel,ls);
desBuf ++;
*desBuf = 0;
*desBuf |= lcd2win_red(secondPixel,ls) | lcd2win_green(secondPixel,ls) | lcd2win_blue(secondPixel,ls);
desBuf ++;
memoryWordPtr++;
}
// robert.chen removed, 2004-07-30, for compatiable with new R2D framebuffer (jpeg codec directly refresh LCD)
// memoryWordPtr++;
}
}
return;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -