Files
BPI-CM9-Linux/aml-comp/hardware/amlogic/video_encoder/tahoe_v4l/tahoe.h
T

126 lines
4.2 KiB
C

/*
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Description:
*/
#ifndef __TAHOE_H__
#define __TAHOE_H__
#include <linux/types.h>
#include <linux/version.h>
#include <linux/compat.h>
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 3, 13)
#define KV_CLASS_CONST
#define KV_CLASS_ATTR_CONST
#else
#define KV_CLASS_CONST const //kernel 6.6 change the type of parameter to const
#define KV_CLASS_ATTR_CONST const //kernel 6.6 change the type of parameter to const
#endif
/* Traditionally the remove callback returned an int which however is
* ignored by the driver core. This led to wrong expectations by driver
* authors who thought returning an error code was a valid error
* handling strategy. To convert to a callback returning void, new
* drivers should implement .
*/
#if LINUX_VERSION_CODE <= KERNEL_VERSION(6, 11, 0)
#define KV_INT_TO_VOID int
#define KV_RET_x_TO_VOID(a) (a)
#else
#define KV_INT_TO_VOID void
#define KV_RET_x_TO_VOID(a)
#endif
#define CHIP_ID 0x0
#define MAX_CHANNEL 1
#ifdef CONFIG_COMPAT
struct compat_venc_drv_buffer_t {
u32 size;
u32 cached;
compat_ulong_t phys_addr;
compat_ulong_t base; /* kernel logical address in use kernel */
compat_ulong_t virt_addr; /* virtual user space address */
};
#endif
struct venc_bit_firmware_info_t {
u32 size; /* size of this structure*/
ulong reg_base_offset;
u16 bit_code[512];
};
struct venc_inst_info_t {
u32 inst_idx;
s32 inst_open_count; /* for output only*/
};
struct venc_drv_intr_info_t {
u32 timeout;
s32 intr_reason;
};
#if 0
/* To track the allocated memory buffer */
struct venc_drv_buffer_pool_t {
struct list_head list;
struct venc_drv_buffer_t vb;
struct file *filp;
};
#endif
#define TAHOE_REG_BASE_ADDR 0xFE370000
#define TAHOE_REG_SIZE 0x10000
enum {
IOC_NR_GET_REGISTER_INFO = 0,
IOC_NR_GET_COMMON_BUF_INFO,
IOC_NR_WAIT_INTERRUPT,
IOC_NR_GET_FW_BUF_INFO,
IOC_NR_ALLOCATE_PHYSICAL_MEMORY,
IOC_NR_FLUSH_BUFFER,
IOC_NR_CACHE_INV_BUFFER,
IOC_NR_FOR_DEBUG,
};
#define VENC_DRV_BUF_LEN struct venc_drv_buffer_t
#ifdef CONFIG_COMPAT
#define VENC_DRV_BUF_LEN32 struct compat_venc_drv_buffer_t
#endif
#define TAHOE_MAGIC 'x'
#define IOC_GET_REGISTER_INFO _IO(TAHOE_MAGIC, IOC_NR_GET_REGISTER_INFO)
#define IOC_GET_COMMON_BUF_INFO _IOR(TAHOE_MAGIC, IOC_NR_GET_COMMON_BUF_INFO, VENC_DRV_BUF_LEN)
#define IOC_WAIT_INTERRUPT _IO(TAHOE_MAGIC, IOC_NR_WAIT_INTERRUPT)
#define IOC_GET_FW_BUF_INFO _IOR(TAHOE_MAGIC, IOC_NR_GET_FW_BUF_INFO, VENC_DRV_BUF_LEN)
#define IOC_ALLOCATE_PHYSICAL_MEMORY _IOWR(TAHOE_MAGIC, IOC_NR_ALLOCATE_PHYSICAL_MEMORY, VENC_DRV_BUF_LEN)
#define IOC_FLUSH_BUFFER _IOW(TAHOE_MAGIC, IOC_NR_FLUSH_BUFFER, VENC_DRV_BUF_LEN)
#define IOC_CACHE_INV_BUFFER _IOW(TAHOE_MAGIC, IOC_NR_CACHE_INV_BUFFER, VENC_DRV_BUF_LEN)
#define IOC_NR_FOR_DEBUG _IOR(TAHOE_MAGIC, IOC_NR_FOR_DEBUG, u32)
#ifdef CONFIG_COMPAT
#define IOC_GET_COMMON_BUF_INFO32 _IOR(TAHOE_MAGIC, IOC_NR_GET_COMMON_BUF_INFO, VENC_DRV_BUF_LEN32)
#define IOC_GET_FW_BUF_INFO32 _IOR(TAHOE_MAGIC, IOC_NR_GET_FW_BUF_INFO, VENC_DRV_BUF_LEN32)
#define IOC_ALLOCATE_PHYSICAL_MEMORY32 _IOWR(TAHOE_MAGIC, IOC_NR_ALLOCATE_PHYSICAL_MEMORY, VENC_DRV_BUF_LEN32)
#define IOC_FLUSH_BUFFER32 _IOW(TAHOE_MAGIC, IOC_NR_FLUSH_BUFFER, VENC_DRV_BUF_LEN32)
#define IOC_CACHE_INV_BUFFER32 _IOW(TAHOE_MAGIC, IOC_NR_CACHE_INV_BUFFER, VENC_DRV_BUF_LEN32)
#endif
#endif