@@ -218,50 +218,59 @@ see :ref:`axi_adc adc-channel` section.
218218 To find the instantiation of this module search for ``up_adc_channel `` inside
219219 the IP's directory.
220220
221+ .. _generic-adc-register-access :
222+
221223Register access
222224~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223225
224226The ADC IP supports **16 channels **, numbered from **0 to 15 **. The **base
225227registers ** start at offset ``0x0 `` and the **common (global) registers ** start
226- at offset ``0x10 ``. Each **channel ** has its own register block, starting from
227- offset ``0x100 `` (for channel 0). Each subsequent channel is spaced by ``0x10 ``
228- (HDL addressing ) or ``0x40 `` (WORD aligned ).
228+ at address ``0x10 ``. Each **channel ** has its own register block, starting from
229+ address ``0x100 `` (for channel 0). Each subsequent channel is spaced by ``0x10 ``
230+ (HDL register address ) or ``0x40 `` (Software addressing ).
229231
230232Let's say the ADC IP base address is 0x44A0_0000. Here is how the channel offset
231233is computed:
232234
233235.. math ::
234236
235- \text {Address}_{HDL} = 0 x44 A0 \_0000 + 0 x100 + (n \times 0 x10 ) \\
236- \text {Address}_{WORD} = 0 x44 A0 \_0000 + 0 x400 + (n \times 0 x40 )
237+ \text {HDL}_{reg} = 0 x100 + (n \times 0 x10 ) \\
238+
239+ .. math ::
240+
241+ \text {Software}_{addr} = IP_BaseAddr + (\text {HDL}_{reg} << 2 ) = 0 x44 A0 \_0000 + 0 x400 + (n \times 0 x40 )
237242
238243 This means the first register's address ( **``CHAN_CNTRL`` **) is:
239244
240245- For **channel 0 **:
241- - ``0x44A0_0100 `` (HDL addressing)
242- - ``0x44A0_0400 `` (WORD aligned addressing)
246+
247+ - ``0x0100 `` (HDL register)=> ``0x44A0_0400 `` (Software addressing)
248+
243249- For **channel 3 **:
244- - `` 0x44A0_0140 `` (HDL addressing)
245- - ``0x44A0_0500 `` (WORD aligned addressing)
250+
251+ - ``0x0130 `` (HDL register) => `` 0x44A0_04C0 `` (Software addressing)
246252- For **channel 15 **:
247- - `` 0x44A0_01F0 `` (HDL addressing)
248- - ``0x44A0_07C0 `` (WORD aligned addressing)
253+
254+ - ``0x01F0 `` (HDL register) => `` 0x44A0_07C0 `` (Software addressing)
249255
250256If you want to access the **``CHAN_CNTRL_3`` ** register, its address is:
251257
252258- For **channel 0 **:
253- - ``0x44A6_0106 `` (HDL addressing)
254- - ``0x44A6_0418 `` (WORD aligned addressing)
259+
260+ - ``0x0106 `` (HDL register) => ``0x44A6_0418 `` (Software addressing)
261+
255262- For **channel 5 **:
256- - ``0x44A6_0156 `` (HDL addressing)
257- - ``0x44A6_0558 `` (WORD aligned addressing)
258263
264+ - ``0x0156 `` (HDL register) => ``0x44A6_0558 `` (Software addressing)
259265In general, the address for the ``CHAN_CNTRL_3 `` register of **channel *n* ** can be calculated as:
260266
261267.. math ::
268+
269+ \text {HDL}_{reg} = 0 x100 + (n \times 0 x10 ) + 0 x06 \\
262270
263- \text {Address}_{HDL} = 0 x44 A6 \_0000 + 0 x100 + (n \times 0 x10 ) + 0 x06 \\
264- \text {Address}_{WORD} = 0 x44 A6 \_0000 + 0 x400 + (n \times 0 x40 ) + 0 x18
271+ .. math ::
272+
273+ \text {Software}_{addr} = IP_base_addr + 0 x400 + (n \times 0 x40 ) + 0 x18
265274
266275 Typical Register Map base addresses
267276~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments