diff options
author | Russell King <rmk@arm.linux.org.uk> | 2012-10-20 16:16:08 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2012-10-23 11:14:47 +0100 |
commit | 3550ca2f59ae1e5f1d5f33fdfa0b56aa06f9930e (patch) | |
tree | 74dc637f9c5e5b25b127ad3c65f3b1def7789bf4 /uio_vmeta.h | |
parent | 17b3a94e32c4b63099f7564cb9ce9d8a91174efa (diff) |
Add support for /dev/vmeta miscdevice
The kernel folk don't like the uio ioctl idea, so we can't use uio for
this driver. Instead, switch it to be a self-contained miscdevice.
This adds support to this library for the miscdevice interface.
Diffstat (limited to 'uio_vmeta.h')
-rw-r--r-- | uio_vmeta.h | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/uio_vmeta.h b/uio_vmeta.h index d1cef5f..6f262a7 100644 --- a/uio_vmeta.h +++ b/uio_vmeta.h @@ -10,39 +10,60 @@ #define __UIO_VMETA_H typedef unsigned int vmeta_instance_status; -typedef struct _id_instance -{ - vmeta_instance_status status; - int height; - int width; - int frame_rate; - pid_t pid; - unsigned int pt;//pthread_t -}id_instance; + +struct _id_instance { + vmeta_instance_status status; + int height; + int width; + int frame_rate; + pid_t pid; + unsigned int pt; /* pthread_t */ +}; #define MAX_VMETA_INSTANCE 32 -typedef enum _VMETA_LOCK_FLAG{ +enum _VMETA_LOCK_FLAG { VMETA_LOCK_OFF = 0, VMETA_LOCK_ON, VMETA_LOCK_FORCE_INIT -}VMETA_LOCK_FLAG; +}; /* This struct should be aligned with user space API */ -typedef struct _kernel_share -{ +struct _kernel_share { int ref_count; - VMETA_LOCK_FLAG lock_flag; + enum _VMETA_LOCK_FLAG lock_flag; int active_user_id; - id_instance user_id_list[MAX_VMETA_INSTANCE]; -}kernel_share; + struct _id_instance user_id_list[MAX_VMETA_INSTANCE]; +}; + +#ifndef __KERNEL__ +/* + * Needed for userspace + */ +typedef enum _VMETA_LOCK_FLAG VMETA_LOCK_FLAG; +typedef struct _id_instance id_instance; +typedef struct _kernel_share kernel_share; +#endif struct vmeta_lock { unsigned long timeout; unsigned int user_id; }; -#define IOP_MAGIC 'v' +struct vmeta_info { + uint32_t revision; + struct { + uint32_t phys; + uint32_t size; + } map[3]; +}; + +#define VMETA_STATUS_BIT_USED 0 +#define VMETA_STATUS_BIT_REGISTED 1 +#define VMETA_STATUS_USED BIT(0) +#define VMETA_STATUS_REGISTERED BIT(1) + +#define IOP_MAGIC ('v') #define VMETA_CMD_POWER_ON _IO(IOP_MAGIC, 0) #define VMETA_CMD_POWER_OFF _IO(IOP_MAGIC, 1) @@ -65,5 +86,6 @@ struct vmeta_lock { #define VMETA_CMD_UNLOCK_USER_ID _IO(IOP_MAGIC, 18) #define VMETA_CMD_FORCE_INI _IO(IOP_MAGIC, 19) #define VMETA_CMD_GET_USER_NUM _IOR(IOP_MAGIC, 20, unsigned) +#define VMETA_CMD_GET_INFO _IOR(IOP_MAGIC, 21, struct vmeta_info) #endif /* __UIO_VMETA_H */ |