aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/video4linux/cx2341x
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-05-22 09:31:37 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:59:48 -0400
commit447d6fb8ccdc3a581a13fe4b5a62c384dc9fd36a (patch)
tree24163c66d1d1f27241c2a5c640175f3f7f42ce31 /Documentation/video4linux/cx2341x
parentb8d4c235d50f8512bbc9d67730c24da3309b0307 (diff)
V4L/DVB (3809b): Added missing docs at kernel tree
Date: From: Mauro Carvalho Chehab <mchehab@infradead.org> There are some docs at V4L/DVB tree that were never included at kernel. This patch includes those docs. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'Documentation/video4linux/cx2341x')
-rw-r--r--Documentation/video4linux/cx2341x/fw-calling.txt69
-rw-r--r--Documentation/video4linux/cx2341x/fw-decoder-api.txt319
-rw-r--r--Documentation/video4linux/cx2341x/fw-dma.txt94
-rw-r--r--Documentation/video4linux/cx2341x/fw-encoder-api.txt672
-rw-r--r--Documentation/video4linux/cx2341x/fw-memory.txt141
-rw-r--r--Documentation/video4linux/cx2341x/fw-osd-api.txt342
-rw-r--r--Documentation/video4linux/cx2341x/fw-upload.txt49
7 files changed, 1686 insertions, 0 deletions
diff --git a/Documentation/video4linux/cx2341x/fw-calling.txt b/Documentation/video4linux/cx2341x/fw-calling.txt
new file mode 100644
index 000000000000..8d21181de537
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-calling.txt
@@ -0,0 +1,69 @@
1This page describes how to make calls to the firmware api.
2
3How to call
4===========
5
6The preferred calling convention is known as the firmware mailbox. The
7mailboxes are basically a fixed length array that serves as the call-stack.
8
9Firmware mailboxes can be located by searching the encoder and decoder memory
10for a 16 byte signature. That signature will be located on a 256-byte boundary.
11
12Signature:
130x78, 0x56, 0x34, 0x12, 0x12, 0x78, 0x56, 0x34,
140x34, 0x12, 0x78, 0x56, 0x56, 0x34, 0x12, 0x78
15
16The firmware implements 20 mailboxes of 20 32-bit words. The first 10 are
17reserved for API calls. The second 10 are used by the firmware for event
18notification.
19
20 Index Name
21 ----- ----
22 0 Flags
23 1 Command
24 2 Return value
25 3 Timeout
26 4-19 Parameter/Result
27
28
29The flags are defined in the following table. The direction is from the
30perspective of the firmware.
31
32 Bit Direction Purpose
33 --- --------- -------
34 2 O Firmware has processed the command.
35 1 I Driver has finished setting the parameters.
36 0 I Driver is using this mailbox.
37
38
39The command is a 32-bit enumerator. The API specifics may be found in the
40fw-*-api.txt documents.
41
42The return value is a 32-bit enumerator. Only two values are currently defined:
430=success and -1=command undefined.
44
45There are 16 parameters/results 32-bit fields. The driver populates these fields
46with values for all the parameters required by the call. The driver overwrites
47these fields with result values returned by the call. The API specifics may be
48found in the fw-*-api.txt documents.
49
50The timeout value protects the card from a hung driver thread. If the driver
51doesn't handle the completed call within the timeout specified, the firmware
52will reset that mailbox.
53
54To make an API call, the driver iterates over each mailbox looking for the
55first one available (bit 0 has been cleared). The driver sets that bit, fills
56in the command enumerator, the timeout value and any required parameters. The
57driver then sets the parameter ready bit (bit 1). The firmware scans the
58mailboxes for pending commands, processes them, sets the result code, populates
59the result value array with that call's return values and sets the call
60complete bit (bit 2). Once bit 2 is set, the driver should retrieve the results
61and clear all the flags. If the driver does not perform this task within the
62time set in the timeout register, the firmware will reset that mailbox.
63
64Event notifications are sent from the firmware to the host. The host tells the
65firmware which events it is interested in via an API call. That call tells the
66firmware which notification mailbox to use. The firmware signals the host via
67an interrupt. Only the 16 Results fields are used, the Flags, Command, Return
68value and Timeout words are not used.
69
diff --git a/Documentation/video4linux/cx2341x/fw-decoder-api.txt b/Documentation/video4linux/cx2341x/fw-decoder-api.txt
new file mode 100644
index 000000000000..59193b6b5572
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-decoder-api.txt
@@ -0,0 +1,319 @@
1Decoder firmware API description
2================================
3
4Note: this API is part of the decoder firmware, so it's cx23415 only.
5
6-------------------------------------------------------------------------------
7
8Name CX2341X_DEC_PING_FW
9Enum 0/0x00
10Description
11 This API call does nothing. It may be used to check if the firmware
12 is responding.
13
14-------------------------------------------------------------------------------
15
16Name CX2341X_DEC_START_PLAYBACK
17Enum 1/0x01
18Description
19 Begin or resume playback.
20Param[0]
21 0 based frame number in GOP to begin playback from.
22Param[1]
23 Specifies the number of muted audio frames to play before normal
24 audio resumes.
25
26-------------------------------------------------------------------------------
27
28Name CX2341X_DEC_STOP_PLAYBACK
29Enum 2/0x02
30Description
31 Ends playback and clears all decoder buffers. If PTS is not zero,
32 playback stops at specified PTS.
33Param[0]
34 Display 0=last frame, 1=black
35Param[1]
36 PTS low
37Param[2]
38 PTS high
39
40-------------------------------------------------------------------------------
41
42Name CX2341X_DEC_SET_PLAYBACK_SPEED
43Enum 3/0x03
44Description
45 Playback stream at speed other than normal. There are two modes of
46 operation:
47 Smooth: host transfers entire stream and firmware drops unused
48 frames.
49 Coarse: host drops frames based on indexing as required to achieve
50 desired speed.
51Param[0]
52 Bitmap:
53 0:7 0 normal
54 1 fast only "1.5 times"
55 n nX fast, 1/nX slow
56 30 Framedrop:
57 '0' during 1.5 times play, every other B frame is dropped
58 '1' during 1.5 times play, stream is unchanged (bitrate
59 must not exceed 8mbps)
60 31 Speed:
61 '0' slow
62 '1' fast
63Param[1]
64 Direction: 0=forward, 1=reverse
65Param[2]
66 Picture mask:
67 1=I frames
68 3=I, P frames
69 7=I, P, B frames
70Param[3]
71 B frames per GOP (for reverse play only)
72Param[4]
73 Mute audio: 0=disable, 1=enable
74Param[5]
75 Display 0=frame, 1=field
76Param[6]
77 Specifies the number of muted audio frames to play before normal audio
78 resumes.
79
80-------------------------------------------------------------------------------
81
82Name CX2341X_DEC_STEP_VIDEO
83Enum 5/0x05
84Description
85 Each call to this API steps the playback to the next unit defined below
86 in the current playback direction.
87Param[0]
88 0=frame, 1=top field, 2=bottom field
89
90-------------------------------------------------------------------------------
91
92Name CX2341X_DEC_SET_DMA_BLOCK_SIZE
93Enum 8/0x08
94Description
95 Set DMA transfer block size. Counterpart to API 0xC9
96Param[0]
97 DMA transfer block size in bytes. A different size may be specified
98 when issuing the DMA transfer command.
99
100-------------------------------------------------------------------------------
101
102Name CX2341X_DEC_GET_XFER_INFO
103Enum 9/0x09
104Description
105 This API call may be used to detect an end of stream condtion.
106Result[0]
107 Stream type
108Result[1]
109 Address offset
110Result[2]
111 Maximum bytes to transfer
112Result[3]
113 Buffer fullness
114
115-------------------------------------------------------------------------------
116
117Name CX2341X_DEC_GET_DMA_STATUS
118Enum 10/0x0A
119Description
120 Status of the last DMA transfer
121Result[0]
122 Bit 1 set means transfer complete
123 Bit 2 set means DMA error
124 Bit 3 set means linked list error
125Result[1]
126 DMA type: 0=MPEG, 1=OSD, 2=YUV
127
128-------------------------------------------------------------------------------
129
130Name CX2341X_DEC_SCHED_DMA_FROM_HOST
131Enum 11/0x0B
132Description
133 Setup DMA from host operation. Counterpart to API 0xCC
134Param[0]
135 Memory address of link list
136Param[1]
137 Total # of bytes to transfer
138Param[2]
139 DMA type (0=MPEG, 1=OSD, 2=YUV)
140
141-------------------------------------------------------------------------------
142
143Name CX2341X_DEC_PAUSE_PLAYBACK
144Enum 13/0x0D
145Description
146 Freeze playback immediately. In this mode, when internal buffers are
147 full, no more data will be accepted and data request IRQs will be
148 masked.
149Param[0]
150 Display: 0=last frame, 1=black
151
152-------------------------------------------------------------------------------
153
154Name CX2341X_DEC_HALT_FW
155Enum 14/0x0E
156Description
157 The firmware is halted and no further API calls are serviced until
158 the firmware is uploaded again.
159
160-------------------------------------------------------------------------------
161
162Name CX2341X_DEC_SET_STANDARD
163Enum 16/0x10
164Description
165 Selects display standard
166Param[0]
167 0=NTSC, 1=PAL
168
169-------------------------------------------------------------------------------
170
171Name CX2341X_DEC_GET_VERSION
172Enum 17/0x11
173Description
174 Returns decoder firmware version information
175Result[0]
176 Version bitmask:
177 Bits 0:15 build
178 Bits 16:23 minor
179 Bits 24:31 major
180
181-------------------------------------------------------------------------------
182
183Name CX2341X_DEC_SET_STREAM_INPUT
184Enum 20/0x14
185Description
186 Select decoder stream input port
187Param[0]
188 0=memory (default), 1=streaming
189
190-------------------------------------------------------------------------------
191
192Name CX2341X_DEC_GET_TIMING_INFO
193Enum 21/0x15
194Description
195 Returns timing information from start of playback
196Result[0]
197 Frame count by decode order
198Result[1]
199 Video PTS bits 0:31 by display order
200Result[2]
201 Video PTS bit 32 by display order
202Result[3]
203 SCR bits 0:31 by display order
204Result[4]
205 SCR bit 32 by display order
206
207-------------------------------------------------------------------------------
208
209Name CX2341X_DEC_SET_AUDIO_MODE
210Enum 22/0x16
211Description
212 Select audio mode
213Param[0]
214 Dual mono mode action
215Param[1]
216 Stereo mode action:
217 0=Stereo, 1=Left, 2=Right, 3=Mono, 4=Swap, -1=Unchanged
218
219-------------------------------------------------------------------------------
220
221Name CX2341X_DEC_SET_EVENT_NOTIFICATION
222Enum 23/0x17
223Description
224 Setup firmware to notify the host about a particular event.
225 Counterpart to API 0xD5
226Param[0]
227 Event: 0=Audio mode change between stereo and dual channel
228Param[1]
229 Notification 0=disabled, 1=enabled
230Param[2]
231 Interrupt bit
232Param[3]
233 Mailbox slot, -1 if no mailbox required.
234
235-------------------------------------------------------------------------------
236
237Name CX2341X_DEC_SET_DISPLAY_BUFFERS
238Enum 24/0x18
239Description
240 Number of display buffers. To decode all frames in reverse playback you
241 must use nine buffers.
242Param[0]
243 0=six buffers, 1=nine buffers
244
245-------------------------------------------------------------------------------
246
247Name CX2341X_DEC_EXTRACT_VBI
248Enum 25/0x19
249Description
250 Extracts VBI data
251Param[0]
252 0=extract from extension & user data, 1=extract from private packets
253Result[0]
254 VBI table location
255Result[1]
256 VBI table size
257
258-------------------------------------------------------------------------------
259
260Name CX2341X_DEC_SET_DECODER_SOURCE
261Enum 26/0x1A
262Description
263 Selects decoder source. Ensure that the parameters passed to this
264 API match the encoder settings.
265Param[0]
266 Mode: 0=MPEG from host, 1=YUV from encoder, 2=YUV from host
267Param[1]
268 YUV picture width
269Param[2]
270 YUV picture height
271Param[3]
272 Bitmap: see Param[0] of API 0xBD
273
274-------------------------------------------------------------------------------
275
276Name CX2341X_DEC_SET_AUDIO_OUTPUT
277Enum 27/0x1B
278Description
279 Select audio output format
280Param[0]
281 Bitmask:
282 0:1 Data size:
283 '00' 16 bit
284 '01' 20 bit
285 '10' 24 bit
286 2:7 Unused
287 8:9 Mode:
288 '00' 2 channels
289 '01' 4 channels
290 '10' 6 channels
291 '11' 6 channels with one line data mode
292 (for left justified MSB first mode, 20 bit only)
293 10:11 Unused
294 12:13 Channel format:
295 '00' right justified MSB first mode
296 '01' left justified MSB first mode
297 '10' I2S mode
298 14:15 Unused
299 16:21 Right justify bit count
300 22:31 Unused
301
302-------------------------------------------------------------------------------
303
304Name CX2341X_DEC_SET_AV_DELAY
305Enum 28/0x1C
306Description
307 Set audio/video delay in 90Khz ticks
308Param[0]
309 0=A/V in sync, negative=audio lags, positive=video lags
310
311-------------------------------------------------------------------------------
312
313Name CX2341X_DEC_SET_PREBUFFERING
314Enum 30/0x1E
315Description
316 Decoder prebuffering, when enabled up to 128KB are buffered for
317 streams <8mpbs or 640KB for streams >8mbps
318Param[0]
319 0=off, 1=on
diff --git a/Documentation/video4linux/cx2341x/fw-dma.txt b/Documentation/video4linux/cx2341x/fw-dma.txt
new file mode 100644
index 000000000000..8123e262d5b6
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-dma.txt
@@ -0,0 +1,94 @@
1This page describes the structures and procedures used by the cx2341x DMA
2engine.
3
4Introduction
5============
6
7The cx2341x PCI interface is busmaster capable. This means it has a DMA
8engine to efficiently transfer large volumes of data between the card and main
9memory without requiring help from a CPU. Like most hardware, it must operate
10on contiguous physical memory. This is difficult to come by in large quantities
11on virtual memory machines.
12
13Therefore, it also supports a technique called "scatter-gather". The card can
14transfer multiple buffers in one operation. Instead of allocating one large
15contiguous buffer, the driver can allocate several smaller buffers.
16
17In practice, I've seen the average transfer to be roughly 80K, but transfers
18above 128K were not uncommon, particularly at startup. The 128K figure is
19important, because that is the largest block that the kernel can normally
20allocate. Even still, 128K blocks are hard to come by, so the driver writer is
21urged to choose a smaller block size and learn the scatter-gather technique.
22
23Mailbox #10 is reserved for DMA transfer information.
24
25Flow
26====
27
28This section describes, in general, the order of events when handling DMA
29transfers. Detailed information follows this section.
30
31- The card raises the Encoder interrupt.
32- The driver reads the transfer type, offset and size from Mailbox #10.
33- The driver constructs the scatter-gather array from enough free dma buffers
34 to cover the size.
35- The driver schedules the DMA transfer via the ScheduleDMAtoHost API call.
36- The card raises the DMA Complete interrupt.
37- The driver checks the DMA status register for any errors.
38- The driver post-processes the newly transferred buffers.
39
40NOTE! It is possible that the Encoder and DMA Complete interrupts get raised
41simultaneously. (End of the last, start of the next, etc.)
42
43Mailbox #10
44===========
45
46The Flags, Command, Return Value and Timeout fields are ignored.
47
48Name: Mailbox #10
49Results[0]: Type: 0: MPEG.
50Results[1]: Offset: The position relative to the card's memory space.
51Results[2]: Size: The exact number of bytes to transfer.
52
53My speculation is that since the StartCapture API has a capture type of "RAW"
54available, that the type field will have other values that correspond to YUV
55and PCM data.
56
57Scatter-Gather Array
58====================
59
60The scatter-gather array is a contiguously allocated block of memory that
61tells the card the source and destination of each data-block to transfer.
62Card "addresses" are derived from the offset supplied by Mailbox #10. Host
63addresses are the physical memory location of the target DMA buffer.
64
65Each S-G array element is a struct of three 32-bit words. The first word is
66the source address, the second is the destination address. Both take up the
67entire 32 bits. The lowest 16 bits of the third word is the transfer byte
68count. The high-bit of the third word is the "last" flag. The last-flag tells
69the card to raise the DMA_DONE interrupt. From hard personal experience, if
70you forget to set this bit, the card will still "work" but the stream will
71most likely get corrupted.
72
73The transfer count must be a multiple of 256. Therefore, the driver will need
74to track how much data in the target buffer is valid and deal with it
75accordingly.
76
77Array Element:
78
79- 32-bit Source Address
80- 32-bit Destination Address
81- 16-bit reserved (high bit is the last flag)
82- 16-bit byte count
83
84DMA Transfer Status
85===================
86
87Register 0x0004 holds the DMA Transfer Status:
88
89Bit
904 Scatter-Gather array error
913 DMA write error
922 DMA read error
931 write completed
940 read completed
diff --git a/Documentation/video4linux/cx2341x/fw-encoder-api.txt b/Documentation/video4linux/cx2341x/fw-encoder-api.txt
new file mode 100644
index 000000000000..64cd111349ad
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-encoder-api.txt
@@ -0,0 +1,672 @@
1Encoder firmware API description
2================================
3
4-------------------------------------------------------------------------------
5
6Name CX2341X_ENC_PING_FW
7Enum 128/0x80
8Description
9 Does nothing. Can be used to check if the firmware is responding.
10
11-------------------------------------------------------------------------------
12
13Name CX2341X_ENC_START_CAPTURE
14Enum 129/0x81
15Description
16 Commences the capture of video, audio and/or VBI data. All encoding
17 parameters must be initialized prior to this API call. Captures frames
18 continuously or until a predefined number of frames have been captured.
19Param[0]
20 Capture stream type:
21 0=MPEG
22 1=Raw
23 2=Raw passthrough
24 3=VBI
25
26Param[1]
27 Bitmask:
28 Bit 0 when set, captures YUV
29 Bit 1 when set, captures PCM audio
30 Bit 2 when set, captures VBI (same as param[0]=3)
31 Bit 3 when set, the capture destination is the decoder
32 (same as param[0]=2)
33 Bit 4 when set, the capture destination is the host
34 Note: this parameter is only meaningful for RAW capture type.
35
36-------------------------------------------------------------------------------
37
38Name CX2341X_ENC_STOP_CAPTURE
39Enum 130/0x82
40Description
41 Ends a capture in progress
42Param[0]
43 0=stop at end of GOP (generates IRQ)
44 1=stop immediate (no IRQ)
45Param[1]
46 Stream type to stop, see param[0] of API 0x81
47Param[2]
48 Subtype, see param[1] of API 0x81
49
50-------------------------------------------------------------------------------
51
52Name CX2341X_ENC_SET_AUDIO_ID
53Enum 137/0x89
54Description
55 Assigns the transport stream ID of the encoded audio stream
56Param[0]
57 Audio Stream ID
58
59-------------------------------------------------------------------------------
60
61Name CX2341X_ENC_SET_VIDEO_ID
62Enum 139/0x8B
63Description
64 Set video transport stream ID
65Param[0]
66 Video stream ID
67
68-------------------------------------------------------------------------------
69
70Name CX2341X_ENC_SET_PCR_ID
71Enum 141/0x8D
72Description
73 Assigns the transport stream ID for PCR packets
74Param[0]
75 PCR Stream ID
76
77-------------------------------------------------------------------------------
78
79Name CX2341X_ENC_SET_FRAME_RATE
80Enum 143/0x8F
81Description
82 Set video frames per second. Change occurs at start of new GOP.
83Param[0]
84 0=30fps
85 1=25fps
86
87-------------------------------------------------------------------------------
88
89Name CX2341X_ENC_SET_FRAME_SIZE
90Enum 145/0x91
91Description
92 Select video stream encoding resolution.
93Param[0]
94 Height in lines. Default 480
95Param[1]
96 Width in pixels. Default 720
97
98-------------------------------------------------------------------------------
99
100Name CX2341X_ENC_SET_BIT_RATE
101Enum 149/0x95
102Description
103 Assign average video stream bitrate.
104Param[0]
105 0=variable bitrate, 1=constant bitrate
106Param[1]
107 bitrate in bits per second
108Param[2]
109 peak bitrate in bits per second, divided by 400
110
111-------------------------------------------------------------------------------
112
113Name CX2341X_ENC_SET_GOP_PROPERTIES
114Enum 151/0x97
115Description
116 Setup the GOP structure
117Param[0]
118 GOP size
119Param[1]
120 Number of B frames between the I and P frame, plus 1.
121 For example: IBBPBBPBBPBB --> GOP size: 12, number of B frames: 2+1 = 3
122
123-------------------------------------------------------------------------------
124
125Name CX2341X_ENC_SET_ASPECT_RATIO
126Enum 153/0x99
127Description
128 Sets the encoding aspect ratio. Changes in the aspect ratio take effect
129 at the start of the next GOP.
130Param[0]
131 '0000' forbidden
132 '0001' 1:1 square
133 '0010' 4:3
134 '0011' 16:9
135 '0100' 2.21:1
136 '0101' reserved
137 ....
138 '1111' reserved
139
140-------------------------------------------------------------------------------
141
142Name CX2341X_ENC_SET_DNR_FILTER_MODE
143Enum 155/0x9B
144Description
145 Assign Dynamic Noise Reduction operating mode
146Param[0]
147 Bit0: Spatial filter, set=auto, clear=manual
148 Bit1: Temporal filter, set=auto, clear=manual
149Param[1]
150 Median filter:
151 0=Disabled
152 1=Horizontal
153 2=Vertical
154 3=Horiz/Vert
155 4=Diagonal
156
157-------------------------------------------------------------------------------
158
159Name CX2341X_ENC_SET_DNR_FILTER_PROPS
160Enum 157/0x9D
161Description
162 These Dynamic Noise Reduction filter values are only meaningful when
163 the respective filter is set to "manual" (See API 0x9B)
164Param[0]
165 Spatial filter: default 0, range 0:15
166Param[1]
167 Temporal filter: default 0, range 0:31
168
169-------------------------------------------------------------------------------
170
171Name CX2341X_ENC_SET_CORING_LEVELS
172Enum 159/0x9F
173Description
174 Assign Dynamic Noise Reduction median filter properties.
175Param[0]
176 Threshold above which the luminance median filter is enabled.
177 Default: 0, range 0:255
178Param[1]
179 Threshold below which the luminance median filter is enabled.
180 Default: 255, range 0:255
181Param[2]
182 Threshold above which the chrominance median filter is enabled.
183 Default: 0, range 0:255
184Param[3]
185 Threshold below which the chrominance median filter is enabled.
186 Default: 255, range 0:255
187
188-------------------------------------------------------------------------------
189
190Name CX2341X_ENC_SET_SPATIAL_FILTER_TYPE
191Enum 161/0xA1
192Description
193 Assign spatial prefilter parameters
194Param[0]
195 Luminance filter
196 0=Off
197 1=1D Horizontal
198 2=1D Vertical
199 3=2D H/V Separable (default)
200 4=2D Symmetric non-separable
201Param[1]
202 Chrominance filter
203 0=Off
204 1=1D Horizontal (default)
205
206-------------------------------------------------------------------------------
207
208Name CX2341X_ENC_SET_3_2_PULLDOWN
209Enum 177/0xB1
210Description
211 3:2 pulldown properties
212Param[0]
213 0=enabled
214 1=disabled
215
216-------------------------------------------------------------------------------
217
218Name CX2341X_ENC_SET_VBI_LINE
219Enum 183/0xB7
220Description
221 Selects VBI line number.
222Param[0]
223 Bits 0:4 line number
224 Bit 31 0=top_field, 1=bottom_field
225 Bits 0:31 all set specifies "all lines"
226Param[1]
227 VBI line information features: 0=disabled, 1=enabled
228Param[2]
229 Slicing: 0=None, 1=Closed Caption
230 Almost certainly not implemented. Set to 0.
231Param[3]
232 Luminance samples in this line.
233 Almost certainly not implemented. Set to 0.
234Param[4]
235 Chrominance samples in this line
236 Almost certainly not implemented. Set to 0.
237
238-------------------------------------------------------------------------------
239
240Name CX2341X_ENC_SET_STREAM_TYPE
241Enum 185/0xB9
242Description
243 Assign stream type
244Param[0]
245 0=Program stream
246 1=Transport stream
247 2=MPEG1 stream
248 3=PES A/V stream
249 5=PES Video stream
250 7=PES Audio stream
251 10=DVD stream
252 11=VCD stream
253 12=SVCD stream
254 13=DVD_S1 stream
255 14=DVD_S2 stream
256
257-------------------------------------------------------------------------------
258
259Name CX2341X_ENC_SET_OUTPUT_PORT
260Enum 187/0xBB
261Description
262 Assign stream output port (not recommended you change setting from default)
263Param[0]
264 0=Memory (default)
265 1=Streaming
266 2=Serial
267
268-------------------------------------------------------------------------------
269
270Name CX2341X_ENC_SET_AUDIO_PROPERTIES
271Enum 189/0xBD
272Description
273 Set audio stream properties, may be called while encoding is in progress.
274 Note: all bitfields are consistent with ISO11172 documentation except
275 bits 2:3 which ISO docs define as:
276 '11' Layer I
277 '10' Layer II
278 '01' Layer III
279 '00' Undefined
280 This discrepancy may indicate a possible error in the documentation.
281Param[0]
282 Bitmask:
283 0:1 '00' 44.1Khz
284 '01' 48Khz
285 '10' 32Khz
286 '11' reserved
287
288 2:3 '01'=Layer I
289 '10'=Layer II
290
291 4:7 Bitrate:
292 Index | Layer I | Layer II
293 ------+-------------+------------
294 '0000' | free format | free format
295 '0001' | 32 kbit/s | 32 kbit/s
296 '0010' | 64 kbit/s | 48 kbit/s
297 '0011' | 96 kbit/s | 56 kbit/s
298 '0100' | 128 kbit/s | 64 kbit/s
299 '0101' | 160 kbit/s | 80 kbit/s
300 '0110' | 192 kbit/s | 96 kbit/s
301 '0111' | 224 kbit/s | 112 kbit/s
302 '1000' | 256 kbit/s | 128 kbit/s
303 '1001' | 288 kbit/s | 160 kbit/s
304 '1010' | 320 kbit/s | 192 kbit/s
305 '1011' | 352 kbit/s | 224 kbit/s
306 '1100' | 384 kbit/s | 256 kbit/s
307 '1101' | 416 kbit/s | 320 kbit/s
308 '1110' | 448 kbit/s | 384 kbit/s
309 Note: For Layer II, not all combinations of total bitrate
310 and mode are allowed. See ISO11172-3 3-Annex B, Table 3-B.2
311
312 8:9 '00'=Stereo
313 '01'=JointStereo
314 '10'=Dual
315 '11'=Mono
316
317 10:11 Mode Extension used in joint_stereo mode.
318 In Layer I and II they indicate which subbands are in
319 intensity_stereo. All other subbands are coded in stereo.
320 '00' subbands 4-31 in intensity_stereo, bound==4
321 '01' subbands 8-31 in intensity_stereo, bound==8
322 '10' subbands 12-31 in intensity_stereo, bound==12
323 '11' subbands 16-31 in intensity_stereo, bound==16
324
325 12:13 Emphasis:
326 '00' None
327 '01' 50/15uS
328 '10' reserved
329 '11' CCITT J.17
330
331 14 CRC:
332 '0' off
333 '1' on
334
335 15 Copyright:
336 '0' off
337 '1' on
338
339 16 Generation:
340 '0' copy
341 '1' original
342
343-------------------------------------------------------------------------------
344
345Name CX2341X_ENC_HALT_FW
346Enum 195/0xC3
347Description
348 The firmware is halted and no further API calls are serviced until the
349 firmware is uploaded again.
350
351-------------------------------------------------------------------------------
352
353Name CX2341X_ENC_GET_VERSION
354Enum 196/0xC4
355Description
356 Returns the version of the encoder firmware.
357Result[0]
358 Version bitmask:
359 Bits 0:15 build
360 Bits 16:23 minor
361 Bits 24:31 major
362
363-------------------------------------------------------------------------------
364
365Name CX2341X_ENC_SET_GOP_CLOSURE
366Enum 197/0xC5
367Description
368 Assigns the GOP open/close property.
369Param[0]
370 0=Open
371 1=Closed
372
373-------------------------------------------------------------------------------
374
375Name CX2341X_ENC_GET_SEQ_END
376Enum 198/0xC6
377Description
378 Obtains the sequence end code of the encoder's buffer. When a capture
379 is started a number of interrupts are still generated, the last of
380 which will have Result[0] set to 1 and Result[1] will contain the size
381 of the buffer.
382Result[0]
383 State of the transfer (1 if last buffer)
384Result[1]
385 If Result[0] is 1, this contains the size of the last buffer, undefined
386 otherwise.
387
388-------------------------------------------------------------------------------
389
390Name CX2341X_ENC_SET_PGM_INDEX_INFO
391Enum 199/0xC7
392Description
393 Sets the Program Index Information.
394Param[0]
395 Picture Mask:
396 0=No index capture
397 1=I frames
398 3=I,P frames
399 7=I,P,B frames
400Param[1]
401 Elements requested (up to 400)
402Result[0]
403 Offset in SDF memory of the table.
404Result[1]
405 Number of allocated elements up to a maximum of Param[1]
406
407-------------------------------------------------------------------------------
408
409Name CX2341X_ENC_SET_VBI_CONFIG
410Enum 200/0xC8
411Description
412 Configure VBI settings
413Param[0]
414 Bitmap:
415 0 Mode '0' Sliced, '1' Raw
416 1:3 Insertion:
417 '000' insert in extension & user data
418 '001' insert in private packets
419 '010' separate stream and user data
420 '111' separate stream and private data
421 8:15 Stream ID (normally 0xBD)
422Param[1]
423 Frames per interrupt (max 8). Only valid in raw mode.
424Param[2]
425 Total raw VBI frames. Only valid in raw mode.
426Param[3]
427 Start codes
428Param[4]
429 Stop codes
430Param[5]
431 Lines per frame
432Param[6]
433 Byte per line
434Result[0]
435 Observed frames per interrupt in raw mode only. Rage 1 to Param[1]
436Result[1]
437 Observed number of frames in raw mode. Range 1 to Param[2]
438Result[2]
439 Memory offset to start or raw VBI data
440
441-------------------------------------------------------------------------------
442
443Name CX2341X_ENC_SET_DMA_BLOCK_SIZE
444Enum 201/0xC9
445Description
446 Set DMA transfer block size
447Param[0]
448 DMA transfer block size in bytes or frames. When unit is bytes,
449 supported block sizes are 2^7, 2^8 and 2^9 bytes.
450Param[1]
451 Unit: 0=bytes, 1=frames
452
453-------------------------------------------------------------------------------
454
455Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_10
456Enum 202/0xCA
457Description
458 Returns information on the previous DMA transfer in conjunction with
459 bit 27 of the interrupt mask. Uses mailbox 10.
460Result[0]
461 Type of stream
462Result[1]
463 Address Offset
464Result[2]
465 Maximum size of transfer
466
467-------------------------------------------------------------------------------
468
469Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_9
470Enum 203/0xCB
471Description
472 Returns information on the previous DMA transfer in conjunction with
473 bit 27 of the interrupt mask. Uses mailbox 9.
474Result[0]
475 Status bits:
476 Bit 0 set indicates transfer complete
477 Bit 2 set indicates transfer error
478 Bit 4 set indicates linked list error
479Result[1]
480 DMA type
481Result[2]
482 Presentation Time Stamp bits 0..31
483Result[3]
484 Presentation Time Stamp bit 32
485
486-------------------------------------------------------------------------------
487
488Name CX2341X_ENC_SCHED_DMA_TO_HOST
489Enum 204/0xCC
490Description
491 Setup DMA to host operation
492Param[0]
493 Memory address of link list
494Param[1]
495 Length of link list (wtf: what units ???)
496Param[2]
497 DMA type (0=MPEG)
498
499-------------------------------------------------------------------------------
500
501Name CX2341X_ENC_INITIALIZE_INPUT
502Enum 205/0xCD
503Description
504 Initializes the video input
505
506-------------------------------------------------------------------------------
507
508Name CX2341X_ENC_SET_FRAME_DROP_RATE
509Enum 208/0xD0
510Description
511 For each frame captured, skip specified number of frames.
512Param[0]
513 Number of frames to skip
514
515-------------------------------------------------------------------------------
516
517Name CX2341X_ENC_PAUSE_ENCODER
518Enum 210/0xD2
519Description
520 During a pause condition, all frames are dropped instead of being encoded.
521Param[0]
522 0=Pause encoding
523 1=Continue encoding
524
525-------------------------------------------------------------------------------
526
527Name CX2341X_ENC_REFRESH_INPUT
528Enum 211/0xD3
529Description
530 Refreshes the video input
531
532-------------------------------------------------------------------------------
533
534Name CX2341X_ENC_SET_COPYRIGHT
535Enum 212/0xD4
536Description
537 Sets stream copyright property
538Param[0]
539 0=Stream is not copyrighted
540 1=Stream is copyrighted
541
542-------------------------------------------------------------------------------
543
544Name CX2341X_ENC_SET_EVENT_NOTIFICATION
545Enum 213/0xD5
546Description
547 Setup firmware to notify the host about a particular event. Host must
548 unmask the interrupt bit.
549Param[0]
550 Event (0=refresh encoder input)
551Param[1]
552 Notification 0=disabled 1=enabled
553Param[2]
554 Interrupt bit
555Param[3]
556 Mailbox slot, -1 if no mailbox required.
557
558-------------------------------------------------------------------------------
559
560Name CX2341X_ENC_SET_NUM_VSYNC_LINES
561Enum 214/0xD6
562Description
563 Depending on the analog video decoder used, this assigns the number
564 of lines for field 1 and 2.
565Param[0]
566 Field 1 number of lines:
567 0x00EF for SAA7114
568 0x00F0 for SAA7115
569 0x0105 for Micronas
570Param[1]
571 Field 2 number of lines:
572 0x00EF for SAA7114
573 0x00F0 for SAA7115
574 0x0106 for Micronas
575
576-------------------------------------------------------------------------------
577
578Name CX2341X_ENC_SET_PLACEHOLDER
579Enum 215/0xD7
580Description
581 Provides a mechanism of inserting custom user data in the MPEG stream.
582Param[0]
583 0=extension & user data
584 1=private packet with stream ID 0xBD
585Param[1]
586 Rate at which to insert data, in units of frames (for private packet)
587 or GOPs (for ext. & user data)
588Param[2]
589 Number of data DWORDs (below) to insert
590Param[3]
591 Custom data 0
592Param[4]
593 Custom data 1
594Param[5]
595 Custom data 2
596Param[6]
597 Custom data 3
598Param[7]
599 Custom data 4
600Param[8]
601 Custom data 5
602Param[9]
603 Custom data 6
604Param[10]
605 Custom data 7
606Param[11]
607 Custom data 8
608
609-------------------------------------------------------------------------------
610
611Name CX2341X_ENC_MUTE_VIDEO
612Enum 217/0xD9
613Description
614 Video muting
615Param[0]
616 Bit usage:
617 0 '0'=video not muted
618 '1'=video muted, creates frames with the YUV color defined below
619 1:7 Unused
620 8:15 V chrominance information
621 16:23 U chrominance information
622 24:31 Y luminance information
623
624-------------------------------------------------------------------------------
625
626Name CX2341X_ENC_MUTE_AUDIO
627Enum 218/0xDA
628Description
629 Audio muting
630Param[0]
631 0=audio not muted
632 1=audio muted (produces silent mpeg audio stream)
633
634-------------------------------------------------------------------------------
635
636Name CX2341X_ENC_UNKNOWN
637Enum 219/0xDB
638Description
639 Unknown API, it's used by Hauppauge though.
640Param[0]
641 0 This is the value Hauppauge uses, Unknown what it means.
642
643-------------------------------------------------------------------------------
644
645Name CX2341X_ENC_MISC
646Enum 220/0xDC
647Description
648 Miscellaneous actions. Not known for 100% what it does. It's really a
649 sort of ioctl call. The first parameter is a command number, the second
650 the value.
651Param[0]
652 Command number:
653 1=set initial SCR value when starting encoding.
654 2=set quality mode (apparently some test setting).
655 3=setup advanced VIM protection handling (supposedly only for the cx23416
656 for raw YUV).
657 Actually it looks like this should be 0 for saa7114/5 based card and 1
658 for cx25840 based cards.
659 4=generate artificial PTS timestamps
660 5=USB flush mode
661 6=something to do with the quantization matrix
662 7=set navigation pack insertion for DVD
663 8=enable scene change detection (seems to be a failure)
664 9=set history parameters of the video input module
665 10=set input field order of VIM
666 11=set quantization matrix
667 12=reset audio interface
668 13=set audio volume delay
669 14=set audio delay
670
671Param[1]
672 Command value.
diff --git a/Documentation/video4linux/cx2341x/fw-memory.txt b/Documentation/video4linux/cx2341x/fw-memory.txt
new file mode 100644
index 000000000000..336d8208ef3b
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-memory.txt
@@ -0,0 +1,141 @@
1This document describes the cx2341x memory map and documents some of the register
2space.
3
4Warning! This information was figured out from searching through the memory and
5registers, this information may not be correct and is certainly not complete, and
6was not derived from anything more than searching through the memory space with
7commands like:
8
9 ivtvctl -O min=0x02000000,max=0x020000ff
10
11So take this as is, I'm always searching for more stuff, it's a large
12register space :-).
13
14Memory Map
15==========
16
17The cx2341x exposes its entire 64M memory space to the PCI host via the PCI BAR0
18(Base Address Register 0). The addresses here are offsets relative to the
19address held in BAR0.
20
210x00000000-0x00ffffff Encoder memory space
220x00000000-0x0003ffff Encode.rom
23 ???-??? MPEG buffer(s)
24 ???-??? Raw video capture buffer(s)
25 ???-??? Raw audio capture buffer(s)
26 ???-??? Display buffers (6 or 9)
27
280x01000000-0x01ffffff Decoder memory space
290x01000000-0x0103ffff Decode.rom
30 ???-??? MPEG buffers(s)
310x0114b000-0x0115afff Audio.rom (deprecated?)
32
330x02000000-0x0200ffff Register Space
34
35Registers
36=========
37
38The registers occupy the 64k space starting at the 0x02000000 offset from BAR0.
39All of these registers are 32 bits wide.
40
41DMA Registers 0x000-0xff:
42
43 0x00 - Control:
44 0=reset/cancel, 1=read, 2=write, 4=stop
45 0x04 - DMA status:
46 1=read busy, 2=write busy, 4=read error, 8=write error, 16=link list error
47 0x08 - pci DMA pointer for read link list
48 0x0c - pci DMA pointer for write link list
49 0x10 - read/write DMA enable:
50 1=read enable, 2=write enable
51 0x14 - always 0xffffffff, if set any lower instability occurs, 0x00 crashes
52 0x18 - ??
53 0x1c - always 0x20 or 32, smaller values slow down DMA transactions
54 0x20 - always value of 0x780a010a
55 0x24-0x3c - usually just random values???
56 0x40 - Interrupt status
57 0x44 - Write a bit here and shows up in Interrupt status 0x40
58 0x48 - Interrupt Mask
59 0x4C - always value of 0xfffdffff,
60 if changed to 0xffffffff DMA write interrupts break.
61 0x50 - always 0xffffffff
62 0x54 - always 0xffffffff (0x4c, 0x50, 0x54 seem like interrupt masks, are
63 3 processors on chip, Java ones, VPU, SPU, APU, maybe these are the
64 interrupt masks???).
65 0x60-0x7C - random values
66 0x80 - first write linked list reg, for Encoder Memory addr
67 0x84 - first write linked list reg, for pci memory addr
68 0x88 - first write linked list reg, for length of buffer in memory addr
69 (|0x80000000 or this for last link)
70 0x8c-0xcc - rest of write linked list reg, 8 sets of 3 total, DMA goes here
71 from linked list addr in reg 0x0c, firmware must push through or
72 something.
73 0xe0 - first (and only) read linked list reg, for pci memory addr
74 0xe4 - first (and only) read linked list reg, for Decoder memory addr
75 0xe8 - first (and only) read linked list reg, for length of buffer
76 0xec-0xff - Nothing seems to be in these registers, 0xec-f4 are 0x00000000.
77
78Memory locations for Encoder Buffers 0x700-0x7ff:
79
80These registers show offsets of memory locations pertaining to each
81buffer area used for encoding, have to shift them by <<1 first.
82
830x07F8: Encoder SDRAM refresh
840x07FC: Encoder SDRAM pre-charge
85
86Memory locations for Decoder Buffers 0x800-0x8ff:
87
88These registers show offsets of memory locations pertaining to each
89buffer area used for decoding, have to shift them by <<1 first.
90
910x08F8: Decoder SDRAM refresh
920x08FC: Decoder SDRAM pre-charge
93
94Other memory locations:
95
960x2800: Video Display Module control
970x2D00: AO (audio output?) control
980x2D24: Bytes Flushed
990x7000: LSB I2C write clock bit (inverted)
1000x7004: LSB I2C write data bit (inverted)
1010x7008: LSB I2C read clock bit
1020x700c: LSB I2C read data bit
1030x9008: GPIO get input state
1040x900c: GPIO set output state
1050x9020: GPIO direction (Bit7 (GPIO 0..7) - 0:input, 1:output)
1060x9050: SPU control
1070x9054: Reset HW blocks
1080x9058: VPU control
1090xA018: Bit6: interrupt pending?
1100xA064: APU command
111
112
113Interrupt Status Register
114=========================
115
116The definition of the bits in the interrupt status register 0x0040, and the
117interrupt mask 0x0048. If a bit is cleared in the mask, then we want our ISR to
118execute.
119
120Bit
12131 Encoder Start Capture
12230 Encoder EOS
12329 Encoder VBI capture
12428 Encoder Video Input Module reset event
12527 Encoder DMA complete
12626
12725 Decoder copy protect detection event
12824 Decoder audio mode change detection event
12923
13022 Decoder data request
13121 Decoder I-Frame? done
13220 Decoder DMA complete
13319 Decoder VBI re-insertion
13418 Decoder DMA err (linked-list bad)
135
136Missing
137Encoder API call completed
138Decoder API call completed
139Encoder API post(?)
140Decoder API post(?)
141Decoder VTRACE event
diff --git a/Documentation/video4linux/cx2341x/fw-osd-api.txt b/Documentation/video4linux/cx2341x/fw-osd-api.txt
new file mode 100644
index 000000000000..da98ae30a37a
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-osd-api.txt
@@ -0,0 +1,342 @@
1OSD firmware API description
2============================
3
4Note: this API is part of the decoder firmware, so it's cx23415 only.
5
6-------------------------------------------------------------------------------
7
8Name CX2341X_OSD_GET_FRAMEBUFFER
9Enum 65/0x41
10Description
11 Return base and length of contiguous OSD memory.
12Result[0]
13 OSD base address
14Result[1]
15 OSD length
16
17-------------------------------------------------------------------------------
18
19Name CX2341X_OSD_GET_PIXEL_FORMAT
20Enum 66/0x42
21Description
22 Query OSD format
23Result[0]
24 0=8bit index, 4=AlphaRGB 8:8:8:8
25
26-------------------------------------------------------------------------------
27
28Name CX2341X_OSD_SET_PIXEL_FORMAT
29Enum 67/0x43
30Description
31 Assign pixel format
32Param[0]
33 0=8bit index, 4=AlphaRGB 8:8:8:8
34
35-------------------------------------------------------------------------------
36
37Name CX2341X_OSD_GET_STATE
38Enum 68/0x44
39Description
40 Query OSD state
41Result[0]
42 Bit 0 0=off, 1=on
43 Bits 1:2 alpha control
44 Bits 3:5 pixel format
45
46-------------------------------------------------------------------------------
47
48Name CX2341X_OSD_SET_STATE
49Enum 69/0x45
50Description
51 OSD switch
52Param[0]
53 0=off, 1=on
54
55-------------------------------------------------------------------------------
56
57Name CX2341X_OSD_GET_OSD_COORDS
58Enum 70/0x46
59Description
60 Retrieve coordinates of OSD area blended with video
61Result[0]
62 OSD buffer address
63Result[1]
64 Stride in pixels
65Result[2]
66 Lines in OSD buffer
67Result[3]
68 Horizontal offset in buffer
69Result[4]
70 Vertical offset in buffer
71
72-------------------------------------------------------------------------------
73
74Name CX2341X_OSD_SET_OSD_COORDS
75Enum 71/0x47
76Description
77 Assign the coordinates of the OSD area to blend with video
78Param[0]
79 buffer address
80Param[1]
81 buffer stride in pixels
82Param[2]
83 lines in buffer
84Param[3]
85 horizontal offset
86Param[4]
87 vertical offset
88
89-------------------------------------------------------------------------------
90
91Name CX2341X_OSD_GET_SCREEN_COORDS
92Enum 72/0x48
93Description
94 Retrieve OSD screen area coordinates
95Result[0]
96 top left horizontal offset
97Result[1]
98 top left vertical offset
99Result[2]
100 bottom right hotizontal offset
101Result[3]
102 bottom right vertical offset
103
104-------------------------------------------------------------------------------
105
106Name CX2341X_OSD_SET_SCREEN_COORDS
107Enum 73/0x49
108Description
109 Assign the coordinates of the screen area to blend with video
110Param[0]
111 top left horizontal offset
112Param[1]
113 top left vertical offset
114Param[2]
115 bottom left horizontal offset
116Param[3]
117 bottom left vertical offset
118
119-------------------------------------------------------------------------------
120
121Name CX2341X_OSD_GET_GLOBAL_ALPHA
122Enum 74/0x4A
123Description
124 Retrieve OSD global alpha
125Result[0]
126 global alpha: 0=off, 1=on
127Result[1]
128 bits 0:7 global alpha
129
130-------------------------------------------------------------------------------
131
132Name CX2341X_OSD_SET_GLOBAL_ALPHA
133Enum 75/0x4B
134Description
135 Update global alpha
136Param[0]
137 global alpha: 0=off, 1=on
138Param[1]
139 global alpha (8 bits)
140Param[2]
141 local alpha: 0=on, 1=off
142
143-------------------------------------------------------------------------------
144
145Name CX2341X_OSD_SET_BLEND_COORDS
146Enum 78/0x4C
147Description
148 Move start of blending area within display buffer
149Param[0]
150 horizontal offset in buffer
151Param[1]
152 vertical offset in buffer
153
154-------------------------------------------------------------------------------
155
156Name CX2341X_OSD_GET_FLICKER_STATE
157Enum 79/0x4F
158Description
159 Retrieve flicker reduction module state
160Result[0]
161 flicker state: 0=off, 1=on
162
163-------------------------------------------------------------------------------
164
165Name CX2341X_OSD_SET_FLICKER_STATE
166Enum 80/0x50
167Description
168 Set flicker reduction module state
169Param[0]
170 State: 0=off, 1=on
171
172-------------------------------------------------------------------------------
173
174Name CX2341X_OSD_BLT_COPY
175Enum 82/0x52
176Description
177 BLT copy
178Param[0]
179'0000' zero
180'0001' ~destination AND ~source
181'0010' ~destination AND source
182'0011' ~destination
183'0100' destination AND ~source
184'0101' ~source
185'0110' destination XOR source
186'0111' ~destination OR ~source
187'1000' ~destination AND ~source
188'1001' destination XNOR source
189'1010' source
190'1011' ~destination OR source
191'1100' destination
192'1101' destination OR ~source
193'1110' destination OR source
194'1111' one
195
196Param[1]
197 Resulting alpha blending
198 '01' source_alpha
199 '10' destination_alpha
200 '11' source_alpha*destination_alpha+1
201 (zero if both source and destination alpha are zero)
202Param[2]
203 '00' output_pixel = source_pixel
204
205 '01' if source_alpha=0:
206 output_pixel = destination_pixel
207 if 256 > source_alpha > 1:
208 output_pixel = ((source_alpha + 1)*source_pixel +
209 (255 - source_alpha)*destination_pixel)/256
210
211 '10' if destination_alpha=0:
212 output_pixel = source_pixel
213 if 255 > destination_alpha > 0:
214 output_pixel = ((255 - destination_alpha)*source_pixel +
215 (destination_alpha + 1)*destination_pixel)/256
216
217 '11' if source_alpha=0:
218 source_temp = 0
219 if source_alpha=255:
220 source_temp = source_pixel*256
221 if 255 > source_alpha > 0:
222 source_temp = source_pixel*(source_alpha + 1)
223 if destination_alpha=0:
224 destination_temp = 0
225 if destination_alpha=255:
226 destination_temp = destination_pixel*256
227 if 255 > destination_alpha > 0:
228 destination_temp = destination_pixel*(destination_alpha + 1)
229 output_pixel = (source_temp + destination_temp)/256
230Param[3]
231 width
232Param[4]
233 height
234Param[5]
235 destination pixel mask
236Param[6]
237 destination rectangle start address
238Param[7]
239 destination stride in dwords
240Param[8]
241 source stride in dwords
242Param[9]
243 source rectangle start address
244
245-------------------------------------------------------------------------------
246
247Name CX2341X_OSD_BLT_FILL
248Enum 83/0x53
249Description
250 BLT fill color
251Param[0]
252 Same as Param[0] on API 0x52
253Param[1]
254 Same as Param[1] on API 0x52
255Param[2]
256 Same as Param[2] on API 0x52
257Param[3]
258 width
259Param[4]
260 height
261Param[5]
262 destination pixel mask
263Param[6]
264 destination rectangle start address
265Param[7]
266 destination stride in dwords
267Param[8]
268 color fill value
269
270-------------------------------------------------------------------------------
271
272Name CX2341X_OSD_BLT_TEXT
273Enum 84/0x54
274Description
275 BLT for 8 bit alpha text source
276Param[0]
277 Same as Param[0] on API 0x52
278Param[1]
279 Same as Param[1] on API 0x52
280Param[2]
281 Same as Param[2] on API 0x52
282Param[3]
283 width
284Param[4]
285 height
286Param[5]
287 destination pixel mask
288Param[6]
289 destination rectangle start address
290Param[7]
291 destination stride in dwords
292Param[8]
293 source stride in dwords
294Param[9]
295 source rectangle start address
296Param[10]
297 color fill value
298
299-------------------------------------------------------------------------------
300
301Name CX2341X_OSD_SET_FRAMEBUFFER_WINDOW
302Enum 86/0x56
303Description
304 Positions the main output window on the screen. The coordinates must be
305 such that the entire window fits on the screen.
306Param[0]
307 window width
308Param[1]
309 window height
310Param[2]
311 top left window corner horizontal offset
312Param[3]
313 top left window corner vertical offset
314
315-------------------------------------------------------------------------------
316
317Name CX2341X_OSD_SET_CHROMA_KEY
318Enum 96/0x60
319Description
320 Chroma key switch and color
321Param[0]
322 state: 0=off, 1=on
323Param[1]
324 color
325
326-------------------------------------------------------------------------------
327
328Name CX2341X_OSD_GET_ALPHA_CONTENT_INDEX
329Enum 97/0x61
330Description
331 Retrieve alpha content index
332Result[0]
333 alpha content index, Range 0:15
334
335-------------------------------------------------------------------------------
336
337Name CX2341X_OSD_SET_ALPHA_CONTENT_INDEX
338Enum 98/0x62
339Description
340 Assign alpha content index
341Param[0]
342 alpha content index, range 0:15
diff --git a/Documentation/video4linux/cx2341x/fw-upload.txt b/Documentation/video4linux/cx2341x/fw-upload.txt
new file mode 100644
index 000000000000..60c502ce3215
--- /dev/null
+++ b/Documentation/video4linux/cx2341x/fw-upload.txt
@@ -0,0 +1,49 @@
1This document describes how to upload the cx2341x firmware to the card.
2
3How to find
4===========
5
6See the web pages of the various projects that uses this chip for information
7on how to obtain the firmware.
8
9The firmware stored in a Windows driver can be detected as follows:
10
11- Each firmware image is 256k bytes.
12- The 1st 32-bit word of the Encoder image is 0x0000da7
13- The 1st 32-bit word of the Decoder image is 0x00003a7
14- The 2nd 32-bit word of both images is 0xaa55bb66
15
16How to load
17===========
18
19- Issue the FWapi command to stop the encoder if it is running. Wait for the
20 command to complete.
21- Issue the FWapi command to stop the decoder if it is running. Wait for the
22 command to complete.
23- Issue the I2C command to the digitizer to stop emitting VSYNC events.
24- Issue the FWapi command to halt the encoder's firmware.
25- Sleep for 10ms.
26- Issue the FWapi command to halt the decoder's firmware.
27- Sleep for 10ms.
28- Write 0x00000000 to register 0x2800 to stop the Video Display Module.
29- Write 0x00000005 to register 0x2D00 to stop the AO (audio output?).
30- Write 0x00000000 to register 0xA064 to ping? the APU.
31- Write 0xFFFFFFFE to register 0x9058 to stop the VPU.
32- Write 0xFFFFFFFF to register 0x9054 to reset the HW blocks.
33- Write 0x00000001 to register 0x9050 to stop the SPU.
34- Sleep for 10ms.
35- Write 0x0000001A to register 0x07FC to init the Encoder SDRAM's pre-charge.
36- Write 0x80000640 to register 0x07F8 to init the Encoder SDRAM's refresh to 1us.
37- Write 0x0000001A to register 0x08FC to init the Decoder SDRAM's pre-charge.
38- Write 0x80000640 to register 0x08F8 to init the Decoder SDRAM's refresh to 1us.
39- Sleep for 512ms. (600ms is recommended)
40- Transfer the encoder's firmware image to offset 0 in Encoder memory space.
41- Transfer the decoder's firmware image to offset 0 in Decoder memory space.
42- Use a read-modify-write operation to Clear bit 0 of register 0x9050 to
43 re-enable the SPU.
44- Sleep for 1 second.
45- Use a read-modify-write operation to Clear bits 3 and 0 of register 0x9058
46 to re-enable the VPU.
47- Sleep for 1 second.
48- Issue status API commands to both firmware images to verify.
49