viv_video_kevent.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /****************************************************************************
  2. *
  3. * The MIT License (MIT)
  4. *
  5. * Copyright (c) 2020 VeriSilicon Holdings Co., Ltd.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. *
  25. *****************************************************************************
  26. *
  27. * The GPL License (GPL)
  28. *
  29. * Copyright (c) 2020 VeriSilicon Holdings Co., Ltd.
  30. *
  31. * This program is free software; you can redistribute it and/or
  32. * modify it under the terms of the GNU General Public License
  33. * as published by the Free Software Foundation; either version 2
  34. * of the License, or (at your option) any later version.
  35. *
  36. * This program is distributed in the hope that it will be useful,
  37. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. * GNU General Public License for more details.
  40. *
  41. * You should have received a copy of the GNU General Public License
  42. * along with this program;
  43. *
  44. *****************************************************************************
  45. *
  46. * Note: This software is released under dual MIT and GPL licenses. A
  47. * recipient may use this file under the terms of either the MIT license or
  48. * GPL License. If you wish to use only one license not the other, you can
  49. * indicate your decision by deleting one of the above license notices in your
  50. * version of this file.
  51. *
  52. *****************************************************************************/
  53. #ifndef _VIV_VIDEO_KEVENT_H_
  54. #define _VIV_VIDEO_KEVENT_H_
  55. #include <linux/videodev2.h>
  56. #ifndef __KERNEL__
  57. #include <stdint.h>
  58. typedef uint8_t u8;
  59. typedef uint16_t u16;
  60. typedef uint32_t u32;
  61. typedef uint64_t u64;
  62. #endif
  63. enum {
  64. VIV_VIDEO_EVENT_MIN = 0,
  65. VIV_VIDEO_EVENT_NEW_STREAM,
  66. VIV_VIDEO_EVENT_DEL_STREAM,
  67. VIV_VIDEO_EVENT_START_STREAM,
  68. VIV_VIDEO_EVENT_STOP_STREAM,
  69. VIV_VIDEO_EVENT_SET_FMT,
  70. VIV_VIDEO_EVENT_SET_CROP,
  71. VIV_VIDEO_EVENT_SET_COMPOSE,
  72. VIV_VIDEO_EVENT_QUERYCAPS,
  73. VIV_VIDEO_EVENT_PASS_JSON,
  74. VIV_VIDEO_EVENT_EXTCTRL,
  75. VIV_VIDEO_EVENT_EXTCTRL2,
  76. VIV_VIDEO_EVENT_SET_CAPSMODE,
  77. VIV_VIDEO_EVENT_GET_CAPS_SUPPORTS,
  78. VIV_VIDEO_EVENT_CREATE_PIPELINE,
  79. VIV_VIDEO_EVENT_QBUF,
  80. VIV_VIDEO_EVENT_MAX,
  81. };
  82. enum {
  83. VIV_DWE_EVENT_MIN = VIV_VIDEO_EVENT_MAX + 1,
  84. VIV_DWE_EVENT_FRAMEDONE,
  85. VIV_DWE_EVENT_MAX,
  86. };
  87. /* max support to 64 bytes! */
  88. struct viv_video_event {
  89. u32 stream_id;
  90. void *file;
  91. u64 addr;
  92. int buf_index;
  93. u64 response;
  94. u32 sync;
  95. };
  96. struct v4l2_user_buffer {
  97. u64 addr;
  98. int streamid;
  99. void *file;
  100. };
  101. struct viv_rect {
  102. __s16 left;
  103. __s16 top;
  104. __u16 width;
  105. __u16 height;
  106. };
  107. #define VIV_EVENT_BUF_SIZE (4*1024)
  108. #define VIV_JSON_BUFFER_SIZE (64*1024)
  109. struct viv_control_event {
  110. /* physical address of json request, fixed size 64K */
  111. u64 request;
  112. /* physical address of json response fixed size 64K */
  113. u64 response;
  114. u32 id;
  115. };
  116. struct ext_buf_info {
  117. u64 addr;
  118. u64 size;
  119. };
  120. struct vvcam_constant_modeinfo {
  121. unsigned index;
  122. unsigned w;
  123. unsigned h;
  124. unsigned fps;
  125. unsigned brpat; /*bayer pattern*/
  126. unsigned bitw; /*bit width*/
  127. };
  128. #define CALIBXML_FILE_NAME_SIZE 64
  129. struct viv_caps_mode_s {
  130. int mode;
  131. char CalibXmlName[CALIBXML_FILE_NAME_SIZE];
  132. };
  133. enum viv_caps_hdr_mode_e
  134. {
  135. VIV_CAPS_MODE_LINEAR ,
  136. VIV_CAPS_MODE_HDR_STITCH,
  137. VIV_CAPS_MODE_HDR_NATIVE,
  138. };
  139. struct viv_caps_mode_info_s{
  140. unsigned int index;
  141. unsigned int width;
  142. unsigned int height;
  143. unsigned int hdr_mode;
  144. unsigned int fps;
  145. };
  146. #define VIV_CAPS_MODE_MAX_COUNT 20
  147. struct viv_caps_supports{
  148. unsigned int count;
  149. struct viv_caps_mode_info_s mode[VIV_CAPS_MODE_MAX_COUNT];
  150. };
  151. #define VIV_VIDEO_ISPIRQ_TYPE (V4L2_EVENT_PRIVATE_START + 0x0)
  152. #define VIV_VIDEO_MIIRQ_TYPE (V4L2_EVENT_PRIVATE_START + 0x1)
  153. #define VIV_VIDEO_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x2000)
  154. #define VIV_DWE_EVENT_TYPE (V4L2_EVENT_PRIVATE_START + 0x3000)
  155. #define VIV_VIDEO_EVENT_TIMOUT_MS 5000
  156. #define VIV_VIDIOC_EVENT_COMPLETE _IOW('V', BASE_VIDIOC_PRIVATE + 100, struct viv_video_event)
  157. #define VIV_VIDIOC_BUFFER_ALLOC _IOWR('V', BASE_VIDIOC_PRIVATE + 101, struct ext_buf_info)
  158. #define VIV_VIDIOC_BUFFER_FREE _IOWR('V', BASE_VIDIOC_PRIVATE + 102, struct ext_buf_info)
  159. #define VIV_VIDIOC_CONTROL_EVENT _IOWR('V', BASE_VIDIOC_PRIVATE + 103, struct viv_control_event)
  160. #define VIV_VIDIOC_S_STREAMID _IOW('V', BASE_VIDIOC_PRIVATE + 104, int)
  161. #define VIV_VIDIOC_BUFDONE _IOW('V', BASE_VIDIOC_PRIVATE + 105, struct v4l2_user_buffer)
  162. #define VIV_VIDIOC_QUERY_EXTMEM _IOWR('V', BASE_VIDIOC_PRIVATE + 106, struct ext_buf_info)
  163. #define VIV_VIDIOC_S_ENDPOINT _IOW('V', BASE_VIDIOC_PRIVATE + 107, int)
  164. #define VIV_VIDIOC_S_MODEINFO _IOW('V', BASE_VIDIOC_PRIVATE + 108, struct vvcam_constant_modeinfo)
  165. #define VIV_VIDIOC_S_CAPS_MODE _IOW('V', BASE_VIDIOC_PRIVATE + 109, struct viv_caps_mode_s)
  166. #define VIV_VIDIOC_G_CAPS_MODE _IOWR('V', BASE_VIDIOC_PRIVATE + 110, struct viv_caps_mode_s)
  167. #define VIV_VIDIOC_EVENT_RESULT _IOWR('V', BASE_VIDIOC_PRIVATE + 111,int)
  168. #define VIV_VIDIOC_GET_CAPS_SUPPORTS _IOWR('V', BASE_VIDIOC_PRIVATE + 112,struct viv_caps_supports)
  169. #define VIV_VIDIOC_SET_CAPS_SUPPORTS _IOWR('V', BASE_VIDIOC_PRIVATE + 113,struct viv_caps_supports)
  170. #define VIV_VIDIOC_S_DWECFG _IOW('V', BASE_VIDIOC_PRIVATE + 114, int)
  171. #define VIV_VIDIOC_G_DWECFG _IOR('V', BASE_VIDIOC_PRIVATE + 115, int)
  172. #endif