LCD液晶屏驱动详解(5)

  • 调色板相关函数设置
  1. 为了兼容性,我们要先定义一个伪调色板数组,

static u32 pseudo_palette[16];
  1. 设置颜色填充函数

/* from pxafb.c */
static inline unsigned int chan_to_field(unsigned int chan, struct fb_bitfield *bf)
{
    chan &= 0xffff;
    chan >>= 16 - bf->length;
    return chan << bf->offset;
}
  1. 设置调色板

static int s3c_lcdfb_setcolreg(unsigned int regno, unsigned int red,
                 unsigned int green, unsigned int blue,
                 unsigned int transp, struct fb_info *info)
{
    unsigned int val;
    
    if (regno > 16)
        return 1;

    /* 用red,green,blue三原色构造出val */
    val  = chan_to_field(red,   &info->var.red);
    val |= chan_to_field(green, &info->var.green);
    val |= chan_to_field(blue,  &info->var.blue);
    
    //((u32 *)(info->pseu

你可能感兴趣的:(LCD,TP,手机,平板知识分享,linux,运维,服务器)