SC132GS.c 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013
  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 = 0.81257f; //us 1/16 * line_time
  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 = 0.81257f; //us 1/16 * line_time
  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 = 0.81257f; //us 1/16 * line_time
  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 = 0.81257f; //us 1/16 * line_time
  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 = 0.81257f; //us 1/16 * line_time
  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 = 0.81257f; //us 1/16 * line_time
  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. if (on == 0) {
  693. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x00);
  694. if (ret != 0) {
  695. return (RET_FAILURE);
  696. }
  697. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3817, 0x01);
  698. if (ret != 0) {
  699. return (RET_FAILURE);
  700. }
  701. ret = SC132GS_IsiRegisterWriteIss(handle, 0x100, on);
  702. if (ret != 0) {
  703. return (RET_FAILURE);
  704. }
  705. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x10);
  706. if (ret != 0) {
  707. return (RET_FAILURE);
  708. }
  709. ret = SC132GS_IsiRegisterWriteIss(handle, 0x3800, 0x40);
  710. if (ret != 0) {
  711. return (RET_FAILURE);
  712. }
  713. } else {
  714. ret = SC132GS_IsiRegisterWriteIss(handle, 0x100, on);
  715. if (ret != 0) {
  716. return (RET_FAILURE);
  717. }
  718. }
  719. pSC132GSCtx->Streaming = on;
  720. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  721. return (result);
  722. }
  723. static int32_t sensor_get_chip_id(IsiSensorHandle_t handle, uint32_t *chip_id)
  724. {
  725. RESULT result = RET_SUCCESS;
  726. int32_t ret = 0;
  727. int32_t chip_id_high = 0;
  728. int32_t chip_id_low = 0;
  729. ret = SC132GS_IsiRegisterReadIss(handle, 0x3107, &chip_id_high);
  730. if (ret != 0) {
  731. TRACE(SC132GS_ERROR,
  732. "%s: Read Sensor correct ID Error! \n", __func__);
  733. return (RET_FAILURE);
  734. }
  735. ret = SC132GS_IsiRegisterReadIss(handle, 0x3108, &chip_id_low);
  736. if (ret != 0) {
  737. TRACE(SC132GS_ERROR,
  738. "%s: Read Sensor correct ID Error! \n", __func__);
  739. return (RET_FAILURE);
  740. }
  741. *chip_id = ((chip_id_high & 0xff)<<8) | (chip_id_low & 0xff);
  742. return 0;
  743. }
  744. static RESULT SC132GS_IsiCheckSensorConnectionIss(IsiSensorHandle_t handle) {
  745. RESULT result = RET_SUCCESS;
  746. int ret = 0;
  747. uint32_t correct_id = 0x132;
  748. uint32_t sensor_id = 0;
  749. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  750. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  751. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  752. return RET_NULL_POINTER;
  753. }
  754. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  755. ret = sensor_get_chip_id(handle, &sensor_id);
  756. if (ret != 0) {
  757. TRACE(SC132GS_ERROR,
  758. "%s: Read Sensor chip ID Error! \n", __func__);
  759. return (RET_FAILURE);
  760. }
  761. if (correct_id != sensor_id) {
  762. TRACE(SC132GS_ERROR, "%s:ChipID =0x%x sensor_id=%x error! \n",
  763. __func__, correct_id, sensor_id);
  764. return (RET_FAILURE);
  765. }
  766. TRACE(SC132GS_INFO,
  767. "%s ChipID = 0x%08x, sensor_id = 0x%08x, success! \n", __func__,
  768. correct_id, sensor_id);
  769. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  770. return (result);
  771. }
  772. static RESULT SC132GS_IsiGetSensorRevisionIss
  773. (IsiSensorHandle_t handle, uint32_t * p_value) {
  774. RESULT result = RET_SUCCESS;
  775. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  776. *p_value = 0X132;
  777. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  778. return (result);
  779. }
  780. static RESULT SC132GS_IsiGetGainLimitsIss
  781. (IsiSensorHandle_t handle, float *pMinGain, float *pMaxGain) {
  782. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  783. RESULT result = RET_SUCCESS;
  784. /*TODO*/
  785. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  786. if (pSC132GSCtx == NULL) {
  787. TRACE(SC132GS_ERROR,
  788. "%s: Invalid sensor handle (NULL pointer detected)\n",
  789. __func__);
  790. return (RET_WRONG_HANDLE);
  791. }
  792. if ((pMinGain == NULL) || (pMaxGain == NULL)) {
  793. TRACE(SC132GS_ERROR, "%s: NULL pointer received!!\n");
  794. return (RET_NULL_POINTER);
  795. }
  796. *pMinGain = pSC132GSCtx->AecMinGain;
  797. *pMaxGain = pSC132GSCtx->AecMaxGain;
  798. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  799. return (result);
  800. }
  801. static RESULT SC132GS_IsiGetIntegrationTimeLimitsIss
  802. (IsiSensorHandle_t handle,
  803. float *pMinIntegrationTime, float *pMaxIntegrationTime) {
  804. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  805. RESULT result = RET_SUCCESS;
  806. /*TODO*/
  807. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  808. if (pSC132GSCtx == NULL) {
  809. TRACE(SC132GS_ERROR,
  810. "%s: Invalid sensor handle (NULL pointer detected)\n",
  811. __func__);
  812. return (RET_WRONG_HANDLE);
  813. }
  814. if ((pMinIntegrationTime == NULL) || (pMaxIntegrationTime == NULL)) {
  815. TRACE(SC132GS_ERROR, "%s: NULL pointer received!!\n");
  816. return (RET_NULL_POINTER);
  817. }
  818. *pMinIntegrationTime = pSC132GSCtx->AecMinIntegrationTime;
  819. *pMaxIntegrationTime = pSC132GSCtx->AecMaxIntegrationTime;
  820. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  821. return (result);
  822. }
  823. RESULT SC132GS_IsiGetGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  824. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  825. RESULT result = RET_SUCCESS;
  826. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  827. if (pSC132GSCtx == NULL) {
  828. TRACE(SC132GS_ERROR,
  829. "%s: Invalid sensor handle (NULL pointer detected)\n",
  830. __func__);
  831. return (RET_WRONG_HANDLE);
  832. }
  833. if (pSetGain == NULL) {
  834. return (RET_NULL_POINTER);
  835. }
  836. *pSetGain = pSC132GSCtx->AecCurGain;
  837. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  838. return (result);
  839. }
  840. RESULT SC132GS_IsiGetLongGainIss(IsiSensorHandle_t handle, float *gain)
  841. {
  842. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  843. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  844. if (pSC132GSCtx == NULL) {
  845. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  846. return (RET_WRONG_HANDLE);
  847. }
  848. if (gain == NULL) {
  849. return (RET_NULL_POINTER);
  850. }
  851. *gain = pSC132GSCtx->AecCurLongGain;
  852. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  853. return (RET_SUCCESS);
  854. }
  855. RESULT SC132GS_IsiGetVSGainIss(IsiSensorHandle_t handle, float *pSetGain) {
  856. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  857. RESULT result = RET_SUCCESS;
  858. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  859. if (pSC132GSCtx == NULL) {
  860. TRACE(SC132GS_ERROR,
  861. "%s: Invalid sensor handle (NULL pointer detected)\n",
  862. __func__);
  863. return (RET_WRONG_HANDLE);
  864. }
  865. if (pSetGain == NULL) {
  866. return (RET_NULL_POINTER);
  867. }
  868. *pSetGain = pSC132GSCtx->AecCurVSGain;
  869. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  870. return (result);
  871. }
  872. RESULT SC132GS_IsiGetGainIncrementIss(IsiSensorHandle_t handle, float *pIncr) {
  873. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  874. RESULT result = RET_SUCCESS;
  875. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  876. if (pSC132GSCtx == NULL) {
  877. TRACE(SC132GS_ERROR,
  878. "%s: Invalid sensor handle (NULL pointer detected)\n",
  879. __func__);
  880. return (RET_WRONG_HANDLE);
  881. }
  882. if (pIncr == NULL)
  883. return (RET_NULL_POINTER);
  884. *pIncr = pSC132GSCtx->AecGainIncrement;
  885. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  886. return (result);
  887. }
  888. RESULT SC132GS_IsiSetGainIss
  889. (IsiSensorHandle_t handle,
  890. float NewGain, float *pSetGain, float *hdr_ratio) {
  891. RESULT result = RET_SUCCESS;
  892. int32_t ret = 0;
  893. int TmpGain;
  894. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  895. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  896. return RET_NULL_POINTER;
  897. }
  898. if (NewGain >= 25) { // More than 25 will not take effect
  899. NewGain = 25;
  900. }
  901. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  902. sc132gs_set_gain(handle, NewGain, pSetGain);
  903. pSC132GSCtx->AecCurGain = *pSetGain;
  904. TRACE(SC132GS_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  905. return (result);
  906. }
  907. RESULT SC132GS_IsiSetLongGainIss(IsiSensorHandle_t handle, float gain)
  908. {
  909. int ret = 0;
  910. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  911. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  912. if (!pSC132GSCtx || !pSC132GSCtx->IsiCtx.HalHandle)
  913. {
  914. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  915. return (RET_WRONG_HANDLE);
  916. }
  917. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  918. uint32_t SensorGain = 0;
  919. SensorGain = gain * pSC132GSCtx->gain_accuracy;
  920. if (pSC132GSCtx->LastLongGain != SensorGain)
  921. {
  922. /*TODO*/
  923. #if 0
  924. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_GAIN, &SensorGain);
  925. if (ret != 0)
  926. {
  927. return (RET_FAILURE);
  928. TRACE(SC132GS_ERROR,"%s: set long gain failed\n");
  929. }
  930. #endif
  931. pSC132GSCtx->LastLongGain = SensorGain;
  932. pSC132GSCtx->AecCurLongGain = gain;
  933. }
  934. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  935. return (RET_SUCCESS);
  936. }
  937. RESULT SC132GS_IsiSetVSGainIss
  938. (IsiSensorHandle_t handle,
  939. float NewIntegrationTime,
  940. float NewGain, float *pSetGain, float *hdr_ratio) {
  941. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  942. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  943. RESULT result = RET_SUCCESS;
  944. #if 0
  945. float Gain = 0.0f;
  946. uint32_t ucGain = 0U;
  947. uint32_t again = 0U;
  948. #endif
  949. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  950. if (!pSC132GSCtx) {
  951. TRACE(SC132GS_ERROR,
  952. "%s: Invalid sensor handle (NULL pointer detected)\n",
  953. __func__);
  954. return (RET_WRONG_HANDLE);
  955. }
  956. if (!pSetGain || !hdr_ratio)
  957. return (RET_NULL_POINTER);
  958. uint32_t SensorGain = 0;
  959. SensorGain = NewGain * pSC132GSCtx->gain_accuracy;
  960. /*TODO*/
  961. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSGAIN, &SensorGain);
  962. pSC132GSCtx->AecCurVSGain = NewGain;
  963. *pSetGain = pSC132GSCtx->AecCurGain;
  964. TRACE(SC132GS_DEBUG, "%s: g=%f\n", __func__, *pSetGain);
  965. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  966. return (result);
  967. }
  968. RESULT SC132GS_IsiSetBayerPattern(IsiSensorHandle_t handle, uint8_t pattern)
  969. {
  970. RESULT result = RET_SUCCESS;
  971. #if 0
  972. uint8_t h_shift = 0, v_shift = 0;
  973. uint32_t val_h = 0, val_l = 0;
  974. uint16_t val = 0;
  975. uint8_t Start_p = 0;
  976. bool_t streaming_status;
  977. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  978. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  979. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  980. return RET_NULL_POINTER;
  981. }
  982. // pattern 0:B 1:GB 2:GR 3:R
  983. streaming_status = pSC132GSCtx->Streaming;
  984. result = SC132GS_IsiSensorSetStreamingIss(handle, 0);
  985. switch (pattern) {
  986. case BAYER_BGGR:
  987. Start_p = 0;
  988. break;
  989. case BAYER_GBRG:
  990. Start_p = 1;
  991. break;
  992. case BAYER_GRBG:
  993. Start_p = 2;
  994. break;
  995. case BAYER_RGGB:
  996. Start_p = 3;
  997. break;
  998. }
  999. h_shift = Start_p % 2;
  1000. v_shift = Start_p / 2;
  1001. SC132GS_IsiRegisterReadIss(handle, 0x30a0, &val_h);
  1002. SC132GS_IsiRegisterReadIss(handle, 0x30a1, &val_l);
  1003. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  1004. val_h = (val >> 8) & 0xff;
  1005. val_l = val & 0xff;
  1006. SC132GS_IsiRegisterWriteIss(handle, 0x30a0, (uint8_t)val_h);
  1007. SC132GS_IsiRegisterWriteIss(handle, 0x30a1, (uint8_t)val_l);
  1008. SC132GS_IsiRegisterReadIss(handle, 0x30a2, &val_h);
  1009. SC132GS_IsiRegisterReadIss(handle, 0x30a3, &val_l);
  1010. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  1011. val_h = (val >> 8) & 0xff;
  1012. val_l = val & 0xff;
  1013. SC132GS_IsiRegisterWriteIss(handle, 0x30a2, (uint8_t)val_h);
  1014. SC132GS_IsiRegisterWriteIss(handle, 0x30a3, (uint8_t)val_l);
  1015. SC132GS_IsiRegisterReadIss(handle, 0x30a4, &val_h);
  1016. SC132GS_IsiRegisterReadIss(handle, 0x30a5, &val_l);
  1017. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + h_shift;
  1018. val_h = (val >> 8) & 0xff;
  1019. val_l = val & 0xff;
  1020. SC132GS_IsiRegisterWriteIss(handle, 0x30a4, (uint8_t)val_h);
  1021. SC132GS_IsiRegisterWriteIss(handle, 0x30a5, (uint8_t)val_l);
  1022. SC132GS_IsiRegisterReadIss(handle, 0x30a6, &val_h);
  1023. SC132GS_IsiRegisterReadIss(handle, 0x30a7, &val_l);
  1024. val = (((val_h << 8) & 0xff00) | (val_l & 0x00ff)) + v_shift;
  1025. val_h = (val >> 8) & 0xff;
  1026. val_l = val & 0xff;
  1027. SC132GS_IsiRegisterWriteIss(handle, 0x30a6, (uint8_t)val_h);
  1028. SC132GS_IsiRegisterWriteIss(handle, 0x30a7, (uint8_t)val_l);
  1029. pSC132GSCtx->pattern = pattern;
  1030. result = SC132GS_IsiSensorSetStreamingIss(handle, streaming_status);
  1031. #endif
  1032. return (result);
  1033. }
  1034. RESULT SC132GS_IsiGetIntegrationTimeIss
  1035. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1036. {
  1037. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1038. RESULT result = RET_SUCCESS;
  1039. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1040. if (!pSC132GSCtx) {
  1041. TRACE(SC132GS_ERROR,
  1042. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1043. __func__);
  1044. return (RET_WRONG_HANDLE);
  1045. }
  1046. if (!pSetIntegrationTime)
  1047. return (RET_NULL_POINTER);
  1048. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1049. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1050. return (result);
  1051. }
  1052. RESULT SC132GS_IsiGetLongIntegrationTimeIss(IsiSensorHandle_t handle, float *pIntegrationTime)
  1053. {
  1054. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1055. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1056. if (!pSC132GSCtx) {
  1057. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1058. return (RET_WRONG_HANDLE);
  1059. }
  1060. if (!pIntegrationTime)
  1061. return (RET_NULL_POINTER);
  1062. pSC132GSCtx->AecCurLongIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1063. *pIntegrationTime = pSC132GSCtx->AecCurLongIntegrationTime;
  1064. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1065. return (RET_SUCCESS);
  1066. }
  1067. RESULT SC132GS_IsiGetVSIntegrationTimeIss
  1068. (IsiSensorHandle_t handle, float *pSetIntegrationTime)
  1069. {
  1070. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1071. RESULT result = RET_SUCCESS;
  1072. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1073. if (!pSC132GSCtx) {
  1074. TRACE(SC132GS_ERROR,
  1075. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1076. __func__);
  1077. return (RET_WRONG_HANDLE);
  1078. }
  1079. if (!pSetIntegrationTime)
  1080. return (RET_NULL_POINTER);
  1081. *pSetIntegrationTime = pSC132GSCtx->AecCurVSIntegrationTime;
  1082. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1083. return (result);
  1084. }
  1085. RESULT SC132GS_IsiGetIntegrationTimeIncrementIss
  1086. (IsiSensorHandle_t handle, float *pIncr)
  1087. {
  1088. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1089. RESULT result = RET_SUCCESS;
  1090. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1091. if (!pSC132GSCtx) {
  1092. TRACE(SC132GS_ERROR,
  1093. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1094. __func__);
  1095. return (RET_WRONG_HANDLE);
  1096. }
  1097. if (!pIncr)
  1098. return (RET_NULL_POINTER);
  1099. //_smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application)
  1100. *pIncr = pSC132GSCtx->AecIntegrationTimeIncrement;
  1101. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1102. return (result);
  1103. }
  1104. RESULT SC132GS_IsiSetIntegrationTimeIss
  1105. (IsiSensorHandle_t handle,
  1106. float NewIntegrationTime,
  1107. float *pSetIntegrationTime,
  1108. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1109. {
  1110. RESULT result = RET_SUCCESS;
  1111. uint32_t exp_lines = 0;
  1112. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1113. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1114. NewIntegrationTime *= 1000000; //us
  1115. // 曝光时间小于3ms, 对应到寄存器值3692
  1116. //if (NewIntegrationTime > 3000) {
  1117. // NewIntegrationTime = 3000;
  1118. //}
  1119. // time to lines
  1120. exp_lines = NewIntegrationTime / pSC132GSCtx->one_line_exp_time;
  1121. if (exp_lines > pSC132GSCtx->FrameLengthLines) {
  1122. exp_lines = pSC132GSCtx->FrameLengthLines;
  1123. }
  1124. //行长 = 寄存器{16‘h320c, 16′h320d}值*2
  1125. //2*{16’h320e,16’h320f}-6:h320e,h320f为帧长
  1126. uint32_t hval_time = (exp_lines & 0xf0000) >> 16;
  1127. uint32_t mval_time = (exp_lines & 0xff00) >> 8;
  1128. uint32_t lval_time = exp_lines & 0xff;
  1129. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e00, hval_time);
  1130. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e01, mval_time);
  1131. result = SC132GS_IsiRegisterWriteIss(handle, 0x3e02, lval_time);
  1132. pSC132GSCtx->AecCurIntegrationTime = exp_lines * pSC132GSCtx->one_line_exp_time;
  1133. *pNumberOfFramesToSkip = 1U;
  1134. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1135. #if 0
  1136. uint32_t exp_line = 0;
  1137. uint32_t exp_line_old = 0;
  1138. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1139. if (!pSC132GSCtx) {
  1140. TRACE(SC132GS_ERROR,
  1141. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1142. __func__);
  1143. return (RET_WRONG_HANDLE);
  1144. }
  1145. if (!pSetIntegrationTime || !pNumberOfFramesToSkip) {
  1146. TRACE(SC132GS_ERROR,
  1147. "%s: Invalid parameter (NULL pointer detected)\n",
  1148. __func__);
  1149. return (RET_NULL_POINTER);
  1150. }
  1151. exp_line = NewIntegrationTime / pSC132GSCtx->one_line_exp_time;
  1152. exp_line_old = exp_line;
  1153. exp_line =
  1154. MIN(pSC132GSCtx->MaxIntegrationLine,
  1155. MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1156. TRACE(SC132GS_DEBUG, "%s: set AEC_PK_EXPO=0x%05x\n", __func__, exp_line);
  1157. if (exp_line != pSC132GSCtx->OldIntegrationTime) {
  1158. /*TODO*/
  1159. //ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_EXP, &exp_line);
  1160. pSC132GSCtx->OldIntegrationTime = exp_line; // remember current integration time
  1161. pSC132GSCtx->AecCurIntegrationTime =
  1162. exp_line * pSC132GSCtx->one_line_exp_time;
  1163. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1164. } else {
  1165. *pNumberOfFramesToSkip = 0U; //no frame skip
  1166. }
  1167. if (NewIntegrationTime > pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time)
  1168. NewIntegrationTime = pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time;
  1169. float exp_t = NewIntegrationTime * 16.0f / pSC132GSCtx->one_line_exp_time;
  1170. __sc132gs_set_exposure(handle, (int)exp_t,
  1171. 0, 0, SC132GS_INTEGRATION_TIME);
  1172. if (exp_line_old != exp_line) {
  1173. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1174. } else {
  1175. *pSetIntegrationTime = NewIntegrationTime;
  1176. }
  1177. #endif
  1178. TRACE(SC132GS_DEBUG, "%s: Ti=%f\n", __func__, *pSetIntegrationTime);
  1179. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1180. return (result);
  1181. }
  1182. RESULT SC132GS_IsiSetLongIntegrationTimeIss(IsiSensorHandle_t handle,float IntegrationTime)
  1183. {
  1184. int ret;
  1185. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1186. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1187. if (!handle || !pSC132GSCtx->IsiCtx.HalHandle)
  1188. {
  1189. TRACE(SC132GS_ERROR,"%s: Invalid sensor handle (NULL pointer detected)\n",__func__);
  1190. return (RET_WRONG_HANDLE);
  1191. }
  1192. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1193. uint32_t exp_line = 0;
  1194. exp_line = IntegrationTime / pSC132GSCtx->one_line_exp_time;
  1195. exp_line = MIN(pSC132GSCtx->MaxIntegrationLine, MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1196. if (exp_line != pSC132GSCtx->LastLongExpLine)
  1197. {
  1198. if (pSC132GSCtx->KernelDriverFlag)
  1199. {
  1200. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_LONG_EXP, &exp_line);
  1201. if (ret != 0)
  1202. {
  1203. TRACE(SC132GS_ERROR,"%s: set long gain failed\n");
  1204. return RET_FAILURE;
  1205. }
  1206. }
  1207. pSC132GSCtx->LastLongExpLine = exp_line;
  1208. pSC132GSCtx->AecCurLongIntegrationTime = pSC132GSCtx->LastLongExpLine*pSC132GSCtx->one_line_exp_time;
  1209. }
  1210. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1211. return (RET_SUCCESS);
  1212. }
  1213. RESULT SC132GS_IsiSetVSIntegrationTimeIss
  1214. (IsiSensorHandle_t handle,
  1215. float NewIntegrationTime,
  1216. float *pSetVSIntegrationTime,
  1217. uint8_t * pNumberOfFramesToSkip, float *hdr_ratio)
  1218. {
  1219. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1220. RESULT result = RET_SUCCESS;
  1221. uint32_t exp_line = 0;
  1222. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1223. if (!pSC132GSCtx) {
  1224. TRACE(SC132GS_ERROR,
  1225. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1226. __func__);
  1227. return (RET_WRONG_HANDLE);
  1228. }
  1229. if (!pSetVSIntegrationTime || !pNumberOfFramesToSkip) {
  1230. TRACE(SC132GS_ERROR,
  1231. "%s: Invalid parameter (NULL pointer detected)\n",
  1232. __func__);
  1233. return (RET_NULL_POINTER);
  1234. }
  1235. TRACE(SC132GS_INFO,
  1236. "%s: maxIntegrationTime-=%f minIntegrationTime = %f\n", __func__,
  1237. pSC132GSCtx->AecMaxIntegrationTime,
  1238. pSC132GSCtx->AecMinIntegrationTime);
  1239. exp_line = NewIntegrationTime / pSC132GSCtx->one_line_exp_time;
  1240. exp_line =
  1241. MIN(pSC132GSCtx->MaxIntegrationLine,
  1242. MAX(pSC132GSCtx->MinIntegrationLine, exp_line));
  1243. if (exp_line != pSC132GSCtx->OldVsIntegrationTime) {
  1244. /*TODO*/
  1245. // ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_VSEXP, &exp_line);
  1246. } else if (1){
  1247. pSC132GSCtx->OldVsIntegrationTime = exp_line;
  1248. pSC132GSCtx->AecCurVSIntegrationTime = exp_line * pSC132GSCtx->one_line_exp_time; //remember current integration time
  1249. *pNumberOfFramesToSkip = 1U; //skip 1 frame
  1250. } else {
  1251. *pNumberOfFramesToSkip = 0U; //no frame skip
  1252. }
  1253. *pSetVSIntegrationTime = pSC132GSCtx->AecCurVSIntegrationTime;
  1254. TRACE(SC132GS_DEBUG, "%s: NewIntegrationTime=%f\n", __func__,
  1255. NewIntegrationTime);
  1256. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1257. return (result);
  1258. }
  1259. RESULT SC132GS_IsiExposureControlIss
  1260. (IsiSensorHandle_t handle,
  1261. float NewGain,
  1262. float NewIntegrationTime,
  1263. uint8_t * pNumberOfFramesToSkip,
  1264. float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio)
  1265. {
  1266. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1267. RESULT result = RET_SUCCESS;
  1268. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1269. if (pSC132GSCtx == NULL) {
  1270. TRACE(SC132GS_ERROR,
  1271. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1272. __func__);
  1273. return (RET_WRONG_HANDLE);
  1274. }
  1275. if ((pNumberOfFramesToSkip == NULL) || (pSetGain == NULL)
  1276. || (pSetIntegrationTime == NULL)) {
  1277. TRACE(SC132GS_ERROR,
  1278. "%s: Invalid parameter (NULL pointer detected)\n",
  1279. __func__);
  1280. return (RET_NULL_POINTER);
  1281. }
  1282. if (NewGain >= 28) {
  1283. NewGain = 28;
  1284. }
  1285. TRACE(SC132GS_DEBUG, "%s: g=%f, Ti=%f\n", __func__, NewGain,
  1286. NewIntegrationTime);
  1287. if (NewIntegrationTime > pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time)
  1288. NewIntegrationTime = pSC132GSCtx->FrameLengthLines * pSC132GSCtx->one_line_exp_time;
  1289. sc132gs_set_gain(handle, NewGain, pSetGain);
  1290. SC132GS_IsiSetIntegrationTimeIss(handle, NewIntegrationTime, pSetIntegrationTime, pNumberOfFramesToSkip, hdr_ratio);
  1291. pSC132GSCtx->AecCurGain = NewGain;
  1292. pSC132GSCtx->AecCurIntegrationTime = *pSetIntegrationTime;
  1293. TRACE(SC132GS_DEBUG, "%s: set: vsg=%f, vsTi=%f, vsskip=%d\n", __func__,
  1294. NewGain, NewIntegrationTime, *pNumberOfFramesToSkip);
  1295. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1296. return result;
  1297. }
  1298. RESULT SC132GS_IsiGetCurrentExposureIss
  1299. (IsiSensorHandle_t handle, float *pSetGain, float *pSetIntegrationTime, float *hdr_ratio) {
  1300. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1301. RESULT result = RET_SUCCESS;
  1302. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1303. if (pSC132GSCtx == NULL) {
  1304. TRACE(SC132GS_ERROR,
  1305. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1306. __func__);
  1307. return (RET_WRONG_HANDLE);
  1308. }
  1309. if ((pSetGain == NULL) || (pSetIntegrationTime == NULL))
  1310. return (RET_NULL_POINTER);
  1311. *pSetGain = pSC132GSCtx->AecCurGain;
  1312. *pSetIntegrationTime = pSC132GSCtx->AecCurIntegrationTime;
  1313. *hdr_ratio = pSC132GSCtx->CurHdrRatio;
  1314. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1315. return (result);
  1316. }
  1317. RESULT SC132GS_IsiGetResolutionIss(IsiSensorHandle_t handle, uint16_t *pwidth, uint16_t *pheight) {
  1318. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1319. RESULT result = RET_SUCCESS;
  1320. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1321. if (pSC132GSCtx == NULL) {
  1322. TRACE(SC132GS_ERROR,
  1323. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1324. __func__);
  1325. return (RET_WRONG_HANDLE);
  1326. }
  1327. *pwidth = pSC132GSCtx->SensorMode.width;
  1328. *pheight = pSC132GSCtx->SensorMode.height;
  1329. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1330. return (result);
  1331. }
  1332. RESULT SC132GS_IsiGetSensorFpsIss(IsiSensorHandle_t handle, uint32_t * pfps)
  1333. {
  1334. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1335. RESULT result = RET_SUCCESS;
  1336. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1337. if (pSC132GSCtx == NULL) {
  1338. TRACE(SC132GS_ERROR,
  1339. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1340. __func__);
  1341. return (RET_WRONG_HANDLE);
  1342. }
  1343. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1344. if (pSC132GSCtx->KernelDriverFlag) {
  1345. /*TODO*/
  1346. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_FPS, pfps);
  1347. pSC132GSCtx->CurrFps = *pfps;
  1348. }
  1349. *pfps = pSC132GSCtx->CurrFps;
  1350. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1351. return (result);
  1352. }
  1353. RESULT SC132GS_IsiSetSensorFpsIss(IsiSensorHandle_t handle, uint32_t fps)
  1354. {
  1355. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1356. RESULT result = RET_SUCCESS;
  1357. int32_t ret = 0;
  1358. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1359. if (pSC132GSCtx == NULL) {
  1360. TRACE(SC132GS_ERROR,
  1361. "%s: Invalid sensor handle (NULL pointer detected)\n",
  1362. __func__);
  1363. return (RET_WRONG_HANDLE);
  1364. }
  1365. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1366. if (fps > pSC132GSCtx->MaxFps) {
  1367. TRACE(SC132GS_ERROR,
  1368. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1369. __func__, fps, pSC132GSCtx->MaxFps, pSC132GSCtx->MinFps,
  1370. pSC132GSCtx->MaxFps);
  1371. fps = pSC132GSCtx->MaxFps;
  1372. }
  1373. if (fps < pSC132GSCtx->MinFps) {
  1374. TRACE(SC132GS_ERROR,
  1375. "%s: set fps(%d) out of range, correct to %d (%d, %d)\n",
  1376. __func__, fps, pSC132GSCtx->MinFps, pSC132GSCtx->MinFps,
  1377. pSC132GSCtx->MaxFps);
  1378. fps = pSC132GSCtx->MinFps;
  1379. }
  1380. if (pSC132GSCtx->KernelDriverFlag) {
  1381. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_FPS, &fps);
  1382. if (ret != 0) {
  1383. TRACE(SC132GS_ERROR, "%s: set sensor fps=%d error\n",
  1384. __func__);
  1385. return (RET_FAILURE);
  1386. }
  1387. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_SENSOR_MODE, &(pSC132GSCtx->SensorMode));
  1388. {
  1389. pSC132GSCtx->MaxIntegrationLine = pSC132GSCtx->SensorMode.ae_info.max_integration_time;
  1390. pSC132GSCtx->AecMaxIntegrationTime = pSC132GSCtx->MaxIntegrationLine * pSC132GSCtx->one_line_exp_time;
  1391. }
  1392. #ifdef SUBDEV_CHAR
  1393. struct vvcam_ae_info_s ae_info;
  1394. ret =
  1395. ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_AE_INFO, &ae_info);
  1396. if (ret != 0) {
  1397. TRACE(SC132GS_ERROR, "%s:sensor get ae info error!\n",
  1398. __func__);
  1399. return (RET_FAILURE);
  1400. }
  1401. pSC132GSCtx->one_line_exp_time =
  1402. (float)ae_info.one_line_exp_time_ns / 1000000000;
  1403. pSC132GSCtx->MaxIntegrationLine = ae_info.max_integration_time;
  1404. pSC132GSCtx->AecMaxIntegrationTime =
  1405. pSC132GSCtx->MaxIntegrationLine *
  1406. pSC132GSCtx->one_line_exp_time;
  1407. #endif
  1408. }
  1409. TRACE(SC132GS_INFO, "%s: set sensor fps = %d\n", __func__,
  1410. pSC132GSCtx->CurrFps);
  1411. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1412. return (result);
  1413. }
  1414. static RESULT SC132GS_IsiActivateTestPattern(IsiSensorHandle_t handle,
  1415. const bool_t enable)
  1416. {
  1417. RESULT result = RET_SUCCESS;
  1418. TRACE(SC132GS_INFO, "%s: (enter)\n", __func__);
  1419. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1420. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1421. return RET_NULL_POINTER;
  1422. }
  1423. if (pSC132GSCtx->Configured != BOOL_TRUE)
  1424. return RET_WRONG_STATE;
  1425. if (BOOL_TRUE == enable) {
  1426. //result = SC132GS_IsiRegisterWriteIss(handle, 0x3253, 0x80);
  1427. } else {
  1428. //result = SC132GS_IsiRegisterWriteIss(handle, 0x3253, 0x00);
  1429. }
  1430. pSC132GSCtx->TestPattern = enable;
  1431. TRACE(SC132GS_INFO, "%s: (exit)\n", __func__);
  1432. return (result);
  1433. }
  1434. static RESULT SC132GS_IsiSensorSetBlcIss(IsiSensorHandle_t handle, sensor_blc_t * pblc)
  1435. {
  1436. int32_t ret = 0;
  1437. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1438. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1439. return RET_WRONG_HANDLE;
  1440. }
  1441. if (pblc == NULL)
  1442. return RET_NULL_POINTER;
  1443. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1444. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_BLC, pblc);
  1445. if (ret != 0)
  1446. {
  1447. TRACE(SC132GS_ERROR, "%s: set wb error\n", __func__);
  1448. }
  1449. return RET_SUCCESS;
  1450. }
  1451. static RESULT SC132GS_IsiSensorSetWBIss(IsiSensorHandle_t handle, sensor_white_balance_t * pwb)
  1452. {
  1453. int32_t ret = 0;
  1454. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1455. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1456. return RET_WRONG_HANDLE;
  1457. }
  1458. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1459. if (pwb == NULL)
  1460. return RET_NULL_POINTER;
  1461. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_S_WB, pwb);
  1462. if (ret != 0)
  1463. {
  1464. TRACE(SC132GS_ERROR, "%s: set wb error\n", __func__);
  1465. }
  1466. return RET_SUCCESS;
  1467. }
  1468. static RESULT SC132GS_IsiGetSensorAWBModeIss(IsiSensorHandle_t handle, IsiSensorAwbMode_t *pawbmode)
  1469. {
  1470. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1471. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1472. return RET_NULL_POINTER;
  1473. }
  1474. if (pSC132GSCtx->SensorMode.hdr_mode == SENSOR_MODE_HDR_NATIVE){
  1475. *pawbmode = ISI_SENSOR_AWB_MODE_SENSOR;
  1476. }else{
  1477. *pawbmode = ISI_SENSOR_AWB_MODE_NORMAL;
  1478. }
  1479. return RET_SUCCESS;
  1480. }
  1481. static RESULT SC132GS_IsiSensorGetExpandCurveIss(IsiSensorHandle_t handle, sensor_expand_curve_t * pexpand_curve)
  1482. {
  1483. int32_t ret = 0;
  1484. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1485. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1486. return RET_NULL_POINTER;
  1487. }
  1488. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1489. ret = ioctl(pHalCtx->sensor_fd, VVSENSORIOC_G_EXPAND_CURVE, pexpand_curve);
  1490. if (ret != 0)
  1491. {
  1492. TRACE(SC132GS_ERROR, "%s: get expand cure error\n", __func__);
  1493. return RET_FAILURE;
  1494. }
  1495. return RET_SUCCESS;
  1496. }
  1497. static RESULT SC132GS_IsiGetCapsIss(IsiSensorHandle_t handle,
  1498. IsiSensorCaps_t * pIsiSensorCaps)
  1499. {
  1500. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1501. RESULT result = RET_SUCCESS;
  1502. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  1503. if (pSC132GSCtx == NULL) {
  1504. return (RET_WRONG_HANDLE);
  1505. }
  1506. if (pIsiSensorCaps == NULL) {
  1507. return (RET_NULL_POINTER);
  1508. }
  1509. pIsiSensorCaps->BusWidth = pSC132GSCtx->SensorMode.bit_width;
  1510. pIsiSensorCaps->Mode = ISI_MODE_BAYER;
  1511. pIsiSensorCaps->FieldSelection = ISI_FIELDSEL_BOTH;
  1512. pIsiSensorCaps->YCSequence = ISI_YCSEQ_YCBYCR;
  1513. pIsiSensorCaps->Conv422 = ISI_CONV422_NOCOSITED;
  1514. pIsiSensorCaps->BPat = pSC132GSCtx->SensorMode.bayer_pattern;
  1515. pIsiSensorCaps->HPol = ISI_HPOL_REFPOS;
  1516. pIsiSensorCaps->VPol = ISI_VPOL_NEG;
  1517. pIsiSensorCaps->Edge = ISI_EDGE_RISING;
  1518. pIsiSensorCaps->Resolution.width = pSC132GSCtx->SensorMode.width;
  1519. pIsiSensorCaps->Resolution.height = pSC132GSCtx->SensorMode.height;
  1520. pIsiSensorCaps->SmiaMode = ISI_SMIA_OFF;
  1521. pIsiSensorCaps->MipiLanes = ISI_MIPI_2LANES;
  1522. if (pIsiSensorCaps->BusWidth == 10) {
  1523. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_10;
  1524. }else if (pIsiSensorCaps->BusWidth == 12){
  1525. pIsiSensorCaps->MipiMode = ISI_MIPI_MODE_RAW_12;
  1526. }else{
  1527. pIsiSensorCaps->MipiMode = ISI_MIPI_OFF;
  1528. }
  1529. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  1530. return result;
  1531. }
  1532. static RESULT SC132GS_IsiGetSensorTemperature(IsiSensorHandle_t handle, int32_t *val)
  1533. {
  1534. RESULT result = RET_SUCCESS;
  1535. int ret = 0;
  1536. uint32_t i = 0, f = 0;
  1537. TRACE(SC132GS_INFO, "%s (enter)\n", __func__);
  1538. SC132GS_Context_t *pSC132GSCtx = (SC132GS_Context_t *) handle;
  1539. if (pSC132GSCtx == NULL || pSC132GSCtx->IsiCtx.HalHandle == NULL) {
  1540. return RET_NULL_POINTER;
  1541. }
  1542. HalContext_t *pHalCtx = (HalContext_t *) pSC132GSCtx->IsiCtx.HalHandle;
  1543. /*
  1544. ret = SC132GS_IsiRegisterReadIss(handle, 0x4c11, &f); //float
  1545. if (ret != 0) {
  1546. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  1547. return (RET_FAILURE);
  1548. }
  1549. */
  1550. ret = SC132GS_IsiRegisterReadIss(handle, 0x4c10, &i); //integer
  1551. if (ret != 0) {
  1552. TRACE(SC132GS_ERROR, "%s: sensor reset error!\n", __func__);
  1553. return (RET_FAILURE);
  1554. }
  1555. *val = i * 2 - 273;
  1556. TRACE(SC132GS_INFO, "%s (exit)\n", __func__);
  1557. return (result);
  1558. }
  1559. RESULT SC132GS_IsiGetSensorIss(IsiSensor_t *pIsiSensor)
  1560. {
  1561. RESULT result = RET_SUCCESS;
  1562. TRACE( SC132GS_INFO, "%s (enter)\n", __func__);
  1563. if ( pIsiSensor != NULL ) {
  1564. pIsiSensor->pszName = SensorName;
  1565. pIsiSensor->pIsiCreateSensorIss = SC132GS_IsiCreateSensorIss;
  1566. pIsiSensor->pIsiInitSensorIss = SC132GS_IsiInitSensorIss;
  1567. pIsiSensor->pIsiGetSensorModeIss = SC132GS_IsiGetSensorModeIss;
  1568. pIsiSensor->pIsiResetSensorIss = SC132GS_IsiResetSensorIss;
  1569. pIsiSensor->pIsiReleaseSensorIss = SC132GS_IsiReleaseSensorIss;
  1570. pIsiSensor->pIsiGetCapsIss = SC132GS_IsiGetCapsIss;
  1571. pIsiSensor->pIsiSetupSensorIss = SC132GS_IsiSetupSensorIss;
  1572. pIsiSensor->pIsiChangeSensorResolutionIss = SC132GS_IsiChangeSensorResolutionIss;
  1573. pIsiSensor->pIsiSensorSetStreamingIss = SC132GS_IsiSensorSetStreamingIss;
  1574. pIsiSensor->pIsiSensorSetPowerIss = SC132GS_IsiSensorSetPowerIss;
  1575. pIsiSensor->pIsiCheckSensorConnectionIss = SC132GS_IsiCheckSensorConnectionIss;
  1576. pIsiSensor->pIsiGetSensorRevisionIss = SC132GS_IsiGetSensorRevisionIss;
  1577. pIsiSensor->pIsiRegisterReadIss = SC132GS_IsiRegisterReadIss;
  1578. pIsiSensor->pIsiRegisterWriteIss = SC132GS_IsiRegisterWriteIss;
  1579. /* AEC functions */
  1580. pIsiSensor->pIsiExposureControlIss = SC132GS_IsiExposureControlIss;
  1581. pIsiSensor->pIsiGetGainLimitsIss = SC132GS_IsiGetGainLimitsIss;
  1582. pIsiSensor->pIsiGetIntegrationTimeLimitsIss = SC132GS_IsiGetIntegrationTimeLimitsIss;
  1583. pIsiSensor->pIsiGetCurrentExposureIss = SC132GS_IsiGetCurrentExposureIss;
  1584. pIsiSensor->pIsiGetVSGainIss = SC132GS_IsiGetVSGainIss;
  1585. pIsiSensor->pIsiGetGainIss = SC132GS_IsiGetGainIss;
  1586. pIsiSensor->pIsiGetLongGainIss = SC132GS_IsiGetLongGainIss;
  1587. pIsiSensor->pIsiGetGainIncrementIss = SC132GS_IsiGetGainIncrementIss;
  1588. pIsiSensor->pIsiSetGainIss = SC132GS_IsiSetGainIss;
  1589. pIsiSensor->pIsiGetIntegrationTimeIss = SC132GS_IsiGetIntegrationTimeIss;
  1590. pIsiSensor->pIsiGetVSIntegrationTimeIss = SC132GS_IsiGetVSIntegrationTimeIss;
  1591. pIsiSensor->pIsiGetLongIntegrationTimeIss = SC132GS_IsiGetLongIntegrationTimeIss;
  1592. pIsiSensor->pIsiGetIntegrationTimeIncrementIss = SC132GS_IsiGetIntegrationTimeIncrementIss;
  1593. pIsiSensor->pIsiSetIntegrationTimeIss = SC132GS_IsiSetIntegrationTimeIss;
  1594. pIsiSensor->pIsiQuerySensorIss = SC132GS_IsiQuerySensorIss;
  1595. pIsiSensor->pIsiGetResolutionIss = SC132GS_IsiGetResolutionIss;
  1596. pIsiSensor->pIsiGetSensorFpsIss = SC132GS_IsiGetSensorFpsIss;
  1597. pIsiSensor->pIsiSetSensorFpsIss = SC132GS_IsiSetSensorFpsIss;
  1598. pIsiSensor->pIsiSensorGetExpandCurveIss = SC132GS_IsiSensorGetExpandCurveIss;
  1599. /* AWB specific functions */
  1600. /* Testpattern */
  1601. pIsiSensor->pIsiActivateTestPattern = SC132GS_IsiActivateTestPattern;
  1602. pIsiSensor->pIsiSetBayerPattern = SC132GS_IsiSetBayerPattern;
  1603. pIsiSensor->pIsiSensorSetBlcIss = SC132GS_IsiSensorSetBlcIss;
  1604. pIsiSensor->pIsiSensorSetWBIss = SC132GS_IsiSensorSetWBIss;
  1605. pIsiSensor->pIsiGetSensorAWBModeIss = SC132GS_IsiGetSensorAWBModeIss;
  1606. pIsiSensor->pIsiGetSensorTemperature = SC132GS_IsiGetSensorTemperature;
  1607. } else {
  1608. result = RET_NULL_POINTER;
  1609. }
  1610. TRACE( SC132GS_INFO, "%s (exit)\n", __func__);
  1611. return ( result );
  1612. }
  1613. /*****************************************************************************
  1614. * each sensor driver need declare this struct for isi load
  1615. *****************************************************************************/
  1616. IsiCamDrvConfig_t SC132GS_IsiCamDrvConfig = {
  1617. 0,
  1618. SC132GS_IsiQuerySensorSupportIss,
  1619. SC132GS_IsiGetSensorIss,
  1620. {
  1621. SensorName, /**< IsiSensor_t.pszName */
  1622. 0, /**< IsiSensor_t.pIsiInitIss>*/
  1623. 0, /**< IsiSensor_t.pIsiResetSensorIss>*/
  1624. 0, /**< IsiSensor_t.pRegisterTable */
  1625. 0, /**< IsiSensor_t.pIsiSensorCaps */
  1626. 0, /**< IsiSensor_t.pIsiCreateSensorIss */
  1627. 0, /**< IsiSensor_t.pIsiReleaseSensorIss */
  1628. 0, /**< IsiSensor_t.pIsiGetCapsIss */
  1629. 0, /**< IsiSensor_t.pIsiSetupSensorIss */
  1630. 0, /**< IsiSensor_t.pIsiChangeSensorResolutionIss */
  1631. 0, /**< IsiSensor_t.pIsiSensorSetStreamingIss */
  1632. 0, /**< IsiSensor_t.pIsiSensorSetPowerIss */
  1633. 0, /**< IsiSensor_t.pIsiCheckSensorConnectionIss */
  1634. 0, /**< IsiSensor_t.pIsiGetSensorRevisionIss */
  1635. 0, /**< IsiSensor_t.pIsiRegisterReadIss */
  1636. 0, /**< IsiSensor_t.pIsiRegisterWriteIss */
  1637. 0, /**< IsiSensor_t.pIsiExposureControlIss */
  1638. 0, /**< IsiSensor_t.pIsiGetGainLimitsIss */
  1639. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeLimitsIss */
  1640. 0, /**< IsiSensor_t.pIsiGetCurrentExposureIss */
  1641. 0, /**< IsiSensor_t.pIsiGetGainIss */
  1642. 0, /**< IsiSensor_t.pIsiGetVSGainIss */
  1643. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1644. 0, /**< IsiSensor_t.pIsiGetGainIncrementIss */
  1645. 0, /**< IsiSensor_t.pIsiSetGainIss */
  1646. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIss */
  1647. 0, /**< IsiSensor_t.pIsiGetIntegrationTimeIncrementIss */
  1648. 0, /**< IsiSensor_t.pIsiSetIntegrationTimeIss */
  1649. 0, /**< IsiSensor_t.pIsiGetResolutionIss */
  1650. 0, /**< IsiSensor_t.pIsiGetAfpsInfoIss */
  1651. 0, /**< IsiSensor_t.pIsiMdiInitMotoDriveMds */
  1652. 0, /**< IsiSensor_t.pIsiMdiSetupMotoDrive */
  1653. 0, /**< IsiSensor_t.pIsiMdiFocusSet */
  1654. 0, /**< IsiSensor_t.pIsiMdiFocusGet */
  1655. 0, /**< IsiSensor_t.pIsiMdiFocusCalibrate */
  1656. 0, /**< IsiSensor_t.pIsiGetSensorMipiInfoIss */
  1657. 0, /**< IsiSensor_t.pIsiActivateTestPattern */
  1658. 0, /**< IsiSensor_t.pIsiSetBayerPattern */
  1659. }
  1660. };