@@ -211,6 +211,60 @@ see :ref:`axi_dac dac-channel` section.
211211 To find the instantiation of this module search for ``up_dac_channel `` inside
212212 the IP's directory.
213213
214+ .. _generic-dac-register-access :
215+
216+ Register access
217+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218+
219+ The DAC IP supports **16 channels **, numbered from **0 to 15 **. The **base
220+ registers ** start at offset ``0x0 `` and the **common (global) registers ** start
221+ at address ``0x10 ``. Each **channel ** has its own register block, starting from
222+ address ``0x100 `` (for channel 0). Each subsequent channel is spaced by ``0x10 ``
223+ (HDL register address) or ``0x40 `` (Software addressing).
224+
225+ Let's say the DAC IP base address is 0x44A0_0000. Here is how the channel offset
226+ is computed:
227+
228+ .. math ::
229+
230+ \text {HDL}_{reg} = 0 x100 + (n \times 0 x10 ) \\
231+
232+ .. math ::
233+
234+ \text {Software}_{addr} = IP_BaseAddr + (\text {HDL}_{reg} << 2 ) = 0 x44 A0 \_0000 + 0 x400 + (n \times 0 x40 )
235+
236+ This means the first register's address ( **``CHAN_CNTRL`` **) is:
237+
238+ - For **channel 0 **:
239+
240+ - ``0x0100 `` (HDL register)=> ``0x44A0_0400 `` (Software addressing)
241+
242+ - For **channel 3 **:
243+
244+ - ``0x0130 `` (HDL register) => ``0x44A0_04C0 `` (Software addressing)
245+ - For **channel 15 **:
246+
247+ - ``0x01F0 `` (HDL register) => ``0x44A0_07C0 `` (Software addressing)
248+
249+ If you want to access the **``CHAN_CNTRL_3`` ** register, its address is:
250+
251+ - For **channel 0 **:
252+
253+ - ``0x0106 `` (HDL register) => ``0x44A6_0418 `` (Software addressing)
254+
255+ - For **channel 5 **:
256+
257+ - ``0x0156 `` (HDL register) => ``0x44A6_0558 `` (Software addressing)
258+ In general, the address for the ``CHAN_CNTRL_3 `` register of **channel *n* ** can be calculated as:
259+
260+ .. math ::
261+
262+ \text {HDL}_{reg} = 0 x100 + (n \times 0 x10 ) + 0 x06 \\
263+
264+ .. math ::
265+
266+ \text {Software}_{addr} = IP_base_addr + 0 x400 + (n \times 0 x40 ) + 0 x18
267+
214268 Typical Register Map base addresses
215269~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216270
0 commit comments