[media] V4L: soc-camera: make (almost) all client drivers re-usable outside of the...
[deliverable/linux.git] / drivers / media / video / cx25821 / cx25821-video-upstream.h
1 /*
2 * Driver for the Conexant CX25821 PCIe bridge
3 *
4 * Copyright (C) 2009 Conexant Systems Inc.
5 * Authors <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 *
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include <linux/mutex.h>
24 #include <linux/workqueue.h>
25
26 #define OUTPUT_FRMT_656 0
27 #define OPEN_FILE_1 0
28 #define NUM_PROGS 8
29 #define NUM_FRAMES 2
30 #define ODD_FIELD 0
31 #define EVEN_FIELD 1
32 #define TOP_OFFSET 0
33 #define FIFO_DISABLE 0
34 #define FIFO_ENABLE 1
35 #define TEST_FRAMES 5
36 #define END_OF_FILE 0
37 #define IN_PROGRESS 1
38 #define RESET_STATUS -1
39 #define NUM_NO_OPS 5
40
41 /* PAL and NTSC line sizes and number of lines. */
42 #define WIDTH_D1 720
43 #define NTSC_LINES_PER_FRAME 480
44 #define PAL_LINES_PER_FRAME 576
45 #define PAL_LINE_SZ 1440
46 #define Y422_LINE_SZ 1440
47 #define Y411_LINE_SZ 1080
48 #define NTSC_FIELD_HEIGHT 240
49 #define NTSC_ODD_FLD_LINES 241
50 #define PAL_FIELD_HEIGHT 288
51
52 #define FRAME_SIZE_NTSC_Y422 (NTSC_LINES_PER_FRAME * Y422_LINE_SZ)
53 #define FRAME_SIZE_NTSC_Y411 (NTSC_LINES_PER_FRAME * Y411_LINE_SZ)
54 #define FRAME_SIZE_PAL_Y422 (PAL_LINES_PER_FRAME * Y422_LINE_SZ)
55 #define FRAME_SIZE_PAL_Y411 (PAL_LINES_PER_FRAME * Y411_LINE_SZ)
56
57 #define NTSC_DATA_BUF_SZ (Y422_LINE_SZ * NTSC_LINES_PER_FRAME)
58 #define PAL_DATA_BUF_SZ (Y422_LINE_SZ * PAL_LINES_PER_FRAME)
59
60 #define RISC_WRITECR_INSTRUCTION_SIZE 16
61 #define RISC_SYNC_INSTRUCTION_SIZE 4
62 #define JUMP_INSTRUCTION_SIZE 12
63 #define MAXSIZE_NO_OPS 36
64 #define DWORD_SIZE 4
65
66 #define USE_RISC_NOOP_VIDEO 1
67
68 #ifdef USE_RISC_NOOP_VIDEO
69 #define PAL_US_VID_PROG_SIZE \
70 (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
71 RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE + \
72 NUM_NO_OPS * DWORD_SIZE)
73
74 #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
75
76 #define PAL_VID_PROG_SIZE \
77 ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE + \
78 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
79 JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
80
81 #define ODD_FLD_PAL_PROG_SIZE \
82 (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
83 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
84 NUM_NO_OPS * DWORD_SIZE)
85
86 #define ODD_FLD_NTSC_PROG_SIZE \
87 (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE + \
88 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
89 NUM_NO_OPS * DWORD_SIZE)
90
91 #define NTSC_US_VID_PROG_SIZE \
92 ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE + \
93 RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE + \
94 NUM_NO_OPS * DWORD_SIZE)
95
96 #define NTSC_RISC_BUF_SIZE \
97 (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
98
99 #define FRAME1_VID_PROG_SIZE \
100 ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE + \
101 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
102 JUMP_INSTRUCTION_SIZE + 2 * NUM_NO_OPS * DWORD_SIZE)
103
104 #endif
105
106 #ifndef USE_RISC_NOOP_VIDEO
107 #define PAL_US_VID_PROG_SIZE \
108 (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
109 RISC_WRITECR_INSTRUCTION_SIZE + RISC_SYNC_INSTRUCTION_SIZE + \
110 JUMP_INSTRUCTION_SIZE)
111
112 #define PAL_RISC_BUF_SIZE (2 * PAL_US_VID_PROG_SIZE)
113
114 #define PAL_VID_PROG_SIZE \
115 ((PAL_FIELD_HEIGHT * 2) * 3 * DWORD_SIZE + \
116 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
117 JUMP_INSTRUCTION_SIZE)
118
119 #define ODD_FLD_PAL_PROG_SIZE \
120 (PAL_FIELD_HEIGHT * 3 * DWORD_SIZE + \
121 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
122
123 #define ODD_FLD_NTSC_PROG_SIZE \
124 (NTSC_ODD_FLD_LINES * 3 * DWORD_SIZE + \
125 RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE)
126
127 #define NTSC_US_VID_PROG_SIZE \
128 ((NTSC_ODD_FLD_LINES + 1) * 3 * DWORD_SIZE + \
129 RISC_WRITECR_INSTRUCTION_SIZE + JUMP_INSTRUCTION_SIZE)
130
131 #define NTSC_RISC_BUF_SIZE \
132 (2 * (RISC_SYNC_INSTRUCTION_SIZE + NTSC_US_VID_PROG_SIZE))
133
134 #define FRAME1_VID_PROG_SIZE \
135 ((NTSC_ODD_FLD_LINES + NTSC_FIELD_HEIGHT) * 3 * DWORD_SIZE + \
136 2 * RISC_SYNC_INSTRUCTION_SIZE + RISC_WRITECR_INSTRUCTION_SIZE + \
137 JUMP_INSTRUCTION_SIZE)
138
139 #endif
This page took 0.324449 seconds and 5 git commands to generate.