cx2341x-devel.rst 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685
  1. .. SPDX-License-Identifier: GPL-2.0
  2. The cx2341x driver
  3. ==================
  4. Memory at cx2341x chips
  5. -----------------------
  6. This section describes the cx2341x memory map and documents some of the
  7. register space.
  8. .. note:: the memory long words are little-endian ('intel format').
  9. .. warning::
  10. This information was figured out from searching through the memory
  11. and registers, this information may not be correct and is certainly
  12. not complete, and was not derived from anything more than searching
  13. through the memory space with commands like:
  14. .. code-block:: none
  15. ivtvctl -O min=0x02000000,max=0x020000ff
  16. So take this as is, I'm always searching for more stuff, it's a large
  17. register space :-).
  18. Memory Map
  19. ~~~~~~~~~~
  20. The cx2341x exposes its entire 64M memory space to the PCI host via the PCI BAR0
  21. (Base Address Register 0). The addresses here are offsets relative to the
  22. address held in BAR0.
  23. .. code-block:: none
  24. 0x00000000-0x00ffffff Encoder memory space
  25. 0x00000000-0x0003ffff Encode.rom
  26. ???-??? MPEG buffer(s)
  27. ???-??? Raw video capture buffer(s)
  28. ???-??? Raw audio capture buffer(s)
  29. ???-??? Display buffers (6 or 9)
  30. 0x01000000-0x01ffffff Decoder memory space
  31. 0x01000000-0x0103ffff Decode.rom
  32. ???-??? MPEG buffers(s)
  33. 0x0114b000-0x0115afff Audio.rom (deprecated?)
  34. 0x02000000-0x0200ffff Register Space
  35. Registers
  36. ~~~~~~~~~
  37. The registers occupy the 64k space starting at the 0x02000000 offset from BAR0.
  38. All of these registers are 32 bits wide.
  39. .. code-block:: none
  40. DMA Registers 0x000-0xff:
  41. 0x00 - Control:
  42. 0=reset/cancel, 1=read, 2=write, 4=stop
  43. 0x04 - DMA status:
  44. 1=read busy, 2=write busy, 4=read error, 8=write error, 16=link list error
  45. 0x08 - pci DMA pointer for read link list
  46. 0x0c - pci DMA pointer for write link list
  47. 0x10 - read/write DMA enable:
  48. 1=read enable, 2=write enable
  49. 0x14 - always 0xffffffff, if set any lower instability occurs, 0x00 crashes
  50. 0x18 - ??
  51. 0x1c - always 0x20 or 32, smaller values slow down DMA transactions
  52. 0x20 - always value of 0x780a010a
  53. 0x24-0x3c - usually just random values???
  54. 0x40 - Interrupt status
  55. 0x44 - Write a bit here and shows up in Interrupt status 0x40
  56. 0x48 - Interrupt Mask
  57. 0x4C - always value of 0xfffdffff,
  58. if changed to 0xffffffff DMA write interrupts break.
  59. 0x50 - always 0xffffffff
  60. 0x54 - always 0xffffffff (0x4c, 0x50, 0x54 seem like interrupt masks, are
  61. 3 processors on chip, Java ones, VPU, SPU, APU, maybe these are the
  62. interrupt masks???).
  63. 0x60-0x7C - random values
  64. 0x80 - first write linked list reg, for Encoder Memory addr
  65. 0x84 - first write linked list reg, for pci memory addr
  66. 0x88 - first write linked list reg, for length of buffer in memory addr
  67. (|0x80000000 or this for last link)
  68. 0x8c-0xdc - rest of write linked list reg, 8 sets of 3 total, DMA goes here
  69. from linked list addr in reg 0x0c, firmware must push through or
  70. something.
  71. 0xe0 - first (and only) read linked list reg, for pci memory addr
  72. 0xe4 - first (and only) read linked list reg, for Decoder memory addr
  73. 0xe8 - first (and only) read linked list reg, for length of buffer
  74. 0xec-0xff - Nothing seems to be in these registers, 0xec-f4 are 0x00000000.
  75. Memory locations for Encoder Buffers 0x700-0x7ff:
  76. These registers show offsets of memory locations pertaining to each
  77. buffer area used for encoding, have to shift them by <<1 first.
  78. - 0x07F8: Encoder SDRAM refresh
  79. - 0x07FC: Encoder SDRAM pre-charge
  80. Memory locations for Decoder Buffers 0x800-0x8ff:
  81. These registers show offsets of memory locations pertaining to each
  82. buffer area used for decoding, have to shift them by <<1 first.
  83. - 0x08F8: Decoder SDRAM refresh
  84. - 0x08FC: Decoder SDRAM pre-charge
  85. Other memory locations:
  86. - 0x2800: Video Display Module control
  87. - 0x2D00: AO (audio output?) control
  88. - 0x2D24: Bytes Flushed
  89. - 0x7000: LSB I2C write clock bit (inverted)
  90. - 0x7004: LSB I2C write data bit (inverted)
  91. - 0x7008: LSB I2C read clock bit
  92. - 0x700c: LSB I2C read data bit
  93. - 0x9008: GPIO get input state
  94. - 0x900c: GPIO set output state
  95. - 0x9020: GPIO direction (Bit7 (GPIO 0..7) - 0:input, 1:output)
  96. - 0x9050: SPU control
  97. - 0x9054: Reset HW blocks
  98. - 0x9058: VPU control
  99. - 0xA018: Bit6: interrupt pending?
  100. - 0xA064: APU command
  101. Interrupt Status Register
  102. ~~~~~~~~~~~~~~~~~~~~~~~~~
  103. The definition of the bits in the interrupt status register 0x0040, and the
  104. interrupt mask 0x0048. If a bit is cleared in the mask, then we want our ISR to
  105. execute.
  106. - bit 31 Encoder Start Capture
  107. - bit 30 Encoder EOS
  108. - bit 29 Encoder VBI capture
  109. - bit 28 Encoder Video Input Module reset event
  110. - bit 27 Encoder DMA complete
  111. - bit 24 Decoder audio mode change detection event (through event notification)
  112. - bit 22 Decoder data request
  113. - bit 20 Decoder DMA complete
  114. - bit 19 Decoder VBI re-insertion
  115. - bit 18 Decoder DMA err (linked-list bad)
  116. Missing documentation
  117. ---------------------
  118. - Encoder API post(?)
  119. - Decoder API post(?)
  120. - Decoder VTRACE event
  121. The cx2341x firmware upload
  122. ---------------------------
  123. This document describes how to upload the cx2341x firmware to the card.
  124. How to find
  125. ~~~~~~~~~~~
  126. See the web pages of the various projects that uses this chip for information
  127. on how to obtain the firmware.
  128. The firmware stored in a Windows driver can be detected as follows:
  129. - Each firmware image is 256k bytes.
  130. - The 1st 32-bit word of the Encoder image is 0x0000da7
  131. - The 1st 32-bit word of the Decoder image is 0x00003a7
  132. - The 2nd 32-bit word of both images is 0xaa55bb66
  133. How to load
  134. ~~~~~~~~~~~
  135. - Issue the FWapi command to stop the encoder if it is running. Wait for the
  136. command to complete.
  137. - Issue the FWapi command to stop the decoder if it is running. Wait for the
  138. command to complete.
  139. - Issue the I2C command to the digitizer to stop emitting VSYNC events.
  140. - Issue the FWapi command to halt the encoder's firmware.
  141. - Sleep for 10ms.
  142. - Issue the FWapi command to halt the decoder's firmware.
  143. - Sleep for 10ms.
  144. - Write 0x00000000 to register 0x2800 to stop the Video Display Module.
  145. - Write 0x00000005 to register 0x2D00 to stop the AO (audio output?).
  146. - Write 0x00000000 to register 0xA064 to ping? the APU.
  147. - Write 0xFFFFFFFE to register 0x9058 to stop the VPU.
  148. - Write 0xFFFFFFFF to register 0x9054 to reset the HW blocks.
  149. - Write 0x00000001 to register 0x9050 to stop the SPU.
  150. - Sleep for 10ms.
  151. - Write 0x0000001A to register 0x07FC to init the Encoder SDRAM's pre-charge.
  152. - Write 0x80000640 to register 0x07F8 to init the Encoder SDRAM's refresh to 1us.
  153. - Write 0x0000001A to register 0x08FC to init the Decoder SDRAM's pre-charge.
  154. - Write 0x80000640 to register 0x08F8 to init the Decoder SDRAM's refresh to 1us.
  155. - Sleep for 512ms. (600ms is recommended)
  156. - Transfer the encoder's firmware image to offset 0 in Encoder memory space.
  157. - Transfer the decoder's firmware image to offset 0 in Decoder memory space.
  158. - Use a read-modify-write operation to Clear bit 0 of register 0x9050 to
  159. re-enable the SPU.
  160. - Sleep for 1 second.
  161. - Use a read-modify-write operation to Clear bits 3 and 0 of register 0x9058
  162. to re-enable the VPU.
  163. - Sleep for 1 second.
  164. - Issue status API commands to both firmware images to verify.
  165. How to call the firmware API
  166. ----------------------------
  167. The preferred calling convention is known as the firmware mailbox. The
  168. mailboxes are basically a fixed length array that serves as the call-stack.
  169. Firmware mailboxes can be located by searching the encoder and decoder memory
  170. for a 16 byte signature. That signature will be located on a 256-byte boundary.
  171. Signature:
  172. .. code-block:: none
  173. 0x78, 0x56, 0x34, 0x12, 0x12, 0x78, 0x56, 0x34,
  174. 0x34, 0x12, 0x78, 0x56, 0x56, 0x34, 0x12, 0x78
  175. The firmware implements 20 mailboxes of 20 32-bit words. The first 10 are
  176. reserved for API calls. The second 10 are used by the firmware for event
  177. notification.
  178. ====== =================
  179. Index Name
  180. ====== =================
  181. 0 Flags
  182. 1 Command
  183. 2 Return value
  184. 3 Timeout
  185. 4-19 Parameter/Result
  186. ====== =================
  187. The flags are defined in the following table. The direction is from the
  188. perspective of the firmware.
  189. ==== ========== ============================================
  190. Bit Direction Purpose
  191. ==== ========== ============================================
  192. 2 O Firmware has processed the command.
  193. 1 I Driver has finished setting the parameters.
  194. 0 I Driver is using this mailbox.
  195. ==== ========== ============================================
  196. The command is a 32-bit enumerator. The API specifics may be found in this
  197. chapter.
  198. The return value is a 32-bit enumerator. Only two values are currently defined:
  199. - 0=success
  200. - -1=command undefined.
  201. There are 16 parameters/results 32-bit fields. The driver populates these fields
  202. with values for all the parameters required by the call. The driver overwrites
  203. these fields with result values returned by the call.
  204. The timeout value protects the card from a hung driver thread. If the driver
  205. doesn't handle the completed call within the timeout specified, the firmware
  206. will reset that mailbox.
  207. To make an API call, the driver iterates over each mailbox looking for the
  208. first one available (bit 0 has been cleared). The driver sets that bit, fills
  209. in the command enumerator, the timeout value and any required parameters. The
  210. driver then sets the parameter ready bit (bit 1). The firmware scans the
  211. mailboxes for pending commands, processes them, sets the result code, populates
  212. the result value array with that call's return values and sets the call
  213. complete bit (bit 2). Once bit 2 is set, the driver should retrieve the results
  214. and clear all the flags. If the driver does not perform this task within the
  215. time set in the timeout register, the firmware will reset that mailbox.
  216. Event notifications are sent from the firmware to the host. The host tells the
  217. firmware which events it is interested in via an API call. That call tells the
  218. firmware which notification mailbox to use. The firmware signals the host via
  219. an interrupt. Only the 16 Results fields are used, the Flags, Command, Return
  220. value and Timeout words are not used.
  221. OSD firmware API description
  222. ----------------------------
  223. .. note:: this API is part of the decoder firmware, so it's cx23415 only.
  224. CX2341X_OSD_GET_FRAMEBUFFER
  225. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226. Enum: 65/0x41
  227. Description
  228. ^^^^^^^^^^^
  229. Return base and length of contiguous OSD memory.
  230. Result[0]
  231. ^^^^^^^^^
  232. OSD base address
  233. Result[1]
  234. ^^^^^^^^^
  235. OSD length
  236. CX2341X_OSD_GET_PIXEL_FORMAT
  237. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  238. Enum: 66/0x42
  239. Description
  240. ^^^^^^^^^^^
  241. Query OSD format
  242. Result[0]
  243. ^^^^^^^^^
  244. 0=8bit index
  245. 1=16bit RGB 5:6:5
  246. 2=16bit ARGB 1:5:5:5
  247. 3=16bit ARGB 1:4:4:4
  248. 4=32bit ARGB 8:8:8:8
  249. CX2341X_OSD_SET_PIXEL_FORMAT
  250. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  251. Enum: 67/0x43
  252. Description
  253. ^^^^^^^^^^^
  254. Assign pixel format
  255. Param[0]
  256. ^^^^^^^^
  257. - 0=8bit index
  258. - 1=16bit RGB 5:6:5
  259. - 2=16bit ARGB 1:5:5:5
  260. - 3=16bit ARGB 1:4:4:4
  261. - 4=32bit ARGB 8:8:8:8
  262. CX2341X_OSD_GET_STATE
  263. ~~~~~~~~~~~~~~~~~~~~~
  264. Enum: 68/0x44
  265. Description
  266. ^^^^^^^^^^^
  267. Query OSD state
  268. Result[0]
  269. ^^^^^^^^^
  270. - Bit 0 0=off, 1=on
  271. - Bits 1:2 alpha control
  272. - Bits 3:5 pixel format
  273. CX2341X_OSD_SET_STATE
  274. ~~~~~~~~~~~~~~~~~~~~~
  275. Enum: 69/0x45
  276. Description
  277. ^^^^^^^^^^^
  278. OSD switch
  279. Param[0]
  280. ^^^^^^^^
  281. 0=off, 1=on
  282. CX2341X_OSD_GET_OSD_COORDS
  283. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  284. Enum: 70/0x46
  285. Description
  286. ^^^^^^^^^^^
  287. Retrieve coordinates of OSD area blended with video
  288. Result[0]
  289. ^^^^^^^^^
  290. OSD buffer address
  291. Result[1]
  292. ^^^^^^^^^
  293. Stride in pixels
  294. Result[2]
  295. ^^^^^^^^^
  296. Lines in OSD buffer
  297. Result[3]
  298. ^^^^^^^^^
  299. Horizontal offset in buffer
  300. Result[4]
  301. ^^^^^^^^^
  302. Vertical offset in buffer
  303. CX2341X_OSD_SET_OSD_COORDS
  304. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  305. Enum: 71/0x47
  306. Description
  307. ^^^^^^^^^^^
  308. Assign the coordinates of the OSD area to blend with video
  309. Param[0]
  310. ^^^^^^^^
  311. buffer address
  312. Param[1]
  313. ^^^^^^^^
  314. buffer stride in pixels
  315. Param[2]
  316. ^^^^^^^^
  317. lines in buffer
  318. Param[3]
  319. ^^^^^^^^
  320. horizontal offset
  321. Param[4]
  322. ^^^^^^^^
  323. vertical offset
  324. CX2341X_OSD_GET_SCREEN_COORDS
  325. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  326. Enum: 72/0x48
  327. Description
  328. ^^^^^^^^^^^
  329. Retrieve OSD screen area coordinates
  330. Result[0]
  331. ^^^^^^^^^
  332. top left horizontal offset
  333. Result[1]
  334. ^^^^^^^^^
  335. top left vertical offset
  336. Result[2]
  337. ^^^^^^^^^
  338. bottom right horizontal offset
  339. Result[3]
  340. ^^^^^^^^^
  341. bottom right vertical offset
  342. CX2341X_OSD_SET_SCREEN_COORDS
  343. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344. Enum: 73/0x49
  345. Description
  346. ^^^^^^^^^^^
  347. Assign the coordinates of the screen area to blend with video
  348. Param[0]
  349. ^^^^^^^^
  350. top left horizontal offset
  351. Param[1]
  352. ^^^^^^^^
  353. top left vertical offset
  354. Param[2]
  355. ^^^^^^^^
  356. bottom left horizontal offset
  357. Param[3]
  358. ^^^^^^^^
  359. bottom left vertical offset
  360. CX2341X_OSD_GET_GLOBAL_ALPHA
  361. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362. Enum: 74/0x4A
  363. Description
  364. ^^^^^^^^^^^
  365. Retrieve OSD global alpha
  366. Result[0]
  367. ^^^^^^^^^
  368. global alpha: 0=off, 1=on
  369. Result[1]
  370. ^^^^^^^^^
  371. bits 0:7 global alpha
  372. CX2341X_OSD_SET_GLOBAL_ALPHA
  373. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  374. Enum: 75/0x4B
  375. Description
  376. ^^^^^^^^^^^
  377. Update global alpha
  378. Param[0]
  379. ^^^^^^^^
  380. global alpha: 0=off, 1=on
  381. Param[1]
  382. ^^^^^^^^
  383. global alpha (8 bits)
  384. Param[2]
  385. ^^^^^^^^
  386. local alpha: 0=on, 1=off
  387. CX2341X_OSD_SET_BLEND_COORDS
  388. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  389. Enum: 78/0x4C
  390. Description
  391. ^^^^^^^^^^^
  392. Move start of blending area within display buffer
  393. Param[0]
  394. ^^^^^^^^
  395. horizontal offset in buffer
  396. Param[1]
  397. ^^^^^^^^
  398. vertical offset in buffer
  399. CX2341X_OSD_GET_FLICKER_STATE
  400. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  401. Enum: 79/0x4F
  402. Description
  403. ^^^^^^^^^^^
  404. Retrieve flicker reduction module state
  405. Result[0]
  406. ^^^^^^^^^
  407. flicker state: 0=off, 1=on
  408. CX2341X_OSD_SET_FLICKER_STATE
  409. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  410. Enum: 80/0x50
  411. Description
  412. ^^^^^^^^^^^
  413. Set flicker reduction module state
  414. Param[0]
  415. ^^^^^^^^
  416. State: 0=off, 1=on
  417. CX2341X_OSD_BLT_COPY
  418. ~~~~~~~~~~~~~~~~~~~~
  419. Enum: 82/0x52
  420. Description
  421. ^^^^^^^^^^^
  422. BLT copy
  423. Param[0]
  424. ^^^^^^^^
  425. .. code-block:: none
  426. '0000' zero
  427. '0001' ~destination AND ~source
  428. '0010' ~destination AND source
  429. '0011' ~destination
  430. '0100' destination AND ~source
  431. '0101' ~source
  432. '0110' destination XOR source
  433. '0111' ~destination OR ~source
  434. '1000' ~destination AND ~source
  435. '1001' destination XNOR source
  436. '1010' source
  437. '1011' ~destination OR source
  438. '1100' destination
  439. '1101' destination OR ~source
  440. '1110' destination OR source
  441. '1111' one
  442. Param[1]
  443. ^^^^^^^^
  444. Resulting alpha blending
  445. - '01' source_alpha
  446. - '10' destination_alpha
  447. - '11' source_alpha*destination_alpha+1
  448. (zero if both source and destination alpha are zero)
  449. Param[2]
  450. ^^^^^^^^
  451. .. code-block:: none
  452. '00' output_pixel = source_pixel
  453. '01' if source_alpha=0:
  454. output_pixel = destination_pixel
  455. if 256 > source_alpha > 1:
  456. output_pixel = ((source_alpha + 1)*source_pixel +
  457. (255 - source_alpha)*destination_pixel)/256
  458. '10' if destination_alpha=0:
  459. output_pixel = source_pixel
  460. if 255 > destination_alpha > 0:
  461. output_pixel = ((255 - destination_alpha)*source_pixel +
  462. (destination_alpha + 1)*destination_pixel)/256
  463. '11' if source_alpha=0:
  464. source_temp = 0
  465. if source_alpha=255:
  466. source_temp = source_pixel*256
  467. if 255 > source_alpha > 0:
  468. source_temp = source_pixel*(source_alpha + 1)
  469. if destination_alpha=0:
  470. destination_temp = 0
  471. if destination_alpha=255:
  472. destination_temp = destination_pixel*256
  473. if 255 > destination_alpha > 0:
  474. destination_temp = destination_pixel*(destination_alpha + 1)
  475. output_pixel = (source_temp + destination_temp)/256
  476. Param[3]
  477. ^^^^^^^^
  478. width
  479. Param[4]
  480. ^^^^^^^^
  481. height
  482. Param[5]
  483. ^^^^^^^^
  484. destination pixel mask
  485. Param[6]
  486. ^^^^^^^^
  487. destination rectangle start address
  488. Param[7]
  489. ^^^^^^^^
  490. destination stride in dwords
  491. Param[8]
  492. ^^^^^^^^
  493. source stride in dwords
  494. Param[9]
  495. ^^^^^^^^
  496. source rectangle start address
  497. CX2341X_OSD_BLT_FILL
  498. ~~~~~~~~~~~~~~~~~~~~
  499. Enum: 83/0x53
  500. Description
  501. ^^^^^^^^^^^
  502. BLT fill color
  503. Param[0]
  504. ^^^^^^^^
  505. Same as Param[0] on API 0x52
  506. Param[1]
  507. ^^^^^^^^
  508. Same as Param[1] on API 0x52
  509. Param[2]
  510. ^^^^^^^^
  511. Same as Param[2] on API 0x52
  512. Param[3]
  513. ^^^^^^^^
  514. width
  515. Param[4]
  516. ^^^^^^^^
  517. height
  518. Param[5]
  519. ^^^^^^^^
  520. destination pixel mask
  521. Param[6]
  522. ^^^^^^^^
  523. destination rectangle start address
  524. Param[7]
  525. ^^^^^^^^
  526. destination stride in dwords
  527. Param[8]
  528. ^^^^^^^^
  529. color fill value
  530. CX2341X_OSD_BLT_TEXT
  531. ~~~~~~~~~~~~~~~~~~~~
  532. Enum: 84/0x54
  533. Description
  534. ^^^^^^^^^^^
  535. BLT for 8 bit alpha text source
  536. Param[0]
  537. ^^^^^^^^
  538. Same as Param[0] on API 0x52
  539. Param[1]
  540. ^^^^^^^^
  541. Same as Param[1] on API 0x52
  542. Param[2]
  543. ^^^^^^^^
  544. Same as Param[2] on API 0x52
  545. Param[3]
  546. ^^^^^^^^
  547. width
  548. Param[4]
  549. ^^^^^^^^
  550. height
  551. Param[5]
  552. ^^^^^^^^
  553. destination pixel mask
  554. Param[6]
  555. ^^^^^^^^
  556. destination rectangle start address
  557. Param[7]
  558. ^^^^^^^^
  559. destination stride in dwords
  560. Param[8]
  561. ^^^^^^^^
  562. source stride in dwords
  563. Param[9]
  564. ^^^^^^^^
  565. source rectangle start address
  566. Param[10]
  567. ^^^^^^^^^
  568. color fill value
  569. CX2341X_OSD_SET_FRAMEBUFFER_WINDOW
  570. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  571. Enum: 86/0x56
  572. Description
  573. ^^^^^^^^^^^
  574. Positions the main output window on the screen. The coordinates must be
  575. such that the entire window fits on the screen.
  576. Param[0]
  577. ^^^^^^^^
  578. window width
  579. Param[1]
  580. ^^^^^^^^
  581. window height
  582. Param[2]
  583. ^^^^^^^^
  584. top left window corner horizontal offset
  585. Param[3]
  586. ^^^^^^^^
  587. top left window corner vertical offset
  588. CX2341X_OSD_SET_CHROMA_KEY
  589. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  590. Enum: 96/0x60
  591. Description
  592. ^^^^^^^^^^^
  593. Chroma key switch and color
  594. Param[0]
  595. ^^^^^^^^
  596. state: 0=off, 1=on
  597. Param[1]
  598. ^^^^^^^^
  599. color
  600. CX2341X_OSD_GET_ALPHA_CONTENT_INDEX
  601. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  602. Enum: 97/0x61
  603. Description
  604. ^^^^^^^^^^^
  605. Retrieve alpha content index
  606. Result[0]
  607. ^^^^^^^^^
  608. alpha content index, Range 0:15
  609. CX2341X_OSD_SET_ALPHA_CONTENT_INDEX
  610. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  611. Enum: 98/0x62
  612. Description
  613. ^^^^^^^^^^^
  614. Assign alpha content index
  615. Param[0]
  616. ^^^^^^^^
  617. alpha content index, range 0:15
  618. Encoder firmware API description
  619. --------------------------------
  620. CX2341X_ENC_PING_FW
  621. ~~~~~~~~~~~~~~~~~~~
  622. Enum: 128/0x80
  623. Description
  624. ^^^^^^^^^^^
  625. Does nothing. Can be used to check if the firmware is responding.
  626. CX2341X_ENC_START_CAPTURE
  627. ~~~~~~~~~~~~~~~~~~~~~~~~~
  628. Enum: 129/0x81
  629. Description
  630. ^^^^^^^^^^^
  631. Commences the capture of video, audio and/or VBI data. All encoding
  632. parameters must be initialized prior to this API call. Captures frames
  633. continuously or until a predefined number of frames have been captured.
  634. Param[0]
  635. ^^^^^^^^
  636. Capture stream type:
  637. - 0=MPEG
  638. - 1=Raw
  639. - 2=Raw passthrough
  640. - 3=VBI
  641. Param[1]
  642. ^^^^^^^^
  643. Bitmask:
  644. - Bit 0 when set, captures YUV
  645. - Bit 1 when set, captures PCM audio
  646. - Bit 2 when set, captures VBI (same as param[0]=3)
  647. - Bit 3 when set, the capture destination is the decoder
  648. (same as param[0]=2)
  649. - Bit 4 when set, the capture destination is the host
  650. .. note:: this parameter is only meaningful for RAW capture type.
  651. CX2341X_ENC_STOP_CAPTURE
  652. ~~~~~~~~~~~~~~~~~~~~~~~~
  653. Enum: 130/0x82
  654. Description
  655. ^^^^^^^^^^^
  656. Ends a capture in progress
  657. Param[0]
  658. ^^^^^^^^
  659. - 0=stop at end of GOP (generates IRQ)
  660. - 1=stop immediate (no IRQ)
  661. Param[1]
  662. ^^^^^^^^
  663. Stream type to stop, see param[0] of API 0x81
  664. Param[2]
  665. ^^^^^^^^
  666. Subtype, see param[1] of API 0x81
  667. CX2341X_ENC_SET_AUDIO_ID
  668. ~~~~~~~~~~~~~~~~~~~~~~~~
  669. Enum: 137/0x89
  670. Description
  671. ^^^^^^^^^^^
  672. Assigns the transport stream ID of the encoded audio stream
  673. Param[0]
  674. ^^^^^^^^
  675. Audio Stream ID
  676. CX2341X_ENC_SET_VIDEO_ID
  677. ~~~~~~~~~~~~~~~~~~~~~~~~
  678. Enum: 139/0x8B
  679. Description
  680. ^^^^^^^^^^^
  681. Set video transport stream ID
  682. Param[0]
  683. ^^^^^^^^
  684. Video stream ID
  685. CX2341X_ENC_SET_PCR_ID
  686. ~~~~~~~~~~~~~~~~~~~~~~
  687. Enum: 141/0x8D
  688. Description
  689. ^^^^^^^^^^^
  690. Assigns the transport stream ID for PCR packets
  691. Param[0]
  692. ^^^^^^^^
  693. PCR Stream ID
  694. CX2341X_ENC_SET_FRAME_RATE
  695. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  696. Enum: 143/0x8F
  697. Description
  698. ^^^^^^^^^^^
  699. Set video frames per second. Change occurs at start of new GOP.
  700. Param[0]
  701. ^^^^^^^^
  702. - 0=30fps
  703. - 1=25fps
  704. CX2341X_ENC_SET_FRAME_SIZE
  705. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  706. Enum: 145/0x91
  707. Description
  708. ^^^^^^^^^^^
  709. Select video stream encoding resolution.
  710. Param[0]
  711. ^^^^^^^^
  712. Height in lines. Default 480
  713. Param[1]
  714. ^^^^^^^^
  715. Width in pixels. Default 720
  716. CX2341X_ENC_SET_BIT_RATE
  717. ~~~~~~~~~~~~~~~~~~~~~~~~
  718. Enum: 149/0x95
  719. Description
  720. ^^^^^^^^^^^
  721. Assign average video stream bitrate.
  722. Param[0]
  723. ^^^^^^^^
  724. 0=variable bitrate, 1=constant bitrate
  725. Param[1]
  726. ^^^^^^^^
  727. bitrate in bits per second
  728. Param[2]
  729. ^^^^^^^^
  730. peak bitrate in bits per second, divided by 400
  731. Param[3]
  732. ^^^^^^^^
  733. Mux bitrate in bits per second, divided by 400. May be 0 (default).
  734. Param[4]
  735. ^^^^^^^^
  736. Rate Control VBR Padding
  737. Param[5]
  738. ^^^^^^^^
  739. VBV Buffer used by encoder
  740. .. note::
  741. #) Param\[3\] and Param\[4\] seem to be always 0
  742. #) Param\[5\] doesn't seem to be used.
  743. CX2341X_ENC_SET_GOP_PROPERTIES
  744. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  745. Enum: 151/0x97
  746. Description
  747. ^^^^^^^^^^^
  748. Setup the GOP structure
  749. Param[0]
  750. ^^^^^^^^
  751. GOP size (maximum is 34)
  752. Param[1]
  753. ^^^^^^^^
  754. Number of B frames between the I and P frame, plus 1.
  755. For example: IBBPBBPBBPBB --> GOP size: 12, number of B frames: 2+1 = 3
  756. .. note::
  757. GOP size must be a multiple of (B-frames + 1).
  758. CX2341X_ENC_SET_ASPECT_RATIO
  759. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  760. Enum: 153/0x99
  761. Description
  762. ^^^^^^^^^^^
  763. Sets the encoding aspect ratio. Changes in the aspect ratio take effect
  764. at the start of the next GOP.
  765. Param[0]
  766. ^^^^^^^^
  767. - '0000' forbidden
  768. - '0001' 1:1 square
  769. - '0010' 4:3
  770. - '0011' 16:9
  771. - '0100' 2.21:1
  772. - '0101' to '1111' reserved
  773. CX2341X_ENC_SET_DNR_FILTER_MODE
  774. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  775. Enum: 155/0x9B
  776. Description
  777. ^^^^^^^^^^^
  778. Assign Dynamic Noise Reduction operating mode
  779. Param[0]
  780. ^^^^^^^^
  781. Bit0: Spatial filter, set=auto, clear=manual
  782. Bit1: Temporal filter, set=auto, clear=manual
  783. Param[1]
  784. ^^^^^^^^
  785. Median filter:
  786. - 0=Disabled
  787. - 1=Horizontal
  788. - 2=Vertical
  789. - 3=Horiz/Vert
  790. - 4=Diagonal
  791. CX2341X_ENC_SET_DNR_FILTER_PROPS
  792. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  793. Enum: 157/0x9D
  794. Description
  795. ^^^^^^^^^^^
  796. These Dynamic Noise Reduction filter values are only meaningful when
  797. the respective filter is set to "manual" (See API 0x9B)
  798. Param[0]
  799. ^^^^^^^^
  800. Spatial filter: default 0, range 0:15
  801. Param[1]
  802. ^^^^^^^^
  803. Temporal filter: default 0, range 0:31
  804. CX2341X_ENC_SET_CORING_LEVELS
  805. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  806. Enum: 159/0x9F
  807. Description
  808. ^^^^^^^^^^^
  809. Assign Dynamic Noise Reduction median filter properties.
  810. Param[0]
  811. ^^^^^^^^
  812. Threshold above which the luminance median filter is enabled.
  813. Default: 0, range 0:255
  814. Param[1]
  815. ^^^^^^^^
  816. Threshold below which the luminance median filter is enabled.
  817. Default: 255, range 0:255
  818. Param[2]
  819. ^^^^^^^^
  820. Threshold above which the chrominance median filter is enabled.
  821. Default: 0, range 0:255
  822. Param[3]
  823. ^^^^^^^^
  824. Threshold below which the chrominance median filter is enabled.
  825. Default: 255, range 0:255
  826. CX2341X_ENC_SET_SPATIAL_FILTER_TYPE
  827. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  828. Enum: 161/0xA1
  829. Description
  830. ^^^^^^^^^^^
  831. Assign spatial prefilter parameters
  832. Param[0]
  833. ^^^^^^^^
  834. Luminance filter
  835. - 0=Off
  836. - 1=1D Horizontal
  837. - 2=1D Vertical
  838. - 3=2D H/V Separable (default)
  839. - 4=2D Symmetric non-separable
  840. Param[1]
  841. ^^^^^^^^
  842. Chrominance filter
  843. - 0=Off
  844. - 1=1D Horizontal (default)
  845. CX2341X_ENC_SET_VBI_LINE
  846. ~~~~~~~~~~~~~~~~~~~~~~~~
  847. Enum: 183/0xB7
  848. Description
  849. ^^^^^^^^^^^
  850. Selects VBI line number.
  851. Param[0]
  852. ^^^^^^^^
  853. - Bits 0:4 line number
  854. - Bit 31 0=top_field, 1=bottom_field
  855. - Bits 0:31 all set specifies "all lines"
  856. Param[1]
  857. ^^^^^^^^
  858. VBI line information features: 0=disabled, 1=enabled
  859. Param[2]
  860. ^^^^^^^^
  861. Slicing: 0=None, 1=Closed Caption
  862. Almost certainly not implemented. Set to 0.
  863. Param[3]
  864. ^^^^^^^^
  865. Luminance samples in this line.
  866. Almost certainly not implemented. Set to 0.
  867. Param[4]
  868. ^^^^^^^^
  869. Chrominance samples in this line
  870. Almost certainly not implemented. Set to 0.
  871. CX2341X_ENC_SET_STREAM_TYPE
  872. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  873. Enum: 185/0xB9
  874. Description
  875. ^^^^^^^^^^^
  876. Assign stream type
  877. .. note::
  878. Transport stream is not working in recent firmwares.
  879. And in older firmwares the timestamps in the TS seem to be
  880. unreliable.
  881. Param[0]
  882. ^^^^^^^^
  883. - 0=Program stream
  884. - 1=Transport stream
  885. - 2=MPEG1 stream
  886. - 3=PES A/V stream
  887. - 5=PES Video stream
  888. - 7=PES Audio stream
  889. - 10=DVD stream
  890. - 11=VCD stream
  891. - 12=SVCD stream
  892. - 13=DVD_S1 stream
  893. - 14=DVD_S2 stream
  894. CX2341X_ENC_SET_OUTPUT_PORT
  895. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  896. Enum: 187/0xBB
  897. Description
  898. ^^^^^^^^^^^
  899. Assign stream output port. Normally 0 when the data is copied through
  900. the PCI bus (DMA), and 1 when the data is streamed to another chip
  901. (pvrusb and cx88-blackbird).
  902. Param[0]
  903. ^^^^^^^^
  904. - 0=Memory (default)
  905. - 1=Streaming
  906. - 2=Serial
  907. Param[1]
  908. ^^^^^^^^
  909. Unknown, but leaving this to 0 seems to work best. Indications are that
  910. this might have to do with USB support, although passing anything but 0
  911. only breaks things.
  912. CX2341X_ENC_SET_AUDIO_PROPERTIES
  913. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  914. Enum: 189/0xBD
  915. Description
  916. ^^^^^^^^^^^
  917. Set audio stream properties, may be called while encoding is in progress.
  918. .. note::
  919. All bitfields are consistent with ISO11172 documentation except
  920. bits 2:3 which ISO docs define as:
  921. - '11' Layer I
  922. - '10' Layer II
  923. - '01' Layer III
  924. - '00' Undefined
  925. This discrepancy may indicate a possible error in the documentation.
  926. Testing indicated that only Layer II is actually working, and that
  927. the minimum bitrate should be 192 kbps.
  928. Param[0]
  929. ^^^^^^^^
  930. Bitmask:
  931. .. code-block:: none
  932. 0:1 '00' 44.1Khz
  933. '01' 48Khz
  934. '10' 32Khz
  935. '11' reserved
  936. 2:3 '01'=Layer I
  937. '10'=Layer II
  938. 4:7 Bitrate:
  939. Index | Layer I | Layer II
  940. ------+-------------+------------
  941. '0000' | free format | free format
  942. '0001' | 32 kbit/s | 32 kbit/s
  943. '0010' | 64 kbit/s | 48 kbit/s
  944. '0011' | 96 kbit/s | 56 kbit/s
  945. '0100' | 128 kbit/s | 64 kbit/s
  946. '0101' | 160 kbit/s | 80 kbit/s
  947. '0110' | 192 kbit/s | 96 kbit/s
  948. '0111' | 224 kbit/s | 112 kbit/s
  949. '1000' | 256 kbit/s | 128 kbit/s
  950. '1001' | 288 kbit/s | 160 kbit/s
  951. '1010' | 320 kbit/s | 192 kbit/s
  952. '1011' | 352 kbit/s | 224 kbit/s
  953. '1100' | 384 kbit/s | 256 kbit/s
  954. '1101' | 416 kbit/s | 320 kbit/s
  955. '1110' | 448 kbit/s | 384 kbit/s
  956. .. note::
  957. For Layer II, not all combinations of total bitrate
  958. and mode are allowed. See ISO11172-3 3-Annex B,
  959. Table 3-B.2
  960. 8:9 '00'=Stereo
  961. '01'=JointStereo
  962. '10'=Dual
  963. '11'=Mono
  964. .. note::
  965. The cx23415 cannot decode Joint Stereo properly.
  966. 10:11 Mode Extension used in joint_stereo mode.
  967. In Layer I and II they indicate which subbands are in
  968. intensity_stereo. All other subbands are coded in stereo.
  969. '00' subbands 4-31 in intensity_stereo, bound==4
  970. '01' subbands 8-31 in intensity_stereo, bound==8
  971. '10' subbands 12-31 in intensity_stereo, bound==12
  972. '11' subbands 16-31 in intensity_stereo, bound==16
  973. 12:13 Emphasis:
  974. '00' None
  975. '01' 50/15uS
  976. '10' reserved
  977. '11' CCITT J.17
  978. 14 CRC:
  979. '0' off
  980. '1' on
  981. 15 Copyright:
  982. '0' off
  983. '1' on
  984. 16 Generation:
  985. '0' copy
  986. '1' original
  987. CX2341X_ENC_HALT_FW
  988. ~~~~~~~~~~~~~~~~~~~
  989. Enum: 195/0xC3
  990. Description
  991. ^^^^^^^^^^^
  992. The firmware is halted and no further API calls are serviced until the
  993. firmware is uploaded again.
  994. CX2341X_ENC_GET_VERSION
  995. ~~~~~~~~~~~~~~~~~~~~~~~
  996. Enum: 196/0xC4
  997. Description
  998. ^^^^^^^^^^^
  999. Returns the version of the encoder firmware.
  1000. Result[0]
  1001. ^^^^^^^^^
  1002. Version bitmask:
  1003. - Bits 0:15 build
  1004. - Bits 16:23 minor
  1005. - Bits 24:31 major
  1006. CX2341X_ENC_SET_GOP_CLOSURE
  1007. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1008. Enum: 197/0xC5
  1009. Description
  1010. ^^^^^^^^^^^
  1011. Assigns the GOP open/close property.
  1012. Param[0]
  1013. ^^^^^^^^
  1014. - 0=Open
  1015. - 1=Closed
  1016. CX2341X_ENC_GET_SEQ_END
  1017. ~~~~~~~~~~~~~~~~~~~~~~~
  1018. Enum: 198/0xC6
  1019. Description
  1020. ^^^^^^^^^^^
  1021. Obtains the sequence end code of the encoder's buffer. When a capture
  1022. is started a number of interrupts are still generated, the last of
  1023. which will have Result[0] set to 1 and Result[1] will contain the size
  1024. of the buffer.
  1025. Result[0]
  1026. ^^^^^^^^^
  1027. State of the transfer (1 if last buffer)
  1028. Result[1]
  1029. ^^^^^^^^^
  1030. If Result[0] is 1, this contains the size of the last buffer, undefined
  1031. otherwise.
  1032. CX2341X_ENC_SET_PGM_INDEX_INFO
  1033. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1034. Enum: 199/0xC7
  1035. Description
  1036. ^^^^^^^^^^^
  1037. Sets the Program Index Information.
  1038. The information is stored as follows:
  1039. .. code-block:: c
  1040. struct info {
  1041. u32 length; // Length of this frame
  1042. u32 offset_low; // Offset in the file of the
  1043. u32 offset_high; // start of this frame
  1044. u32 mask1; // Bits 0-2 are the type mask:
  1045. // 1=I, 2=P, 4=B
  1046. // 0=End of Program Index, other fields
  1047. // are invalid.
  1048. u32 pts; // The PTS of the frame
  1049. u32 mask2; // Bit 0 is bit 32 of the pts.
  1050. };
  1051. u32 table_ptr;
  1052. struct info index[400];
  1053. The table_ptr is the encoder memory address in the table were
  1054. *new* entries will be written.
  1055. .. note:: This is a ringbuffer, so the table_ptr will wraparound.
  1056. Param[0]
  1057. ^^^^^^^^
  1058. Picture Mask:
  1059. - 0=No index capture
  1060. - 1=I frames
  1061. - 3=I,P frames
  1062. - 7=I,P,B frames
  1063. (Seems to be ignored, it always indexes I, P and B frames)
  1064. Param[1]
  1065. ^^^^^^^^
  1066. Elements requested (up to 400)
  1067. Result[0]
  1068. ^^^^^^^^^
  1069. Offset in the encoder memory of the start of the table.
  1070. Result[1]
  1071. ^^^^^^^^^
  1072. Number of allocated elements up to a maximum of Param[1]
  1073. CX2341X_ENC_SET_VBI_CONFIG
  1074. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1075. Enum: 200/0xC8
  1076. Description
  1077. ^^^^^^^^^^^
  1078. Configure VBI settings
  1079. Param[0]
  1080. ^^^^^^^^
  1081. Bitmap:
  1082. .. code-block:: none
  1083. 0 Mode '0' Sliced, '1' Raw
  1084. 1:3 Insertion:
  1085. '000' insert in extension & user data
  1086. '001' insert in private packets
  1087. '010' separate stream and user data
  1088. '111' separate stream and private data
  1089. 8:15 Stream ID (normally 0xBD)
  1090. Param[1]
  1091. ^^^^^^^^
  1092. Frames per interrupt (max 8). Only valid in raw mode.
  1093. Param[2]
  1094. ^^^^^^^^
  1095. Total raw VBI frames. Only valid in raw mode.
  1096. Param[3]
  1097. ^^^^^^^^
  1098. Start codes
  1099. Param[4]
  1100. ^^^^^^^^
  1101. Stop codes
  1102. Param[5]
  1103. ^^^^^^^^
  1104. Lines per frame
  1105. Param[6]
  1106. ^^^^^^^^
  1107. Byte per line
  1108. Result[0]
  1109. ^^^^^^^^^
  1110. Observed frames per interrupt in raw mode only. Rage 1 to Param[1]
  1111. Result[1]
  1112. ^^^^^^^^^
  1113. Observed number of frames in raw mode. Range 1 to Param[2]
  1114. Result[2]
  1115. ^^^^^^^^^
  1116. Memory offset to start or raw VBI data
  1117. CX2341X_ENC_SET_DMA_BLOCK_SIZE
  1118. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1119. Enum: 201/0xC9
  1120. Description
  1121. ^^^^^^^^^^^
  1122. Set DMA transfer block size
  1123. Param[0]
  1124. ^^^^^^^^
  1125. DMA transfer block size in bytes or frames. When unit is bytes,
  1126. supported block sizes are 2^7, 2^8 and 2^9 bytes.
  1127. Param[1]
  1128. ^^^^^^^^
  1129. Unit: 0=bytes, 1=frames
  1130. CX2341X_ENC_GET_PREV_DMA_INFO_MB_10
  1131. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1132. Enum: 202/0xCA
  1133. Description
  1134. ^^^^^^^^^^^
  1135. Returns information on the previous DMA transfer in conjunction with
  1136. bit 27 of the interrupt mask. Uses mailbox 10.
  1137. Result[0]
  1138. ^^^^^^^^^
  1139. Type of stream
  1140. Result[1]
  1141. ^^^^^^^^^
  1142. Address Offset
  1143. Result[2]
  1144. ^^^^^^^^^
  1145. Maximum size of transfer
  1146. CX2341X_ENC_GET_PREV_DMA_INFO_MB_9
  1147. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1148. Enum: 203/0xCB
  1149. Description
  1150. ^^^^^^^^^^^
  1151. Returns information on the previous DMA transfer in conjunction with
  1152. bit 27 or 18 of the interrupt mask. Uses mailbox 9.
  1153. Result[0]
  1154. ^^^^^^^^^
  1155. Status bits:
  1156. - 0 read completed
  1157. - 1 write completed
  1158. - 2 DMA read error
  1159. - 3 DMA write error
  1160. - 4 Scatter-Gather array error
  1161. Result[1]
  1162. ^^^^^^^^^
  1163. DMA type
  1164. Result[2]
  1165. ^^^^^^^^^
  1166. Presentation Time Stamp bits 0..31
  1167. Result[3]
  1168. ^^^^^^^^^
  1169. Presentation Time Stamp bit 32
  1170. CX2341X_ENC_SCHED_DMA_TO_HOST
  1171. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1172. Enum: 204/0xCC
  1173. Description
  1174. ^^^^^^^^^^^
  1175. Setup DMA to host operation
  1176. Param[0]
  1177. ^^^^^^^^
  1178. Memory address of link list
  1179. Param[1]
  1180. ^^^^^^^^
  1181. Length of link list (wtf: what units ???)
  1182. Param[2]
  1183. ^^^^^^^^
  1184. DMA type (0=MPEG)
  1185. CX2341X_ENC_INITIALIZE_INPUT
  1186. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1187. Enum: 205/0xCD
  1188. Description
  1189. ^^^^^^^^^^^
  1190. Initializes the video input
  1191. CX2341X_ENC_SET_FRAME_DROP_RATE
  1192. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1193. Enum: 208/0xD0
  1194. Description
  1195. ^^^^^^^^^^^
  1196. For each frame captured, skip specified number of frames.
  1197. Param[0]
  1198. ^^^^^^^^
  1199. Number of frames to skip
  1200. CX2341X_ENC_PAUSE_ENCODER
  1201. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1202. Enum: 210/0xD2
  1203. Description
  1204. ^^^^^^^^^^^
  1205. During a pause condition, all frames are dropped instead of being encoded.
  1206. Param[0]
  1207. ^^^^^^^^
  1208. - 0=Pause encoding
  1209. - 1=Continue encoding
  1210. CX2341X_ENC_REFRESH_INPUT
  1211. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1212. Enum: 211/0xD3
  1213. Description
  1214. ^^^^^^^^^^^
  1215. Refreshes the video input
  1216. CX2341X_ENC_SET_COPYRIGHT
  1217. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1218. Enum: 212/0xD4
  1219. Description
  1220. ^^^^^^^^^^^
  1221. Sets stream copyright property
  1222. Param[0]
  1223. ^^^^^^^^
  1224. - 0=Stream is not copyrighted
  1225. - 1=Stream is copyrighted
  1226. CX2341X_ENC_SET_EVENT_NOTIFICATION
  1227. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1228. Enum: 213/0xD5
  1229. Description
  1230. ^^^^^^^^^^^
  1231. Setup firmware to notify the host about a particular event. Host must
  1232. unmask the interrupt bit.
  1233. Param[0]
  1234. ^^^^^^^^
  1235. Event (0=refresh encoder input)
  1236. Param[1]
  1237. ^^^^^^^^
  1238. Notification 0=disabled 1=enabled
  1239. Param[2]
  1240. ^^^^^^^^
  1241. Interrupt bit
  1242. Param[3]
  1243. ^^^^^^^^
  1244. Mailbox slot, -1 if no mailbox required.
  1245. CX2341X_ENC_SET_NUM_VSYNC_LINES
  1246. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1247. Enum: 214/0xD6
  1248. Description
  1249. ^^^^^^^^^^^
  1250. Depending on the analog video decoder used, this assigns the number
  1251. of lines for field 1 and 2.
  1252. Param[0]
  1253. ^^^^^^^^
  1254. Field 1 number of lines:
  1255. - 0x00EF for SAA7114
  1256. - 0x00F0 for SAA7115
  1257. - 0x0105 for Micronas
  1258. Param[1]
  1259. ^^^^^^^^
  1260. Field 2 number of lines:
  1261. - 0x00EF for SAA7114
  1262. - 0x00F0 for SAA7115
  1263. - 0x0106 for Micronas
  1264. CX2341X_ENC_SET_PLACEHOLDER
  1265. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1266. Enum: 215/0xD7
  1267. Description
  1268. ^^^^^^^^^^^
  1269. Provides a mechanism of inserting custom user data in the MPEG stream.
  1270. Param[0]
  1271. ^^^^^^^^
  1272. - 0=extension & user data
  1273. - 1=private packet with stream ID 0xBD
  1274. Param[1]
  1275. ^^^^^^^^
  1276. Rate at which to insert data, in units of frames (for private packet)
  1277. or GOPs (for ext. & user data)
  1278. Param[2]
  1279. ^^^^^^^^
  1280. Number of data DWORDs (below) to insert
  1281. Param[3]
  1282. ^^^^^^^^
  1283. Custom data 0
  1284. Param[4]
  1285. ^^^^^^^^
  1286. Custom data 1
  1287. Param[5]
  1288. ^^^^^^^^
  1289. Custom data 2
  1290. Param[6]
  1291. ^^^^^^^^
  1292. Custom data 3
  1293. Param[7]
  1294. ^^^^^^^^
  1295. Custom data 4
  1296. Param[8]
  1297. ^^^^^^^^
  1298. Custom data 5
  1299. Param[9]
  1300. ^^^^^^^^
  1301. Custom data 6
  1302. Param[10]
  1303. ^^^^^^^^^
  1304. Custom data 7
  1305. Param[11]
  1306. ^^^^^^^^^
  1307. Custom data 8
  1308. CX2341X_ENC_MUTE_VIDEO
  1309. ~~~~~~~~~~~~~~~~~~~~~~
  1310. Enum: 217/0xD9
  1311. Description
  1312. ^^^^^^^^^^^
  1313. Video muting
  1314. Param[0]
  1315. ^^^^^^^^
  1316. Bit usage:
  1317. .. code-block:: none
  1318. 0 '0'=video not muted
  1319. '1'=video muted, creates frames with the YUV color defined below
  1320. 1:7 Unused
  1321. 8:15 V chrominance information
  1322. 16:23 U chrominance information
  1323. 24:31 Y luminance information
  1324. CX2341X_ENC_MUTE_AUDIO
  1325. ~~~~~~~~~~~~~~~~~~~~~~
  1326. Enum: 218/0xDA
  1327. Description
  1328. ^^^^^^^^^^^
  1329. Audio muting
  1330. Param[0]
  1331. ^^^^^^^^
  1332. - 0=audio not muted
  1333. - 1=audio muted (produces silent mpeg audio stream)
  1334. CX2341X_ENC_SET_VERT_CROP_LINE
  1335. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1336. Enum: 219/0xDB
  1337. Description
  1338. ^^^^^^^^^^^
  1339. Something to do with 'Vertical Crop Line'
  1340. Param[0]
  1341. ^^^^^^^^
  1342. If saa7114 and raw VBI capture and 60 Hz, then set to 10001.
  1343. Else 0.
  1344. CX2341X_ENC_MISC
  1345. ~~~~~~~~~~~~~~~~
  1346. Enum: 220/0xDC
  1347. Description
  1348. ^^^^^^^^^^^
  1349. Miscellaneous actions. Not known for 100% what it does. It's really a
  1350. sort of ioctl call. The first parameter is a command number, the second
  1351. the value.
  1352. Param[0]
  1353. ^^^^^^^^
  1354. Command number:
  1355. .. code-block:: none
  1356. 1=set initial SCR value when starting encoding (works).
  1357. 2=set quality mode (apparently some test setting).
  1358. 3=setup advanced VIM protection handling.
  1359. Always 1 for the cx23416 and 0 for cx23415.
  1360. 4=generate DVD compatible PTS timestamps
  1361. 5=USB flush mode
  1362. 6=something to do with the quantization matrix
  1363. 7=set navigation pack insertion for DVD: adds 0xbf (private stream 2)
  1364. packets to the MPEG. The size of these packets is 2048 bytes (including
  1365. the header of 6 bytes: 0x000001bf + length). The payload is zeroed and
  1366. it is up to the application to fill them in. These packets are apparently
  1367. inserted every four frames.
  1368. 8=enable scene change detection (seems to be a failure)
  1369. 9=set history parameters of the video input module
  1370. 10=set input field order of VIM
  1371. 11=set quantization matrix
  1372. 12=reset audio interface after channel change or input switch (has no argument).
  1373. Needed for the cx2584x, not needed for the mspx4xx, but it doesn't seem to
  1374. do any harm calling it regardless.
  1375. 13=set audio volume delay
  1376. 14=set audio delay
  1377. Param[1]
  1378. ^^^^^^^^
  1379. Command value.
  1380. Decoder firmware API description
  1381. --------------------------------
  1382. .. note:: this API is part of the decoder firmware, so it's cx23415 only.
  1383. CX2341X_DEC_PING_FW
  1384. ~~~~~~~~~~~~~~~~~~~
  1385. Enum: 0/0x00
  1386. Description
  1387. ^^^^^^^^^^^
  1388. This API call does nothing. It may be used to check if the firmware
  1389. is responding.
  1390. CX2341X_DEC_START_PLAYBACK
  1391. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1392. Enum: 1/0x01
  1393. Description
  1394. ^^^^^^^^^^^
  1395. Begin or resume playback.
  1396. Param[0]
  1397. ^^^^^^^^
  1398. 0 based frame number in GOP to begin playback from.
  1399. Param[1]
  1400. ^^^^^^^^
  1401. Specifies the number of muted audio frames to play before normal
  1402. audio resumes. (This is not implemented in the firmware, leave at 0)
  1403. CX2341X_DEC_STOP_PLAYBACK
  1404. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1405. Enum: 2/0x02
  1406. Description
  1407. ^^^^^^^^^^^
  1408. Ends playback and clears all decoder buffers. If PTS is not zero,
  1409. playback stops at specified PTS.
  1410. Param[0]
  1411. ^^^^^^^^
  1412. Display 0=last frame, 1=black
  1413. .. note::
  1414. this takes effect immediately, so if you want to wait for a PTS,
  1415. then use '0', otherwise the screen goes to black at once.
  1416. You can call this later (even if there is no playback) with a 1 value
  1417. to set the screen to black.
  1418. Param[1]
  1419. ^^^^^^^^
  1420. PTS low
  1421. Param[2]
  1422. ^^^^^^^^
  1423. PTS high
  1424. CX2341X_DEC_SET_PLAYBACK_SPEED
  1425. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1426. Enum: 3/0x03
  1427. Description
  1428. ^^^^^^^^^^^
  1429. Playback stream at speed other than normal. There are two modes of
  1430. operation:
  1431. - Smooth: host transfers entire stream and firmware drops unused
  1432. frames.
  1433. - Coarse: host drops frames based on indexing as required to achieve
  1434. desired speed.
  1435. Param[0]
  1436. ^^^^^^^^
  1437. .. code-block:: none
  1438. Bitmap:
  1439. 0:7 0 normal
  1440. 1 fast only "1.5 times"
  1441. n nX fast, 1/nX slow
  1442. 30 Framedrop:
  1443. '0' during 1.5 times play, every other B frame is dropped
  1444. '1' during 1.5 times play, stream is unchanged (bitrate
  1445. must not exceed 8mbps)
  1446. 31 Speed:
  1447. '0' slow
  1448. '1' fast
  1449. .. note::
  1450. n is limited to 2. Anything higher does not result in
  1451. faster playback. Instead the host should start dropping frames.
  1452. Param[1]
  1453. ^^^^^^^^
  1454. Direction: 0=forward, 1=reverse
  1455. .. note::
  1456. to make reverse playback work you have to write full GOPs in
  1457. reverse order.
  1458. Param[2]
  1459. ^^^^^^^^
  1460. .. code-block:: none
  1461. Picture mask:
  1462. 1=I frames
  1463. 3=I, P frames
  1464. 7=I, P, B frames
  1465. Param[3]
  1466. ^^^^^^^^
  1467. B frames per GOP (for reverse play only)
  1468. .. note::
  1469. for reverse playback the Picture Mask should be set to I or I, P.
  1470. Adding B frames to the mask will result in corrupt video. This field
  1471. has to be set to the correct value in order to keep the timing correct.
  1472. Param[4]
  1473. ^^^^^^^^
  1474. Mute audio: 0=disable, 1=enable
  1475. Param[5]
  1476. ^^^^^^^^
  1477. Display 0=frame, 1=field
  1478. Param[6]
  1479. ^^^^^^^^
  1480. Specifies the number of muted audio frames to play before normal audio
  1481. resumes. (Not implemented in the firmware, leave at 0)
  1482. CX2341X_DEC_STEP_VIDEO
  1483. ~~~~~~~~~~~~~~~~~~~~~~
  1484. Enum: 5/0x05
  1485. Description
  1486. ^^^^^^^^^^^
  1487. Each call to this API steps the playback to the next unit defined below
  1488. in the current playback direction.
  1489. Param[0]
  1490. ^^^^^^^^
  1491. 0=frame, 1=top field, 2=bottom field
  1492. CX2341X_DEC_SET_DMA_BLOCK_SIZE
  1493. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1494. Enum: 8/0x08
  1495. Description
  1496. ^^^^^^^^^^^
  1497. Set DMA transfer block size. Counterpart to API 0xC9
  1498. Param[0]
  1499. ^^^^^^^^
  1500. DMA transfer block size in bytes. A different size may be specified
  1501. when issuing the DMA transfer command.
  1502. CX2341X_DEC_GET_XFER_INFO
  1503. ~~~~~~~~~~~~~~~~~~~~~~~~~
  1504. Enum: 9/0x09
  1505. Description
  1506. ^^^^^^^^^^^
  1507. This API call may be used to detect an end of stream condition.
  1508. Result[0]
  1509. ^^^^^^^^^
  1510. Stream type
  1511. Result[1]
  1512. ^^^^^^^^^
  1513. Address offset
  1514. Result[2]
  1515. ^^^^^^^^^
  1516. Maximum bytes to transfer
  1517. Result[3]
  1518. ^^^^^^^^^
  1519. Buffer fullness
  1520. CX2341X_DEC_GET_DMA_STATUS
  1521. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1522. Enum: 10/0x0A
  1523. Description
  1524. ^^^^^^^^^^^
  1525. Status of the last DMA transfer
  1526. Result[0]
  1527. ^^^^^^^^^
  1528. Bit 1 set means transfer complete
  1529. Bit 2 set means DMA error
  1530. Bit 3 set means linked list error
  1531. Result[1]
  1532. ^^^^^^^^^
  1533. DMA type: 0=MPEG, 1=OSD, 2=YUV
  1534. CX2341X_DEC_SCHED_DMA_FROM_HOST
  1535. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1536. Enum: 11/0x0B
  1537. Description
  1538. ^^^^^^^^^^^
  1539. Setup DMA from host operation. Counterpart to API 0xCC
  1540. Param[0]
  1541. ^^^^^^^^
  1542. Memory address of link list
  1543. Param[1]
  1544. ^^^^^^^^
  1545. Total # of bytes to transfer
  1546. Param[2]
  1547. ^^^^^^^^
  1548. DMA type (0=MPEG, 1=OSD, 2=YUV)
  1549. CX2341X_DEC_PAUSE_PLAYBACK
  1550. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1551. Enum: 13/0x0D
  1552. Description
  1553. ^^^^^^^^^^^
  1554. Freeze playback immediately. In this mode, when internal buffers are
  1555. full, no more data will be accepted and data request IRQs will be
  1556. masked.
  1557. Param[0]
  1558. ^^^^^^^^
  1559. Display: 0=last frame, 1=black
  1560. CX2341X_DEC_HALT_FW
  1561. ~~~~~~~~~~~~~~~~~~~
  1562. Enum: 14/0x0E
  1563. Description
  1564. ^^^^^^^^^^^
  1565. The firmware is halted and no further API calls are serviced until
  1566. the firmware is uploaded again.
  1567. CX2341X_DEC_SET_STANDARD
  1568. ~~~~~~~~~~~~~~~~~~~~~~~~
  1569. Enum: 16/0x10
  1570. Description
  1571. ^^^^^^^^^^^
  1572. Selects display standard
  1573. Param[0]
  1574. ^^^^^^^^
  1575. 0=NTSC, 1=PAL
  1576. CX2341X_DEC_GET_VERSION
  1577. ~~~~~~~~~~~~~~~~~~~~~~~
  1578. Enum: 17/0x11
  1579. Description
  1580. ^^^^^^^^^^^
  1581. Returns decoder firmware version information
  1582. Result[0]
  1583. ^^^^^^^^^
  1584. Version bitmask:
  1585. - Bits 0:15 build
  1586. - Bits 16:23 minor
  1587. - Bits 24:31 major
  1588. CX2341X_DEC_SET_STREAM_INPUT
  1589. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1590. Enum: 20/0x14
  1591. Description
  1592. ^^^^^^^^^^^
  1593. Select decoder stream input port
  1594. Param[0]
  1595. ^^^^^^^^
  1596. 0=memory (default), 1=streaming
  1597. CX2341X_DEC_GET_TIMING_INFO
  1598. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1599. Enum: 21/0x15
  1600. Description
  1601. ^^^^^^^^^^^
  1602. Returns timing information from start of playback
  1603. Result[0]
  1604. ^^^^^^^^^
  1605. Frame count by decode order
  1606. Result[1]
  1607. ^^^^^^^^^
  1608. Video PTS bits 0:31 by display order
  1609. Result[2]
  1610. ^^^^^^^^^
  1611. Video PTS bit 32 by display order
  1612. Result[3]
  1613. ^^^^^^^^^
  1614. SCR bits 0:31 by display order
  1615. Result[4]
  1616. ^^^^^^^^^
  1617. SCR bit 32 by display order
  1618. CX2341X_DEC_SET_AUDIO_MODE
  1619. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1620. Enum: 22/0x16
  1621. Description
  1622. ^^^^^^^^^^^
  1623. Select audio mode
  1624. Param[0]
  1625. ^^^^^^^^
  1626. Dual mono mode action
  1627. 0=Stereo, 1=Left, 2=Right, 3=Mono, 4=Swap, -1=Unchanged
  1628. Param[1]
  1629. ^^^^^^^^
  1630. Stereo mode action:
  1631. 0=Stereo, 1=Left, 2=Right, 3=Mono, 4=Swap, -1=Unchanged
  1632. CX2341X_DEC_SET_EVENT_NOTIFICATION
  1633. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1634. Enum: 23/0x17
  1635. Description
  1636. ^^^^^^^^^^^
  1637. Setup firmware to notify the host about a particular event.
  1638. Counterpart to API 0xD5
  1639. Param[0]
  1640. ^^^^^^^^
  1641. Event:
  1642. - 0=Audio mode change between mono, (joint) stereo and dual channel.
  1643. - 3=Decoder started
  1644. - 4=Unknown: goes off 10-15 times per second while decoding.
  1645. - 5=Some sync event: goes off once per frame.
  1646. Param[1]
  1647. ^^^^^^^^
  1648. Notification 0=disabled, 1=enabled
  1649. Param[2]
  1650. ^^^^^^^^
  1651. Interrupt bit
  1652. Param[3]
  1653. ^^^^^^^^
  1654. Mailbox slot, -1 if no mailbox required.
  1655. CX2341X_DEC_SET_DISPLAY_BUFFERS
  1656. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1657. Enum: 24/0x18
  1658. Description
  1659. ^^^^^^^^^^^
  1660. Number of display buffers. To decode all frames in reverse playback you
  1661. must use nine buffers.
  1662. Param[0]
  1663. ^^^^^^^^
  1664. 0=six buffers, 1=nine buffers
  1665. CX2341X_DEC_EXTRACT_VBI
  1666. ~~~~~~~~~~~~~~~~~~~~~~~
  1667. Enum: 25/0x19
  1668. Description
  1669. ^^^^^^^^^^^
  1670. Extracts VBI data
  1671. Param[0]
  1672. ^^^^^^^^
  1673. 0=extract from extension & user data, 1=extract from private packets
  1674. Result[0]
  1675. ^^^^^^^^^
  1676. VBI table location
  1677. Result[1]
  1678. ^^^^^^^^^
  1679. VBI table size
  1680. CX2341X_DEC_SET_DECODER_SOURCE
  1681. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1682. Enum: 26/0x1A
  1683. Description
  1684. ^^^^^^^^^^^
  1685. Selects decoder source. Ensure that the parameters passed to this
  1686. API match the encoder settings.
  1687. Param[0]
  1688. ^^^^^^^^
  1689. Mode: 0=MPEG from host, 1=YUV from encoder, 2=YUV from host
  1690. Param[1]
  1691. ^^^^^^^^
  1692. YUV picture width
  1693. Param[2]
  1694. ^^^^^^^^
  1695. YUV picture height
  1696. Param[3]
  1697. ^^^^^^^^
  1698. Bitmap: see Param[0] of API 0xBD
  1699. CX2341X_DEC_SET_PREBUFFERING
  1700. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1701. Enum: 30/0x1E
  1702. Description
  1703. ^^^^^^^^^^^
  1704. Decoder prebuffering, when enabled up to 128KB are buffered for
  1705. streams <8mpbs or 640KB for streams >8mbps
  1706. Param[0]
  1707. ^^^^^^^^
  1708. 0=off, 1=on
  1709. PVR350 Video decoder registers 0x02002800 -> 0x02002B00
  1710. -------------------------------------------------------
  1711. Author: Ian Armstrong <[email protected]>
  1712. Version: v0.4
  1713. Date: 12 March 2007
  1714. This list has been worked out through trial and error. There will be mistakes
  1715. and omissions. Some registers have no obvious effect so it's hard to say what
  1716. they do, while others interact with each other, or require a certain load
  1717. sequence. Horizontal filter setup is one example, with six registers working
  1718. in unison and requiring a certain load sequence to correctly configure. The
  1719. indexed colour palette is much easier to set at just two registers, but again
  1720. it requires a certain load sequence.
  1721. Some registers are fussy about what they are set to. Load in a bad value & the
  1722. decoder will fail. A firmware reload will often recover, but sometimes a reset
  1723. is required. For registers containing size information, setting them to 0 is
  1724. generally a bad idea. For other control registers i.e. 2878, you'll only find
  1725. out what values are bad when it hangs.
  1726. .. code-block:: none
  1727. --------------------------------------------------------------------------------
  1728. 2800
  1729. bit 0
  1730. Decoder enable
  1731. 0 = disable
  1732. 1 = enable
  1733. --------------------------------------------------------------------------------
  1734. 2804
  1735. bits 0:31
  1736. Decoder horizontal Y alias register 1
  1737. ---------------
  1738. 2808
  1739. bits 0:31
  1740. Decoder horizontal Y alias register 2
  1741. ---------------
  1742. 280C
  1743. bits 0:31
  1744. Decoder horizontal Y alias register 3
  1745. ---------------
  1746. 2810
  1747. bits 0:31
  1748. Decoder horizontal Y alias register 4
  1749. ---------------
  1750. 2814
  1751. bits 0:31
  1752. Decoder horizontal Y alias register 5
  1753. ---------------
  1754. 2818
  1755. bits 0:31
  1756. Decoder horizontal Y alias trigger
  1757. These six registers control the horizontal aliasing filter for the Y plane.
  1758. The first five registers must all be loaded before accessing the trigger
  1759. (2818), as this register actually clocks the data through for the first
  1760. five.
  1761. To correctly program set the filter, this whole procedure must be done 16
  1762. times. The actual register contents are copied from a lookup-table in the
  1763. firmware which contains 4 different filter settings.
  1764. --------------------------------------------------------------------------------
  1765. 281C
  1766. bits 0:31
  1767. Decoder horizontal UV alias register 1
  1768. ---------------
  1769. 2820
  1770. bits 0:31
  1771. Decoder horizontal UV alias register 2
  1772. ---------------
  1773. 2824
  1774. bits 0:31
  1775. Decoder horizontal UV alias register 3
  1776. ---------------
  1777. 2828
  1778. bits 0:31
  1779. Decoder horizontal UV alias register 4
  1780. ---------------
  1781. 282C
  1782. bits 0:31
  1783. Decoder horizontal UV alias register 5
  1784. ---------------
  1785. 2830
  1786. bits 0:31
  1787. Decoder horizontal UV alias trigger
  1788. These six registers control the horizontal aliasing for the UV plane.
  1789. Operation is the same as the Y filter, with 2830 being the trigger
  1790. register.
  1791. --------------------------------------------------------------------------------
  1792. 2834
  1793. bits 0:15
  1794. Decoder Y source width in pixels
  1795. bits 16:31
  1796. Decoder Y destination width in pixels
  1797. ---------------
  1798. 2838
  1799. bits 0:15
  1800. Decoder UV source width in pixels
  1801. bits 16:31
  1802. Decoder UV destination width in pixels
  1803. NOTE: For both registers, the resulting image must be fully visible on
  1804. screen. If the image exceeds the right edge both the source and destination
  1805. size must be adjusted to reflect the visible portion. For the source width,
  1806. you must take into account the scaling when calculating the new value.
  1807. --------------------------------------------------------------------------------
  1808. 283C
  1809. bits 0:31
  1810. Decoder Y horizontal scaling
  1811. Normally = Reg 2854 >> 2
  1812. ---------------
  1813. 2840
  1814. bits 0:31
  1815. Decoder ?? unknown - horizontal scaling
  1816. Usually 0x00080514
  1817. ---------------
  1818. 2844
  1819. bits 0:31
  1820. Decoder UV horizontal scaling
  1821. Normally = Reg 2854 >> 2
  1822. ---------------
  1823. 2848
  1824. bits 0:31
  1825. Decoder ?? unknown - horizontal scaling
  1826. Usually 0x00100514
  1827. ---------------
  1828. 284C
  1829. bits 0:31
  1830. Decoder ?? unknown - Y plane
  1831. Usually 0x00200020
  1832. ---------------
  1833. 2850
  1834. bits 0:31
  1835. Decoder ?? unknown - UV plane
  1836. Usually 0x00200020
  1837. ---------------
  1838. 2854
  1839. bits 0:31
  1840. Decoder 'master' value for horizontal scaling
  1841. ---------------
  1842. 2858
  1843. bits 0:31
  1844. Decoder ?? unknown
  1845. Usually 0
  1846. ---------------
  1847. 285C
  1848. bits 0:31
  1849. Decoder ?? unknown
  1850. Normally = Reg 2854 >> 1
  1851. ---------------
  1852. 2860
  1853. bits 0:31
  1854. Decoder ?? unknown
  1855. Usually 0
  1856. ---------------
  1857. 2864
  1858. bits 0:31
  1859. Decoder ?? unknown
  1860. Normally = Reg 2854 >> 1
  1861. ---------------
  1862. 2868
  1863. bits 0:31
  1864. Decoder ?? unknown
  1865. Usually 0
  1866. Most of these registers either control horizontal scaling, or appear linked
  1867. to it in some way. Register 2854 contains the 'master' value & the other
  1868. registers can be calculated from that one. You must also remember to
  1869. correctly set the divider in Reg 2874.
  1870. To enlarge:
  1871. Reg 2854 = (source_width * 0x00200000) / destination_width
  1872. Reg 2874 = No divide
  1873. To reduce from full size down to half size:
  1874. Reg 2854 = (source_width/2 * 0x00200000) / destination width
  1875. Reg 2874 = Divide by 2
  1876. To reduce from half size down to quarter size:
  1877. Reg 2854 = (source_width/4 * 0x00200000) / destination width
  1878. Reg 2874 = Divide by 4
  1879. The result is always rounded up.
  1880. --------------------------------------------------------------------------------
  1881. 286C
  1882. bits 0:15
  1883. Decoder horizontal Y buffer offset
  1884. bits 15:31
  1885. Decoder horizontal UV buffer offset
  1886. Offset into the video image buffer. If the offset is gradually incremented,
  1887. the on screen image will move left & wrap around higher up on the right.
  1888. --------------------------------------------------------------------------------
  1889. 2870
  1890. bits 0:15
  1891. Decoder horizontal Y output offset
  1892. bits 16:31
  1893. Decoder horizontal UV output offset
  1894. Offsets the actual video output. Controls output alignment of the Y & UV
  1895. planes. The higher the value, the greater the shift to the left. Use
  1896. reg 2890 to move the image right.
  1897. --------------------------------------------------------------------------------
  1898. 2874
  1899. bits 0:1
  1900. Decoder horizontal Y output size divider
  1901. 00 = No divide
  1902. 01 = Divide by 2
  1903. 10 = Divide by 3
  1904. bits 4:5
  1905. Decoder horizontal UV output size divider
  1906. 00 = No divide
  1907. 01 = Divide by 2
  1908. 10 = Divide by 3
  1909. bit 8
  1910. Decoder ?? unknown
  1911. 0 = Normal
  1912. 1 = Affects video output levels
  1913. bit 16
  1914. Decoder ?? unknown
  1915. 0 = Normal
  1916. 1 = Disable horizontal filter
  1917. --------------------------------------------------------------------------------
  1918. 2878
  1919. bit 0
  1920. ?? unknown
  1921. bit 1
  1922. osd on/off
  1923. 0 = osd off
  1924. 1 = osd on
  1925. bit 2
  1926. Decoder + osd video timing
  1927. 0 = NTSC
  1928. 1 = PAL
  1929. bits 3:4
  1930. ?? unknown
  1931. bit 5
  1932. Decoder + osd
  1933. Swaps upper & lower fields
  1934. --------------------------------------------------------------------------------
  1935. 287C
  1936. bits 0:10
  1937. Decoder & osd ?? unknown
  1938. Moves entire screen horizontally. Starts at 0x005 with the screen
  1939. shifted heavily to the right. Incrementing in steps of 0x004 will
  1940. gradually shift the screen to the left.
  1941. bits 11:31
  1942. ?? unknown
  1943. Normally contents are 0x00101111 (NTSC) or 0x1010111d (PAL)
  1944. --------------------------------------------------------------------------------
  1945. 2880 -------- ?? unknown
  1946. 2884 -------- ?? unknown
  1947. --------------------------------------------------------------------------------
  1948. 2888
  1949. bit 0
  1950. Decoder + osd ?? unknown
  1951. 0 = Normal
  1952. 1 = Misaligned fields (Correctable through 289C & 28A4)
  1953. bit 4
  1954. ?? unknown
  1955. bit 8
  1956. ?? unknown
  1957. Warning: Bad values will require a firmware reload to recover.
  1958. Known to be bad are 0x000,0x011,0x100,0x111
  1959. --------------------------------------------------------------------------------
  1960. 288C
  1961. bits 0:15
  1962. osd ?? unknown
  1963. Appears to affect the osd position stability. The higher the value the
  1964. more unstable it becomes. Decoder output remains stable.
  1965. bits 16:31
  1966. osd ?? unknown
  1967. Same as bits 0:15
  1968. --------------------------------------------------------------------------------
  1969. 2890
  1970. bits 0:11
  1971. Decoder output horizontal offset.
  1972. Horizontal offset moves the video image right. A small left shift is
  1973. possible, but it's better to use reg 2870 for that due to its greater
  1974. range.
  1975. NOTE: Video corruption will occur if video window is shifted off the right
  1976. edge. To avoid this read the notes for 2834 & 2838.
  1977. --------------------------------------------------------------------------------
  1978. 2894
  1979. bits 0:23
  1980. Decoder output video surround colour.
  1981. Contains the colour (in yuv) used to fill the screen when the video is
  1982. running in a window.
  1983. --------------------------------------------------------------------------------
  1984. 2898
  1985. bits 0:23
  1986. Decoder video window colour
  1987. Contains the colour (in yuv) used to fill the video window when the
  1988. video is turned off.
  1989. bit 24
  1990. Decoder video output
  1991. 0 = Video on
  1992. 1 = Video off
  1993. bit 28
  1994. Decoder plane order
  1995. 0 = Y,UV
  1996. 1 = UV,Y
  1997. bit 29
  1998. Decoder second plane byte order
  1999. 0 = Normal (UV)
  2000. 1 = Swapped (VU)
  2001. In normal usage, the first plane is Y & the second plane is UV. Though the
  2002. order of the planes can be swapped, only the byte order of the second plane
  2003. can be swapped. This isn't much use for the Y plane, but can be useful for
  2004. the UV plane.
  2005. --------------------------------------------------------------------------------
  2006. 289C
  2007. bits 0:15
  2008. Decoder vertical field offset 1
  2009. bits 16:31
  2010. Decoder vertical field offset 2
  2011. Controls field output vertical alignment. The higher the number, the lower
  2012. the image on screen. Known starting values are 0x011E0017 (NTSC) &
  2013. 0x01500017 (PAL)
  2014. --------------------------------------------------------------------------------
  2015. 28A0
  2016. bits 0:15
  2017. Decoder & osd width in pixels
  2018. bits 16:31
  2019. Decoder & osd height in pixels
  2020. All output from the decoder & osd are disabled beyond this area. Decoder
  2021. output will simply go black outside of this region. If the osd tries to
  2022. exceed this area it will become corrupt.
  2023. --------------------------------------------------------------------------------
  2024. 28A4
  2025. bits 0:11
  2026. osd left shift.
  2027. Has a range of 0x770->0x7FF. With the exception of 0, any value outside of
  2028. this range corrupts the osd.
  2029. --------------------------------------------------------------------------------
  2030. 28A8
  2031. bits 0:15
  2032. osd vertical field offset 1
  2033. bits 16:31
  2034. osd vertical field offset 2
  2035. Controls field output vertical alignment. The higher the number, the lower
  2036. the image on screen. Known starting values are 0x011E0017 (NTSC) &
  2037. 0x01500017 (PAL)
  2038. --------------------------------------------------------------------------------
  2039. 28AC -------- ?? unknown
  2040. |
  2041. V
  2042. 28BC -------- ?? unknown
  2043. --------------------------------------------------------------------------------
  2044. 28C0
  2045. bit 0
  2046. Current output field
  2047. 0 = first field
  2048. 1 = second field
  2049. bits 16:31
  2050. Current scanline
  2051. The scanline counts from the top line of the first field
  2052. through to the last line of the second field.
  2053. --------------------------------------------------------------------------------
  2054. 28C4 -------- ?? unknown
  2055. |
  2056. V
  2057. 28F8 -------- ?? unknown
  2058. --------------------------------------------------------------------------------
  2059. 28FC
  2060. bit 0
  2061. ?? unknown
  2062. 0 = Normal
  2063. 1 = Breaks decoder & osd output
  2064. --------------------------------------------------------------------------------
  2065. 2900
  2066. bits 0:31
  2067. Decoder vertical Y alias register 1
  2068. ---------------
  2069. 2904
  2070. bits 0:31
  2071. Decoder vertical Y alias register 2
  2072. ---------------
  2073. 2908
  2074. bits 0:31
  2075. Decoder vertical Y alias trigger
  2076. These three registers control the vertical aliasing filter for the Y plane.
  2077. Operation is similar to the horizontal Y filter (2804). The only real
  2078. difference is that there are only two registers to set before accessing
  2079. the trigger register (2908). As for the horizontal filter, the values are
  2080. taken from a lookup table in the firmware, and the procedure must be
  2081. repeated 16 times to fully program the filter.
  2082. --------------------------------------------------------------------------------
  2083. 290C
  2084. bits 0:31
  2085. Decoder vertical UV alias register 1
  2086. ---------------
  2087. 2910
  2088. bits 0:31
  2089. Decoder vertical UV alias register 2
  2090. ---------------
  2091. 2914
  2092. bits 0:31
  2093. Decoder vertical UV alias trigger
  2094. These three registers control the vertical aliasing filter for the UV
  2095. plane. Operation is the same as the Y filter, with 2914 being the trigger.
  2096. --------------------------------------------------------------------------------
  2097. 2918
  2098. bits 0:15
  2099. Decoder Y source height in pixels
  2100. bits 16:31
  2101. Decoder Y destination height in pixels
  2102. ---------------
  2103. 291C
  2104. bits 0:15
  2105. Decoder UV source height in pixels divided by 2
  2106. bits 16:31
  2107. Decoder UV destination height in pixels
  2108. NOTE: For both registers, the resulting image must be fully visible on
  2109. screen. If the image exceeds the bottom edge both the source and
  2110. destination size must be adjusted to reflect the visible portion. For the
  2111. source height, you must take into account the scaling when calculating the
  2112. new value.
  2113. --------------------------------------------------------------------------------
  2114. 2920
  2115. bits 0:31
  2116. Decoder Y vertical scaling
  2117. Normally = Reg 2930 >> 2
  2118. ---------------
  2119. 2924
  2120. bits 0:31
  2121. Decoder Y vertical scaling
  2122. Normally = Reg 2920 + 0x514
  2123. ---------------
  2124. 2928
  2125. bits 0:31
  2126. Decoder UV vertical scaling
  2127. When enlarging = Reg 2930 >> 2
  2128. When reducing = Reg 2930 >> 3
  2129. ---------------
  2130. 292C
  2131. bits 0:31
  2132. Decoder UV vertical scaling
  2133. Normally = Reg 2928 + 0x514
  2134. ---------------
  2135. 2930
  2136. bits 0:31
  2137. Decoder 'master' value for vertical scaling
  2138. ---------------
  2139. 2934
  2140. bits 0:31
  2141. Decoder ?? unknown - Y vertical scaling
  2142. ---------------
  2143. 2938
  2144. bits 0:31
  2145. Decoder Y vertical scaling
  2146. Normally = Reg 2930
  2147. ---------------
  2148. 293C
  2149. bits 0:31
  2150. Decoder ?? unknown - Y vertical scaling
  2151. ---------------
  2152. 2940
  2153. bits 0:31
  2154. Decoder UV vertical scaling
  2155. When enlarging = Reg 2930 >> 1
  2156. When reducing = Reg 2930
  2157. ---------------
  2158. 2944
  2159. bits 0:31
  2160. Decoder ?? unknown - UV vertical scaling
  2161. ---------------
  2162. 2948
  2163. bits 0:31
  2164. Decoder UV vertical scaling
  2165. Normally = Reg 2940
  2166. ---------------
  2167. 294C
  2168. bits 0:31
  2169. Decoder ?? unknown - UV vertical scaling
  2170. Most of these registers either control vertical scaling, or appear linked
  2171. to it in some way. Register 2930 contains the 'master' value & all other
  2172. registers can be calculated from that one. You must also remember to
  2173. correctly set the divider in Reg 296C
  2174. To enlarge:
  2175. Reg 2930 = (source_height * 0x00200000) / destination_height
  2176. Reg 296C = No divide
  2177. To reduce from full size down to half size:
  2178. Reg 2930 = (source_height/2 * 0x00200000) / destination height
  2179. Reg 296C = Divide by 2
  2180. To reduce from half down to quarter.
  2181. Reg 2930 = (source_height/4 * 0x00200000) / destination height
  2182. Reg 296C = Divide by 4
  2183. --------------------------------------------------------------------------------
  2184. 2950
  2185. bits 0:15
  2186. Decoder Y line index into display buffer, first field
  2187. bits 16:31
  2188. Decoder Y vertical line skip, first field
  2189. --------------------------------------------------------------------------------
  2190. 2954
  2191. bits 0:15
  2192. Decoder Y line index into display buffer, second field
  2193. bits 16:31
  2194. Decoder Y vertical line skip, second field
  2195. --------------------------------------------------------------------------------
  2196. 2958
  2197. bits 0:15
  2198. Decoder UV line index into display buffer, first field
  2199. bits 16:31
  2200. Decoder UV vertical line skip, first field
  2201. --------------------------------------------------------------------------------
  2202. 295C
  2203. bits 0:15
  2204. Decoder UV line index into display buffer, second field
  2205. bits 16:31
  2206. Decoder UV vertical line skip, second field
  2207. --------------------------------------------------------------------------------
  2208. 2960
  2209. bits 0:15
  2210. Decoder destination height minus 1
  2211. bits 16:31
  2212. Decoder destination height divided by 2
  2213. --------------------------------------------------------------------------------
  2214. 2964
  2215. bits 0:15
  2216. Decoder Y vertical offset, second field
  2217. bits 16:31
  2218. Decoder Y vertical offset, first field
  2219. These two registers shift the Y plane up. The higher the number, the
  2220. greater the shift.
  2221. --------------------------------------------------------------------------------
  2222. 2968
  2223. bits 0:15
  2224. Decoder UV vertical offset, second field
  2225. bits 16:31
  2226. Decoder UV vertical offset, first field
  2227. These two registers shift the UV plane up. The higher the number, the
  2228. greater the shift.
  2229. --------------------------------------------------------------------------------
  2230. 296C
  2231. bits 0:1
  2232. Decoder vertical Y output size divider
  2233. 00 = No divide
  2234. 01 = Divide by 2
  2235. 10 = Divide by 4
  2236. bits 8:9
  2237. Decoder vertical UV output size divider
  2238. 00 = No divide
  2239. 01 = Divide by 2
  2240. 10 = Divide by 4
  2241. --------------------------------------------------------------------------------
  2242. 2970
  2243. bit 0
  2244. Decoder ?? unknown
  2245. 0 = Normal
  2246. 1 = Affect video output levels
  2247. bit 16
  2248. Decoder ?? unknown
  2249. 0 = Normal
  2250. 1 = Disable vertical filter
  2251. --------------------------------------------------------------------------------
  2252. 2974 -------- ?? unknown
  2253. |
  2254. V
  2255. 29EF -------- ?? unknown
  2256. --------------------------------------------------------------------------------
  2257. 2A00
  2258. bits 0:2
  2259. osd colour mode
  2260. 000 = 8 bit indexed
  2261. 001 = 16 bit (565)
  2262. 010 = 15 bit (555)
  2263. 011 = 12 bit (444)
  2264. 100 = 32 bit (8888)
  2265. bits 4:5
  2266. osd display bpp
  2267. 01 = 8 bit
  2268. 10 = 16 bit
  2269. 11 = 32 bit
  2270. bit 8
  2271. osd global alpha
  2272. 0 = Off
  2273. 1 = On
  2274. bit 9
  2275. osd local alpha
  2276. 0 = Off
  2277. 1 = On
  2278. bit 10
  2279. osd colour key
  2280. 0 = Off
  2281. 1 = On
  2282. bit 11
  2283. osd ?? unknown
  2284. Must be 1
  2285. bit 13
  2286. osd colour space
  2287. 0 = ARGB
  2288. 1 = AYVU
  2289. bits 16:31
  2290. osd ?? unknown
  2291. Must be 0x001B (some kind of buffer pointer ?)
  2292. When the bits-per-pixel is set to 8, the colour mode is ignored and
  2293. assumed to be 8 bit indexed. For 16 & 32 bits-per-pixel the colour depth
  2294. is honoured, and when using a colour depth that requires fewer bytes than
  2295. allocated the extra bytes are used as padding. So for a 32 bpp with 8 bit
  2296. index colour, there are 3 padding bytes per pixel. It's also possible to
  2297. select 16bpp with a 32 bit colour mode. This results in the pixel width
  2298. being doubled, but the color key will not work as expected in this mode.
  2299. Colour key is as it suggests. You designate a colour which will become
  2300. completely transparent. When using 565, 555 or 444 colour modes, the
  2301. colour key is always 16 bits wide. The colour to key on is set in Reg 2A18.
  2302. Local alpha works differently depending on the colour mode. For 32bpp & 8
  2303. bit indexed, local alpha is a per-pixel 256 step transparency, with 0 being
  2304. transparent and 255 being solid. For the 16bpp modes 555 & 444, the unused
  2305. bit(s) act as a simple transparency switch, with 0 being solid & 1 being
  2306. fully transparent. There is no local alpha support for 16bit 565.
  2307. Global alpha is a 256 step transparency that applies to the entire osd,
  2308. with 0 being transparent & 255 being solid.
  2309. It's possible to combine colour key, local alpha & global alpha.
  2310. --------------------------------------------------------------------------------
  2311. 2A04
  2312. bits 0:15
  2313. osd x coord for left edge
  2314. bits 16:31
  2315. osd y coord for top edge
  2316. ---------------
  2317. 2A08
  2318. bits 0:15
  2319. osd x coord for right edge
  2320. bits 16:31
  2321. osd y coord for bottom edge
  2322. For both registers, (0,0) = top left corner of the display area. These
  2323. registers do not control the osd size, only where it's positioned & how
  2324. much is visible. The visible osd area cannot exceed the right edge of the
  2325. display, otherwise the osd will become corrupt. See reg 2A10 for
  2326. setting osd width.
  2327. --------------------------------------------------------------------------------
  2328. 2A0C
  2329. bits 0:31
  2330. osd buffer index
  2331. An index into the osd buffer. Slowly incrementing this moves the osd left,
  2332. wrapping around onto the right edge
  2333. --------------------------------------------------------------------------------
  2334. 2A10
  2335. bits 0:11
  2336. osd buffer 32 bit word width
  2337. Contains the width of the osd measured in 32 bit words. This means that all
  2338. colour modes are restricted to a byte width which is divisible by 4.
  2339. --------------------------------------------------------------------------------
  2340. 2A14
  2341. bits 0:15
  2342. osd height in pixels
  2343. bits 16:32
  2344. osd line index into buffer
  2345. osd will start displaying from this line.
  2346. --------------------------------------------------------------------------------
  2347. 2A18
  2348. bits 0:31
  2349. osd colour key
  2350. Contains the colour value which will be transparent.
  2351. --------------------------------------------------------------------------------
  2352. 2A1C
  2353. bits 0:7
  2354. osd global alpha
  2355. Contains the global alpha value (equiv ivtvfbctl --alpha XX)
  2356. --------------------------------------------------------------------------------
  2357. 2A20 -------- ?? unknown
  2358. |
  2359. V
  2360. 2A2C -------- ?? unknown
  2361. --------------------------------------------------------------------------------
  2362. 2A30
  2363. bits 0:7
  2364. osd colour to change in indexed palette
  2365. ---------------
  2366. 2A34
  2367. bits 0:31
  2368. osd colour for indexed palette
  2369. To set the new palette, first load the index of the colour to change into
  2370. 2A30, then load the new colour into 2A34. The full palette is 256 colours,
  2371. so the index range is 0x00-0xFF
  2372. --------------------------------------------------------------------------------
  2373. 2A38 -------- ?? unknown
  2374. 2A3C -------- ?? unknown
  2375. --------------------------------------------------------------------------------
  2376. 2A40
  2377. bits 0:31
  2378. osd ?? unknown
  2379. Affects overall brightness, wrapping around to black
  2380. --------------------------------------------------------------------------------
  2381. 2A44
  2382. bits 0:31
  2383. osd ?? unknown
  2384. Green tint
  2385. --------------------------------------------------------------------------------
  2386. 2A48
  2387. bits 0:31
  2388. osd ?? unknown
  2389. Red tint
  2390. --------------------------------------------------------------------------------
  2391. 2A4C
  2392. bits 0:31
  2393. osd ?? unknown
  2394. Affects overall brightness, wrapping around to black
  2395. --------------------------------------------------------------------------------
  2396. 2A50
  2397. bits 0:31
  2398. osd ?? unknown
  2399. Colour shift
  2400. --------------------------------------------------------------------------------
  2401. 2A54
  2402. bits 0:31
  2403. osd ?? unknown
  2404. Colour shift
  2405. --------------------------------------------------------------------------------
  2406. 2A58 -------- ?? unknown
  2407. |
  2408. V
  2409. 2AFC -------- ?? unknown
  2410. --------------------------------------------------------------------------------
  2411. 2B00
  2412. bit 0
  2413. osd filter control
  2414. 0 = filter off
  2415. 1 = filter on
  2416. bits 1:4
  2417. osd ?? unknown
  2418. --------------------------------------------------------------------------------
  2419. The cx231xx DMA engine
  2420. ----------------------
  2421. This page describes the structures and procedures used by the cx2341x DMA
  2422. engine.
  2423. Introduction
  2424. ~~~~~~~~~~~~
  2425. The cx2341x PCI interface is busmaster capable. This means it has a DMA
  2426. engine to efficiently transfer large volumes of data between the card and main
  2427. memory without requiring help from a CPU. Like most hardware, it must operate
  2428. on contiguous physical memory. This is difficult to come by in large quantities
  2429. on virtual memory machines.
  2430. Therefore, it also supports a technique called "scatter-gather". The card can
  2431. transfer multiple buffers in one operation. Instead of allocating one large
  2432. contiguous buffer, the driver can allocate several smaller buffers.
  2433. In practice, I've seen the average transfer to be roughly 80K, but transfers
  2434. above 128K were not uncommon, particularly at startup. The 128K figure is
  2435. important, because that is the largest block that the kernel can normally
  2436. allocate. Even still, 128K blocks are hard to come by, so the driver writer is
  2437. urged to choose a smaller block size and learn the scatter-gather technique.
  2438. Mailbox #10 is reserved for DMA transfer information.
  2439. Note: the hardware expects little-endian data ('intel format').
  2440. Flow
  2441. ~~~~
  2442. This section describes, in general, the order of events when handling DMA
  2443. transfers. Detailed information follows this section.
  2444. - The card raises the Encoder interrupt.
  2445. - The driver reads the transfer type, offset and size from Mailbox #10.
  2446. - The driver constructs the scatter-gather array from enough free dma buffers
  2447. to cover the size.
  2448. - The driver schedules the DMA transfer via the ScheduleDMAtoHost API call.
  2449. - The card raises the DMA Complete interrupt.
  2450. - The driver checks the DMA status register for any errors.
  2451. - The driver post-processes the newly transferred buffers.
  2452. NOTE! It is possible that the Encoder and DMA Complete interrupts get raised
  2453. simultaneously. (End of the last, start of the next, etc.)
  2454. Mailbox #10
  2455. ~~~~~~~~~~~
  2456. The Flags, Command, Return Value and Timeout fields are ignored.
  2457. - Name: Mailbox #10
  2458. - Results[0]: Type: 0: MPEG.
  2459. - Results[1]: Offset: The position relative to the card's memory space.
  2460. - Results[2]: Size: The exact number of bytes to transfer.
  2461. My speculation is that since the StartCapture API has a capture type of "RAW"
  2462. available, that the type field will have other values that correspond to YUV
  2463. and PCM data.
  2464. Scatter-Gather Array
  2465. ~~~~~~~~~~~~~~~~~~~~
  2466. The scatter-gather array is a contiguously allocated block of memory that
  2467. tells the card the source and destination of each data-block to transfer.
  2468. Card "addresses" are derived from the offset supplied by Mailbox #10. Host
  2469. addresses are the physical memory location of the target DMA buffer.
  2470. Each S-G array element is a struct of three 32-bit words. The first word is
  2471. the source address, the second is the destination address. Both take up the
  2472. entire 32 bits. The lowest 18 bits of the third word is the transfer byte
  2473. count. The high-bit of the third word is the "last" flag. The last-flag tells
  2474. the card to raise the DMA_DONE interrupt. From hard personal experience, if
  2475. you forget to set this bit, the card will still "work" but the stream will
  2476. most likely get corrupted.
  2477. The transfer count must be a multiple of 256. Therefore, the driver will need
  2478. to track how much data in the target buffer is valid and deal with it
  2479. accordingly.
  2480. Array Element:
  2481. - 32-bit Source Address
  2482. - 32-bit Destination Address
  2483. - 14-bit reserved (high bit is the last flag)
  2484. - 18-bit byte count
  2485. DMA Transfer Status
  2486. ~~~~~~~~~~~~~~~~~~~
  2487. Register 0x0004 holds the DMA Transfer Status:
  2488. - bit 0: read completed
  2489. - bit 1: write completed
  2490. - bit 2: DMA read error
  2491. - bit 3: DMA write error
  2492. - bit 4: Scatter-Gather array error