Linux I2C总线设备驱动模型分析(ov7740)(2)

struct cmos_ov7740_scaler {
    unsigned int PreHorRatio;
    unsigned int PreVerRatio;
    unsigned int H_Shift;
    unsigned int V_Shift;
    unsigned int PreDstWidth;
    unsigned int PreDstHeight;
    unsigned int MainHorRatio;
    unsigned int MainVerRatio;
    unsigned int SHfactor;
    unsigned int ScaleUpDown;
};

static struct cmos_ov7740_scaler sc;

typedef struct cmos_ov7740_i2c_value {
    unsigned char regaddr;
    unsigned char value;
}ov7740_t;

/* init: 640x480,30fps的,YUV422输出格式 */
ov7740_t ov7740_setting_30fps_VGA_640_480[] =
{
    {0x12, 0x80},
    {0x47, 0x02},
    {0x17, 0x27},
    {0x04, 0x40},
    {0x1B, 0x81},
    {0x29, 0x17},
    {0x5F, 0x03},
    {0x3A, 0x09},
    {0x33, 0x44},
    {0x68, 0x1A},

{0x14, 0x38},
    {0x5F, 0x04},
    {0x64, 0x00},
    {0x67, 0x90},
    {0x27, 0x80},
    {0x45, 0x41},
    {0x4B, 0x40},
    {0x36, 0x2f},
    {0x11, 0x01},
    {0x36, 0x3f},
    {0x0c, 0x12},

{0x12, 0x00},
    {0x17, 0x25},
    {0x18, 0xa0},
    {0x1a, 0xf0},
    {0x31, 0xa0},
    {0x32, 0xf0},

{0x85, 0x08},
    {0x86, 0x02},
    {0x87, 0x01},
    {0xd5, 0x10},
    {0x0d, 0x34},
    {0x19, 0x03},
    {0x2b, 0xf8},
    {0x2c, 0x01},

{0x53, 0x00},
    {0x89, 0x30},
    {0x8d, 0x30},
    {0x8f, 0x85},
    {0x93, 0x30},
    {0x95, 0x85},
    {0x99, 0x30},
    {0x9b, 0x85},

{0xac, 0x6E},
    {0xbe, 0xff},
    {0xbf, 0x00},
    {0x38, 0x14},
    {0xe9, 0x00},
    {0x3D, 0x08},
    {0x3E, 0x80},
    {0x3F, 0x40},
    {0x40, 0x7F},
    {0x41, 0x6A},
    {0x42, 0x29},
    {0x49, 0x64},
    {0x4A, 0xA1},
    {0x4E, 0x13},
    {0x4D, 0x50},
    {0x44, 0x58},
    {0x4C, 0x1A},
    {0x4E, 0x14},
    {0x38, 0x11},
    {0x84, 0x70}
};

struct cmos_ov7740_fmt {
    char  *name;
    u32  fourcc;          /* v4l2 format id */
    int  depth;
};

static struct cmos_ov7740_fmt formats[] = {
    {
        .name    = "RGB565",
        .fourcc  = V4L2_PIX_FMT_RGB565,
        .depth    = 16,
    },
    {
        .name    = "PACKED_RGB_888",
        .fourcc  = V4L2_PIX_FMT_RGB24,
        .depth    = 24,
    },
};

struct camif_buffer
{
    unsigned int order;
    unsigned long virt_base;
    unsigned long phy_base;   
};

struct camif_buffer img_buff[] =
{
    {
        .order = 0,
        .virt_base = (unsigned long)NULL,
        .phy_base = (unsigned long)NULL       
    },
    {
        .order = 0,
        .virt_base = (unsigned long)NULL,
        .phy_base = (unsigned long)NULL       
    },
    {
        .order = 0,
        .virt_base = (unsigned long)NULL,
        .phy_base = (unsigned long)NULL       
    },
    {
        .order = 0,
        .virt_base = (unsigned long)NULL,
        .phy_base = (unsigned long)NULL       
    }
};

static struct i2c_client *cmos_ov7740_client;

// CAMIF GPIO
static unsigned long *GPJCON;
static unsigned long *GPJDAT;
static unsigned long *GPJUP;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/124de2ba14b952f5a166e369a62106bb.html