csi_camera_platform_spec.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: LuChongzhi <chongzhi.lcz@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <stdio.h>
  10. #include <csi_camera_platform_spec.h>
  11. #define LOG_LEVEL 3
  12. #define LOG_PREFIX "dlg_cam_enums"
  13. #include <syslog.h>
  14. /******************************************************************************/
  15. /*********** Platform Spec in Enum ********************************************/
  16. /******************************************************************************/
  17. /* The enums platform supports for Property ID: CSI_CAMERA_PID_EXPOSURE_MODE */
  18. const camera_spec_enums_s camera_spec_camera_exposure_modes[] = {
  19. 4,
  20. {
  21. CSI_CAMERA_EXPOSURE_MODE_AUTO,
  22. CSI_CAMERA_EXPOSURE_MANUAL,
  23. CSI_CAMERA_EXPOSURE_SHUTTER_PRIORITY,
  24. CSI_CAMERA_EXPOSURE_APERTURE_PRIORITY
  25. }
  26. };
  27. /* The enums platform supports for Channel pix_fmt */
  28. const camera_spec_enums_s camera_spec_chn_pix_fmt[] = {
  29. 3,
  30. {
  31. CSI_PIX_FMT_I420,
  32. CSI_PIX_FMT_NV12,
  33. CSI_PIX_FMT_BGR,
  34. }
  35. };
  36. /* The enums platform supports for Channel pix_fmt */
  37. const camera_spec_enums_s camera_spec_chn_img_type[] = {
  38. 2,
  39. {
  40. CSI_IMG_TYPE_DMA_BUF,
  41. CSI_IMG_TYPE_SYSTEM_CONTIG,
  42. }
  43. };
  44. /* The enums platform supports for camera event subscribe */
  45. const camera_spec_enums_s camera_spec_camera_event_type[] = {
  46. 4,
  47. {
  48. CSI_CAMERA_EVENT_WARNING,
  49. CSI_CAMERA_EVENT_ERROR,
  50. CSI_CAMERA_EVENT_SENSOR_FIRST_IMAGE_ARRIVE,
  51. CSI_CAMERA_EVENT_ISP_3A_ADJUST_READY,
  52. }
  53. };
  54. /* The enums platform supports for camera channel event subscribe */
  55. const camera_spec_enums_s camera_spec_channel_event_type[] = {
  56. 3,
  57. {
  58. CSI_CAMERA_CHANNEL_EVENT_FRAME_READY,
  59. CSI_CAMERA_CHANNEL_EVENT_FRAME_PUT,
  60. CSI_CAMERA_CHANNEL_EVENT_OVERFLOW,
  61. }
  62. };
  63. const camera_spec_enums_s *camera_spec_get_enum_array(int property_id)
  64. {
  65. switch(property_id) {
  66. case CAMERA_SPEC_ENUM_CAMERA_EXPOSURE_MODES:
  67. return camera_spec_camera_exposure_modes;
  68. case CAMERA_SPEC_ENUM_CAMERA_EVENT_TYPES:
  69. return camera_spec_camera_event_type;
  70. case CAMERA_SPEC_ENUM_CHANNEL_PIX_FMT:
  71. return camera_spec_chn_pix_fmt;
  72. case CAMERA_SPEC_ENUM_CHANNEL_IMG_TYPE:
  73. return camera_spec_chn_img_type;
  74. case CAMERA_SPEC_ENUM_CHANNEL_EVENT_TYPES:
  75. return camera_spec_channel_event_type;
  76. default:
  77. LOG_E("Unknown property_id:%d\n", property_id);
  78. return NULL;
  79. }
  80. }
  81. /******************************************************************************/
  82. /*********** Platform Spec in Bitmask *****************************************/
  83. /******************************************************************************/
  84. /* The enums platform supports for Property ID: CSI_CAMERA_PID_EXPOSURE_MODE */
  85. const camera_spec_bitmasks_t camera_spec_3a_lock[] = {
  86. 3,
  87. {
  88. CSI_CAMERA_LOCK_EXPOSURE,
  89. CSI_CAMERA_LOCK_WHITE_BALANCE,
  90. CSI_CAMERA_LOCK_FOCUS,
  91. }
  92. };
  93. /* The enums platform supports for Property ID: CSI_CAMERA_PID_EXPOSURE_MODE */
  94. const camera_spec_bitmasks_t channel_spec_support_capture_type[] = {
  95. 2,
  96. {
  97. CSI_CAMERA_CHANNEL_CAPTURE_VIDEO,
  98. CSI_CAMERA_CHANNEL_CAPTURE_META,
  99. }
  100. };
  101. /* The enums platform supports for Property ID: CSI_CAMERA_PID_EXPOSURE_MODE */
  102. const camera_spec_bitmasks_t channel_spec_support_meta_type[] = {
  103. 5,
  104. {
  105. CSI_CAMERA_META_ID_CAMERA_NAME,
  106. CSI_CAMERA_META_ID_CHANNEL_ID,
  107. CSI_CAMERA_META_ID_FRAME_ID,
  108. CSI_CAMERA_META_ID_TIMESTAMP,
  109. CSI_CAMERA_META_ID_HDR,
  110. }
  111. };
  112. const camera_spec_bitmasks_t *camera_spec_get_bitmask_array(int property_id)
  113. {
  114. switch(property_id) {
  115. case CAMERA_SPEC_BITMAKS_CAMERA_3A_LOCK:
  116. return camera_spec_3a_lock;
  117. case CAMERA_SPEC_BITMAKS_CHANNEL_CAPTURE_TYPE:
  118. return channel_spec_support_capture_type;
  119. case CAMERA_SPEC_BITMAKS_CHANNEL_META_TYPE:
  120. return channel_spec_support_meta_type;
  121. default:
  122. LOG_E("Unknown property_id:%d\n", property_id);
  123. return NULL;
  124. }
  125. }