Part Number Hot Search : 
E100A DPA425 P6KE200A TLE4250G HMC361G8 CP302 P6KE250 1N2976
Product Description
Full Text Search
 

To Download AN162-2 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 AN162 APPLICATION NOTE
BROADCAST SYSTEMS: APPLICATION CODE USER'S GUIDE FOR THE CS4931X/CS49330 FAMILY
Contents
Dolby DigitalTM (AC-3TM) Description AAC Description Stereo MPEG-1, Layers 1 and 2; Stereo MPEG-2, Layer 2 Description MPEG-1, Audio Layer 3 (MP3) Description Flexible Audio/Video (AV) Sync Algorithm Hardware Configurations Supported by the CS4931X/CS49330 and AC-3, AAC, MPEG Stereo, and MP3
-- Parallel Data Delivery Support -- Serial Data Delivery Support
Understanding Application Messaging Protocols
-- Indexed Module Communication Protocol -- Stand-Alone Messaging Protocol
How to Control Common Application Modules such as:
-- Audio Manager -- PES Manager -- Unsolicited Messages
How to Control Stand-Alone Messages:
-- WRITE_STC, READ_STC_PTS, CHANNEL_CHANGE_REQUEST, AV_SYNC_LOST, AV_SYNC_DRIFT, AV_SYNC_TIMEOUT, INPUT_FIFO_OVERFLOW, CLEAR_INPUT_FIFO_OVERFLOW, INPUT_FIFO_LEVEL
Software Naming Convention Document Strategy
(R)
How to Control Specific Application Modules such as:
-- -- -- -- AC-3: AC-3 Manager AAC: AAC Manager MPEG: MPEG Stereo Manager MP3: MP3E Manager
DIGITAL SOUND
TM
(R)
CRYSTAL
(R)
PROCESSING
IEC61937 Data Stream OR Lt,Rt (or L,R) Downmixed Output
IEC61937 Data Stream Up to 5 Discrete Channels Specific only to AC3E, AC3P, AASE and AASP Codes
Dualzone Either Lt,Rt (or L,R) Downmixed 2 Channel Output (in IEC60958 or Digital Audio Format) or IEC61937 Compressed Data Stream Up to 5.1 Discrete Channels
2 Channel Lt,Rt (or L,R) Downmixed Output AV Sync Module Specific only to PES Codes Up to 5 Discrete Channels Audio Manager
ES/PES to IEC61937 Packer Up to 5.1 Discrete Channels
AC-3, AAC, MPEG, or MP3 Enable AC-3, AAC, MPEG, and MP3 Decode CMPDAT/ Parallel
Downmix
Up to 5 Discrete Channels Output Mode Control 0.1 (Sub) LFE Enable
Up to 5.1 Discrete Channels
33-Bit STC Counter
Volume/Mute Channel Remap
P.O. Box 17847, Austin, Texas 78760 (512) 445 7222 FAX: (512) 445 7581 http://www.cirrus.com
Copyright Cirrus Logic, Inc. 2001 (All Rights Reserved)
MAY `01 AN162REV2 1
AN162
TABLE OF CONTENTS
1. OVERVIEW................................................................................................................................ 6 1.1 Document Strategy ............................................................................................................. 6 0.0.1 Hardware Documentation ...................................................................................... 6 0.0.2 CS493XX Application Code User's Guides ........................................................... 7 1.2 Using the CS4931X/CS49330 .......................................................................................... 15 1.3 Software Naming Convention........................................................................................... 15 1.4 Understanding the Feature Set of a Device vs. the Application Code.............................. 15 1.5 Dolby Digital Description .................................................................................................. 16 1.6 AAC Description ............................................................................................................... 17 1.7 MPEG Description ............................................................................................................ 18 1.8 MP3 Description ............................................................................................................... 19 2. HARDWARE CONFIGURATION ............................................................................................ 20 2.1 Supported Input/Output Modes ........................................................................................ 20 2.1.1 DSP Clock Speed Dependent on Fs.................................................................... 20 2.1.2 Configuring the XMT958/AUDAT3 Data Format.................................................. 20 2.1.3 S/PDIF (AES/EBU) Channel Status Block Control .............................................. 21 2.1.4 S/PDIF (AES/EBU) Validity Bit Control ................................................................ 23 3. APPLICATION MESSAGING PROTOCOLS .......................................................................... 24 3.1 Indexed Module Communication Protocol ........................................................................ 24 3.1.1 Write Session....................................................................................................... 25 3.1.2 Solicited Read Message Format.......................................................................... 25 3.1.3 Unsolicited Read Message Format...................................................................... 28 3.2 Stand-Alone Message Communication Protocol .............................................................. 29 3.2.1 Host Message ...................................................................................................... 29 3.2.2 DSP Response Message..................................................................................... 29 4. BROADCAST SYSTEM CONSIDERATIONS......................................................................... 31 4.1 Audio Dropout................................................................................................................... 31 4.1.1 PLL Re-Lock ........................................................................................................ 31
Contacting Cirrus Logic Support
For a complete listing of Direct Sales, Distributor, and Sales Representative contacts, visit the Cirrus Logic web site at: http://www.cirrus.com/corporate/contacts/sales.cfm
Dolby Digital, AC-3, Dolby Pro Logic, Dolby Pro Logic II, Dolby Surround, Surround EX, Virtual Dolby Digital and the "AAC" logo are trademarks and the "Dolby Digital Logo", "Dolby" and the double-"D" symbol are registered trademarks of Dolby Laboratories Licensing Corporation. D TS, DTS Digital Surround, DTS-ES Extended Surround, DTS Neo:6, and DTS Virtual 5.1 are trademarks and the "DTS" , "DTS-ES", "DTS Virtual 5.1" logos are a registered trademarks of the Digital Theater Systems Corporation. The "MPEG Logo" is a registered trademark of Philips Electronics N.V. THX is a registered trademark of Lucasfilm Ltd. Suround EX is a jointly developed technology THX and Dolby Labs, Inc. AAC (Advanced Audio Coding) is an "MPEG-2-standard-based" digital audio compression algorithm (offering up 5.1 discrete decoded channels for this implementation) collaboratively developed by AT&T, the Fraunhofer Institute, Dolby Laboratories, and the Sony Corporation. MLP and Meridian Lossless Packing are registered trademarks of Meridian Audio Ltd. Harman VMAx is a registered trademark of Harman Internaltional. Logic 7 is a registered trademark of Lexicon. SRS CircleSur round and SRS TruSurround are a trademark of SRS Labs, Inc. The HDCD logo, HDCD, High Definition Compatible Digital and Pacific Microsonics are either registered trademarks or trademarks of Pacific Microsonics, Inc. in the United States and/or other countries. HDCD technology provided under license from Pacific Microsonics, Inc. This product's software is covered by one or more of the following in the United States: 5,479,168; 5,638,074; 5,640,161; 5,872,531; 5,808,574; 5,838,274; 5,854,600; 5,864,311; and in Australia: 669114; with other patents pending.The "Crystal Logo" and the "Crystal Digital Sound Processing Logo" are registered trademarks of Cirrus Logic, Inc. Preliminary product information describes products which are in production, but for which full characterization data is not yet available. Advance product information describes products which are in development and subject to development changes. Cirrus Logic, Inc. has made best efforts to ensure that the information contained in this document is accurate and reliable. However, the information is subject to change without notice and is provided "AS IS" without warranty of any kind (express or implied). No responsibility is assumed by Cirrus Logic, Inc. for the use of this information, nor for infringements of patents or other rights of third parties. This document is the property of Cirrus Logic, Inc. and implies no license under patents, copyrights, trademarks, or trade secrets. No part of this publication may be copied, reproduced, stored in a retrieval system, or transmitted, in any form or by any means (electronic, mechanical, photographic, or otherwise) without the prior written consent of Cirrus Logic, Inc. Items from any Cirrus Loic website or disk may be g printed for use by the user. However, no part of the printout or electronic files may be copied, reproduced, stored in a retrieval system, or transmitted, in any form or by any means (electronic, mechanical, photographic, or otherwise) without the prior written consent of Cirrus Logic, Inc.The names of products of Cirrus Logic, Inc. or other vendors and suppliers appearing in this document may be trademarks or service marks of their respective owners which may be registered in some jurisdictions. A list of Cirrus Logic, Inc. trademarks and service marks can be found at http://www.cirrus.com.
2
AN162REV2
AN162
4.1.2 Loss of Frame Sync ............................................................................................. 31 4.1.3 CRC Errors .......................................................................................................... 31 4.1.4 Input Overflow...................................................................................................... 32 4.1.5 PCM Output Buffer Underflow ............................................................................. 32 4.1.6 AV SYNC Problems ............................................................................................. 32 4.2 General AV SYNC Description ......................................................................................... 32 4.3 Audio/Video Synchronization Algorithm for the CS4931X/CS49330 ................................ 33 4.3.1 AV SYNC Lost ..................................................................................................... 33 4.3.2 AV SYNC Search................................................................................................. 35 4.3.3 AV SYNC Lock..................................................................................................... 35 4.3.4 Manual Control of AV SYNC................................................................................ 36 4.3.5 Enabling AV SYNC .............................................................................................. 36 4.3.6 Window Sizing ..................................................................................................... 37 4.4 System Clocking............................................................................................................... 37 4.4.1 Compressed Data Input Clock ............................................................................. 38 4.4.2 DSP Clock............................................................................................................ 38 4.4.3 PCM Audio Output Clocks ................................................................................... 38 4.4.4 Input/Output Clock Relationship .......................................................................... 38 4.4.5 No AV SYNC, Slave to Audio Clocks................................................................... 39 4.4.6 No AV SYNC, Master Audio Clocks..................................................................... 39 4.4.7 AV SYNC ............................................................................................................. 39 5. COMMON APPLICATION MODULES .................................................................................... 40 5.1 Audio Manager for Dolby Digital, AAC, MPEG and MP3 ................................................. 41 5.1.1 Audio_Mgr_Control (Index 0x00) ......................................................................... 44 5.1.2 Mute (Index 0x0d) ................................................................................................ 44 5.1.3 PLL Registers (Indexes 0x17 - 0x1c)................................................................... 44 5.1.4 Special Notes about PCM Mixing Functionality available with AASE and AASP Application Codes ............................................ 44 5.2 PES Manager ................................................................................................................... 45 5.2.1 PES_CONTROL_AND_AV_SYNC_ STATUS (Index 0x00) ......................................................................................... 45 5.2.2 Instant_PTS-STC (Index 0x04)............................................................................ 45 5.2.3 Drift_Thresh (Index 0x05) .................................................................................... 49 5.2.4 XMT_L_Volume (Index 0x06) .............................................................................. 49 5.2.5 XMT R_Volume (Index 0x07)............................................................................... 49 5.2.6 Lock_Attempt_Thresh (Index 0x08) ........................................................................................................ 49 5.2.7 Lock_Attempt_Fail_Thresh (Index 0x09) ............................................................. 49 5.2.8 Lock_Thresh (Index 0x0a) ................................................................................... 50 5.2.9 AV_Sync_Lost_Thresh (Index 0x0b) ........................................................................................................ 50 5.3 Unsolicited Messages (Read-Only) .................................................................................. 50 5.3.1 PES ID Detection ................................................................................................. 50 6. COMMON STAND-ALONE MESSAGES................................................................................ 52 6.1 WRITE_STC [PES Codes] ............................................................................................... 52 6.1.1 EN - AV SYNC Enable......................................................................................... 52 6.1.2 IGN - Ignore EN Bit .............................................................................................. 52 6.1.3 STC_LSB ............................................................................................................. 52 6.1.4 STC_MSB ............................................................................................................ 53 6.2 READ_STC_PTS [PES Codes] ........................................................................................ 53 6.2.1 SEL - STC/PTS Select......................................................................................... 53 6.2.2 SEL - STC/PTS Select......................................................................................... 53
AN162REV2
3
AN162
6.2.3 STC_PTS_LSB .................................................................................................... 53 6.2.4 STC_PTS_MSB ................................................................................................... 53 6.3 CHANNEL_CHANGE_REQUEST [PES Codes] .............................................................. 54 6.3.1 EN ........................................................................................................................ 54 6.3.2 Channel Change Procedure................................................................................. 55 6.3.3 Channel Change Procedure Notes ...................................................................... 55 6.4 AV_SYNC_LOST [PES Codes] ........................................................................................ 55 6.4.1 IPS - Instantaneous PTS-STC Select .................................................................. 56 6.4.2 AVD - Auto Disable Status ................................................................................... 56 6.5 AV_SYNC_DRIFT [PES Codes] ....................................................................................... 56 6.5.1 DRIFT_RELOCK_STATUS.................................................................................. 56 6.5.2 PTS-STC.............................................................................................................. 57 6.6 AV_SYNC_TIMEOUT [PES Codes] ................................................................................. 57 6.6.1 PTS-STC.............................................................................................................. 58 6.7 INPUT_FIFO_OVERFLOW .............................................................................................. 58 6.7.1 OVR - Overflow Status......................................................................................... 58 6.8 CLEAR_INPUT_FIFO_OVERFLOW ................................................................................ 59 6.9 INPUT_FIFO_LEVEL........................................................................................................ 59 6.9.1 PUT ...................................................................................................................... 59 6.9.2 GET...................................................................................................................... 60 7. AC-3 SPECIFIC MODULE....................................................................................................... 61 7.1 AC-3 Manager................................................................................................................... 61 7.1.1 AC3_CONTROL (Index 0x00).............................................................................. 65 7.1.2 OUTPUT_MODE_CONTROL (Index 0x01) ........................................................................................................ 65 7.1.3 Down mix Equation for Lt, Rt (Pro Logic Encoded) Output ................................................................................ 65 7.1.4 AC-3 Stream Information ..................................................................................... 65 8. AAC SPECIFIC MODULE ....................................................................................................... 66 8.1 AAC Manager ................................................................................................................... 67 8.1.1 AAC_CONTROL (Index 0x00) ............................................................................. 71 8.1.2 Down mix Equation for Lt, Rt (ProLogic Encoded) Output................................... 71 8.1.3 AAC Stream Information ...................................................................................... 71 8.1.4 Implicit Speaker Mapping..................................................................................... 72 9. MPEG SPECIFIC MODULE..................................................................................................... 73 9.1 MPEG Stereo Manager..................................................................................................... 73 9.1.1 MPEG_CONTROL (Index 0x00) .......................................................................... 75 9.1.2 MPEG Stream Information ................................................................................... 75 10. MP3E SPECIFIC MODULE ................................................................................................... 76 10.1 MP3E Manager ............................................................................................................... 76 10.1.1 MP3E_CONTROL (Index 0x00)......................................................................... 78 11. APPLICATION CONFIGURATION EXAMPLES ................................................................... 79 11.1 AC-3 Decode with Unsolicited PES ID Reporting ........................................................... 79 11.2 MPEG Decode ................................................................................................................ 79
4
AN162REV2
AN162
LIST OF FIGURES
Figure 1. Typical Broadcast System ............................................................................................... 7 Figure 2. Dolby Digital Block Diagram .......................................................................................... 16 Figure 3. AAC Block Diagram for AASE and AASP Codes .......................................................... 17 Figure 4. AAC Block Diagram for AACE and AACP Codes .......................................................... 17 Figure 5. MPEG Stereo Block Diagram ........................................................................................ 18 Figure 6. MP3 Block Diagram ....................................................................................................... 19 Figure 7. Example of Pseudocode Used to Configure the CS4931X/CS49330 for AC-3 Decode with Unsolicited PES ID Reporting Enabled ................................................................. 80
LIST OF TABLES
Table 1. Hardware Configurations Supported by AC-3, AAC, MPEG, or MP3 Broadcast Codes.............................................................. 20 Table 2. Professional Channel Status bytes 0, 1 and 3 ................................................................ 21 Table 3. Consumer Channel Status Bytes 0, 1 and 3 ................................................................... 22 Table 4. Write Message Format.................................................................................................... 25 Table 5. Read Command Message Format .................................................................................. 27 Table 6. Read Response Message Format .................................................................................. 27 Table 7. Unsolicited Read Message Format ................................................................................. 28 Table 8. Host Message Format..................................................................................................... 30 Table 9. DSP Response Message Format.................................................................................... 30 Table 10. Audio Manager.............................................................................................................. 41 Table 11. PES Manager................................................................................................................ 46 Table 12. Unsolicited Messages ................................................................................................... 50 Table 13. WRITE_STC (Host Command) ..................................................................................... 52 Table 14. READ_STC_PTS (Host Command).............................................................................. 53 Table 15. READ_STC_PTS (DSP Response Command and Data)............................................. 53 Table 16. CHANNEL_CHANGE_REQUEST (Host Command).................................................... 54 Table 17. CHANNEL_CHANGE_REQUEST (DSP Response Command and Data) ................... 54 Table 18. AV_SYNC_LOST (DSP Response Command and Data)............................................. 56 Table 19. AV_SYNC_DRIFT (DSP Response Command and Data)............................................ 57 Table 20. AV_SYNC_TIMEOUT (DSP Response Command and Data) ...................................... 57 Table 21. INPUT_FIFO_OVERFLOW (Host Command) .............................................................. 58 Table 22. INPUT_FIFO_OVERFLOW (DSP Response Command and Data) ............................. 58 Table 23. CLEAR_INPUT_FIFO_OVERFLOW............................................................................. 59 Table 24. INPUT_FIFO_LEVEL (Host Command)........................................................................ 59 Table 25. INPUT_FIFO_LEVEL (DSP Response Command and Data)....................................... 59 Table 26. AC-3 Manager............................................................................................................... 61 Table 27. AAC Manager................................................................................................................ 67 Table 28. Implicit Speaker Mapping.............................................................................................. 72 Table 29. MPEG Manager ............................................................................................................ 73 Table 30. MP3E Manager ............................................................................................................. 76 Table 31. AC-3 Decode with Unsolicited PES ID Reporting ......................................................... 79 Table 32. MPEG Decode .............................................................................................................. 80
AN162REV2
5
AN162
1. OVERVIEW
The CS4931X/CS49330 is a family of system on a chip solutions for Stereo and Multichannel audio decompression and digital signal processing. Since the part is RAM-based, a download of application software is required each time the CS4931X/CS49330 is powered up. The CS493XX family is generally targeted at three different market segments.
The broadcast market, where audio/video (A/V) synchronization is sometimes required The DVD Player market, where audio/video (A/V) synchronization is sometimes required The outboard decoder markets, where audio/video synchronization is not required
Another important differentiation between these applications is the format in which the data will be received by the CS49300 Family DSP. In systems where A/V synchronization is required from the CS4931X/CS49330, the incoming data is typically PES (Packetized Elementary Stream) encoded. In an outboard decoder application the data typically comes in the IEC61937 format (as specified by the DVD consortium). In DVD players, where A/V synchronization is not required, data is typically delivered in an ES (Elementary Stream) format. An important point to remember is that the CS49300 Family can support all three environments, but different device numbers and downloads are required depending on the input data type. Broadcast applications include (but are not limited to) digital cable and satellite set-top box applications, digital radio receivers, and integrated digital TVs. Data input can be ES (Elementary Stream) or PES in format, and either serial or parallel in delivery. Data delivery is typically bursty in nature and is handled via a throttle mechanism as seen in Figure 1 on page 7. DVD-Audio Players are unique in that they may have the additional requirement of MLP(R) (Meridian Lossless Packing) Technology and other compressed audio decoding algorithms that are not needed in the Broadcast market, yet may or may
not require A/V synchronization. Data delivery can be ES, PES, or IEC61937 depending on the implementation. Often times, a system may be a hybrid between an outboard decoder and a broadcast system, depending on its functionality. Outboard decoder applications include stand-alone decoders and audio/video receivers, where data is delivered by way of a S/PDIF optical or coaxial cable, where the data is formatted IEC61937 (for compressed data) or IEC60958 (for PCM data). This document includes a brief description of hardware configuration and detailed descriptions of the application messaging protocol, application control modules, and application configuration examples. The main body covers all the features included in the broadcast application code for decoding ES or PES formatted AC-3 data; MPEG-1, Layers 1 and 2 Stereo data; MPEG-2 Layer 2 Stereo data; and MPEG-2 AAC data. This guide also includes a detailed discussion of the AV Sync Algorithm. Figure 1 on page 7 displays the interaction between the demux, host controller, and the CS4931X/CS49330 in a typical broadcast system.
1.1 Document Strategy
Multiple documents are needed to fully define, understand and implement the functionality of the CS4931X/CS49330. They can be split up into two basic groups: hardware and application code documentation. It should be noted that hardware and application code are co-dependent and one can not successfully use the part without an understanding of both. The "ANXXX" notation denotes the application note number under which the respective software User's Guide was released.
0.0.1 Hardware Documentation CS49300 Family Data Sheet
This document describes the electrical characteristics of the device from timing to base functionality. This is the hardware designers tool to learn the part's electrical and systems requirements.
6
AN162REV2
AN162
Host Controller INTERRUPT Control
CS4931X INTREQ Control AUDATA0 AUDATA1 AUDATA2 CMPDAT CMPCLK Flow Control CMPREQ CLKIN
PLL
XMT958
S/PDIF Out
PES/ES Delivery System
Data Out Data Clock Throttle System_27MHz
PCM Out PCM Out PCM Out MCLK SCLK LRCLK
Figure 1. Typical Broadcast System
0.0.2 CS493XX Application Code User's Guides
The following application notes describe the application codes used with the CS493XX. Whenever an application code user's guide is referred to, it should be assumed that one or more of the below documents are being referenced. This list will grow with each new application released. For the most current list of released user's guides and application codes please refer to the CS4931x/CS49330 Part Matrix vs. Code Matrix and the CS4932x/CS49330 Part Matrix vs. Code Matrix available from the CS49300 Page. All appendices covering proprietary algorithms such as: DTS-ESTM, DTS Neo:6, Dolby Digital with Dolby Pro Logic II, Virtual Dolby DigitalTM, VMAx, SRS CircleSurroundTM, HDCD(R), Logic 7TM, SRS TruSurroundTM, and THX(R)/THX(R) Surround EXTM, in addition to the corresponding device-specific codes are available from Cirrus Logic. All application codes are only available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after the proper IP rights have been confirmed (i.e. - the end-customer has a Dolby Digital License, DTS License, etc.). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design.
AN161 DVD Audio/Video Systems: Application Code User's Guide for the CS4930X This guide describes all application code (e.g. Dolby Digital; DTS; MPEG-1, Layer 3 (MP3); MPEG-2, Layer 3 (a.k.a. MP3); MPEG-2, Layer 2 Multichannel.) intended specifically for DVD Players. This guide also describes the additional application codes designed for DVD Audio Players such as: Meridian Lossless Packing (with both elementary and DVD Audio Pack support), all supported LPCM formats, in addition to a discussion of audio/video synchronization considerations. All application codes referred to in AN161 are only available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after the proper IP rights have been confirmed (i.e. - the end-customer has a MLP License, Dolby Digital License, DTS License, and/or AAC License). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN162 Broadcast Systems: Application Code User's Guide for the CS4931X This guide describes all application code (e.g. Dolby Digital; Stereo MPEG-1, Layers 1 and 2, Stereo MPEG-2, Layer 2; and MPEG-2, AAC) designed for broadcast systems such as HDTV and set-top box receivers. This document also provides a discussion of broadcast system considerations
7
AN162REV2
AN162
and dependencies, such as bursty data delivery, and audio/video synchronization. All application codes referred to in AN162 are only available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after the proper IP rights have been confirmed (i.e. - the end-customer has a Dolby Digital License, and/or AAC License). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN162A Appendix A to Application Note 162: PCMP (SMPTE 302M) User's Guide for the CS4931X Family and CS49330 The PCMP application code is a SMPTE 302M decoder designed for broadcast applications where PCM is delivered in an MPEG-2 transport stream PES packet. It provides support for AV synchronization, channel change, bitstream parameter reporting and PLL control, among other features offered in other broadcast-based application codes discussed in AN162. In addition, a mutually exclusive PCM pass-through application mode is available with the PCMP release. This feature is similar to the AVR-based AC-3 code that is capable of passing PCM via I2S data delivery. PCMP application code and AN162A are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN162B Appendix B to Application Note 162: AC-3 + PCM Mixer (AC3N) User's Guide for the CS4931X AC3N - Dolby Digital decoder supporting PES parsing and AV Sync for data that is delivered according to the "PES over I2S" Cirrus Logic proprietary packing technique. Additionally, an IEC60958 Lt, Rt output or IEC61937 compressed output is supported from the AUDAT3/XMT958 pin. AC3N application code and AN162B are available for a 90 day evaluation period upon
8
signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN162C Appendix C to Application Note 162: Interfacing the TeraLogic TL8XX Digital TV ICs to the CS4931X Audio Decoder ICs using AACT or AAST AN162C includes a brief description of hardware configurations and software feature set supported by the Cougar DTV Development Platform in combination with the CS4931X when using two separate AAC application codes developed exclusively for TeraLogic. These two codes are AACT and AAST. The AACT code offers up to 5.1 Channel decoded outputs for an 5.1 Channel AAC Digital Audio Source (Low Complexity, ADTS, Elementary Stream Data packed according to the IEC61937 specification) delivered via an I 2 S (or LJ) output from the TL85X. The AACT code is also capable of simultaneously mixing PCM via the DAI port on the CS4931X. The AAST code offers up to 2.0 Channel (Lt, Rt downmix) decoded outputs for a 5.1 Channel AAC Digital Audio Source (Low Complexity, ADTS, Elementary Stream Data packed according to the IEC61937 specification) delivered via an I 2 S (or LJ) output from the TL85x. AACT and AAST application codes and AN162C are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163 AVR/Outboard Decoder Systems: Application Code User's Guide for the CS4932X Family This guide describes all application code (e.g. Dolby Digital; DTS; MPEG-1, Layer 3 (MP3); MPEG-2, Layer 3 (a.k.a. MP3); MPEG-2, Layer 2 Multichannel; MPEG-2, AAC; and Crystal Original Surround) designed for outboard decoder and A/V Receiver systems. All application codes
AN162REV2
AN162
referred to in AN163 are only available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after the proper IP rights have been confirmed (i.e. - the end-customer has a Dolby Digital License, DTS License, and/or AAC License). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163A Appendix A to Application Note 163: Virtual Dolby DigitalTM User's Guide for the CS4932X Family This appendix offers how to control the softwarespecific features displayed in the Virtual Dolby Digital Manager. Release of this document and code requires confirmation of an approved Virtual Dolby Digital license. Please contact Dolby Laboratories Licensing Corporation for licensing information. Virtual Dolby Digital application code and AN163A are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Virtual Dolby Digital License and is in good standing with Dolby Laboratories. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163B Appendix B to Application Note 163: VMAx VirtualTheaterTM User's Guide for the CS4932X Family This appendix offers how to control the softwarespecific features displayed in the VMAx VirtualTheater Manager. Please contact Harman International and Dolby Laboratories Licensing Corporation for licensing information. VMAx VirtualTheater application code and AN163B are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a VMAx License as well as a Virtual Dolby Digital License and is in good standing with both Harman International and Dolby Laboratories Licensing Corporation. A
AN162REV2
Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163C Appendix C to Application Note 163: SRS CircleSurroundTM User's Guide for the CS4932X Family and CS49330 This appendix offers how to control the softwarespecific features displayed in the SRS CircleSurround Manager. Release of this document and code is currently only authorized to licensees of SRS CircleSurround technology. Please contact SRS Labs for licensing information. SRS CircleSurround application code and AN163C are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a SRS CircleSurround License, and is in good standing with SRS Labs. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163D Appendix D to Application Note 163: Pacific MicrosonicsTM HDCD(R) User's Guide for the CS4932X Family and CS49330 This appendix offers how to control the softwarespecific features displayed in the HDCD Manager. Release of this document and code is currently only authorized to licensees of HDCD technology. Please contact Pacific Microsonics for licensing information. HDCD application code and AN163D are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has an HDCD License and is in good standing with Pacific Microsonics. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163E Appendix E to Application Note 163: Logic 5TM 5.1 Channel PCM Enhancement User's Guide for the CS4932X Family This appendix offers how to control the softwarespecific features displayed in the Logic 5 Manager.
9
AN162
Release of this document and code is currently only authorized to licensees of Logic 5 technology. Please contact Lexicon, Inc. for licensing information. Logic 5 application code and AN163E are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Logic 5 License and is in good standing with Lexicon, Inc. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163F Appendix F to Application Note 163: SRS TruSurroundTM User's Guide for the CS4932X Family This appendix offers how to control the softwarespecific features displayed in the SRS TruSurround Manager. Release of this document and code requires confirmation of an approved SRS TruSurround license. Please contact SRS Labs for licensing information. Furthermore, if the version of code that is to be released is based on Virtual Dolby Digital technology, a Virtual Dolby Digital License will be required. Please contact Dolby Laboratories Licensing Corporation for licensing information. If the version of this code is based on DTS technology, a DTS license will be required. Please contact Digital Theater Systems for licensing information. If the version of this code is based on MPEG-2, Layer 2 Multichannel technology, no additional licensing is required other than the SRS TruSurround license. All SRS TruSurround application codes and AN163F are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a SRS TruSurround License, Virtual Dolby Digital License and DTS Virtual 5.1 License and is in good standing with SRS Labs, Dolby Laboratories Licensing Corporation, and DTS Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163G Appendix G to Application Note 163: Crystal 5.1 Channel Digital Post-Processor User's Guide for the CS49330 This appendix offers how to control the softwarespecific features for a non-license based multichannel PCM digital post-processing code. This code offers the following features: Multichannel PCM input, LR2LsRs copy, Test Noise and Impulse Generator, PCM Mixing, Downmixing, Tone Control and 3-band Parametric EQ control of up to 5 full-bandwidth input channels, Bass Manager and Delay. Crystal 5.1 Channel Digital Post-Processor application code and AN163G are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163H Appendix H to Application Note 163: THX(R)/THX(R) Surround EXTM 5.1 Channel Post-Processor User's Guide for the CS49330 This appendix offers how to control the softwarespecific features for THX and THX Surround EX application codes. Release of this document and code(s) requires confirmation of an approved THX license status. Please contact the Mr. Mark Paddack at the THX Division of Lucasfilm, Ltd. for licensing information. Both Home THX Cinema and/or THX Surround EX 5.1 Channel Post-Processing application codes and AN163H are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Home THX Cinema and/or THX Surround EX License and is in good standing with the THX Division of Lucasfilm, Ltd. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163I Appendix I to Application Note 163: Crystal P.D.F. User's Guide for the CS4932X This appendix offers how to control the softwarespecific features for Crystal P.D.F. (Pro Logic
AN162REV2
10
AN162
Double-Frequency) application code. This code allows for stereo or Pro Logic encoded PCM Stereo streams with sampling rates up to 96kHz. This code also allows for 1:2 upsampling for all input sampling frequencies up to 48kHz. Digital deemphasis for all input sampling frequencies is also available with dual-precision bass management. A Dolby Pro Logic License is required. Crystal P.D.F. application code and AN163I are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Dolby Pro Logic License and is in good standing with Dolby Laboratories Licensing Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163J Appendix J to Application Note 163: Digital/Multimedia Speaker User's Guide for the CS4932X Family This appendix describes the Digital/Multimedia Speaker (D.M.S.) licensed software that can process up to two PCM stereo streams, as well as perform an AC-3 decode or DTS (depending on the version of code requested). It also controls independent 5-channel tone control and 3-band parametric EQ on all full-bandwidth channels. With the appropriate Dolby licenses, codes for various virtualization modules are available that support Virtualization of Dolby Digital or Dolby Pro Logic decoded output down to two channels. A Dual-Precision Bass Manager is also available with this code. A Dolby Digital, DTS or additional virtualizer technology license may be required, depending on which application code is required. All Digital/Multimedia application codes and AN163J are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has the proper IP owner's licenses and is in good standing with all respective companies. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163K Appendix K to Application Note 163: 5-Channel, 5-Band Graphic Equalizer User's Guide For the CS4932X Family This appendix describes how to control the licensed application code that runs on the CS4932X Family DSP and offers the designer a 5-channel, 5- band graphic equalizer. This graphic equalizer features 24-bits of precision at the backend of an AC-3 decoder (which offers additional Pass-Through). The application code also offers a DTS decoder or an MPEG Multichannel decoder, instead of a Dolby Digital decoder. All application codes with a 5-Band, 5 Channel Graphic EQ and AN163K are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Dolby Digital License and DTS Digital Surround License and is in good standing with Dolby Laboratories Licensing Corporation, and the DTS Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163L Appendix L to Application Note 163: DTS-ES Discrete 6.1 and Matrix 6.1 User's Guide for the CS4932X Family This appendix describes the licensed software designed to run on: the CS49326 and CS49329 which provides DTS Digital Surround 5.1 channel decoding in addition to DTS-ES Discrete 6.1 and DTS-ES Matrix 6.1 decoding. Descriptions for software configuration and in-depth descriptions of application control modules are also included in this document. DTS-ES Discrete 6.1 and Matrix 6.1 application code and AN163L are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a DTS-ES License, and is in good standing with the DTS Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before these
11
AN162REV2
AN162
application codes may be used in a production-level design. AN163M Appendix M to Application Note 163: Dolby Pro Logic II TM PCM Enhancement User's Guide for the CS4932X Family This appendix describes how to control the licensed software designed to run on: the CS4932X Family, which provides Dolby Pro Logic II decoding of 2 channel PCM material and AC-3 DTS, MPEG. To find out about the licensing requirements for using these Dolby features, contact Dolby Laboratories Licensing Corporation for licensing information. All application codes that contain Dolby Pro Logic II decoding technology and AN163M are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Dolby Pro Logic II License in addition to a Dolby Digital License and DTS Digital Surround License and is in good standing with Dolby Laboratories Licensing Corporation, and the DTS Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163N Appendix N to Application Note 163: DTS Neo:6 PCM Enhancement User's Guide for the CS4932X Family This appendix describes the licensed software designed to run on: the CS49326 and CS49329 which provides DTS NEO:6 decoding for 2-channel PCM. This appendix documents how to enable the DTS NEO:6 functionality. DTS Neo:6 and AN163N are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a DTS Neo:6 License and is in good standing with the DTS Corporation. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163O Appendix H to Application Note 163: THX(R)/THX(R) Surround EXTM 7.1 Channel Post-Processor User's Guide for the CS49330 This appendix offers how to control the softwarespecific features for Home THX Cinema and THX Surround EX 7.1 Channel Post-Processor application codes. This application code is capable of post-processing DTS-ES Discrete 6.1 channel streams. Release of this document and code(s) requires confirmation of an approved THX license status. Please contact the Mr. Mark Paddack at the THX Division of Lucasfilm, Ltd. for licensing information. Both Home THX Cinema and/or THX Surround EX 7.1 Channel Post-Processing application codes and AN163O are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Home THX Cinema and/or THX Surround EX License and is in good standing with the THX Division of Lucasfilm, Ltd. A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163P Appendix P to Application Note 163: Crystal PL2_2FS User's Guide for the CS4932X This appendix offers how to control the softwarespecific features for Crystal PL2_2FS (Pro Logic II Double-Frequency) application code. This code allows for stereo or Pro Logic encoded PCM Stereo streams with sampling rates up to 96kHz. This code also allows for 1:2 upsampling for all input sampling frequencies up to 48kHz. Digital deemphasis for all input sampling frequencies is also available with dual-precision bass management. A Dolby Pro Logic II License is required. Crystal PL2_2FS application code and AN163P are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Dolby Pro Logic II License and is in good standing with Dolby Laboratories Licensing Corporation. A Crystal Ware Licensing Agreement (CWLA) must
AN162REV2
12
AN162
be signed before this application code may be used in a production-level design. AN163Q Appendix Q to Application Note 163: Crystal 7.1 Channel Digital Post-Processor User's Guide for the CS49330 This appendix offers how to control the softwarespecific features for a non-license based multichannel PCM digital post-processing code. This code offers the following features: Multichannel PCM input, LR2LsRs copy, Test Noise and Impulse Generator, PCM Mixing, Downmixing, Tone Control and 3-band Parametric EQ control of up to 7 full-bandwidth input channels, Bass Manager and Delay. Crystal 7.1 Channel Digital Post-Processor application code and AN163Q are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163R Appendix R to Application Note 163: Crystal Extra Surround 6.1/7.1 Channel Decoder Enhancement User's Guide for the CS4932X This appendix offers how to control all application codes which offer the Crystal Extra Surround 6.1/7.1 Channel Decoder Enhancement. Crystal Extra Surround (CES) algorithm processes the surround channels (Ls and Rs) to produce the extra surround channel (BsC) or channels (BsL, BsR) using proprietary matrix techniques developed by Cirrus Logic. The Crystal Extra Surround module can operate in "Matrix Encoded Mode" (e.g. Surround EXTM encoded Dolby DigitalTM streams or DTS-ESTM Extended Surround streams) or "Non-Matrix Encoded Mode" (e.g. - normal Dolby Digital, DTS Digital SurroundTM, or MPEG Multichannel streams) which is user controlled. These two different matrix processing modes are available to help provide optimum surround channel steering performance depending on whether the input surround channels (Ls and Rs) are matrix encoded or not. All Crystal Extra
AN162REV2
Surround enabled application codes and AN163R are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before these application codes may be used in a production-level design. AN163S Appendix S to Application Note 163: Logic 7TM 7.1 Channel PCM Enhancement User's Guide for the CS4932X Family This appendix offers how to control the softwarespecific features displayed in the Logic 7 Manager. Release of this document and code is currently only authorized to licensees of Logic 7 technology. Please contact Lexicon, Inc. for licensing information. Logic 7 application code and AN163S are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a Logic 7 License and is in good standing with Lexicon, Inc. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design. AN163T Appendix T to Application Note 163: SRS CircleSurround IITM User's Guide for the CS4932X Family and CS49330 This appendix offers how to control the softwarespecific features displayed in the SRS CircleSurround II Manager. Release of this document and code is currently only authorized to licensees of SRS CircleSurround II technology. Please contact SRS Labs for licensing information. SRS CircleSurround II application code and AN163T are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA) after Cirrus Logic has confirmed that the end-user has a SRS CircleSurround II License, and is in good standing with SRS Labs. A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design.
13
AN162
AN163U Appendix U to Application Note 163: Crystal DVD Audio Bass Management User's Guide for the CS4932X Family and CS49330 This appendix offers how to control the softwarespecific features of the Crystal DVD Audio Bass Manager application code in addition to to showing a system block diagram of how to deliver 6 channels of 96kHz, 24-bit audio or 2 channels of 192kHz, 24-bit audio into the DSP from 3 stereo, high-performance A/Ds. Crystal DVD Audio Bass Management application code and AN163U are available for a 90 day evaluation period upon signing of a Crystal Ware Software Evaluation Agreement (CWSEA). A Crystal Ware Licensing Agreement (CWLA) must be signed before this application code may be used in a production-level design.
14
AN162REV2
AN162
1.2 Using the CS4931X/CS49330
No matter what application is being used on the chip, the following four steps are always followed to use the CS4931X/CS49330 in system. Please refer to the associated documents (seen below in parentheses). 1) Reset and/or Download Code. (CS49300 Family Datasheet) 2) Hardware Configuration. (CS49300 Family Datasheet) 3) Application Configuration. (AN162) 4) Kickstart - This is the "Go" command to the CS4931X/CS49330 once the system is properly configured. (AN162) 5) Channel Change - Used for both ES/PES delivery. (AN162) ANAME = Application Name = 2...12 chars (can include "_"s) CCCCCC = Chip Number = 6 chars NOTE: This is exactly what is marked on the chip except "x" wheANAMErever wildcard applies VV = Version Number = 2 digits This document uses the terms Dolby Digital and AC-3 interchangeably. For the AC-3 section, CS49310 and 312 has been replaced with CS4931X/CS49330. For the MPEG Stereo and MP3 sections, CS49310, 311, 312 and 330 have been replaced with CS4931X/CS49330. For the AAC Section, CS49310 and 311 have been replaced with CS4931X/CS49330. Unless otherwise specified, CS4931X/CS49330 should be interpreted as applying to the CS49310, 311, 312, and 330.
1.3 Software Naming Convention
To keep up with the different applications, parts, hardware revisions and software revisions the following naming convention has been adopted for the CS4932X software: ANAME_CCCCCC_VV.LD where:
1.4 Understanding the Feature Set of a Device vs. the Application Code
Please refer to the CS4931x/CS49330 Part Matrix data sheet on the CS49300 web page (http://www.crystal.com/design/products/overview/index.cfm?DivisionID=3&SubdivisionID=9 &ProductID=45) for information about which codes will run on which parts.
AN162REV2
15
AN162
1.5 Dolby Digital Description
Dolby Digital, also known as AC-3, is a digital audio compression algorithm developed by Dolby Laboratories for up to 5.1 channels of audio. This Software User's Guide covers the software designed to run on the CS49310 and CS49312 that decode Dolby Digital. This User's Guide covers all code that is named with ANAME == AC3E and AC3P and CCCCCC == 493102 and 493122 as described in Section 1.3 "Software Naming Convention" on page 15. This document will describe how to use the code for Dolby Digital decode and Dolby Down mixing. It is assumed that the reader is familiar with the requirements and features of Dolby Digital as specified in: * Dolby AC-3 Specification: Digital Audio Compression Standard (AC-3), Advanced Television Systems Committee, Dec. 20, 1995 * Licensee Information Manual: Dolby Digital Multichannel Digital Audio Decoding for Consumer Products, Licensee Information Manual, Version 2.0, April, 1997
Figure 2 displays a functional block diagram when the part is configured for decoding AC-3.
IEC61937 Data Stream OR Lt,Rt (or L,R) Downmixed Output
IEC61937 Data Stream Up to 5 Discrete Channels
Dualzone Either Lt,Rt Downmixed 2 Channel Output (in IEC60958 or Digital Audio Format) or IEC61937 Compressed Data Stream Up to 5.1 Discrete Channels
2 Channel Lt,Rt (or L,R) Downmixed Output AV Sync Module Specific only to AC3P Up to 5 Discrete Channels Audio Manager
ES/PES to IEC61937 Packer Up to 5.1 Discrete Channels
AC-3 Enable
AC-3, AAC, MPEG, and MP3 Decode CMPDAT/ Parallel Up to 5 Discrete Channels
Downmix
Output Mode Control
0.1 (Sub)
LFE Enable
Up to 5.1 Discrete Channels
33-Bit STC Counter
Volume/Mute Channel Remap
Figure 2. Dolby Digital Block Diagram
16
AN162REV2
AN162
1.6 AAC Description
AAC (Advanced Audio Coding) is an "MPEG-2-standard-based" digital audio compression algorithm (offering up 5.1 discrete decoded channels for the AACE or AACP codes, or up to 2 discrete decoded channels for the AASE or AASP codes) collaboratively developed by AT&T, the Fraunhofer Institute, Dolby Laboratories, and the Sony Corporation. This User's Guide covers the software designed to run on the CS49310 and 311 that decodes AAC. This User's Guide covers all code that is named with ANAME == AACE, AACP, AASE and AASP and CCCCCC == 493102 and 493112 as described in Section 1.3 "Software Naming Convention" on page 15. Along with AAC this document will describe how to use the code for Dolby Pro Logic decode and bass management among other features. It is assumed that the reader is familiar with the features of AAC as specified in: IS 13818-7, MPEG-2 Advanced Audio Coding (AAC) Specification, April, 1997 Figure 3 displays a functional block diagram of the AAC Stereo application code (AASE and AASP) while Figure 4 displays a function block diagram of the AAC Multichannel application code (AACE and AACP). Both give an idea of the interaction between the various application modules.
IEC61937 Data Stream
Dualzone Either IEC60958 Lt, Rt Downmixed Output or IEC61937 Compressed Data Stream Up to 2 Discrete Channels
Up to 5 Discrete Channels ES/PES to IEC61937 Packer
2 Channel Lt, Rt Downmixed Output
AAC Enable
Up to 5.1 Discrete Channels
AV Sync Module
Audio Manager
Up to 2 Discrete Channels Downmix
Specific only to AASP
AAC Decode
CMPDAT/ Parallel
Up to 5 Discrete Channels Output Mode Control 33-Bit STC Counter Volume/Mute Channel Remap
Figure 3. AAC Block Diagram for AASE and AASP Codes
Dualzone
Up to 5 Discrete Channels Up to 5.1 Discrete Channels
2 Channel Lt, Rt Downmixed Output Up to 5 Discrete Channels
AV Sync Module
AAC Enable
Audio Manager
Specific only to AACP
Lt, Rt Downmixed Output in IEC60958 or Digital Audio Format Up to 5.1 Discrete Channels
AAC Decode
Downmix
CMPDAT/ Parallel
Up to 5 Discrete Channels Output Mode Control 0.1 (Sub)
Up to 5.1 Discrete Channels 33-Bit STC Counter
Volume/Mute Channel Remap
Figure 4. AAC Block Diagram for AACE and AACP Codes AN162REV2 17
AN162
1.7 MPEG Description
MPEG is a digital audio compression algorithm developed by the Moving Pictures Experts Group for either two or more discrete encoded channels of audio (depending on the MPEG Level and Layer). This User's Guide covers the software designed to run on the CS4931X/CS49330 that decodes MPEG-1, Audio Layers 1 and 2 as well as MPEG-2, Audio Layer 2 (with and without extension) Stereo streams with a decoded output of up to 2 discrete channels. It should be noted that the while CS4931X/CS49330 will accept an MPEG-2, Layer 2 multichannel stream, it will only decode the Left and Right channels. All other channels will not be decoded. MPEG-2, Layer 2 Low Sampling Rate data streams are not supported. This Software User's Guide covers all code that is named with ANAME == MPSE and MPSP and CCCCCC == 493102, 493112, 493122, and 493302 as described in Section 1.3 "Software Naming Convention" on page 15. It is assumed that the reader is familiar with the features of MPEG-1, Layers 1 and 2 as specified in: ISO/IEC 11172-3, Information Technology Coding Of Moving Pictures And Associated Audio For Digital Storage Media At Up To About 1.5 Mbit/s - Part 3: Audio in addition to the features of MPEG-2, Layer 2 as specified in: ISO/IEC 13818-3, Information technology Generic coding of moving pictures and associated audio information - Part 3: Audio Figure 5 displays a functional block diagram of the MPEG Stereo application codes and gives an idea of the interaction between the various application modules.
Dualzone
MPEG Enable
Up to 2 Discrete Channels
Up to 2 Discrete Channels
L, R Output Up to 2 Discrete Channels
AV Sync Module
L, R Output in IEC60958 or Digital Audio Format Audio Manager Up to 2 Discrete Channels
MPEG Decode Specific only to MPSP
CMPDAT/ Parallel
33-Bit STC Counter
Volume/Mute Channel Remap
Figure 5. MPEG Stereo Block Diagram
18
AN162REV2
AN162
1.8 MP3 Description
MPEG-1, Audio Layer 3 (also known as MP3) is a digital audio compression algorithm developed by the Moving Pictures Experts Group for up to 2 discrete decoded channels of audio. This Software User's Guide covers the software designed to run on the CS4931X/CS49330 that decodes MPEG-1, Audio Layer 3 in an Elementary Stream format. This User's Guide covers all code that is named with ANAME == MP3E and CCCCCC == 493102, 493112, 493122, and 493302 as described in Section 1.3 "Software Naming Convention" on page 15. It is assumed that the reader is familiar with the features of MP3 as specified in: ISO/IEC 11172-3, Information Technology Coding of Moving Pictures and Associated Audio for Digital Storage Media at up to about 1.5 Mbit/s - Part 3: Audio Figure 6 displays a functional block diagram of the MP3 application code and gives an idea of the interaction between the various application modules.
Dualzone
Audio Manager MP3 Enable 2 Discrete Channels MP3 Decoding
L, R Output in IEC60958 or Digital Audio Format Up to 2 Discrete Channels
CMPDAT/ Parallel
Volume/Mute Channel Remap
Figure 6. MP3 Block Diagram
AN162REV2
19
AN162
2. HARDWARE CONFIGURATION
After download or soft reset, and before kickstarting the application (please see Section 5.1 "Audio Manager for Dolby Digital, AAC, MPEG and MP3" on page 41 for more information on kickstarting), the host has the option of changing the default hardware configuration. Address checking for serial communication and data type and format for digital data input and output can be changed through hardware configuration settings. The entire hardware configuration can only be changed immediately after download or soft reset.
2.1.1 DSP Clock Speed Dependent on Fs
The switching characteristics of the Motorola(R) and Intel(R) parallel communication modes, discussed in the CS49300 Data Sheet (pages 8 and 10) have notes that state "It should be noted that DCLK for the internal clock mode is application specific. The application code User's Guide should be checked to confirm DCLK for the particular application." For all the application codes discussed in this application code User's Guide, the DSP Clock (DCLK) is equal to 86 MHz for sampling frequencies of 48 kHz and 44.1 kHz while the DCLK is 73 MHz for the 32 kHz sampling frequency.
2.1 Supported Input/Output Modes
The CS4931X/CS49330 has two input ports and one output port. The CS49300 Family datasheet describes the digital audio formats supported by the ports and gives a description of the ports themselves. The capabilities of each port are presented in the CS49300 Family Datasheet. Table 1 specifies the exact hardware modes supported by the all broadcast application codes. Please refer to the CS49300 Family Datasheet for more information on these hardware configurations. The following hardware modes are supported when the AC-3, AAC, MPEG or MP3 code is active:
Hardware Configuration INPUTA INPUTC INPUTD OUTPUTA OUTPUTB OUTPUTC OUTPUTD OUTPUTE Description Input Data Type Input SCLK/Data Edge Input FIFO Block Size Output Master/Slave Clock Setup Output Data Format Output MCLK Rate Output SCLK Rate Output SCLK/Data Edge Supported Modes 3,6,7,8 0,1 1, 2 0,1,2 0,1,2,3 0,1,2,3 0,1,2 0,1
2.1.2 Configuring the XMT958/AUDAT3 Data Format
The following commands must be sent to configure the data present on the XMT958/AUDAT3 pin to S/PDIF format that is driven from an MCLK that is 256 Fs (default for all codes): 0x800271 0xf7ffff 0x800171 0x021000 The following commands must be sent to configure the data present on the XMT958/AUDAT3 pin to S/PDIF format that is driven from an MCLK that is 512 Fs: 0x800271 0xf7ffff 0x800171 0x061000 The following commands must be sent to configure the data present on the XMT958/AUDAT3 pin to I2S format that is driven from an MCLK that is 256 Fs: 0x800171 0x0a1000
Table 1. Hardware Configurations Supported by AC-3, AAC, MPEG, or MP3 Broadcast Codes
20
AN162REV2
AN162
0 0 1 bit 1 0 1 bits 2 3 4 000
bit
1 1 1 X bit 5 0 1 bits 6 0
0 1 1 X
0 0 1 X
7 0
01 10 11
BYTE 0 PRO = 1 Consumer use of channel status block Professional use of channel status block Audio Normal Audio Non-Audio Encoded audio signal emphasis Emphasis not indicated. Receiver defaults to no emphasis with manual override enabled None. Rec. manual override disabled 50/15 S. Rec. manual override disabled CCITT J.17. Rec. man. override disabled All other states of bits 2-4 are reserved Lock: Source Sample Frequency Locked - default Unlocked Fs: Sample Frequency Not indicated. Receiver default to 48 kHz and manual override or auto set enabled 48 kHz. Man. override or auto disabled 44.1 kHz. Man. override or auto disabled 32 kHz. Man. override or auto disabled
BYTE 1 bits 0 1 2 3 Channel Mode 0 0 0 0 Mode not indicated. Receiver default to 2-channel mode. Manual override enabled 0 0 0 1 Two-channels. Man. override disabled 0 0 1 0 Single channel. Man. override disabled 0 0 1 1 Primary/Secondary (Ch. A is primary) Manual override disabled 0 1 0 0 Stereophonic. (Ch. A is left) Manual override disabled. 0 1 0 1 Reserved for user defined application 0 1 1 0 Reserved for user defined application 1 1 1 1 Vector to byte 3. Reserved X X X X All other states of bits 0-3 are reserved. bits 4 5 6 7 User bits management 0 0 0 0 Default, no user info indicated 0 0 0 1 192 bit block structure Preamble `Z' starts block 0 0 1 0 Reserved 0 0 1 1 User defined application X X X X All other states of bits 4-7 are reserved. BYTE 3 Vectored target byte Reserved
bits 0-7 XXXXXX
Table 2. Professional Channel Status bytes 0, 1 and 3
The following commands must be sent to configure the data present on the XMT958/AUDAT3 pin to I2S format that is driven from an MCLK that is 512 Fs: 0x800171 0x0e1000 One of the above two configurations must be sent before kickstart in order to configure the AUDAT3 port for I2S output.
2.1.3 S/PDIF (AES/EBU) Channel Status Block Control
The CS4931X/CS49330, in combination with all of the codes mentioned in this document, offers the "minimum" professional implementation of control over the IEC60958 channel status bits. According to the IEC60958 specification, the host has control over the setting of the "PRO" bit in the channel status word (Channel Status Byte 0, Bit 0). "Professional use of the channel status block" will be implemented if the host sets the PRO bit to a state of logic 1. The additional following channel status bits may also be set by the host: Channel Status Byte 0, Bits 1-5; Channel Status Byte 1, Bits 0-7; and Channel Status Byte 3, Bits 0 and 1. Please refer to Table 2 for the IEC60958 definition for the setting of each bit or set of bits.
AN162REV2
21
AN162
BYTE 0 PRO = 0 (consumer) Consumer use of channel status block Professional use of channel status block Audio Digital Audio Non-Audio Copy / Copyright Copy inhibited / copyright asserted Copy permitted / copyright not asserted Pre-emphasis - if bit 1 is 0 (dig. audio) None - 2 channel audio 50/15 s - 2 channel audio Reserved - 2 channel audio Reserved - 2 channel audio Reserved - 4 channel audio if bit 1 is 1 (non-audio) Digital data All other states of bits 3-5 are reserved Mode Mode 0 (defines bytes 1-3) All other states of bits 6-7 are reserved BYTE 1 - Category Code 001 6 Broadcast reception of digital audio 0 Japan 1 United States 0 Europe 1 Electronic software delivery X All other states are reserved BYTE 1 Category Code General Experimental Reserved Solid state memory
Bit
Bit
0 0 1 1 0 1
Bits 0 1 2 3 4 5 0 0 0 000 * 00 XX * 0 0 0 1XX *
6 0 1 X X
2 0 1 Bits 3 0 1 0 1 X Bits 3 0 X Bits 6 0 X
Bit
0 0 1 X X X X Broadcast recep. of digital audio
0 1 0 X X X X Digital/digital converters
4 0 0 1 1 X 4 0 X 6 0 X
5 0 0 0 0 1 5 0 X
Bits * * * *
3 0 0 1 0 X
4 0 0 0 0 X
5 0 1 0 0 X
BYTE 1 - Category Code 100 Bits 3 4 5 6 Laser Optical 0 0 0 0 CD - compatible with IEC-908 * 1 0 0 0 CD - not comp. with IEC-908 (magneto-optical) X X X X All other states are reserved BYTE 1 - Category Code 110 6 Magnetic tape or disk 0 DAT 0 Digital audio sound VCR X All other states are reserved BYTE 1 - Category Code 101 6 Musical Instruments, mics, etc. 0 Synthesizer 0 Microphone X All other states are reserved
0 1 1 0 0 X X A/D converters w/o copyright 1 X X A/D converters w/ copyright (using Copy and L bits) * 0 1 1 1 X X X Broadcast recep. of digital audio 1 0 0 X X X X Laser-optical * 1 0 1 X X X X Musical Instruments, mics, etc. 1 1 0 X X X X Magnetic tape or disk 1 1 1 X X X X Reserved Bit 7 L: Generation Status. Only category codes:001XXXX, 0111XXX,100XXXX * 0 Original/Commercially pre-recorded data * 1 No indication or 1st generation or higher All other category codes * 0 No indication or 1st generation or higher * 1 Original/Commercially pre-recorded data The subgroups under the category code groups listed above are described in tables below. Those not listed are reserved. The Copy and L bits form a copy protection scheme for original works. Further explanations can be found in the proposed amendment (TC84) to IEC-958. BYTE 1 - Category Code 010 Bits 3 4 5 6 Digital/digital conv. and signal processing 0 0 0 0 PCM encoder/decoder * 0 0 1 0 Digital sound sampler * 0 1 0 0 Digital signal mixer * 1 1 0 0 Sample-rate converter X X X X All other states are reserved BYTE 3 Fs: Sample Frequency 44.1 kHz 48 kHz 32 kHz Sample-rate converter All other states are reserved
* *
Bits 3 0 * 1 X
4 0 0 X
5 0 0 X
Bits 3 4 5 * 000 * 100 XXX
Table 3. Consumer Channel Status Bytes 0, 1 and 3
Bits 0 0 0 1 1 X
1 0 1 1 1 X
2 0 0 0 0 X
3 0 0 0 0 X
22
AN162REV2
AN162
"Consumer use of the channel status block" will be implemented if the host sets the PRO bit to a state of logic 0. The additional following channel status bits may also be set by the host: Channel Status Byte 0, Bits 1-5; Channel Status Byte 1, Bits 0-7; and Channel Status Byte 3, Bits 0 and 1. Please refer to Table 3 for the IEC6096 definition for the setting of each bit or set of bits. The channel status bits map to the DSP Write Data Word in the following manner (please refer to Section 4 "Write Message Format" on page 25): * Channel Status Byte 0, Bit 0 = maps to bit 8 in the DSP Write Data Word. * * * Channel Status Byte 0, Bits 1:5 = map to bits 9:13 in the DSP Write Data Word. Channel Status Byte 1, Bits 0:7 = map to bits 14:21 in the DSP Write Data Word. Channel Status Byte 3, Bits 0 and 1 = map to bits 22 and 23 in the DSP Write Data Word. 48 kHz Fs (Byte 3, Bit 0 and 1 = 01), Category Code = General (Byte 1, Bits 0:7 = 000000000), 2 Audio Channels without Pre-Emphasis and Copy Prohibited (Byte 0, Bits 1:5 = 00000): 0x800272 0x0000FF 0x800172 0x800000 For example the following command sets the Channel Status Block of the Right Subframe (Channel B) for: Consumer Mode (Byte 0, Bit 0 = 0), 32 kHz Fs (Byte 3, Bits 0 and 1 = 11), Category Code = General (Byte 1, Bits 0:7 = 000000000), 2 Audio Channels without Pre-Emphasis and Copy Prohibited (Byte 0, Bits 1:5 = 00000): 0x800273 0x0000FF 0x800173 0xC00000
Please refer to the IEC60958 Specification for more a more detailed explanation of the channel status block definitions. A two step process of clearing and setting is required to set the desired bits. This is done by writing four 24-bit words to the DSP. In the examples below, the first word performs a logical "AND" of the register with the second word, which acts as a mask. The third word performs a logical "OR" of the modified register with the fourth word, which contains the necessary CSW Bits which the user wants to set. For example the following command sets the Channel Status Block of the Left Subframe (Channel A) for: Consumer Mode (Byte 0, Bit0 = 0),
2.1.4 S/PDIF (AES/EBU) Validity Bit Control
In addition to the Channel Status Block Control, the Validity Bit in the IEC60958 stream may also be set by the host to indicate if the according audio sample is fit for conversion to analog. The following command must be sent to CLEAR the IEC60958 Validity Bit: 0x800271 0xFFBFFF The following command must be sent to SET the IEC60958 Validity Bit: 0x800171 0x004000
AN162REV2
23
AN162
3. APPLICATION MESSAGING PROTOCOLS
While using the CS4931X/CS49330 it may be necessary to control or monitor the application to take full advantage of the rich feature set employed by the CS4931X/CS49330 and its software. Application messaging allows the user to do this. Whether it be configuring the part after download (e.g. enabling MPEG decode), or changing run-time parameters (e.g. adjusting channel delays), the host will use application messaging to communicate with the CS4931X/CS49330. There are two main protocols for communicating with the CS4931X/CS49330 and the software. They are: "Indexed Module Communication Protocol" and "Stand-Alone Communication Protocol". While communicating with the CS4931X/CS49330 using indexed modules, a strict software protocol referred to as the "Indexed Module Communication Protocol" must be used in conjunction with the hardware protocol discussed in the CS49300 Family Data Sheet. The "Indexed Module Communication Protocol" is covered in Section 3.2 "Stand-Alone Message Communication Protocol" on page 29. When communicating with the CS4931X/CS49330, certain messages are used that are considered stand-alone, in contrast to the indexed modules presented in Section 3.1, "Indexed Module Communication Protocol". These messages consist of an opcode followed by the associated data. The "Stand-Alone Message Communication Protocol" is covered in Section 3.2, "Stand-Alone Message Communication Protocol".
3.1 Indexed Module Communication Protocol
Each indexed module of the application can be thought of as a block of software registers or variables. The index identifies a unique variable within the module. When the opcode for a module and an index are combined, a unique variable can be read or written. This section covers how to communicate with the CS4931X/CS49330 using indexed modules. The software protocol is presented for the following types of messages: Write, Solicited Read, Read Response, and Unsolicited Read Response. When the protocol presented in this section is used with the application modules in Section 5 "Common Application Modules" on page 40, the host will be able to fully configure the application running on the CS4931X/CS49330.
24
AN162REV2
AN162
3.1.1 Write Session
A write session with the CS4931X/CS49330 consists of one 6 byte message from the host to the CS4931X/CS49330. The write message consists of a command word followed by an associated data word. Table 4 shows the format of a Write Message. Response message from the CS4931X/CS49330 to the host. The read request message simply consists of a Read Command word whose format is shown in Table 5 on page 27. After the host sends the read command word it should wait for the INTREQ line to fall. See the CS49300 Family Data Sheet for more on hardware communication with the CS4931X/CS49330. After INTREQ falls the host should read out the 6-byte Read Response message which consists of a 3-byte Read Response Command word followed
3.1.2 Solicited Read Message Format
A solicited read session consists of one 3-byte Read Request message from the host to the CS4931X/CS49330, followed by a 6-byte Read
Write Command Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OPCODE[7:0] INDEX[15:0]
Write Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 DATA[23:0]
OPCODE[7:0] - 8 bit (1 byte) field containing opcode for targeted application module. This field will choose which module is written. INDEX[15:0] - 16 bit (2 byte) field containing the index for the desired variable in the module chosen by OPCODE. This field will choose the actual variable to be altered. DATA[23:0] - 24 bit (3 byte) data word to be written into the variable specified byINDEX in the module specified by OPCODE. Table 4. Write Message Format
AN162REV2
25
AN162
by the requested data word. The format of the Read Response message is shown in Table 6 on page 27.
26
AN162REV2
AN162
Read Command Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OPCODE[7:0] INDEX[15:0]
OPCODE[7:0] - 8 bit (1 byte) field containing opcode for targeted application module. This field will choose which module is to be read from. INDEX[15:0] - 16 bit (2 byte) field containing the index for the desired variable in the module chosen by OPCODE. This field will choose the actual variable to be read. Table 5. Read Command Message Format
Read Response Command Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OPCODE[7:0] INDEX[15:0]
Read Response Data Word
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 DATA[23:0]
OPCODE[7:0] - 8 bit (1 byte) field containing the Read Response opcode for the targeted application module. This field will show which module was read. INDEX[15:0] - 16 bit (2 byte) field containing the index for the desired variable in the module chosen by OPCODE. This field will show the actual variable that was read. DATA[23:0] - 24 bit (3 byte) data word that was read from the variable specified by INDEX in the module specified by OPCODE. Table 6. Read Response Message Format
AN162REV2
27
AN162
3.1.3 Unsolicited Read Message Format
Unsolicited messages will typically be used in systems where INTREQ can generate interrupts. These messages will come from the CS4931X/CS49330 to indicate a change in the system that must be addressed. One example is when the part is in autodetect mode and detects a new stream. An unsolicited read message will be sent by the CS4931X/CS49330 to indicate the new stream type. The 6-byte unsolicited read messages from the CS4931X/CS49330 consist of a 3-byte read command word which defines the type of unsolicited message (as described in Section 5.3 "Unsolicited Messages (Read-Only)" on page 50) and a 3-byte associated data word that contains more information describing a system condition. Every time the existence of a message is detected (by sensing that INTREQ has gone LOW), the host should read out the 6-byte read unsolicited message. Table 7 shows the format of an Unsolicited Read Message.
Unsolicited Read Command Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OPCODE[7:0] INDEX[15:0]
Unsolicited Read Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 DATA[23:0]
OPCODE[7:0] - 8 bit (1 byte) field containing opcode for the unsolicited read message INDEX[15:0] - 16 bit (2 byte) field containing the index for the variable in the module designated by OPCODE. DATA[23:0] - 24 bit (3 byte) data word that corresponds to the variable specified by INDEX in the module specified by OPCODE. Table 7. Unsolicited Read Message Format
28
AN162REV2
AN162
3.2 Stand-Alone Message Communication Protocol
Certain commands are used in combination with others to handle different system events. The final chapter covers special system events such as a channel change and how to deal with those events using the stand-alone message communication protocol. This section covers how to communicate with the CS4931X/CS49330 using stand alone messages. The software protocol is presented for the following types of messages: Host Message and DSP Response Message. licited, Unsolicited and Pending Read Responses. They can be defined as follows: * Solicited Response A solicited response is defined as a DSP response command word, optionally followed by one more DSP response data word sent to the host in response to a host message. The solicited DSP response messages are paired with their respective host message words in the next section. * Unsolicited Response An unsolicited response is defined as a DSP response command word, optionally followed by one more DSP response data word sent to the host in response to some change in the system run-time environment. An unsolicited response is not associated not initiated by the host message. However, the unsolicited response messages have to be enabled through PES Manager module (index 0 - PES_Control and AV Sync Status) * Pending Read Responses In the event that the PLL needs to re-lock (e.g. change of Fs in bit stream), and there are messages pending in the output message queue, the decoder will stall until all message have been read from the message queue (i.e., INTREQ goes high). Once the message queue has been flushed, the decoder will commence the PLL lock routine and decoding will progress as usual. This behavior is intended to prevent host-decoder communication while internal clocking is changing. Consequently, the host should always service the INTREQ interrupt as quickly as possible to prevent prolonged audio silence. Audio will resume after the PLL has locked and valid data is present on the input port.
3.2.1 Host Message
A host message consists of one 3 byte words (command words) from the host to the CS4931X/CS49330, followed by one more optional 3 byte words (data words) depending on the actual message being sent. Some host messages are strictly used to communicate something to the CS4931X/CS49330 while other host messages will elicit a response from the CS4931X/CS49330 in the form of a DSP response message. The format of the host message is shown in Table 8 on page 30.
3.2.2 DSP Response Message
A DSP response message consists of one 3 byte word from the CS4931X/CS49330 to the host, followed by one more 3 byte DSP response data word depending on the actual message being sent. Usually the DSP response message comes as either a response to a host message or as an indication of some change in the system. In the next section, host messages are paired with the corresponding DSP response messages. The DSP response message can be broken down into three response types: So-
AN162REV2
29
AN162
Host Command Word:
23 22 21 20 19 18 OPCODE[7:0] 17 16 15 14 13 12 11 10 987 DATA[15:0] 6 5 4 3 2 1 0
Optional Host Data Word(s):
23 22 21 20 19 18 17 16 15 14 13 12 11 10 OPTIONAL HOST DATA[23:0] 9 8 7 6 5 4 3 2 1 0
OPCODE[7:0] - 8 bit (1 byte) field containing opcode for the host command being used. DATA[15:0] - 16 bit (2 byte) data for the opcode being used. In some cases the data word will contain variables that can be optionally set by the host. Others will have hard coded data that should be sent when using the command. All bits marked as reserved should be set to 0's. OPTIONAL HOST DATA[23:0] - Depending on the host message being used, this optional host data word may or may not follow the host command word. Table 8. Host Message Format
DSP Response Command Word:
23 22 21 20 19 18 OPCODE[7:0] 17 16 15 14 13 12 11 10 987 DATA[15:0] 6 5 4 3 2 1 0
Optional DSP Response Data Word(s):
23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 OPTIONAL DSP RESPONSE DATA[23:0] 8 7 6 5 4 3 2 1 0
OPCODE[7:0] - 8 bit (1 byte) field containing opcode for the DSP response message being used. DATA[15:0] - 16 bit (2 byte) Data for the opcode being used. OPTIONAL DSP RESPONSE DATA[23:0] - Depending on the DSP response message being used, this optional DSP response data word may or may not follow DSP response command word. Table 9. DSP Response Message Format
30
AN162REV2
AN162
4. BROADCAST SYSTEM CONSIDERATIONS 4.1 Audio Dropout
There are six conditions which will cause the CS4931X/CS49330 to soft mute its outputs as a means of error concealment. These conditions include: * PLL Re-Lock * * * * * Loss of frame synchronization Cyclic Redundancy Code (CRC) errors Buffer overflow on the input FIFO Underflow of the PCM output buffer AV synchronization problems found the sync word and confirmed that a subsequent sync word appears at the correct position in the bit stream, the CS4931X/CS49330 will begin to decode the compressed data and generate audio. If, after decoding valid audio frames, the CS4931X/CS49330 does not find a sync word in a position where it expects to find one, the outputs will be soft muted and a new search will begin for valid synchronization words. Please note that those frames used in establishing sync are thrown away by the decoder. For this reason, the CS4931X/CS49330 can consume data at a higher bit rate while attempting to establish synchronization than it will during audio decode. Elementary Stream frame sync is the lowest level of frame synchronization. One layer above the elementary stream is the PES layer. PES bit streams have their own specific sync words which indicate PES frames. In fact, PES wrapped MPEG streams have multiple valid sync words. The sync word can range from 0x000001C? or 0x000001D? where `?' can represent any hexadecimal nibble. AC-3 steams have a PES sync word of 0x000001BD. After establishing a valid PES stream, the CS4931X/CS49330 will then insure that a valid elementary stream is present by searching for the elementary sync word. If either of these sync words cannot be found during decode, frame sync has been lost. At this point the audio output will be soft muted, and a new sync search begins. The PES_Sync_Status bit, located in index 0x00 of the PES Manager, indicates whether PES frame sync has been achieved, and the elementary frame sync status can be determined by checking index 0x00 of the AC-3, AAC, or MPEG Manager.
4.1.1 PLL Re-Lock
In the event that the PLL needs to re-lock (e.g. change of Fs in bit stream), and there are no messages pending in the output message queue, the decoder will automatically lock to the new Fs and begin audio decode. If, however, the PLL needs to relock and outgoing messages are pending, the decoder will stall until all messages have been read from the message queue (i.e., INTREQ goes high). Once the message queue has been flushed, the decoder will commence the PLL lock routine and decoding will progress as usual. This behavior is intended to help avoid host-decoder communication problems while internal clocking is changing. Consequently, the host should always service the INTREQ interrupt as quickly as possible to prevent prolonged audio silence. Audio will resume after the PLL has locked and valid data is present on the input port.
4.1.3 CRC Errors
All AC-3, AAC streams, and some MPEG streams have CRC protection. The CS4931X/CS49330 will calculate the CRC at run-time for those streams and compare it to the value specified by the incoming compressed bit stream. If the two values do not match, then a CRC error condition exists. A CRC error causes the audio outputs to soft mute, and a search begins for frame synchronization.
31
4.1.2 Loss of Frame Sync
Loss of frame sync can occur at the elementary stream level and at the PES level. When the CS4931X/CS49330 is configured to decode elementary AC-3, AAC, or MPEG, the decoder will initially search the incoming bit stream for the correct sync word (0x0B77 for AC-3, 0xFFF for AAC and MPEG). Once the CS4931X/CS49330 has
AN162REV2
AN162
4.1.4 Input Overflow
The MPEG systems specification defines the maximum required audio FIFO size as 4 kbytes. Since the CS4931X/CS49330 has 6 kbyte input FIFO, overflow should not be a problem when using properly multiplexed audio streams. However, audio streams which do not conform to the MPEG systems model could cause input overflow if the host does not observe the FIFO threshold indicator (CMPREQ or the MFB bit). Compressed audio should only be delivered to the CS4931X/CS49330 while CMPREQ or MFB is low. Overflow of the buffer will cause corruption of data. Eventually, when the CS4931X/CS49330 reaches the corrupted data in the FIFO, the DSP will lose sync or calculate a CRC error. As described above, loss of sync and CRC errors cause the outputs to be soft muted and sync search begins. zation Algorithm for the CS4931X/CS49330" on page 33.
4.2 General AV SYNC Description
AV synchronization is achieved in broadcast systems through the use of the PTS (presentation time stamp) included in the data stream, and the STCs (system time clocks) which keep track of time within the audio and video decoders. Separate Presentation Time Stamps (PTS) are sent to the audio decoder and the video decoder within the audio PES (packetized elementary stream) and video PES streams. From a functional standpoint, a PES stream can be regarded as an elementary stream with embedded time stamp information. The PES format is actually more complex, but the true structure of a PES stream is not relevant to this discussion. The audio PTS tells an audio decoder when to play a particular audio sample and the video PTS tells a video decoder when to display a particular video frame. Since these events are dependent upon the current time, each decoder must have a time reference. The System Time Clock (STC) within a decoder is the time reference used for comparisons with the PTS. The STC is simply a counter inside of the decoder which is driven at frequency specified by the MPEG standard. The STC within the CS4931X/CS49330 is incremented at a frequency of 90 kHz. Note that 90 kHz corresponds to 27 MHz divided by 300. The CS4931X/CS49330 is tuned to operate from a 27 MHz clock, and will internally divide the 27 MHz clock in order to generate the STC clock. As discussed in the Section 4.4 "System Clocking" on page 37, it is critical for the clock which drives the STC to be phase-locked to the system reference clock. In a broadcast system this is typically done by supplying the 27 MHz clock output of the transport demultiplexer as CLKIN for the CS4931X/CS49330. If the audio decoder and video decoder count time at different rates, the presentation of an image will not always correspond to the audio presentation.
AN162REV2
4.1.5 PCM Output Buffer Underflow
It is important to realize that input buffer underflow is a valid condition in broadcast applications. Decoded audio is buffered within the CS4931X/CS49330, so a brief underflow on the input FIFO will not cause an audio discontinuity. If an underflow condition at the input FIFO exists long enough for the PCM output buffer to underflow, however, the CS4931X/CS49330 will soft mute the outputs until more compressed audio has been decoded.
4.1.6 AV SYNC Problems
Finally, when PES streams are being decoded and AV synchronization is enabled the audio muting scheme becomes more complicated. In addition to the conditions listed above, the CS4931X/CS49330 can mute its audio outputs when there is a large enough difference between the internal STC (System Time Clock) and the PTS (Presentation Time Stamp) values found in the PES stream. The PTS/STC synchronization algorithm is used when AV SYNC has been enabled, and it is described in Section 4.3 "Audio/Video Synchroni-
32
AN162
Because a system which requires AV SYNC has a video decoder whose behavior is directly related to the audio decoder, the designer must consider the system as a whole. If the audio is to be in `lip sync' with the video, the decode of audio and video information must occur synchronously. The latency of the video decode process should be considered when setting the initial value of the CS4931X/CS49330's system time counter (STC). The designer should bear in mind that although compressed audio and video data are transferred to their respective decoders at the same time, the decode of audio and video may not require the same amount of time. Another factor that must be considered is that the video PTS and the analog VSYNC signal are asynchronous. It may be necessary to delay or advance video in order to align video frames with the VSYNC signal. This manipulation of the video presentation time is effectively changing the video PTS, and the audio playback must be adjusted accordingly through changes to the audio STC. The CS4931X/CS49330 has a programmable STC. The host can, at any time, set the value of the CS4931X/CS49330's STC to a specific value using a WRITE_STC message. It may be necessary to configure the STC of the CS4931X/CS49330 such that there is a constant difference between its STC value and the value of the video decoder's STC. The two decoders still count time at the same rate, but now the audio decoder and video decoder are effectively in different `time zones'. This technique can be used to compensate for the latency of the video decoder. It should be noted that the default values programmed into the AV SYNC engine will be more than sufficient for most systems. The programmability provided by the code, however, gives system designers the ability to support proprietary synchronization schemes. The details of this AV SYNC algorithm are presented below. When AV SYNC has been enabled, there are three (3) states that define the behavior of the AV SYNC engine: * AV SYNC Lost * AV Sync engine is out of lock Audio is muted CS4931X/CS49330 will stall or fast-forward (FF) through incoming data AV Sync engine is attempting to synchronize audio/video to within 16 audio samples Audio is played CS4931X/CS49330 adds/drops samples during playback until |PTS-STC| <= 16 samples AV Sync engine has achieved lock Audio is played at the sampling frequency of the audio stream If the AV Sync engine is disabled, the three states described above are irrelevant. PTS/STC values do not affect playback Audio is played at the sampling frequency of the audio stream PTS/STC are still updated and can be monitored
AV SYNC Search -
*
AV SYNC Lock -
*
AV SYNC Disabled -
4.3 Audio/Video Synchronization Algorithm for the CS4931X/CS49330
Audio/Video (AV) synchronization can be one of the most difficult features to get working in a broadcast product. The CS4931X/CS49330 features a very robust, and configurable AV SYNC algorithm that requires little support from the host microcontroller, and at the same time it can be tailored to suit different systems.
4.3.1 AV SYNC Lost
This is the state of the decoder: * After a CHANNEL_CHANGE_REQUEST
33
AN162REV2
AN162
message (see Section "CHANNEL_CHANGE_REQUEST 6.3 [PES Codes]" on page 54)
34
AN162REV2
AN162
* After falling into the Lock Attempt Failed window (see Section 4.3.2, "AV SYNC Search") during AV SYNC Search When the PTS-STC has fallen into the AV SYNC Lost window (see Section 4.3.3, "AV SYNC Lock") after having achieved AV SYNC Lock. If the decoder remains in window (4) for 2 seconds or longer a timeout occurs, and an unsolicited AV_SYNC_TIMEOUT messages is issued (if enabled). The decoder continues in its attempt to reach window (5). If, for whatever reason, the |PTS-STC| manages to jump into window (3) before lock has been achieved (window 5) the CS4931X/CS49330 will once again mute audio and revert back to the AV SYNC Lost state. Once the decoder successfully hits the Lock Achieved Window (window 5), the CS4931X/CS49330 will begin playing audio at the sampling frequency (no add/drop of samples), and the CS4931X/CS49330 will enter the AV SYNC Lock state.
*
There are 2 windows of interest when in the AV SYNC lost state: 1) Out of Lock Window (|PTS-STC| > 1 frame) 2) Lock Engage Window (|PTS-STC| <= 1 frame) When the CS4931X/CS49330 is in window (1), no audio is played and the sync engine enters a STALL/FF state in an attempt to reach window (2). Once the sync engine has pulled the audio/video synchronization within window (2), the sync engine progresses to the AV SYNC Search state.
4.3.3 AV SYNC Lock
This is the state of the decoder after reaching the Lock Achieved Window. When in this state, the AV SYNC engine uses three different windows to determine playback behavior. 6) Playback Window (0 <= |PTS-STC| <= 160 samples) 7) AV SYNC Drift Window (160 samples < |PTS-STC| < 1 frame - 160 samples) 8) AV SYNC Lost Window (|PTS-STC| >= 1 frame - 160 samples) Within window (6), the CS4931X/CS49330 considers itself synchronized and plays audio at the sampling frequency. If the |PTS-STC| falls into window (7), the CS4931X/CS49330 will inform the host of an AV_SYNC_DRIFT state if Unsolicited_AV_Sync_Drift messages are enabled in the PES Manager. If the host has enabled AV_DRIFT_RELOCK, then the CS4931X/CS49330 will begin to add/drop samples until |PTS-STC| falls within window (5), the Lock Achieved Window. If AV_DRIFT_RELOCK has not been enabled (see Section 5.2 "PES Manager" on page 45) the CS4931X/CS49330 continues to
35
4.3.2 AV SYNC Search
When in this state, the CS4931X/CS49330 must work to align the PTS & STC values (by adding and dropping samples) such that |PTS-STC| difference is close enough to 0 ms for audio to be played without lip sync problems. This state is engaged when the sync engine has pulled the |PTS-STC| value to within 1 audio frame time of perfect sync. There are 3 windows of interest when in the AV SYNC Search state: 3) Lock Attempt Fail Window (2 frames < |PTS-STC|) 4) Lock Attempt Window (16 samples < |PTS-STC| <= 2 frames) 5) Lock Achieved Window (|PTS-STC| <= 16 samples) After entering the AV SYNC Search state, the decoder is within window (4). In this window, audio begins to play and the CS4931X/CS49330 will add/drop samples until window (5) has been reached.
AN162REV2
AN162
play audio at the sampling frequency and does not attempt any further correction unless the decoder falls outside the AV SYNC Drift Window. If the CS4931X/CS49330 is in the AV SYNC Lock state, and the |PTS-STC| value falls into the AV SYNC Lost Window (8) an AV_SYNC_LOST message is issued to the host if the Unsolicited_AV_Sync_Lost bit has been enabled in the PES Manager. At this point, the behavior of the AV SYNC engine is determined by the state of the AUTO_AV_SYNC_DISABLE bit: If the AUTO_AV_SYNC_DISABLE feature has been enabled, the CS4931X/CS49330 will disable AV synchronization and continue to play audio at the sampling frequency. The host has the responsibility of either updating the STC or changing window sizes and then re-enabling AV SYNC as described in Section 4.3.4, "Manual Control of AV SYNC". If the AUTO_AV_SYNC_DISABLE feature has NOT been enabled, the CS4931X/CS49330 will mute the audio and resume the locking procedure as discussed in Section 4.3.1 "AV SYNC Lost" on page 33 above. While AV SYNC is disabled, the host can adjust parameters such as the STC value or the window definitions in order to force the CS4931X/CS49330 to immediately play audio when the AV SYNC engine is re-enabled. The broadcast applications for the CS4931X/CS49330 allow full visibility into the stream PTS and the STC at all times (regardless of whether AV SYNC is enabled). Therefore, when using the AUTO_AV_SYNC_DISABLE feature, the host can determine the |PTS-STC| value and adjust the STC value to place the |PTS-STC| value within window (5) before re-enabling AV SYNC. Alternatively, the host has the ability to re-size all of the AV SYNC windows. The host may change the size of the AV SYNC windows to accommodate the current |PTS-STC| value. The sizing of these windows should be considered with respect to the desired lip sync tolerance of the system (i.e., a smaller playback window results in tighter lip-sync). When performed properly, window adjustment or STC adjustment can be used to place the AV SYNC engine into the AV SYNC Lock state immediately upon enabling AV Synchronization. This allows the CS4931X/CS49330 to reproduce audio with no discontinuities. Please see Section 4.3.5, "Enabling AV SYNC" for details on enabling AV SYNC.
4.3.4 Manual Control of AV SYNC
The AUTO_AV_SYNC_DISABLE bit provided in the PES Manager is intended only for those systems that require a customized AV SYNC scheme. In applications which require the support of proprietary PES streams, the host may use this bit to provide some manual control of the AV SYNC engine. An example would be a system required to handle splices in a PES stream (discontinuities in the PTS values) without audio discontinuities. When the AUTO_AV_SYNC_DISABLE bit has been set, any condition which would cause the CS4931X/CS49330 to fall out of AV SYNC Lock will disable the AV SYNC engine, and audio will play at the sampling frequency. AV SYNC will remain disabled until explicity enabled through the WRITE_STC message.
4.3.5 Enabling AV SYNC
When enabling AV SYNC (after AV SYNC has been disabled during run-time), audio is played at its sampling frequency irrespective of the PTS/STC relationship of the current stream. The next PTS received after enabling AV SYNC will engage the AV SYNC engine, and audio playback will be governed by the value of |PTS-STC|. When AV SYNC is enabled after a channel change, audio is not played until the decoder verifies that |PTS-STC| falls within the Lock Attempt Window (4). This means that no audio will be heard until the first PTS of the stream has been read by the decoder.
AN162REV2
36
AN162
The |PTS-STC| value is first used to determine whether the AV SYNC engine will enter window (1) or window (2). Window (1) implies a large lip-sync problem and audio will be corrected as discussed in Section 4.3.1 "AV SYNC Lost" on page 33. If the |PTS-STC| value falls into window (2), the application code transitions to the AV SYNC Search state. If the |PTS-STC| value is 16 samples or less, the AV SYNC Lock state will be engaged, and the decoder will fall into window (6). A difference of greater than 16 samples, however, will engage the correction algorithm of either window (4) or window (3). If the value of |PTS-STC| falls within window (5), it is possible to seamlessly enable AV SYNC during run-time (i.e., no audio discontinuities). However, a |PTS-STC| value that falls outside of window (5) will require correction either at a sample or frame level. It is the host's responsibility to ensure that the STC is set properly if no audio discontinuities are to be heard. 6) Playback Window |PTS-STC| < Drift_Thresh Drift_Thresh <= |PTS-STC| AV_Sync_Lost_Thresh |PTS-STC| >= AV_Sync_Lost_Thresh < 7) AV SYNC Drift Window
8) AV SYNC Lost Window The default thresholds are: 1) Lock_Attempt_Fail_Thresh == 2 Frames 2) Lock_Attempt_Thresh == 1 Frame 3) Lock_Thresh == 16 samples 4) AV_Sync_Lost_Thresh == 1 Frame - 160 samples 5) Drift_Thresh == 160 samples The thresholds for the CS4931X/CS49330 AV SYNC algorithm are defined in terms of frame sizes that are specific to each compression algorithm. The frame sizes for AC-3, AAC and MPEG are defined as follows: AC-3 Frame = 1536 Samples AAC Frame = 1024 Samples MPEG Frame = 1152 Samples The enhanced code allows the host to re-size all of these windows with the following constraint: Threshold (1) > Threshold (2) > Threshold (4) > Threshold (5) >= Threshold (3) By automatically disabling the AV SYNC engine, and providing the ability to dynamically change the AV SYNC window definitions, the host is empowered to manually control AV SYNC in order to avoid undesirable audio artifacts. Please bear in mind, however, that manual control of the AV SYNC process can be quite complicated. We strongly recommend using the default values provided in the broadcast application code.
4.3.6 Window Sizing
The "window" boundaries will be defined in terms of programmable "thresholds". The thresholds are defined in relation to perfect sync, or |PTS-STC| == 0. Please see Section 5.2 "PES Manager" on page 45 for more details on the threshold variables. 1) Out of Lock Window |PTS-STC| > Lock_Attempt_Thresh |PTS-STC| <= Lock_Attempt_Thresh |PTS-STC| > Lock_Attempt_Fail_Thresh Lock_Thresh < |PTS-STC| Lock_Attempt_Fail_Thresh |PTS-STC| <= Lock_Thresh <= 2) Lock Engage Window 3) Lock Attempt Fail Window 4) Lock Attempt Window
5) Lock Achieved Window -
4.4 System Clocking
The clocking scheme is one of the most important factors to consider when designing the
37
AN162REV2
AN162
CS4931X/CS49330 into a system. The clocking strategy should be carefully thought out before beginning the design. It is not possible to overstress the importance of clock synchronization within the entire system. The clocking domains relevant to the CS4931X/CS49330 in a system design would be: * The PCM Audio Output Clock * * The DSP Clock The Compressed Data Input Clock (or Average Input Bit Rate) CS4931X/CS49330 is configured to generate the proper internal DSP clocks from this 27 MHz recovered. The CS4931X/CS49330 can also derive audio output clocks (MCLK, SCLK and LRCLK) for 32 kHz, 44.1kHz, 48kHz, and double Fs sampling frequencies from a 27 MHz clock. As discussed in Section 2.1.1 "DSP Clock Speed Dependent on Fs" on page 20, depending on the sampling frequency the DSP Clock may be 86 MHz or 73 MHz.
4.4.3 PCM Audio Output Clocks
The audio output port of the CS4931X/CS49330 has an oversampling clock (MCLK), a bit clock (SCLK), a sampling frequency clock (LRCLK), three PCM data outputs, and an IEC60958 transmitter. Although the IEC60958 transmitter provides a bi-phase encoded signal (clock and data sent together on one wire), the encoded clock is based on the clocks used for the PCM outputs. The CS4931X/CS49330 can derive audio clocks from the recovered clock (i.e., 27 MHz), it can slave to an MCLK signal and provide LRCLK and SCLK, or the CS4931X/CS49330 can slave to LRCLK and SCLK. In all three scenarios the audio output clocks must be synchronized to the clock source used to define the average input bit rate (the recovered clock or reference clock).
4.4.1 Compressed Data Input Clock
In broadcast applications the compressed data can either be delivered at the encoded bit rate (e.g., 384 kbit/s) with a constant clock, or the data can be sent in bursts (bursty format). When data is delivered to the CS4931X/CS49330 in a bursty format, the metric that must be considered is the average rate of data delivery (average bit rate). In both constant clocking and bursty systems the compressed audio must be delivered at an average bit rate equivalent to the encoded bit rate. When data is delivered in bursty format through the serial input (CMPCLK and CMPDATA) the bit clock will run at a higher frequency than the encoded bit rate, but the clock and data will be gated such that it is driven in bursts only when data is available. When averaged over time, though, the delivery rate must be equivalent to the encoded bit rate of the compressed bit stream. Likewise, when delivering the compressed audio over the parallel interface the data can arrive in quick bursts, but the average bit rate of data delivery must be the same as the encoded bit rate.
4.4.4 Input/Output Clock Relationship
Although the PCM output bit rate is much higher than the average bit rate of the incoming data (e.g., incoming bit rate = 384 kbit/s, outgoing bit rate = 6 channels * 48 kHz * 20 bits/sample = 5.76 Mbit/s) it is important that the input and output data clocks are derived from a common clock source. The reference clock source in broadcast applications is generally a 27 MHz clock recovered from the incoming data. When the input data rate and output clocks are not synchronized to one another, audio dropouts will occur. The dropouts may occur infrequently, but they will be inevitable.
AN162REV2
4.4.2 DSP Clock
The CS4931X/CS49330 can use its internal PLL to generate the core DSP clocks and audio output clocks from a reference clock provided on the CLKIN pin. Broadcast demultiplexors typically recover a 27 MHz clock from the incoming data which is synchronized to the clock source used to encode the compressed data. The PLL of the
38
AN162
The reason that audio dropouts will occur is because the rate at which data is delivered to CS4931X/CS49330 will not be exactly matched to the rate at which PCM is pulled from the part. Either the input FIFO will overflow, or the output PCM FIFO will underflow. When asynchronous sources are used for the input clocks and the output clocks, there will be a finite frequency difference since there is no such thing as an ideal clock source. In fact, the clock frequency will also vary over time due to fluctuations in temperature and voltage. Two separate clock sources will vary at different rates which could exacerbate the problem. An easy way to synchronize the input and output clocks is to use the PLL of the CS4931X/CS49330 to derive audio clocks from the clock source that is used to define the average input data rate (the system reference clock or recovered clock). will then be synchronized to the encoded bit rate of the incoming data.
4.4.7 AV SYNC
When the CS4931X/CS49330 is used to maintain audio/video synchronization, it is important that a 27 MHz clock is present on CLKIN, which is locked to the encoder's 27 MHz clock. The CS4931X/CS49330 has an internal system time clock (STC) that is incremented at a frequency of 90 kHz. The 90 kHz clock is obtained by dividing the CLKIN signal by 300, hence 27 MHz is necessary for proper operation. The STC is used in comparisons against the presentation time stamps (PTS) embedded in PES streams to determine when audio samples should be played. The 27 MHz clock recovered by a broadcast system will be synchronized to the encoding clock. The encoding clock is also used as the reference for the PTS values. In order for the PTS values and STC value to increment at the same rate, the DSP clock must be synchronized to the encoding clock. If the 27 MHz clock source is not synchronized to the system reference clock, eventually the AV SYNC will drift and "lip sync" problems will be visible. The AV SYNC engine will continuously attempt to correct for |PTS-STC| differences if the two values are incrementing at different rates. The audible artifacts can range from an offset between events in the video and their associated sounds to muting of the audio. Please see Section 4.3 "Audio/Video Synchronization Algorithm for the CS4931X/CS49330" on page 33 for more details on the AV SYNC engine.
4.4.5 No AV SYNC, Slave to Audio Clocks
If the CS4931X/CS49330 is not responsible for AV SYNC, the audio clocks must be synchronized to the incoming data elsewhere in the system. This is the only scenario that allows for the signal on the CLKIN pin to be asynchronous with respect to the system reference clock.
4.4.6 No AV SYNC, Master Audio Clocks
If the CS4931X/CS49330 is responsible for generating the audio clocks in the system, the signal provided on the CLKIN pin must be phase-locked to the system reference clock. Since the CS4931X/CS49330 will use its internal PLL to derive the audio clocks, the resulting output clocks
AN162REV2
39
AN162
5. COMMON APPLICATION MODULES
The Generalized Audio Manager is generic in its use and applies to all versions of Dolby Digital, AAC, MPEG Stereo, and MP3 codes. The Generalized PES Manager is only applicable to the PES-specific codes: AACP, AASP, AC3P and MPSP.
Note: For the following modules, Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol.
The following should be noted about all values in the application modules: Variables marked by `Default*' will only be initialized after download. These variables will retain their values after a soft reset (or application restart, where applicable). Variables marked by `Default' will be reinitialized to the values shown in this application note after download, soft reset (or application restart, where applicable). Variables marked by `' can be modified during runtime of any application code. Variables NOT marked by `' can NOT be modified during runtime of any application code. Indices and/or specific bits that have indicators like: [PES Codes] or [AACE, AACP, AC3E, AC3P], mean that the associated indices and/or specific bits are only applicable to the codes listed in braces. The indicator of [PES Codes] means [AACP, AASP, AC3P, MPSP]. Only those values which are presented as valid or which fall within the specified range should be written to the application module variables. If a value which falls outside the stated range is written to a variable, functionality of the application is not guaranteed and erroneous output could result. All bits that are not defined should be considered reserved and written with 0's unless specified otherwise.
For variables such as volume and scaling factors, the real number range of 0.0-1.0 is written as 0x000000-0x7FFFFF. This range is linear, i.e. 1/4 volume, or -12 dB, is represented as 0x200000 and is equivalent to a value of 0.25. The formula for converting variable settings from a hexadecimal number into dB is as follows: 20 * log (variable setting/max value for variable) e.g. 20 * log (0x1FFFFF/0x7FFFFF) == -12 dB Numbers preceded by 0x should be interpreted as hex, and numbers followed by `b' should be interpreted as binary. All values sent to the CS4931X/CS49330 should be converted to hexadecimal. Likewise all values read from the part are in hexadecimal.
40
AN162REV2
AN162
5.1 Audio Manager for Dolby Digital, AAC, MPEG and MP3
Note: This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol. Write Opcode = 0x88; Read Opcode = 0x09; Read Response Opcode = 0x89 Write Message = 0x8800HH 0xhhhhhh Read Request Message = 0x0900HH; Read Response Message = 0x8900HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x00
Variable
AUDIO_MGR_CONTROL
Dataword Content
Bit 20 = PCM (12kHz mono + upsampling to 48kHz) Mixing for AASE/AASP codes = 0/1 = Disable/Enable. Bit 14 = Unsolicited_Fscod_Change_Reporting = 0/1= Disable/Enable unsolicited messages that report a change in the Fs. Bit 12 = Unsolicited_PES_ID_Reporting = 0/1= Disable/Enable unsolicited messages that report the current PES stream ID. [PES Codes] Bit 7 = PLL_Status = 0 - PLL is out of lock. READ-ONLY 1 - PLL is locked. Bit 5 = Unsolicited_PLL_Status_Messages = 0/1 = Disable/Enable unsolicited messages indicating that the PLL has lost lock. Bit 4 = PLL_Enable = This bit must be set to 1 for normal operation. Bit 0 = Kickstart_Enable = 0/1 = Disable/Enable Kickstart of application. Default = 0x000000
0x06 0x07 0x08
MASTER_VOLUME L_VOLUME C_VOLUME
0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF [AACE, AACP, AC3E, AC3P] 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF [AACE, AACP, AC3E, AC3P] 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF [AACE, AACP, AC3E, AC3P] 0x800001-0x7FFFFF. (-1.0 to 1.0). Default* = 0x7FFFFF [AACE, AACP, AC3E, AC3P] Table 10. Audio Manager
0x09 0x0a
R_VOLUME LS_VOLUME
0x0b
RS_VOLUME
0x0c
LFE_VOLUME
AN162REV2
41
AN162
Index
0x0d 0x0e MUTE DAO0_CHANNEL
Variable
Dataword Content
0/1 = Unmute/mute audio. This is a soft mute. Default = 0 0...7 = Channel typea for Digital Audio Output 0. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 0(L) 0...7 = Channel typea for Digital Audio Output 1. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 2(R) 0...7 = Channel typea for Digital Audio Output 2. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 3(Ls) 0...7 = Channel typea for Digital Audio Output 3. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 4(Rs) 0...7 = Channel typea for Digital Audio Output 4. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 1(C) 0...7 = Channel typea for Digital Audio Output 5. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 5(LFE) Last PES ID extracted from data stream (see Section 5.3 "Unsolicited Messages (Read-Only)" on page 50) READ ONLY Default=0x000000 [PES Codes]
0x0f
DAO1_CHANNEL
0x10
DAO2_CHANNEL
0x11
DAO3_CHANNEL
0x12
DAO4_CHANNEL
0x13
DAO5_CHANNEL
0x16
LAST_PES_ID
0x17
PLL_REGISTER1_48KHZ
Register 1 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 48kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) Register 2 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 48kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) Register 1 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 44.1kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) Register 2 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 44.1kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) Table 10. Audio Manager (Continued)
0x18
PLL_REGISTER2_48KHZ
0x19
PLL_REGISTER1_44KHZ
0x1a
PLL_REGISTER2_44KHZ
42
AN162REV2
AN162
Index
0x1b
Variable
PLL_REGISTER1_32KHZ
Dataword Content
Register 1 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 32kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) Register 2 value for Phase Locked Loop (with Fs generation). The following values should be used for each corresponding CLKIN frequency: (Fs = 32kHz, CLKIN = 27 MHz, Output A2) Default* = 0xXXXXXX (Reserved) 0...7 = Channel typea for Digital Audio Output 6. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 6(Lt) 0...7 = Channel typea for Digital Audio Output 7. Any channel may be mapped to any valid number of outputs. (Note a) Default* = 7(Rt) 0x800000-0x7FFFFF (-1.0 to 1.0). Default* = 0x7FFFFF Reserved.
0x1c
PLL_REGISTER2_32KHZ
0x1d
DAO6_CHANNEL
0x1e
DAO7_CHANNEL
0x1f 0x20 0x21
DUALZONE_ ATTENUATION RESERVED
DECOMP_DATA_MIXING_ Bits 23:0 = Decompressed data mixing coefficient. 0x000000-0x7FFFFF. Default* = 0x300000 COEFF [AASE, AASP] PCM_DATA_MIXING_ COEFF TONE_DATA_MIXING_ COEFF TONE_START Bits 23:0 = PCM data mixing coefficient. 0x000000-0x7FFFFF. Default* = 0x300000 [AASE, AASP] Bits 23:0 = Tone data mixing coefficient. 0x000000-0x7FFFFF. Default* = 0x100000 [AASE, AASP] Bits 23:0 = Tone Start - Writing a non-zero value to this parameter starts the tone. When the tone is completeed, the parameter is cleared. Default* = 0x000000 [AASE, AASP] Bits 23:0 = Tone Duration (in ms). Default* = 0x000000 [AASE, AASP] Bits 23:0 = Tone Frequency. This variable should be initialized to 2*cos (2*pi*Tone_Freq/Sampling_Frequency) represented in 2Q22 format. Values for standard tone and sampling frequency can be found in a file called Tone.dat (available from your FAE). Default* = 0x000000 [AASE, AASP] Table 10. Audio Manager (Continued)
0x22
0x23
0x24
0x25
TONE_DURATION
0x26
TONE_FREQUENCY
Notes:
a. Channel type 0...7 corresponds to Channels L, C, R, Ls, Rs, LFE, Lt, and Rt, respectively. Lt and Rt refer to down-mixed outputs. If the source made available to the decoder is a 5.1 Channel AC-3 or AAC stream, these outputs will be Pro Logic encoded and should be considered to be Lt and Rt. However, for a 2.0 Channel AC-3 stream, these outputs will be simply L and R. For all MPEG and MP3 codes this output will always be just L and R. See definition on page 40. 43
AN162REV2
AN162
"Default" vs. "Default*" See definition page 40.
5.1.1 Audio_Mgr_Control (Index 0x00)
Bit 12: Unsolicited_PES_ID_Reporting This bit configures the CS4931X/CS49330 to deliver an unsolicited message to the host each time the PES ID changes. 0 - Disables Unsolicited PES_ID_Reporting 1 - Enables Unsolicited PES_ID_Reporting Bit 4: PLL_Enable The internal PLL generates clocks based upon the Fs of the current data stream. The PLL will work ONLY for a CLKIN frequency of 27 MHz. If other CLKIN frequency is desired please contact the factory for this possibility. Note: Bit 4 must be set for normal operation. Bit 0: Kickstart Enable 0 - Application continues waiting for kickstart. 1 - Application is kickstarted
erate audio clocks at the correct sampling frequency and the internal DSP clock. The default values shown for each index are calculated for a 27 MHz CLKIN frequency.
5.1.4 Special Notes about PCM Mixing Functionality available with AASE and AASP Application Codes
1. The AASE and AASP codes assume that mono PCM data @12Khz will be delivered to the DAI port. If parallel data delivery (host input port 0) is to be used for PCM data, the following configuration message should be sent before kickstart. 0x800210 0x003FC0 0x800110 0x0E0014 2. If sampling frequency is not 48KHz, host should disable mixing. This will disable tone mixing also. If tone mixing is required at Fs = 44.1 and 32.0 kHz, mixing should be enabled but the PCM data mixing coefficient (Audio Manager Index 0x22) should be Set to zero. 3. If using parallel port delivery for PCM data, host must write mono PCM samples (16bit precision) uniformly at 12Khz rate to avoid input buffer overflow/underflow. 4. Sum of all the three mixing coefficients (indices 0x21, 0x22 & 0x23) must be smaller that 0x7FFFFF to avoid signal clipping.
5.1.2 Mute (Index 0x0d)
Setting this index to 0x000001 gradually ramps down the volume of the PCM outputs down to zero within 1 5mS. Clearing this index gradually ramps the volume up to the current volume setting within 15 mS. The time required to complete the ramp is dependent on the volume setting. The maximum ramp time of 15 mS is required to change the volume from 0x7fffff to 0x000000.
5.1.3 PLL Registers (Indexes 0x17 - 0x1c)
PLL Register1 and PLL Register2 values configure the internal PLL of the CS4931X/CS49330 to gen-
44
AN162REV2
AN162
5.2 PES Manager
This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol.
Write Opcode = 0xA2; Read Opcode = 0x23; Read Response Opcode = 0xA3 Write Message = 0xA200HH 0xhhhhhh Read Request Message = 0x2300HH; Read Response Message = 0xA300HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value Notes: See definition on page 40. "Default" vs. "Default*"See definition page 40.
5.2.1 PES_CONTROL_AND_AV_SYNC_ STATUS (Index 0x00)
This control index allows the host to do the following:
Control and monitor AV synchronization process Inform the CS4931X/CS49330 whether the incoming stream is ATSC compliant (in the case of AC-3) Read the status of the AV SYNC engine
Please note that the actual enabling of AV SYNC mechanism is done through WRITE_STC Message. The AV SYNC status bits are valid only when AV SYNC has already been enabled and the status of whether AV SYNC has been enabled or not is reflected in bit 4 of the PES_Control. Note that at any given time only one of Bits[7:5] will be set when AV SYNC is enabled. Bit 10: AUTO_AV_SYNC_DISABLE Setting this bit allows the decoder to automatically disable the AV synchronization engine when the AV_Sync_Lost state has been entered. AV synchronization will not resume until the host re-enables the AV SYNC engine using the WRITE_STC message. If this bit is cleared the AV SYNC engine can only be disabled using the WRITE_STC message. Bit 9: SPDIF (XMT_OUTPUT_FORMAT) This determines if the output format on the AUDAT3/ XMT958 pin is IEC61937-formatted
AN162REV2
compressed data or IEC60958 Lt, Rt Down mixed PCM for the AASE, AASP, AC3E and AC3P codes. This bit is sampled after kickstart and is latched until next reset. Therefore switching between compressed output and PCM in the AASE, AASP, AC3E, and AC3P codes is only possible after download or soft reset. The setting of this bit has no affect on all other codes, as they default to IEC60958 Stereo (L,R) PCM output of the AUDAT3/XMT958 pin. In all codes, it is possible to configure the output of the AUDAT3/XMT958 pin to be I2S formatted, provided Bit 9 has been set to 0. Please refer to Section 2.1.2 "Configuring the XMT958/AUDAT3 Data Format" on page 20 for configuring the CS4931X/CS49330 for I2S output from the AUDAT3/XMT958 pin. Bit 8: ATSC_COMPLIANCE Setting this bit forces the decoder to check for all ATSC constraints imposed upon the PES header and extensions. Note: Certain variables denoted READ-ONLY extract their values directly from the incoming stream while others denoted READ-ONLY are fixed. Variables designated as READ-ONLY can not be altered by the host.
5.2.2 INSTANT_PTS-STC (Index 0x04)
Once AV synchronization has been achieved (as indicated by the AV_Sync_Lock bit), this value should remain constant. Please note that this value
45
AN162
Index
0x00
Variable
PES_CONTROL_AND_ AV_SYNC_STATUS
Dataword Content
----------------------------- CONTROL BITS ----------------------------Bit 16 = Instant_PTS-STC_Updated = [PES Codes] READ-ONLY 0 - PES Manager index 0x04 not updated since last read 1 - PES Manager index 0x04 updated since last read Bit 15 = AV_Drift_Relock Enable = [PES Codes] 0 - Disable automatic relock when in drift window 1 - Enable automatic relock when in drift window Bit 14 = Unsolicited AV_Sync_Drift Message Enable = [PES Codes] 0 - Disable AV_Sync_Drift message 1 - Enable AV_Sync_Drift message Bit 13 = Unsolicited AV_Sync_Timeout Message Enable = [PES Codes] 0 - Disable AV_Sync_Timeout message 1 - Enable AV_Sync_Timeout message Bit 12 = Unsolicited AV_Sync_Lost Message Enable = [PES Codes] 0 - Disable AV_Sync_Lost message 1 - Enable AV_Sync_Lost message Bit 11 = AV_Sync_Lost Message Payload Selection = [PES Codes] 0 - Offending PTS from stream included 1 - Instant PTS-STC included Bit 10 = Auto_AV_Sync_Disable = [PES Codes] 0 - AV SYNC control unaffected by sync status 1 - AV SYNC disabled when sync engine falls out of lock Bit 9 = S/PDIF_Output_Format = [AASE, AASP, AC3E, AC3P] 0 - AC-3 or AAC Compressed output per IEC61937 Specification (default) 1 - PCM 2 channel Lt, Rt per IEC60958 Specification Note: By default the AUDAT3/XMT958 pin is configured for S/PDIF output, however the host must configure the AUDAT3/XMT958 pin for S/PDIF output if this bit is set to 0. The AUDAT3/XMT may be configured for I2S output when this bit is set to 1. Refer to Section 2.1.2 "Configuring the XMT958/AUDAT3 Data Format" on page 20 for more information about configuring the output of the AUDAT3/XMT958 pin. Table 11. PES Manager
46
AN162REV2
AN162
Index
0x00
Variable
PES_CONTROL_AND_ AV_SYNC_STATUS
Dataword Content
Bit 9 = S/PDIF_Output_Format = [AACE, AACP, MP3E, MPSE, MPSP] 0 - PCM 2 channel L, R per IEC60958 Specification (default) [MP3E, MPSE, MPSP] 0 - PCM 2 channel Lt, Rt per IEC60958 Specification (default) [AACE, AACP] Note: For the above listed codes, this bit MUST be set to 0. By default the AUDAT3/XMT958 pin is configured for S/PDIF output, however, the AUDAT3/XMT may be configured for I2S output when this bit is set to 0. Refer to Section 2.1.2 "Configuring the XMT958/AUDAT3 Data Format" on page 20 for more information about configuring the output of the AUDAT3/XMT958 pin.Bit 8: ATSC_Compliance = 0 - ATSC compliance not enforced 1 - ATSC compliance enforced [AC3P]
------------------------------ STATUS BITS -----------------------------Bit 7 = AV_Sync_Wait = [PES Codes] 0 - AV SYNC is not in wait mode READ-ONLY 1 - AV SYNC is in wait mode Bit 6 = AV_Sync_FF = [PES Codes] 0 - AV SYNC is not in FF mode READ-ONLY 1 - AV SYNC is in FF mode Bit 5 = AV_Sync_Lock = [PES Codes] 0 - AV SYNC is out of lock READ-ONLY 1 - AV SYNC is in lock Bit 4 = AV_Sync_Enabled= [PES Codes] 0 - AV SYNC is disabled READ-ONLY 1 - AV SYNC is enabled Bit 3 = PES_Sync_Status = [PES Codes] 0 - PES sync lost READ-ONLY 1 - PES sync is established Bit 2 = AV_Sync_Lock_Extension = Provides additional status about AV SYNC [PES Codes] 0 - No information available READ-ONLY 1 - If AV_Sync_Lock==0, AV_Sync_Timeout If AV_Sync_Lock==1, AV_Sync_Drift Bits 1:0 = STC_Rate = [PES Codes] 00b - CLKIN is 27 MHz 01b - Reserved 10b - Reserved 11b - Reserved Default = 0x000000 Table 11. PES Manager (Continued)
AN162REV2
47
AN162
Index
0x01 0x02 0x03
Variable
RESERVED RESERVED OUTPUT_FIFO_ UNDERFLOW INSTANT_PTS-STC Reserved. Reserved.
Dataword Content
0x000000-0x7FFFFF - Integer number of output FIFO underflows. To clear the count, write 0x000000 to this index. Default = 0x000000 This index provides the instantaneous difference between the PTS for the current sample and the internal STC in terms of audio samples (saturated to 24 bit arithmetic). The host must convert this number into time by dividing by the sampling frequency of the current stream. READ-ONLY Threshold used to define AV SYNC Drift Window. This parameter is specified in terms of audio samples, which the host needs to convert to the actual time by using appropriate Fs. Default* = 0xA0 Volume control for the Left channel in the XMT PCM output. 0x000000-0x7FFFFF. Note: Only applicable when Bit 9 is set to 1 in Index 0x00 in the Audio Manager for AASE, AASP, AC3E or AC3P codes. This is register is always applicable for all other codes when Bit 9 is set to 0 in Index 0x00 in the Audio Manager. Volume will have an effect on the output data, regardless of the setting of the output configuration of the AUDAT3/XMT958 pin. Default* = 0x7FFFFF
0x04
0x05
DRIFT_THRESH
0x06
XMT_L_VOLUME
0x07
XMT_R_VOLUME
Volume control for the Right channel in the XMT PCM output. 0x000000-0x7FFFFF. Note: Only applicable when Bit 9 is set to 1 in Index 0x00 in the Audio Manager for AASE, AASP, AC3E or AC3P codes. This is register is always applicable for all other codes when Bit 9 is set to 0 in Index 0x00 in the Audio Manager. Volume will have an effect on the output data, regardless of the setting of the output configuration of the AUDAT3/XMT958 pin. Default* = 0x7FFFFF
0x08
LOCK_ATTEMPT_ THRESH
This threshold is defined in terms of the PTS-STC difference, and should be given as a number of audio samples. 0x000000-0x7FFFFF. Default* = 0x000600 [AC-3] Default* = 0x000400 [AAC] Default* = 0x000480 [MPEG] This threshold is defined in terms of the PTS-STC difference, and should be given as a number of audio samples. 0x000000-0x7FFFFF. Default* = 0x000C00 [AC-3] Default* = 0x000800 [AAC] Default* = 0x000900 [MPEG] Table 11. PES Manager (Continued)
0x09
LOCK_ATTEMPT_FAIL_ THRESH
48
AN162REV2
AN162
Index
0x0a
Variable
LOCK_THRESH
Dataword Content
This threshold determines when the AV SYNC engine will declare AV lock. This threshold is defined in terms of the PTS-STC difference, and should be given as a number of audio samples. 0x000000-0x7FFFFF. Default* = 0x000010 This threshold is defined in terms of the PTS-STC difference, and should be given as a number of audio samples. 0x000000-0x7FFFFF. Default* = 0x000560 [AC-3] Default* = 0x000360 [AAC] Default* = 0x0003E0 [MPEG] Table 11. PES Manager (Continued)
0x0b
AV_SYNC_LOST_ THRESH
corresponds to the PTS-STC numbers used by our AV SYNC algorithm.
(Index 0x08)
This threshold determines when the AV SYNC engine will attempt to achieve AV lock by adding/dropping audio samples, and is valid only while the decoder is searching for AV lock. The default value for this parameter is 1 audio frame. AC-3 has a frame size of 1536 samples. AAC has a frame size of 1024 samples. MPEG has a frame size of 1152 samples. * Out of Lock Window: |PTS-STC| > Lock_Attempt_Thresh * AV SYNC Drift Window: Drift_Thresh <= |PTS-STC| < AV_Sync_Lost_Thresh
5.2.3 DRIFT_THRESH (Index 0x05)
If AV_Drift_Relock is enabled, this index sets the threshold at which the AV SYNC drift algorithm will be activated. This feature allows the user to reduce audio decoder sensitivity to jittery STC updates and/or to jitter (drift) in the 27 MHz system clock. This parameter is specified in terms of audio samples, which the host needs to convert to the actual time by using appropriate Fs. Recommended range is 160-480 samples (0xA0-0x1E0), which results in 3.33 ms - 10 ms window for 48 kHz Fs or 5 ms - 15 ms for 32 kHz Fs. * Playback Window: |PTS-STC| < Drift_Thresh
5.2.4 XMT_L_VOLUME (Index 0x06)
This volume control is independent of the volume control of the main L channel. However muting is still under control of the Mute_Flag in the Audio Manager and/or AV SYNC mechanism and/or underflow control.
5.2.7 LOCK_ATTEMPT_FAIL_THRESH (Index 0x09)
This threshold determines when the AV SYNC engine will quit attempting to achieve AV lock on a sample-by-sample basis, and is valid only while the decoder is searching for AV lock. The default value for this parameter is 2 audio frames. AC-3 has a frame size of 1536 samples. AAC has a frame size of 1024 samples. MPEG has a frame size of 1152 samples. * Lock Engage Window: |PTS-STC| <= Lock_Attempt_Thresh * * Lock Attempt Window: Lock_Thresh < |PTS-STC| <= Lock_Attempt_Fail_Thresh Lock Attempt Fail Window: |PTS-STC| >
49
5.2.5 XMT R_VOLUME (Index 0x07)
This volume control is independent of the volume control of the main R channel. However muting is still under control of the Mute_Flag in the Audio Manager and/or AV SYNC mechanism and/or underflow control.
5.2.6 LOCK_ATTEMPT_THRESH
AN162REV2
AN162
Lock_Attempt_Fail_Thresh
5.2.8 LOCK_THRESH (Index 0x0a)
This threshold determines when the AV SYNC engine will declare AV lock. This threshold is defined in terms of the PTS-STC difference, and should be given as a number of audio samples. * Lock Attempt Window: Lock_Thresh < |PTS-STC| <= Lock_Attempt_Fail_Thresh * Lock Achieved Window: |PTS-STC| <= Lock_Thresh
5.2.9 AV_SYNC_LOST_THRESH (Index 0x0b)
This threshold determines when the AV SYNC engine will declare AV SYNC lost, and is valid only when the decoder is in the AV lock state. The default value for this parameter is 1 audio frame - 160 samples. AAC has a frame size of 1024 samples. AC-3 has a frame size of 1536 samples. MPEG has a frame size of 1152 samples. * AV SYNC Drift Window: Drift_Thresh <= |PTS-STC| < AV_Sync_Lost_Thresh * AV SYNC Lost Window: |PTS-STC| >= AV_Sync_Lost_Thresh
5.3 Unsolicited Messages (Read-Only)
This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol.
No Write Message. No Read Request. Unsolicited Read Response = 0x8700HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x01
Variable
PES_ID_RESPONSE Bits 23:8 = Reserved
Dataword Content
Bits 7:0 = Last ID extracted from PES header: 0xBD = PES encoded AC-3 data 0xC0 - 0xDF = PES encoded MPEG data
0x02
FSCOD_CHANGE
Bits 23:4 = Reserved Bits 3:0 = Last FS information extracted from AC-3/MPEG header: 0x0 = 48 kHz 0x1 = 44.1 kHz 0x2 = 32 kHz 0x3 = 96 kHz
0x10
RESERVED
Bits 23:0 = Reserved Table 12. Unsolicited Messages
Note:
All of these unsolicited messages must first be enabled in the Audio Manager module. There is another set of unsolicited messages that can happen because of various conditions enabled in the PES Manager module and those
messages are covered later in this document.
5.3.1 PES ID Detection
The ID found in the PES header is extracted and reported to the host through index 0x16 of the Audio Manager Module and can also be sent as an unsolicited message if PES_ID_Reporting is selected in
AN162REV2
50
AN162
the Audio Manager. The PES encoder is responsible for assigning a valid PES ID to the data stream. If the PES ID does not match the data type, then the CS4931X/CS49330 will not produce audio. Valid MPEG streams must have a PES ID in the range 0xC? - 0xD? where `?' can have any value in the range 0x0 - 0xF. PES encoded AC-3 streams must have a PES ID of 0xBD which indicates a private_stream_1. After each channel change the PES ID is reset to 0x00. This means that if PES ID unsolicited messages are enabled, a new message will be sent after each channel change once PES SYNC has been established.
AN162REV2
51
AN162
6. COMMON STAND-ALONE MESSAGES
Note: Stand-Alone Message Communication Protocol must be used. Please refer to Section 3.2 "Stand-Alone Message Communication Protocol" on page 29 for more information about the Stand-Alone Message Communication Protocol.
Table 13 illustrates the WRITE_STC message:
6.1.1 EN - AV SYNC Enable
This bit enables or disables A/V synchronization.
1 - Enable AV SYNC. STC_MSB and STC_LSB must contain the correct 33 bit value to be written to the STC of the CS4931X/CS49330. 0 - Disable AV Sync.
This section presents the stand-alone messages common to all broadcast code releases and their functionality. Since each stand-alone message is unique, it is assumed that the user is familiar with each message and its individual requirements. In this section host messages are paired with their DSP response messages when applicable.
6.1.2 IGN - Ignore EN Bit
This bit allows the host to update the STC of the decoder without affecting the state of the AV SYNC engine. Essentially, the CS4931X/CS49330 will ignore the state of EN when the IGN bit is set by the host.
1 - Ignore the state of EN. Allow CS4931X/CS49330 to determine whether AV SYNC is currently enabled. The state of the AV SYNC engine can be read from index 0x00 of the PES Manager. 0 - Use the EN bit to enable/disable the AV SYNC engine.
6.1 WRITE_STC [PES Codes]
This message allows the host to enable audio/video (AV) synchronization and write the 33 bit system time counter (STC). Alternatively this message can be used to disable AV synchronization. This message could be sent at start-up, during run-time or as a part of a channel change procedure. Please refer to Section 6.3.2 "Channel Change Procedure" on page 55 for more information. The WRITE_STC message involves a host command word followed by a host data word.
6.1.3 STC_LSB
The 9 least significant bits of the 33 bit STC to be written.
Host Command Word:
23 22 21 20 19 18 OPCODE=0xA0 17 16 15 EN 14 IGN 13 0 12 0 11 0 10 0 9 0 8 7 6 543 STC_LSB 2 1 0
Host Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 STC_MSB 11 10 9 8 7 6 5 4 3 2 1 0
Table 13. WRITE_STC (Host Command)
52
AN162REV2
AN162
6.1.4 STC_MSB
The 24 most significant bits of the 33 bit STC to be written.
6.2.1 SEL - STC/PTS Select
1 - The current STC (latched upon receiving the host message) will be returned by the DSP 0 - The last stream PTS used in AV SYNC algorithm will be returned by the DSP The DSP will respond with the DSP response command and data word illustrated in Table 15 on page 53.
6.2 READ_STC_PTS [PES Codes]
This host message solicits the DSP to respond with the last presentation time stamp (PTS) that was used in the AV SYNC algorithm. This host command can also to be used to solicit the DSP to respond with the current system time counter value. It is important to note that the OPCODE for the DSP response message is different than the OPCODE for the host message. The READ_STC_PTS message involves one host command word. The DSP will in turn respond with a DSP response command word followed by a DSP response data word. Table 14 illustrates the READ_STC_PTS host message.
6.2.2 SEL - STC/PTS Select
This bit is echoed from the Host Command Word.
6.2.3 STC_PTS_LSB
The 9 least significant bits of the 33 bit STC or stream PTS being read.
6.2.4 STC_PTS_MSB
The 24 most significant bits of the 33 bit STC or stream PTS being read.The last PTS used by the AV synchronization algorithm will be reported by the READ_STC_PTS message.
Host Command Word:
23 22 21 20 19 18 OPCODE=0x21 17 16 15 SEL 14 13 12 11 10 9 87 0x00 6 5 4 3 2 1 0
Table 14. READ_STC_PTS (Host Command)
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0xA1 17 16 15 SEL 14 0 13 0 12 0 11 0 10 0 9 0 8 7 654321 STC_LSB or PTS_LSB 0
DSP Response Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 STC_MSB or PTS_MSB 10 9 8 7 6 5 4 3 2 1 0
Table 15. READ_STC_PTS (DSP Response Command and Data)
AN162REV2
53
AN162
Notes: 1) The last PTS used by the AV synchronization algorithm will be reported by the READ_STC_PTS message.
Table 16 illustrates CHANNEL_CHANGE_REQUEST mand.
host
the com-
2) The STC reported is guaranteed to have a maximum error of 1 LSB (one tick of the 90 kHz system time counter) when referenced to the time at which the READ_STC_PTS message was received.
6.3.1 EN
This bit selects whether the DSP should respond to the CHANNEL_CHANGE_REQUEST with a solicited response to indicate that it is ready for the WRITE_STC message that carries new STC time base for the new channel.
1 - The DSP will respond when it is ready for a WRITE_STC message 0 - The DSP will not respond when it is ready for a WRITE_STC message. For this case the host should wait at least 50 ms before sending the WRITE_STC message
6.3 CHANNEL_CHANGE_REQUEST [PES Codes]
The host can use this message to change between different PES streams. The DSP will soft mute and prepare for accepting a new PES stream. The host can enable an unsolicited response from the DSP which indicates that the DSP is ready to accept a new WRITE_STC message. Conversely, the host can wait 50 ms and then send a WRITE_STC message. The entire channel change process is detailed further below. The CHANNEL_CHANGE_REQUEST involves one host command word. The DSP can optionally respond with a DSP response command word followed by a DSP response data word if the response is enabled in the host command.
If the EN bit is set in the CHANNEL_CHANGE_REQUEST sent by the host, the DSP will send a solicited response as shown in Table 17. This CHANNEL_CHANGE_REQUEST acknowledge indicates that the DSP is ready for a new WRITE_STC message.
Host Command Word:
23 22 21 20 19 18 OPCODE=0x24 17 16 15 EN 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 0 3 0 2 0 1 0 0 0
Table 16. CHANNEL_CHANGE_REQUEST (Host Command)
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0xA5 17 16 15 14 13 12 11 10 987 0x0000 6 5 4 3 2 1 0
DSP Response Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 0x000000 11 10 9 8 7 6 5 4 3 2 1 0
Table 17. CHANNEL_CHANGE_REQUEST (DSP Response Command and Data) 54 AN162REV2
AN162
6.3.2 Channel Change Procedure
In order to transition synchronized audio playback from one channel to another, the following message sequence is to be followed by the host controller. 1) Send Mute Command (0x88000d, 0x000001). For a consistent and audibly pleasant channel change this is recommended but not required. 2) Send CHANNEL_CHANGE_REQUEST to the DSP. (0x248000 if solicited response is desired, 0x240000 if no DSP response is desired). 3) At this point the host should wait 50ms if the solicited CHANNEL_CHANGE_REQUEST acknowledge was not enabled. If the solicited CHANNEL_CHANGE_REQUEST acknowledge was enabled, the host should wait for this message from the DSP (0xA50000 0x000000). After, at most 50 ms, the DSP will stop asking for data (CMPREQ will go high, indicating that the data from the old channel are no longer accepted) and wait for a new WRITE_STC message.
Note: We recommend that the host reads all solicited message responses before initiating a channel change to insure clean communication.
6.3.3 Channel Change Procedure Notes
Any number of CHANNEL_CHANGE_REQUESTs may be issued prior to issuing a WRITE_STC message. One or more CHANNEL_CHANGE_REQUESTs immediately preceding a WRITE_STC message, along with the WRITE_STC message constitutes one complete channel change sequence. If more than one CHANNEL_CHANGE_REQUEST is sent before sending a WRITE_STC to complete the channel change procedure, then each CHANNEL_CHANGE_REQUEST should have the EN bit set (or not set) consistently. If the state of the EN bit changes during a string of multiple CHANNEL_CHANGE_REQUESTs, then DSP behavior will be undefined. Only one CHANNEL_CHANGE_REQUEST acknowledgment message will be generated if the EN bit is set. The host should ensure that no data from the new channel is sent to the DSP before issuing CHANNEL_CHANGE_REQUEST. New data should be withheld until after the new WRITE_STC message has been issued. Additionally, once CMPREQ goes high, all old data at the host/demux side should be flushed, ensuring that no old data is sent to the DSP after the new WRITE_STC message. These data management suggestions will allow the fastest possible audio channel playback. The input FIFO will accept new channel input, indicated by the CMPREQ signal dropping, upon processing the WRITE_STC message which completes the Channel Change.
4) At this point the HOST should send a WRITE_STC message with the correct system time clock to the CS4931X/CS49330 for the next channel. It is sometimes necessary to adjust the STC for the CS4931X/CS49330 to adjust for system latencies between audio decode and video decode. This adjustment is entirely system dependent.
Note: If AV synchronization is not desired for the new stream, the WRITE_STC message should be sent with AV synchronization disabled.
6.4 AV_SYNC_LOST [PES Codes]
AV_SYNC_LOST is an unsolicited message from the DSP which indicates that the AV SYNC engine has lost lock, meaning that the difference between the current STC and PTS exceeds the AV_Sync_Lost_Thresh (index 0x0b of the PES Manager). If Auto_AV_Sync_Disable has been activated, the decoder will continue to play audio
55
5) If the DSP was muted in step 1, send an unmute (0x88000d, 0x000000).
AN162REV2
AN162
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0xA4 17 16 15 14 13 0x0 12 11 10 IPS AVD 9 0 8 7654321 PTS_LSB or (PTS-STC) LSB 0
DSP Response Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 11 10 PTS_MSB or (PTS-STC) MSB 9 8 7 6 5 4 3 2 1 0
Table 18. AV_SYNC_LOST (DSP Response Command and Data)
without AV synchronization when this message is issued. If Auto_AV_Sync_Disable has not been activated, audio will be soft muted when this message is generated. This message can be enabled in the PES Manager Module (bit 12 =1), and it is disabled by default (bit 12 = 0). Table 18 on page 56 illustrates the format of the AV_SYNC_LOST DSP response message. The payload of this message (bits 8:0 of the DSP response command, and the subsequent DSP response data) can contain either the `bad' PTS as extracted from the PES stream, or the instantaneous PTS-STC at the time of sync loss. The host can select whichever payload is most useful by setting the AV_Sync_Lost Message Payload Selection bit (bit 11) of the PES Manager.
This message is generated only if the DSP had already achieved lock and then subsequently lost lock This message will never be generated if AV SYNC algorithm has not been enabled through WRITE_STC message or the AV_SYNC_LOST message has not been enabled in the PES Manager (bit 12 = 0). The message will be generated only once for each transition from an AV SYNC lock state to AV SYNC out of lock.
6.5 AV_SYNC_DRIFT [PES Codes]
AV_SYNC_DRIFT is an unsolicited message from the DSP which indicates that the AV SYNC engine has determined that the instantaneous PTS-STC value is larger than the value specified in the index 5 of the PES Manager (default is 160 audio samples) but less than 1 audio frame - 160 samples (AAC = 864 samples, AC-3 = 1376 samples, MPEG = 992 samples). The largest lower threshold that we recommend is 480 samples. This message can be enabled in the PES Manager Module (bit 14 = 1), and it is disabled by default (bit 14 = 0). Table 19 on page 57 illustrates the AV_SYNC_LOST DSP response message.
6.4.1 IPS - Instantaneous PTS-STC Select
This bit indicates whether the Instantaneous PTS-STC (IPS) or PTS is returned in this message. 1 - The payload of this message contains the instantaneous PTS-STC 0 - The payload of this message contains the most recent PTS from the incoming stream
6.5.1 DRIFT_RELOCK_STATUS
7 bit field- The drift control field indicates whether the host has activated AV_Drift_Relock. When enabled, the DSP will automatically add or drop samples in order to bring the instantaneous PTS-STC back to 0ms. If AV_Drift_Relock is disabled, the host may update the STC counter using WRITE_STC message or may not take any action if the system is designed in such a way that this event may not harm the overall AV SYNC mechaAN162REV2
6.4.2 AVD - Auto Disable Status
This bit indicates whether Auto_AV_Sync_Disable has been activated. 1 - Auto_AV_Sync_Disable is activated (see bit 10 of PES Manager Index 0x00) 0 - Auto_AV_Sync_Disable is deactivated
56
AN162
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0xA4 17 16 15 14 13 12 11 10 DRIFT_RELOCK_STATUS 9 8 7 6 5 43 0x00 2 1 0
DSP Response Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 PTS-STC 11 10 9 8 7 6 5 4 3 2 1 0
Table 19. AV_SYNC_DRIFT (DSP Response Command and Data)
nism and the system lip sync. For example, if it is known that there are some bad instantaneous PTSs, the host may not take any action. Clearly, the bad PTS may only be up to 32 ms away from the actual correct value, otherwise AV_SYNC_LOST mechanism will kick in. 0100 000 b - AV_Drift_Relock is disabled 0100 100 b - AV_Drift_Relock is enabled
in the PES Manager (bit 14 = 0). The message will be generated only once for each transition from an AV SYNC lock state to this new state.
6.6 AV_SYNC_TIMEOUT [PES Codes]
AV_SYNC_TIMEOUT is an unsolicited message from the DSP which indicates that the AV SYNC engine found itself stuck for more than 2 seconds in the Lock Attempt window defined in Section 4.3.2 "AV SYNC Search" on page 35. This is indicative that the AV Sync engine did not reach either the value set in Lock_Attempt_Fail_Threshold (Index 0x09) or the value in Lock_Threshold (in Index 0x0a) of the PES Manager in its attempt to reach AV Sync lock. Upon receipt of this message the host should update the STC counter of the CS4931X/CS49330 with the WRITE_STC message. The AV_SYNC_TIMEOUT message can be enabled in the PES Manager Module (bit 13 =1), and it is disabled by default (bit 13=0). Table 20 illustrates the AV_SYNC_TIMEOUT DSP response message.
6.5.2 PTS-STC
This field gives the instantaneous difference between PTS and STC in audio samples at the point in time when instant drift was detected. Divide this value by the sampling frequency of the current stream to determine the absolute time difference. The PTS-STC information included in the message indicates the instantaneous value which triggered the message. This message is generated only if the DSP had already achieved lock. This message will never be generated if AV SYNC algorithm has not been enabled through WRITE_STC message or the AV_SYNC_DRIFT message has not been enabled
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0xA4 17 16 15 14 13 12 11 10 987 0x8000 6 5 4 3 2 1 0
DSP Response Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 PTS-STC 11 10 9 8 7 6 5 4 3 2 1 0
Table 20. AV_SYNC_TIMEOUT (DSP Response Command and Data) AN162REV2 57
AN162
6.6.1 PTS-STC
This field gives the instantaneous difference between PTS and STC in audio samples at the instant of the time-out. Divide this value by the sampling frequency of the current stream to determine the absolute time difference. The PTS-STC information included in the message indicates the instantaneous value in audio samples at the instant of time-out. This message will never be generated if AV SYNC algorithm has not been enabled through WRITE_STC message or the AV_SYNC_TIMEOUT message has not been enabled in the PES Manager (bit 13 = 0). The message will be generated only once for each transition into the Lock Attempt Window during which the CS4931X/CS49330 times out. Please see Section 4.3 "Audio/Video Synchronization Algorithm for the CS4931X/CS49330" on page 33 for details on the Lock Attempt Window. poses and should not be used in a production system. Input overflow is a catastrophic error indicating that the host has a flow control problem. In the event of input overflow at least one frame of compressed data will be lost. The absolute amount of lost data depends on how long the host delivered data while in the overflow state. The INPUT FIFO_OVERFLOW message involves one host command word. The DSP will then return a DSP response command word followed by a DSP response data word. Table 21 illustrates the INPUT_FIFO_OVERFLOW host command. The DSP will respond with the DSP response command and data word illustrated in Table 22.
6.7.1 OVR - Overflow Status
This bit indicated that the input FIFO of the CS4931X/CS49330 has overflowed. Once an overflow has occurred this bit will remain set until it is explicitly cleared by the CLEAR_INPUT_FIFO_OVERFLOW message.
6.7 INPUT_FIFO_OVERFLOW
The INPUT_FIFO_OVERFLOW message allows the host to check whether the input FIFO of the CS4931X/CS49330 has overflowed. Please note that this message is intended only for debug pur-
Host Command Word:
23 22 21 20 19 18 OPCODE=0x01 17 16 15 14 13 12 11 10 987 0x8014 6 5 4 3 2 1 0
Table 21. INPUT_FIFO_OVERFLOW (Host Command)
DSP Response Command Word:
23 22 21 20 19 18 OPCODE=0x81 17 16 15 14 13 12 11 10 987 0x8014 6 5 4 3 2 1 0
DSP Response Data Word:
23 0 22 0 21 0 20 0 19 0 18 0 17 0 16 0 15 0 14 0 13 0 12 0 11 0 10 0 9 0 8 0 7 0 6 0 5 0 4 0 3 0 2 O 1 0 0 0
Table 22. INPUT_FIFO_OVERFLOW (DSP Response Command and Data) 58 AN162REV2
AN162
Host Command Word:
23 22 21 20 19 18 OPCODE=0x80 17 16 15 14 13 12 11 10 987 0x8214 6 5 4 3 2 1 0
Host Data Word:
23 22 21 20 19 18 17 16 15 14 13 12 0xFFFFFB 11 10 9 8 7 6 5 4 3 2 1 0
Table 23. CLEAR_INPUT_FIFO_OVERFLOW
6.8 CLEAR_INPUT_FIFO_OVERFLOW
The CLEAR_INPUT_FIFO_OVERFLOW message allows the host to clear the FIFO overflow indicator that can be read with the INPUT_FIFO_OVERFLOW message. Please note that this message is intended only for debug purposes and should not be used in a production system. The CLEAR_INPUT_FIFO_OVERFLOW message involves one host command word followed by a host data word. Table 23 illustrates the CLEAR_INPUT_FIFO_OVERFLOW host command.
CS4931X/CS49330 input FIFO. With this information the host can calculate the input FIFO level. Please note that this message is intended only for debug purposes and should not be used in a production system. The INPUT_FIFO_LEVEL message involves one host command word. The DSP will then return a DSP response command word followed by a DSP response data word. Table 24 illustrates the INPUT_FIFO_LEVEL host message. The DSP will respond with the DSP response message and data word illustrated in Table 25.
6.9.1 PUT
The PUT section of the INPUT_FIFO_LEVEL message refers to the 12 bit value of the CS4931X/CS49330 input FIFO put pointer
12 11 10 987 0x8012 6 5 4 3 2 1 0
6.9 INPUT_FIFO_LEVEL
The INPUT_FIFO_LEVEL message allows the host to read the get and put pointers of the
Host Command Word:
23 22 21 20 19 18 OPCODE=0x01 17 16 15 14 13
Table 24. INPUT_FIFO_LEVEL (Host Command) DSP Response command Word:
23 22 21 20 19 18 OPCODE=0x81 17 16 15 14 13 12 11 10 987 0x8012 6 5 4 3 2 1 0
DSP Response data Word:
23 22 21 20 19 18 17 PUT 16 15 14 13 12 11 10 9 8 7 65 GET 4 3 2 1 0
Table 25. INPUT_FIFO_LEVEL (DSP Response Command and Data) AN162REV2 59
AN162
6.9.2 GET
The GET section of the INPUT_FIFO_LEVEL message refers to the 12 bit value of the CS4931X/CS49330 input FIFO get pointer The input FIFO size of the CS4931X/CS49330 is 0x1000 words (2 bytes/word). The FIFO level can be calculated as follows: if PUT-GET >= 0 then { INPUT FIFO LEVEL = (PUT - GET) } else { INPUT FIFO LEVEL = [ (PUT-GET) +
60
AN162REV2
AN162
7. AC-3 SPECIFIC MODULE
Note: This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1, "Indexed Module Communication Protocol" for more information about the Indexed Module Communication Protocol.
The following module is specific to AC-3 code. It is applicable only to code releases starting with the prefixes AC3P (PES code) and AC3E (ES code).
7.1 AC-3 Manager
Write Opcode = 0x8A; Read Opcode = 0x0B; Read Response Opcode = 0x8B Write = 0x8A00HH 0xhhhhhh Read Request = 0x0B00HH; Read Response = 0x8B00HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x00
Variable
AC3_CONTROL
Dataword Content
Bit 11:8 = Pre_Fill_Level = 0..15 = Indicates the number of 512-byte data chunks to pre-fill before initiating decode. Bit 4 = LFE_Enable 0/1 - Disable/Enable LFE channel decoding (if it exists in the stream). Bit 3 = AC3_Sync_Status 0 - AC-3 frame-sync lost READ-ONLY 1 - AC-3 frame-sync established Bit 0 = AC3_Enable 0/1 - Disable/Enable AC-3 decoding. Default = 0x000000 Table 26. AC-3 Manager
AN162REV2
61
AN162
Index
0x01
Variable
Dataword Content
OUTPUT_MODE_CONTROL Bit 8 = Reserved. Always write 0. Bits 5:4 = Dualmode = 0...3 = -u setting of Dolby C decoder. Valid only if acmod=0 (dual mono). 00b = Stereo. 01b = Left Mono. 10b = Right Mono. 11b = Mixed-Mono. Bits 3:0 = Output_Mode = 0...7 = -o setting of Dolby C decoder. 0x0 = 2/0 Lt, Rt Dolby Surround compatible. (Equation in Section 7.1.3 "Down mix Equation for Lt, Rt (Pro Logic Encoded) Output" on page 65). 0x1 = 1/0 C. 0x2 = 2/0 L, R. 0x3 = 3/0 L, C, R. 0x4 = 2/1 L, R, S (Ls = Rs = S - 3dB). 0x5 = 3/1 L, C, R, S (Ls = Rs = S - 3dB). 0x6 = 2/2 L, R, Ls, Rs. 0x7 = 3/2 L, C, R, Ls, Rs. Default* = 0x000007 Note: Undesired Channel outputs must be explicitly muted by setting the corresponding Ch_Vol to 0.0 (see Section 5.1 "Audio Manager for Dolby Digital, AAC, MPEG and MP3" on page 41).
0x02
COMPRESSION_CONTROL Bits 1:0 = 0...3 = -k setting of Dolby C decoder. 00b = Custom Mode 0 (Analog Dialnorm). 01b = Custom Mode 1 (Digital Dialnorm). 10b = Line Out Mode (This mode is REQUIRED for all AVR systems). 11b = RF Remodulation Mode. Default* = 1
0x03
CUT_X
0x000000-0x7FFFFF = Compression cut scale factor = -x setting of Dolby C decoder. Cut_x is a scaling factor used on the absolute compression limits. The absolute compression limits are set during the encoding process. Default* = 0 0x000000-0x7FFFFF = Compression boost scale factor = -y setting of Dolby C decoder. Boost_y is a scaling factor used on the absolute compression limits. The absolute compression limits are set during the encoding process. Default* = 0 Table 26. AC-3 Manager (Continued)
0x04
BOOST_Y
62
AN162REV2
AN162
Index
0x05 FSCOD
Variable
00b = 48 kHz. 01b = 44.1 kHz. 10b = 32 kHz. 11b = Reserved. READ-ONLY
Dataword Content
Bits 1:0 = Current Sample Rate Code (fscod) value.
0x06
BSMOD
Bits 3:0 = Current Bit Stream (bsmod) value. 0x0 = main audio service: complete main (CM). 0x1 = main audio service: music and effects (ME). 0x2 = associated service: visually impaired (VI). 0x3 = associated service: hearing impaired (HI). 0x4 = associated service: dialogue (D). 0x5 = associated service: commentary (C). 0x6 = associated service: emergency (E). 0x7: if ACMOD == 1: associated service: voice over (VO). if ACMOD == 010b to 111b: main audio service: karaoke. READ-ONLY
0x07
ACMOD
Bits 3:0 = Current Audio Coding Mode (acmod) value 0x0 = 1+1 Ch1, Ch2. 0x1 = 1/0 C. 0x2 = 2/0 L, R. 0x3 = 3/0 L, C, R. 0x4 = 2/1 L, R, S. 0x5 = 3/1 L, C, R, S. 0x6 = 2/2 L, R, Ls, Rs. 0x7 = 3/2 L, C, R, Ls, Rs. READ-ONLY
0x08
DSURMOD
Bits 1:0 = Current Dolby Surround Mode (dsurmod value) valid only when (acmod=2). 00b = not indicated. 01b = NOT Dolby Surround encoded. 10b = Dolby Surround Encoded. 11b = Reserved. READ-ONLY
0x09
CLEV
0x000000-0x7FFFFF = Current center mixing level (interpreted stream value as 1.23 fractional integer). Valid only if 3 front channels exist. READ-ONLY 0x000000-0x7FFFFF = Current surround mixing level (interpreted stream value as 1.23 fractional integer). Valid only if a surround channel exists. READ-ONLY Table 26. AC-3 Manager (Continued)
0x0a
SLEV
AN162REV2
63
AN162
Index
0x0b LFEON
Variable
Dataword Content
Bit 0 = Current lfeon value. 0 - LFE channel is off. 1 - LFE channel is on. READ-ONLY
0x0c 0x0d 0x0e
DIALNORM COMPR DIALNORM2
0...31 = Current dialnorm value. READ-ONLY 0xFFFFFF = Nonexistent in stream. 0x00-0xFF = Current compr value. READ-ONLY 0...31 = Current dialnorm2 value. Valid only in 1+1 dual mono mode (acmod=0). READ-ONLY 0xFFFFFF = Nonexistent in stream. 0x00-0xFF = Current compr2 value. Valid only in 1+1 dual mono mode (acmod=0). READ-ONLY 0...31 = Current bsid value. READ-ONLY 0xFFFFFF = Nonexistent in stream. 0...255 = Current langcod value. READ-ONLY 0xFFFFFF = Nonexistent in stream. 0x00...0x7F: Bits 6:2: current mixlevel. Bits 1:0: current roomtyp. READ-ONLY 0xFFFFFF = Nonexistent in stream. 0...255 = Current langcod value. Valid only in 1+1 dual mono mode (acmod=0). READ-ONLY 0xFFFFFF = Nonexistent in stream. 0x00...0x7F: Bits 6:2: current mixlevel2. Bits 1:0: current roomtyp2. Valid only in 1+1 dual mono mode (acmod=0). READ-ONLY 0/1 - Current copyrightb value. READ-ONLY 0/1 - Current origbs value. READ-ONLY Current frame size code. READ-ONLY Table 26. AC-3 Manager (Continued)
0x0f
COMPR2
0x10 0x11 0x12
BSID LANGCOD MIXLEVEL_ROOMTYP
0x13
LANGCOD2
0x14
MIXLEVEL2_ROOMTYP2
0x15 0x16 0x17
COPYRIGHTB ORIGBS FRMSIZCOD
Notes: See definition on page 40. "Default" vs. "Default*"See definition page 40.
64
AN162REV2
AN162
7.1.1 AC3_CONTROL (Index 0x00)
Bits 11:8: PRE-FILL LEVEL The input FIFO will pre-fill the number of 512-byte chunks indicated by bits 11:8 before initiating decode. There are two caveats for the PES code. First, these bits must be set to 0 when AV SYNC has been enabled when using the PES code. Second, after every channel change, audio decoding by the DSP will not commence until the input FIFO pre-fill threshold level has been met. The ES code only performs pre-fill immediately after the kickstart message has been issued or upon detection of errors (CRCs) in the stream. Bits 3:0: OUTPUT_MODE = 0...7 = -o setting of Dolby C decoder 0x0 = 2/0 L, R Dolby Surround compatible (a.k.a. Lt,Rt). 0x1 = 1/0 C. 0x2 = 2/0 L, R. 0x3 = 3/0 L, C, R. 0x4 = 2/1 L, R, S (Ls = Rs = S - 3 dB). 0x5 = 3/1 L, C, R, S (Ls = Rs = S - 3 dB). 0x6 = 2/2 L, R, Ls, Rs. 0x7 = 3/2 L, C, R, Ls, Rs.
7.1.3 Down mix Equation for Lt, Rt (Pro Logic Encoded) Output
Lt = (((1/3.1)L) + ((0.7/3.1)C) - ((0.7/3.1)Ls) ((0.7/3.1)Rs) Rt = (((1/3.1)L) + ((0.7/3.1)C) + ((0.7/3.1)Ls) + ((0.7/3.1)Rs)
7.1.2 OUTPUT_MODE_CONTROL (Index 0x01)
Sets up particular output speaker down mix configuration. When configuring the Output _Mode_Control, first the individual volumes of each undesired channel should be set to 0. Next, the desired output mode should be specified. This should typically be done before kickstart of the application. For example, if output mode 3/0 (L, C, R) is chosen, Ls and Rs volume must be explicitly set to 0 in the Audio Manager module to guarantee no output on those channels. Bits 5:4 DUALMODE = 0...3 = -u setting of Dolby C decoder. Valid only if ACMOD = 0 (dual mono). 00b = Stereo. 01b = Left Mono. 10b = Right Mono. 11b = Mixed-Mono.
7.1.4 AC-3 Stream Information
The table above lists a complete set of READ-ONLY variables that are reported to the host by the AC-3 Decoder module. These can be read out using the appropriate Read Request, Read Response sessions. For example, to read the ACMOD value, host should issue the 3-byte Read Request 0x0b0007 and then read the 6-byte Read Response 0x9b0007, 0x00000h, where the dataword (latter 3 bytes) indicates the reported value of ACMOD. Please refer to the Dolby AC-3 Specification for more information on these stream variables.
AN162REV2
65
AN162
8. AAC SPECIFIC MODULE
Note: This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol. The following module is specific to AACE, AACP, AASE and AASP codes. The AAC application codes only supports the following type of AAC data: AAC, Low Complexity, ADTS Format. The AACE code is capable of decoding a 5.1 channel, AAC, Low Complexity, ADTS format data in from an Elementary Stream with up to 5.1 decoded discrete channels on AUDAT0-2 while simultaneously outputting an Lt, Rt down mix in IEC60958 or I2S format on the AUDAT3/XMT958 pin. The AACP code is identical to the AACE code, except that it decodes Packetized Elementary Streams and adds AV Sync capabilities. The AASE code is capable of decoding a 5.1 channel, AAC, Low Complexity, ADTS format data in from an Elementary Stream, and then performing an Lt, Rt down mix of the decoded channels, providing up to 2 discrete channels on AUDAT0 while simultaneously outputting either: an Lt, Rt down mix in IEC60958 or I2S format on the AUDAT3/XMT958 pin or the original 5.1 channel AAC stream in an IEC61937 format on the AUDAT3/XMT958 pin. The AASP code is identical to the AASE code, except that is decodes Packetized Elementary Streams and adds AV Sync capabilities.
66
AN162REV2
AN162
8.1 AAC Manager
Write Opcode = 0x9E; Read Opcode = 0x1F; Read Response Opcode = 0x9F Write = 0x9E00HH 0xhhhhhh Read Request = 0x1F00HH; Read Response = 0x9F00HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x00
Variable
AAC_CONTROL
Dataword Content
Bits 15:14 = Downmix_Equation (Applicable for ASSE/AASP application codes only) Output mode - 0 (Lt/Rt Mode) 00b = {Lt = 1.0/3.1(L) + 0.7/3.1(C) - 0.7/3.1(Ls+Rs), Rt = 1.0/3.1(R) + 0.7/3.1(C) + 0.7/3.1(Ls+Rs)} 01b = {Lt = 1.0/3.1(L) + 1.0/1.414(C) - 0.7/3.1(Ls+Rs), Rt = 1.0/3.1(R) + 1.0/1.414(C) + 0.7/3.1(Ls+Rs)} 10b*** = {Lt = 1.0/1.414(L) + 0.7/1.414(C) 0.7/1.414(Ls+Rs), Rt = 1.0/1.414(R) + 0.7/1.414(C) + 0.7/1.414(Ls+Rs)} 11b = {Lt = 1.0/3.1(L) + 0.7/1.414(C) - 0.7/3.1(Ls+Rs), Rt = 1.0/3.1(R) + 0.7/1.414(C) + 0.7/3.1(Ls+Rs)} Output Mode - 2 (Lo/Ro mode) 00b = {Lo = 1.0/2.4(L) + 0.7/2.4(C) + 0.7/2.4(Ls), Ro = 1.0/2.4(R) + 0.7/2.4(C) + 0.7/2.4(Rs)} 01b = {Lo = 1.0/2.4(L) + 1.0/1.414(C) + 0.7/2.4(Ls), Ro = 1.0/2.4(R) + 1.0/1.414(C) + 0.7/2.4(Rs)} 10b *** = {Lo = 1.0/1.414(L) + 0.7/1.414(C) + 0.7/1.414(Ls), Ro = 1.0/1.414(R) + 0.7/1.414(C) + 0.7/1.414(Rs)} 11b = {Lo = 1.0/2.4(L) + 0.7/1.414(C) + 0.7/2.4(Ls), Ro = 1.0/2.4(R) + 0.7/1.414(C) + 0.7/2.4(Rs)} Note: *** If AAC_Manager Bits 15:14 mode 10b is selected, then the normalization factor 1/1.414 is applicable to downmix equations of all the input modes. Note: Since in these modified downmix equations, true normalization coefficients are not used there is a possibility of distortion in the mix resulting from saturation. Users are requested, therefore, to make careful selection when choosing from the modes listed above. Table 27. AAC Manager
AN162REV2
67
AN162
Index
0x00
Variable
AAC_CONTROL (Continued)
Dataword Content
Bits 13:10 = Input_Prefill Input prefill = (Number indicated by these 4 bits * 256 words) Bit 9:8 = Dualmono_Mode 00b = Lout = Lin, Rout = Rin; No dualmono mixing 01b = Lout = Lin, Rout = Lin: Left mono 10b = Lout = Rout = Rin; Right mono 11b = Lout = Rout = (Lin + Rin)/2; Dualmono mixing Bits 7:4 = Output_Mode = 0...7 [AACE, AACP] 0 = 2/0 Lt, Rt Surround Encoded. (Equation in Section 8.1.2 "Down mix Equation for Lt, Rt (ProLogic Encoded) Output" on page 71). 1 = 1/0 C 2 = 2/0 Lo, Ro 3 = 3/0 L, C, R. 4 = 2/1 L, R, S (Ls = Rs = S - 3dB) 5 = 3/1 L, C, R, S (Ls = Rs = S - 3dB) 6 = 2/2 L, R, Ls, Rs 7 = 3/2 L, C, R, Ls, Rs Bit 3 = AAC_Sync_Status 0 - AAC frame-sync lost READ-ONLY 1 - AAC frame-sync established Bit 0 = AAC_Enable = 0/1 = Disable/Enable AAC decoding. Default* = 0x000070 [AACE, AACP] Default* = 0x000000 [AASE, AASP]
0x01
PROFILE
0x0...0x3 = profile used. See ISO/IEC 13818-7, subsection 2.1. Note: Only Low Complexity (LC) profile == 0x1 is supported by this application code. READ-ONLY
0x02
FS_INDEX
0x0...0xF: Index to AAC sampling frequency table. Only the following frequencies are supported: 0x3 = 48 kHz 0x4 = 44.1 kHz 0x5 = 32 kHz READ-ONLY 0 - The num_?_channel elements variables (see 0x04 - 0x08) are not valid 1 - The num_?_channel_elements variables (see 0x04 - 0x08) are valid READ-ONLY Table 27. AAC Manager (Continued)
0x03
PCE_PRESENT
68
AN162REV2
AN162
Index
0x04
Variable
Dataword Content
NUM_FRONT_CHANNEL_ELEMENTS Number of audio syntactic elements in the front channels, front center to back center, symmetrically by left and right, or alternating by left and right in the case of single channel elements. READ-ONLY NUM_FRONT_CHANNELS Number of front channels. This field is valid only when channel_configuration is zero. READ-ONLY Number of side and front channel elements, for back channels. READ-ONLY Number of back channels. This field is valid only when channel_configuration is zero. READ-ONLY Number of LFE channel elements associated with the program. READ-ONLY Bit 0 = Home bit from the stream. READ-ONLY Bit 0: Original/Copy bit from the input stream. READ-ONLY Bit 0 = When 1, Index 0x0c to 0x0e carries the last received copyright identification field. READ-ONLY Bits 0:23 = Map to the first 24 bits of the 72-bit copyright identification field. Bit 23 is the first bit of the field. READ-ONLY Bits 0:23 = Map to the second 24 bits of the 72-bit copyright identification field. Bit 23 is the 25th bit of the field, while Bit 0 is the 48th bit of the field. READ-ONLY Bits 0:23 = Map to the second 24 bits of the 72-bit copyright identification field. Bit 0 is the 72nd bit of the field. READ-ONLY 13 bit field = length of the frame in bytes, including headers and error_check. READ-ONLY Number of raw_data_blocks in the ADTS frame. READ-ONLY
0x05
0x06 0x07
NUM_BACK_CHANNEL_ELEMENTS NUM_BACK_CHANNELS
0x08 0x09 0x0a 0x0b
NUM_LFE_CHANNEL_ELEMENTS HOME ORIGINAL_COPY COPYRIGHT_ID_PRESENT
0x0c
COPYRIGHT_ID_WORD_1
0x0d
COPYRIGHT_ID_WORD_2
0x0e
COPYRIGHT_ID_WORD_3
0x0f
FRAME_LENGTH
0x10
NUMBER_OF_RAW_DATA_BLOCKS_ IN_FRAME
Table 27. AAC Manager (Continued)
AN162REV2
69
AN162
Index
0x11
Variable
CHANNEL_CONFIGURATION
Dataword Content
0x0...0x7 = channel configuration used. If channel_configuration is greater than 0, the channel configuration is given by the default bit stream index number in Table 28 on page 72, Implicit Speaker Mapping. If channel_configuration equals 0, the channel configuration is not specified in the header and must be given by a program_config_element following as first bit stream element in the first raw_data_block after the header, or by the implicit configuration (see subsection 3.5) or must be known in the application. Note: Changes in this stream variable will result in an Unsolicited Message from the DSP if Audio_Config_Change_Notification has been enabled in the Audio Manager. Please refer to Section 5.2.1 "PES_CONTROL_AND_AV_SYNC_ STATUS (Index 0x00)" on page 45 for more information. READ-ONLY
0x12
PROTECTION_ABSENT
0 - stream is CRC protected, 1 - stream is not CRC protected. READ-ONLY Table 27. AAC Manager (Continued)
Notes: "Default" vs. "Default*"See definition page 40.
70
AN162REV2
AN162
8.1.1 AAC_CONTROL (Index 0x00)
Bits 7:4: Output_Mode These bits set up the output speaker down mix configuration. When configuring the OUTPUT _MODE, first the individual volumes of each undesired channel should be set to 0. Next, the desired output mode should be specified. This should be done before kickstart of the application. For example, if output mode 3/0 (L, C, R) is chosen, Ls and Rs volume must explicitly be set to 0 in the Audio Manager module to guarantee no output on those channels. 0 = 2/0 Lt, Rt Surround Encoded. 1 = 1/0 C. 2 = 2/0 L, R. 3 = 3/0 L, C, R. 4 = 2/1 L, R, S (Ls = Rs = S - 3dB). 5 = 3/1 L, C, R, S (Ls = Rs = S - 3dB). 6 = 2/2 L, R, Ls, Rs. 7 = 3/2 L, C, R, Ls, Rs.
8.1.2 Down mix Equation for Lt, Rt (ProLogic Encoded) Output
Lt = (((1/3.1)L) + ((0.7/3.1)C) - ((0.7/3.1)Ls) ((0.7/3.1)Rs) Rt = (((1/3.1)L) + ((0.7/3.1)C) + ((0.7/3.1)Ls) + ((0.7/3.1)Rs)
8.1.3 AAC Stream Information
The table above lists a complete set of READ-ONLY variables that are reported to the host by the AAC Decoder module. These can be read out using the appropriate Read Request, Read Response sessions. For example, to read the PROFILE value, host should issue the 3-byte Read Request 0x1f0001 and then read the 6-byte Read Response 0x9f0001, 0x00001h, where the dataword (latter 3 bytes) indicates the reported value of PROFILE. Please refer to the MPEG-2 AAC Specification (ISO/IEC 13818-7) for more information on these stream variables.
AN162REV2
71
AN162
8.1.4 Implicit Speaker Mapping
Default Bit Stream Index Number 0 Number of Speakers See Note. Audio Syntactic Elements, Listed in Order Received See Note. Default Element to Speaker Mapping Note: If channel configuration is equal to zero, the speaker mapping is given by the PCE. center front speaker left, right front speakers center front speaker left, right front speakers center front speaker left, right front speakers rear surround center front speaker left, right front speakers left surround, right surround rear speakers center front speaker left, right front speakers left surround, right surround rear speakers front low frequency effects speaker center front speaker left, right center front speakers left, right outside front speakers left surround, right surround rear speakers front low frequency effects speaker
1 2 3 4
1 2 3 4
single_channel_element channel_pair_element single_channel_element, channel_pair_element single_channel_element, channel_pair_element, single_channel_element single_channel_element, channel_pair_element, channel_pair_element single_channel_element, channel_pair_element, channel_pair_element, lfe_element single_channel_element, channel_pair_element, channel_pair_element, channel_pair_element, lfe_element
5
5
6
5+1
7 (Note a)
7+1
Table 28. Implicit Speaker Mapping Note: a. This bit stream is not supported by the CS4931X/CS49330 or any of the ACC application codes.
72
AN162REV2
AN162
9. MPEG SPECIFIC MODULE
Note: This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol. The following module is specific to the MPEG codes (MPSE and MPSP). These application codes support the following types of MPEG data: MPEG-1, Layers 1 and 2; and MPEG-2, Layer 2. Please refer to MP3 application code for support of MPEG-1, Audio Layer 3. Note: The MPEG application code does NOT support the following types of MPEG data: MPEG-1, Audio Layer 3; or MPEG-2, Audio Layers 1, 2 or 3, with Low Sampling Frequency.
9.1 MPEG Stereo Manager
Write Opcode = 0x8C; Read Opcode = 0x0D; Read Response Opcode = 0x8D Write Message = 0x8C00HH 0xhhhhhh Read Request Message = 0x0D00HH; Read Response Message = 0x8D00HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x00
Variable
MPEG_CONTROL
Dataword Content
Bit 10 = Deemphasis_Enable = Enables 50/15 uS Digital Deemphasis 0 - 50/15 uS Digital Deemphasis Disabled 1 - 50/15uS Digital Deemphasis Enabled Note: Automatically enabled if encoded bit stream has valid emphasis bit set. Bits 9:8 Dual-Mono_Mode = 00b - No Dual-Mono Mixing (i.e. Lout = Lin; Rout = Rin). 01b - Lout = Lin; Rout = Lin. 10b - Lout = Rin; Rout = Rin. 11b - Lout = (Lin + Rin) - 3dB; Rout = (Lin + Rin) - 3dB. Bit 3 = MPEG_Sync_Status = READ-ONLY 0 - MPEG frame-sync lost 1 - MPEG frame-sync established Bit 0 = MPEG_Enable = 0/1 = Disable/Enable MPEG decoding. Default = 0x000070 Note: Undesired Channel outputs should be explicitly muted by setting the corresponding Ch_Vol to 0.0 (see Section 5.1 "Audio Manager for Dolby Digital, AAC, MPEG and MP3" on page 41).
0x01
ID
0 - Extension to lower frequencies, 1 - ISO/IEC 11172-3 or ISO/IEC 13818-3. READ-ONLY 2 bits to indicate which layer is used. READ-ONLY Table 29. MPEG Manager
0x02
LAYER
AN162REV2
73
AN162
Index
0x03 0x04 0x05
Variable
PROTECTION_BIT BITRATE_INDEX SAMPLING_FREQUENCY READ-ONLY
Dataword Content
0 - stream is CRC protected, 1 - not CRC protected. 4-bit index to a bit rate table. READ-ONLY 0x0...0x2: 2 bit index to MPEG sampling frequency table. Only the following frequencies are supported: 0x0 = 44.1 kHz 0x1 = 48 kHz 0x2 = 32 kHz READ-ONLY 0 - no padding, 1 - padding exists. READ-ONLY reserved for non-ISO purposes. READ-ONLY 2 bits to indicate the audio configuration mode (for 2 channels only) 00 - stereo 01 - joint stereo (intensity stereo and/or ms_stereo) 10 - dual channel 11 - single channel READ-ONLY
0x06 0x07 0x08
PADDING_BIT PRIVATE_BIT MODE
0x09 0x0a 0x0b 0x0c
MODE_EXTENSION COPYRIGHT ORIGHOME EMPHASIS
2 bits to indicate which sub-bands are in intensity stereo. READ-ONLY 0 - no copyright, 1 - copyright protected bit stream. READ-ONLY 0 - bit stream is a copy, 1 - bit stream is an original. READ-ONLY 2 bits to indicate which type of de-emphasis is used. READ-ONLY Table 29. MPEG Manager (Continued)
74
AN162REV2
AN162
9.1.1 MPEG_CONTROL (Index 0x00)
Bits 7:4: OUTPUT_MODE These bits set up the output speaker down mix configuration. When configuring the OUTPUT _MODE, first the individual volumes of each undesired channel should be set to 0. Next, the desired output mode should be specified. This should be done before kickstart of the application. For example, if output mode 3/0 (L, C, R) is chosen, Ls and Rs volume must explicitly be set to 0 in the Audio Manager module to guarantee no output on those channels. 0 = 2/0 Lt, Rt Surround Encoded. 1 = 1/0 C. 2 = 2/0 L, R. 3 = 3/0 L, C, R. 4 = 2/1 L, R, S (Ls = Rs = S - 3dB). 5 = 3/1 L, C, R, S (Ls = Rs = S - 3dB). 6 = 2/2 L, R, Ls, Rs. 7 = 3/2 L, C, R, Ls, Rs.
9.1.2 MPEG Stream Information
Table 29 on page 73 sets out a complete set of READ-ONLY variables that are reported to the host by the MPEG Decoder module. These can be read out using the appropriate Read Request and Read Response sessions. For example, to read the MODE value, the host should issue the 3-byte Read Request 0x0D0008 and then read the 6-byte Read Response 0x8D0008, 0x00000h, where the dataword (latter 3 bytes) indicates the reported value of MODE. Please refer to the MPEG Specification (ISO/IEC 11172-3 and ISO/IEC 13818-3) for more information on these stream variables.
AN162REV2
75
AN162
10. MP3E SPECIFIC MODULE
Note: This is an indexed module. Indexed Module Communication Protocol must be used. Please refer to Section 3.1 "Indexed Module Communication Protocol" on page 24 for more information about the Indexed Module Communication Protocol. The module described in Section 10.1 is specific to MP3E code. MP3E application code only supports the following type of MPEG data in Elementary format: MPEG-1, Layer 3. The latest MP3E code will support all MPEG data, including the following formats:
-- Layer 3 CBR and VBR streams (but NO bit streams with the bit_index = '0000' = free) -- MPEG2, Layer 3 CBR and VBR streams (but NO bit streams with the bit_index = '0000' = free).
These codes will also support the half-sampling frequencies outlined in the MPEG2, Layer 3 specification.
10.1 MP3E Manager
Write Opcode = 0x8C; Read Opcode = 0x0D; Read Response Opcode = 0x8D Write Message = 0x8C00HH 0xhhhhhh Read Request Message = 0x0D00HH; Read Response Message = 0x8D00HH 0xhhhhhh 0xHH = index, 0xhhhhhh = data value
Index
0x00
Variable
MP3E_CONTROL 0 = Reserved. 1 = 1/0 C. 2 = 2/0 L, R. 3 = 2/0 L, R. 4 = 2/0 L, R. 5 = 2/0 L, R. 6 = 2/0 L, R. 7 = 2/0 L, R.
Dataword Content
Bits 7:4 = Output_Mode = 0...7
Note: Undesired Channel outputs should be explicitly muted by setting the corresponding Ch_Vol (see Section 5.1 "Audio Manager for Dolby Digital, AAC, MPEG and MP3" on page 41). It should also be noted that unlike the other application code managers in AN162, the MP3 Manager does not have a "Decode Enable Bit". This is intentional. Default* = 000070 0x01 ID 0 - Extension to lower frequencies, 1 - ISO/IEC 11172-3 or ISO/IEC 13818-3 READ-ONLY 0x02 LAYER 2 bits to indicate which layer is used READ-ONLY Table 30. MP3E Manager
76
AN162REV2
AN162
Index
0x03
Variable
PROTECTION_BIT 1 - not CRC protected READ-ONLY
Dataword Content
0 - stream is CRC protected
0x04 0x05
BITRATE_INDEX SAMPLING_FREQUENCY
4-bit index to a bit rate table READ-ONLY 0x0...0x2: 2 bit index to MPEG sampling frequency table. Only the following frequencies are supported: 0x0 = 44.1 kHz 0x1 = 48 kHz 0x2 = 32 kHz READ-ONLY 0 - no padding 1 - padding exists READ-ONLY
0x06
PADDING_BIT
0x07 0x08
PRIVATE_BIT MODE
reserved for non-ISO purposes READ-ONLY 2 bits to indicate the audio configuration mode (for 2 channels only) 00 - stereo 01 - joint stereo (intensity stereo and/or ms_stereo) 10 - dual channel 11 - single channel READ-ONLY
0x09 0x0a
MODE_EXTENSION COPYRIGHT
2 bits to indicate which sub-bands are in intensity stereo READ-ONLY 0 - no copyright 1 - copyright protected bit stream READ-ONLY
0x0b
ORIGHOME
0 - bit stream is a copy 1 - bit stream is an original READ-ONLY
0x0c
EMPHASIS
2 bits to indicate which type of de-emphasis is used READ-ONLY Table 30. MP3E Manager (Continued)
Notes: "Default" vs. "Default*"See definition page 40.
AN162REV2
77
AN162
10.1.1 MP3E_CONTROL (Index 0x00)
Bits 7:4: OUTPUT MODE These bits set up the output speaker down mix configuration. When configuring the Output_Mode, first the individual volumes of each undesired channel should be set to 0. Next, the desired output mode should be specified. This should be done before kickstart of the application. For example, if output mode 1/0 C is chosen, R, L volume must explicitly be set to 0 in the Audio Manager module to guarantee no output on those channels. MPEG Stream Information: The above table lists out a complete set of READ-ONLY variables that are reported to the host by the MP3 Decoder module. These can be read out using the appropriate Read Request, and Read Response sessions. For example, to read the MODE value, host should issue the 3-byte Read Request 0x0D0008 and then read the 6-byte Read Response 0x8D0008, 0x00000h, where the dataword (latter 3 bytes) indicates the reported value of MODE. Please refer to the MPEG Specification ISO/IEC 11172-3 and for more information on these stream variables.
78
AN162REV2
AN162
11. APPLICATION CONFIGURATION EXAMPLES
This section covers various application modes available with the CS4931X/CS49330. Although many application modes are possible, only the most common modes have been presented here as examples. This should not be considered the complete list of modes in which the part will operate, as the system designer can configure the application parameters of the CS4931X/CS49330 as desired in order to differentiate the system. The tables in each section below provide the message to be sent and a description of what the message is doing. Care should be taken to guarantee that the correct value is sent directly after the associated opcode and index word. The command to kickstart the application should always be sent last.
11.1 AC-3 Decode with Unsolicited PES ID Reporting
In this mode the input should be PES encoded AC-3. The data will be taken from the compressed data input port as designated by the hardware configuration message. If the input on this port is not PES encoded AC-3 then no audio will be produced, and the DSP will not achieve AV lock. The AV lock status bit can be found in the PES Manager (Section 5.2 "PES Manager" on page 45). Figure 7 on page 80 gives an example of pseudocode to configure the part to perform AC-3 decode with unsolicited PES ID Reporting enabled. This pseudocode can be used as a template for other configurations by swapping out the message array and the size.
11.2 MPEG Decode
In this mode the input should be two-channel MPEG data. The data will be taken from the compressed input port as designated by the hardware configuration message.
Module AC-3 Audio Manager
Index AC-3 Control
Description
AC-3 Enabled LFE Enabled Audio Manager Control Unsolicited PES ID Reporting Enabled 0x880000 PLL Enabled Kickstart Application Table 31. AC-3 Decode with Unsolicited PES ID Reporting
Opcode and Value Index 0x8A0000 0x000011 0x001011
AN162REV2
79
AN162
void AC3_UPR_Config() unsigned char hardware_config_message[] = /* INPUT A3 -- see AN115 */ {0x80, 0x02, 0x10, /* bursty delivery on CDI */ 0x00, 0x3f, 0xc0, 0x80, 0x01, 0x10, 0x0E, 0x00, 0x2c, /* OUTPUT A2 -- master MCLK */ /* master LRCLK, master SCLK */ 0x80, 0x02, 0x7f, 0xbf, 0xdf, 0xff};
unsigned char AC3_UPR_config_message[] = /* Enable AC-3 decode */ {0x8A, 0x00, 0x00, 0x00, 0x00, 0x11, /* Assume CLKIN = 27 MHz, so use default PLL_Register1_* and PLL_Register2_* values */ /* Kickstart with PLL and */ 0x88, 0x00, 0x00, /* Unsolicited PES ID report */ 0x00, 0x10, 0x11}; Write_*(hardware_config_message,12); /* Replace * with I2C or SPI depending on protocol */ } Write_*(AC3_UPR_config_message,12); /* Replace * with I2C or SPI depending on protocol */ }
Figure 7. Example of Pseudocode Used to Configure the CS4931X/CS49330 for AC-3 Decode with Unsolicited PES ID Reporting Enabled
Module MPEG Manager Audio Manager
Index MPEG Control Audio Manager Control
Description MPEG Enabled 2/0 L,R output PLL Enabled Kickstart Application
Opcode and Value Index 0x8c0000 0x000021 0x880000 0x000011
Table 32. MPEG Decode
80
AN162REV2
* Notes *


▲Up To Search▲   

 
Price & Availability of AN162-2

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X