
USB Audio Design Guide 27/61
Bits
0:3 A tag (see below)
4:28 PCM encoded sample value
29:31 User bits (parity, etc)
Figure 20:
S/PDIF RX
Word
Structure
Tag Meaning
FRAME_X Sample on channel 0 (Left for stereo)
FRAME_Y Sample on another channel (Right if for stereo)
FRAME_Z Sample on channel 0 (Left), and the first sample of a frame; can be used if
the user bits need to be reconstructed.
Figure 21:
S/PDIF RX
Tags
3.11.1 Integration
The S/PDIF receive function communicates with the clockGen component with
passes audio data to the audio driver and handles locking to the S/PDIF clock
source if required (see Clock Recovery).
Ideally the parity of each word/sample received should be checked. This is done
using the built in crc32 function (see xs1.h):
/* Returns 1 for bad parity , else 0 */
static inline int badParity ( u nsigned x)
{
unsigned X = (x > >4) ;
crc32 (X, 0, 1) ;
return X & 1;
}
If bad parity is detected the word/sample is ignored, else the tag is inspected for
channel and the sample stored.
The following code snippet illustrates how the output of the S/PDIF receive compo-
nent could be used:
while (1) {
c_spdif_rx : > data ;
if( badParity ( data )
continue ;
tag = data & 0 xF ;
sample = ( data << 4) & 0 xFFFFFF00 ;
switch ( tag)
{
case FRAME_X :
REV 6.1
Kommentare zu diesen Handbüchern