📄 t6963fb.c
字号:
}while(lcd_status != 0x01); return 0;}/************************************************************************* 功能:parse st5 参数: 返回值:0 OK -1 err **************************************************************************/static signed char st05(void){ if(((ReadStatus()>>5) & 0x01) == 0x01)return 0; else return -1; }/************************************************************************* 功能:parse st6 参数: 返回值:0 OK -1 err **************************************************************************/static signed char st06(void){ if(((ReadStatus()>>6) & 0x01) == 0x01)return -1; else return 0; }/************************************************************************* 功能:parse st7 参数: 返回值:0 OK -1 err **************************************************************************/static signed char st07(void){ if(((ReadStatus()>>7) & 0x01) == 0x01)return -1; else return 0; }/************************************************************************* 功能:write_data 参数: 返回值:0 OK -1 err **************************************************************************/static char write_data(u8 dat){ u_int32_t tmod; if(st01() < 0) return -2; LCD_WRITE_EN(); LCD_CS_CLR; LCD_CD_CLR; tmod = GPDDAT & 0xff00; tmod |= (int)dat; GPDDAT = tmod; LCD_WR_CLR; delay(20); LCD_WR_SET; LCD_CS_SET; return 0;}/************************************************************************* 功能:write_command 参数: 返回值:0 OK -1 err **************************************************************************/static char write_command(u8 cmd){ u_int32_t tmod; if(st01() < 0) return -2; LCD_WRITE_EN(); LCD_CS_CLR; LCD_CD_SET; tmod = GPDDAT & 0xff00; tmod |= (int)cmd; GPDDAT = tmod; LCD_WR_CLR; delay(20); LCD_WR_SET; LCD_CS_SET; return 0;}/************************************************************************* 功能:read_data 参数: 返回值:0 OK -1 err **************************************************************************/static char read_data(void){ u_int32_t tmod; char i; if(st01() < 0) return -2; LCD_READ_EN(); LCD_CS_CLR; LCD_CD_CLR; LCD_RD_CLR; tmod = GPDDAT & 0x00ff; i = (char)tmod; delay(20); LCD_RD_SET; LCD_CS_SET; return i;}/************************************************************************* 功能:LCD显示开 参数: 返回值:0 OK -1 err **************************************************************************/static inline void LCMOn(void) { write_command( 0x98 );}/************************************************************************* 功能:LCD显示关 参数: 返回值:0 OK -1 err **************************************************************************/static inline void LCMOff(void) { write_command( 0x90 );}/************************************************************************* 功能:LCMSetAddr 参数: 返回值:0 OK -1 err **************************************************************************/static void LCMSetAddr(unsigned int addr){ unsigned char AddrMSB; unsigned char AddrLSB; AddrMSB = addr>>8; AddrLSB = (unsigned char)(addr); write_data(AddrLSB); write_data(AddrMSB); write_command(0x24); }/************************************************************************* 功能:data_to_lcd 参数: 返回值:0 OK -1 err **************************************************************************/static signed char DATA_wr_LCD(u16 start_add, u8 *data_tmp, u16 d_len){ u16 i; LCMSetAddr(start_add); write_command(0xB0); if(st03() == -1) { printk("Auto write timeout!\n"); return -3; } for(i = 0; i < d_len;i++) { write_data(*data_tmp++); } write_command(0xB2); return 0; }/************************************************************************* 功能:data_to_lcd 参数: 返回值:0 OK -1 err **************************************************************************/static signed char DATA_wr_LCD_hand(u16 start_add, u8 *data_tmp, u16 d_len){ u16 i; LCMSetAddr(start_add); for(i = 0; i < d_len;i++) { write_data(*data_tmp++); write_command(0xC0); } return 0; }/************************************************************************* 功能:data_from_lcd 参数: 返回值:0 OK -1 err **************************************************************************/static char DATA_rd_LCD(u16 start_add, u8 *data_tmp, u16 d_len){ u16 i; LCMSetAddr(start_add); write_command(0xB1); for(i = 0; i < d_len;i++) { *data_tmp++ = read_data(); } write_command(0xB3); return 0; }/*****************************************************************************/void sed1335fb_pio_copy(unsigned long sed1335_pio){ /* Re-init refresh timer */ //printk("sed1335fb_pio_copy\n"); //int i; //for(i = 0;i < LCD_BUF_SIZE; i++) // t6963fb_buff[i] = 0xf0; del_timer(&pio_timer); pio_timer.expires = jiffies + PIO_REFRESH_TIMER_TICKS; add_timer(&pio_timer); //DATA_wr_LCD_hand(0, sed1335fb_buff, SED1335FB_BUFSIZE); if(flag_wake == 1) { wake_up_interruptible(&proc_list); flag_wake = 0; } else { if(memcmp(t6963fb_buff,tmp_buff,LCD_BUF_SIZE) != 0) { DATA_wr_LCD(0, t6963fb_buff, LCD_BUF_SIZE); memcpy(tmp_buff,t6963fb_buff,LCD_BUF_SIZE); //t6963fb_buff[10] = 0xff; //for(i = 0;i < LCD_BUF_SIZE; i++) // printk(" 0x%2x ",t6963fb_buff[i]); printk("LCD\n"); } } }///////////////////// LCDSADDR3/********************************************************************************* 函数名:LCMInit 功能:显示初始化 ** 入口参数:无 ** 返回参数:无 ** ** 编写人:方天戟 (Flanker Fang) ** 最后更新日期:2006-08-11 *********************************************************************************/void LCMInit2(void){ write_data(0x00); write_data(0x00); write_command(0x42); //设定图形首地址 000 write_data(30); //30行 write_data(0x00); // write_command(0x43); //设定图形区域}/********************************************************************************* 函数名:LCMInit 功能:显示初始化 ** 入口参数:无 ** 返回参数:无 ** ** 编写人:方天戟 (Flanker Fang) ** 最后更新日期:2006-08-11 *********************************************************************************/int __init s3c44b0xfb_init(void){ int err = -ENOMEM; int result; //char *fbuf; cfb = kmalloc(sizeof(*cfb) + sizeof(struct display), GFP_KERNEL); if (!cfb) goto out; memset(cfb, 0, sizeof(*cfb) + sizeof(struct display)); memset(t6963fb_buff, 0xff, LCD_BUF_SIZE); cfb->currcon = -1; strcpy(cfb->fb.fix.id, "s3c44b0"); cfb->fb.screen_base = t6963fb_buff; cfb->fb.fix.smem_start = t6963fb_buff; cfb->fb.fix.smem_len = LCD_BUF_SIZE; cfb->fb.fix.type = FB_TYPE_PACKED_PIXELS; cfb->fb.var.xres = LCD_XSIZE; cfb->fb.var.xres_virtual = SCR_XSIZE; cfb->fb.var.yres = LCD_YSIZE; cfb->fb.var.yres_virtual = SCR_YSIZE; cfb->fb.var.bits_per_pixel = LCD_DEPTH; cfb->fb.var.grayscale = 1; cfb->fb.var.activate = FB_ACTIVATE_NOW; cfb->fb.var.height = -1;//-1 cfb->fb.var.width = -1;//-1 cfb->fb.fbops = &s3c44b0fb_ops; cfb->fb.changevar = NULL;// cfb->fb.switch_con = s3c44b0fb_switch; cfb->fb.updatevar = s3c44b0fb_updatevar; cfb->fb.blank = s3c44b0fb_blank; cfb->fb.flags = FBINFO_FLAG_DEFAULT; cfb->fb.disp = (struct display *)(cfb + 1); fb_alloc_cmap(&cfb->fb.cmap, CMAP_SIZE, 0); /* * Power up the LCD */ init_waitqueue_head(&proc_list); GPDCON &= 0xfc000000; GPDCON |= 0x01555555;//GPD0-12 out GPDDAT &= 0xe300;//GPD0-12 L GPD8 GPD9 H GPBCON &= 0x3ffffc; GPBCON |= 0x01;//GPB0 out RD GPBDAT |= 0x01;//GPB0 H //#ifdef LCM_RST GPCCON &= ~(0x3<<8); GPCCON |= 0x01<<8;//GPC4 out GPCDAT |= (0x01<<4);//GPC4 H delay(50000); GPCDAT &= ~(0x01<<4);//GPC4 H write_command(0xa7);//cousor shape write_command(0x80);//display mode write_command(0x90);//display off pio_timer.function = sed1335fb_pio_copy; pio_timer.expires = jiffies + 100; add_timer(&pio_timer); flag_wake = 1; interruptible_sleep_on(&proc_list); LCMInit2(); write_command(0x98);//display on s3c44b0fb_set_var(&cfb->fb.var, -1, &cfb->fb); err = register_framebuffer(&cfb->fb); printk("err=%d\n", err); memset(tmp_buff, 0x00, LCD_BUF_SIZE); //memset(t6963fb_buff, 0xff, LCD_BUF_SIZE); //pio_timer.function = sed1335fb_pio_copy; pio_timer.expires = jiffies + PIO_REFRESH_TIMER_TICKS; add_timer(&pio_timer); printk("******sed1335fb_init() finished8*****\n"); return 0; out: return err;}static void __exit s3c44b0xfb_exit(void){ unregister_framebuffer(&cfb->fb); kfree(cfb);}int __init s3c44b0xfb_setup(char *options){ return 0;}#ifdef MODULEmodule_init(s3c44b0xfb_init);module_exit(s3c44b0xfb_exit);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -