image_sensor.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _IMAGE_SENSOR_H_
  13. #define _IMAGE_SENSOR_H_
  14. #include "osi_compiler.h"
  15. OSI_EXTERN_C_BEGIN
  16. #include "drv_camera.h"
  17. #include "drv_config.h"
  18. typedef struct
  19. {
  20. bool (*cameraOpen)(void);
  21. void (*cameraClose)(void);
  22. void (*cameraGetID)(uint8_t *data, uint8_t len);
  23. void (*cameraSetBrightness)(uint8_t level);
  24. void (*cameraSetContrast)(uint8_t level);
  25. void (*cameraSetImageEffect)(uint8_t effect_type);
  26. void (*cameraSetEv)(uint8_t level);
  27. void (*cameraSetAWB)(uint8_t mode);
  28. void (*cameraCaptureImage)(uint32_t size);
  29. void (*cameraStartPrev)(uint32_t size);
  30. void (*cameraStopPrev)(void);
  31. void (*cameraPrevNotify)(void);
  32. void (*cameraGetSensorInfo)(sensorInfo_t **pSensorInfo);
  33. void (*cameraFlashSet)(uint8_t level);
  34. void (*cameraTestMode)(bool on);
  35. } SensorOps_t;
  36. //general sensor drv need ping-pang buffer for continus data mode
  37. #ifdef CONFIG_CAMERA_SINGLE_BUFFER
  38. #define SENSOR_FRAMEBUFFER_NUM (1)
  39. #else
  40. #define SENSOR_FRAMEBUFFER_NUM (2)
  41. #endif
  42. typedef struct image_dev_tag
  43. {
  44. bool poweron_flag;
  45. uint32_t nPixcels;
  46. uint8_t framebuffer_count;
  47. sensorInfo_t *pSensorInfo;
  48. SensorOps_t *pSensorOpsApi;
  49. uint16_t *pFramebuffer[SENSOR_FRAMEBUFFER_NUM];
  50. } IMAGE_DEV_T, *IMAGE_DEV_T_PTR;
  51. typedef struct cam_dev_tag
  52. {
  53. char *pNamestr;
  54. uint32_t img_width;
  55. uint32_t img_height;
  56. uint32_t nPixcels;
  57. } CAM_DEV_T, *CAM_DEV_T_PTR;
  58. bool drvCamInit(void);
  59. void drvCamGetSensorInfo(CAM_DEV_T *pCamDevice);
  60. bool drvCamPowerOn(void);
  61. bool drvCamStartPreview(void);
  62. uint16_t *drvCamPreviewDQBUF(void);
  63. void drvCamPreviewQBUF(uint16_t *pFrameBuf);
  64. bool drvCamStopPreview(void);
  65. bool drvCamCaptureImage(uint16_t **pFrameBuf);
  66. bool drvCamGePrevStatus(void);
  67. void drvCamClose(void);
  68. void drvCamTestMode(bool on);
  69. #ifdef CONFIG_QUEC_PROJECT_FEATURE_CAMERA
  70. void drvCamPowerOff(void);
  71. #endif
  72. #ifdef CONFIG_QUEC_PROJECT_FEATURE_CAMERA
  73. SensorOps_t *prvCamLoad(void);
  74. IMAGE_DEV_T *quec_getImageSensor(void);
  75. bool drvCamI2CRead(uint8_t addr, uint8_t *data, uint32_t len);
  76. bool drvCamI2CWrite(uint8_t addr, uint8_t data);
  77. #endif
  78. OSI_EXTERN_C_END
  79. #endif