// number_position: 0~1st number, 1~2nd number ,2~% void show_animation_number(UINT32 index,UINT32 number_position){ UINT32 logonum; UINT32 logolen; UINT32 inaddr; UINT32 i; void *fb_addr = mt65xx_get_fb_addr(); UINT32 fb_size = mt65xx_get_fb_size(); void *db_addr = mt65xx_get_logo_db_addr(); unsigned int *pinfo = (unsigned int*)db_addr; logonum = pinfo[0]; printf("[ChargingAnimation]show_animation_number :index= %d, logonum = %d\n", index, logonum); //ASSERT(index < logonum); if(index < logonum) logolen = pinfo[3+index] - pinfo[2+index]; else logolen = pinfo[1] - pinfo[2+index]; inaddr = (unsigned int)db_addr+pinfo[2+index]; printf("[ChargingAnimation]show_animation_number, in_addr=0x%08x, dest_addr=0x%08x, logolen=%d, ticks=%d\n", inaddr, logolen, logolen, get_ticks()); //windows draw default 160 180, mt65xx_logo_decompress((void*)inaddr, (void*)number_pic_addr, logolen, number_pic_size); fill_rect_flow(number_location_rect.left+ number_pic_width*number_position, number_location_rect.top, number_location_rect.right+number_pic_width*number_position, number_location_rect.bottom,number_pic_addr); //mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); }
void show_animation_line(UINT32 index,UINT32 capacity_grids){ UINT32 logonum; UINT32 logolen; UINT32 inaddr; UINT32 i; void *fb_addr = mt65xx_get_fb_addr(); UINT32 fb_size = mt65xx_get_fb_size(); void *db_addr = mt65xx_get_logo_db_addr(); unsigned int *pinfo = (unsigned int*)db_addr; logonum = pinfo[0]; printf("[ChargingAnimation]show_animation_line :index= %d, logonum = %d\n", index, logonum); //ASSERT(index < logonum); if(index < logonum) logolen = pinfo[3+index] - pinfo[2+index]; else logolen = pinfo[1] - pinfo[2+index]; inaddr = (unsigned int)db_addr+pinfo[2+index]; printf("[ChargingAnimation]show_animation_line, in_addr=0x%08x, dest_addr=0x%08x, logolen=%d, ticks=%d\n", inaddr, logolen, logolen, get_ticks()); //windows draw default 160 180, mt65xx_logo_decompress((void*)inaddr, (void*)line_pic_addr, logolen, line_pic_size); printf("[ChargingAnimation]show_animation_line :line_pic_size= %d, line_pic_addr size = %d\n", line_pic_size, sizeof(line_pic_addr)); fill_line_flow(battery_rect.left, capacity_grids, battery_rect.right, battery_rect.bottom, line_pic_addr); }
// this is a sample code for how to draw the logo by yourself. void cust_show_boot_logo(void) { void *fb_addr = mt65xx_get_fb_addr(); UINT32 fb_size = mt65xx_get_fb_size(); void *db_addr = mt65xx_get_logo_db_addr(); memcpy(fb_addr, (UINT32)db_addr + fb_size * 0, fb_size); mt65xx_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT); }
void mt65xx_disp_fill_rect(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom, UINT32 color) { void * fb_addr = mt65xx_get_fb_addr(); const UINT32 WIDTH = ALIGN_TO(CFG_DISPLAY_WIDTH, 32); const UINT32 HEIGHT = CFG_DISPLAY_HEIGHT; const UINT16 COLOR = (UINT16)color; UINT16 *pLine; INT32 x, y; pLine = (UINT16 *)fb_addr + top * WIDTH + left; #if 1 if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3)) { unsigned int l; UINT16 *d = fb_addr; for (x=top; x<bottom; x++){ for (y=left, l= HEIGHT - left; y<right; y++, l--) { d = fb_addr + ((WIDTH * l + x) << 1); *d = COLOR; } } } else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2)) { unsigned int l; UINT16 *d = fb_addr; for (x=WIDTH - top + 1; x > WIDTH - bottom; x--){ for (y=left, l=left; y<right; y++, l++) { d = fb_addr + ((WIDTH * l + x) << 1); *d = COLOR; } } } else #endif { for (y = top; y < bottom; ++ y) { UINT16 *pPixel = pLine; for (x = left; x < right; ++ x) { *pPixel++ = COLOR; } pLine += WIDTH; } } }
static void fill_rect_flow(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom, char *addr) { void * fb_addr = mt65xx_get_fb_addr(); const UINT32 WIDTH = ALIGN_TO(CFG_DISPLAY_WIDTH, 32); const UINT32 HEIGHT = CFG_DISPLAY_HEIGHT; UINT16 *pLine = (UINT16 *)fb_addr + top * WIDTH + left; INT32 x, y; INT32 i = 0; if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3)) { printf("[ChargingAnimation]fill_rect_flow : MTK_LCM_PHYSICAL_ROTATION = 270\n"); unsigned int l; UINT16 *d = fb_addr; UINT16 *pLine2 = (UINT16*)addr; for (x=top; x<bottom; x++) { for (y=left, l= HEIGHT - left; y<right; y++, l--) { d = fb_addr + ((WIDTH * l + x) << 1); *d = pLine2[i++]; } } } else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2)) { printf("[ChargingAnimation]fill_rect_flow : MTK_LCM_PHYSICAL_ROTATION = 90\n"); unsigned int l; UINT16 *d = fb_addr; UINT16 *pLine2 = (UINT16*)addr; for (x=WIDTH - top + 1; x > WIDTH - bottom; x--) { for (y=left, l=left; y<right; y++, l++) { d = fb_addr + ((WIDTH * l + x) << 1); *d = pLine2[i++]; } } } else { UINT16 *pLine2 = (UINT16*)addr; for (y = top; y < bottom; ++ y) { UINT16 *pPixel = pLine; for (x = left; x < right; ++ x) { *pPixel++ = pLine2[i++]; } pLine += WIDTH; } } }
static void fill_rect_flow2(UINT32 left, UINT32 top, UINT32 right, UINT32 bottom, char *addr) { void * fb_addr = mt65xx_get_fb_addr(); const UINT32 WIDTH = ALIGN_TO(CFG_DISPLAY_WIDTH, 32); UINT16 *pLine = (UINT16 *)fb_addr + top * WIDTH + left; INT32 x, y; INT32 i = 0; UINT16 *pLine2 = (UINT16*)addr; for (y = top; y < bottom; ++ y) { UINT16 *pPixel = pLine; for (x = left; x < right; ++ x) { *pPixel++ = pLine2[i++]; } pLine += WIDTH; } }
void show_animation(UINT32 index, RECT rect, char* addr){ UINT32 logonum; UINT32 logolen; UINT32 inaddr; UINT32 i; void *fb_addr = mt65xx_get_fb_addr(); UINT32 fb_size = mt65xx_get_fb_size(); void *db_addr = mt65xx_get_logo_db_addr(); unsigned int *pinfo = (unsigned int*)db_addr; logonum = pinfo[0]; printf("[ChargingAnimation]show_animation : index = %d, logonum = %d\n", index, logonum); //ASSERT(index < logonum); printf("[ChargingAnimation]show_animation :pinfo[0] = %d, pinfo[1] = %d, pinfo[2]= %d, pinfo[3] = %d\n",pinfo[0] , pinfo[1],pinfo[2],pinfo[3]); printf("[ChargingAnimation]show_animation :pinfo[2+index] = %d, pinfo[1] = %d\n",pinfo[2+index] , pinfo[3+index]); if(index < logonum) logolen = pinfo[3+index] - pinfo[2+index]; else logolen = pinfo[1] - pinfo[2+index]; inaddr = (unsigned int)db_addr+pinfo[2+index]; printf("[ChargingAnimation]show_animation: in_addr=0x%08x, dest_addr=0x%08x, logolen=%d, ticks=%d\n", inaddr, logolen, logolen, get_ticks()); mt65xx_logo_decompress((void*)inaddr, (void*)addr, logolen, (rect.right-rect.left)*(rect.bottom-rect.top)*2); printf("[ChargingAnimation]show_animation : rect right = %d\n", rect.right); printf("[ChargingAnimation]show_animation : rect top = %d\n", rect.top); printf("[ChargingAnimation]show_animation : rect size = %d\n", (rect.right-rect.left)*(rect.bottom-rect.top)*2); fill_rect_flow(rect.left,rect.top,rect.right,rect.bottom,addr); printf("ticks=%d\n", get_ticks()); }
static void show_logo(UINT32 index) { UINT32 logonum; UINT32 logolen; UINT32 inaddr; void *fb_addr = mt65xx_get_fb_addr(); UINT32 fb_size = mt65xx_get_fb_size(); void *db_addr = mt65xx_get_logo_db_addr(); unsigned int *pinfo = (unsigned int*)db_addr; logonum = pinfo[0]; ASSERT(index < logonum); if(index < logonum) logolen = pinfo[3+index] - pinfo[2+index]; else logolen = pinfo[1] - pinfo[2+index]; inaddr = (unsigned int)db_addr+pinfo[2+index]; printf("show_logo, in_addr=0x%08x, fb_addr=0x%08x, logolen=%d, ticks=%d\n", inaddr, fb_addr, logolen, get_ticks()); // mt65xx_logo_decompress((void*)inaddr, (void*)fb_addr + 2 * fb_size, logolen, fb_size); #if 1 { unsigned short *d; int j,k; if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "270", 3)) { unsigned int l; unsigned short *s; unsigned int width = CFG_DISPLAY_WIDTH; unsigned int height = CFG_DISPLAY_HEIGHT; mt65xx_logo_decompress((void*)inaddr, (void*)fb_addr + 2 * fb_size, logolen, fb_size); s = fb_addr + 2 * fb_size; for (j=0; j<width; j++){ for (k=0, l=height-1; k<height; k++, l--) { d = fb_addr + ((ALIGN_TO(width, 32) * l + j) << 1); *d = *s++; } } } else if(0 == strncmp(MTK_LCM_PHYSICAL_ROTATION, "90", 2)) { unsigned int l; unsigned short *s; unsigned int width = CFG_DISPLAY_WIDTH; unsigned int height = CFG_DISPLAY_HEIGHT; mt65xx_logo_decompress((void*)inaddr, (void*)fb_addr + 2 * fb_size, logolen, fb_size); s = fb_addr + 2 * fb_size; for (j=width - 1; j>=0; j--){ for (k=0, l=0; k<height; k++, l++) { d = fb_addr + ((ALIGN_TO(width, 32) * l + j) << 1); *d = *s++; } } } else #endif { if(0 != CFG_DISPLAY_WIDTH % 32){ unsigned short *s; unsigned short *d; unsigned int width = CFG_DISPLAY_WIDTH; unsigned int height = CFG_DISPLAY_HEIGHT; mt65xx_logo_decompress((void*)inaddr, (void*)fb_addr + 2 * fb_size, logolen, fb_size); s = fb_addr + 2 * fb_size; d = fb_addr; for (j=0;j < height; j++){ { memcpy(d, s, width * 2); d += ALIGN_TO(width, 32); s += width; } } } else{ mt65xx_logo_decompress((void*)inaddr, (void*)fb_addr, logolen, fb_size); } } } printf("ticks=%d\n", get_ticks()); }
DPI_STATUS DPI_Init_PLL(unsigned int mipi_pll_clk_ref,unsigned int mipi_pll_clk_div1,unsigned int mipi_pll_clk_div2) { unsigned int reg_value = 0; #if 0 MIPITX_CFG0_REG con0 = DSI_PHY_REG_DPI->MIPITX_CON0; MIPITX_CFG1_REG con1 = DSI_PHY_REG_DPI->MIPITX_CON1; #ifdef DPI_MIPI_API enable_mipi(MT65XX_MIPI_TX, "DPI"); #endif #ifdef BUILD_UBOOT OUTREG16(0xc2080858, 0x8000); OUTREG16(0xc20a3824, 0x4008); MASKREG16(0xc20a380c, 0x000c, 0x0000); //default value is 0x7008, but should be 0x7000 #else OUTREG16(0xf2080858, 0x8000); //?? OUTREG16(0xf20a3824, 0x4008); MASKREG16(0xf20a380c, 0x000c, 0x0000); //default value is 0x7008, but should be 0x7000 MASKREG16(PLL_SOURCE, 0x0010, 0x0010); // #endif con1.RG_PLL_DIV1 = mipi_pll_clk_div1; con1.RG_PLL_DIV2 = mipi_pll_clk_div2; con0.PLL_CLKR_EN = 1; con0.PLL_EN = 1; con0.RG_DPI_EN = 1; // Set to DSI_PHY_REG OUTREG32(&DSI_PHY_REG_DPI->MIPITX_CON0, AS_UINT32(&con0)); OUTREG32(&DSI_PHY_REG_DPI->MIPITX_CON1, AS_UINT32(&con1)); #else //#ifndef BUILD_UBOOT #if 0 OUTREG32(DISPSYS_BASE + 0x34, 0x02);//set RDMA0 to DPI #if 0 //CG OUTREG32(DISPSYS_BASE + 0x104, 0xffffffff);//set CG OUTREG32(DISPSYS_BASE + 0x108, 0xffffffff); OUTREG32(DISPSYS_BASE + 0x114, 0xffffffff); OUTREG32(DISPSYS_BASE + 0x118, 0xffffffff); #endif OUTREG32(DISP_MUTEX_BASE + 0x28, 0x01);//reset mutex OUTREG32(DISP_MUTEX_BASE + 0x28, 0); OUTREG32(DISP_MUTEX_BASE + 0x2c, 0x80); //rdma0 is in the mutex OUTREG32(DISP_MUTEX_BASE + 0x30, 0x2); //dpi0 is the dst OUTREG32(DISP_MUTEX_BASE + 0x24, 0x1); //lock mutex0 OUTREG32(DISP_MUTEX_BASE + 0, 0x1); //lock mutex0 // OUTREG32(MUTEX_BASE + 0x4, 0x1); //lock mutex0 while((INREG32(DISP_MUTEX_BASE + 0x24)&0x02)!=0x02){} // polling until mutex lock complete OUTREG32(DISPSYS_BASE + 0xC08, 0x01);//select DPI pin OUTREG32(DISPSYS_BASE + 0x60, 0x8);// DPI src clock //RDMA0 setting OUTREG32(RDMA0_BASE + 0x10, 0); //stop rdma0 // width, height and format OUTREG32(RDMA0_BASE + 0x14, lcm_params->width); OUTREG32(RDMA0_BASE + 0x18, lcm_params->height); OUTREG32(RDMA0_BASE + 0x24, 0x40);//input format ARGB888 #ifndef BUILD_UBOOT OUTREG32(RDMA0_BASE + 0x28, FB_Addr);//input addr #else OUTREG32(RDMA0_BASE + 0x28, mt65xx_get_fb_addr());//input addr #endif OUTREG32(RDMA0_BASE + 0x2C, lcm_params->width*2);//input pitch OUTREG32(RDMA0_BASE + 0x30, 0x10101010); OUTREG32(RDMA0_BASE + 0x40, 0x80f00008); OUTREG32(RDMA0_BASE + 0x50, 0); OUTREG32(RDMA0_BASE + 0x54, 0); OUTREG32(RDMA0_BASE + 0x58, 0); OUTREG32(RDMA0_BASE + 0x5C, 0); OUTREG32(RDMA0_BASE + 0x60, 0); OUTREG32(RDMA0_BASE + 0x64, 0); OUTREG32(RDMA0_BASE + 0x68, 0); OUTREG32(RDMA0_BASE + 0x6C, 0); OUTREG32(RDMA0_BASE + 0x70, 0); OUTREG32(RDMA0_BASE + 0x74, 0); OUTREG32(RDMA0_BASE + 0x78, 0); OUTREG32(RDMA0_BASE + 0x7C, 0); OUTREG32(RDMA0_BASE + 0x80, 0); OUTREG32(RDMA0_BASE + 0x84, 0); OUTREG32(RDMA0_BASE + 0x88, 0); OUTREG32(RDMA0_BASE + 0x8C, 0); //start rdma OUTREG32(RDMA0_BASE + 0x10, 0x03); //start + memory mode // dump register //release mutex0 // OUTREG32(MUTEX_BASE + 0x24, 0); // while((INREG32(MUTEX_BASE + 0x24)&&0x02)!=0){} // polling until mutex lock complete #endif #endif return DPI_STATUS_OK; }