fw-memory.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. This document describes the cx2341x memory map and documents some of the register
  2. space.
  3. Note: the memory long words are little-endian ('intel format').
  4. Warning! This information was figured out from searching through the memory and
  5. registers, this information may not be correct and is certainly not complete, and
  6. was not derived from anything more than searching through the memory space with
  7. commands like:
  8. ivtvctl -O min=0x02000000,max=0x020000ff
  9. So take this as is, I'm always searching for more stuff, it's a large
  10. register space :-).
  11. Memory Map
  12. ==========
  13. The cx2341x exposes its entire 64M memory space to the PCI host via the PCI BAR0
  14. (Base Address Register 0). The addresses here are offsets relative to the
  15. address held in BAR0.
  16. 0x00000000-0x00ffffff Encoder memory space
  17. 0x00000000-0x0003ffff Encode.rom
  18. ???-??? MPEG buffer(s)
  19. ???-??? Raw video capture buffer(s)
  20. ???-??? Raw audio capture buffer(s)
  21. ???-??? Display buffers (6 or 9)
  22. 0x01000000-0x01ffffff Decoder memory space
  23. 0x01000000-0x0103ffff Decode.rom
  24. ???-??? MPEG buffers(s)
  25. 0x0114b000-0x0115afff Audio.rom (deprecated?)
  26. 0x02000000-0x0200ffff Register Space
  27. Registers
  28. =========
  29. The registers occupy the 64k space starting at the 0x02000000 offset from BAR0.
  30. All of these registers are 32 bits wide.
  31. DMA Registers 0x000-0xff:
  32. 0x00 - Control:
  33. 0=reset/cancel, 1=read, 2=write, 4=stop
  34. 0x04 - DMA status:
  35. 1=read busy, 2=write busy, 4=read error, 8=write error, 16=link list error
  36. 0x08 - pci DMA pointer for read link list
  37. 0x0c - pci DMA pointer for write link list
  38. 0x10 - read/write DMA enable:
  39. 1=read enable, 2=write enable
  40. 0x14 - always 0xffffffff, if set any lower instability occurs, 0x00 crashes
  41. 0x18 - ??
  42. 0x1c - always 0x20 or 32, smaller values slow down DMA transactions
  43. 0x20 - always value of 0x780a010a
  44. 0x24-0x3c - usually just random values???
  45. 0x40 - Interrupt status
  46. 0x44 - Write a bit here and shows up in Interrupt status 0x40
  47. 0x48 - Interrupt Mask
  48. 0x4C - always value of 0xfffdffff,
  49. if changed to 0xffffffff DMA write interrupts break.
  50. 0x50 - always 0xffffffff
  51. 0x54 - always 0xffffffff (0x4c, 0x50, 0x54 seem like interrupt masks, are
  52. 3 processors on chip, Java ones, VPU, SPU, APU, maybe these are the
  53. interrupt masks???).
  54. 0x60-0x7C - random values
  55. 0x80 - first write linked list reg, for Encoder Memory addr
  56. 0x84 - first write linked list reg, for pci memory addr
  57. 0x88 - first write linked list reg, for length of buffer in memory addr
  58. (|0x80000000 or this for last link)
  59. 0x8c-0xdc - rest of write linked list reg, 8 sets of 3 total, DMA goes here
  60. from linked list addr in reg 0x0c, firmware must push through or
  61. something.
  62. 0xe0 - first (and only) read linked list reg, for pci memory addr
  63. 0xe4 - first (and only) read linked list reg, for Decoder memory addr
  64. 0xe8 - first (and only) read linked list reg, for length of buffer
  65. 0xec-0xff - Nothing seems to be in these registers, 0xec-f4 are 0x00000000.
  66. Memory locations for Encoder Buffers 0x700-0x7ff:
  67. These registers show offsets of memory locations pertaining to each
  68. buffer area used for encoding, have to shift them by <<1 first.
  69. 0x07F8: Encoder SDRAM refresh
  70. 0x07FC: Encoder SDRAM pre-charge
  71. Memory locations for Decoder Buffers 0x800-0x8ff:
  72. These registers show offsets of memory locations pertaining to each
  73. buffer area used for decoding, have to shift them by <<1 first.
  74. 0x08F8: Decoder SDRAM refresh
  75. 0x08FC: Decoder SDRAM pre-charge
  76. Other memory locations:
  77. 0x2800: Video Display Module control
  78. 0x2D00: AO (audio output?) control
  79. 0x2D24: Bytes Flushed
  80. 0x7000: LSB I2C write clock bit (inverted)
  81. 0x7004: LSB I2C write data bit (inverted)
  82. 0x7008: LSB I2C read clock bit
  83. 0x700c: LSB I2C read data bit
  84. 0x9008: GPIO get input state
  85. 0x900c: GPIO set output state
  86. 0x9020: GPIO direction (Bit7 (GPIO 0..7) - 0:input, 1:output)
  87. 0x9050: SPU control
  88. 0x9054: Reset HW blocks
  89. 0x9058: VPU control
  90. 0xA018: Bit6: interrupt pending?
  91. 0xA064: APU command
  92. Interrupt Status Register
  93. =========================
  94. The definition of the bits in the interrupt status register 0x0040, and the
  95. interrupt mask 0x0048. If a bit is cleared in the mask, then we want our ISR to
  96. execute.
  97. Bit
  98. 31 Encoder Start Capture
  99. 30 Encoder EOS
  100. 29 Encoder VBI capture
  101. 28 Encoder Video Input Module reset event
  102. 27 Encoder DMA complete
  103. 24 Decoder audio mode change detection event (through event notification)
  104. 22 Decoder data request
  105. 20 Decoder DMA complete
  106. 19 Decoder VBI re-insertion
  107. 18 Decoder DMA err (linked-list bad)
  108. Missing
  109. Encoder API call completed
  110. Decoder API call completed
  111. Encoder API post(?)
  112. Decoder API post(?)
  113. Decoder VTRACE event