[sync] sync from internal repo

* use nuttx libc, disable system libc
* use tlsf as default
* update lhal flash driver
* add example readme
* add flash ini for new flash tool
* add fw header for new flash tool
This commit is contained in:
jzlv 2023-01-17 20:54:15 +08:00
parent 89592fc9a3
commit 356f258e83
554 changed files with 79150 additions and 46596 deletions

View file

@ -26,6 +26,165 @@
#include "image_sensor.h"
static struct image_sensor_command_s gc2053_init_list[] = {
#ifdef CONFIG_BSP_CSI
{ 0xfe, 0x80 },
{ 0xfe, 0x80 },
{ 0xfe, 0x80 },
{ 0xfe, 0x00 },
{ 0xf2, 0x00 },
{ 0xf3, 0x00 },
{ 0xf4, 0x36 },
{ 0xf5, 0xc0 },
{ 0xf6, 0x84 },
{ 0xf7, 0x11 },
{ 0xf8, 0x37 },
{ 0xf9, 0x82 },
{ 0xfc, 0x8e },
{ 0xfe, 0x00 },//mirror and flip
{ 0x17, 0x83 },
{ 0xfe, 0x00 },
{ 0x87, 0x18 },
{ 0xee, 0x30 },
{ 0xd0, 0xb7 },
{ 0x03, 0x04 },
{ 0x04, 0x60 },
{ 0x05, 0x04 },
{ 0x06, 0x4c },
{ 0x07, 0x00 },
{ 0x08, 0x64 },
{ 0x09, 0x00 },
{ 0x0a, 0x02 },
{ 0x0b, 0x00 },
{ 0x0c, 0x02 },
{ 0x0d, 0x04 },
{ 0x0e, 0x40 },
{ 0x12, 0xe2 },
{ 0x13, 0x16 },
{ 0x19, 0x0a },
{ 0x21, 0x1c },
{ 0x28, 0x0a },
{ 0x29, 0x24 },
{ 0x2b, 0x04 },
{ 0x32, 0xf8 },
{ 0x37, 0x03 },
{ 0x39, 0x15 },
{ 0x43, 0x07 },
{ 0x44, 0x40 },
{ 0x46, 0x0b },
{ 0x4b, 0x20 },
{ 0x4e, 0x08 },
{ 0x55, 0x20 },
{ 0x66, 0x05 },
{ 0x67, 0x05 },
{ 0x77, 0x01 },
{ 0x78, 0x00 },
{ 0x7c, 0x93 },
{ 0x8c, 0x12 },
{ 0x8d, 0x92 },
{ 0x90, 0x00 },
{ 0x41, 0x04 },
{ 0x42, 0xb0 },
{ 0x9d, 0x10 },
{ 0xce, 0x7c },
{ 0xd2, 0x41 },
{ 0xd3, 0xdc },
{ 0xe6, 0x50 },
{ 0xb6, 0xc0 },
{ 0xb0, 0x70 },
{ 0xb1, 0x01 },
{ 0xb2, 0x00 },
{ 0xb3, 0x00 },
{ 0xb4, 0x00 },
{ 0xb8, 0x01 },
{ 0xb9, 0x00 },
{ 0x26, 0x30 },
{ 0xfe, 0x01 },
{ 0x40, 0x23 },
{ 0x55, 0x07 },
{ 0x60, 0x40 },
{ 0xfe, 0x04 },
{ 0x14, 0x78 },
{ 0x15, 0x78 },
{ 0x16, 0x78 },
{ 0x17, 0x78 },
{ 0xfe, 0x01 },
{ 0x92, 0x01 },
{ 0x94, 0x04 },
{ 0x95, 0x04 },
{ 0x96, 0x38 },
{ 0x97, 0x07 },
{ 0x98, 0x80 },
/*skip frame*/
{ 0xfe, 0x01 },
{ 0x83, 0x01 },
{ 0x87, 0x50 },//0x50, skip 0, default:0x53,skip 3
{ 0xfe, 0x00 },
{ 0xfe, 0x01 },
{ 0x01, 0x05 },
{ 0x02, 0x89 },
{ 0x04, 0x00 },//DD_en
{ 0x07, 0xa6 },
{ 0x08, 0xa9 },
{ 0x09, 0xa8 },
{ 0x0a, 0xa7 },
{ 0x0b, 0xff },
{ 0x0c, 0xff },
{ 0x0f, 0x00 },
{ 0x50, 0x1c },
{ 0x89, 0x03 },
{ 0xfe, 0x04 },
{ 0x28, 0x86 },
{ 0x29, 0x86 },
{ 0x2a, 0x86 },
{ 0x2b, 0x68 },
{ 0x2c, 0x68 },
{ 0x2d, 0x68 },
{ 0x2e, 0x68 },
{ 0x2f, 0x68 },
{ 0x30, 0x4f },
{ 0x31, 0x68 },
{ 0x32, 0x67 },
{ 0x33, 0x66 },
{ 0x34, 0x66 },
{ 0x35, 0x66 },
{ 0x36, 0x66 },
{ 0x37, 0x66 },
{ 0x38, 0x62 },
{ 0x39, 0x62 },
{ 0x3a, 0x62 },
{ 0x3b, 0x62 },
{ 0x3c, 0x62 },
{ 0x3d, 0x62 },
{ 0x3e, 0x62 },
{ 0x3f, 0x62 },
{ 0xfe, 0x01 },
//{ 0x8c, 0x01 }, // test mode
{ 0x9a, 0x06 },
{ 0xfe, 0x00 },
{ 0x7b, 0x2a },
//{ 0x22, 0x0a }, // jz tmp
{ 0x23, 0x2d },
{ 0xfe, 0x03 },
{ 0x01, 0x27 },
{ 0x02, 0x56 },
//{ 0x03, 0xb6 }, // default is 0xb6
{ 0x03, 0x8e },
{ 0x12, 0x80 },
{ 0x13, 0x07 },
{ 0x15, 0x12 },
{ 0xfe, 0x01 },
{ 0x8c, 0x10 },
{ 0xfe, 0x00 },
{ 0x3e, 0x91 },
#else
{ 0xfe, 0x80 }, // page select
{ 0xfe, 0x80 },
{ 0xfe, 0x80 },
@ -155,7 +314,7 @@ static struct image_sensor_command_s gc2053_init_list[] = {
{ 0x3f, 0x62 },
/****DVP & MIPI****/
{ 0xfe, 0x01 },
// {0x8c,0x01}, // test mode
//{0x8c,0x01}, // test mode
//{0x9a,0x06}, /* VSYNC low pulse */
{ 0x9a, 0x02 }, /* VSYNC high pulse */
{ 0xfe, 0x00 },
@ -170,6 +329,7 @@ static struct image_sensor_command_s gc2053_init_list[] = {
{ 0xfe, 0x00 },
{ 0x3e, 0x40 },
#endif
};
static struct image_sensor_config_s gc2053_config = {
@ -183,7 +343,11 @@ static struct image_sensor_config_s gc2053_config = {
.resolution_y = 1080,
.id_addr = 0xf0f1,
.id_value = 0x2053,
#ifdef CONFIG_BSP_CSI
.pixel_clock = 66000000,
#else
.pixel_clock = 24000000,
#endif
.init_list_len = sizeof(gc2053_init_list)/sizeof(gc2053_init_list[0]),
.init_list = gc2053_init_list,
};

View file

@ -25,16 +25,18 @@
#include "gc0308.h"
#include "gc0328.h"
#include "gc2053.h"
#include "ov2685.h"
#include "bflb_i2c.h"
static struct image_sensor_config_s *sensor_list[] = {
NULL, &bf2013_config, &gc0308_config, &gc0328_config, &gc2053_config
NULL, &bf2013_config, &gc0308_config, &gc0328_config, &gc2053_config, &ov2685_config
};
void image_sensor_read(struct bflb_device_s *i2c, uint32_t sensor_index, struct image_sensor_command_s *read_list, uint32_t list_len)
{
uint32_t i;
struct bflb_i2c_msg_s msgs[2];
uint8_t buffer[2];
msgs[0].addr = sensor_list[sensor_index]->slave_addr;
msgs[0].flags = I2C_M_NOSTOP;
@ -47,7 +49,14 @@ void image_sensor_read(struct bflb_device_s *i2c, uint32_t sensor_index, struct
msgs[1].length = 1;
for(i=0;i<list_len;i++){
msgs[0].buffer = (uint8_t *)&read_list[i].address;
if (sensor_list[sensor_index]->reg_size == 1) {
buffer[0] = read_list[i].address & 0xff;
} else {
buffer[0] = read_list[i].address >> 8;
buffer[1] = read_list[i].address & 0xff;
}
msgs[0].buffer = buffer;
msgs[1].buffer = &read_list[i].paramete;
bflb_i2c_transfer(i2c, msgs, 2);
}
@ -57,6 +66,7 @@ void image_sensor_write(struct bflb_device_s *i2c, uint32_t sensor_index, struct
{
uint32_t i;
struct bflb_i2c_msg_s msgs[2];
uint8_t buffer[2];
msgs[0].addr = sensor_list[sensor_index]->slave_addr;
msgs[0].flags = I2C_M_NOSTOP;
@ -69,7 +79,14 @@ void image_sensor_write(struct bflb_device_s *i2c, uint32_t sensor_index, struct
msgs[1].length = 1;
for(i=0;i<list_len;i++){
msgs[0].buffer = (uint8_t *)&read_list[i].address;
if (sensor_list[sensor_index]->reg_size == 1) {
buffer[0] = read_list[i].address & 0xff;
} else {
buffer[0] = read_list[i].address >> 8;
buffer[1] = read_list[i].address & 0xff;
}
msgs[0].buffer = buffer;
msgs[1].buffer = &read_list[i].paramete;
bflb_i2c_transfer(i2c, msgs, 2);
}

View file

@ -0,0 +1,296 @@
/**
* @file image_sensor.h
* @brief
*
* Copyright (c) 2022 Bouffalolab team
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
#ifndef __OV2685_H__
#define __OV2685_H__
#include "image_sensor.h"
static struct image_sensor_command_s ov2685_init_list[] = {
{0x0103, 0x0001},
{0xffff, 0x0005},
{0x3002, 0x0000},
{0x3016, 0x001c},
{0x3018, 0x0084},
{0x301d, 0x00f0},
{0x3020, 0x0000},
{0x3082, 0x002c},
{0x3083, 0x0003},
{0x3084, 0x0007},
{0x3085, 0x0003},
{0x3086, 0x0000},
{0x3087, 0x0000},
{0x3501, 0x004e},
{0x3502, 0x00e0},
{0x3503, 0x0003},
{0x350b, 0x0036},
{0x3600, 0x00b4},
{0x3603, 0x0035},
{0x3604, 0x0024},
{0x3605, 0x0000},
{0x3620, 0x0024},
{0x3621, 0x0034},
{0x3622, 0x0003},
{0x3628, 0x0010},
{0x3705, 0x003c},
{0x370a, 0x0021},
{0x370c, 0x0050},
{0x370d, 0x00c0},
{0x3717, 0x0058},
{0x3718, 0x0080},
{0x3720, 0x0000},
{0x3721, 0x0009},
{0x3722, 0x0006},
{0x3723, 0x0059},
{0x3738, 0x0099},
{0x3781, 0x0080},
{0x3784, 0x000c},
{0x3789, 0x0060},
{0x3800, 0x0000},
{0x3801, 0x0000},
{0x3802, 0x0000},
{0x3803, 0x0000},
{0x3804, 0x0006},
{0x3805, 0x004f},
{0x3806, 0x0004},
{0x3807, 0x00bf},
{0x3808, 0x0006},
{0x3809, 0x0040},
{0x380a, 0x0004},
{0x380b, 0x00b0},
{0x380c, 0x0006},
{0x380d, 0x00a4},
{0x380e, 0x0005},
{0x380f, 0x000e},
{0x3810, 0x0000},
{0x3811, 0x0008},
{0x3812, 0x0000},
{0x3813, 0x0008},
{0x3814, 0x0011},
{0x3815, 0x0011},
{0x3819, 0x0004},
{0x3820, 0x00c0},
{0x3821, 0x0000},
{0x3a06, 0x0001},
{0x3a07, 0x0084},
{0x3a08, 0x0001},
{0x3a09, 0x0043},
{0x3a0a, 0x0024},
{0x3a0b, 0x0060},
{0x3a0c, 0x0028},
{0x3a0d, 0x0060},
{0x3a0e, 0x0004},
{0x3a0f, 0x008c},
{0x3a10, 0x0005},
{0x3a11, 0x000c},
{0x4000, 0x0081},
{0x4001, 0x0040},
{0x4008, 0x0002},
{0x4009, 0x0009},
{0x4300, 0x0032},//output format
{0x430e, 0x0000},
{0x4602, 0x0002},
{0x4837, 0x001e},
{0x5000, 0x00ff},
{0x5001, 0x0005},
{0x5002, 0x0032},
{0x5003, 0x0004},
{0x5004, 0x00ff},
{0x5005, 0x0012},
//{0x5080, 0x0092},//test pattern
{0x0100, 0x0001},
{0x0101, 0x0001},
{0x1000, 0x0003},
{0x0129, 0x0010},
{0x5180, 0x00f4},
{0x5181, 0x0011},
{0x5182, 0x0041},
{0x5183, 0x0042},
{0x5184, 0x0078},
{0x5185, 0x0058},
{0x5186, 0x00b5},
{0x5187, 0x00b2},
{0x5188, 0x0008},
{0x5189, 0x000e},
{0x518a, 0x000c},
{0x518b, 0x004c},
{0x518c, 0x0038},
{0x518d, 0x00f8},
{0x518e, 0x0004},
{0x518f, 0x007f},
{0x5190, 0x0040},
{0x5191, 0x005f},
{0x5192, 0x0040},
{0x5193, 0x00ff},
{0x5194, 0x0040},
{0x5195, 0x0007},
{0x5196, 0x0004},
{0x5197, 0x0004},
{0x5198, 0x0000},
{0x5199, 0x0005},
{0x519a, 0x00d2},
{0x519b, 0x0010},
{0x5200, 0x0009},
{0x5201, 0x0000},
{0x5202, 0x0006},
{0x5203, 0x0020},
{0x5204, 0x0041},
{0x5205, 0x0016},
{0x5206, 0x0000},
{0x5207, 0x0005},
{0x520b, 0x0030},
{0x520c, 0x0075},
{0x520d, 0x0000},
{0x520e, 0x0030},
{0x520f, 0x0075},
{0x5210, 0x0000},
{0x5280, 0x0014},
{0x5281, 0x0002},
{0x5282, 0x0002},
{0x5283, 0x0004},
{0x5284, 0x0006},
{0x5285, 0x0008},
{0x5286, 0x000c},
{0x5287, 0x0010},
{0x5300, 0x00c5},
{0x5301, 0x00a0},
{0x5302, 0x0006},
{0x5303, 0x000a},
{0x5304, 0x0030},
{0x5305, 0x0060},
{0x5306, 0x0090},
{0x5307, 0x00c0},
{0x5308, 0x0082},
{0x5309, 0x0000},
{0x530a, 0x0026},
{0x530b, 0x0002},
{0x530c, 0x0002},
{0x530d, 0x0000},
{0x530e, 0x000c},
{0x530f, 0x0014},
{0x5310, 0x001a},
{0x5311, 0x0020},
{0x5312, 0x0080},
{0x5313, 0x004b},
{0x5380, 0x0001},
{0x5381, 0x0052},
{0x5382, 0x0000},
{0x5383, 0x004a},
{0x5384, 0x0000},
{0x5385, 0x00b6},
{0x5386, 0x0000},
{0x5387, 0x008d},
{0x5388, 0x0000},
{0x5389, 0x003a},
{0x538a, 0x0000},
{0x538b, 0x00a6},
{0x538c, 0x0000},
{0x5400, 0x000d},
{0x5401, 0x0018},
{0x5402, 0x0031},
{0x5403, 0x005a},
{0x5404, 0x0065},
{0x5405, 0x006f},
{0x5406, 0x0077},
{0x5407, 0x0080},
{0x5408, 0x0087},
{0x5409, 0x008f},
{0x540a, 0x00a2},
{0x540b, 0x00b2},
{0x540c, 0x00cc},
{0x540d, 0x00e4},
{0x540e, 0x00f0},
{0x540f, 0x00a0},
{0x5410, 0x006e},
{0x5411, 0x0006},
{0x5480, 0x0019},
{0x5481, 0x0000},
{0x5482, 0x0009},
{0x5483, 0x0012},
{0x5484, 0x0004},
{0x5485, 0x0006},
{0x5486, 0x0008},
{0x5487, 0x000c},
{0x5488, 0x0010},
{0x5489, 0x0018},
{0x5500, 0x0002},
{0x5501, 0x0003},
{0x5502, 0x0004},
{0x5503, 0x0005},
{0x5504, 0x0006},
{0x5505, 0x0008},
{0x5506, 0x0000},
{0x5600, 0x0002},
{0x5603, 0x0040},
{0x5604, 0x0028},
{0x5609, 0x0020},
{0x560a, 0x0060},
{0x5800, 0x0003},
{0x5801, 0x0024},
{0x5802, 0x0002},
{0x5803, 0x0040},
{0x5804, 0x0034},
{0x5805, 0x0005},
{0x5806, 0x0012},
{0x5807, 0x0005},
{0x5808, 0x0003},
{0x5809, 0x003c},
{0x580a, 0x0002},
{0x580b, 0x0040},
{0x580c, 0x0026},
{0x580d, 0x0005},
{0x580e, 0x0052},
{0x580f, 0x0006},
{0x5810, 0x0003},
{0x5811, 0x0028},
{0x5812, 0x0002},
{0x5813, 0x0040},
{0x5814, 0x0024},
{0x5815, 0x0005},
{0x5816, 0x0042},
{0x5817, 0x0006},
{0x5818, 0x000d},
{0x5819, 0x0040},
{0x581a, 0x0004},
{0x581b, 0x000c},
{0x3a03, 0x004c},
{0x3a04, 0x0040},
{0x3503, 0x0000},
};
static struct image_sensor_config_s ov2685_config = {
.name = "OV2685",
.output_format = IMAGE_SENSOR_FORMAT_YUV422_YUYV,
.slave_addr = 0x3c,
.id_size = 2,
.reg_size = 2,
.h_blank = 0xde,
.resolution_x = 1600,
.resolution_y = 1200,
.id_addr = 0x300a300b,
.id_value = 0x2685,
.pixel_clock = 66000000,
.init_list_len = sizeof(ov2685_init_list)/sizeof(ov2685_init_list[0]),
.init_list = ov2685_init_list,
};
#endif /* __OV2685_H__ */