1 /*
2  * g2d_bsp/g2d_bsp.h
3  *
4  * Copyright (c) 2007-2019 Allwinnertech Co., Ltd.
5  * Author: zhengxiaobin <zhengxiaobin@allwinnertech.com>
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  */
17 #ifndef __G2D_BSP_H
18 #define __G2D_BSP_H
19 #include <log.h>
20 
21 #include <stdlib.h>
22 #include <string.h>
23 
24 
25 #include <sunxi_hal_common.h>
26 #include <hal_log.h>
27 #include "g2d_driver.h"
28 #include <hal_mem.h>
29 
30 #define G2D_FINISH_IRQ		(1<<8)
31 #define G2D_ERROR_IRQ			(1<<9)
32 
33 extern __u32 dbg_info;
34 
35 #define G2D_INFO_MSG(fmt, ...) \
36 	do {\
37 		if (dbg_info)\
38 			hal_log_info("g2d: [%s %d]"fmt, __func__, __LINE__, ##__VA_ARGS__);\
39 	} while (0)
40 
41 #define G2D_ERR_MSG(fmt, ...) \
42 	do {\
43 			hal_log_err("g2d: [%s %d]"fmt, __func__, __LINE__, ##__VA_ARGS__);\
44 	} while (0)
45 
46 typedef struct {
47 	unsigned long g2d_base;
48 } g2d_init_para;
49 
50 typedef struct {
51 	g2d_init_para init_para;
52 } g2d_dev_t;
53 
54 typedef enum {
55 	G2D_RGB2YUV_709,
56 	G2D_YUV2RGB_709,
57 	G2D_RGB2YUV_601,
58 	G2D_YUV2RGB_601,
59 	G2D_RGB2YUV_2020,
60 	G2D_YUV2RGB_2020,
61 } g2d_csc_sel;
62 
63 typedef enum {
64 	VSU_FORMAT_YUV422 = 0x00,
65 	VSU_FORMAT_YUV420 = 0x01,
66 	VSU_FORMAT_YUV411 = 0x02,
67 	VSU_FORMAT_RGB = 0x03,
68 	VSU_FORMAT_BUTT = 0x04,
69 } vsu_pixel_format;
70 
71 #define VSU_ZOOM0_SIZE	1
72 #define VSU_ZOOM1_SIZE	8
73 #define VSU_ZOOM2_SIZE	4
74 #define VSU_ZOOM3_SIZE	1
75 #define VSU_ZOOM4_SIZE	1
76 #define VSU_ZOOM5_SIZE	1
77 
78 #define VSU_PHASE_NUM            32
79 #define VSU_PHASE_FRAC_BITWIDTH  19
80 #define VSU_PHASE_FRAC_REG_SHIFT 1
81 #define VSU_FB_FRAC_BITWIDTH     32
82 
83 #define VI_LAYER_NUMBER 1
84 #define UI_LAYER_NUMBER 3
85 
86 
87 #endif	/* __G2D_BSP_H */
88 
89