1. Assigning a fb_info structure: framebuffer_alloc
2. Settings
3. Registration
4. Hardware-related exercises
struct Fb_fix_screeninfo {
Char id[16]; /* Identification string EG "TT Builtin" */
unsigned long smem_start; /* Start of frame buffer mem */
/* (Physical Address) */
__u32 Smem_len; /* Length of frame buffer mem */
__U32 type; /* See fb_type_* */
__U32 Visual; /* See fb_visual_* */
__u32 line_length; /* Length of a line in bytes */
};
struct Fb_var_screeninfo {
__u32 Xres; /* Visible Resolution */
__u32 Yres;
__u32 xres_virtual; /* Virtual Resolution */
__u32 yres_virtual;
__u32 Bits_per_pixel; /* Guess what * *
struct Fb_bitfield red; /* Bitfield in FB mem if True color, */
struct Fb_bitfield Green; /* Else only length is significant */
struct Fb_bitfield blue;
__u32 activate; /* See fb_activate_* */
};
1Staticint Lcd_init (void)2{3/*1. Assigning a Fb_info*/4 S3C_LCD = Framebuffer_alloc (0, NULL);56/*2. Settings*/7/*2.1 Setting the fixed parameters*/8 strcpy (S3c_lcd->fix.id,"Mylcd");9 S3c_lcd->fix.smem_len =480 *272 *16/8;Ten S3c_lcd->fix.type =Fb_type_packed_pixels;One s3c_lcd->fix.visual = Fb_visual_truecolor;/*Tft*/S3c_lcd->fix.line_length =480 *2;1314/*2.2 Setting variable Parameters*/S3c_lcd->Var.xres =480;S3c_lcd->Var.yres =272;S3c_lcd->Var.xres_virtual =480;S3c_lcd->Var.yres_virtual =272;S3c_lcd->Var.bits_per_pixel =16;2021st/*rgb:565*/S3c_lcd->Var.red.offset =11;S3c_lcd->Var.red.length =5;24S3c_lcd->Var.green.offset =5;S3c_lcd->Var.green.length =6;27S3c_lcd->Var.blue.offset =0;S3c_lcd->Var.blue.length =5;30S3c_lcd->Var.activate =Fb_activate_now;3233/*2.3 Setting the Action function*/S3c_lcd->fbops = &S3c_lcdfb_ops;3536/*2.4 Other Settings*/37//s3c_lcd->pseudo_palette;38//s3c_lcd->screen_base;//Virtual Address of video memory39//S3c_lcd->screen_size = 480 * 272 * 16/8;40/*3. Hardware-Related Settings*/41/*3.1 Configuring Gpio for LCD*/42 /* 3.2 Set LCD controller according to LCD manual, such as VCLK frequency */43 /**/44 45 /* 4. Register */46 47 Register_ Framebuffer (S3C_LCD); 48 49 return 0;
LCD driver 15-2