UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
263 of 362
NXP Semiconductors
UM10208
Chapter 20: LPC2800 DAO
6.
Programming the DAO and SAO1
Data can be supplied to SAO1 and the DAO in one of three modes:
1. Fully interrupt-driven. All I
2
S output data is handled via interrupts.
2. Dedicated DMA. All I
2
S output data is fetched from memory by one or two dedicated
GPDMA channel(s). Typically the channel(s) are programmed to interrupt when it/they
empty a buffer.
3. Dynamic DMA assignment. One or two GPDMA channel(s) is/are selected and
configured when the application determines that I
2
S output should be done.
6.1 Setting up the DAO and SAO1
System initialization (reset) code should include the following steps if the DAO and SAO1
are used in the application:
1. Write the desired format codes to the I
2
S Format register.
2. Write the Stream I/O Configuration register with the prescribed/fixed bits. If the DAI is
used for I
2
S input, be sure that the DAI_OE bit is set properly for the DAI mode (see
).
3. Program the CGU to provide the desired DAO bit clock and route it to its DAO_BCK
output, and program a fractional divider to divide that bit clock by twice the number of
bits per word in stretched mode, and route the fractional divider output to its DAO_WS
output.
4. Write the SAO1 Interrupt Request register in the interrupt controller (INT_REQ20 -
0x8030 0460) to enable SAO1 interrupts at the desired priority level (see
5. Write the SAO1 Mask register with zero(es) in the desired interrupt condition(s). For
fully interrupt-driven applications, write a 0 to the LMTMK or LHALFMK bit (or RMTMK
or RHALFMK if only the R channel is used). For DMA operation, write a 0 to LUNDER
and/or RUNDER to allow interrupt for underrun (which indicates an error in DMA
operation or programming).
Since DAO always shifts the L and R values together, except for LUNDER and RUNDER
when using two DMA channels, there is no reason to enable both L and R interrupts.
6.2 Fully interrupt-driven data transfer
When an interrupt occurs and the SAO1 is the highest-priority interrupt request, the basic
interrupt service routine (ISR) transfers control to the specific ISR for the SAO1. On entry,
depending on which interrupt was enabled in step
above, the SAO1 ISR knows the
minimum number of L and/or R values that can be written to SAO1 (2 for LHALFMK or
RHALFMK, 4 for LMTMK or RMTMK). The following steps assume that the ISR reads
these values from one or two buffers in memory. The case in which the values are read
from another peripheral should be a straightforward variation on the steps described
below.