diff options
| author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-05-22 09:31:37 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:59:48 -0400 |
| commit | 447d6fb8ccdc3a581a13fe4b5a62c384dc9fd36a (patch) | |
| tree | 24163c66d1d1f27241c2a5c640175f3f7f42ce31 /Documentation/video4linux/cx2341x | |
| parent | b8d4c235d50f8512bbc9d67730c24da3309b0307 (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.txt | 69 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-decoder-api.txt | 319 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-dma.txt | 94 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-encoder-api.txt | 672 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-memory.txt | 141 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-osd-api.txt | 342 | ||||
| -rw-r--r-- | Documentation/video4linux/cx2341x/fw-upload.txt | 49 |
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 @@ | |||
| 1 | This page describes how to make calls to the firmware api. | ||
| 2 | |||
| 3 | How to call | ||
| 4 | =========== | ||
| 5 | |||
| 6 | The preferred calling convention is known as the firmware mailbox. The | ||
| 7 | mailboxes are basically a fixed length array that serves as the call-stack. | ||
| 8 | |||
| 9 | Firmware mailboxes can be located by searching the encoder and decoder memory | ||
| 10 | for a 16 byte signature. That signature will be located on a 256-byte boundary. | ||
| 11 | |||
| 12 | Signature: | ||
| 13 | 0x78, 0x56, 0x34, 0x12, 0x12, 0x78, 0x56, 0x34, | ||
| 14 | 0x34, 0x12, 0x78, 0x56, 0x56, 0x34, 0x12, 0x78 | ||
| 15 | |||
| 16 | The firmware implements 20 mailboxes of 20 32-bit words. The first 10 are | ||
| 17 | reserved for API calls. The second 10 are used by the firmware for event | ||
| 18 | notification. | ||
| 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 | |||
| 29 | The flags are defined in the following table. The direction is from the | ||
| 30 | perspective 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 | |||
| 39 | The command is a 32-bit enumerator. The API specifics may be found in the | ||
| 40 | fw-*-api.txt documents. | ||
| 41 | |||
| 42 | The return value is a 32-bit enumerator. Only two values are currently defined: | ||
| 43 | 0=success and -1=command undefined. | ||
| 44 | |||
| 45 | There are 16 parameters/results 32-bit fields. The driver populates these fields | ||
| 46 | with values for all the parameters required by the call. The driver overwrites | ||
| 47 | these fields with result values returned by the call. The API specifics may be | ||
| 48 | found in the fw-*-api.txt documents. | ||
| 49 | |||
| 50 | The timeout value protects the card from a hung driver thread. If the driver | ||
| 51 | doesn't handle the completed call within the timeout specified, the firmware | ||
| 52 | will reset that mailbox. | ||
| 53 | |||
| 54 | To make an API call, the driver iterates over each mailbox looking for the | ||
| 55 | first one available (bit 0 has been cleared). The driver sets that bit, fills | ||
| 56 | in the command enumerator, the timeout value and any required parameters. The | ||
| 57 | driver then sets the parameter ready bit (bit 1). The firmware scans the | ||
| 58 | mailboxes for pending commands, processes them, sets the result code, populates | ||
| 59 | the result value array with that call's return values and sets the call | ||
| 60 | complete bit (bit 2). Once bit 2 is set, the driver should retrieve the results | ||
| 61 | and clear all the flags. If the driver does not perform this task within the | ||
| 62 | time set in the timeout register, the firmware will reset that mailbox. | ||
| 63 | |||
| 64 | Event notifications are sent from the firmware to the host. The host tells the | ||
| 65 | firmware which events it is interested in via an API call. That call tells the | ||
| 66 | firmware which notification mailbox to use. The firmware signals the host via | ||
| 67 | an interrupt. Only the 16 Results fields are used, the Flags, Command, Return | ||
| 68 | value 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 @@ | |||
| 1 | Decoder firmware API description | ||
| 2 | ================================ | ||
| 3 | |||
| 4 | Note: this API is part of the decoder firmware, so it's cx23415 only. | ||
| 5 | |||
| 6 | ------------------------------------------------------------------------------- | ||
| 7 | |||
| 8 | Name CX2341X_DEC_PING_FW | ||
| 9 | Enum 0/0x00 | ||
| 10 | Description | ||
| 11 | This API call does nothing. It may be used to check if the firmware | ||
| 12 | is responding. | ||
| 13 | |||
| 14 | ------------------------------------------------------------------------------- | ||
| 15 | |||
| 16 | Name CX2341X_DEC_START_PLAYBACK | ||
| 17 | Enum 1/0x01 | ||
| 18 | Description | ||
| 19 | Begin or resume playback. | ||
| 20 | Param[0] | ||
| 21 | 0 based frame number in GOP to begin playback from. | ||
| 22 | Param[1] | ||
| 23 | Specifies the number of muted audio frames to play before normal | ||
| 24 | audio resumes. | ||
| 25 | |||
| 26 | ------------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | Name CX2341X_DEC_STOP_PLAYBACK | ||
| 29 | Enum 2/0x02 | ||
| 30 | Description | ||
| 31 | Ends playback and clears all decoder buffers. If PTS is not zero, | ||
| 32 | playback stops at specified PTS. | ||
| 33 | Param[0] | ||
| 34 | Display 0=last frame, 1=black | ||
| 35 | Param[1] | ||
| 36 | PTS low | ||
| 37 | Param[2] | ||
| 38 | PTS high | ||
| 39 | |||
| 40 | ------------------------------------------------------------------------------- | ||
| 41 | |||
| 42 | Name CX2341X_DEC_SET_PLAYBACK_SPEED | ||
| 43 | Enum 3/0x03 | ||
| 44 | Description | ||
| 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. | ||
| 51 | Param[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 | ||
| 63 | Param[1] | ||
| 64 | Direction: 0=forward, 1=reverse | ||
| 65 | Param[2] | ||
| 66 | Picture mask: | ||
| 67 | 1=I frames | ||
| 68 | 3=I, P frames | ||
| 69 | 7=I, P, B frames | ||
| 70 | Param[3] | ||
| 71 | B frames per GOP (for reverse play only) | ||
| 72 | Param[4] | ||
| 73 | Mute audio: 0=disable, 1=enable | ||
| 74 | Param[5] | ||
| 75 | Display 0=frame, 1=field | ||
| 76 | Param[6] | ||
| 77 | Specifies the number of muted audio frames to play before normal audio | ||
| 78 | resumes. | ||
| 79 | |||
| 80 | ------------------------------------------------------------------------------- | ||
| 81 | |||
| 82 | Name CX2341X_DEC_STEP_VIDEO | ||
| 83 | Enum 5/0x05 | ||
| 84 | Description | ||
| 85 | Each call to this API steps the playback to the next unit defined below | ||
| 86 | in the current playback direction. | ||
| 87 | Param[0] | ||
| 88 | 0=frame, 1=top field, 2=bottom field | ||
| 89 | |||
| 90 | ------------------------------------------------------------------------------- | ||
| 91 | |||
| 92 | Name CX2341X_DEC_SET_DMA_BLOCK_SIZE | ||
| 93 | Enum 8/0x08 | ||
| 94 | Description | ||
| 95 | Set DMA transfer block size. Counterpart to API 0xC9 | ||
| 96 | Param[0] | ||
| 97 | DMA transfer block size in bytes. A different size may be specified | ||
| 98 | when issuing the DMA transfer command. | ||
| 99 | |||
| 100 | ------------------------------------------------------------------------------- | ||
| 101 | |||
| 102 | Name CX2341X_DEC_GET_XFER_INFO | ||
| 103 | Enum 9/0x09 | ||
| 104 | Description | ||
| 105 | This API call may be used to detect an end of stream condtion. | ||
| 106 | Result[0] | ||
| 107 | Stream type | ||
| 108 | Result[1] | ||
| 109 | Address offset | ||
| 110 | Result[2] | ||
| 111 | Maximum bytes to transfer | ||
| 112 | Result[3] | ||
| 113 | Buffer fullness | ||
| 114 | |||
| 115 | ------------------------------------------------------------------------------- | ||
| 116 | |||
| 117 | Name CX2341X_DEC_GET_DMA_STATUS | ||
| 118 | Enum 10/0x0A | ||
| 119 | Description | ||
| 120 | Status of the last DMA transfer | ||
| 121 | Result[0] | ||
| 122 | Bit 1 set means transfer complete | ||
| 123 | Bit 2 set means DMA error | ||
| 124 | Bit 3 set means linked list error | ||
| 125 | Result[1] | ||
| 126 | DMA type: 0=MPEG, 1=OSD, 2=YUV | ||
| 127 | |||
| 128 | ------------------------------------------------------------------------------- | ||
| 129 | |||
| 130 | Name CX2341X_DEC_SCHED_DMA_FROM_HOST | ||
| 131 | Enum 11/0x0B | ||
| 132 | Description | ||
| 133 | Setup DMA from host operation. Counterpart to API 0xCC | ||
| 134 | Param[0] | ||
| 135 | Memory address of link list | ||
| 136 | Param[1] | ||
| 137 | Total # of bytes to transfer | ||
| 138 | Param[2] | ||
| 139 | DMA type (0=MPEG, 1=OSD, 2=YUV) | ||
| 140 | |||
| 141 | ------------------------------------------------------------------------------- | ||
| 142 | |||
| 143 | Name CX2341X_DEC_PAUSE_PLAYBACK | ||
| 144 | Enum 13/0x0D | ||
| 145 | Description | ||
| 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. | ||
| 149 | Param[0] | ||
| 150 | Display: 0=last frame, 1=black | ||
| 151 | |||
| 152 | ------------------------------------------------------------------------------- | ||
| 153 | |||
| 154 | Name CX2341X_DEC_HALT_FW | ||
| 155 | Enum 14/0x0E | ||
| 156 | Description | ||
| 157 | The firmware is halted and no further API calls are serviced until | ||
| 158 | the firmware is uploaded again. | ||
| 159 | |||
| 160 | ------------------------------------------------------------------------------- | ||
| 161 | |||
| 162 | Name CX2341X_DEC_SET_STANDARD | ||
| 163 | Enum 16/0x10 | ||
| 164 | Description | ||
| 165 | Selects display standard | ||
| 166 | Param[0] | ||
| 167 | 0=NTSC, 1=PAL | ||
| 168 | |||
| 169 | ------------------------------------------------------------------------------- | ||
| 170 | |||
| 171 | Name CX2341X_DEC_GET_VERSION | ||
| 172 | Enum 17/0x11 | ||
| 173 | Description | ||
| 174 | Returns decoder firmware version information | ||
| 175 | Result[0] | ||
| 176 | Version bitmask: | ||
| 177 | Bits 0:15 build | ||
| 178 | Bits 16:23 minor | ||
| 179 | Bits 24:31 major | ||
| 180 | |||
| 181 | ------------------------------------------------------------------------------- | ||
| 182 | |||
| 183 | Name CX2341X_DEC_SET_STREAM_INPUT | ||
| 184 | Enum 20/0x14 | ||
| 185 | Description | ||
| 186 | Select decoder stream input port | ||
| 187 | Param[0] | ||
| 188 | 0=memory (default), 1=streaming | ||
| 189 | |||
| 190 | ------------------------------------------------------------------------------- | ||
| 191 | |||
| 192 | Name CX2341X_DEC_GET_TIMING_INFO | ||
| 193 | Enum 21/0x15 | ||
| 194 | Description | ||
| 195 | Returns timing information from start of playback | ||
| 196 | Result[0] | ||
| 197 | Frame count by decode order | ||
| 198 | Result[1] | ||
| 199 | Video PTS bits 0:31 by display order | ||
| 200 | Result[2] | ||
| 201 | Video PTS bit 32 by display order | ||
| 202 | Result[3] | ||
| 203 | SCR bits 0:31 by display order | ||
| 204 | Result[4] | ||
| 205 | SCR bit 32 by display order | ||
| 206 | |||
| 207 | ------------------------------------------------------------------------------- | ||
| 208 | |||
| 209 | Name CX2341X_DEC_SET_AUDIO_MODE | ||
| 210 | Enum 22/0x16 | ||
| 211 | Description | ||
| 212 | Select audio mode | ||
| 213 | Param[0] | ||
| 214 | Dual mono mode action | ||
| 215 | Param[1] | ||
| 216 | Stereo mode action: | ||
| 217 | 0=Stereo, 1=Left, 2=Right, 3=Mono, 4=Swap, -1=Unchanged | ||
| 218 | |||
| 219 | ------------------------------------------------------------------------------- | ||
| 220 | |||
| 221 | Name CX2341X_DEC_SET_EVENT_NOTIFICATION | ||
| 222 | Enum 23/0x17 | ||
| 223 | Description | ||
| 224 | Setup firmware to notify the host about a particular event. | ||
| 225 | Counterpart to API 0xD5 | ||
| 226 | Param[0] | ||
| 227 | Event: 0=Audio mode change between stereo and dual channel | ||
| 228 | Param[1] | ||
| 229 | Notification 0=disabled, 1=enabled | ||
| 230 | Param[2] | ||
| 231 | Interrupt bit | ||
| 232 | Param[3] | ||
| 233 | Mailbox slot, -1 if no mailbox required. | ||
| 234 | |||
| 235 | ------------------------------------------------------------------------------- | ||
| 236 | |||
| 237 | Name CX2341X_DEC_SET_DISPLAY_BUFFERS | ||
| 238 | Enum 24/0x18 | ||
| 239 | Description | ||
| 240 | Number of display buffers. To decode all frames in reverse playback you | ||
| 241 | must use nine buffers. | ||
| 242 | Param[0] | ||
| 243 | 0=six buffers, 1=nine buffers | ||
| 244 | |||
| 245 | ------------------------------------------------------------------------------- | ||
| 246 | |||
| 247 | Name CX2341X_DEC_EXTRACT_VBI | ||
| 248 | Enum 25/0x19 | ||
| 249 | Description | ||
| 250 | Extracts VBI data | ||
| 251 | Param[0] | ||
| 252 | 0=extract from extension & user data, 1=extract from private packets | ||
| 253 | Result[0] | ||
| 254 | VBI table location | ||
| 255 | Result[1] | ||
| 256 | VBI table size | ||
| 257 | |||
| 258 | ------------------------------------------------------------------------------- | ||
| 259 | |||
| 260 | Name CX2341X_DEC_SET_DECODER_SOURCE | ||
| 261 | Enum 26/0x1A | ||
| 262 | Description | ||
| 263 | Selects decoder source. Ensure that the parameters passed to this | ||
| 264 | API match the encoder settings. | ||
| 265 | Param[0] | ||
| 266 | Mode: 0=MPEG from host, 1=YUV from encoder, 2=YUV from host | ||
| 267 | Param[1] | ||
| 268 | YUV picture width | ||
| 269 | Param[2] | ||
| 270 | YUV picture height | ||
| 271 | Param[3] | ||
| 272 | Bitmap: see Param[0] of API 0xBD | ||
| 273 | |||
| 274 | ------------------------------------------------------------------------------- | ||
| 275 | |||
| 276 | Name CX2341X_DEC_SET_AUDIO_OUTPUT | ||
| 277 | Enum 27/0x1B | ||
| 278 | Description | ||
| 279 | Select audio output format | ||
| 280 | Param[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 | |||
| 304 | Name CX2341X_DEC_SET_AV_DELAY | ||
| 305 | Enum 28/0x1C | ||
| 306 | Description | ||
| 307 | Set audio/video delay in 90Khz ticks | ||
| 308 | Param[0] | ||
| 309 | 0=A/V in sync, negative=audio lags, positive=video lags | ||
| 310 | |||
| 311 | ------------------------------------------------------------------------------- | ||
| 312 | |||
| 313 | Name CX2341X_DEC_SET_PREBUFFERING | ||
| 314 | Enum 30/0x1E | ||
| 315 | Description | ||
| 316 | Decoder prebuffering, when enabled up to 128KB are buffered for | ||
| 317 | streams <8mpbs or 640KB for streams >8mbps | ||
| 318 | Param[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 @@ | |||
| 1 | This page describes the structures and procedures used by the cx2341x DMA | ||
| 2 | engine. | ||
| 3 | |||
| 4 | Introduction | ||
| 5 | ============ | ||
| 6 | |||
| 7 | The cx2341x PCI interface is busmaster capable. This means it has a DMA | ||
| 8 | engine to efficiently transfer large volumes of data between the card and main | ||
| 9 | memory without requiring help from a CPU. Like most hardware, it must operate | ||
| 10 | on contiguous physical memory. This is difficult to come by in large quantities | ||
| 11 | on virtual memory machines. | ||
| 12 | |||
| 13 | Therefore, it also supports a technique called "scatter-gather". The card can | ||
| 14 | transfer multiple buffers in one operation. Instead of allocating one large | ||
| 15 | contiguous buffer, the driver can allocate several smaller buffers. | ||
| 16 | |||
| 17 | In practice, I've seen the average transfer to be roughly 80K, but transfers | ||
| 18 | above 128K were not uncommon, particularly at startup. The 128K figure is | ||
| 19 | important, because that is the largest block that the kernel can normally | ||
| 20 | allocate. Even still, 128K blocks are hard to come by, so the driver writer is | ||
| 21 | urged to choose a smaller block size and learn the scatter-gather technique. | ||
| 22 | |||
| 23 | Mailbox #10 is reserved for DMA transfer information. | ||
| 24 | |||
| 25 | Flow | ||
| 26 | ==== | ||
| 27 | |||
| 28 | This section describes, in general, the order of events when handling DMA | ||
| 29 | transfers. 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 | |||
| 40 | NOTE! It is possible that the Encoder and DMA Complete interrupts get raised | ||
| 41 | simultaneously. (End of the last, start of the next, etc.) | ||
| 42 | |||
| 43 | Mailbox #10 | ||
| 44 | =========== | ||
| 45 | |||
| 46 | The Flags, Command, Return Value and Timeout fields are ignored. | ||
| 47 | |||
| 48 | Name: Mailbox #10 | ||
| 49 | Results[0]: Type: 0: MPEG. | ||
| 50 | Results[1]: Offset: The position relative to the card's memory space. | ||
| 51 | Results[2]: Size: The exact number of bytes to transfer. | ||
| 52 | |||
| 53 | My speculation is that since the StartCapture API has a capture type of "RAW" | ||
| 54 | available, that the type field will have other values that correspond to YUV | ||
| 55 | and PCM data. | ||
| 56 | |||
| 57 | Scatter-Gather Array | ||
| 58 | ==================== | ||
| 59 | |||
| 60 | The scatter-gather array is a contiguously allocated block of memory that | ||
| 61 | tells the card the source and destination of each data-block to transfer. | ||
| 62 | Card "addresses" are derived from the offset supplied by Mailbox #10. Host | ||
| 63 | addresses are the physical memory location of the target DMA buffer. | ||
| 64 | |||
| 65 | Each S-G array element is a struct of three 32-bit words. The first word is | ||
| 66 | the source address, the second is the destination address. Both take up the | ||
| 67 | entire 32 bits. The lowest 16 bits of the third word is the transfer byte | ||
| 68 | count. The high-bit of the third word is the "last" flag. The last-flag tells | ||
| 69 | the card to raise the DMA_DONE interrupt. From hard personal experience, if | ||
| 70 | you forget to set this bit, the card will still "work" but the stream will | ||
| 71 | most likely get corrupted. | ||
| 72 | |||
| 73 | The transfer count must be a multiple of 256. Therefore, the driver will need | ||
| 74 | to track how much data in the target buffer is valid and deal with it | ||
| 75 | accordingly. | ||
| 76 | |||
| 77 | Array 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 | |||
| 84 | DMA Transfer Status | ||
| 85 | =================== | ||
| 86 | |||
| 87 | Register 0x0004 holds the DMA Transfer Status: | ||
| 88 | |||
| 89 | Bit | ||
| 90 | 4 Scatter-Gather array error | ||
| 91 | 3 DMA write error | ||
| 92 | 2 DMA read error | ||
| 93 | 1 write completed | ||
| 94 | 0 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 @@ | |||
| 1 | Encoder firmware API description | ||
| 2 | ================================ | ||
| 3 | |||
| 4 | ------------------------------------------------------------------------------- | ||
| 5 | |||
| 6 | Name CX2341X_ENC_PING_FW | ||
| 7 | Enum 128/0x80 | ||
| 8 | Description | ||
| 9 | Does nothing. Can be used to check if the firmware is responding. | ||
| 10 | |||
| 11 | ------------------------------------------------------------------------------- | ||
| 12 | |||
| 13 | Name CX2341X_ENC_START_CAPTURE | ||
| 14 | Enum 129/0x81 | ||
| 15 | Description | ||
| 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. | ||
| 19 | Param[0] | ||
| 20 | Capture stream type: | ||
| 21 | 0=MPEG | ||
| 22 | 1=Raw | ||
| 23 | 2=Raw passthrough | ||
| 24 | 3=VBI | ||
| 25 | |||
| 26 | Param[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 | |||
| 38 | Name CX2341X_ENC_STOP_CAPTURE | ||
| 39 | Enum 130/0x82 | ||
| 40 | Description | ||
| 41 | Ends a capture in progress | ||
| 42 | Param[0] | ||
| 43 | 0=stop at end of GOP (generates IRQ) | ||
| 44 | 1=stop immediate (no IRQ) | ||
| 45 | Param[1] | ||
| 46 | Stream type to stop, see param[0] of API 0x81 | ||
| 47 | Param[2] | ||
| 48 | Subtype, see param[1] of API 0x81 | ||
| 49 | |||
| 50 | ------------------------------------------------------------------------------- | ||
| 51 | |||
| 52 | Name CX2341X_ENC_SET_AUDIO_ID | ||
| 53 | Enum 137/0x89 | ||
| 54 | Description | ||
| 55 | Assigns the transport stream ID of the encoded audio stream | ||
| 56 | Param[0] | ||
| 57 | Audio Stream ID | ||
| 58 | |||
| 59 | ------------------------------------------------------------------------------- | ||
| 60 | |||
| 61 | Name CX2341X_ENC_SET_VIDEO_ID | ||
| 62 | Enum 139/0x8B | ||
| 63 | Description | ||
| 64 | Set video transport stream ID | ||
| 65 | Param[0] | ||
| 66 | Video stream ID | ||
| 67 | |||
| 68 | ------------------------------------------------------------------------------- | ||
| 69 | |||
| 70 | Name CX2341X_ENC_SET_PCR_ID | ||
| 71 | Enum 141/0x8D | ||
| 72 | Description | ||
| 73 | Assigns the transport stream ID for PCR packets | ||
| 74 | Param[0] | ||
| 75 | PCR Stream ID | ||
| 76 | |||
| 77 | ------------------------------------------------------------------------------- | ||
| 78 | |||
| 79 | Name CX2341X_ENC_SET_FRAME_RATE | ||
| 80 | Enum 143/0x8F | ||
| 81 | Description | ||
| 82 | Set video frames per second. Change occurs at start of new GOP. | ||
| 83 | Param[0] | ||
| 84 | 0=30fps | ||
| 85 | 1=25fps | ||
| 86 | |||
| 87 | ------------------------------------------------------------------------------- | ||
| 88 | |||
| 89 | Name CX2341X_ENC_SET_FRAME_SIZE | ||
| 90 | Enum 145/0x91 | ||
| 91 | Description | ||
| 92 | Select video stream encoding resolution. | ||
| 93 | Param[0] | ||
| 94 | Height in lines. Default 480 | ||
| 95 | Param[1] | ||
| 96 | Width in pixels. Default 720 | ||
| 97 | |||
| 98 | ------------------------------------------------------------------------------- | ||
| 99 | |||
| 100 | Name CX2341X_ENC_SET_BIT_RATE | ||
| 101 | Enum 149/0x95 | ||
| 102 | Description | ||
| 103 | Assign average video stream bitrate. | ||
| 104 | Param[0] | ||
| 105 | 0=variable bitrate, 1=constant bitrate | ||
| 106 | Param[1] | ||
| 107 | bitrate in bits per second | ||
| 108 | Param[2] | ||
| 109 | peak bitrate in bits per second, divided by 400 | ||
| 110 | |||
| 111 | ------------------------------------------------------------------------------- | ||
| 112 | |||
| 113 | Name CX2341X_ENC_SET_GOP_PROPERTIES | ||
| 114 | Enum 151/0x97 | ||
| 115 | Description | ||
| 116 | Setup the GOP structure | ||
| 117 | Param[0] | ||
| 118 | GOP size | ||
| 119 | Param[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 | |||
| 125 | Name CX2341X_ENC_SET_ASPECT_RATIO | ||
| 126 | Enum 153/0x99 | ||
| 127 | Description | ||
| 128 | Sets the encoding aspect ratio. Changes in the aspect ratio take effect | ||
| 129 | at the start of the next GOP. | ||
| 130 | Param[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 | |||
| 142 | Name CX2341X_ENC_SET_DNR_FILTER_MODE | ||
| 143 | Enum 155/0x9B | ||
| 144 | Description | ||
| 145 | Assign Dynamic Noise Reduction operating mode | ||
| 146 | Param[0] | ||
| 147 | Bit0: Spatial filter, set=auto, clear=manual | ||
| 148 | Bit1: Temporal filter, set=auto, clear=manual | ||
| 149 | Param[1] | ||
| 150 | Median filter: | ||
| 151 | 0=Disabled | ||
| 152 | 1=Horizontal | ||
| 153 | 2=Vertical | ||
| 154 | 3=Horiz/Vert | ||
| 155 | 4=Diagonal | ||
| 156 | |||
| 157 | ------------------------------------------------------------------------------- | ||
| 158 | |||
| 159 | Name CX2341X_ENC_SET_DNR_FILTER_PROPS | ||
| 160 | Enum 157/0x9D | ||
| 161 | Description | ||
| 162 | These Dynamic Noise Reduction filter values are only meaningful when | ||
| 163 | the respective filter is set to "manual" (See API 0x9B) | ||
| 164 | Param[0] | ||
| 165 | Spatial filter: default 0, range 0:15 | ||
| 166 | Param[1] | ||
| 167 | Temporal filter: default 0, range 0:31 | ||
| 168 | |||
| 169 | ------------------------------------------------------------------------------- | ||
| 170 | |||
| 171 | Name CX2341X_ENC_SET_CORING_LEVELS | ||
| 172 | Enum 159/0x9F | ||
| 173 | Description | ||
| 174 | Assign Dynamic Noise Reduction median filter properties. | ||
| 175 | Param[0] | ||
| 176 | Threshold above which the luminance median filter is enabled. | ||
| 177 | Default: 0, range 0:255 | ||
| 178 | Param[1] | ||
| 179 | Threshold below which the luminance median filter is enabled. | ||
| 180 | Default: 255, range 0:255 | ||
| 181 | Param[2] | ||
| 182 | Threshold above which the chrominance median filter is enabled. | ||
| 183 | Default: 0, range 0:255 | ||
| 184 | Param[3] | ||
| 185 | Threshold below which the chrominance median filter is enabled. | ||
| 186 | Default: 255, range 0:255 | ||
| 187 | |||
| 188 | ------------------------------------------------------------------------------- | ||
| 189 | |||
| 190 | Name CX2341X_ENC_SET_SPATIAL_FILTER_TYPE | ||
| 191 | Enum 161/0xA1 | ||
| 192 | Description | ||
| 193 | Assign spatial prefilter parameters | ||
| 194 | Param[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 | ||
| 201 | Param[1] | ||
| 202 | Chrominance filter | ||
| 203 | 0=Off | ||
| 204 | 1=1D Horizontal (default) | ||
| 205 | |||
| 206 | ------------------------------------------------------------------------------- | ||
| 207 | |||
| 208 | Name CX2341X_ENC_SET_3_2_PULLDOWN | ||
| 209 | Enum 177/0xB1 | ||
| 210 | Description | ||
| 211 | 3:2 pulldown properties | ||
| 212 | Param[0] | ||
| 213 | 0=enabled | ||
| 214 | 1=disabled | ||
| 215 | |||
| 216 | ------------------------------------------------------------------------------- | ||
| 217 | |||
| 218 | Name CX2341X_ENC_SET_VBI_LINE | ||
| 219 | Enum 183/0xB7 | ||
| 220 | Description | ||
| 221 | Selects VBI line number. | ||
| 222 | Param[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" | ||
| 226 | Param[1] | ||
| 227 | VBI line information features: 0=disabled, 1=enabled | ||
| 228 | Param[2] | ||
| 229 | Slicing: 0=None, 1=Closed Caption | ||
| 230 | Almost certainly not implemented. Set to 0. | ||
| 231 | Param[3] | ||
| 232 | Luminance samples in this line. | ||
| 233 | Almost certainly not implemented. Set to 0. | ||
| 234 | Param[4] | ||
| 235 | Chrominance samples in this line | ||
| 236 | Almost certainly not implemented. Set to 0. | ||
| 237 | |||
| 238 | ------------------------------------------------------------------------------- | ||
| 239 | |||
| 240 | Name CX2341X_ENC_SET_STREAM_TYPE | ||
| 241 | Enum 185/0xB9 | ||
| 242 | Description | ||
| 243 | Assign stream type | ||
| 244 | Param[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 | |||
| 259 | Name CX2341X_ENC_SET_OUTPUT_PORT | ||
| 260 | Enum 187/0xBB | ||
| 261 | Description | ||
| 262 | Assign stream output port (not recommended you change setting from default) | ||
| 263 | Param[0] | ||
| 264 | 0=Memory (default) | ||
| 265 | 1=Streaming | ||
| 266 | 2=Serial | ||
| 267 | |||
| 268 | ------------------------------------------------------------------------------- | ||
| 269 | |||
| 270 | Name CX2341X_ENC_SET_AUDIO_PROPERTIES | ||
| 271 | Enum 189/0xBD | ||
| 272 | Description | ||
| 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. | ||
| 281 | Param[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 | |||
| 345 | Name CX2341X_ENC_HALT_FW | ||
| 346 | Enum 195/0xC3 | ||
| 347 | Description | ||
| 348 | The firmware is halted and no further API calls are serviced until the | ||
| 349 | firmware is uploaded again. | ||
| 350 | |||
| 351 | ------------------------------------------------------------------------------- | ||
| 352 | |||
| 353 | Name CX2341X_ENC_GET_VERSION | ||
| 354 | Enum 196/0xC4 | ||
| 355 | Description | ||
| 356 | Returns the version of the encoder firmware. | ||
| 357 | Result[0] | ||
| 358 | Version bitmask: | ||
| 359 | Bits 0:15 build | ||
| 360 | Bits 16:23 minor | ||
| 361 | Bits 24:31 major | ||
| 362 | |||
| 363 | ------------------------------------------------------------------------------- | ||
| 364 | |||
| 365 | Name CX2341X_ENC_SET_GOP_CLOSURE | ||
| 366 | Enum 197/0xC5 | ||
| 367 | Description | ||
| 368 | Assigns the GOP open/close property. | ||
| 369 | Param[0] | ||
| 370 | 0=Open | ||
| 371 | 1=Closed | ||
| 372 | |||
| 373 | ------------------------------------------------------------------------------- | ||
| 374 | |||
| 375 | Name CX2341X_ENC_GET_SEQ_END | ||
| 376 | Enum 198/0xC6 | ||
| 377 | Description | ||
| 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. | ||
| 382 | Result[0] | ||
| 383 | State of the transfer (1 if last buffer) | ||
| 384 | Result[1] | ||
| 385 | If Result[0] is 1, this contains the size of the last buffer, undefined | ||
| 386 | otherwise. | ||
| 387 | |||
| 388 | ------------------------------------------------------------------------------- | ||
| 389 | |||
| 390 | Name CX2341X_ENC_SET_PGM_INDEX_INFO | ||
| 391 | Enum 199/0xC7 | ||
| 392 | Description | ||
| 393 | Sets the Program Index Information. | ||
| 394 | Param[0] | ||
| 395 | Picture Mask: | ||
| 396 | 0=No index capture | ||
| 397 | 1=I frames | ||
| 398 | 3=I,P frames | ||
| 399 | 7=I,P,B frames | ||
| 400 | Param[1] | ||
| 401 | Elements requested (up to 400) | ||
| 402 | Result[0] | ||
| 403 | Offset in SDF memory of the table. | ||
| 404 | Result[1] | ||
| 405 | Number of allocated elements up to a maximum of Param[1] | ||
| 406 | |||
| 407 | ------------------------------------------------------------------------------- | ||
| 408 | |||
| 409 | Name CX2341X_ENC_SET_VBI_CONFIG | ||
| 410 | Enum 200/0xC8 | ||
| 411 | Description | ||
| 412 | Configure VBI settings | ||
| 413 | Param[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) | ||
| 422 | Param[1] | ||
| 423 | Frames per interrupt (max 8). Only valid in raw mode. | ||
| 424 | Param[2] | ||
| 425 | Total raw VBI frames. Only valid in raw mode. | ||
| 426 | Param[3] | ||
| 427 | Start codes | ||
| 428 | Param[4] | ||
| 429 | Stop codes | ||
| 430 | Param[5] | ||
| 431 | Lines per frame | ||
| 432 | Param[6] | ||
| 433 | Byte per line | ||
| 434 | Result[0] | ||
| 435 | Observed frames per interrupt in raw mode only. Rage 1 to Param[1] | ||
| 436 | Result[1] | ||
| 437 | Observed number of frames in raw mode. Range 1 to Param[2] | ||
| 438 | Result[2] | ||
| 439 | Memory offset to start or raw VBI data | ||
| 440 | |||
| 441 | ------------------------------------------------------------------------------- | ||
| 442 | |||
| 443 | Name CX2341X_ENC_SET_DMA_BLOCK_SIZE | ||
| 444 | Enum 201/0xC9 | ||
| 445 | Description | ||
| 446 | Set DMA transfer block size | ||
| 447 | Param[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. | ||
| 450 | Param[1] | ||
| 451 | Unit: 0=bytes, 1=frames | ||
| 452 | |||
| 453 | ------------------------------------------------------------------------------- | ||
| 454 | |||
| 455 | Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_10 | ||
| 456 | Enum 202/0xCA | ||
| 457 | Description | ||
| 458 | Returns information on the previous DMA transfer in conjunction with | ||
| 459 | bit 27 of the interrupt mask. Uses mailbox 10. | ||
| 460 | Result[0] | ||
| 461 | Type of stream | ||
| 462 | Result[1] | ||
| 463 | Address Offset | ||
| 464 | Result[2] | ||
| 465 | Maximum size of transfer | ||
| 466 | |||
| 467 | ------------------------------------------------------------------------------- | ||
| 468 | |||
| 469 | Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_9 | ||
| 470 | Enum 203/0xCB | ||
| 471 | Description | ||
| 472 | Returns information on the previous DMA transfer in conjunction with | ||
| 473 | bit 27 of the interrupt mask. Uses mailbox 9. | ||
| 474 | Result[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 | ||
| 479 | Result[1] | ||
| 480 | DMA type | ||
| 481 | Result[2] | ||
| 482 | Presentation Time Stamp bits 0..31 | ||
| 483 | Result[3] | ||
| 484 | Presentation Time Stamp bit 32 | ||
| 485 | |||
| 486 | ------------------------------------------------------------------------------- | ||
| 487 | |||
| 488 | Name CX2341X_ENC_SCHED_DMA_TO_HOST | ||
| 489 | Enum 204/0xCC | ||
| 490 | Description | ||
| 491 | Setup DMA to host operation | ||
| 492 | Param[0] | ||
| 493 | Memory address of link list | ||
| 494 | Param[1] | ||
| 495 | Length of link list (wtf: what units ???) | ||
| 496 | Param[2] | ||
| 497 | DMA type (0=MPEG) | ||
| 498 | |||
| 499 | ------------------------------------------------------------------------------- | ||
| 500 | |||
| 501 | Name CX2341X_ENC_INITIALIZE_INPUT | ||
| 502 | Enum 205/0xCD | ||
| 503 | Description | ||
| 504 | Initializes the video input | ||
| 505 | |||
| 506 | ------------------------------------------------------------------------------- | ||
| 507 | |||
| 508 | Name CX2341X_ENC_SET_FRAME_DROP_RATE | ||
| 509 | Enum 208/0xD0 | ||
| 510 | Description | ||
| 511 | For each frame captured, skip specified number of frames. | ||
| 512 | Param[0] | ||
| 513 | Number of frames to skip | ||
| 514 | |||
| 515 | ------------------------------------------------------------------------------- | ||
| 516 | |||
| 517 | Name CX2341X_ENC_PAUSE_ENCODER | ||
| 518 | Enum 210/0xD2 | ||
| 519 | Description | ||
| 520 | During a pause condition, all frames are dropped instead of being encoded. | ||
| 521 | Param[0] | ||
| 522 | 0=Pause encoding | ||
| 523 | 1=Continue encoding | ||
| 524 | |||
| 525 | ------------------------------------------------------------------------------- | ||
| 526 | |||
| 527 | Name CX2341X_ENC_REFRESH_INPUT | ||
| 528 | Enum 211/0xD3 | ||
| 529 | Description | ||
| 530 | Refreshes the video input | ||
| 531 | |||
| 532 | ------------------------------------------------------------------------------- | ||
| 533 | |||
| 534 | Name CX2341X_ENC_SET_COPYRIGHT | ||
| 535 | Enum 212/0xD4 | ||
| 536 | Description | ||
| 537 | Sets stream copyright property | ||
| 538 | Param[0] | ||
| 539 | 0=Stream is not copyrighted | ||
| 540 | 1=Stream is copyrighted | ||
| 541 | |||
| 542 | ------------------------------------------------------------------------------- | ||
| 543 | |||
| 544 | Name CX2341X_ENC_SET_EVENT_NOTIFICATION | ||
| 545 | Enum 213/0xD5 | ||
| 546 | Description | ||
| 547 | Setup firmware to notify the host about a particular event. Host must | ||
| 548 | unmask the interrupt bit. | ||
| 549 | Param[0] | ||
| 550 | Event (0=refresh encoder input) | ||
| 551 | Param[1] | ||
| 552 | Notification 0=disabled 1=enabled | ||
| 553 | Param[2] | ||
| 554 | Interrupt bit | ||
| 555 | Param[3] | ||
| 556 | Mailbox slot, -1 if no mailbox required. | ||
| 557 | |||
| 558 | ------------------------------------------------------------------------------- | ||
| 559 | |||
| 560 | Name CX2341X_ENC_SET_NUM_VSYNC_LINES | ||
| 561 | Enum 214/0xD6 | ||
| 562 | Description | ||
| 563 | Depending on the analog video decoder used, this assigns the number | ||
| 564 | of lines for field 1 and 2. | ||
| 565 | Param[0] | ||
| 566 | Field 1 number of lines: | ||
| 567 | 0x00EF for SAA7114 | ||
| 568 | 0x00F0 for SAA7115 | ||
| 569 | 0x0105 for Micronas | ||
| 570 | Param[1] | ||
| 571 | Field 2 number of lines: | ||
| 572 | 0x00EF for SAA7114 | ||
| 573 | 0x00F0 for SAA7115 | ||
| 574 | 0x0106 for Micronas | ||
| 575 | |||
| 576 | ------------------------------------------------------------------------------- | ||
| 577 | |||
| 578 | Name CX2341X_ENC_SET_PLACEHOLDER | ||
| 579 | Enum 215/0xD7 | ||
| 580 | Description | ||
| 581 | Provides a mechanism of inserting custom user data in the MPEG stream. | ||
| 582 | Param[0] | ||
| 583 | 0=extension & user data | ||
| 584 | 1=private packet with stream ID 0xBD | ||
| 585 | Param[1] | ||
| 586 | Rate at which to insert data, in units of frames (for private packet) | ||
| 587 | or GOPs (for ext. & user data) | ||
| 588 | Param[2] | ||
| 589 | Number of data DWORDs (below) to insert | ||
| 590 | Param[3] | ||
| 591 | Custom data 0 | ||
| 592 | Param[4] | ||
| 593 | Custom data 1 | ||
| 594 | Param[5] | ||
| 595 | Custom data 2 | ||
| 596 | Param[6] | ||
| 597 | Custom data 3 | ||
| 598 | Param[7] | ||
| 599 | Custom data 4 | ||
| 600 | Param[8] | ||
| 601 | Custom data 5 | ||
| 602 | Param[9] | ||
| 603 | Custom data 6 | ||
| 604 | Param[10] | ||
| 605 | Custom data 7 | ||
| 606 | Param[11] | ||
| 607 | Custom data 8 | ||
| 608 | |||
| 609 | ------------------------------------------------------------------------------- | ||
| 610 | |||
| 611 | Name CX2341X_ENC_MUTE_VIDEO | ||
| 612 | Enum 217/0xD9 | ||
| 613 | Description | ||
| 614 | Video muting | ||
| 615 | Param[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 | |||
| 626 | Name CX2341X_ENC_MUTE_AUDIO | ||
| 627 | Enum 218/0xDA | ||
| 628 | Description | ||
| 629 | Audio muting | ||
| 630 | Param[0] | ||
| 631 | 0=audio not muted | ||
| 632 | 1=audio muted (produces silent mpeg audio stream) | ||
| 633 | |||
| 634 | ------------------------------------------------------------------------------- | ||
| 635 | |||
| 636 | Name CX2341X_ENC_UNKNOWN | ||
| 637 | Enum 219/0xDB | ||
| 638 | Description | ||
| 639 | Unknown API, it's used by Hauppauge though. | ||
| 640 | Param[0] | ||
| 641 | 0 This is the value Hauppauge uses, Unknown what it means. | ||
| 642 | |||
| 643 | ------------------------------------------------------------------------------- | ||
| 644 | |||
| 645 | Name CX2341X_ENC_MISC | ||
| 646 | Enum 220/0xDC | ||
| 647 | Description | ||
| 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. | ||
| 651 | Param[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 | |||
| 671 | Param[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 @@ | |||
| 1 | This document describes the cx2341x memory map and documents some of the register | ||
| 2 | space. | ||
| 3 | |||
| 4 | Warning! This information was figured out from searching through the memory and | ||
| 5 | registers, this information may not be correct and is certainly not complete, and | ||
| 6 | was not derived from anything more than searching through the memory space with | ||
| 7 | commands like: | ||
| 8 | |||
| 9 | ivtvctl -O min=0x02000000,max=0x020000ff | ||
| 10 | |||
| 11 | So take this as is, I'm always searching for more stuff, it's a large | ||
| 12 | register space :-). | ||
| 13 | |||
| 14 | Memory Map | ||
| 15 | ========== | ||
| 16 | |||
| 17 | The 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 | ||
| 19 | address held in BAR0. | ||
| 20 | |||
| 21 | 0x00000000-0x00ffffff Encoder memory space | ||
| 22 | 0x00000000-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 | |||
| 28 | 0x01000000-0x01ffffff Decoder memory space | ||
| 29 | 0x01000000-0x0103ffff Decode.rom | ||
| 30 | ???-??? MPEG buffers(s) | ||
| 31 | 0x0114b000-0x0115afff Audio.rom (deprecated?) | ||
| 32 | |||
| 33 | 0x02000000-0x0200ffff Register Space | ||
| 34 | |||
| 35 | Registers | ||
| 36 | ========= | ||
| 37 | |||
| 38 | The registers occupy the 64k space starting at the 0x02000000 offset from BAR0. | ||
| 39 | All of these registers are 32 bits wide. | ||
| 40 | |||
| 41 | DMA 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 | |||
| 78 | Memory locations for Encoder Buffers 0x700-0x7ff: | ||
| 79 | |||
| 80 | These registers show offsets of memory locations pertaining to each | ||
| 81 | buffer area used for encoding, have to shift them by <<1 first. | ||
| 82 | |||
| 83 | 0x07F8: Encoder SDRAM refresh | ||
| 84 | 0x07FC: Encoder SDRAM pre-charge | ||
| 85 | |||
| 86 | Memory locations for Decoder Buffers 0x800-0x8ff: | ||
| 87 | |||
| 88 | These registers show offsets of memory locations pertaining to each | ||
| 89 | buffer area used for decoding, have to shift them by <<1 first. | ||
| 90 | |||
| 91 | 0x08F8: Decoder SDRAM refresh | ||
| 92 | 0x08FC: Decoder SDRAM pre-charge | ||
| 93 | |||
| 94 | Other memory locations: | ||
| 95 | |||
| 96 | 0x2800: Video Display Module control | ||
| 97 | 0x2D00: AO (audio output?) control | ||
| 98 | 0x2D24: Bytes Flushed | ||
| 99 | 0x7000: LSB I2C write clock bit (inverted) | ||
| 100 | 0x7004: LSB I2C write data bit (inverted) | ||
| 101 | 0x7008: LSB I2C read clock bit | ||
| 102 | 0x700c: LSB I2C read data bit | ||
| 103 | 0x9008: GPIO get input state | ||
| 104 | 0x900c: GPIO set output state | ||
| 105 | 0x9020: GPIO direction (Bit7 (GPIO 0..7) - 0:input, 1:output) | ||
| 106 | 0x9050: SPU control | ||
| 107 | 0x9054: Reset HW blocks | ||
| 108 | 0x9058: VPU control | ||
| 109 | 0xA018: Bit6: interrupt pending? | ||
| 110 | 0xA064: APU command | ||
| 111 | |||
| 112 | |||
| 113 | Interrupt Status Register | ||
| 114 | ========================= | ||
| 115 | |||
| 116 | The definition of the bits in the interrupt status register 0x0040, and the | ||
| 117 | interrupt mask 0x0048. If a bit is cleared in the mask, then we want our ISR to | ||
| 118 | execute. | ||
| 119 | |||
| 120 | Bit | ||
| 121 | 31 Encoder Start Capture | ||
| 122 | 30 Encoder EOS | ||
| 123 | 29 Encoder VBI capture | ||
| 124 | 28 Encoder Video Input Module reset event | ||
| 125 | 27 Encoder DMA complete | ||
| 126 | 26 | ||
| 127 | 25 Decoder copy protect detection event | ||
| 128 | 24 Decoder audio mode change detection event | ||
| 129 | 23 | ||
| 130 | 22 Decoder data request | ||
| 131 | 21 Decoder I-Frame? done | ||
| 132 | 20 Decoder DMA complete | ||
| 133 | 19 Decoder VBI re-insertion | ||
| 134 | 18 Decoder DMA err (linked-list bad) | ||
| 135 | |||
| 136 | Missing | ||
| 137 | Encoder API call completed | ||
| 138 | Decoder API call completed | ||
| 139 | Encoder API post(?) | ||
| 140 | Decoder API post(?) | ||
| 141 | Decoder 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 @@ | |||
| 1 | OSD firmware API description | ||
| 2 | ============================ | ||
| 3 | |||
| 4 | Note: this API is part of the decoder firmware, so it's cx23415 only. | ||
| 5 | |||
| 6 | ------------------------------------------------------------------------------- | ||
| 7 | |||
| 8 | Name CX2341X_OSD_GET_FRAMEBUFFER | ||
| 9 | Enum 65/0x41 | ||
| 10 | Description | ||
| 11 | Return base and length of contiguous OSD memory. | ||
| 12 | Result[0] | ||
| 13 | OSD base address | ||
| 14 | Result[1] | ||
| 15 | OSD length | ||
| 16 | |||
| 17 | ------------------------------------------------------------------------------- | ||
| 18 | |||
| 19 | Name CX2341X_OSD_GET_PIXEL_FORMAT | ||
| 20 | Enum 66/0x42 | ||
| 21 | Description | ||
| 22 | Query OSD format | ||
| 23 | Result[0] | ||
| 24 | 0=8bit index, 4=AlphaRGB 8:8:8:8 | ||
| 25 | |||
| 26 | ------------------------------------------------------------------------------- | ||
| 27 | |||
| 28 | Name CX2341X_OSD_SET_PIXEL_FORMAT | ||
| 29 | Enum 67/0x43 | ||
| 30 | Description | ||
| 31 | Assign pixel format | ||
| 32 | Param[0] | ||
| 33 | 0=8bit index, 4=AlphaRGB 8:8:8:8 | ||
| 34 | |||
| 35 | ------------------------------------------------------------------------------- | ||
| 36 | |||
| 37 | Name CX2341X_OSD_GET_STATE | ||
| 38 | Enum 68/0x44 | ||
| 39 | Description | ||
| 40 | Query OSD state | ||
| 41 | Result[0] | ||
| 42 | Bit 0 0=off, 1=on | ||
| 43 | Bits 1:2 alpha control | ||
| 44 | Bits 3:5 pixel format | ||
| 45 | |||
| 46 | ------------------------------------------------------------------------------- | ||
| 47 | |||
| 48 | Name CX2341X_OSD_SET_STATE | ||
| 49 | Enum 69/0x45 | ||
| 50 | Description | ||
| 51 | OSD switch | ||
| 52 | Param[0] | ||
| 53 | 0=off, 1=on | ||
| 54 | |||
| 55 | ------------------------------------------------------------------------------- | ||
| 56 | |||
| 57 | Name CX2341X_OSD_GET_OSD_COORDS | ||
| 58 | Enum 70/0x46 | ||
| 59 | Description | ||
| 60 | Retrieve coordinates of OSD area blended with video | ||
| 61 | Result[0] | ||
| 62 | OSD buffer address | ||
| 63 | Result[1] | ||
| 64 | Stride in pixels | ||
| 65 | Result[2] | ||
| 66 | Lines in OSD buffer | ||
| 67 | Result[3] | ||
| 68 | Horizontal offset in buffer | ||
| 69 | Result[4] | ||
| 70 | Vertical offset in buffer | ||
| 71 | |||
| 72 | ------------------------------------------------------------------------------- | ||
| 73 | |||
| 74 | Name CX2341X_OSD_SET_OSD_COORDS | ||
| 75 | Enum 71/0x47 | ||
| 76 | Description | ||
| 77 | Assign the coordinates of the OSD area to blend with video | ||
| 78 | Param[0] | ||
| 79 | buffer address | ||
| 80 | Param[1] | ||
| 81 | buffer stride in pixels | ||
| 82 | Param[2] | ||
| 83 | lines in buffer | ||
| 84 | Param[3] | ||
| 85 | horizontal offset | ||
| 86 | Param[4] | ||
| 87 | vertical offset | ||
| 88 | |||
| 89 | ------------------------------------------------------------------------------- | ||
| 90 | |||
| 91 | Name CX2341X_OSD_GET_SCREEN_COORDS | ||
| 92 | Enum 72/0x48 | ||
| 93 | Description | ||
| 94 | Retrieve OSD screen area coordinates | ||
| 95 | Result[0] | ||
| 96 | top left horizontal offset | ||
| 97 | Result[1] | ||
| 98 | top left vertical offset | ||
| 99 | Result[2] | ||
| 100 | bottom right hotizontal offset | ||
| 101 | Result[3] | ||
| 102 | bottom right vertical offset | ||
| 103 | |||
| 104 | ------------------------------------------------------------------------------- | ||
| 105 | |||
| 106 | Name CX2341X_OSD_SET_SCREEN_COORDS | ||
| 107 | Enum 73/0x49 | ||
| 108 | Description | ||
| 109 | Assign the coordinates of the screen area to blend with video | ||
| 110 | Param[0] | ||
| 111 | top left horizontal offset | ||
| 112 | Param[1] | ||
| 113 | top left vertical offset | ||
| 114 | Param[2] | ||
| 115 | bottom left horizontal offset | ||
| 116 | Param[3] | ||
| 117 | bottom left vertical offset | ||
| 118 | |||
| 119 | ------------------------------------------------------------------------------- | ||
| 120 | |||
| 121 | Name CX2341X_OSD_GET_GLOBAL_ALPHA | ||
| 122 | Enum 74/0x4A | ||
| 123 | Description | ||
| 124 | Retrieve OSD global alpha | ||
| 125 | Result[0] | ||
| 126 | global alpha: 0=off, 1=on | ||
| 127 | Result[1] | ||
| 128 | bits 0:7 global alpha | ||
| 129 | |||
| 130 | ------------------------------------------------------------------------------- | ||
| 131 | |||
| 132 | Name CX2341X_OSD_SET_GLOBAL_ALPHA | ||
| 133 | Enum 75/0x4B | ||
| 134 | Description | ||
| 135 | Update global alpha | ||
| 136 | Param[0] | ||
| 137 | global alpha: 0=off, 1=on | ||
| 138 | Param[1] | ||
| 139 | global alpha (8 bits) | ||
| 140 | Param[2] | ||
| 141 | local alpha: 0=on, 1=off | ||
| 142 | |||
| 143 | ------------------------------------------------------------------------------- | ||
| 144 | |||
| 145 | Name CX2341X_OSD_SET_BLEND_COORDS | ||
| 146 | Enum 78/0x4C | ||
| 147 | Description | ||
| 148 | Move start of blending area within display buffer | ||
| 149 | Param[0] | ||
| 150 | horizontal offset in buffer | ||
| 151 | Param[1] | ||
| 152 | vertical offset in buffer | ||
| 153 | |||
| 154 | ------------------------------------------------------------------------------- | ||
| 155 | |||
| 156 | Name CX2341X_OSD_GET_FLICKER_STATE | ||
| 157 | Enum 79/0x4F | ||
| 158 | Description | ||
| 159 | Retrieve flicker reduction module state | ||
| 160 | Result[0] | ||
| 161 | flicker state: 0=off, 1=on | ||
| 162 | |||
| 163 | ------------------------------------------------------------------------------- | ||
| 164 | |||
| 165 | Name CX2341X_OSD_SET_FLICKER_STATE | ||
| 166 | Enum 80/0x50 | ||
| 167 | Description | ||
| 168 | Set flicker reduction module state | ||
| 169 | Param[0] | ||
| 170 | State: 0=off, 1=on | ||
| 171 | |||
| 172 | ------------------------------------------------------------------------------- | ||
| 173 | |||
| 174 | Name CX2341X_OSD_BLT_COPY | ||
| 175 | Enum 82/0x52 | ||
| 176 | Description | ||
| 177 | BLT copy | ||
| 178 | Param[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 | |||
| 196 | Param[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) | ||
| 202 | Param[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 | ||
| 230 | Param[3] | ||
| 231 | width | ||
| 232 | Param[4] | ||
| 233 | height | ||
| 234 | Param[5] | ||
| 235 | destination pixel mask | ||
| 236 | Param[6] | ||
| 237 | destination rectangle start address | ||
| 238 | Param[7] | ||
| 239 | destination stride in dwords | ||
| 240 | Param[8] | ||
| 241 | source stride in dwords | ||
| 242 | Param[9] | ||
| 243 | source rectangle start address | ||
| 244 | |||
| 245 | ------------------------------------------------------------------------------- | ||
| 246 | |||
| 247 | Name CX2341X_OSD_BLT_FILL | ||
| 248 | Enum 83/0x53 | ||
| 249 | Description | ||
| 250 | BLT fill color | ||
| 251 | Param[0] | ||
| 252 | Same as Param[0] on API 0x52 | ||
| 253 | Param[1] | ||
| 254 | Same as Param[1] on API 0x52 | ||
| 255 | Param[2] | ||
| 256 | Same as Param[2] on API 0x52 | ||
| 257 | Param[3] | ||
| 258 | width | ||
| 259 | Param[4] | ||
| 260 | height | ||
| 261 | Param[5] | ||
| 262 | destination pixel mask | ||
| 263 | Param[6] | ||
| 264 | destination rectangle start address | ||
| 265 | Param[7] | ||
| 266 | destination stride in dwords | ||
| 267 | Param[8] | ||
| 268 | color fill value | ||
| 269 | |||
| 270 | ------------------------------------------------------------------------------- | ||
| 271 | |||
| 272 | Name CX2341X_OSD_BLT_TEXT | ||
| 273 | Enum 84/0x54 | ||
| 274 | Description | ||
| 275 | BLT for 8 bit alpha text source | ||
| 276 | Param[0] | ||
| 277 | Same as Param[0] on API 0x52 | ||
| 278 | Param[1] | ||
| 279 | Same as Param[1] on API 0x52 | ||
| 280 | Param[2] | ||
| 281 | Same as Param[2] on API 0x52 | ||
| 282 | Param[3] | ||
| 283 | width | ||
| 284 | Param[4] | ||
| 285 | height | ||
| 286 | Param[5] | ||
| 287 | destination pixel mask | ||
| 288 | Param[6] | ||
| 289 | destination rectangle start address | ||
| 290 | Param[7] | ||
| 291 | destination stride in dwords | ||
| 292 | Param[8] | ||
| 293 | source stride in dwords | ||
| 294 | Param[9] | ||
| 295 | source rectangle start address | ||
| 296 | Param[10] | ||
| 297 | color fill value | ||
| 298 | |||
| 299 | ------------------------------------------------------------------------------- | ||
| 300 | |||
| 301 | Name CX2341X_OSD_SET_FRAMEBUFFER_WINDOW | ||
| 302 | Enum 86/0x56 | ||
| 303 | Description | ||
| 304 | Positions the main output window on the screen. The coordinates must be | ||
| 305 | such that the entire window fits on the screen. | ||
| 306 | Param[0] | ||
| 307 | window width | ||
| 308 | Param[1] | ||
| 309 | window height | ||
| 310 | Param[2] | ||
| 311 | top left window corner horizontal offset | ||
| 312 | Param[3] | ||
| 313 | top left window corner vertical offset | ||
| 314 | |||
| 315 | ------------------------------------------------------------------------------- | ||
| 316 | |||
| 317 | Name CX2341X_OSD_SET_CHROMA_KEY | ||
| 318 | Enum 96/0x60 | ||
| 319 | Description | ||
| 320 | Chroma key switch and color | ||
| 321 | Param[0] | ||
| 322 | state: 0=off, 1=on | ||
| 323 | Param[1] | ||
| 324 | color | ||
| 325 | |||
| 326 | ------------------------------------------------------------------------------- | ||
| 327 | |||
| 328 | Name CX2341X_OSD_GET_ALPHA_CONTENT_INDEX | ||
| 329 | Enum 97/0x61 | ||
| 330 | Description | ||
| 331 | Retrieve alpha content index | ||
| 332 | Result[0] | ||
| 333 | alpha content index, Range 0:15 | ||
| 334 | |||
| 335 | ------------------------------------------------------------------------------- | ||
| 336 | |||
| 337 | Name CX2341X_OSD_SET_ALPHA_CONTENT_INDEX | ||
| 338 | Enum 98/0x62 | ||
| 339 | Description | ||
| 340 | Assign alpha content index | ||
| 341 | Param[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 @@ | |||
| 1 | This document describes how to upload the cx2341x firmware to the card. | ||
| 2 | |||
| 3 | How to find | ||
| 4 | =========== | ||
| 5 | |||
| 6 | See the web pages of the various projects that uses this chip for information | ||
| 7 | on how to obtain the firmware. | ||
| 8 | |||
| 9 | The 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 | |||
| 16 | How 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 | |||
