sc2210_mipi.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /*
  2. * sc2210_mipi.c
  3. *
  4. */
  5. #include <unistd.h>
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <assert.h>
  9. #include <string.h>
  10. #include "isp_func_def.h"
  11. #include "isp_sensor_if.h"
  12. #include "sensor_ops.h"
  13. #include "clock_ops.h"
  14. #include "isp_enum.h"
  15. #include "mipi_api.h"
  16. #include "sc2210_mipi.h"
  17. #include "sensor.h"
  18. #ifndef OS_LINUX
  19. #include <rtthread.h>
  20. #endif
  21. static struct sns_cfg_s sns_cfg = {
  22. .inited = 0,
  23. .curr_exposure_ratio = 256, // 默认初始化为16倍
  24. .MinRstLine = 5,
  25. .minAGain = 0x40,
  26. };
  27. static int SetIntt(FH_UINT32 intt, FH_UINT8 fNo);
  28. static int GetIntt();
  29. static int SetGain(FH_UINT32 again, FH_UINT8 fNo);
  30. static int GetGain();
  31. static int SetExposureRatio(FH_UINT32 exposure_ratio);
  32. static int GetExposureRatio(FH_UINT32 *exposure_ratio);
  33. static int GetSensorViAttr(ISP_VI_ATTR_S *vi_attr)
  34. {
  35. if(vi_attr == NULL)
  36. return FH_ERR_NULL_POINTER;
  37. switch (sns_cfg.sensor_fmt)
  38. {
  39. case FORMAT_1080P25:
  40. vi_attr->u16WndWidth = FRAM_W_1080P25;
  41. vi_attr->u16WndHeight = FRAM_H_1080P25;
  42. vi_attr->u16InputWidth = ACTIVE_W_1080P25;
  43. vi_attr->u16InputHeight = ACTIVE_H_1080P25;
  44. vi_attr->u16PicWidth = PIC_IN_W_1080P25;
  45. vi_attr->u16PicHeight = PIC_IN_H_1080P25;
  46. vi_attr->u16OffsetX = OFFSET_X_1080P25;
  47. vi_attr->u16OffsetY = OFFSET_Y_1080P25;
  48. vi_attr->enBayerType = BAYER_BGGR;
  49. sns_cfg.curr_hsf = 25 * vi_attr->u16WndHeight;
  50. break;
  51. case FORMAT_1080P30:
  52. vi_attr->u16WndWidth = FRAM_W_1080P30;
  53. vi_attr->u16WndHeight = FRAM_H_1080P30;
  54. vi_attr->u16InputWidth = ACTIVE_W_1080P30;
  55. vi_attr->u16InputHeight = ACTIVE_H_1080P30;
  56. vi_attr->u16PicWidth = PIC_IN_W_1080P30;
  57. vi_attr->u16PicHeight = PIC_IN_H_1080P30;
  58. vi_attr->u16OffsetX = OFFSET_X_1080P30;
  59. vi_attr->u16OffsetY = OFFSET_Y_1080P30;
  60. vi_attr->enBayerType = BAYER_BGGR;
  61. sns_cfg.curr_hsf = 30 * vi_attr->u16WndHeight;
  62. break;
  63. case FORMAT_WDR_1080P25:
  64. vi_attr->u16WndWidth = FRAM_W_1080P25_WDR;
  65. vi_attr->u16WndHeight = FRAM_H_1080P25_WDR;
  66. vi_attr->u16InputWidth = ACTIVE_W_1080P25_WDR;
  67. vi_attr->u16InputHeight = ACTIVE_H_1080P25_WDR;
  68. vi_attr->u16PicWidth = PIC_IN_W_1080P25_WDR;
  69. vi_attr->u16PicHeight = PIC_IN_H_1080P25_WDR;
  70. vi_attr->u16OffsetX = OFFSET_X_1080P25_WDR;
  71. vi_attr->u16OffsetY = OFFSET_Y_1080P25_WDR;
  72. vi_attr->enBayerType = BAYER_BGGR;
  73. sns_cfg.curr_hsf = 25 * vi_attr->u16WndHeight;
  74. break;
  75. case FORMAT_WDR_1080P30:
  76. vi_attr->u16WndWidth = FRAM_W_1080P30_WDR;
  77. vi_attr->u16WndHeight = FRAM_H_1080P30_WDR;
  78. vi_attr->u16InputWidth = ACTIVE_W_1080P30_WDR;
  79. vi_attr->u16InputHeight = ACTIVE_H_1080P30_WDR;
  80. vi_attr->u16PicWidth = PIC_IN_W_1080P30_WDR;
  81. vi_attr->u16PicHeight = PIC_IN_H_1080P30_WDR;
  82. vi_attr->u16OffsetX = OFFSET_X_1080P30_WDR;
  83. vi_attr->u16OffsetY = OFFSET_Y_1080P30_WDR;
  84. vi_attr->enBayerType = BAYER_BGGR;
  85. sns_cfg.curr_hsf = 30 * vi_attr->u16WndHeight;
  86. break;
  87. default:
  88. break;
  89. }
  90. return 0;
  91. }
  92. static void SensorReset(void)
  93. {
  94. return;
  95. }
  96. static unsigned short sc2210_i2c_addr = 0x60;
  97. static int Sensor_Isconnect(void)
  98. {
  99. unsigned short pid1, pid2;
  100. unsigned short i2c_addr[4] = {0x60,0x62, 0x64,0x66};
  101. int i;
  102. for(i = 0; i < 4; i ++)
  103. {
  104. SensorDevice_Init((i2c_addr[i] >> 1), 2);
  105. pid1 = Sensor_Read(0x3107);
  106. if(pid1!=0x22)
  107. {
  108. SensorDevice_Close();
  109. continue;
  110. }
  111. pid2 = Sensor_Read(0x3108);
  112. SensorDevice_Close();
  113. if (pid1 == 0x22 && pid2 == 0x10)
  114. {
  115. sc2210_i2c_addr = i2c_addr[i];
  116. return 1;
  117. }
  118. else
  119. {
  120. continue;
  121. }
  122. }
  123. return 0;
  124. }
  125. static int Sensor_Init(void)
  126. {
  127. Sensor_Isconnect();
  128. SensorDevice_Init((sc2210_i2c_addr>>1), 2);
  129. SensorReset();
  130. sns_cfg.inited = 1;
  131. return 0;
  132. }
  133. static int Sensor_DeInit(void)
  134. {
  135. SensorReset();
  136. return SensorDevice_Close();
  137. }
  138. // GetGain仅在ae refresh时会重新获取,所以尽量直接从sensor端获取,保证intt的正确性
  139. static int GetGain()
  140. {
  141. return sns_cfg.curr_sensor_gain;
  142. }
  143. // GetIntt仅在ae refresh时会重新获取,所以尽量直接从sensor端获取,保证intt的正确性
  144. static int GetIntt(void)
  145. {
  146. return sns_cfg.curr_sensor_intt;
  147. }
  148. static int SetLaneNumMax(FH_UINT32 lane_num)
  149. {
  150. sns_cfg.maxLaneNum = lane_num;
  151. return 0;
  152. }
  153. static void SetSensorMipiCfg(void)
  154. {
  155. struct mipi_conf config;
  156. config.frq_range = R_750_799;
  157. config.sensor_mode = NOT_SONY_WDR_USE_WDR;
  158. config.raw_type = RAW10;
  159. // config.lf_vc_id = 0;
  160. // config.sf_vc_id = 1;
  161. // config.lane_num =2;
  162. if(!sns_cfg.wdr_flag)
  163. {
  164. config.lf_vc_id = 0xff;//0xff
  165. config.sf_vc_id = 0xff;//0xff
  166. config.lane_num =2;
  167. }
  168. else
  169. {
  170. config.lf_vc_id = 0;
  171. config.sf_vc_id = 2;
  172. config.lane_num =2;
  173. }
  174. mipi_init(&config);
  175. }
  176. static int SetSensorFmt(int format)
  177. {
  178. sns_cfg.sensor_fmt = format;
  179. sns_cfg.wdr_flag = (format >> 16)&1;
  180. SetSensorMipiCfg();
  181. if(sns_cfg.inited)
  182. {
  183. int i;
  184. printf("sc2210 ver20210701\n");
  185. switch(format)
  186. {
  187. case FORMAT_1080P25:
  188. printf("1080p25\n");
  189. for(i=0; i<sizeof(Sensor_Cfg_SC2210_MIPI_1080P25)/4; i++)
  190. {
  191. Sensor_Write(Sensor_Cfg_SC2210_MIPI_1080P25[2*i], Sensor_Cfg_SC2210_MIPI_1080P25[2*i+1]);
  192. }
  193. break;
  194. case FORMAT_1080P30:
  195. printf("1080p30\n");
  196. for(i=0; i<sizeof(Sensor_Cfg_SC2210_MIPI_1080P30)/4; i++)
  197. {
  198. Sensor_Write(Sensor_Cfg_SC2210_MIPI_1080P30[2*i], Sensor_Cfg_SC2210_MIPI_1080P30[2*i+1]);
  199. }
  200. break;
  201. case FORMAT_WDR_1080P25:
  202. printf("1080p25wdr\n");
  203. for(i=0; i<sizeof(Sensor_Cfg_SC2210_MIPI_1080P25_WDR)/4; i++)
  204. {
  205. Sensor_Write(Sensor_Cfg_SC2210_MIPI_1080P25_WDR[2*i], Sensor_Cfg_SC2210_MIPI_1080P25_WDR[2*i+1]);
  206. }
  207. break;
  208. case FORMAT_WDR_1080P30:
  209. printf("1080p30wdr\n");
  210. for(i=0; i<sizeof(Sensor_Cfg_SC2210_MIPI_1080P30_WDR)/4; i++)
  211. {
  212. Sensor_Write(Sensor_Cfg_SC2210_MIPI_1080P30_WDR[2*i], Sensor_Cfg_SC2210_MIPI_1080P30_WDR[2*i+1]);
  213. }
  214. break;
  215. default:
  216. printf("Format error!");
  217. return -1;
  218. break;
  219. }
  220. usleep(20000);
  221. }
  222. else
  223. {
  224. return -1;
  225. }
  226. sns_cfg.v_cycle = (Sensor_Read(0x320e) << 8) | (Sensor_Read(0x320f));
  227. sns_cfg.fullLineStd = sns_cfg.v_cycle;
  228. if (sns_cfg.wdr_flag == 0)
  229. {
  230. sns_cfg.MinRstLine = 5;
  231. }
  232. else
  233. {
  234. sns_cfg.MinRstLine = sns_cfg.v_cycle / 7 + 5;
  235. }
  236. sns_cfg.max_intt = sns_cfg.v_cycle - sns_cfg.MinRstLine;
  237. SetIntt(sns_cfg.max_intt, 0);
  238. SetExposureRatio(sns_cfg.curr_exposure_ratio);
  239. SetGain(sns_cfg.minAGain, 0);
  240. sns_cfg.curr_sensor_gain = sns_cfg.minAGain;
  241. return 0;
  242. }
  243. static int GetAEInfo(Sensor_AE_INFO_S *sensAEInfo)
  244. {
  245. sensAEInfo->currIntt = GetIntt();
  246. sensAEInfo->currAGain = GetGain();
  247. sensAEInfo->currHsf = sns_cfg.curr_hsf;
  248. sensAEInfo->currFrameH = sns_cfg.v_cycle;
  249. return 0;
  250. }
  251. static int GetAEDefault(Sensor_AE_Default_S *sensAEDefault)
  252. {
  253. sensAEDefault->minIntt = 1;
  254. sensAEDefault->maxIntt = sns_cfg.max_intt;
  255. sensAEDefault->minAGain = sns_cfg.minAGain;
  256. sensAEDefault->maxAGain = 0x7fff;
  257. sensAEDefault->fullLineStd = sns_cfg.fullLineStd;
  258. sensAEDefault->MinRstLine = sns_cfg.MinRstLine;
  259. return 0;
  260. }
  261. static int CalcSnsValidGain(FH_UINT32 *u32Gain)
  262. {
  263. return 0;
  264. }
  265. static int SetGain(FH_UINT32 again, FH_UINT8 fNo)
  266. {
  267. sns_cfg.curr_sensor_gain = again;
  268. unsigned char gain_0x3e06 = 0x00;
  269. unsigned char gain_0x3e07 = 0x80;
  270. unsigned char gain_0x3e08 = 0x03;
  271. unsigned char gain_0x3e09 = 0x40;
  272. //UINT32 gainShift = 0;
  273. //printf("again: 0x%x, ", again);
  274. if (again < 64 * 2) //again 1x-2x
  275. {
  276. gain_0x3e08 = 0x03;
  277. gain_0x3e09 = again;
  278. gain_0x3e06 = 0x0;
  279. gain_0x3e07 = 0x80;
  280. }
  281. else if (again <= 64 * 3.375) //again 2x-3.375x
  282. {
  283. gain_0x3e08 = 0x07;
  284. gain_0x3e09 = again / 2;
  285. gain_0x3e06 = 0x0;
  286. gain_0x3e07 = 0x80;
  287. }
  288. else if (again <= 64 * 3.375 * 2) //again 3.375x-6.812x
  289. {
  290. gain_0x3e08 = 0x23;
  291. gain_0x3e09 = again / 3.375;
  292. gain_0x3e06 = 0x0;
  293. gain_0x3e07 = 0x80;
  294. }
  295. else if (again <= 64 * 3.375 * 4) //again 6.812x-13.624x
  296. {
  297. gain_0x3e08 = 0x27;
  298. gain_0x3e09 = again / 3.375 / 2;
  299. gain_0x3e06 = 0x0;
  300. gain_0x3e07 = 0x80;
  301. }
  302. else if (again <= 64 * 3.375 * 8) //again 13.624x-27.248x
  303. {
  304. gain_0x3e08 = 0x2f;
  305. gain_0x3e09 = again / 3.375 / 4;
  306. gain_0x3e06 = 0x0;
  307. gain_0x3e07 = 0x80;
  308. }
  309. else if (again <= 64 * 3.375 * 16) //again 27.248x-54.07x
  310. {
  311. gain_0x3e08 = 0x3f;
  312. gain_0x3e09 = again / 3.375 / 8;
  313. gain_0x3e06 = 0x0;
  314. gain_0x3e07 = 0x80;
  315. }
  316. #if 1
  317. else if (again <= 64 * 3.375 * 16 * 2) //again 54.07x dgain 2x
  318. {
  319. gain_0x3e08 = 0x3f;
  320. gain_0x3e09 = 0x7f;
  321. gain_0x3e06 = 0x0;
  322. gain_0x3e07 = again / 3.375 / 8;
  323. }
  324. else if (again <= 64 * 3.375 * 16 * 4) //again 54.07x dgain 4x
  325. {
  326. gain_0x3e08 = 0x3f;
  327. gain_0x3e09 = 0x7f;
  328. gain_0x3e06 = 0x1;
  329. gain_0x3e07 = again / 3.375 / 16;
  330. }
  331. else if (again <= 64 * 3.375 * 16 * 8) //again 54.07x dgain 8x
  332. {
  333. gain_0x3e08 = 0x3f;
  334. gain_0x3e09 = 0x7f;
  335. gain_0x3e06 = 0x3;
  336. gain_0x3e07 = again / 3.375 / 32;
  337. }
  338. else if (again <= 64 * 3.375 * 16 * 16) //again 54.07x dgain 16x
  339. {
  340. gain_0x3e08 = 0x3f;
  341. gain_0x3e09 = 0x7f;
  342. gain_0x3e06 = 0x7;
  343. gain_0x3e07 = again / 3.375 / 64;
  344. }
  345. else if (again <= 64 * 3.375 * 16 * 32) //again 54.07x dgain 32x
  346. {
  347. gain_0x3e08 = 0x3f;
  348. gain_0x3e09 = 0x7f;
  349. gain_0x3e06 = 0xf;
  350. gain_0x3e07 = again / 3.375 / 128;
  351. }
  352. #endif
  353. // high frm GAIN
  354. Sensor_Write(0x3e06, gain_0x3e06);
  355. Sensor_Write(0x3e07, gain_0x3e07);
  356. Sensor_Write(0x3e08, gain_0x3e08);
  357. Sensor_Write(0x3e09, gain_0x3e09);
  358. // low frm GAIN
  359. Sensor_Write(0x3e10, gain_0x3e06);
  360. Sensor_Write(0x3e11, gain_0x3e07);
  361. Sensor_Write(0x3e12, gain_0x3e08);
  362. Sensor_Write(0x3e13, gain_0x3e09);
  363. return 0;
  364. }
  365. static int CalcSnsValidIntt(FH_UINT32 *u32Intt)
  366. {
  367. return 0;
  368. }
  369. static int SetIntt(FH_UINT32 intt, FH_UINT8 fNo)
  370. {
  371. //printf("intt=%d----",intt);
  372. if(intt<2)
  373. intt=2;
  374. sns_cfg.curr_sensor_intt = intt;
  375. //printf("curr_sensor_intt=%d\n",curr_sensor_intt);
  376. /*
  377. FH_SINT32 height1L,height1H,height1,height2L,height2H,height2;
  378. height1H = Sensor_Read(0x320e);
  379. height1L = Sensor_Read(0x320f);
  380. height1 = (height1H << 8) | height1L;
  381. height2H = Sensor_Read(0x3e23);
  382. height2L = Sensor_Read(0x3e24);
  383. height2 = (height2H << 8) | height2L;
  384. */
  385. FH_UINT8 exposure_3e00 = 0x00;
  386. FH_UINT8 exposure_3e01 = 0x00;
  387. FH_UINT8 exposure_3e02 = 0x00;
  388. /*
  389. if(wdr_flag==0)
  390. {
  391. if(intt > height1-4 )
  392. intt = height1-4;
  393. }
  394. else
  395. {
  396. if(intt > height1-height2-8 )
  397. intt = height1-height2-8 ;
  398. }
  399. */
  400. exposure_3e00 = (intt>>12) & 0x0f;
  401. exposure_3e01 = (intt &0xfff)>>4;
  402. exposure_3e02 = (intt&0xf)<<4;
  403. Sensor_Write(0x3e00, exposure_3e00);
  404. Sensor_Write(0x3e01, exposure_3e01);
  405. Sensor_Write(0x3e02, exposure_3e02);
  406. sns_cfg.curr_sensor_intt = intt;
  407. return 0;
  408. }
  409. static int SetSnsFrameH(FH_UINT32 frameH)
  410. {
  411. //if(sns_cfg.wdr_flag)
  412. // frame_height = (vi_attr.u16WndHeight )* multiple;
  413. // else
  414. // frame_height = (vi_attr.u16WndHeight/2 )* multiple;
  415. Sensor_Write(0x320e, (frameH>>8)&0xff);
  416. Sensor_Write(0x320f, frameH&0xff);
  417. sns_cfg.v_cycle = frameH;
  418. return 0;
  419. }
  420. static int SetExposureRatio(FH_UINT32 exposure_ratio)
  421. {
  422. FH_UINT32 s_intt;
  423. //FH_SINT32 s_3e23,s_3e24,sf_exp_limit;
  424. if(exposure_ratio == 0)
  425. return 0;
  426. //s_3e23=Sensor_Read(0x3e23);
  427. //s_3e24=Sensor_Read(0x3e24);
  428. //sf_exp_limit=(s_3e23<<8)|s_3e24;
  429. s_intt = MAX((((sns_cfg.curr_sensor_intt<<6)+(exposure_ratio>>1)) / exposure_ratio), 1);
  430. //printf("the s_intt =%d, %d\n",s_intt,s_intt%4);
  431. if(s_intt < 1)
  432. s_intt = 1;
  433. /*
  434. if(s_intt > (2 * sf_exp_limit -8))
  435. s_intt = 2 * sf_exp_limit -8;
  436. */
  437. Sensor_Write(0x3e04, (s_intt&0xfff)>>4);
  438. Sensor_Write(0x3e05, (s_intt&0xf)<<4);
  439. sns_cfg.curr_exposure_ratio = (sns_cfg.curr_sensor_intt<<4)/s_intt;
  440. return 0;
  441. }
  442. static int GetExposureRatio(FH_UINT32 *exposure_ratio)
  443. {
  444. *exposure_ratio = sns_cfg.curr_exposure_ratio;
  445. return 0;
  446. }
  447. /*
  448. static int Sensor_Kick()
  449. {
  450. if (sns_cfg.inited)
  451. {
  452. SensorDevice_Init((sc2210_i2c_addr>>1), 2); //0x64
  453. SensorReset();
  454. sns_cfg.inited = 1;
  455. }
  456. return 0;
  457. }
  458. */
  459. static int SetSensorReg(unsigned short addr,unsigned short data)
  460. {
  461. Sensor_Write(addr,data);
  462. return 0;
  463. }
  464. static int GetSensorReg(unsigned short addr, unsigned short *data)
  465. {
  466. *data = Sensor_Read(addr);
  467. return 0;
  468. }
  469. static int SetSensorFlipMirror(FH_UINT32 sensor_en_stat)
  470. {
  471. FH_UINT32 mirror,flip;
  472. mirror = (sensor_en_stat >>1)&0x1;
  473. flip = sensor_en_stat & 0x1;
  474. Sensor_Write(0x3221, ((flip?0x3:0x00)<<5) | ((mirror?0x3:0x00) <<1) );
  475. return 0;
  476. }
  477. static int GetSensorFlipMirror(FH_UINT32 *sensor_en_stat)
  478. {
  479. FH_UINT32 mirror,flip,tmp;
  480. tmp = Sensor_Read(0x3221);
  481. mirror = (tmp>>1) & 0x1;
  482. flip = (tmp>>5) &0x01 ;
  483. *sensor_en_stat = (mirror<<1)|flip;
  484. return 0;
  485. }
  486. static int GetSensorAttribute(char *name, FH_UINT32 *value)
  487. {
  488. #ifdef OS_LINUX
  489. if (strcmp(name, "WDR") == 0) {
  490. #else
  491. if (rt_strcmp(name, "WDR") == 0) {
  492. #endif
  493. *value = sns_cfg.wdr_flag;
  494. return 0;
  495. }
  496. return -1;
  497. }
  498. static int SensorCommonIf(FH_UINT32 cmd, ISP_SENSOR_COMMON_CMD_DATA0* data0, ISP_SENSOR_COMMON_CMD_DATA1* data1)
  499. {
  500. int ret = -1;
  501. return ret;
  502. }
  503. static FH_UINT32* GetMirrorFlipBayerFormat(void) {
  504. return NAME(MirrorFlipBayerFormat);
  505. }
  506. static FH_UINT32* GetUserSensorAwbGain(FH_UINT32 idx) {return 0;}
  507. static FH_UINT32* GetSensorLtmCurve(FH_UINT32 idx) {
  508. return 0;
  509. }
  510. /***********************adv api related end*************************************/
  511. /***********************not used for now start**********************************/
  512. static int SetSensorAwbGain(FH_UINT32 *awb_gain){return 0;}
  513. static int GetSensorAwbGain(FH_UINT32 *awb_gain){return 0;}
  514. static int SetSensorIris(FH_UINT32 iris){return 0;}
  515. #define SENSOR_SC2210_MIPI "sc2210_mipi"
  516. struct isp_sensor_if sc2210_mipi_sensor_if;
  517. /***********************not used for now end************************************/
  518. #ifdef OS_RTT
  519. struct isp_sensor_if sc2210_mipi_sensor_if __attribute__((section(".sensor_drv"))) = {
  520. #else
  521. struct isp_sensor_if sc2210_mipi_sensor_if = {
  522. #endif
  523. .name = SENSOR_SC2210_MIPI,
  524. .get_vi_attr = GetSensorViAttr,
  525. .set_flipmirror = SetSensorFlipMirror,
  526. .get_flipmirror = GetSensorFlipMirror,
  527. .set_iris = SetSensorIris,
  528. .init = Sensor_Init,
  529. .reset = SensorReset,
  530. .deinit = Sensor_DeInit,
  531. .set_sns_fmt = SetSensorFmt,
  532. //.kick = Sensor_Kick,
  533. .set_sns_reg = SetSensorReg,
  534. .set_exposure_ratio = SetExposureRatio,
  535. .get_exposure_ratio = GetExposureRatio,
  536. .get_sensor_attribute = GetSensorAttribute,
  537. .set_lane_num_max = SetLaneNumMax,
  538. .get_sns_reg = GetSensorReg,
  539. .get_awb_gain = GetSensorAwbGain,
  540. .set_awb_gain = SetSensorAwbGain,
  541. .data = 0,
  542. .common_if = SensorCommonIf,
  543. .get_sns_ae_default = GetAEDefault,
  544. .get_sns_ae_info = GetAEInfo,
  545. .set_sns_intt = SetIntt,
  546. .calc_sns_valid_intt = CalcSnsValidIntt,
  547. .set_sns_gain = SetGain,
  548. .calc_sns_valid_gain = CalcSnsValidGain,
  549. .set_sns_frame_height = SetSnsFrameH,
  550. .get_sensor_mirror_flip_bayer_format = GetMirrorFlipBayerFormat,
  551. .get_user_awb_gain = GetUserSensorAwbGain,
  552. .get_user_ltm_curve = GetSensorLtmCurve,
  553. .is_sensor_connect = Sensor_Isconnect,
  554. };
  555. #ifdef OS_RTT
  556. #else
  557. struct isp_sensor_if* NAME(Sensor_Create)() {
  558. return &sc2210_mipi_sensor_if;
  559. }
  560. void NAME(Sensor_Destroy)(struct isp_sensor_if* s_if){
  561. memset(&sc2210_mipi_sensor_if, 0, sizeof(struct isp_sensor_if));
  562. }
  563. #endif