技术专栏
海思Hi3519AV100sensor移植之一-- imx307
-
驱动修改, 基于imx291的驱动(imx291_sensor_ctl.c )进行修改, 遵循imx307数据手册修改寄存器即可。(因为imx307与imx291型号差距不大,初始化序列可以参考imx291)
const unsigned short IMX291_SETTING_SHORT[]= { //Tag standby 0x0200,0x1, 0x0204,0x10, //Tag AD 12bit 0x0205,0x1, 0x0206,0x0, //Tag FULL HD1080 0x0207,0x00,//0x10, 0x0208,0xA0,//0x10, //Tag 30fps 0x0209,0x02,//IMX185_FRSEL,//0x2, //Tag BLACKLEVEL default 0x020A,0xf0, 0x020B,0x0, 0x020C,0x0, 0x020D,0x0, 0x020E,0x1, 0x020F,0x00,//0x1, 0x0210,0x21,//0x39, 0x0211,0x0, 0x0212,0x64,//0x50, 0x0213,0x0, //Tag GAIN 0x0214,0x0, 0x0215,0x0, 0x0216,0x09,//0x8, 0x0217,0x0, //Tag /VMAX calc refer to 0x0218,0x65,//0x46,//0x65, 0x0219,0x4,//0x5,//0x4, 0x021A,0x0, 0x021B,0x00,//IMX185_HMAX_LOW,//0x98, //Tag HMAX 0x021C,0x30,//IMX185_HMAX_HIGH,//0x8, 0x021D,0x11,//0xff, 0x021E,0xB2,//0x1, 0x021F,0x01,//0x0, //Tag SHS1 0x0220,0x0, 0x0221,0x0, 0x0222,0x0, //Tag :WINWV_OB calc ? 0x023A,0x10,//0xc9, 0x023B,0x00,//0x4, //Tag WINPV 0x023C,0x0, 0x023D,0x0, //Tag WINWV 0x023E,0x49,//0x9c, 0x023F,0x04,//0x7, //Tag WINPH 0x0240,0x00,//0x1, 0x0241,0x0, //Tag WInWH 0x0242,0x9C,//0x1, 0x0243,0x07,//0x0, //Fixed in CSI-2 0x0246,0x01,//0x0, 0x0247,0x01,//0x8, //Tag XVSLNG 0x0248,0x00,//0x13, 0x0249,0x08,//0x0, 0x024A,0x00, //0x024B,0x00, //Tag INCK 0x025C,0x18,//0x20, 0x025D,0x03,//0x0, 0x025E,0x20,//0x18, 0x025F,0x01,//0x0, 0x0270,0x02, 0x0271,0x11, 0x02A6,0x20, 0x02A7,0x00, 0x02A8,0x20, 0x02A9,0x00, 0x02AA,0x20, 0x02AB,0x00, 0x02AC,0x20, 0x030B,0x00,//0x84, 0x0319,0x9E,//0x0, 0x031E,0x08,//0x3, 0x0328,0x05,//0x0, 0x0334,0x0F,//0x0, 0x033B,0x50,//0x0, 0x033C,0x41,//0x0, 0x033D,0x83,//0x1, //Tag INCKSEL5 0x035E,0x1A,//0x12, 0x0364,0x1A,//0x12, 0x037C,0x0, 0x037D,0x00,//0x10, //0x037E,0x0, 0x037F,0x0, 0x04B8,0x50,//0xc1,//0x11, 0x04B9,0x10,//0x12,//0x13, 0x04BA,0x0, 0x04BB,0x04,//0xac, 0x04C8,0x50,//0x0, 0x04C9,0x10,//0xb0,//0xb5, 0x04CA,0x00,//0x40,//0x90, 0x04CB,0x04,//0xb, 0x052C,0xD3,//IMX185_THSEXIT,//0x3f, 0x052D,0x10,//0x20,//0x1f, 0x052E,0x0D,//0x3, 0x0558,0x06, 0x0559,0xE1, 0x055A,0x11, 0x0560,0x1E, 0x0561,0x61, 0x0562,0x10, 0x05B0,0x08,//0x0, 0x05B1,0x30,//0x0, 0x05B2,0x00, 0x05B3,0x04,//0x0,
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222
- 223
- 224
- 225
- 226
- 227
- 228
- 229
- 230
- 231
<////////////////////////////////////
//REPETITION default 0x0605,0x20, 0x0606,0x00, //LANE_NUM default 0x0607,0x03, //Tag OPB_SIZE_V 0x0614,0x0A, //Tag YOUTSIZE 0x0618,0x49, 0x0619,0x04, 0x062C,0x47, 0x062D,0x00, 0x0630,0x0F, 0x0631,0x00, //RAW12: 0x0641,0x0C, 0x0642,0x0C, //Tag 3: 4Lane 0x0643,0x03, //INCK = 37.125 MHz 0x0644,0x20, 0x0645,0x25, 0x0646,0x47, 0x0647,0x00, 0x0648,0x1F, 0x0649,0x00, 0x064A,0x17, 0x064B,0x00, 0x064C,0x0F, 0x064D,0x00, 0x064E,0x17, 0x064F,0x00, 0x0650,0x47, 0x0651,0x00, 0x0652,0x0F, 0x0653,0x00, 0x0654,0x0F, 0x0655,0x00, //Tag X_OUT_SIZE 0x0672,0x9C, 0x0673,0x07, //H,V Inverted 0x3007,0x03
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
<};
-
按照《sensor调试指南》修改文件,主要集中在sample_comm_vi.c , sample_comm_isp.c
下面为驱动程序分析
原文件为sample_comm_isp.cHI_S32 SAMPLE_COMM_ISP_Sensor_Regiter_callback(ISP_DEV IspDev, HI_U32 u32SnsId)
{
ALG_LIB_S stAeLib; ALG_LIB_S stAwbLib; const ISP_SNS_OBJ_S* pstSnsObj; HI_S32 s32Ret = -1; if (MAX_SENSOR_NUM <= u32SnsId) { SAMPLE_PRT("invalid sensor id: %d\n", u32SnsId); return HI_FAILURE; } pstSnsObj = SAMPLE_COMM_ISP_GetSnsObj(u32SnsId); if (HI_NULL == pstSnsObj) { SAMPLE_PRT("sensor %d not exist!\n", u32SnsId); return HI_FAILURE; }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
<
跳入SAMPLE_COMM_ISP_GetSnsObj,发现原来是缺少了stSnsImx307Obj;所以我在这里添加了相应的代码
switch (enSnsType)
{
case SONY_IMX290_MIPI_2M_30FPS_12BIT:
case SONY_IMX290_MIPI_2M_30FPS_12BIT_WDR2TO1:
return &stSnsImx290Obj;
/*添加的代码*/
case SONY_IMX307_MIPI_2M_30FPS_12BIT:
return &stSnsImx307Obj;
...
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
<
该结构体定义在
imx290_cmos.c ; 添加stSnsImx307Obj
ISP_SNS_OBJ_S stSnsImx307Obj =
{
.pfnRegisterCallback = sensor_register_callback,
.pfnUnRegisterCallback = sensor_unregister_callback,
.pfnStandby = imx291_standby,
.pfnRestart = imx291_restart,
.pfnMirrorFlip = HI_NULL,
.pfnWriteReg = imx291_write_register,
.pfnReadReg = imx291_read_register,
.pfnSetBusInfo = imx291_set_bus_info,
.pfnSetInit = sensor_set_init
};
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
<
定义在.c文件所有肯定是外部引用,extern , 位置
hi_sns_ctrl.h ; 同理添加 extern ISP_SNS_OBJ_S stSnsImx307Obj
extern ISP_SNS_OBJ_S stSnsMn34220Obj;
extern ISP_SNS_OBJ_S stSnsImx377Obj;
extern ISP_SNS_OBJ_S stSnsImx299Obj;
extern ISP_SNS_OBJ_S stSnsImx477Obj;
extern ISP_SNS_OBJ_S stSnsImx299SlvsObj;
extern ISP_SNS_OBJ_S stSnsImx290Obj;
extern ISP_SNS_OBJ_S stSnsImx327Obj;
extern ISP_SNS_OBJ_S stSnsImx334Obj;
extern ISP_SNS_OBJ_S stSnsOV2718Obj;
extern ISP_SNS_OBJ_S stSnsCmv50000Obj;
extern ISP_SNS_OBJ_S stSnsImx277SlvsObj;
extern ISP_SNS_OBJ_S stSnsImx117Obj;
extern ISP_SNS_OBJ_S stSnsImx290SlaveObj;
extern ISP_SNS_OBJ_S stSnsImx334SlaveObj;
extern ISP_SNS_OBJ_S stSnsImx226Obj;
extern ISP_SNS_OBJ_S stSnsImx335Obj;
extern ISP_SNS_OBJ_S stSnsImx458Obj;
/*添加的代码*/
extern ISP_SNS_OBJ_S stSnsImx307Obj;
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
<
声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。
红包
点赞
收藏
评论
打赏
- 分享
- 举报
评论
0个
手气红包

相关专栏
-
2019-04-10 21:45:38
-
浏览量:1967次2024-01-08 17:24:15
-
浏览量:987次2024-01-08 18:13:05
-
2019-12-11 22:01:19
-
浏览量:1315次2023-10-12 14:25:01
-
2020-08-10 09:21:07
-
浏览量:2258次2023-10-13 14:34:01
-
浏览量:2783次2020-08-04 20:30:30
-
浏览量:726次2024-01-24 14:47:22
-
浏览量:10985次2022-08-12 15:15:09
-
浏览量:10885次2020-08-03 14:27:03
-
浏览量:2613次2021-12-10 16:36:33
-
浏览量:2338次2019-04-10 17:45:23
-
浏览量:2601次2021-12-03 17:42:05
-
浏览量:7608次2020-09-06 16:25:23
-
浏览量:1183次2023-06-12 14:34:24
-
浏览量:2943次2020-08-10 19:14:51
-
浏览量:1228次2023-10-13 10:22:12
-
浏览量:2360次2020-08-05 21:02:35
置顶时间设置
结束时间
删除原因
-
广告/SPAM
-
恶意灌水
-
违规内容
-
文不对题
-
重复发帖
打赏作者

在学了在学了!
您的支持将鼓励我继续创作!
打赏金额:
¥1

¥5

¥10

¥50

¥100

支付方式:

举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
审核成功
发布时间设置
发布时间:
请选择发布时间设置
是否关联周任务-专栏模块
审核失败
失败原因
请选择失败原因
备注
请输入备注