stflib_isp_sensor.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /**
  2. ******************************************************************************
  3. * @file stflib_isp_sensor.h
  4. * @author StarFive Isp Team
  5. * @version V1.0
  6. * @date 08/26/2020
  7. * @brief Declaration of ISPC::Sensor
  8. ******************************************************************************
  9. * @copy
  10. *
  11. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  12. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  13. * TIME. AS A RESULT, STARFIVE SHALL NOT BE HELD LIABLE FOR ANY
  14. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  15. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  16. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  17. *
  18. * Copyright (C) 2019 - 2022 StarFive Technology Co., Ltd.
  19. ******************************************************************************/
  20. #ifndef __STFLIB_ISP_SENSOR_H__
  21. #define __STFLIB_ISP_SENSOR_H__
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #include "stf_include.h"
  26. #include "ci/ci_api_structs.h"
  27. #include "stf_common/pixel_format.h"
  28. #include "sensorapi/sensorapi.h"
  29. #if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  30. #include "ISPC/stflib_isp_device.h"
  31. #endif //#if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  32. typedef enum _EN_SENSOR_STATE {
  33. SENSOR_ERROR = 0, /**< @brief Sensor is in error estate. */
  34. SENSOR_INITIALIZED, /**< @brief Sensor initialization is complete. */
  35. SENSOR_ENABLED, /**< @brief Sensor is enabled for capture. */
  36. SENSOR_CONFIGURED, /**< @brief Sensor is configured. */
  37. } EN_SENSOR_STATE, *PEN_SENSOR_STATE;
  38. typedef struct _ST_SENSOR ST_SENSOR;
  39. typedef struct _ST_SENSOR {
  40. SENSOR_HANDLE *pstSensorHandle; /** @brief Sensor handle that controls the camera */
  41. EN_SENSOR_STATE enState; /** @brief Sensor running state */
  42. STF_U16 u16Width; /** @brief in pixels, Range: 0 - 16384. */
  43. STF_U16 u16Height; /** @brief in lines, Range: 0 - 16384. */
  44. STF_U8 u8Imager; /** @brief imager id */
  45. STF_U16 u16VerticalTotal; /** @brief Number of lines including blanking, Range: 0 - 16383 */
  46. enum MOSAICType enBayerFormat; /** @brief Mosaic of the sensor */
  47. STF_U8 u8SensorContexts; /** @brief contexts */
  48. STF_U8 u8BitDepth; /** @brief Data size of the sensor, Range: 8 - 16. */
  49. STF_DOUBLE dFrameRate; /** @brief Sensor default frame rate, Range: 1.0 - 255.0. */
  50. STF_DOUBLE dCurrentFPS; /** @brief Frame rate programmed in the sensor, Range: 1.0 - 255.0. */
  51. STF_U32 u32WellDepth; /** Range: 0 - 65535 */
  52. STF_DOUBLE dReadNoise; /** Range: 0.0 - 100.0 */
  53. STF_DOUBLE dAperture;
  54. STF_U16 u16FocalLength;
  55. STF_U32 u32ProgrammedExposure; /** @brief Exposure time programmed in the sensor (microseconds), Range: 0.0 - 5000.0. */
  56. STF_DOUBLE dProgrammedGain; /** @brief Gain programmed in the sensor, Range: 0.0 - 128.0. */
  57. STF_U16 u16ProgrammedFocus; /** @brief Focus distance set in the sensor */
  58. STF_U32 u32MinExposure; /** @brief Minumum exposure times (microseconds) */
  59. STF_U32 u32MaxExposure; /** @brief Maximum exposure times (microseconds) */
  60. STF_U16 u16MinFocus; /** @brief Minimum focus distance (milimetre) */
  61. STF_U16 u16MaxFocus; /** @brief Maximum focus distance (milimetre) */
  62. STF_DOUBLE dMinGain; /** @brief Minimum exposure gain */
  63. STF_DOUBLE dMaxGain; /** @brief Maximum exposure gain */
  64. STF_BOOL8 bFocusSupported; /** @brief variable focus support status */
  65. /**
  66. * @brief Get sensor state name
  67. *
  68. * @param s Sensor state
  69. */
  70. const STF_CHAR* (*StateName)(EN_SENSOR_STATE enState);
  71. /**
  72. * @brief Populate a list with the available sensors from Sensor API
  73. *
  74. * @param [out] sensorNames appends name to the list
  75. */
  76. STF_VOID (*GetSensorNames)(STF_U8 *pu8Count, STF_CHAR szSensorName[][64]);
  77. /**
  78. * @brief Get sensor ID from a name
  79. *
  80. * @param name of the sensor in Sensor API
  81. *
  82. * @return positive identifier or negative number if sensor not found
  83. */
  84. STF_S8 (*GetSensorId)(const char *SensorName);
  85. /**
  86. * @brief to centralise the init of the constructor so that children
  87. * classes can initialise the object as if constructor has been called
  88. * with a sensor id
  89. */
  90. #if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  91. STF_RESULT (*Init)(CI_CONNECTION *pCIConnection, STF_U8 u8IspIdx, ST_SENSOR *pstSensor, STF_U8 u8SensorId, STF_U8 u8Index);
  92. #else
  93. STF_RESULT (*Init)(ST_SENSOR *pstSensor, STF_U8 u8SensorId, STF_U8 u8Index);
  94. #endif //#if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  95. /**
  96. * @brief Destroy a sensor using given identifier.
  97. */
  98. STF_RESULT (*Destroy)(ST_SENSOR *pstSensor);
  99. /**
  100. * @brief Access to sensors API handle
  101. *
  102. * Mainly to be able to call extended functions
  103. */
  104. SENSOR_HANDLE *(*GetHandle)(ST_SENSOR *pstSensor);
  105. /**
  106. * @brief Get the sensor state.
  107. */
  108. EN_SENSOR_STATE (*GetState)(ST_SENSOR *pstSensor);
  109. /**
  110. * @brief Get sensor information
  111. *
  112. * @param[out] sMode
  113. */
  114. STF_RESULT (*GetInfo)(ST_SENSOR *pstSensor, SENSOR_INFO *pstSensorInfo);
  115. /**
  116. * @brief Get sensor mode index
  117. *
  118. * @param u16Width the width of mode for the mode to check.
  119. * @param u16Height the height of mode for the mode to check.
  120. *
  121. * @return positive mode index or negative number if mode is not found
  122. */
  123. STF_S8 (*GetModeIdx)(ST_SENSOR *pstSensor, STF_U16 u16Width, STF_U16 u16Height);
  124. /**
  125. * @brief Get some mode information (including if flipping is supported)
  126. *
  127. * @param mode for the sensor
  128. * @param[out] sMode
  129. */
  130. STF_RESULT (*GetMode)(ST_SENSOR *pstSensor, STF_U8 u8ModeIdx, SENSOR_MODE *pstModes);
  131. /**
  132. * @brief Set the mode of the sensor
  133. */
  134. STF_RESULT (*SetMode)(ST_SENSOR *pstSensor, STF_U8 u8ModeIdx, STF_U8 u8Flipping);
  135. /**
  136. * @brief Get the sensor's connection data bus and I2C hardware information.
  137. *
  138. * @param[out] pstInterface
  139. */
  140. STF_RESULT (*GetInterfaceInfo)(ST_SENSOR *pstSensor, SENSOR_INTFC *pstInterface);
  141. /**
  142. * @brief Configure the sensor with a selected mode.
  143. */
  144. STF_RESULT (*Configure)(ST_SENSOR *pstSensor, STF_U8 u8ModeIdx, STF_U8 u8Flipping);
  145. /**
  146. * @brief Access to the Sensor API insert function (which may not be
  147. * available on all sensors!)
  148. */
  149. STF_RESULT (*Insert)(ST_SENSOR *pstSensor);
  150. /**
  151. * @brief Access to the Sensor API waitProcessed function (which may not
  152. * be available on all sensors!)
  153. */
  154. STF_RESULT (*WaitProcessed)(ST_SENSOR *pstSensor);
  155. /**
  156. * @brief start transmission of the data from the sensor.
  157. */
  158. STF_RESULT (*Enable)(ST_SENSOR *pstSensor);
  159. /**
  160. * @brief stop transmission of the data from the sensor.
  161. */
  162. STF_RESULT (*Disable)(ST_SENSOR *pstSensor);
  163. /**
  164. * @brief Reset the sensor.
  165. */
  166. STF_RESULT (*Reset)(ST_SENSOR *pstSensor);
  167. /**
  168. * @brief Get status value in the sensor.
  169. */
  170. STF_RESULT (*GetStatus)(ST_SENSOR *pstSensor, SENSOR_STATUS *pstStatus);
  171. /**
  172. * @brief Get the sensor register value.
  173. *
  174. * @param u16RegAddr the sensor register address.
  175. * @param pu16RegValue point to read back value from the sensor.
  176. */
  177. STF_RESULT (*GetReg)(ST_SENSOR *pstSensor, STF_U16 u16RegAddr, STF_U16 *pu16RegValue);
  178. /**
  179. * @brief Program the value to the register of sensor.
  180. *
  181. * @param u16RegAddr the sensor register address.
  182. * @param u16RegValue the program value to the sensor register.
  183. */
  184. STF_RESULT (*SetReg)(ST_SENSOR *pstSensor, STF_U16 u16RegAddr, STF_U16 u16RegValue);
  185. /**
  186. * @brief Get flip and mirror value in the sensor.
  187. */
  188. STF_RESULT (*GetFlipMirror)(ST_SENSOR *pstSensor, STF_U8 *pu8Flag);
  189. #ifdef SIFIVE_ISP_TUNING
  190. /**
  191. * @brief Set flip and mirror value in the sensor.
  192. */
  193. STF_RESULT (*SetFlipMirror)(ST_SENSOR *pstSensor, STF_U8 u8Flag);
  194. #endif //SIFIVE_ISP_TUNING
  195. /**
  196. * @brief Get the fixed FPS value in the sensor.
  197. */
  198. STF_RESULT (*GetFixedFPS)(ST_SENSOR *pstSensor, STF_U16 *pu16FixedFps);
  199. /**
  200. * @brief Set the FPS value the sensor.
  201. */
  202. STF_RESULT (*SetFPS)(ST_SENSOR *pstSensor, STF_DOUBLE dFps);
  203. /**
  204. * @brief Get the snapahot resolution value in the sensor.
  205. */
  206. STF_RESULT (*GetSnapShotResolution)(ST_SENSOR *pstSensor, ST_RES_LIST *pstResList);
  207. /**
  208. * @brief Set the resolution value the sensor.
  209. */
  210. STF_RESULT (*SetResolution)(ST_SENSOR *pstSensor, STF_U16 u16ImgW, STF_U16 u16ImgH);
  211. /**
  212. * @brief Get minimum exposure time value programmable in the sensor
  213. * (microseconds).
  214. */
  215. STF_U32 (*GetMinExposure)(ST_SENSOR *pstSensor);
  216. /**
  217. * @brief Get maximum exposure time value programmable in the sensor
  218. * (microseconds).
  219. */
  220. STF_U32 (*GetMaxExposure)(ST_SENSOR *pstSensor);
  221. /**
  222. * @brief Get minimum and maximum exposure time value programmable in the sensor
  223. * (microseconds).
  224. */
  225. STF_RESULT (*GetExposureRange)(ST_SENSOR *pstSensor, STF_U32 *pu32MinExposure, STF_U32 *pu32MaxExposure);
  226. /**
  227. * @brief Get the exposure time programmed in the sensor (microseconds)
  228. */
  229. STF_U32 (*GetExposure)(ST_SENSOR *pstSensor);
  230. /**
  231. * @brief Program the exposure time in the sensor (microseconds).
  232. *
  233. * @param u32Exposure Exposure time (microseconds)
  234. */
  235. STF_RESULT (*SetExposure)(ST_SENSOR *pstSensor, STF_U32 u32Exposure);
  236. /**
  237. * @brief Get minimum gain value programmable in the sensor.
  238. */
  239. STF_DOUBLE (*GetMinGain)(ST_SENSOR *pstSensor);
  240. #ifdef SIFIVE_ISP_TUNING
  241. /**
  242. * @brief Set the minimum gain value programmable in the sensor.
  243. */
  244. STF_RESULT (*SetMinGain)(ST_SENSOR *pstSensor, STF_DOUBLE dMinGain);
  245. #endif //SIFIVE_ISP_TUNING
  246. /**
  247. * @brief Get maximum gain value programmable in the sensor.
  248. */
  249. STF_DOUBLE (*GetMaxGain)(ST_SENSOR *pstSensor);
  250. #ifdef SIFIVE_ISP_TUNING
  251. /**
  252. * @brief Set the maximum gain value programmable in the sensor.
  253. */
  254. STF_RESULT (*SetMaxGain)(ST_SENSOR *pstSensor, STF_DOUBLE dMaxGain);
  255. #endif //SIFIVE_ISP_TUNING
  256. /**
  257. * @brief Get minimum and maximum gain value programmable in the sensor.
  258. */
  259. STF_RESULT (*GetGainRange)(ST_SENSOR *pstSensor, STF_DOUBLE *pdMinGain, STF_DOUBLE *pdMaxGain);
  260. /**
  261. * @brief Set the minimum and maximum gain value programmable in the sensor according to the ISO value.
  262. */
  263. STF_RESULT (*SetIsoLimit)(ST_SENSOR *pstSensor, STF_U8 u8IsoLimit);
  264. /**
  265. * @brief Get the gain value programmed in the sensor.
  266. */
  267. STF_DOUBLE (*GetGain)(ST_SENSOR *pstSensor);
  268. /**
  269. * @brief Set the gain value in the sensor.
  270. */
  271. STF_RESULT (*SetGain)(ST_SENSOR *pstSensor, STF_DOUBLE dGain);
  272. /**
  273. * @brief Program the exposure time (microseconds) and gain in the sensor.
  274. *
  275. * @param u32Exposure Exposure time (microseconds)
  276. * @param dGain gain value
  277. */
  278. STF_RESULT (*SetExposureAndGain)(ST_SENSOR *pstSensor, STF_U32 u32Exposure, STF_DOUBLE dGain);
  279. /**
  280. * @brief Get state of driver support for variable focus.
  281. */
  282. STF_BOOL8 (*GetFocusSupported)(ST_SENSOR *pstSensor);
  283. /**
  284. * @brief Get minimum focus distance programmable in the sensor in
  285. * milimiters.
  286. */
  287. STF_U16 (*GetMinFocus)(ST_SENSOR *pstSensor);
  288. /**
  289. * @brief Get maximum focus distance programmable in the sensor in
  290. * milimiters.
  291. */
  292. STF_U16 (*GetMaxFocus)(ST_SENSOR *pstSensor);
  293. /**
  294. * @brief Get the focus distance currently programmed in the sensor in
  295. * milimiters
  296. *
  297. * @return Focus distance currently set in the sensor
  298. */
  299. STF_U16 (*GetFocusDistance)(ST_SENSOR *pstSensor);
  300. /**
  301. * @brief Set focus distance in the sensor in milimiters
  302. *
  303. * @param focusDistance Focus distance to be set in the sensor
  304. */
  305. STF_RESULT (*SetFocusDistance)(ST_SENSOR *pstSensor, STF_U16 u16FocusDistance);
  306. } ST_SENSOR, *PST_SENSOR;
  307. extern
  308. const STF_CHAR* STFLIB_ISP_SENSOR_StateName(
  309. EN_SENSOR_STATE enState
  310. );
  311. extern
  312. STF_VOID STFLIB_ISP_SENSOR_GetSensorNames(
  313. STF_U8 *pu8Count,
  314. STF_CHAR szSensorName[][64]
  315. );
  316. extern
  317. STF_S8 STFLIB_ISP_SENSOR_GetSensorId(
  318. const STF_CHAR *pszSensorName
  319. );
  320. extern
  321. STF_RESULT STFLIB_ISP_SENSOR_Init(
  322. #if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  323. CI_CONNECTION *pCIConnection,
  324. STF_U8 u8IspIdx,
  325. #endif //#if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  326. ST_SENSOR *pstSensor,
  327. STF_U8 u8SensorId,
  328. STF_U8 u8Index
  329. );
  330. extern
  331. STF_RESULT STFLIB_ISP_SENSOR_Destroy(
  332. ST_SENSOR *pstSensor
  333. );
  334. extern
  335. SENSOR_HANDLE * STFLIB_ISP_SENSOR_GetHandle(
  336. ST_SENSOR *pstSensor
  337. );
  338. extern
  339. EN_SENSOR_STATE STFLIB_ISP_SENSOR_GetState(
  340. ST_SENSOR *pstSensor
  341. );
  342. extern
  343. STF_RESULT STFLIB_ISP_SENSOR_GetInfo(
  344. ST_SENSOR *pstSensor,
  345. SENSOR_INFO *pstSensorInfo
  346. );
  347. extern
  348. STF_S8 STFLIB_ISP_SENSOR_GetModeIdx(
  349. ST_SENSOR *pstSensor,
  350. STF_U16 u16Width,
  351. STF_U16 u16Height
  352. );
  353. extern
  354. STF_RESULT STFLIB_ISP_SENSOR_GetMode(
  355. ST_SENSOR *pstSensor,
  356. STF_U8 u8ModeIdx,
  357. SENSOR_MODE *pstModes
  358. );
  359. extern
  360. STF_RESULT STFLIB_ISP_SENSOR_SetMode(
  361. ST_SENSOR *pstSensor,
  362. STF_U8 u8ModeIdx,
  363. STF_U8 u8Flipping
  364. );
  365. extern
  366. STF_RESULT STFLIB_ISP_SENSOR_GetInterfaceInfo(
  367. ST_SENSOR *pstSensor,
  368. SENSOR_INTFC *pstInterface
  369. );
  370. extern
  371. STF_RESULT STFLIB_ISP_SENSOR_Configure(
  372. ST_SENSOR *pstSensor,
  373. STF_U8 u8ModeIdx,
  374. STF_U8 u8Flipping
  375. );
  376. extern
  377. STF_RESULT STFLIB_ISP_SENSOR_Insert(
  378. ST_SENSOR *pstSensor
  379. );
  380. extern
  381. STF_RESULT STFLIB_ISP_SENSOR_WaitProcessed(
  382. ST_SENSOR *pstSensor
  383. );
  384. extern
  385. STF_RESULT STFLIB_ISP_SENSOR_Enable(
  386. ST_SENSOR *pstSensor
  387. );
  388. extern
  389. STF_RESULT STFLIB_ISP_SENSOR_Disable(
  390. ST_SENSOR *pstSensor
  391. );
  392. extern
  393. STF_RESULT STFLIB_ISP_SENSOR_Reset(
  394. ST_SENSOR *pstSensor
  395. );
  396. extern
  397. STF_RESULT STFLIB_ISP_SENSOR_GetStatus(
  398. ST_SENSOR *pstSensor,
  399. SENSOR_STATUS *pstStatus
  400. );
  401. extern
  402. STF_RESULT STFLIB_ISP_SENSOR_GetReg(
  403. ST_SENSOR *pstSensor,
  404. STF_U16 u16RegAddr,
  405. STF_U16 *pu16RegValue
  406. );
  407. extern
  408. STF_RESULT STFLIB_ISP_SENSOR_SetReg(
  409. ST_SENSOR *pstSensor,
  410. STF_U16 u16RegAddr,
  411. STF_U16 u16RegValue
  412. );
  413. extern
  414. STF_RESULT STFLIB_ISP_SENSOR_GetFlipMirror(
  415. ST_SENSOR *pstSensor,
  416. STF_U8 *pu8Flag
  417. );
  418. #ifdef SIFIVE_ISP_TUNING
  419. extern
  420. STF_RESULT STFLIB_ISP_SENSOR_SetFlipMirror(
  421. ST_SENSOR *pstSensor,
  422. STF_U8 u8Flag
  423. );
  424. #endif //SIFIVE_ISP_TUNING
  425. extern
  426. STF_RESULT STFLIB_ISP_SENSOR_GetFixedFPS(
  427. ST_SENSOR *pstSensor,
  428. STF_U16 *pu16FixedFps
  429. );
  430. extern
  431. STF_RESULT STFLIB_ISP_SENSOR_SetFPS(
  432. ST_SENSOR *pstSensor,
  433. STF_DOUBLE dFps
  434. );
  435. extern
  436. STF_RESULT STFLIB_ISP_SENSOR_GetSnapShotResolution(
  437. ST_SENSOR *pstSensor,
  438. ST_RES_LIST *pstResList
  439. );
  440. extern
  441. STF_RESULT STFLIB_ISP_SENSOR_SetResolution(
  442. ST_SENSOR *pstSensor,
  443. STF_U16 u16ImgW,
  444. STF_U16 u16ImgH
  445. );
  446. extern
  447. STF_U32 STFLIB_ISP_SENSOR_GetMinExposure(
  448. ST_SENSOR *pstSensor
  449. );
  450. extern
  451. STF_U32 STFLIB_ISP_SENSOR_GetMaxExposure(
  452. ST_SENSOR *pstSensor
  453. );
  454. extern
  455. STF_RESULT STFLIB_ISP_SENSOR_GetExposureRange(
  456. ST_SENSOR *pstSensor,
  457. STF_U32 *pu32MinExposure,
  458. STF_U32 *pu32MaxExposure
  459. );
  460. extern
  461. STF_U32 STFLIB_ISP_SENSOR_GetExposure(
  462. ST_SENSOR *pstSensor
  463. );
  464. extern
  465. STF_RESULT STFLIB_ISP_SENSOR_SetExposure(
  466. ST_SENSOR *pstSensor,
  467. STF_U32 u32Exposure
  468. );
  469. extern
  470. STF_DOUBLE STFLIB_ISP_SENSOR_GetMinGain(
  471. ST_SENSOR *pstSensor
  472. );
  473. #ifdef SIFIVE_ISP_TUNING
  474. extern
  475. STF_RESULT STFLIB_ISP_SENSOR_SetMinGain(
  476. ST_SENSOR *pstSensor,
  477. STF_DOUBLE dMinGain
  478. );
  479. #endif //SIFIVE_ISP_TUNING
  480. extern
  481. STF_DOUBLE STFLIB_ISP_SENSOR_GetMaxGain(
  482. ST_SENSOR *pstSensor
  483. );
  484. #ifdef SIFIVE_ISP_TUNING
  485. extern
  486. STF_RESULT STFLIB_ISP_SENSOR_SetMaxGain(
  487. ST_SENSOR *pstSensor,
  488. STF_DOUBLE dMaxGain
  489. );
  490. #endif //SIFIVE_ISP_TUNING
  491. extern
  492. STF_RESULT STFLIB_ISP_SENSOR_GetGainRange(
  493. ST_SENSOR *pstSensor,
  494. STF_DOUBLE *pdMinGain,
  495. STF_DOUBLE *pdMaxGain
  496. );
  497. extern
  498. STF_RESULT STFLIB_ISP_SENSOR_SetIsoLimit(
  499. ST_SENSOR *pstSensor,
  500. STF_U8 u8IsoLimit
  501. );
  502. extern
  503. STF_DOUBLE STFLIB_ISP_SENSOR_GetGain(
  504. ST_SENSOR *pstSensor
  505. );
  506. extern
  507. STF_RESULT STFLIB_ISP_SENSOR_SetGain(
  508. ST_SENSOR *pstSensor,
  509. STF_DOUBLE dGain
  510. );
  511. extern
  512. STF_RESULT STFLIB_ISP_SENSOR_SetExposureAndGain(
  513. ST_SENSOR *pstSensor,
  514. STF_U32 u32Exposure,
  515. STF_DOUBLE dGain
  516. );
  517. extern
  518. STF_BOOL8 STFLIB_ISP_SENSOR_GetFocusSupported(
  519. ST_SENSOR *pstSensor
  520. );
  521. extern
  522. STF_U16 STFLIB_ISP_SENSOR_GetMinFocus(
  523. ST_SENSOR *pstSensor
  524. );
  525. extern
  526. STF_U16 STFLIB_ISP_SENSOR_GetMaxFocus(
  527. ST_SENSOR *pstSensor
  528. );
  529. extern
  530. STF_U16 STFLIB_ISP_SENSOR_GetFocusDistance(
  531. ST_SENSOR *pstSensor
  532. );
  533. extern
  534. STF_RESULT STFLIB_ISP_SENSOR_SetFocusDistance(
  535. ST_SENSOR *pstSensor,
  536. STF_U16 u16FocusDistance
  537. );
  538. /**
  539. * @brief Create a sensor using given identifier.
  540. *
  541. * Sensor is initialised in this function.
  542. * Mode should be selected with configure() and sensor can then be started
  543. * using enabled()
  544. *
  545. * @param sensorId
  546. */
  547. extern
  548. STF_RESULT STFLIB_ISP_SENSOR_SturctInitialize(
  549. ST_SENSOR *pstSensor,
  550. #if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  551. CI_CONNECTION *pCIConnection,
  552. STF_U8 u8IspIdx,
  553. #endif //#if defined(VIRTUAL_IO_MAPPING) && !defined(USE_LINUX_SYSTEM_STARTAND_I2C)
  554. STF_U8 u8SensorId,
  555. STF_U8 u8Index
  556. );
  557. /**
  558. * @brief Destroy a sensor using given identifier.
  559. */
  560. extern
  561. STF_RESULT STFLIB_ISP_SENSOR_SturctUninitialize(
  562. ST_SENSOR *pstSensor
  563. );
  564. #ifdef __cplusplus
  565. }
  566. #endif
  567. #endif //__STFLIB_ISP_SENSOR_H__