Chirayu Desai | 0a336cc | 2012-07-12 14:37:05 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright@ Samsung Electronics Co. LTD |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _S5P_FIMC_H_ |
| 18 | #define _S5P_FIMC_H_ |
| 19 | |
| 20 | #include <linux/videodev2.h> |
| 21 | |
| 22 | /* |
| 23 | * G E N E R A L S |
| 24 | * |
| 25 | */ |
| 26 | #define MIN(x, y) ((x < y) ? x : y) |
| 27 | |
| 28 | /* |
| 29 | * P I X E L F O R M A T G U I D E |
| 30 | * |
| 31 | * The 'x' means 'DO NOT CARE' |
| 32 | * The '*' means 'FIMC SPECIFIC' |
| 33 | * For some fimc formats, we couldn't find equivalent format in the V4L2 FOURCC. |
| 34 | * |
| 35 | * FIMC TYPE PLANES ORDER V4L2_PIX_FMT |
| 36 | * --------------------------------------------------------- |
| 37 | * RGB565 x x V4L2_PIX_FMT_RGB565 |
| 38 | * RGB888 x x V4L2_PIX_FMT_RGB24 |
| 39 | * YUV420 2 LSB_CBCR V4L2_PIX_FMT_NV12 |
| 40 | * YUV420 2 LSB_CRCB V4L2_PIX_FMT_NV21 |
| 41 | * YUV420 2 MSB_CBCR V4L2_PIX_FMT_NV21X* |
| 42 | * YUV420 2 MSB_CRCB V4L2_PIX_FMT_NV12X* |
| 43 | * YUV420 3 x V4L2_PIX_FMT_YUV420 |
| 44 | * YUV422 1 YCBYCR V4L2_PIX_FMT_YUYV |
| 45 | * YUV422 1 YCRYCB V4L2_PIX_FMT_YVYU |
| 46 | * YUV422 1 CBYCRY V4L2_PIX_FMT_UYVY |
| 47 | * YUV422 1 CRYCBY V4L2_PIX_FMT_VYUY* |
| 48 | * YUV422 2 LSB_CBCR V4L2_PIX_FMT_NV16* |
| 49 | * YUV422 2 LSB_CRCB V4L2_PIX_FMT_NV61* |
| 50 | * YUV422 2 MSB_CBCR V4L2_PIX_FMT_NV16X* |
| 51 | * YUV422 2 MSB_CRCB V4L2_PIX_FMT_NV61X* |
| 52 | * YUV422 3 x V4L2_PIX_FMT_YUV422P |
| 53 | * |
| 54 | */ |
| 55 | |
| 56 | /* |
| 57 | * V 4 L 2 F I M C E X T E N S I O N S |
| 58 | * |
| 59 | */ |
| 60 | #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') |
| 61 | |
| 62 | /* FOURCC for FIMC specific */ |
| 63 | #define V4L2_PIX_FMT_NV12X v4l2_fourcc('N', '1', '2', 'X') |
| 64 | #define V4L2_PIX_FMT_NV21X v4l2_fourcc('N', '2', '1', 'X') |
| 65 | #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') |
| 66 | #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') |
| 67 | #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') |
| 68 | #define V4L2_PIX_FMT_NV16X v4l2_fourcc('N', '1', '6', 'X') |
| 69 | #define V4L2_PIX_FMT_NV61X v4l2_fourcc('N', '6', '1', 'X') |
| 70 | |
| 71 | #define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ |
| 72 | |
| 73 | /* CID extensions */ |
| 74 | #define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) |
| 75 | #define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20) |
| 76 | #define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21) |
| 77 | /* |
| 78 | * U S E R D E F I N E D T Y P E S |
| 79 | * |
| 80 | */ |
| 81 | |
| 82 | typedef unsigned int dma_addr_t; |
| 83 | |
| 84 | struct fimc_buf { |
| 85 | dma_addr_t base[3]; |
| 86 | size_t length[3]; |
| 87 | }; |
| 88 | |
| 89 | struct fimc_buffer { |
| 90 | void *virt_addr; |
| 91 | void *phys_addr; |
| 92 | size_t length; |
| 93 | }; |
| 94 | |
| 95 | struct yuv_fmt_list { |
| 96 | const char *name; |
| 97 | const char *desc; |
| 98 | unsigned int fmt; |
| 99 | int bpp; |
| 100 | int planes; |
| 101 | }; |
| 102 | |
| 103 | struct img_offset { |
| 104 | int y_h; |
| 105 | int y_v; |
| 106 | int cb_h; |
| 107 | int cb_v; |
| 108 | int cr_h; |
| 109 | int cr_v; |
| 110 | }; |
| 111 | |
| 112 | //------------ STRUCT ---------------------------------------------------------// |
| 113 | |
| 114 | typedef struct |
| 115 | { |
| 116 | unsigned int full_width; // Source Image Full Width (Virtual screen size) |
| 117 | unsigned int full_height; // Source Image Full Height (Virtual screen size) |
| 118 | unsigned int start_x; // Source Image Start width offset |
| 119 | unsigned int start_y; // Source Image Start height offset |
| 120 | unsigned int width; // Source Image Width |
| 121 | unsigned int height; // Source Image Height |
| 122 | unsigned int buf_addr_phy_rgb_y; // Base Address of the Source Image (RGB or Y): Physical Address |
| 123 | unsigned int buf_addr_phy_cb; // Base Address of the Source Image (CB Component) : Physical Address |
| 124 | unsigned int buf_addr_phy_cr; // Base Address of the Source Image (CR Component) : Physical Address |
| 125 | unsigned int color_space; // Color Space of the Source Image |
| 126 | } s5p_fimc_img_info; |
| 127 | |
| 128 | typedef struct |
| 129 | { |
| 130 | s5p_fimc_img_info src; |
| 131 | s5p_fimc_img_info dst; |
| 132 | } s5p_fimc_params_t; |
| 133 | |
| 134 | typedef struct _s5p_fimc_t { |
| 135 | int dev_fd; |
| 136 | struct fimc_buffer out_buf; |
| 137 | |
| 138 | s5p_fimc_params_t params; |
| 139 | |
| 140 | int use_ext_out_mem; |
| 141 | unsigned int hw_ver; |
| 142 | }s5p_fimc_t; |
| 143 | |
Chirayu Desai | 0a336cc | 2012-07-12 14:37:05 +0530 | [diff] [blame] | 144 | #endif |