1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) Rockchip Electronics Co., Ltd. 4 * 5 * Author: Huang Lee <Putin.li@rock-chips.com> 6 */ 7 #ifndef _RVE_DRIVER_H_ 8 #define _RVE_DRIVER_H_ 9 10 #include <linux/mutex.h> 11 #include <linux/scatterlist.h> 12 13 /* Use 'r' as magic number */ 14 #define RVE_IOC_MAGIC 'r' 15 #define RVE_IOW(nr, type) _IOW(RVE_IOC_MAGIC, nr, type) 16 #define RVE_IOR(nr, type) _IOR(RVE_IOC_MAGIC, nr, type) 17 #define RVE_IOWR(nr, type) _IOWR(RVE_IOC_MAGIC, nr, type) 18 19 #define RVE_IOC_GET_VER RVE_IOR(0x1, struct rve_version_t) 20 #define RVE_IOC_GET_HW_VER RVE_IOR(0x2, struct rve_hw_versions_t) 21 #define RVE_IOC_IMPORT_BUFFER RVE_IOWR(0x3, struct rve_buffer_pool) 22 #define RVE_IOC_RELEASE_BUFFER RVE_IOW(0x4, struct rve_buffer_pool) 23 24 #define RVE_IOC_START_CONFIG RVE_IOR(0x5, uint32_t) 25 #define RVE_IOC_END_CONFIG RVE_IOWR(0x6, struct rve_user_ctx_t) 26 #define RVE_IOC_CMD_CONFIG RVE_IOWR(0x7, struct rve_user_ctx_t) 27 #define RVE_IOC_CANCEL_CONFIG RVE_IOWR(0x8, uint32_t) 28 29 #define RVE_CMD_NUM_MAX 10 30 31 #define RVE_BUFFER_POOL_SIZE_MAX 40 32 33 enum rve_memory_type { 34 RVE_DMA_BUFFER = 0, 35 RVE_VIRTUAL_ADDRESS, 36 RVE_PHYSICAL_ADDRESS 37 }; 38 39 #define RVE_SCHED_PRIORITY_DEFAULT 0 40 #define RVE_SCHED_PRIORITY_MAX 6 41 42 #define RVE_VERSION_SIZE 16 43 #define RVE_HW_SIZE 5 44 45 struct rve_version_t { 46 uint32_t major; 47 uint32_t minor; 48 uint32_t revision; 49 uint32_t prod_num; 50 uint8_t str[RVE_VERSION_SIZE]; 51 }; 52 53 struct rve_hw_versions_t { 54 struct rve_version_t version[RVE_HW_SIZE]; 55 uint32_t size; 56 }; 57 58 struct rve_user_ctx_t { 59 uint32_t header; 60 uint64_t regcmd_data; 61 int32_t in_fence_fd; 62 int32_t out_fence_fd; 63 int32_t cmd_num; 64 uint32_t id; 65 uint8_t priority; 66 uint32_t sync_mode; 67 uint32_t disable_auto_cancel; 68 69 uint32_t reserve[31]; 70 }; 71 72 #endif /*_RVE_DRIVER_H_*/ 73