SC132GS.c 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996
  1. #include <ebase/types.h>
  2. #include <ebase/trace.h>
  3. #include <ebase/builtins.h>
  4. #include <common/return_codes.h>
  5. #include <common/misc.h>
  6. #include <sys/ioctl.h>
  7. #include <fcntl.h>
  8. #include <isi/isi.h>
  9. #include <isi/isi_iss.h>
  10. #include <isi/isi_priv.h>
  11. #include <vvsensor.h>
  12. #include "SC132GS_priv.h"
  13. #include "sc132gs.h"
  14. CREATE_TRACER( SC132GS_INFO , "SC132GS: ", INFO, 0);
  15. CREATE_TRACER( SC132GS_WARN , "SC132GS: ", WARNING, 1);
  16. CREATE_TRACER( SC132GS_ERROR, "SC132GS: ", ERROR, 1);
  17. CREATE_TRACER( SC132GS_DEBUG, "SC132GS: ", INFO, 1);
  18. CREATE_TRACER( SC132GS_REG_INFO , "SC132GS: ", INFO, 1);
  19. CREATE_TRACER( SC132GS_REG_DEBUG, "SC132GS: ", INFO, 1);
  20. #ifdef SUBDEV_V4L2
  21. #include <sys/ioctl.h>
  22. #include <sys/mman.h>
  23. #include <fcntl.h>
  24. #include <linux/videodev2.h>
  25. #include <linux/v4l2-subdev.h>
  26. #undef TRACE
  27. #define TRACE(x, ...)
  28. #endif
  29. #define SC132GS_MIN_GAIN_STEP ( 1.0f/16.0f ) /**< min gain step size used by GUI (hardware min = 1/16; 1/16..32/16 depending on actual gain ) */
  30. #define SC132GS_MAX_GAIN_AEC ( 32.0f ) /**< max. gain used by the AEC (arbitrarily chosen, hardware limit = 62.0, driver limit = 32.0 ) */
  31. #define SC132GS_VS_MAX_INTEGRATION_TIME (0.0018)
  32. /*****************************************************************************
  33. *Sensor Info
  34. *****************************************************************************/
  35. static const char SensorName[16] = "SC132GS";
  36. static struct vvcam_mode_info psc132gs_mode_info[] = {
  37. {
  38. .index = 0,
  39. .width = 1080,
  40. .height = 1280,
  41. .fps = 30,
  42. .hdr_mode = SENSOR_MODE_LINEAR,
  43. .bit_width = 10,
  44. .bayer_pattern = BAYER_BGGR,
  45. .mipi_phy_freq = 607, //mbps
  46. .mipi_line_num = 2,
  47. .preg_data = (void *)"sc132gs sensor liner mode, raw10, 607mbps(sensor clk 24m), img resolution is 1080*1280",
  48. },
  49. {
  50. .index = 1,
  51. .width = 1080,
  52. .height = 1280,
  53. .fps = 30,
  54. .hdr_mode = SENSOR_MODE_LINEAR,
  55. .bit_width = 10,
  56. .bayer_pattern = BAYER_BGGR,
  57. .mipi_phy_freq = 607, //mbps
  58. .mipi_line_num = 2,
  59. .preg_data = (void *)"sc132gs sensor liner mode, raw10, 607mbps(sensor clk 24m), img resolution is 1080*1280, dual camera synchronization mode, sensor is master",
  60. },
  61. {
  62. .index = 2,
  63. .width = 1080,
  64. .height = 1280,
  65. .fps = 30,
  66. .hdr_mode = SENSOR_MODE_LINEAR,
  67. .bit_width = 10,
  68. .bayer_pattern = BAYER_BGGR,
  69. .mipi_phy_freq = 607, //mbps
  70. .mipi_line_num = 2,
  71. .preg_data = (void *)"sc132gs sensor liner mode, raw10, 607mbps(sensor clk 24m), img resolution is 1080*1280, dual camera synchronization mode, sensor is slave",
  72. },
  73. {
  74. .index = 3,
  75. .width = 960,
  76. .height = 1280,
  77. .fps = 30,
  78. .hdr_mode = SENSOR_MODE_LINEAR,
  79. .bit_width = 10,
  80. .bayer_pattern = BAYER_BGGR,
  81. .mipi_phy_freq = 360, //mbps
  82. .mipi_line_num = 2,
  83. .preg_data = (void *)"sc132gs sensor liner mode, raw10 30fps, 360mbps, img resolution is 960*1280",
  84. },
  85. {
  86. .index = 4,
  87. .width = 960,
  88. .height = 1280,
  89. .fps = 30,
  90. .hdr_mode = SENSOR_MODE_LINEAR,
  91. .bit_width = 10,
  92. .bayer_pattern = BAYER_BGGR,
  93. .mipi_phy_freq = 360, //mbps
  94. .mipi_line_num = 2,
  95. .preg_data = (void *)"sc132gs sensor liner mode, raw10 30fps, 360mbps, img resolution is 960*1280, dual camera synchronization mode, sensor is master",
  96. },
  97. {
  98. .index = 5,
  99. .width = 960,
  100. .height = 1280,
  101. .fps = 30,
  102. .hdr_mode = SENSOR_MODE_LINEAR,
  103. .bit_width = 10,
  104. .bayer_pattern = BAYER_BGGR,
  105. .mipi_phy_freq = 360, //mbps
  106. .mipi_line_num = 2,
  107. .preg_data = (void *)"sc132gs sensor liner mode, raw10 30fps, 360mbps, img resolution is 960*1280, dual camera synchronization mode, sensor is slave",
  108. },
  109. };
  110. static RESULT SC132GS_IsiRegisterWriteIss(IsiSensorHandle_t handle, const uint32_t address, const uint32_t value);
  111. typedef struct {
  112. int ana_reg_val;
  113. float step;
  114. float max_val;
  115. } sc132gs_gain_map_t;
  116. static sc132gs_gain_map_t sc132gs_gain_map[] = {
  117. {0x03, 0.031, 1},
  118. {0x03, 0.031, 1.781},
  119. {0x023, 0.056, 3.568},
  120. {0x027, 0.114, 7.137},
  121. {0x02f, 0.226, 14.273},
  122. {0x03f, 0.450, 28.547},
  123. };
  124. static int sc132gs_set_gain(IsiSensorHandle_t handle, float gain, float *set_gain)
  125. {
  126. //Normal 模式/ HDR 模式下的长曝光数据
  127. #define ANA_GAIN 0x3e08
  128. #define ANA_FINE 0x3e09
  129. //HDR 模式下的短曝光数据
  130. #define ANA_VS_GAIN 0x3e12
  131. #define ANA_VS_FINE 0x3e13
  132. int ret = 0;
  133. int i = 0;
  134. uint32_t ana_gain_val = 0;
  135. uint32_t ana_fine_val = 0;
  136. if (gain <= 1.0) {
  137. ana_gain_val = 0x3;
  138. ana_fine_val = 0x20;
  139. *set_gain = 1;
  140. } else if (gain >= 28.547) {
  141. ana_gain_val = 0x3f;
  142. ana_fine_val = 0x3f;
  143. *set_gain = 28.547;
  144. } else {
  145. for(i = 0; i < sizeof(sc132gs_gain_map) / sizeof(sc132gs_gain_map[0]); i++) {
  146. if (sc132gs_gain_map[i].max_val > gain) {
  147. ana_gain_val = sc132gs_gain_map[i].ana_reg_val;
  148. ana_fine_val = 0x20 + (gain - sc132gs_gain_map[i - 1].max_val) / sc132gs_gain_map[i].step;
  149. *set_gain = sc132gs_gain_map[i - 1].max_val + (gain - sc132gs_gain_map[i - 1].max_val) / sc132gs_gain_map[i].step;
  150. break;
  151. }
  152. }
  153. if (ana_fine_val > 0x3f) {
  154. ana_fine_val = 0x3f;
  155. *set_gain = sc132gs_gain_map[i].max_val;
  156. }
  157. }
  158. ret |= SC132GS_IsiRegisterWriteIss(handle, ANA_GAIN, ana_gain_val);
  159. ret |= SC132GS_IsiRegisterWriteIss(handle, ANA_FINE, ana_fine_val);
  160. if (ret != 0) {
  161. return -1;
  162. }
  163. return ret;
  164. }
  165. long __sc132gs_set_exposure(IsiSensorHandle_t handle, int coarse_itg,
  166. int gain, int digitgain, SC132GS_EXPOSURE_SETTING_t type)
  167. {
  168. return 0;
  169. }
  170. static RESULT SC132GS_IsiSensorSetPowerIss(IsiSensorHandle_t handle, bool_t on) {
  171. RESULT result = RET_SUCCESS;
  172. int ret = 0;
  173. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  174. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  175. return RET_NULL_POINTER;
  176. }
  177. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  178. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  179. int32_t enable = on;
  180. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_POWER, &enable);
  181. if (ret != 0) {
  182. // to do
  183. //TRACE(SC132GS_ERROR, "%s: sensor set power error!\n", __func__);
  184. //return (RET_FAILURE);
  185. }
  186. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  187. return (result);
  188. }
  189. static RESULT SC132GS_IsiResetSensorIss(IsiSensorHandle_t handle) {
  190. RESULT result = RET_SUCCESS;
  191. int ret = 0;
  192. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  193. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  194. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  195. return RET_NULL_POINTER;
  196. }
  197. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  198. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_RESET, NULL);
  199. if (ret != 0) {
  200. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  201. return (RET_FAILURE);
  202. }
  203. sleep(0.01);
  204. ret = SC132GS_IsiRegisterWriteIss(handle, 0x103, 1);
  205. if (ret != 0) {
  206. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  207. return (RET_FAILURE);
  208. }
  209. sleep(0.01);
  210. ret = SC132GS_IsiRegisterWriteIss(handle, 0x103, 0);
  211. if (ret != 0) {
  212. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  213. return (RET_FAILURE);
  214. }
  215. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  216. return (result);
  217. }
  218. #ifdef SUBDEV_CHAR
  219. static RESULT SC132GS_IsiSensorSetClkIss(IsiSensorHandle_t handle, uint32_t clk) {
  220. RESULT result = RET_SUCCESS;
  221. int32_t ret = 0;
  222. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  223. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  224. return RET_NULL_POINTER;
  225. }
  226. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  227. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  228. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_CLK, &clk);
  229. if (ret != 0) {
  230. // to do
  231. //TRACE(SC132GS_ERROR, "%s: sensor set clk error!\n", __func__);
  232. //return (RET_FAILURE);
  233. }
  234. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  235. return (result);
  236. }
  237. static RESULT SC132GS_IsiSensorGetClkIss
  238. (IsiSensorHandle_t handle, uint32_t * pclk) {
  239. RESULT result = RET_SUCCESS;
  240. int ret = 0;
  241. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  242. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  243. return RET_NULL_POINTER;
  244. }
  245. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  246. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  247. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_CLK, pclk);
  248. if (ret != 0) {
  249. // to do
  250. //TRACE(SC132GS_ERROR, "%s: sensor get clk error!\n", __func__);
  251. //return (RET_FAILURE);
  252. }
  253. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  254. return (result);
  255. }
  256. static RESULT SC132GS_IsiConfigSensorSCCBIss(IsiSensorHandle_t handle)
  257. {
  258. RESULT result = RET_SUCCESS;
  259. return result;
  260. int ret = 0;
  261. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  262. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  263. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  264. return RET_NULL_POINTER;
  265. }
  266. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  267. static const IsiSccbInfo_t SensorSccbInfo = {
  268. .slave_addr = (0x31), //0x30 or 0x32
  269. .addr_byte = 2,
  270. .data_byte = 1,
  271. };
  272. struct vvcam_sccb_cfg_s sensor_sccb_config;
  273. sensor_sccb_config.slave_addr = SensorSccbInfo.slave_addr;
  274. sensor_sccb_config.addr_byte = SensorSccbInfo.addr_byte;
  275. sensor_sccb_config.data_byte = SensorSccbInfo.data_byte;
  276. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_SENSOR_SCCB_CFG,
  277. &sensor_sccb_config);
  278. if (ret != 0) {
  279. TRACE(SC132GS_ERROR, "%s: sensor config sccb info error!\n",
  280. __func__);
  281. return (RET_FAILURE);
  282. }
  283. TRACE(SC132GS_INFO, "%s (exit) result = %d\n", __func__, result);
  284. return (result);
  285. return RET_SUCCESS;
  286. }
  287. #endif
  288. static RESULT SC132GS_IsiRegisterReadIss
  289. (IsiSensorHandle_t handle, const uint32_t address, uint32_t * p_value) {
  290. RESULT result = RET_SUCCESS;
  291. int32_t ret = 0;
  292. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  293. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  294. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  295. return RET_NULL_POINTER;
  296. }
  297. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  298. struct vvcam_sccb_data sccb_data;
  299. sccb_data.addr = address;
  300. sccb_data.data = 0;
  301. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_READ_REG, &sccb_data);
  302. if (ret != 0) {
  303. TRACE(SC132GS_ERROR, "%s: read sensor register error!\n",
  304. __func__);
  305. return (RET_FAILURE);
  306. }
  307. *p_value = sccb_data.data;
  308. TRACE(SC132GS_INFO, "%s (exit) result = %d\n", __func__, result);
  309. return (result);
  310. }
  311. static RESULT SC132GS_IsiRegisterWriteIss
  312. (IsiSensorHandle_t handle, const uint32_t address, const uint32_t value) {
  313. RESULT result = RET_SUCCESS;
  314. int ret = 0;
  315. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  316. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  317. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  318. return RET_NULL_POINTER;
  319. }
  320. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  321. struct vvcam_sccb_data sccb_data;
  322. sccb_data.addr = address;
  323. sccb_data.data = value;
  324. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_WRITE_REG, &sccb_data);
  325. if (ret != 0) {
  326. TRACE(SC132GS_ERROR, "%s: write sensor register error!\n",
  327. __func__);
  328. return (RET_FAILURE);
  329. }
  330. TRACE(SC132GS_INFO, "%s (exit) result = %d\n", __func__, result);
  331. return (result);
  332. }
  333. static RESULT SC132GS_IsiQuerySensorSupportIss(HalHandle_t HalHandle, vvcam_mode_info_array_t *pSensorSupportInfo)
  334. {
  335. //int ret = 0;
  336. struct vvcam_mode_info_array *psensor_mode_info_arry;
  337. HalContext_t *pHalCtx = HalHandle;
  338. if ( pHalCtx == NULL ) {
  339. return RET_NULL_POINTER;
  340. }
  341. psensor_mode_info_arry = pSensorSupportInfo;
  342. psensor_mode_info_arry->count = sizeof(psc132gs_mode_info) / sizeof(struct vvcam_mode_info);
  343. memcpy(psensor_mode_info_arry->modes, psc132gs_mode_info, sizeof(psc132gs_mode_info));
  344. return RET_SUCCESS;
  345. }
  346. static RESULT SC132GS_IsiQuerySensorIss(IsiSensorHandle_t handle, vvcam_mode_info_array_t *pSensorInfo)
  347. {
  348. RESULT result = RET_SUCCESS;
  349. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  350. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  351. return RET_NULL_POINTER;
  352. }
  353. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  354. SC132GS_IsiQuerySensorSupportIss(pHalCtx,pSensorInfo);
  355. return result;
  356. }
  357. static RESULT SC132GS_IsiGetSensorModeIss(IsiSensorHandle_t handle,void *mode)
  358. {
  359. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  360. if (pSC132GSCtx == NULL) {
  361. return (RET_WRONG_HANDLE);
  362. }
  363. memcpy(mode,&(pSC132GSCtx->SensorMode), sizeof(pSC132GSCtx->SensorMode));
  364. return ( RET_SUCCESS );
  365. }
  366. static RESULT SC132GS_IsiCreateSensorIss(IsiSensorInstanceConfig_t * pConfig) {
  367. RESULT result = RET_SUCCESS;
  368. SC132GS_Context_t *pSC132GSCtx;
  369. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  370. if (!pConfig || !pConfig->pSensor)
  371. return (RET_NULL_POINTER);
  372. pSC132GSCtx = (SC132GS_Context_t *) malloc(sizeof(SC132GS_Context_t));
  373. if (!pSC132GSCtx) {
  374. TRACE(SC132GS_ERROR, "%s: Can't allocate sc132gs context\n",
  375. __func__);
  376. return (RET_OUTOFMEM);
  377. }
  378. MEMSET(pSC132GSCtx, 0, sizeof(SC132GS_Context_t));
  379. result = HalAddRef(pConfig->HalHandle);
  380. if (result != RET_SUCCESS) {
  381. free(pSC132GSCtx);
  382. return (result);
  383. }
  384. pSC132GSCtx->IsiCtx.HalHandle = pConfig->HalHandle;
  385. pSC132GSCtx->IsiCtx.pSensor = pConfig->pSensor;
  386. pSC132GSCtx->GroupHold = BOOL_FALSE;
  387. pSC132GSCtx->OldGain = 0;
  388. pSC132GSCtx->OldIntegrationTime = 0;
  389. pSC132GSCtx->Configured = BOOL_FALSE;
  390. pSC132GSCtx->Streaming = BOOL_FALSE;
  391. pSC132GSCtx->TestPattern = BOOL_FALSE;
  392. pSC132GSCtx->isAfpsRun = BOOL_FALSE;
  393. pSC132GSCtx->SensorMode.index = pConfig->SensorModeIndex;
  394. pConfig->hSensor = (IsiSensorHandle_t) pSC132GSCtx;
  395. #ifdef SUBDEV_CHAR
  396. struct vvcam_mode_info *SensorDefaultMode = NULL;
  397. for (int i=0; i < sizeof(psc132gs_mode_info)/ sizeof(struct vvcam_mode_info); i++)
  398. {
  399. if (psc132gs_mode_info[i].index == pSC132GSCtx->SensorMode.index)
  400. {
  401. SensorDefaultMode = &(psc132gs_mode_info[i]);
  402. break;
  403. }
  404. }
  405. if (SensorDefaultMode != NULL)
  406. {
  407. strcpy(pSC132GSCtx->SensorRegCfgFile, get_vi_config_path());
  408. switch(SensorDefaultMode->index)
  409. {
  410. case 0:
  411. strcat(pSC132GSCtx->SensorRegCfgFile,
  412. "SC132GS_mipi2lane_1080x1280_init.txt");
  413. break;
  414. case 1:
  415. strcat(pSC132GSCtx->SensorRegCfgFile,
  416. "SC132GS_mipi2lane_1080x1280_master_init.txt");
  417. break;
  418. case 2:
  419. strcat(pSC132GSCtx->SensorRegCfgFile,
  420. "SC132GS_mipi2lane_1080x1280_slave_init.txt");
  421. break;
  422. case 3:
  423. strcat(pSC132GSCtx->SensorRegCfgFile,
  424. "SC132GS_mipi2lane_960x1280_init.txt");
  425. break;
  426. case 4:
  427. strcat(pSC132GSCtx->SensorRegCfgFile,
  428. "SC132GS_mipi2lane_960x1280_master_init.txt");
  429. break;
  430. case 5:
  431. strcat(pSC132GSCtx->SensorRegCfgFile,
  432. "SC132GS_mipi2lane_960x1280_slave_init.txt");
  433. break;
  434. default:
  435. return -1;
  436. }
  437. if (access(pSC132GSCtx->SensorRegCfgFile, F_OK) == 0) {
  438. pSC132GSCtx->KernelDriverFlag = 0;
  439. memcpy(&(pSC132GSCtx->SensorMode),SensorDefaultMode,sizeof(struct vvcam_mode_info));
  440. } else {
  441. return -1;
  442. }
  443. }else
  444. {
  445. pSC132GSCtx->KernelDriverFlag = 1;
  446. }
  447. result = SC132GS_IsiSensorSetPowerIss(pSC132GSCtx, BOOL_TRUE);
  448. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  449. uint32_t SensorClkIn = 0;
  450. if (pSC132GSCtx->KernelDriverFlag) {
  451. result = SC132GS_IsiSensorGetClkIss(pSC132GSCtx, &SensorClkIn);
  452. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  453. }
  454. result = SC132GS_IsiSensorSetClkIss(pSC132GSCtx, SensorClkIn);
  455. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  456. result = SC132GS_IsiResetSensorIss(pSC132GSCtx);
  457. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  458. pSC132GSCtx->pattern = ISI_BPAT_BGBGGRGR;
  459. if (!pSC132GSCtx->KernelDriverFlag) {
  460. result = SC132GS_IsiConfigSensorSCCBIss(pSC132GSCtx);
  461. RETURN_RESULT_IF_DIFFERENT(RET_SUCCESS, result);
  462. }
  463. #endif
  464. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  465. return (result);
  466. }
  467. static RESULT SC132GS_IsiGetRegCfgIss(const char *registerFileName,
  468. struct vvcam_sccb_array *arry)
  469. {
  470. if (NULL == registerFileName) {
  471. TRACE(SC132GS_ERROR, "%s:registerFileName is NULL\n", __func__);
  472. return (RET_NULL_POINTER);
  473. }
  474. #ifdef SUBDEV_CHAR
  475. FILE *fp = NULL;
  476. fp = fopen(registerFileName, "rb");
  477. if (!fp) {
  478. TRACE(SC132GS_ERROR, "%s:load register file %s error!\n",
  479. __func__, registerFileName);
  480. return (RET_FAILURE);
  481. }
  482. char LineBuf[512];
  483. uint32_t FileTotalLine = 0;
  484. while (!feof(fp)) {
  485. fgets(LineBuf, 512, fp);
  486. FileTotalLine++;
  487. }
  488. arry->sccb_data =
  489. malloc(FileTotalLine * sizeof(struct vvcam_sccb_data));
  490. if (arry->sccb_data == NULL) {
  491. TRACE(SC132GS_ERROR, "%s:malloc failed NULL Point!\n", __func__,
  492. registerFileName);
  493. return (RET_FAILURE);
  494. }
  495. rewind(fp);
  496. arry->count = 0;
  497. while (!feof(fp)) {
  498. memset(LineBuf, 0, sizeof(LineBuf));
  499. fgets(LineBuf, 512, fp);
  500. int result =
  501. sscanf(LineBuf, "0x%x 0x%x",
  502. &(arry->sccb_data[arry->count].addr),
  503. &(arry->sccb_data[arry->count].data));
  504. if (result != 2)
  505. continue;
  506. arry->count++;
  507. }
  508. #endif
  509. return 0;
  510. }
  511. static RESULT SC132GS_IsiInitSensorIss(IsiSensorHandle_t handle) {
  512. RESULT result = RET_SUCCESS;
  513. int ret = 0;
  514. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  515. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  516. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  517. if (pSC132GSCtx == NULL) {
  518. return (RET_WRONG_HANDLE);
  519. }
  520. if (pSC132GSCtx->KernelDriverFlag) {
  521. ;
  522. } else {
  523. struct vvcam_sccb_array arry;
  524. result = SC132GS_IsiGetRegCfgIss(pSC132GSCtx->SensorRegCfgFile, &arry);
  525. if (result != 0) {
  526. TRACE(SC132GS_ERROR,
  527. "%s:SC132GS_IsiGetRegCfgIss error!\n", __func__);
  528. return (RET_FAILURE);
  529. }
  530. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_WRITE_ARRAY, &arry);
  531. if (ret != 0) {
  532. TRACE(SC132GS_ERROR, "%s:Sensor Write Reg arry error!\n",
  533. __func__);
  534. return (RET_FAILURE);
  535. }
  536. switch(pSC132GSCtx->SensorMode.index)
  537. {
  538. case 0:
  539. pSC132GSCtx->one_line_exp_time = 1;
  540. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  541. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  542. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  543. pSC132GSCtx->MinIntegrationLine = 1;
  544. pSC132GSCtx->AecMaxGain = 28;
  545. pSC132GSCtx->AecMinGain = 1;
  546. break;
  547. case 1:
  548. pSC132GSCtx->one_line_exp_time = 1;
  549. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  550. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  551. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  552. pSC132GSCtx->MinIntegrationLine = 1;
  553. pSC132GSCtx->AecMaxGain = 28;
  554. pSC132GSCtx->AecMinGain = 1;
  555. break;
  556. case 2:
  557. pSC132GSCtx->one_line_exp_time = 1;
  558. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  559. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  560. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  561. pSC132GSCtx->MinIntegrationLine = 1;
  562. pSC132GSCtx->AecMaxGain = 28;
  563. pSC132GSCtx->AecMinGain = 1;
  564. break;
  565. case 3:
  566. pSC132GSCtx->one_line_exp_time = 1;
  567. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  568. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  569. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  570. pSC132GSCtx->MinIntegrationLine = 1;
  571. pSC132GSCtx->AecMaxGain = 28;
  572. pSC132GSCtx->AecMinGain = 1;
  573. break;
  574. case 4:
  575. pSC132GSCtx->one_line_exp_time = 1;
  576. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  577. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  578. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  579. pSC132GSCtx->MinIntegrationLine = 1;
  580. pSC132GSCtx->AecMaxGain = 28;
  581. pSC132GSCtx->AecMinGain = 1;
  582. break;
  583. case 5:
  584. pSC132GSCtx->one_line_exp_time = 1;
  585. pSC132GSCtx->FrameLengthLines = (0x546 - 8) * 16;
  586. pSC132GSCtx->CurFrameLengthLines = pSC132GSCtx->FrameLengthLines;
  587. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->CurFrameLengthLines - 3;
  588. pSC132GSCtx->MinIntegrationLine = 1;
  589. pSC132GSCtx->AecMaxGain = 28;
  590. pSC132GSCtx->AecMinGain = 1;
  591. break;
  592. default:
  593. return ( RET_NOTAVAILABLE );
  594. }
  595. pSC132GSCtx->AecIntegrationTimeIncrement = pSC132GSCtx->one_line_exp_time;
  596. pSC132GSCtx->AecMinIntegrationTime =
  597. pSC132GSCtx->one_line_exp_time * pSC132GSCtx->MinIntegrationLine;
  598. pSC132GSCtx->AecMaxIntegrationTime =
  599. pSC132GSCtx->one_line_exp_time * pSC132GSCtx->FrameLengthLines;
  600. pSC132GSCtx->MaxFps = pSC132GSCtx->SensorMode.fps;
  601. pSC132GSCtx->MinFps = 1;
  602. pSC132GSCtx->CurrFps = pSC132GSCtx->MaxFps;
  603. }
  604. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  605. return (result);
  606. }
  607. static RESULT SC132GS_IsiReleaseSensorIss(IsiSensorHandle_t handle) {
  608. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  609. RESULT result = RET_SUCCESS;
  610. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  611. if (pSC132GSCtx == NULL)
  612. return (RET_WRONG_HANDLE);
  613. (void)SC132GS_IsiSensorSetStreamingIss(pSC132GSCtx, BOOL_FALSE);
  614. (void)SC132GS_IsiSensorSetPowerIss(pSC132GSCtx, BOOL_FALSE);
  615. (void)HalDelRef(pSC132GSCtx->IsiCtx.HalHandle);
  616. MEMSET(pSC132GSCtx, 0, sizeof(SC132GS_Context_t));
  617. free(pSC132GSCtx);
  618. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  619. return (result);
  620. }
  621. struct sc132gs_fmt {
  622. int width;
  623. int height;
  624. int fps;
  625. };
  626. static RESULT SC132GS_IsiSetupSensorIss
  627. (IsiSensorHandle_t handle, const IsiSensorConfig_t * pConfig) {
  628. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  629. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  630. RESULT result = RET_SUCCESS;
  631. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  632. if (!pSC132GSCtx) {
  633. TRACE(SC132GS_ERROR,
  634. "%s: Invalid sensor handle (NULL pointer detected)\n",
  635. __func__);
  636. return (RET_WRONG_HANDLE);
  637. }
  638. if (!pConfig) {
  639. TRACE(SC132GS_ERROR,
  640. "%s: Invalid configuration (NULL pointer detected)\n",
  641. __func__);
  642. return (RET_NULL_POINTER);
  643. }
  644. if (pSC132GSCtx->Streaming != BOOL_FALSE) {
  645. return RET_WRONG_STATE;
  646. }
  647. memcpy(&pSC132GSCtx->Config, pConfig, sizeof(IsiSensorConfig_t));
  648. /* 1.) SW reset of image sensor (via I2C register interface) be careful, bits 6..0 are reserved, reset bit is not sticky */
  649. TRACE(SC132GS_DEBUG, "%s: SC132GS System-Reset executed\n", __func__);
  650. osSleep(100);
  651. //SC132GS_AecSetModeParameters not defined yet as of 2021/8/9.
  652. //result = SC132GS_AecSetModeParameters(pSC132GSCtx, pConfig);
  653. //if (result != RET_SUCCESS) {
  654. // TRACE(SC132GS_ERROR, "%s: SetupOutputWindow failed.\n",
  655. // __func__);
  656. // return (result);
  657. //}
  658. #if 1
  659. struct sc132gs_fmt fmt;
  660. fmt.width = pConfig->Resolution.width;
  661. fmt.height = pConfig->Resolution.height;
  662. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);//result = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);
  663. #endif
  664. pSC132GSCtx->Configured = BOOL_TRUE;
  665. TRACE(SC132GS_INFO, "%s: (exit) ret=0x%x \n", __func__, result);
  666. return result;
  667. }
  668. static RESULT SC132GS_IsiChangeSensorResolutionIss(IsiSensorHandle_t handle, uint16_t width, uint16_t height) {
  669. RESULT result = RET_SUCCESS;
  670. #if 0
  671. struct sc132gs_fmt fmt;
  672. fmt.width = width;
  673. fmt.height = height;
  674. int ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fmt);
  675. #endif
  676. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  677. return (result);
  678. }
  679. static RESULT SC132GS_IsiSensorSetStreamingIss
  680. (IsiSensorHandle_t handle, bool_t on) {
  681. RESULT result = RET_SUCCESS;
  682. int ret = 0;
  683. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  684. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  685. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  686. return RET_NULL_POINTER;
  687. }
  688. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  689. if (pSC132GSCtx->Configured != BOOL_TRUE)
  690. return RET_WRONG_STATE;
  691. int32_t enable = (uint32_t) on;
  692. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x00);
  693. if (ret != 0) {
  694. return (RET_FAILURE);
  695. }
  696. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3817, 0x01);
  697. if (ret != 0) {
  698. return (RET_FAILURE);
  699. }
  700. ret = SC132GS_IsiRegisterWriteIss(handle, 0x100, on);
  701. if (ret != 0) {
  702. return (RET_FAILURE);
  703. }
  704. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x10);
  705. if (ret != 0) {
  706. return (RET_FAILURE);
  707. }
  708. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x40);
  709. if (ret != 0) {
  710. return (RET_FAILURE);
  711. }
  712. pSC132GSCtx->Streaming = on;
  713. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  714. return (result);
  715. }
  716. static int32_t sensor_get_chip_id(IsiSensorHandle_t handle, uint32_t *chip_id)
  717. {
  718. RESULT result = RET_SUCCESS;
  719. int32_t ret = 0;
  720. int32_t chip_id_high = 0;
  721. int32_t chip_id_low = 0;
  722. ret = SC132GS_IsiRegisterReadIss(handle, 0x3107, &chip_id_high);
  723. if (ret != 0) {
  724. TRACE(SC132GS_ERROR,
  725. "%s: Read Sensor correct ID Error! \n", __func__);
  726. return (RET_FAILURE);
  727. }
  728. ret = SC132GS_IsiRegisterReadIss(handle, 0x3108, &chip_id_low);
  729. if (ret != 0) {
  730. TRACE(SC132GS_ERROR,
  731. "%s: Read Sensor correct ID Error! \n", __func__);
  732. return (RET_FAILURE);
  733. }
  734. *chip_id = ((chip_id_high & 0xff)<<8) | (chip_id_low & 0xff);
  735. return 0;
  736. }
  737. static RESULT SC132GS_IsiCheckSensorConnectionIss(IsiSensorHandle_t handle) {
  738. RESULT result = RET_SUCCESS;
  739. int ret = 0;
  740. uint32_t correct_id = 0x132;
  741. uint32_t sensor_id = 0;
  742. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  743. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  744. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  745. return RET_NULL_POINTER;
  746. }
  747. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  748. ret = sensor_get_chip_id(handle, &sensor_id);
  749. if (ret != 0) {
  750. TRACE(SC132GS_ERROR,
  751. "%s: Read Sensor chip ID Error! \n", __func__);
  752. return (RET_FAILURE);
  753. }
  754. if (correct_id != sensor_id) {
  755. TRACE(SC132GS_ERROR, "%s:ChipID =0x%x sensor_id=%x error! \n",
  756. __func__, correct_id, sensor_id);
  757. return (RET_FAILURE);
  758. }
  759. TRACE(SC132GS_INFO,
  760. "%s ChipID = 0x%08x, sensor_id = 0x%08x, success! \n", __func__,
  761. correct_id, sensor_id);
  762. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  763. return (result);
  764. }
  765. static RESULT SC132GS_IsiGetSensorRevisionIss
  766. (IsiSensorHandle_t handle, uint32_t * p_value) {
  767. RESULT result = RET_SUCCESS;
  768. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  769. *p_value = 0X132;
  770. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  771. return (result);
  772. }
  773. static RESULT SC132GS_IsiGetGainLimitsIss
  774. (IsiSensorHandle_t handle, float *pMinGain, float *pMaxGain) {
  775. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  776. RESULT result = RET_SUCCESS;
  777. /*TODO*/
  778. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  779. if (pSC132GSCtx == NULL) {
  780. TRACE(SC132GS_ERROR,
  781. "%s: Invalid sensor handle (NULL pointer detected)\n",
  782. __func__);
  783. return (RET_WRONG_HANDLE);
  784. }
  785. if ((pMinGain == NULL) || (pMaxGain == NULL)) {
  786. TRACE(SC132GS_ERROR, "%s: NULL pointer received!!\n");
  787. return (RET_NULL_POINTER);
  788. }
  789. *pMinGain = pSC132GSCtx->AecMinGain;
  790. *pMaxGain = pSC132GSCtx->AecMaxGain;
  791. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  792. return (result);
  793. }
  794. static RESULT SC132GS_IsiGetIntegrationTimeLimitsIss
  795. (IsiSensorHandle_t handle,
  796. float *pMinIntegrationTime, float *pMaxIntegrationTime) {
  797. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  798. RESULT result = RET_SUCCESS;
  799. /*TODO*/
  800. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  801. if (pSC132GSCtx == NULL) {
  802. TRACE(SC132GS_ERROR,
  803. "%s: Invalid sensor handle (NULL pointer detected)\n",
  804. __func__);
  805. return (RET_WRONG_HANDLE);
  806. }
  807. if ((pMinIntegrationTime == NULL) || (pMaxIntegrationTime == NULL)) {
  808. TRACE(SC132GS_ERROR, "%s: NULL pointer received!!\n");
  809. return (RET_NULL_POINTER);
  810. }
  811. *pMinIntegrationTime = pSC132GSCtx->AecMinIntegrationTime;
  812. *pMaxIntegrationTime = pSC132GSCtx->AecMaxIntegrationTime;
  813. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  814. return (result);
  815. }
  816. RESULT SC132GS_IsiGetGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  817. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  818. RESULT result = RET_SUCCESS;
  819. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  820. if (pSC132GSCtx == NULL) {
  821. TRACE(SC132GS_ERROR,
  822. "%s: Invalid sensor handle (NULL pointer detected)\n",
  823. __func__);
  824. return (RET_WRONG_HANDLE);
  825. }
  826. if (pSetGain == NULL) {
  827. return (RET_NULL_POINTER);
  828. }
  829. *pSetGain = pSC132GSCtx->AecCurGain;
  830. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  831. return (result);
  832. }
  833. RESULT SC132GS_IsiGetLongGainIss(IsiSensorHandle_t handle, float *gain)
  834. {
  835. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  836. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  837. if (pSC132GSCtx == NULL) {
  838. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  839. return (RET_WRONG_HANDLE);
  840. }
  841. if (gain == NULL) {
  842. return (RET_NULL_POINTER);
  843. }
  844. *gain = pSC132GSCtx->AecCurLongGain;
  845. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  846. return (RET_SUCCESS);
  847. }
  848. RESULT SC132GS_IsiGetVSGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  849. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  850. RESULT result = RET_SUCCESS;
  851. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  852. if (pSC132GSCtx == NULL) {
  853. TRACE(SC132GS_ERROR,
  854. "%s: Invalid sensor handle (NULL pointer detected)\n",
  855. __func__);
  856. return (RET_WRONG_HANDLE);
  857. }
  858. if (pSetGain == NULL) {
  859. return (RET_NULL_POINTER);
  860. }
  861. *pSetGain = pSC132GSCtx->AecCurVSGain;
  862. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  863. return (result);
  864. }
  865. RESULT SC132GS_IsiGetGainIncrementIss(IsiSensorHandle_t handle, float *pIncr) {
  866. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  867. RESULT result = RET_SUCCESS;
  868. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  869. if (pSC132GSCtx == NULL) {
  870. TRACE(SC132GS_ERROR,
  871. "%s: Invalid sensor handle (NULL pointer detected)\n",
  872. __func__);
  873. return (RET_WRONG_HANDLE);
  874. }
  875. if (pIncr == NULL)
  876. return (RET_NULL_POINTER);
  877. *pIncr = pSC132GSCtx->AecGainIncrement;
  878. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  879. return (result);
  880. }
  881. RESULT SC132GS_IsiSetGainIss
  882. (IsiSensorHandle_t handle,
  883. float NewGain, float *pSetGain, float *hdr_ratio) {
  884. RESULT result = RET_SUCCESS;
  885. int32_t ret = 0;
  886. int TmpGain;
  887. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  888. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  889. return RET_NULL_POINTER;
  890. }
  891. if (NewGain >= 25) { // More than 25 will not take effect
  892. NewGain = 25;
  893. }
  894. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  895. sc132gs_set_gain(handle, NewGain, pSetGain);
  896. pSC132GSCtx->AecCurGain = *pSetGain;
  897. TRACE(SC132GS_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  898. return (result);
  899. }
  900. RESULT SC132GS_IsiSetLongGainIss(IsiSensorHandle_t handle, float gain)
  901. {
  902. int ret = 0;
  903. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  904. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  905. if (!pSC132GSCtx || !pSC132GSCtx->IsiCtx.HalHandle)
  906. {
  907. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  908. return (RET_WRONG_HANDLE);
  909. }
  910. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  911. uint32_t SensorGain = 0;
  912. SensorGain = gain * pSC132GSCtx->gain_accuracy;
  913. if (pSC132GSCtx->LastLongGain != SensorGain)
  914. {
  915. /*TODO*/
  916. #if 0
  917. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_GAIN, &SensorGain);
  918. if (ret != 0)
  919. {
  920. return (RET_FAILURE);
  921. TRACE(SC132GS_ERROR,"%s: set long gain failed\n");
  922. }
  923. #endif
  924. pSC132GSCtx->LastLongGain = SensorGain;
  925. pSC132GSCtx->AecCurLongGain = gain;
  926. }
  927. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  928. return (RET_SUCCESS);
  929. }
  930. RESULT SC132GS_IsiSetVSGainIss
  931. (IsiSensorHandle_t handle,
  932. float NewIntegrationTime,
  933. float NewGain, float *pSetGain, float *hdr_ratio) {
  934. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  935. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  936. RESULT result = RET_SUCCESS;
  937. #if 0
  938. float Gain = 0.0f;
  939. uint32_t ucGain = 0U;
  940. uint32_t again = 0U;
  941. #endif
  942. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  943. if (!pSC132GSCtx) {
  944. TRACE(SC132GS_ERROR,
  945. "%s: Invalid sensor handle (NULL pointer detected)\n",
  946. __func__);
  947. return (RET_WRONG_HANDLE);
  948. }
  949. if (!pSetGain || !hdr_ratio)
  950. return (RET_NULL_POINTER);
  951. uint32_t SensorGain = 0;
  952. SensorGain = NewGain * pSC132GSCtx->gain_accuracy;
  953. /*TODO*/
  954. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSGAIN, &SensorGain);
  955. pSC132GSCtx->AecCurVSGain = NewGain;
  956. *pSetGain = pSC132GSCtx->AecCurGain;
  957. TRACE(SC132GS_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  958. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  959. return (result);
  960. }
  961. RESULT SC132GS_IsiSetBayerPattern(IsiSensorHandle_t handle, uint8_t pattern)
  962. {
  963. RESULT result = RET_SUCCESS;
  964. #if 0
  965. uint8_t h_shift = 0, v_shift = 0;
  966. uint32_t val_h = 0, val_l = 0;
  967. uint16_t val = 0;
  968. uint8_t Start_p = 0;
  969. bool_t streaming_status;
  970. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  971. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  972. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  973. return RET_NULL_POINTER;
  974. }
  975. // pattern 0:B 1:GB 2:GR 3:R
  976. streaming_status = pSC132GSCtx->Streaming;
  977. result = SC132GS_IsiSensorSetStreamingIss(handle, 0);
  978. switch (pattern) {
  979. case BAYER_BGGR:
  980. Start_p = 0;
  981. break;
  982. case BAYER_GBRG:
  983. Start_p = 1;
  984. break;
  985. case BAYER_GRBG:
  986. Start_p = 2;
  987. break;
  988. case BAYER_RGGB:
  989. Start_p = 3;
  990. break;
  991. }
  992. h_shift = Start_p % 2;
  993. v_shift = Start_p / 2;
  994. SC132GS_IsiRegisterReadIss(handle, 0x30a0, &val_h);
  995. SC132GS_IsiRegisterReadIss(handle, 0x30a1, &val_l);
  996. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  997. val_h = (val >> 8) & 0xff;
  998. val_l = val & 0xff;
  999. SC132GS_IsiRegisterWriteIss(handle, 0x30a0, (uint8_t)val_h);
  1000. SC132GS_IsiRegisterWriteIss(handle, 0x30a1, (uint8_t)val_l);
  1001. SC132GS_IsiRegisterReadIss(handle, 0x30a2, &val_h);
  1002. SC132GS_IsiRegisterReadIss(handle, 0x30a3, &val_l);
  1003. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  1004. val_h = (val >> 8) & 0xff;
  1005. val_l = val & 0xff;
  1006. SC132GS_IsiRegisterWriteIss(handle, 0x30a2, (uint8_t)val_h);
  1007. SC132GS_IsiRegisterWriteIss(handle, 0x30a3, (uint8_t)val_l);
  1008. SC132GS_IsiRegisterReadIss(handle, 0x30a4, &val_h);
  1009. SC132GS_IsiRegisterReadIss(handle, 0x30a5, &val_l);
  1010. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  1011. val_h = (val >> 8) & 0xff;
  1012. val_l = val & 0xff;
  1013. SC132GS_IsiRegisterWriteIss(handle, 0x30a4, (uint8_t)val_h);
  1014. SC132GS_IsiRegisterWriteIss(handle, 0x30a5, (uint8_t)val_l);
  1015. SC132GS_IsiRegisterReadIss(handle, 0x30a6, &val_h);
  1016. SC132GS_IsiRegisterReadIss(handle, 0x30a7, &val_l);
  1017. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  1018. val_h = (val >> 8) & 0xff;
  1019. val_l = val & 0xff;
  1020. SC132GS_IsiRegisterWriteIss(handle, 0x30a6, (uint8_t)val_h);
  1021. SC132GS_IsiRegisterWriteIss(handle, 0x30a7, (uint8_t)val_l);
  1022. pSC132GSCtx->pattern = pattern;
  1023. result = SC132GS_IsiSensorSetStreamingIss(handle, streaming_status);
  1024. #endif
  1025. return (result);
  1026. }
  1027. RESULT SC132GS_IsiGetIntegrationTimeIss
  1028. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1029. {
  1030. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1031. RESULT result = RET_SUCCESS;
  1032. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1033. if (!pSC132GSCtx) {
  1034. TRACE(SC132GS_ERROR,
  1035. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1036. __func__);
  1037. return (RET_WRONG_HANDLE);
  1038. }
  1039. if (!pSetIntegrationTime)
  1040. return (RET_NULL_POINTER);
  1041. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1042. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1043. return (result);
  1044. }
  1045. RESULT SC132GS_IsiGetLongIntegrationTimeIss(IsiSensorHandle_t handle, float *pIntegrationTime)
  1046. {
  1047. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1048. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1049. if (!pSC132GSCtx) {
  1050. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1051. return (RET_WRONG_HANDLE);
  1052. }
  1053. if (!pIntegrationTime)
  1054. return (RET_NULL_POINTER);
  1055. pSC132GSCtx->AecCurLongIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1056. *pIntegrationTime = pSC132GSCtx->AecCurLongIntegrationTime;
  1057. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1058. return (RET_SUCCESS);
  1059. }
  1060. RESULT SC132GS_IsiGetVSIntegrationTimeIss
  1061. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1062. {
  1063. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1064. RESULT result = RET_SUCCESS;
  1065. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1066. if (!pSC132GSCtx) {
  1067. TRACE(SC132GS_ERROR,
  1068. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1069. __func__);
  1070. return (RET_WRONG_HANDLE);
  1071. }
  1072. if (!pSetIntegrationTime)
  1073. return (RET_NULL_POINTER);
  1074. *pSetIntegrationTime = pSC132GSCtx->AecCurVSIntegrationTime;
  1075. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1076. return (result);
  1077. }
  1078. RESULT SC132GS_IsiGetIntegrationTimeIncrementIss
  1079. (IsiSensorHandle_t handle, float *pIncr)
  1080. {
  1081. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1082. RESULT result = RET_SUCCESS;
  1083. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1084. if (!pSC132GSCtx) {
  1085. TRACE(SC132GS_ERROR,
  1086. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1087. __func__);
  1088. return (RET_WRONG_HANDLE);
  1089. }
  1090. if (!pIncr)
  1091. return (RET_NULL_POINTER);
  1092. //_smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application)
  1093. *pIncr = pSC132GSCtx->AecIntegrationTimeIncrement;
  1094. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1095. return (result);
  1096. }
  1097. RESULT SC132GS_IsiSetIntegrationTimeIss
  1098. (IsiSensorHandle_t handle,
  1099. float NewIntegrationTime,
  1100. float *pSetIntegrationTime,
  1101. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1102. {
  1103. RESULT result = RET_SUCCESS;
  1104. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1105. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1106. // 曝光时间小于3ms
  1107. if (NewIntegrationTime > 3692.0f) {
  1108. NewIntegrationTime = 3692.0f;
  1109. }
  1110. //行长 = 寄存器{16‘h320c, 16′h320d}值*2
  1111. //2*{16’h320e,16’h320f}-6:h320e,h320f为帧长
  1112. uint32_t hval_time = (((uint32_t)NewIntegrationTime) & 0xf0000) >> 16;
  1113. uint32_t mval_time = (((uint32_t)NewIntegrationTime) & 0xff00) >> 8;
  1114. uint32_t lval_time = ((uint32_t)NewIntegrationTime) & 0xff;
  1115. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e00, hval_time);
  1116. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e01, mval_time);
  1117. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e02, lval_time);
  1118. pSC132GSCtx->AecCurIntegrationTime = NewIntegrationTime;
  1119. *pNumberOfFramesToSkip = 1U;
  1120. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1121. #if 0
  1122. uint32_t exp_line = 0;
  1123. uint32_t exp_line_old = 0;
  1124. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1125. if (!pSC132GSCtx) {
  1126. TRACE(SC132GS_ERROR,
  1127. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1128. __func__);
  1129. return (RET_WRONG_HANDLE);
  1130. }
  1131. if (!pSetIntegrationTime || !pNumberOfFramesToSkip) {
  1132. TRACE(SC132GS_ERROR,
  1133. "%s: Invalid parameter (NULL pointer detected)\n",
  1134. __func__);
  1135. return (RET_NULL_POINTER);
  1136. }
  1137. exp_line = NewIntegrationTime / pSC132GSCtx->one_line_exp_time;
  1138. exp_line_old = exp_line;
  1139. exp_line =
  1140. MIN(pSC132GSCtx->MaxIntegrationLine,
  1141. MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1142. TRACE(SC132GS_DEBUG, "%s: set AEC_PK_EXPO=0x%05x\n", __func__, exp_line);
  1143. if (exp_line != pSC132GSCtx->OldIntegrationTime) {
  1144. /*TODO*/
  1145. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_EXP, &exp_line);
  1146. pSC132GSCtx->OldIntegrationTime = exp_line; // remember current integration time
  1147. pSC132GSCtx->AecCurIntegrationTime =
  1148. exp_line * pSC132GSCtx->one_line_exp_time;
  1149. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1150. } else {
  1151. *pNumberOfFramesToSkip = 0U; //no frame skip
  1152. }
  1153. if (NewIntegrationTime > pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time)
  1154. NewIntegrationTime = pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time;
  1155. float exp_t = NewIntegrationTime * 16.0f / pSC132GSCtx->one_line_exp_time;
  1156. __sc132gs_set_exposure(handle, (int)exp_t,
  1157. 0, 0, SC132GS_INTEGRATION_TIME);
  1158. if (exp_line_old != exp_line) {
  1159. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1160. } else {
  1161. *pSetIntegrationTime = NewIntegrationTime;
  1162. }
  1163. #endif
  1164. TRACE(SC132GS_DEBUG, "%s: Ti=%f\n", __func__, *pSetIntegrationTime);
  1165. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1166. return (result);
  1167. }
  1168. RESULT SC132GS_IsiSetLongIntegrationTimeIss(IsiSensorHandle_t handle,float IntegrationTime)
  1169. {
  1170. int ret;
  1171. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1172. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1173. if (!handle || !pSC132GSCtx->IsiCtx.HalHandle)
  1174. {
  1175. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1176. return (RET_WRONG_HANDLE);
  1177. }
  1178. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1179. uint32_t exp_line = 0;
  1180. exp_line = IntegrationTime / pSC132GSCtx->one_line_exp_time;
  1181. exp_line = MIN(pSC132GSCtx->MaxIntegrationLine, MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1182. if (exp_line != pSC132GSCtx->LastLongExpLine)
  1183. {
  1184. if (pSC132GSCtx->KernelDriverFlag)
  1185. {
  1186. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_EXP, &exp_line);
  1187. if (ret != 0)
  1188. {
  1189. TRACE(SC132GS_ERROR,"%s: set long gain failed\n");
  1190. return RET_FAILURE;
  1191. }
  1192. }
  1193. pSC132GSCtx->LastLongExpLine = exp_line;
  1194. pSC132GSCtx->AecCurLongIntegrationTime = pSC132GSCtx->LastLongExpLine*pSC132GSCtx->one_line_exp_time;
  1195. }
  1196. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1197. return (RET_SUCCESS);
  1198. }
  1199. RESULT SC132GS_IsiSetVSIntegrationTimeIss
  1200. (IsiSensorHandle_t handle,
  1201. float NewIntegrationTime,
  1202. float *pSetVSIntegrationTime,
  1203. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1204. {
  1205. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1206. RESULT result = RET_SUCCESS;
  1207. uint32_t exp_line = 0;
  1208. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1209. if (!pSC132GSCtx) {
  1210. TRACE(SC132GS_ERROR,
  1211. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1212. __func__);
  1213. return (RET_WRONG_HANDLE);
  1214. }
  1215. if (!pSetVSIntegrationTime || !pNumberOfFramesToSkip) {
  1216. TRACE(SC132GS_ERROR,
  1217. "%s: Invalid parameter (NULL pointer detected)\n",
  1218. __func__);
  1219. return (RET_NULL_POINTER);
  1220. }
  1221. TRACE(SC132GS_INFO,
  1222. "%s: maxIntegrationTime-=%f minIntegrationTime = %f\n", __func__,
  1223. pSC132GSCtx->AecMaxIntegrationTime,
  1224. pSC132GSCtx->AecMinIntegrationTime);
  1225. exp_line = NewIntegrationTime / pSC132GSCtx->one_line_exp_time;
  1226. exp_line =
  1227. MIN(pSC132GSCtx->MaxIntegrationLine,
  1228. MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1229. if (exp_line != pSC132GSCtx->OldVsIntegrationTime) {
  1230. /*TODO*/
  1231. // ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSEXP, &exp_line);
  1232. } else if (1){
  1233. pSC132GSCtx->OldVsIntegrationTime = exp_line;
  1234. pSC132GSCtx->AecCurVSIntegrationTime = exp_line * pSC132GSCtx->one_line_exp_time; //remember current integration time
  1235. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1236. } else {
  1237. *pNumberOfFramesToSkip = 0U; //no frame skip
  1238. }
  1239. *pSetVSIntegrationTime = pSC132GSCtx->AecCurVSIntegrationTime;
  1240. TRACE(SC132GS_DEBUG, "%s: NewIntegrationTime=%f\n", __func__,
  1241. NewIntegrationTime);
  1242. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1243. return (result);
  1244. }
  1245. RESULT SC132GS_IsiExposureControlIss
  1246. (IsiSensorHandle_t handle,
  1247. float NewGain,
  1248. float NewIntegrationTime,
  1249. uint8_t * pNumberOfFramesToSkip,
  1250. float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio)
  1251. {
  1252. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1253. RESULT result = RET_SUCCESS;
  1254. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1255. if (pSC132GSCtx == NULL) {
  1256. TRACE(SC132GS_ERROR,
  1257. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1258. __func__);
  1259. return (RET_WRONG_HANDLE);
  1260. }
  1261. if ((pNumberOfFramesToSkip == NULL) || (pSetGain == NULL)
  1262. || (pSetIntegrationTime == NULL)) {
  1263. TRACE(SC132GS_ERROR,
  1264. "%s: Invalid parameter (NULL pointer detected)\n",
  1265. __func__);
  1266. return (RET_NULL_POINTER);
  1267. }
  1268. if (NewGain >= 28) {
  1269. NewGain = 28;
  1270. }
  1271. TRACE(SC132GS_DEBUG, "%s: g=%f, Ti=%f\n", __func__, NewGain,
  1272. NewIntegrationTime);
  1273. if (NewIntegrationTime > pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time)
  1274. NewIntegrationTime = pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time;
  1275. sc132gs_set_gain(handle, NewGain, pSetGain);
  1276. SC132GS_IsiSetIntegrationTimeIss(handle, NewIntegrationTime, pSetIntegrationTime, pNumberOfFramesToSkip, hdr_ratio);
  1277. pSC132GSCtx->AecCurGain = NewGain;
  1278. pSC132GSCtx->AecCurIntegrationTime = *pSetIntegrationTime;
  1279. TRACE(SC132GS_DEBUG, "%s: set: vsg=%f, vsTi=%f, vsskip=%d\n", __func__,
  1280. NewGain, NewIntegrationTime, *pNumberOfFramesToSkip);
  1281. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1282. return result;
  1283. }
  1284. RESULT SC132GS_IsiGetCurrentExposureIss
  1285. (IsiSensorHandle_t handle, float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio) {
  1286. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1287. RESULT result = RET_SUCCESS;
  1288. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1289. if (pSC132GSCtx == NULL) {
  1290. TRACE(SC132GS_ERROR,
  1291. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1292. __func__);
  1293. return (RET_WRONG_HANDLE);
  1294. }
  1295. if ((pSetGain == NULL) || (pSetIntegrationTime == NULL))
  1296. return (RET_NULL_POINTER);
  1297. *pSetGain = pSC132GSCtx->AecCurGain;
  1298. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1299. *hdr_ratio = pSC132GSCtx->CurHdrRatio;
  1300. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1301. return (result);
  1302. }
  1303. RESULT SC132GS_IsiGetResolutionIss(IsiSensorHandle_t handle, uint16_t *pwidth, uint16_t *pheight) {
  1304. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1305. RESULT result = RET_SUCCESS;
  1306. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1307. if (pSC132GSCtx == NULL) {
  1308. TRACE(SC132GS_ERROR,
  1309. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1310. __func__);
  1311. return (RET_WRONG_HANDLE);
  1312. }
  1313. *pwidth = pSC132GSCtx->SensorMode.width;
  1314. *pheight = pSC132GSCtx->SensorMode.height;
  1315. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1316. return (result);
  1317. }
  1318. RESULT SC132GS_IsiGetSensorFpsIss(IsiSensorHandle_t handle, uint32_t * pfps)
  1319. {
  1320. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1321. RESULT result = RET_SUCCESS;
  1322. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1323. if (pSC132GSCtx == NULL) {
  1324. TRACE(SC132GS_ERROR,
  1325. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1326. __func__);
  1327. return (RET_WRONG_HANDLE);
  1328. }
  1329. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1330. if (pSC132GSCtx->KernelDriverFlag) {
  1331. /*TODO*/
  1332. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_FPS, pfps);
  1333. pSC132GSCtx->CurrFps = *pfps;
  1334. }
  1335. *pfps = pSC132GSCtx->CurrFps;
  1336. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1337. return (result);
  1338. }
  1339. RESULT SC132GS_IsiSetSensorFpsIss(IsiSensorHandle_t handle, uint32_t fps)
  1340. {
  1341. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1342. RESULT result = RET_SUCCESS;
  1343. int32_t ret = 0;
  1344. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1345. if (pSC132GSCtx == NULL) {
  1346. TRACE(SC132GS_ERROR,
  1347. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1348. __func__);
  1349. return (RET_WRONG_HANDLE);
  1350. }
  1351. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1352. if (fps > pSC132GSCtx->MaxFps) {
  1353. TRACE(SC132GS_ERROR,
  1354. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1355. __func__, fps, pSC132GSCtx->MaxFps, pSC132GSCtx->MinFps,
  1356. pSC132GSCtx->MaxFps);
  1357. fps = pSC132GSCtx->MaxFps;
  1358. }
  1359. if (fps < pSC132GSCtx->MinFps) {
  1360. TRACE(SC132GS_ERROR,
  1361. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1362. __func__, fps, pSC132GSCtx->MinFps, pSC132GSCtx->MinFps,
  1363. pSC132GSCtx->MaxFps);
  1364. fps = pSC132GSCtx->MinFps;
  1365. }
  1366. if (pSC132GSCtx->KernelDriverFlag) {
  1367. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fps);
  1368. if (ret != 0) {
  1369. TRACE(SC132GS_ERROR, "%s: set sensor fps=%d error\n",
  1370. __func__);
  1371. return (RET_FAILURE);
  1372. }
  1373. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_SENSOR_MODE, &(pSC132GSCtx->SensorMode));
  1374. {
  1375. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->SensorMode.ae_info.max_integration_time;
  1376. pSC132GSCtx->AecMaxIntegrationTime = pSC132GSCtx->MaxIntegrationLine * pSC132GSCtx->one_line_exp_time;
  1377. }
  1378. #ifdef SUBDEV_CHAR
  1379. struct vvcam_ae_info_s ae_info;
  1380. ret =
  1381. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_AE_INFO, &ae_info);
  1382. if (ret != 0) {
  1383. TRACE(SC132GS_ERROR, "%s:sensor get ae info error!\n",
  1384. __func__);
  1385. return (RET_FAILURE);
  1386. }
  1387. pSC132GSCtx->one_line_exp_time =
  1388. (float)ae_info.one_line_exp_time_ns / 1000000000;
  1389. pSC132GSCtx->MaxIntegrationLine = ae_info.max_integration_time;
  1390. pSC132GSCtx->AecMaxIntegrationTime =
  1391. pSC132GSCtx->MaxIntegrationLine *
  1392. pSC132GSCtx->one_line_exp_time;
  1393. #endif
  1394. }
  1395. TRACE(SC132GS_INFO, "%s: set sensor fps = %d\n", __func__,
  1396. pSC132GSCtx->CurrFps);
  1397. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1398. return (result);
  1399. }
  1400. static RESULT SC132GS_IsiActivateTestPattern(IsiSensorHandle_t handle,
  1401. const bool_t enable)
  1402. {
  1403. RESULT result = RET_SUCCESS;
  1404. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1405. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1406. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1407. return RET_NULL_POINTER;
  1408. }
  1409. if (pSC132GSCtx->Configured != BOOL_TRUE)
  1410. return RET_WRONG_STATE;
  1411. if (BOOL_TRUE == enable) {
  1412. //result = SC132GS_IsiRegisterWriteIss(handle, 0x3253, 0x80);
  1413. } else {
  1414. //result = SC132GS_IsiRegisterWriteIss(handle, 0x3253, 0x00);
  1415. }
  1416. pSC132GSCtx->TestPattern = enable;
  1417. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1418. return (result);
  1419. }
  1420. static RESULT SC132GS_IsiSensorSetBlcIss(IsiSensorHandle_t handle, sensor_blc_t * pblc)
  1421. {
  1422. int32_t ret = 0;
  1423. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1424. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1425. return RET_WRONG_HANDLE;
  1426. }
  1427. if (pblc == NULL)
  1428. return RET_NULL_POINTER;
  1429. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1430. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_BLC, pblc);
  1431. if (ret != 0)
  1432. {
  1433. TRACE(SC132GS_ERROR, "%s: set wb error\n", __func__);
  1434. }
  1435. return RET_SUCCESS;
  1436. }
  1437. static RESULT SC132GS_IsiSensorSetWBIss(IsiSensorHandle_t handle, sensor_white_balance_t * pwb)
  1438. {
  1439. int32_t ret = 0;
  1440. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1441. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1442. return RET_WRONG_HANDLE;
  1443. }
  1444. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1445. if (pwb == NULL)
  1446. return RET_NULL_POINTER;
  1447. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_WB, pwb);
  1448. if (ret != 0)
  1449. {
  1450. TRACE(SC132GS_ERROR, "%s: set wb error\n", __func__);
  1451. }
  1452. return RET_SUCCESS;
  1453. }
  1454. static RESULT SC132GS_IsiGetSensorAWBModeIss(IsiSensorHandle_t handle, IsiSensorAwbMode_t *pawbmode)
  1455. {
  1456. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1457. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1458. return RET_NULL_POINTER;
  1459. }
  1460. if (pSC132GSCtx->SensorMode.hdr_mode == SENSOR_MODE_HDR_NATIVE){
  1461. *pawbmode = ISI_SENSOR_AWB_MODE_SENSOR;
  1462. }else{
  1463. *pawbmode = ISI_SENSOR_AWB_MODE_NORMAL;
  1464. }
  1465. return RET_SUCCESS;
  1466. }
  1467. static RESULT SC132GS_IsiSensorGetExpandCurveIss(IsiSensorHandle_t handle, sensor_expand_curve_t * pexpand_curve)
  1468. {
  1469. int32_t ret = 0;
  1470. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1471. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1472. return RET_NULL_POINTER;
  1473. }
  1474. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1475. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_EXPAND_CURVE, pexpand_curve);
  1476. if (ret != 0)
  1477. {
  1478. TRACE(SC132GS_ERROR, "%s: get expand cure error\n", __func__);
  1479. return RET_FAILURE;
  1480. }
  1481. return RET_SUCCESS;
  1482. }
  1483. static RESULT SC132GS_IsiGetCapsIss(IsiSensorHandle_t handle,
  1484. IsiSensorCaps_t * pIsiSensorCaps)
  1485. {
  1486. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1487. RESULT result = RET_SUCCESS;
  1488. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  1489. if (pSC132GSCtx == NULL) {
  1490. return (RET_WRONG_HANDLE);
  1491. }
  1492. if (pIsiSensorCaps == NULL) {
  1493. return (RET_NULL_POINTER);
  1494. }
  1495. pIsiSensorCaps->BusWidth = pSC132GSCtx->SensorMode.bit_width;
  1496. pIsiSensorCaps->Mode = ISI_MODE_BAYER;
  1497. pIsiSensorCaps->FieldSelection = ISI_FIELDSEL_BOTH;
  1498. pIsiSensorCaps->YCSequence = ISI_YCSEQ_YCBYCR;
  1499. pIsiSensorCaps->Conv422 = ISI_CONV422_NOCOSITED;
  1500. pIsiSensorCaps->BPat = pSC132GSCtx->SensorMode.bayer_pattern;
  1501. pIsiSensorCaps->HPol = ISI_HPOL_REFPOS;
  1502. pIsiSensorCaps->VPol = ISI_VPOL_NEG;
  1503. pIsiSensorCaps->Edge = ISI_EDGE_RISING;
  1504. pIsiSensorCaps->Resolution.width = pSC132GSCtx->SensorMode.width;
  1505. pIsiSensorCaps->Resolution.height = pSC132GSCtx->SensorMode.height;
  1506. pIsiSensorCaps->SmiaMode = ISI_SMIA_OFF;
  1507. pIsiSensorCaps->MipiLanes = ISI_MIPI_2LANES;
  1508. if (pIsiSensorCaps->BusWidth == 10) {
  1509. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_10;
  1510. }else if (pIsiSensorCaps->BusWidth == 12){
  1511. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_12;
  1512. }else{
  1513. pIsiSensorCaps->MipiMode = ISI_MIPI_OFF;
  1514. }
  1515. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  1516. return result;
  1517. }
  1518. static RESULT SC132GS_IsiGetSensorTemperature(IsiSensorHandle_t handle, int32_t *val)
  1519. {
  1520. RESULT result = RET_SUCCESS;
  1521. int ret = 0;
  1522. uint32_t i = 0, f = 0;
  1523. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  1524. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1525. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1526. return RET_NULL_POINTER;
  1527. }
  1528. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1529. /*
  1530. ret = SC132GS_IsiRegisterReadIss(handle, 0x4c11, &f); //float
  1531. if (ret != 0) {
  1532. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  1533. return (RET_FAILURE);
  1534. }
  1535. */
  1536. ret = SC132GS_IsiRegisterReadIss(handle, 0x4c10, &i); //integer
  1537. if (ret != 0) {
  1538. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  1539. return (RET_FAILURE);
  1540. }
  1541. *val = i * 2 - 273;
  1542. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  1543. return (result);
  1544. }
  1545. RESULT SC132GS_IsiGetSensorIss(IsiSensor_t *pIsiSensor)
  1546. {
  1547. RESULT result = RET_SUCCESS;
  1548. TRACE( SC132GS_INFO, "%s (enter)\n", __func__);
  1549. if ( pIsiSensor != NULL ) {
  1550. pIsiSensor->pszName = SensorName;
  1551. pIsiSensor->pIsiCreateSensorIss = SC132GS_IsiCreateSensorIss;
  1552. pIsiSensor->pIsiInitSensorIss = SC132GS_IsiInitSensorIss;
  1553. pIsiSensor->pIsiGetSensorModeIss = SC132GS_IsiGetSensorModeIss;
  1554. pIsiSensor->pIsiResetSensorIss = SC132GS_IsiResetSensorIss;
  1555. pIsiSensor->pIsiReleaseSensorIss = SC132GS_IsiReleaseSensorIss;
  1556. pIsiSensor->pIsiGetCapsIss = SC132GS_IsiGetCapsIss;
  1557. pIsiSensor->pIsiSetupSensorIss = SC132GS_IsiSetupSensorIss;
  1558. pIsiSensor->pIsiChangeSensorResolutionIss = SC132GS_IsiChangeSensorResolutionIss;
  1559. pIsiSensor->pIsiSensorSetStreamingIss = SC132GS_IsiSensorSetStreamingIss;
  1560. pIsiSensor->pIsiSensorSetPowerIss = SC132GS_IsiSensorSetPowerIss;
  1561. pIsiSensor->pIsiCheckSensorConnectionIss = SC132GS_IsiCheckSensorConnectionIss;
  1562. pIsiSensor->pIsiGetSensorRevisionIss = SC132GS_IsiGetSensorRevisionIss;
  1563. pIsiSensor->pIsiRegisterReadIss = SC132GS_IsiRegisterReadIss;
  1564. pIsiSensor->pIsiRegisterWriteIss = SC132GS_IsiRegisterWriteIss;
  1565. /* AEC functions */
  1566. pIsiSensor->pIsiExposureControlIss = SC132GS_IsiExposureControlIss;
  1567. pIsiSensor->pIsiGetGainLimitsIss = SC132GS_IsiGetGainLimitsIss;
  1568. pIsiSensor->pIsiGetIntegrationTimeLimitsIss = SC132GS_IsiGetIntegrationTimeLimitsIss;
  1569. pIsiSensor->pIsiGetCurrentExposureIss = SC132GS_IsiGetCurrentExposureIss;
  1570. pIsiSensor->pIsiGetVSGainIss = SC132GS_IsiGetVSGainIss;
  1571. pIsiSensor->pIsiGetGainIss = SC132GS_IsiGetGainIss;
  1572. pIsiSensor->pIsiGetLongGainIss = SC132GS_IsiGetLongGainIss;
  1573. pIsiSensor->pIsiGetGainIncrementIss = SC132GS_IsiGetGainIncrementIss;
  1574. pIsiSensor->pIsiSetGainIss = SC132GS_IsiSetGainIss;
  1575. pIsiSensor->pIsiGetIntegrationTimeIss = SC132GS_IsiGetIntegrationTimeIss;
  1576. pIsiSensor->pIsiGetVSIntegrationTimeIss = SC132GS_IsiGetVSIntegrationTimeIss;
  1577. pIsiSensor->pIsiGetLongIntegrationTimeIss = SC132GS_IsiGetLongIntegrationTimeIss;
  1578. pIsiSensor->pIsiGetIntegrationTimeIncrementIss = SC132GS_IsiGetIntegrationTimeIncrementIss;
  1579. pIsiSensor->pIsiSetIntegrationTimeIss = SC132GS_IsiSetIntegrationTimeIss;
  1580. pIsiSensor->pIsiQuerySensorIss = SC132GS_IsiQuerySensorIss;
  1581. pIsiSensor->pIsiGetResolutionIss = SC132GS_IsiGetResolutionIss;
  1582. pIsiSensor->pIsiGetSensorFpsIss = SC132GS_IsiGetSensorFpsIss;
  1583. pIsiSensor->pIsiSetSensorFpsIss = SC132GS_IsiSetSensorFpsIss;
  1584. pIsiSensor->pIsiSensorGetExpandCurveIss = SC132GS_IsiSensorGetExpandCurveIss;
  1585. /* AWB specific functions */
  1586. /* Testpattern */
  1587. pIsiSensor->pIsiActivateTestPattern = SC132GS_IsiActivateTestPattern;
  1588. pIsiSensor->pIsiSetBayerPattern = SC132GS_IsiSetBayerPattern;
  1589. pIsiSensor->pIsiSensorSetBlcIss = SC132GS_IsiSensorSetBlcIss;
  1590. pIsiSensor->pIsiSensorSetWBIss = SC132GS_IsiSensorSetWBIss;
  1591. pIsiSensor->pIsiGetSensorAWBModeIss = SC132GS_IsiGetSensorAWBModeIss;
  1592. pIsiSensor->pIsiGetSensorTemperature = SC132GS_IsiGetSensorTemperature;
  1593. } else {
  1594. result = RET_NULL_POINTER;
  1595. }
  1596. TRACE( SC132GS_INFO, "%s (exit)\n", __func__);
  1597. return ( result );
  1598. }
  1599. /*****************************************************************************
  1600. * each sensor driver need declare this struct for isi load
  1601. *****************************************************************************/
  1602. IsiCamDrvConfig_t SC132GS_IsiCamDrvConfig = {
  1603. 0,
  1604. SC132GS_IsiQuerySensorSupportIss,
  1605. SC132GS_IsiGetSensorIss,
  1606. {
  1607. SensorName, /**< IsiSensor_t.pszName */
  1608. 0, /**< IsiSensor_t.pIsiInitIss>*/
  1609. 0, /**< IsiSensor_t.pIsiResetSensorIss>*/
  1610. 0, /**< IsiSensor_t.pRegisterTable */
  1611. 0, /**< IsiSensor_t.pIsiSensorCaps */
  1612. 0, /**< IsiSensor_t.pIsiCreateSensorIss */
  1613. 0, /**< IsiSensor_t.pIsiReleaseSensorIss */
  1614. 0, /**< IsiSensor_t.pIsiGetCapsIss */
  1615. 0, /**< IsiSensor_t.pIsiSetupSensorIss */
  1616. 0, /**< IsiSensor_t.pIsiChangeSensorResolutionIss */
  1617. 0, /**< IsiSensor_t.pIsiSensorSetStreamingIss */
  1618. 0, /**< IsiSensor_t.pIsiSensorSetPowerIss */
  1619. 0, /**< IsiSensor_t.pIsiCheckSensorConnectionIss */
  1620. 0, /**< IsiSensor_t.pIsiGetSensorRevisionIss */
  1621. 0, /**< IsiSensor_t.pIsiRegisterReadIss */
  1622. 0, /**< IsiSensor_t.pIsiRegisterWriteIss */
  1623. 0, /**< IsiSensor_t.pIsiExposureControlIss */
  1624. 0, /**< IsiSensor_t.pIsiGetGainLimitsIss */
  1625. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeLimitsIss */
  1626. 0, /**< IsiSensor_t.pIsiGetCurrentExposureIss */
  1627. 0, /**< IsiSensor_t.pIsiGetGainIss */
  1628. 0, /**< IsiSensor_t.pIsiGetVSGainIss */
  1629. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1630. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1631. 0, /**< IsiSensor_t.pIsiSetGainIss */
  1632. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIss */
  1633. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIncrementIss */
  1634. 0, /**< IsiSensor_t.pIsiSetIntegrationTimeIss */
  1635. 0, /**< IsiSensor_t.pIsiGetResolutionIss */
  1636. 0, /**< IsiSensor_t.pIsiGetAfpsInfoIss */
  1637. 0, /**< IsiSensor_t.pIsiMdiInitMotoDriveMds */
  1638. 0, /**< IsiSensor_t.pIsiMdiSetupMotoDrive */
  1639. 0, /**< IsiSensor_t.pIsiMdiFocusSet */
  1640. 0, /**< IsiSensor_t.pIsiMdiFocusGet */
  1641. 0, /**< IsiSensor_t.pIsiMdiFocusCalibrate */
  1642. 0, /**< IsiSensor_t.pIsiGetSensorMipiInfoIss */
  1643. 0, /**< IsiSensor_t.pIsiActivateTestPattern */
  1644. 0, /**< IsiSensor_t.pIsiSetBayerPattern */
  1645. }
  1646. };