1 #ifndef __UAPI_CAM_SYNC_H__ 2 #define __UAPI_CAM_SYNC_H__ 3 4 #include <linux/videodev2.h> 5 #include <linux/types.h> 6 #include <linux/ioctl.h> 7 #include <linux/media.h> 8 9 #define CAM_SYNC_DEVICE_NAME "cam_sync_device" 10 11 #define CAM_SYNC_V4L_EVENT (V4L2_EVENT_PRIVATE_START + 0) 12 13 #define CAM_SYNC_V4L_EVENT_ID_CB_TRIG 0 14 15 #define CAM_SYNC_USER_PAYLOAD_SIZE 2 16 17 #define CAM_SYNC_DEVICE_TYPE (MEDIA_ENT_F_OLD_BASE) 18 19 #define CAM_SYNC_GET_PAYLOAD_PTR(ev, type) \ 20 (type *)((char *)ev.u.data + sizeof(struct cam_sync_ev_header)) 21 22 #define CAM_SYNC_GET_HEADER_PTR(ev) \ 23 ((struct cam_sync_ev_header *)ev.u.data) 24 25 #define CAM_SYNC_STATE_INVALID 0 26 #define CAM_SYNC_STATE_ACTIVE 1 27 #define CAM_SYNC_STATE_SIGNALED_SUCCESS 2 28 #define CAM_SYNC_STATE_SIGNALED_ERROR 3 29 30 struct cam_sync_ev_header { 31 int32_t sync_obj; 32 int32_t status; 33 }; 34 35 struct cam_sync_info { 36 char name[64]; 37 int32_t sync_obj; 38 }; 39 40 struct cam_sync_signal { 41 int32_t sync_obj; 42 uint32_t sync_state; 43 }; 44 45 struct cam_sync_merge { 46 __u64 sync_objs; 47 uint32_t num_objs; 48 int32_t merged; 49 }; 50 51 struct cam_sync_userpayload_info { 52 int32_t sync_obj; 53 uint32_t reserved; 54 __u64 payload[CAM_SYNC_USER_PAYLOAD_SIZE]; 55 }; 56 57 struct cam_sync_wait { 58 int32_t sync_obj; 59 uint32_t reserved; 60 uint64_t timeout_ms; 61 }; 62 63 struct cam_private_ioctl_arg { 64 __u32 id; 65 __u32 size; 66 __u32 result; 67 __u32 reserved; 68 __u64 ioctl_ptr; 69 }; 70 71 #define CAM_PRIVATE_IOCTL_CMD \ 72 _IOWR('V', BASE_VIDIOC_PRIVATE, struct cam_private_ioctl_arg) 73 74 #define CAM_SYNC_CREATE 0 75 #define CAM_SYNC_DESTROY 1 76 #define CAM_SYNC_SIGNAL 2 77 #define CAM_SYNC_MERGE 3 78 #define CAM_SYNC_REGISTER_PAYLOAD 4 79 #define CAM_SYNC_DEREGISTER_PAYLOAD 5 80 #define CAM_SYNC_WAIT 6 81 82 #endif /* __UAPI_CAM_SYNC_H__ */ 83