SC132GS_priv.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /******************************************************************************\
  2. |* Copyright (c) 2020 by VeriSilicon Holdings Co., Ltd. ("VeriSilicon") *|
  3. |* All Rights Reserved. *|
  4. |* *|
  5. |* The material in this file is confidential and contains trade secrets of *|
  6. |* of VeriSilicon. This is proprietary information owned or licensed by *|
  7. |* VeriSilicon. No part of this work may be disclosed, reproduced, copied, *|
  8. |* transmitted, or used in any way for any purpose, without the express *|
  9. |* written permission of VeriSilicon. *|
  10. |* *|
  11. \******************************************************************************/
  12. /**
  13. * @file SC132GS_priv.h
  14. *
  15. * @brief Interface description for image sensor specific implementation (iss).
  16. *
  17. *****************************************************************************/
  18. /**
  19. * @page module_name_page Module Name
  20. * Describe here what this module does.
  21. *
  22. * For a detailed list of functions and implementation detail refer to:
  23. * - @ref module_name
  24. *
  25. * @defgroup sc132gs_priv
  26. * @{
  27. *
  28. */
  29. #ifndef __SC132GS_PRIV_H__
  30. #define __SC132GS_PRIV_H__
  31. #include <ebase/types.h>
  32. #include <common/return_codes.h>
  33. #include <hal/hal_api.h>
  34. #include <isi/isi_common.h>
  35. #include "vvsensor.h"
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif
  40. /*****************************************************************************
  41. * SC control registers
  42. *****************************************************************************/
  43. #define SC132GS_PIDH (0x300A) //R - Product ID High Byte MSBs
  44. #define SC132GS_PIDL (0x300B) //R - Product ID Low Byte LSBs
  45. /*****************************************************************************
  46. * Default values
  47. *****************************************************************************/
  48. // Make sure that these static settings are reflecting the capabilities defined
  49. // in IsiGetCapsIss (further dynamic setup may alter these default settings but
  50. // often does not if there is no choice available).
  51. /*****************************************************************************
  52. * SC control registers
  53. *****************************************************************************/
  54. #define SC132GS_PIDH_DEFAULT (0x27) //read only
  55. #define SC132GS_PIDL_DEFAULT (0x70) //read only
  56. typedef struct SC132GS_Context_s
  57. {
  58. IsiSensorContext_t IsiCtx; /**< common context of ISI and ISI driver layer; @note: MUST BE FIRST IN DRIVER CONTEXT */
  59. struct vvcam_mode_info SensorMode;
  60. uint32_t KernelDriverFlag;
  61. char SensorRegCfgFile[128];
  62. uint32_t HdrMode;
  63. uint32_t Resolution;
  64. uint32_t MaxFps;
  65. uint32_t MinFps;
  66. uint32_t CurrFps;
  67. //// modify below here ////
  68. IsiSensorConfig_t Config; /**< sensor configuration */
  69. bool_t Configured; /**< flags that config was applied to sensor */
  70. bool_t Streaming; /**< flags that csensor is streaming data */
  71. bool_t TestPattern; /**< flags that sensor is streaming test-pattern */
  72. bool_t isAfpsRun; /**< if true, just do anything required for Afps parameter calculation, but DON'T access SensorHW! */
  73. float one_line_exp_time;
  74. uint16_t MaxIntegrationLine;
  75. uint16_t MinIntegrationLine;
  76. uint32_t gain_accuracy;
  77. uint16_t FrameLengthLines; /**< frame line length */
  78. uint16_t CurFrameLengthLines;
  79. float AecMinGain;
  80. float AecMaxGain;
  81. float AecMinIntegrationTime;
  82. float AecMaxIntegrationTime;
  83. float AecIntegrationTimeIncrement; /**< _smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application) */
  84. float AecGainIncrement; /**< _smallest_ increment the sensor/driver can handle (e.g. used for sliders in the application) */
  85. float AecCurIntegrationTime;
  86. float AecCurVSIntegrationTime;
  87. float AecCurLongIntegrationTime;
  88. float AecCurGain;
  89. float AecCurVSGain;
  90. float AecCurLongGain;
  91. uint32_t LastExpLine;
  92. uint32_t LastVsExpLine;
  93. uint32_t LastLongExpLine;
  94. uint32_t LastGain;
  95. uint32_t LastVsGain;
  96. uint32_t LastLongGain;
  97. bool GroupHold;
  98. uint32_t OldGain;
  99. uint32_t OldVsGain;
  100. uint32_t OldIntegrationTime;
  101. uint32_t OldVsIntegrationTime;
  102. uint32_t OldGainHcg;
  103. uint32_t OldAGainHcg;
  104. uint32_t OldGainLcg;
  105. uint32_t OldAGainLcg;
  106. int subdev;
  107. uint8_t pattern;
  108. float CurHdrRatio;
  109. } SC132GS_Context_t;
  110. static RESULT SC132GS_IsiCreateSensorIss(IsiSensorInstanceConfig_t *
  111. pConfig);
  112. static RESULT SC132GS_IsiInitSensorIss(IsiSensorHandle_t handle);
  113. static RESULT SC132GS_IsiReleaseSensorIss(IsiSensorHandle_t handle);
  114. static RESULT SC132GS_IsiGetCapsIss(IsiSensorHandle_t handle,
  115. IsiSensorCaps_t * pIsiSensorCaps);
  116. static RESULT SC132GS_IsiSetupSensorIss(IsiSensorHandle_t handle,
  117. const IsiSensorConfig_t *
  118. pConfig);
  119. static RESULT SC132GS_IsiSensorSetStreamingIss(IsiSensorHandle_t handle,
  120. bool_t on);
  121. static RESULT SC132GS_IsiSensorSetPowerIss(IsiSensorHandle_t handle,
  122. bool_t on);
  123. static RESULT SC132GS_IsiGetSensorRevisionIss(IsiSensorHandle_t handle,
  124. uint32_t * p_value);
  125. static RESULT SC132GS_IsiSetBayerPattern(IsiSensorHandle_t handle,
  126. uint8_t pattern);
  127. static RESULT SC132GS_IsiGetGainLimitsIss(IsiSensorHandle_t handle,
  128. float *pMinGain,
  129. float *pMaxGain);
  130. static RESULT SC132GS_IsiGetIntegrationTimeLimitsIss(IsiSensorHandle_t
  131. handle,
  132. float
  133. *pMinIntegrationTime,
  134. float
  135. *pMaxIntegrationTime);
  136. static RESULT SC132GS_IsiExposureControlIss(IsiSensorHandle_t handle,
  137. float NewGain,
  138. float NewIntegrationTime,
  139. uint8_t *
  140. pNumberOfFramesToSkip,
  141. float *pSetGain,
  142. float *pSetIntegrationTime,
  143. float *hdr_ratio);
  144. static RESULT SC132GS_IsiGetGainIss(IsiSensorHandle_t handle,
  145. float *pSetGain);
  146. static RESULT SC132GS_IsiGetVSGainIss(IsiSensorHandle_t handle,
  147. float *pSetGain);
  148. static RESULT SC132GS_IsiGetGainIncrementIss(IsiSensorHandle_t handle,
  149. float *pIncr);
  150. static RESULT SC132GS_IsiSetGainIss(IsiSensorHandle_t handle,
  151. float NewGain, float *pSetGain,
  152. float *hdr_ratio);
  153. static RESULT SC132GS_IsiSetVSGainIss(IsiSensorHandle_t handle,
  154. float NewIntegrationTime,
  155. float NewGain, float *pSetGain,
  156. float *hdr_ratio);
  157. static RESULT SC132GS_IsiGetIntegrationTimeIss(IsiSensorHandle_t handle,
  158. float
  159. *pSetIntegrationTime);
  160. static RESULT SC132GS_IsiGetVSIntegrationTimeIss(IsiSensorHandle_t
  161. handle,
  162. float
  163. *pSetIntegrationTime);
  164. static RESULT SC132GS_IsiGetIntegrationTimeIncrementIss(IsiSensorHandle_t handle,
  165. float *pIncr);
  166. static RESULT SC132GS_IsiSetIntegrationTimeIss(IsiSensorHandle_t handle,
  167. float NewIntegrationTime,
  168. float
  169. *pSetIntegrationTime,
  170. uint8_t *
  171. pNumberOfFramesToSkip,
  172. float *hdr_ratio);
  173. static RESULT SC132GS_IsiSetVSIntegrationTimeIss(IsiSensorHandle_t
  174. handle,
  175. float
  176. NewIntegrationTime,
  177. float
  178. *pSetIntegrationTime,
  179. uint8_t *
  180. pNumberOfFramesToSkip,
  181. float *hdr_ratio);
  182. RESULT SC132GS_IsiGetResolutionIss(IsiSensorHandle_t handle, uint16_t *pwidth, uint16_t *pheight);
  183. static RESULT SC132GS_IsiResetSensorIss(IsiSensorHandle_t handle);
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187. /* @} sc132gspriv */
  188. #endif /* __SC132GSPRIV_H__ */