0% found this document useful (0 votes)
8 views67 pages

EMMA2 Audio API User Manual

The EMMA2 API User's Manual provides detailed information on the audio driver API, including initialization, configuration, and function prototypes for audio operations. It outlines the data structures, limitations, and differences between EMMA1 and EMMA2, as well as the supported and unsupported functionalities. Additionally, it includes result codes for various audio operations and specifies the necessary hardware configurations for optimal performance.

Uploaded by

gwoodstccd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views67 pages

EMMA2 Audio API User Manual

The EMMA2 API User's Manual provides detailed information on the audio driver API, including initialization, configuration, and function prototypes for audio operations. It outlines the data structures, limitations, and differences between EMMA1 and EMMA2, as well as the supported and unsupported functionalities. Additionally, it includes result codes for various audio operations and specifies the necessary hardware configurations for optimal performance.

Uploaded by

gwoodstccd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

User’s Manual

EMMA2 API

Audio

Contents

1 Introduction ....................................................................................................................... 3
1.1 A Data structure of AUDIO API............................................................................. 6
1.1.1 MMAC_AUDIO_CONFIGURATION ................................................................6
1.1.2 MMAC_AUDIO_TONEINFO ............................................................................9
1.1.3 MMAC_AUDIO_VOLUMEINFO.....................................................................10
1.1.4 MMAC_AUDIO_OUTPUT_SELECTOR ........................................................10
1.1.5 MMAC_AUDIO_INPUT_SELECTOR ............................................................12
1.1.6 MMAC_AUDIO_DECODE_MODE ................................................................13
1.1.7 MMAC_AUDIO_THROUGH_MODE .............................................................13
1.1.8 MMAC_AUDIO_CALLBACK_EVENT............................................................14
1.1.9 MMAC_AUDIO_AAU_HEADER ....................................................................14
1.1.10 MMAC_AUDIO_AC3_HEADER ....................................................................17
1.1.11 MMAC_AUDIO_PES_INFO...........................................................................18
1.1.12 MMAC_AUDIO_REF_STC ............................................................................19
1.1.13 MMAC_AUDIO_SPDIF_CHANNEL_STATUS ..............................................19
1.1.14 Audio firmware configuration by "mmac/config/api.h" ...................................19
1.1.15 Audio firmware configuration by "mmac/config/api.h" ...................................20
1.1.16 Audio firmware configuration by "mmac/config/api.h" ...................................22
1.1.17 Audio hardware configuration by "mmac/config/api.h" ..................................22
1.1.18 Audio hardware configuration by "mmac/config/api.h" ..................................22
1.1.19 Audio API configuration by "mmac/config/api.h"............................................23
1.1.20 Audio API configuration by "mmac/config/api.h"............................................24
1.1.21 Audio API configuration by "mmac/config/api.h"............................................24
1.2 Example of AUDIO API Use ............................................................................... 26

Book No: S16753EE1V0UM00 Doc No: MMAC0004, Issue: 1.2


© NEC Electronics Corporation 2002 ~ 2004 Publication Date: 2004-02-11
The information is this document is subject to change without notice – it is
the reader’s responsibility to check that this is the latest available version.

This document includes company confidential information. It should only be


released to third parties under a Non-Disclosure Agreemant.
2 Function Prototypes ........................................................................................................ 28
MMAC_AUDIO_Initialise.............................................................................................28
MMAC_AUDIO_SetConfiguration...............................................................................29
MMAC_AUDIO_GetConfiguration ..............................................................................31
MMAC_AUDIO_Decode .............................................................................................32
MMAC_AUDIO_Mute..................................................................................................33
MMAC_AUDIO_SetVolume ........................................................................................34
MMAC_AUDIO_TestToneEnable ...............................................................................35
MMAC_AUDIO_TestToneDisable ..............................................................................36
MMAC_AUDIO_Reset ................................................................................................37
MMAC_AUDIO_SetOutputSelector ............................................................................38
MMAC_AUDIO_GetOutputSelector............................................................................39
MMAC_AUDIO_SetInputSelector ...............................................................................40
MMAC_AUDIO_GetInputSelector ..............................................................................41
MMAC_AUDIO_Notify ................................................................................................42
MMAC_AUDIO_SelectDecoderMode.........................................................................44
MMAC_AUDIO_Pause ...............................................................................................45
MMAC_AUDIO_SetVolumeEx....................................................................................46
MMAC_AUDIO_GetAAUheaderMPEG ......................................................................47
MMAC_AUDIO_GetAAUheaderMP3..........................................................................49
MMAC_AUDIO_GetAC3StreamStatus.......................................................................51
MMAC_AUDIO_GetAAUHeaderStatus ......................................................................54
MMAC_AUDIO_GetAC3HeaderStatus.......................................................................55
MMAC_AUDIO_SetRefStc .........................................................................................56
MMAC_AUDIO_SetSPDIFChannelStatus..................................................................57
MMAC_AUDIO_GetSPDIFChannelStatus .................................................................58
3 Type Definitions .............................................................................................................. 59
4 Revision History .............................................................................................................. 66

2
1 Introduction
This section defines the API for the EMMA2 audio driver. Prior to using any of the functions of this
section, it is necessary to initialise the other parts of the API that this code depends on by calling:
MMAC_RTOS_Initialise()
MMAC_DMA_Initialise()
MMAC_DEMUX_Initialise()

The API function MMAC_AUDIO_Initialise() must be called prior to any other function in the audio
driver. Normally the subsystem should then be configured to MMAC_AUDIO_SYNC using
MMAC_AUDIO_SetConfiguration() and the decoder started with MMAC_AUDIO_Decode().
Configuring the driver in synchronous mode means that it will maintain audio time synchronisation
between the audio PTS and the Audio Firmware handling STC counter. In addition, audio driver in the
synchronous mode is not un-muted until the audio gains synchronisation between the audio PTS and STC.
In the asynchronous mode, there is no dependency between the audio and video. The system clock is
slaved from the PCR in the stream so the synchronisation is effectively between the PCR and the
respective PTS.
The volume levels/balance should be set to the desired level using MMAC_AUDIO_SetVolume(). With
this set up the audio will be automatically un-muted once the audio and video gain synchronisation.
The MMAC_AUDIO_Reset() function is provided for completeness in the event of the audio subsystem
malfunctioning.
The test tone output is started by MMAC_AUDIO_TestToneEnable function when audio decoder is
started. The test tone output is stopped by MMAC_AUDIO_TestToneDisable function or audio decoder
is stopped.
This audio system has the following four outputs.
• Decode audio stream (MPEG/ AC3 / MP3/ etc)
• Tone generator
• PCM mix with audio decoder result (reference RAM AUDIO API).
• Through out for SPDIF output.
All of audio output is started or stopped by MMAC_AUDIO_Decode function.
This audio system does not have mute function. Therefore, this API simulates mute operation by control
attenuator.
The Audio API and RAM AUDIO API only support audio decode output and data on RAM, data input
from external PCM or external SPDIF is not supported. When the user wants to use external input to RAM,
user must control input data buffer and ListDMA API for PCM write.
The definition of MMAC_AUDIO_BITRATE_CLK is setting of the Bit ClocK (BCK) of PCM output
format.
The definition of MMAC_AUDIO_FS is setting of audio master clock that is used to select which type of
ASCLK is used for generate PCM output. In this audio system, audio master clock is only available 256 or
384.
frequency master clock
Audio Master Clock is 256 Audio Master Clock is 384
48KHz ACLK1 of 12.288MHz ACLK1 of 18.432MHz
44.1KHz ACLK0 of 11.2896MHz ACLK0 of 16.9344MHz
32KHz ACLK0 of 8.192MHz ACLK1 of 12.288MHz

3
Current functionally Limitation:
• When user execute initialised or start audio decoder, sometime generate click noise.
• AUDIO API must call in TASK of Nucleus otherwise this API is always failed by semaphore error.
• There is a hardware restriction when audio output is low sampling frequency(32KHz, 22.05KHz,
16KHz).
• That restriction is that the hardware DAC must can handle the master clock of 512(256*2) or
768.(384*2).
• Through output is currently not tested.
• May be buffer empty error generate and S/PDIF output is not correct when S/PDIF output is stream
data.
• When audio TONE output is enabled and audio decoder is stopped, then audio TONE output may
contain continuous noise. In the future, to resolve this problem, the AUDIO API specification may be
changed as follows, automatically the TONE stops when the audio decoder is stopped.
• The status of 'streamStatus' of MMAC_AUDIO_CONFIGURATION does not have correct
information when stream data does not input audio decoder.
• When user configure audio system as MMAC_AUDIO_SYNC, current audio firmware sometime
return invalid status to do synchronisation, therefore some special audio data can not do audio
synchronisation.

Hardware notation.
When Low Sampling Frequency is used, the audio master clock is multiply by 2. For example, when user
specify the audio master clock as 256, then audio hardware generated audio master clock is 512(256*2).
And when user specify the audio master clock as 384, then audio hardware generated audio master clock is
768(384*2).
Therefore when user want to use Low Sampling Frequency(24K,22.05K,16K), user must select the DAC
ability which can accept MCLK clock 256, 384, 512, 768. Otherwise, audio is not work correctly.

Not Supported function AUDIO API.


This API does not support ASCLK1 as External Input clock. (When use external audio clock, EMMA2
audio system may be not realise sampling frequency of 48KHz.)

Result Codes
The meanings of the various result codes returned by the driver are described in the following table:
Result Code Description
MMAC_AUDIO_OK An AUDIO operation has successfully completed.
MMAC_AUDIO_FAIL An AUDIO operation has not completed.
MMAC_AUDIO_NOT_SUPPORTED An AUDIO operation has not completed according
to specification.
MMAC_AUDIO_NOSEMAPHORE_AVAILABLE An AUDIO operation has not completed by acquire
semaphore for access Audio Firmware fail.
MMAC_AUDIO_ALREADY_INTIALISED The AUDIO driver has already been initialised.
MMAC_AUDIO_NOT_INITIALISED The AUDIO driver has not been initialised.
MMAC_AUDIO_NOT_CONFIGURED The AUDIO driver has not been configured.
MMAC_AUDIO_ALREADY_STARTED The AUDIO driver has already started decoding.
MMAC_AUDIO_ALREADY_STOPPED The AUDIO driver has already stopped decoding.
MMAC_AUDIO_OUT_OF_RANGE The AUDIO driver’s TestToneEnable() function has
been called with an invalid frequency value.

4
Result Code Description
MMAC_AUDIO_INVALID_PARAM A parameter passed is invalid, it is out of range or a
NULL pointer has been passed.
MMAC_AUDIO_INVALID_CALLBACK The AUDIO driver's Notify() function has been
called with invalid parameter.

Differences between EMMA1 and EMMA2


1. EMMA2 has audio STC counter different from video STC.
One is the hardware counter of VIDEO (which can set STC by PCR) and the other is the software
counter of Audio Firmware (which can not be set by PCR), the AUDIO STC counter is count up every
1.4 milli-seconds.
2. MMAC_AUDIO_SetVolume() influence to audio source.
EMMA2 can control attenuator level of every audio source (TONE, PCM playback, audio decoder
output).
3. EMMA2 serial port only uses MSB first.
EMMA2 serial output port is same mean of Audio DSP serial output port. Also that DSP does not
have LSB first mode.
4. EMMA2 software decoder does not have fixed bit rate mode.
EMMA2 audio firmware does not have this feature.
5. EMMA2 software decoder does not have fixed layer mode.
EMMA2 audio firmware does not have this feature.
6. MMAC_AUDIO_SetConfiguration() setting of mono/stereo/dual mono.
EMMA2 can not specify AUDIO stream type mono/stereo because it is automatically AUDIO
firmware processed. Dual mono setting (left to both, right to both, both) works when decode stream is
dual-mono.
7. EMMA2 does not handle MPEG audio ancillary data.
EMMA2 audio firmware does not have this feature.
8. EMMA2 CPU must communicate Audio Firmware to get PTS.
EMMA2 CPU must communicate Audio Firmware to get PTS, STC. This mean that there is overhead
to get audio PTS, STC.
9. EMMA2 resets PES decoder and audio decoder at same time.
EMMA2 can not reset the PES decoder, because audio firmware does not have such functionality.
PES decoder reset is only applied when the entire audio firmware is reset.
10. EMMA2 does not have mute function.
EMMA2 does not have mute function so this audio system has to control attenuator to simulate mute
function.
11. EMMA2 can repeat frames to get audio synchronised.
EMMA2 can repeat frames instead of halting (pause) audio output to do audio synchronisation.
12. EMMA2 does not have skip if specify bit is 1.
EMMA2 audio firmware does not have this feature.
13. EMMA2 does not have pause if specify bit is 1.
EMMA2 audio firmware does not have this feature.

5
14. EMMA2 does not have automatic pause cancel function.
EMMA2 audio firmware can not get information of Nearly Full or not, so the CPU must simulate this
function.
15. EMMA2 does not swap L/R channel in hardware.
EMMA2 audio firmware does not have this feature.
16. EMMA2 can not input master clock as 512fs.
EMMA2 audio master clock is only 256fs or 384fs.
17. EMMA2 can not set sampling frequency automatically.
EMMA2 audio firmware can not change ASCLK (audio serial clock) mode so the CPU must modify
ASCLK.
18. EMMA2 can not pause audio.
If audio data input is stopped, in firmware specification, audio output is stopped. However, in reality,
the audio firmware does not stop audio output and continuously outputs previously decoded results (it
looks like noise).
This is the specification of AUDIO. The user must stop the decoder as soon as possible after audio
stream input has stopped.

1.1 A Data structure of AUDIO API

1.1.1 MMAC_AUDIO_CONFIGURATION

The MMAC_AUDIO_CONFIGURATION structure used by function call of


MMAC_AUDIO_SetConfiguration and MMAC_AUDIO_GetConfiguration.

member name description


startUpMode specify the AUDIO API should control audio synchronisation by STC master
mode.
When VIDEO API control audio synchronisation (such as audio master or
video master), user specified this setting is sometimes ignored to do
synchronisation.
MMAC_AUDIO_ASYNC
audio synchronisation is not necessary.
MMAC_AUDIO_SYNC
audio synchronisation is necessary. When audio API detect the lost
of synchronisation, this API mute the decoder output. and when
detect gain of synchronisation, this API un-mute the decoder output

6
member name description
steering specify the audio output mode of decoding dual mono stream.
MMAC_AUDIO_MONO
this is same as MMAC_AUDIO_STEREO
MMAC_AUDIO_STEREO
specify that the output of audio automatically change between
stereo and monaural.
When decoding dual mono stream, this is not mixed main and sub
output
MMAC_AUDIO_LEFT_TO_BOTH
When decoding dual mono stream, only main (only left) is output.
When not decode dual mono stream, this setting is not allowed.
MMAC_AUDIO_RIGHT_TO_BOTH
When decoding dual mono stream, only sub (only right) is output.
When not decode dual mono stream, this setting is not allowed.
MMAC_AUDIO_AUTOMATIC
Specify that AUDIO API should monitor stream status. And update
dual mono setting between 'audio output is not dual mono' and
'audio output is mixed result of main and sub'.
Note this setting is simulated by AUDIO API when audio firmware
detect PTS information.
The steering parameter update delay was about 0.2 second or
more.
streamStatus this is indicate the type of current decoding audio stream.
MMAC_AUDIO_STEREO_STREAM
This status is indicate current decoding stream is stereo.
MMAC_AUDIO_JOINT_STEREO_STREAM
This status is indicate current decoding stream is stereo (joint
stereo).
MMAC_AUDIO_DUAL_CHANNEL_STREAM
This status is indicate current decoding stream is dual mono.
MMAC_AUDIO_SINGLE_CHANNEL_STREAM
This status is indicate current decoding stream is monaural.
MMAC_AUDIO_NO_STREAM
This status indicate there is no audio input.
AUDIO API is judged the thing that the input of audio stream is
started when AUDIO API detect PTS.
This status is returned at next condition.
1. Just after MMAC_AUDIO_Initialise() and before AUDIO API
detect audio stream input.
2. Just after MMAC_AUDIO_Decode(MMAC_FALSE) and
before AUDIO API detect audio stream input.
3. Just after AUDIO API detect empty of audio stream input
and before AUDIO API detect audio stream input.

7
member name description
outputMix specify that the AUDIO API can output audio sample. This member has two
type of setting.
setting type 1 [ use symbol]
MMAC_AUDIO_NO_OUTPUT
specify that all audio output is muted (mute mean is apply maximum
attenuate)
MMAC_AUDIO_MPEG_ONLY
specify that the audio decoder output is only available, the other is
muted.
MMAC_AUDIO_TONE_ONLY
specify that the test tone output is only available, the other is muted.
MMAC_AUDIO_MPEG_AND_EXT
specify that the decoder output and the PCM are available, the other
is muted.
MMAC_AUDIO_MPEG_AND_TONE
specify that the decoder output and the test tone are available, the
other is muted.
MMAC_AUDIO_MPEG_EXT_TONE
specify that all audio output is available.( mean of all audio output
are, the decoder output , the test tone, the PCM).

setting type2 [use combination of symbol]


following three symbol can combine by '|'.
"MMAC_AUDIO_MPEG_MIX", "MMAC_AUDIO_PCM_MIX",
"MMAC_AUDIO_TONE_MIX"
for examples when user want to output MPEG and PCM, user can
set this member as follow.
[Link] = MMAC_AUDIO_MPEG_MIX |
MMAC_AUDIO_PCM_MIX;
bitWidth specify that bit width of audio output which can handle with DAC.
MMAC_AUDIO_BITWIDTH16
specify that the bit width of audio output is 16 bit.
MMAC_AUDIO_BITWIDTH18
specify that the bit width of audio output is 18 bit.
MMAC_AUDIO_BITWIDTH20
specify that the bit width of audio output is 20 bit.
MMAC_AUDIO_BITWIDTH24
specify that the bit width of audio output is 24 bit.

bitsPerSecond specify that the audio bit clock of audio output which can handle with DAC.
MMAC_AUDIO_BITRATE_CLK32
specify that the bit clock of audio output is 32bit.
MMAC_AUDIO_BITRATE_CLK48
specify that the bit clock of audio output is 48bit.
MMAC_AUDIO_BITRATE_CLK64
specify that the bit clock of audio output is 64bit.

8
member name description
fs specify that the audio master clock of audio output which can handle with
DAC.
MMAC_AUDIO_FS_384
specify that the audio master clock is 384.
MMAC_AUDIO_FS_256
specify that the audio master clock is 256.
MMAC_AUDIO_FS_512
this setting is same as "MMAC_AUDIO_FS_256". this is only
provide for compatibility of old AUDIO API.
frequency specify that the sampling frequency of audio decoder output.
MMAC_AUDIO_SAMPLE_FREQ_16K
specify that the sampling frequency of audio decoder is 16KHz.
MMAC_AUDIO_SAMPLE_FREQ_22K05
specify that the sampling frequency of audio decoder is 22.05KHz.
MMAC_AUDIO_SAMPLE_FREQ_24K
specify that the sampling frequency of audio decoder is 24KHz.
MMAC_AUDIO_SAMPLE_FREQ_32K
specify that the sampling frequency of audio decoder is 32KHz.
MMAC_AUDIO_SAMPLE_FREQ_44K1
specify that the sampling frequency of audio decoder is 44.1KHz.
MMAC_AUDIO_SAMPLE_FREQ_48K
specify that the sampling frequency of audio decoder is 48KHz.
MMAC_AUDIO_SAMPLE_FREQ_AUTO
Specify that AUDIO API should monitor stream status. And update
sampling frequency of audio decoder that depend on the status of
decoding audio stream.
Note this setting is only worked when audio firmware detect PTS
information.
The sampling frequency update delay was about 0.2 second or
more.

1.1.2 MMAC_AUDIO_TONEINFO

The MMAC_AUDIO_TONEINFO structure used by function call of MMAC_AUDIO_TestToneEnable.

member name description


frequency specify the frequency of test tone
Available range is from MMAC_AUDIO_MIN_FREQ (its value is 93 ) to
MMAC_AUDIO_MAX_FREQ (it value is 1984 ).
Actually setting frequency has steps (15.62Hz, 21.53Hz, 23.43Hz, 31.25Hz,
43.06Hz, 46.87Hz) depend on sampling frequency. And AUDIO API choose
most suitable test tone divide rate in MMAC_AUDIO_TestToneEnable
function.

9
member name description
level specify the output level of test tone.
Available range is from zero to MMAC_AUDIO_MAX_VOLUME (its value is
85).
When specify zero, AUDIO API set attenuator of test tone as 85dB.(it
become small sound)
When specify 85, AUDIO API set attenuator of test tone as 0dB (it become
big sound).
Actually setting attenuator is stepped by 3dB.

1.1.3 MMAC_AUDIO_VOLUMEINFO

The MMAC_AUDIO_VOLUMEINFO structure used by function call of MMAC_AUDIO_SetVolumeEx.

member name description


tv_L Volume setting for left channel of TV audio output.
tv_R Volume setting for right channel of TV audio output.
vtr_L Volume setting for left channel of VTR audio output.
vtr_R Volume setting for right channel of VTR audio output.
tone_L Volume setting for left channel of TONE output.
tone_R Volume setting for right channel of TONE output.
pcm_L Volume setting for left channel of PCM output.
pcm_R Volume setting for right channel of PCM output.
ac3_SL Volume setting for left surround output.
ac3_SR Volume setting for right surround output.
ac3_C Volume setting for centre output.
ac3_LFE Volume setting for LFE output.

1.1.4 MMAC_AUDIO_OUTPUT_SELECTOR

The MMAC_AUDIO_OUTPUT_SELECTOR structure used by function call of


MMAC_AUDIO_SetOutputSelector and MMAC_AUDIO_GetOutputSelector.

10
member name description
spdifout This setting is control audio output for the S/P DIF.
MMAC_AUDIO_OUTPUTSELECT_SPDIF_LR
specify that the output for SPDIF is only decode result. this is called
as "VTR output".
MMAC_AUDIO_OUTPUTSELECT_SPDIF_MIX
specify that the output for SPDIF is decode result that are mixed by
tone and PCM. this is called as "TV output".
MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM0
specify that the output for SPDIF is stream data of audio channel0.
MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM1
specify that the output for SPDIF is stream data of audio channel1.

pcm1out This setting is control audio output for L/R channel.


MMAC_AUDIO_OUTPUTSELECT_PCM1_LR
specify that the output for PCM1 is only decode result. this is called
as "VTR output".
MMAC_AUDIO_OUTPUTSELECT_PCM1_MIX
specify that the output for PCM1 is decode result that are mixed by
tone and PCM. this is called as "TV output".
pcm2out This setting is control audio output for SL/SR channel.
MMAC_AUDIO_OUTPUTSELECT_PCM2_SLSR
specify that the output for PCM2 is decode result of SL/SR.
when decoding AC-3, this decode result is depend on setting of
"MMAC_AUDIO_DEFAULT_FIRMWARE_OUTPUT_CONFIG".in
"api.h"
MMAC_AUDIO_OUTPUTSELECT_PCM2_MIX
specify that the output for PCM2 is decode result that are mixed by
tone and PCM. this is called as "TV output".

11
Notes
When "VTR output" is selected:
The decoder output is downmix result when decoding AC-3. the downmix type is depend on the
setting of "MMAC_AUDIO_DEFAULT_FIRMWARE_AC3DOWNMIX_TYPE" in "api.h".
Also, when decoding LPCM, the decoder output become downmix result.
When "TV output" is selected:
When decoding AC-3, the decoder output is depend on the setting of
"MMAC_AUDIO_DEFAULT_FIRMWARE_OUTPUT_CONFIG" in "api.h".
When decoding LPCM, the decoder output is depend on the setting of
"MMAC_AUDIO_DEFAULT_FIRMWARE_LPCM_CONFIG" in "api.h"

1.1.5 MMAC_AUDIO_INPUT_SELECTOR

The MMAC_AUDIO_INPUT_SELECTOR structure used by function call of


MMAC_AUDIO_SetInputSelector and MMAC_AUDIO_GetInputSelector.

member name description


playsel specify that the source of audio firmware decoded.
MMAC_AUDIO_CODED_AUDIO0_PLAY
specify that audio firmware decode the stream from audio channel0.
The type of stream is specified by "audio0type".
MMAC_AUDIO_CODED_AUDIO1_PLAY
specify that audio firmware decode the stream from audio channel1.
The type of stream is specified by "audio1type".
MMAC_AUDIO_EXT_CODED_AUDIO_PLAY
specify that audio firmware decode the elementary from external
input.
audio0type specify that the type of stream(audio channel0) which can audio firmware
handled.
MMAC_AUDIO_CODED_AUDIO_TYPE_PES
specify that the stream type is PES.
MMAC_AUDIO_CODED_AUDIO_TYPE_MPEG
specify that the stream type is MPEG1 system.
MMAC_AUDIO_CODED_AUDIO_TYPE_PS_PES
specify that the stream type is PS-PES.
When specified PS-PES, the audio firmware performs PES
decoding and processing private data area as header before
extracted audio data from stream.

audio1type specify that the type of stream(audio channel1) which can audio firmware
handled.
description is same as "audio0type".

12
1.1.6 MMAC_AUDIO_DECODE_MODE

The MMAC_AUDIO_DECODE_MODE define used by function call of


MMAC_AUDIO_SelectDecoderMode.

MMAC_AUDIO_DECODE_MODE_MPEG
specify that the audio firmware can decode MPEG Layer1 and Layer2.
MMAC_AUDIO_DECODE_MODE_MP3
specify that the audio firmware can decode MPEG Layer3.
MMAC_AUDIO_DECODE_MODE_AC3_2CH
specify that the audio firmware can decode AC3 with TONE and LPCM available.
MMAC_AUDIO_DECODE_MODE_AC3_5CH
specify that the audio firmware can decode AC3 however not available TONE and LPCM.
When decoding 5.1ch of AC3, user must choose this define, otherwise audio decode not work
correctly.
MMAC_AUDIO_DECODE_MODE_LPCM_2CH
specify that the audio firmware can decode LPCM with TONE and LPCM available.
MMAC_AUDIO_DECODE_MODE_LPCM_6CH
specify that the audio firmware can decode LPCM however not available TONE and LPCM.
When decoding more than 3 channel of LPCM, user must choose this define, otherwise audio
decode not work correctly.

1.1.7 MMAC_AUDIO_THROUGH_MODE

The MMAC_AUDIO_DECODE_MODE define used by function call of


MMAC_AUDIO_SelectDecoderMode.
Through mode setting is only available when output selector of SPDIF is selected as stream data.

MMAC_AUDIO_THROUGH_MODE_MPEG
specify the stream data type of audio output for SPDIF is MPEG Layer1, Layer2.
MMAC_AUDIO_THROUGH_MODE_AAC
specify the stream data type of audio output for SPDIF is AAC.
MMAC_AUDIO_THROUGH_MODE_AC3
specify the stream data type of audio output for SPDIF is AC3.
MMAC_AUDIO_THROUGH_MODE_DTS
specify the stream data type of audio output for SPDIF is DTS
MMAC_AUDIO_THROUGH_MODE_MP3
specify the stream data type of audio output for SPDIF is MP3
MMAC_AUDIO_THROUGH_MODE_NONE
through output is not available.

13
1.1.8 MMAC_AUDIO_CALLBACK_EVENT

The MMAC_AUDIO_CALLBACK_EVENT define used by function call of MMAC_AUDIO_Notify.

MMAC_AUDIO_CALLBACK_STREAMFULLINTERRUPT
when the interrupt of audio buffer full occurs, call back is generated in HISR of nucleus.
MMAC_AUDIO_CALLBACK_STREAMNEARFULLINTERRUPT
when the interrupt of audio buffer near full occurs, call back is generated in HISR of nucleus.
this interrupt is generated when audio buffer is filled by 90%.
MMAC_AUDIO_CALLBACK_STREAMNEAREMPTYINTERRUPT
when the interrupt of audio buffer near empty occurs, call back is generated in HISR of nucleus.
this interrupt is generated when audio buffer is less than 10%.
MMAC_AUDIO_CALLBACK_STREAMEMPTYINTERRUPT
when the interrupt of audio buffer empty occurs, call back is generated in HISR of nucleus.
However, audio firmware has stream buffer, therefore this call back not indicate actually stream
become empty. And this callback is frequently occur even audio decoder work correctly
MMAC_AUDIO_CALLBACK_AUDIOFIRMWAREERROR
when audio firmware detect error condition, call back is generated in HISR of nucleus.
However, this callback is frequently occur by audio internal buffer full or empty.
MMAC_AUDIO_CALLBACK_PESINTERRUPT
when audio firmware detect PTS information, call back is generated in HISR of nucleus.
This can be used, audio stream input is actually started or not when decoding stream has PTS.

1.1.9 MMAC_AUDIO_AAU_HEADER

The MMAC_AUDIO_AAU_HEADER structure is used to indicate the MPEG audio status which is return
by function call of MMAC_AUDIO_GetAAUHeaderStatus.
member name description
id indicate the ID of the algorithm.
‘1’: ISO/IEC11172-3 Audio stream
‘0’: Extension to lower sampling frequencies(ISO/IEC 13818-3 Audio stream)
layer indicate which layer is used.
‘0’: reserved
‘1’: Layer 1
‘2’: Layer 2
‘3’: Layer 3
protection indicate whether redundancy has been added in the audio bitstream to
facilitate error detection and concealment.
MMAC_TRUE: no redundancy has been added.
MMAC_FALSE: redundancy has been added.

14
member name description
bitrate_index indicate the bitrate.
In the case of id = ‘1’
bitrate_index bitrate specified (kbits/s)
Layer 1 Layer 2 Layer 3
0 free free free
1 32 32 32
2 64 48 40
3 96 56 48
4 128 64 56
5 160 80 64
6 192 96 80
7 224 112 96
8 256 128 112
9 288 160 128
10 320 192 160
11 352 224 192
12 384 256 224
13 416 320 256
14 448 384 320
15 forbidden forbidden forbidden
In the case of id = ‘0’ (lower sampling frequencies)
bitrate_index bitrate specified (kbits/s)
Layer 1 Layer 2, Layer 3
0 free free
1 32 8
2 48 16
3 56 24
4 64 32
5 80 40
6 96 48
7 112 56
8 128 64
9 144 80
10 160 96
11 176 112
12 192 128
13 224 144
14 256 160
15 forbidden forbidden

15
member name description
freq_index indicate the sampling frequency.
In the case of id = ‘1’.
‘0’: 44.1kHz
‘1’: 48kHz
‘2’: 32kHz
‘3’: reserved
In the case of id = ‘0’. (lower sampling frequencies)
‘0’: 22.05kHz
‘1’: 24kHz
‘2’: 16kHz
‘3’: reserved
padding indicate with or without padding in stream.
MMAC_TRUE: Audio frame does not contain an additional slot.
MMAC_FALSE: Audio frame contains an additional slot to adjust the mean
bitrate to the sampling frequency.
private_bit Bit for private use. This bit will not be used in the future by ISO/IEC.
mode indicate the mode.
‘0’: stereo
‘1’: joint stereo (intensity_stereo and/or ms_stereo)
‘2’: dual channel
‘3’: single channel
extension This is used in mode = joint stereo.
In Layer 1 and 2 this indicate which subbands are intensity_stereo.
‘0’: subbands 4-31 in intensity_stereo, bound = 4
‘1’: subbands 8-31 in intensity_stereo, bound=8
‘2’: subbands 12-31 in intensity_stereo, bound=12
‘3’: subbands 16-31 in intensity_stereo, bound=16
In Layer 3 this indicate which type of joint stereo coding method is applied.
The frequency ranges over which the intensity_stereo and ms_stereo
modeds are applied are implicit in the algorithm.
‘0’: intensity_stereo=off, ms_stereo=off
‘1’: intensity_stereo=on, ms_stereo=off
‘2’: intensity_stereo=off, ms_stereo=on
‘3’: intensity_stereo=on, ms_stereo=on
copyright inidicate the copyright status.
MMAC_TRUE: copyright protected
MMAC_FALSE: no copyright
original_copy indicate original or copy.
MMAC_ TRUE: original
MMAC_FALSE: copy

16
member name description
empasis indicates the type of de-emphasis that shall be used.
‘0’: none
‘1’: 50/15 microseconds
‘2’: reserved
‘3’: CCITT J.17

1.1.10 MMAC_AUDIO_AC3_HEADER

The MMAC_AUDIO_AC3_HEADER structure is used to indicate the AC3 audio status which is return
by function call of MMAC_AUDIO_GetAC3HeaderStatus.
member name description
fscod indicate the sampling frequency.
‘0’: 48kHz
‘1’: 44.1kHz
‘2’: 32kHz
‘3’: Reserved
frmsizecod indicate the bitrate code.
Value Rate Valu Rate Valu Rate Valu Rate
e e e
0 32 10 80 20 192 30 448
2 40 12 96 22 224 32 512
4 48 14 112 24 256 34 576
6 56 16 128 26 320 36 640
8 64 18 160 28 384
bsid indicate the stream id.
bsmod indicate the stream mode.
‘0’: Main audio service.
‘1’: Main audio service minus dialogue.
‘2’: Accociated service; visually impaired.
‘3’: Accociated service; hearing impaired.
‘4’: Associated service; dialogue.
‘5’: Associated service; commentary.
‘6’: Associated service; emergency flash.
‘7’: Associated service; voice over (acmod = ‘1’).
acmod indicate the main audio service.
‘2’-‘7’: main audio service: Karaoke
cmixlev indicate the centre mix level.
‘0’: -3dB
‘1’: -4.5dB
‘2’: -6dB
‘3’: User

17
member name description
surmixlev indicate the sorround mix level.
‘0’: 0dB
‘1’: -3dB
‘2’: -6dB
‘3’: User
dsurmod indicate Dolby surround mode.
‘0’: No indication
‘1’: No Dolby Surround encoding
‘2’: Dolby Surround encoding.
lfeon indicate LFE On or Off.
‘0’: Off
‘1’: On
langcod indicate Language code1.
audprodie indicate AC3 production information1.
mixlevel indicate mixing level1.
roomtyp indicate room type1.
‘0’: Not indicated.
‘1’: Large
‘2’: Small
‘3’: Reserved
langcod2 indicate Language code2.
audprodi2e indicate AC3 production information2.
mixlevel2 indicate mixing level2.
roomtyp2 indicate room type2.
‘0’: Not indicated.
‘1’: Large
‘2’: Small
‘3’: Reserved
copyrightb indicate copy protection.
MMAC_TRUE: Protected
MMAC_FALSE: Not protected
origbs indicate original or copy.
MMAC_TRUE: Original.
MMAC_FALSE: Copy.

1.1.11 MMAC_AUDIO_PES_INFO

The MMAC_AUDIO_PES_INFO structure is used to indicate the audio PES status which is return by
function call of MMAC_AUDIO_GetPesStatus.
member name description
streamid indicate PES stream id.

18
1.1.12 MMAC_AUDIO_REF_STC

The MMAC_AUDIO_REF_STC define used by function call of MMAC_AUDIO_SetRefStc.


MMAC_AUDIO_REF_STC1
Referenced System time clock for synchronisation is STC1.
MMAC_AUDIO_REF_STC2
Referenced System time clock for synchronisation is STC2.

1.1.13 MMAC_AUDIO_SPDIF_CHANNEL_STATUS

The MMAC_AUDIO_SPDIF_CHANNEL_STATUS structure used by function call of


MMAC_AUDIO_SetSPDIFChannelStatus and MMAC_AUDIO_GetSPDIFChannelStatus.
member name description
nControl About the detail of these member, please refer “IEC-60958 Digital audio
nMode interface”.

nCategoryCode
nSource
nChannelNumber1
nChannelNumbar2
nFs
nClockAccuracy
nWordLength

1.1.14 Audio firmware configuration by "mmac/config/api.h"

Basically, this audio firmware setting is not necessary to modify.


Next shown is for configuration of downmixing the decode result.

MMAC_AUDIO_DEFAULT_FIRMWARE_AC3DOWNMIX_TYPE
Specify the down mix type of VTR output when AC-3 decoding.
MMAC_AUDIO_AC3DMIX_LTRT
The "VTR output" of AC3 decoded result is downmixed to Lt, Rt.
MMAC_AUDIO_AC3DMIX_LORO
The "VTR output" of AC3 decoded result is downmixed to Lo, Ro.
MMAC_AUDIO_DEFAULT_FIRMWARE_OUTPUT_CONFIG
specify the down mix type of TV output when AC-3 decoding.
MMAC_AUDIO_OUTCONFIG_LTRT
The "TV output" of AC3 decoded result is downmixed to Lt, Rt.
This is reserved for dolby surround.
If set this parameter then the setting of dual mono is worked, when decoding AC-3.
MMAC_AUDIO_OUTCONFIG_C

19
The "TV output" of AC3 decoded result is downmixed to only Center channel. please
refer note1
MMAC_AUDIO_OUTCONFIG_LR
The "TV output" of AC3 decoded result is downmixed to Left/ Right channel. please
refer note1
MMAC_AUDIO_OUTCONFIG_LCR
The "TV output" of AC3 decoded result is downmixed to Left/Center/Right Channel.
please refer note1
MMAC_AUDIO_OUTCONFIG_LRS
The "TV output" of AC3 decoded result is downmixed to Left/Right/mono Surround
Channel. please refer note1
MMAC_AUDIO_OUTCONFIG_LCRS
The "TV output" of AC3 decoded result is downmixed to Left/Center/Right/mono
Surround Channel. please refer note1
MMAC_AUDIO_OUTCONFIG_LRSLSR
The "TV output" of AC3 decoded result is downmixed to Left/Right/Surround
Left/Surround Right Channel. please refer note1
MMAC_AUDIO_OUTCONFIG_LCRSLSR
The "TV output" of AC3 decoded result is downmixed to Left/Center/Right/Surround
Left/Surround Right Channel. please refer note1
note1:
In this block, user keyword of "downmix" as next mean. AC3 decoder is always perform
downmixing to make decode result.

MMAC_AUDIO_DEFAULT_FIRMWARE_LPCM_CONFIG
specify the LPCM decoded result is downmixed or not.
MMAC_AUDIO_LPCM_6CH
The "TV output" of LPCM decoded result is not downmixed.
MMAC_AUDIO_LPCM_6TO2CH
The "TV output" of LPCM decoded result is downmixed 6 channel to 2 channel.

1.1.15 Audio firmware configuration by "mmac/config/api.h"

Basically, this audio firmware setting is not necessary to modify.


Next shown is for configuration of AC3 decoder.

MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_KMODE
specify that the AC3 Karaoke mode setting.
MMAC_AUDIO_AC3_2_0_PLAY
specify Left/Right mode.
MMAC_AUDIO_AC3_3_0_PLAY
specify Left/MiddleMelody/Right mode

20
MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_WVOCAL
specify that the AC3 karaoke mode setting.
MMAC_AUDIO_AC3_TWO_VOCAL
both vocal (V1+V2)
MMAC_AUDIO_AC3_VOCAL1_TO_BOTH
vocal V1 only
MMAC_AUDIO_AC3_VOCAL2_TO_BOTH
vocal V2 only
MMAC_AUDIO_AC3_NO_VOCAL
no vocals

MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_SLDELAY
specify that the amount of delay of Surround Left channel by 16 sample unit.
available setting is from 0 to 127.
MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_SRDELAY
specify that the amount of delay of Surround Right channel by 16 sample unit.
available setting is from 0 to 127.
MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_CDELAY
specify that the amount of delay of mono Surround channel by 16 sample unit.
available setting is from 0 to 127.

MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_DYNCOMPMODE
specify that the dynamic range compression mode.
MMAC_AUDIO_AC3_DYNCOMP_ANALOG
custom mode (Analog dialogue normalisation)
MMAC_AUDIO_AC3_DYNCOMP_DIGITAL
custom mode (Digital dialogue normalisation)
MMAC_AUDIO_AC3_DYNCOMP_LINE
"Line out" mode
MMAC_AUDIO_AC3_DYNCOMP_RF
"RF remod" mode

MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_DYNCOMPCUT
specify the user setting coefficient at using dynamic range compression.
available setting is from 0 to 127
MMAC_AUDIO_DEFAULT_FIRMWARE_AC3_DYNCOMPBST
specify the user setting coefficient at using dynamic range compression.

21
available setting is from 0 to 127

1.1.16 Audio firmware configuration by "mmac/config/api.h"

When user necessary to set audio STC clock at 27MHz, user must set this define.
Basically, this audio firmware setting is not necessary to modify.
Next shown is for configuration of audio synchronisation.

MMAC_AUDIO_DEFAULT_FIRMWARE_SYNC_STC_PERIOD
specify that count up rate of STC counter which controlled by audio firmware.
MMAC_AUDIO_SYNCPCR_90K
The STC counter which controlled by audio firmware is count up 64 every 64*300 count
period of 27MHz. This symbol may used for DVB.
MMAC_AUDIO_SYNCPCR_27M
The STC counter which controlled by audio firmware is count up 64*300 every 64*300
count period of 27MHz. This symbol may used for DirecTV (of MPEG1 sysMpegAudio).
Note: DirecTV (of AC3) is not supported current AUDIO API. Because of period of STC
and PTS not equal.

1.1.17 Audio hardware configuration by "mmac/config/api.h"

When user necessary to set audio data input rate, user can change its by this define.
Basically, this audio firmware setting is not necessary to modify.
Next shown is for configuration of audio data input rate.

MMAC_AUDIO_DEFAULT_SICTRL_CLOCK
this is data input rate from audio unit to audio firmware of audio data.
0 is fastest and 15 is slowest. default value is 10.
MMAC_AUDIO_DEFAULT_ESICTRL_CLOCK
this is data input rate from audio unit to audio firmware of external input audio data(PCM etc).
0 is fastest and 15 is slowest. default value is 9.

1.1.18 Audio hardware configuration by "mmac/config/api.h"

When user necessary to set external input data format(only for PCM), user must set this define correctly.
When user use external input data(not PCM), user must set default value.
Next shown is for configuration of external audio data format.

MMAC_AUDIO_DEFAULT_ESICTRL_BITWIDTH
specify the audio data format (bit width) which come from
when external input data is not PCM, this setting is must EMMA_BIOS_AUDIO_BITWIDTH16.

22
EMMA_BIOS_AUDIO_BITWIDTH16
The bit width of audio input data was 16 bit(PCM).
EMMA_BIOS_AUDIO_BITWIDTH18
The bit width of audio input data was 18 bit(PCM).
EMMA_BIOS_AUDIO_BITWIDTH20
The bit width of audio input data was 20 bit(PCM).
EMMA_BIOS_AUDIO_BITWIDTH24
The bit width of audio input data was 24 bit(PCM).

MMAC_AUDIO_DEFAULT_ESICTRL_BITCLOCK
specify the audio data format (bit clock) which come from
when external input data is not PCM, this setting is must
EMMA_BIOS_AUDIO_BITRATE_CLK32.
EMMA_BIOS_AUDIO_BITRATE_CLK32
The bit clock of audio input data was 32fs bit clock.
EMMA_BIOS_AUDIO_BITRATE_CLK48
The bit clock of audio input data was 48fs bit clock.
EMMA_BIOS_AUDIO_BITRATE_CLK64
The bit clock of audio input data was 64fs bit clock.

MMAC_AUDIO_DEFAULT_ESICTRL_STUFFMODE
specify the audio data format (stuff mode) which come from
when external input data is not PCM, this setting is must
EMMA_BIOS_AUDIO_STUFFBACKWARD .
EMMA_BIOS_AUDIO_STUFFBACKWARD
the stuff mode of audio input data was "Right Justified"
EMMA_BIOS_AUDIO_STUFFAHEAD
the stuff mode of audio input data was "Left Justified"
EMMA_BIOS_AUDIO_STUFFI2S
the stuff mode of audio input data was "1 clock delay"

1.1.19 Audio API configuration by "mmac/config/api.h"

When user want to decode MP3 and AC3, user must set this setting as (MMAC_YES).
Basically, this Audio API is not necessary to modify when decode MPEG only.

MMAC_AUDIO_MP3_AVAILABLE
When user have MP3 license, user can set this symbol as MMAC_YES.
Otherwise this symbol must be MMAC_NO.

23
And if user set this symbol MMAC_YES and user do not have related header file of audio
firmware, it lead fail of MMAC_AUDIO_Initialise() or build error of Audio API.
MMAC_YES or 1
AUDIO API enabled MP3 decoding.
MMAC_NO or 0
AUDIO API disabled MP3 decoding.
MMAC_AUDIO_AC3_AVAILABLE
When user have AC3 license , user can set this symbol as MMAC_YES.
Otherwise this symbol must be MMAC_NO.
And if user set this symbol MMAC_YES and user do not have related header file of audio
firmware, it lead build error of Audio API.
MMAC_YES or 1
AUDIO API enabled AC3 decoding.
MMAC_NO or 0
AUDIO API disabled AC3 decoding.

1.1.20 Audio API configuration by "mmac/config/api.h"

When user not necessary to execute AUDIO API error check, user necessary to change this symbol.

MMAC_AUDIO_PARAMETER_CHECKING
Specify that AUDIO API necessary to check parameter and audio related fatal error.
Audio related fatal error was that 1. audio firmware is not correct. [Link] buffer restriction not
satisfied.
MMAC_YES
specify that AUDIO API should check user passed parameter and fatal error.
MMAC_NO
specify that AUDIO API should not check user passed parameter.

1.1.21 Audio API configuration by "mmac/config/api.h"

When user want to modify stack size and task priority depend on used RTOS, user necessary to change
this symbol.

MMAC_AUDIO_TASK_STACK_SIZE
Specify the task used stack size where AUDIO API created.
this setting is require more than 4096. default setting is 4096.
MMAC_AUDIO_TASK_PRIORITY
Specify the task priority where AUDIO API created.

24
If there is higher priority TASK than AUDIO API, some function of AUDIO API which necessary
to monitor audio state is not work periodic. Example are audio synchronisation, automatically set
frequency.
MMAC_AUDIO_HISR_STACK_SIZE
Specify the HISR used stack size where AUDIO API created.
HISR is functionality of RTOS (Nucleus ). Therefore when MMAC_RTOS_NUCLEUS is not
MMAC_YES, this setting is not used in AUDIO API.
The default setting is 1024.

25
1.2 Example of AUDIO API Use
MMAC_AUDIO_RESULT_CODE InitialiseAudio( void )
{
MMAC_AUDIO_INPUT_SELECTOR ise;
MMAC_AUDIO_OUTPUT_SELECTOR ose;
MMAC_AUDIO_CONFIGURATION cfg;
MMAC_AUDIO_RESULT_CODE audioResult;

audioResult = MMAC_AUDIO_Initialise();
/********************************
* Audio [Link] *
********************************/
if(audioResult == MMAC_AUDIO_OK)
{
[Link] = MMAC_AUDIO_ASYNC;
[Link] = MMAC_AUDIO_AUTOMATIC;
[Link] = MMAC_AUDIO_NO_STREAM;
[Link] = MMAC_AUDIO_MPEG_AND_TONE;
[Link] = MMAC_AUDIO_BITWIDTH18;
[Link]= MMAC_AUDIO_BITRATE_CLK64;
[Link] = MMAC_AUDIO_FS_512;
[Link] = MMAC_AUDIO_SAMPLE_FREQ_48K;
audioResult = MMAC_AUDIO_SetConfiguration(&cfg);
}

/****************************************
* Audio API apply maximum attenuation *
* set attenuator as 0 dB. *
****************************************/
if(audioResult == MMAC_AUDIO_OK)
{
audioResult = MMAC_AUDIO_SetVolume(0,0);

/*******************************
*Specify input stream routing *
* and stream type. *
*******************************/
if(audioResult == MMAC_AUDIO_OK)
{
[Link] = MMAC_AUDIO_CODED_AUDIO0_PLAY;
isel.audio0type= MMAC_AUDIO_CODED_AUDIO_TYPE_PES;
isel.audio1type= MMAC_AUDIO_CODED_AUDIO_TYPE_PES;
audioResult = MMAC_AUDIO_SetInputSelector(&isel);
}
}

/*************************
* specify audio output. *
*************************/
if(audioResult == MMAC_AUDIO_OK)
{
[Link] = MMAC_AUDIO_OUTPUTSELECT_SPDIF_LR;
osel.pcm1out = MMAC_AUDIO_OUTPUTSELECT_PCM1_MIX;
osel.pcm2out = MMAC_AUDIO_OUTPUTSELECT_PCM2_MIX;
audioResult = MMAC_AUDIO_SetOutputSelector(&osel);
}

/*********************
* stream data input *
**********************/

26
if(audioResult == MMAC_AUDIO_OK)
{
audioResult = MMAC_AUDIO_Decode(MMAC_TRUE);
}

return (audioResult);

27
2 Function Prototypes

MMAC_AUDIO_Initialise

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Initialise(void);

Includes
#include “mmac/audio.h”

Inputs
None.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_ALREADY_INITIALISED
MMAC_AUDIO_FAIL

Description
This function initialises the audio subsystem and this function must be called once prior to using any of the
other AUDIO API functions. If this is called multiple times then the subsequent calls will have no action.
It is good practice to call this function together with MMAC_VIDEO_Initialise() in order that both the
audio and video parts of the driver are initialised correctly, this is due to the close coupling of these two
sections of the API.
When this API succeeds all related registers to AUDIO are overwritten so the audio API can work. It also
sets the stream DMA for audio as a dummy setting. For the Stream DMA setting please refer to
MMAC_AUDIO_Configuraiton function.

See Also
MMAC_VIDEO_Initialise
MMAC_DMA_Initialise

Sample Code
< tba >

28
MMAC_AUDIO_SetConfiguration

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetConfiguration(
MMAC_AUDIO_CONFIGURATION *config
);

Includes
#include “mmac/audio.h”

Inputs
config Pointer to configuration structure.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_FAIL

Description
This function sets the configuration of the audio subsystem.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The config structure should be initialised with the startUpMode if audio and video should be synchronised.
Use MMAC_AUDIO_GetConfiguration() to get the read only MMAC_AUDIO_STREAM configuration
parameter to report the type of audio stream.
If the config pointer is NULL or the member of the structure is invalid the value
MMAC_AUDIO_INVALID_PARAM is returned.

Following member of MMAC_AUDIO_CONFIGURATION structure should be initialised to use this


function:
startUpMode specify Audio API perform audio synchronisation based on STC master.
When VIDEO API control audio synchronisation (audio master), this setting is
not work (sometime ignore) and, to return STC master mode video setting return
to STC master and reset AUDIO API is necessary.
steering indicate the handling method of dual-mono audio when decode dual mono
stream. When audio decoder decode stream with PTS, it can specify
MMAC_AUDIO_AUTOMATIC. In other case, automatic setting is not work
and the behaviour is not defined.
outputMix indicate the utilising audio source in this audio system. Not using audio source is
applyingmaximum attenuate value. when MPEG(audio decoder) is not used,
apply attenuator of -85db(maximum). when TONE(tone mixing) is not used,
apply attenuator of -93db(maximum). when EXT(pcm mixing) is not used, apply
attenuator of -85dB(maximum)

29
bitWidth indicate the bit width of decoder outputs.
bitsPerSecond indicate the bit clock of decoder outputs. (bit clock is same mean bitrate clock)
fs indicate the master clock of decoder outputs.
frequency indicate the sampling frequencyt of decoder outputs. When audio decoder
decode stream with PTS, it can specify
MMAC_AUDIO_SAMPLE_FREQ_AUTO. In other case, automatic setting is
not work and behaviour is not defined.
When output selector for SPDIF is specified as audio decode result (example
MMAC_AUDIO_OUTPUTSELECT_SPDIF_MIX or
MMAC_AUDIO_OUTPUTSELECT_SPDIF_LR), SPDIF output frequency is
also set by this member. However, sampling frequency is low(16K, 22.05K,
24K), that case is SPDIF output is undefined. (may be become 16K,22.05K,24K
with incorrect SPDIF header)
When output selector for SPDIF is specified as stream
(MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM0 or
MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM1), SPDIF output
frequency is fixed as 48K. However, sampling frequency is low(16K,22.05K,
24K) that case is setting frequency is undefined. (may be become 24K with
incorrect SPDIF header)

The setting of dual mono mode (left to both, right to both, both) has effect when the decode stream is dual-
mono. When the stream is not for dual mono the setting of dual mono is not allowed. Thefunction sets the
sampling frequency of decode output and SPDIF output. When SPDIF output is a Stream the frequency of
SPDIF output is fixed as 48KHz.
When this API is first called after initialise the API initialises StreamDMA Channel0, based on the
DEMUX setting. If user want to initialise StramDMA Channel0 again, please execute
MMAC_AUDIO_Reset().
When decoding MP3, startUpMode should be MMAC_AUDIO_ASYNC. Otherwise audio is not work
correctly.

See Also
MMAC_AUDIO_GetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

30
MMAC_AUDIO_GetConfiguration

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetConfiguration(
MMAC_AUDIO_CONFIGURATION *config
)

Includes
#include “mmac/audio.h”

Inputs
None.

Outputs
config Pointer to configuration structure where data is returned.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_FAIL

Description
This function gets the configuration of the audio subsystem but MMAC_AUDIO_Initialise() must be
called at first, otherwise MMAC_AUDIO_NOT_INITIALISED will be returned. The function
MMAC_AUDIO_SetConfiguration() must then be called, otherwise
MMAC_AUDIO_NOT_CONFIGURED will be returned. If the config pointer is NULL the value
MMAC_AUDIO_INVALID_PARAM is returned. The read only configuration parameter
MMAC_AUDIO_STREAM reports the type of audio stream which may be used to confirm the current
decoded stream.
AUDIO API monitored firmware status and updating streamStatus when audio decoder decode stream
with PTS and updating period is more than 0.1 sec. The period of updating is depend on TASK priority of
AUDIO API. When user not decode stream with PTS, the streamStatus information is not guarantee
having correct status.
The other member is returned the current configuration of audio system which set by
MMAC_AUDIO_SetConfiguration.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

31
MMAC_AUDIO_Decode

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Decode(MMAC_BOOL enableFlag);

Includes
#include “mmac/audio.h”

Inputs
enableFlag If MMAC_TRUE enables the decoder otherwise halts it.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_ALREADY_STARTED
MMAC_AUDIO_ALREADY_STOPPED
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function starts or stops the audio decoder depending on the state of enableFlag.
MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_INITIALISED will
be returned. The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise
MMAC_AUDIO_NOT_CONFIGURED will be returned. If the function is called twice with enableFlag set
to MMAC_TRUE then the value MMAC_AUDIO_ALREADY_STARTED will be returned. If the function
is called with enableFlag set to MMAC_FALSE then the value MMAC_AUDIO_OK will be returned.
This API performs the reset operation for AUDIO firmware in this API. Thus, all decoder output (TONE,
PCM playback, SPDIF output) is temporarily stopped. Therefore, the user must stop using SPDIF output
before calling this API.
When enableFlag is MMAC_TRUE and take audio synchronisation by audio configuration of
MMAC_AUDIO_SetConfiguration(), audio decode output is muted until get audio synchronisation.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

32
MMAC_AUDIO_Mute

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Mute(MMAC_BOOL muteFlag);

Includes
#include “mmac/audio.h”

Inputs
muteFlag If MMAC_TRUE mutes the audio otherwise un-mutes.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function mutes or un-mutes the audio decoder output both for TV and for VTR. When the output is
un-muted, the volume level is returned to the original level prior to the mute.
The function MMAC_AUDIO_Initialise() must be called at first otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned. The function MMAC_AUDIO_SetConfiguration() must then be called
otherwise MMAC_AUDIO_NOT_CONFIGURED will be returned.
Audio Firmware does not have a mute function. This function controls audio decoder output level, to
realise mute and un-mute. Therefore, when applying mute for decode output, an audio level of 0.0056% of
original remains and is output as decode output.
The 0.0056 was derived from next calculation. Audio Firmware can apply attenuate as -85dB(maximum).
Therefore 20*log(X)= -85, And then X become 0.000056. equal 0.0056 percentage.
Next show the maximum remaining PCM level after audio mute of each bit width.
When audio output is 16bit, the remaining maximum level is 32768*0.000056 (result is 2).
When audio output is 18bit, the remaining maximum level is 131072*0.000056 (result is 8).
When audio output is 20bit, the remaining maximum level is 524288*0.000056 (result is 30).
When audio output is 24bit, the remaining maximum level is 8388608*0.000056 (result is 472).
At this result, if user use high quality audio amp, user may notice that audio output is not muted.
This is audio firmware specification and there is no side step. if user want to be perfect mute, then
additional hardware and software development is necessary.

See Also
MMAC_AUDIO_SetVolume
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

33
MMAC_AUDIO_SetVolume

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetVolume(
UI16 volumeLeft,
UI16 volumeRight
);

Includes
#include “mmac/audio.h”

Inputs
volumeLeft Specifies the Volume for the left channel
(0x00 - MMAC_AUDIO_MAX_VOLUME).
volumeRight Specifies the Volume for the right channel
(0x00 - MMAC_AUDIO_MAX_VOLUME).

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function sets the volume of the audio decoder outputs and the RAM AUDIO outputs.
The function MMAC_AUDIO_Initialise() must be called at first otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned. The function MMAC_AUDIO_SetConfiguration() must be called
otherwise MMAC_AUDIO_NOT_CONFIGURED will be returned.
This function is also sets the output level of PCM playback (for RAM-AUDIO API), but does not set the
output level of TONE.
When input argument is 0, this API apply maximum attenuate to the audio output.
When input argument is MMAC_AUDIO_MAX_VOLUME or more than MMAC_AUDIO_MAX_
VOLUME, this API not apply attenuate , then output audio volume become maximum.

See Also
MMAC_AUDIO_Mute
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

34
MMAC_AUDIO_TestToneEnable

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_TestToneEnable(
MMAC_AUDIO_TONEINFO *toneInfo
);

Includes
#include “mmac/audio.h”

Inputs
toneInfo This points to an MMAC_AUDIO_TONEINFO structure which should specifies
the frequency and level. See also introduction of data type.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_OUT_OF_RANGE
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_FAIL

Description
This function causes the Audio Firmware to generate a sine wave test tone of a specified frequency, and
level.
• The frequency output may actually be in the range 93.75Hz – 1.984KHz in 15.625Hz increments with
the requested frequency being in the range MMAC_AUDIO_API_MIN_FREQ to MMAC_AUDIO_
API_MAX_FREQ. If the request is outside of this range then MMAC_AUDIO_OUT_OF_RANGE will
be returned.
• This function does not affect the playing of an audio stream or sample, but the mix for the audio
sources will be determined by the value set when MMAC_AUDIO_SetConfiguration() function was
called.
• The attenuation may be set to up to between 0 and 93dB by specifying the level member of the
toneInfo structure. The actual attenuation is applied in units of 3dB.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned. The function MMAC_AUDIO_SetConfiguration() must then be called,
otherwise MMAC_AUDIO_NOT_CONFIGURED will be returned.
This function does not control duration of Tone.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

35
MMAC_AUDIO_TestToneDisable

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_TestToneDisable(void);

Includes
#include “mmac/audio.h”

Inputs
None.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function switches the test tone off.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned. The function MMAC_AUDIO_SetConfiguration() must then be called,
otherwise MMAC_AUDIO_NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_TestToneEnable

Sample Code
< tba >

36
MMAC_AUDIO_Reset

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Reset(void);

Includes
#include “mmac/audio.h”

Inputs
None.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_FAIL

Description
This function resets the audio subsystem.
The function MMAC_AUDIO_Initialise() must be called at first otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
This function performs audio hardware / firmware reset and the previous configuration is overwritten. Set
up the StreamDMA Channel0 setting from DEMUX setting and discard StreamDMA Channel1 setting.
This function holds the volume level. If audio is running (TONE generate, decoder busy) this API
automatically stops that function.

See Also
None.

Sample Code
< tba >

37
MMAC_AUDIO_SetOutputSelector

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetOutputSelector(
MMAC_AUDIO_OUTPUT_SELECTOR *select
)

Includes
#include “mmac/audio.h”

Inputs
select Specify the audio output mode of audio system.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURATION
MMAC_AUDIO_FAIL

Description
This function configures the audio decoder output type.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise
MMAC_AUDIO_NOT_INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise
MMAC_AUDIO_NOT_CONFIGURED will be returned.
This function is only available when decoder output is stopped. If output of SPDIF was selected as audio
decoder output, then the sampling frequency and master clock for SPDIF output is set-up as same
frequency of decoder output. If SPDIF output specify stream output, then the sampling frequency is set-up
48KHz and master clock is automatically selected to realise that frequency.
Following member of MMAC_AUDIO_OUTPUT_SELECTOR structure should be initialised to use this
function.
spdifout specify the output data type for SPDIF.
pcm1out specify the output data type for audio decode result of PCM1 L/R
pcm2out specify the output data type for audio decode result of PCM2 SL/SR

See Also
MMAC_AUDIO_GetOutputSelector
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

38
MMAC_AUDIO_GetOutputSelector

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetOutputSelector(
MMAC_AUDIO_OUTPUT_SELECTOR *select
)

Includes
#include “mmac/audio.h”

Inputs
select Pointer to output configuration structure where data is stored.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED

Description
This function gets the configuration of the output signal type.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetOutputSelector
MMAC_AUDIO_Initialise

Sample Code
< tba >

39
MMAC_AUDIO_SetInputSelector

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetInputSelector (
MMAC_AUDIO_INPUT_SELECTOR *select
)

Includes
#include “mmac/audio.h”

Inputs
select This points to an MMAC_AUDIO_INPUT_SELECTOR structure. See also
introduction of data type.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function configures the input signal type.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.
This function is set-up what source is processed by audio decoder. This function is only available when
decoder output is stopped. If RAM AUDIO of MPEG playback is running, then the functionality of RAM
AUDIO of MPEG playback is automatically stopped.
Following member of MMAC_AUDIO_INPUT_SELECTOR structure should be specified by user to use
this function.
playsel specify the which source of audio data was decoding by audio decoder.
audio0type specify the input audio data format of Audio Channel0.
audio1type specify the input audio data format of Audio Channel1

See Also
MMAC_AUDIO_GetInputSelector
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

40
MMAC_AUDIO_GetInputSelector

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetInputSelector(
MMAC_AUDIO_INPUT_SELECTOR *select
)

Includes
#include “mmac/audio.h”

Inputs
None.

Outputs
select Pointer to input configuration structure where data is stored.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED

Description
This function gets the configuration of the input signal type.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetInputSelector
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

41
MMAC_AUDIO_Notify

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Notify(
MMAC_AUDIO_CALLBACK_EVENT event,
MMAC_AUDIO_CALLBACK_FUNCTION function
)

Includes
#include “mmac/audio.h”

Inputs
event Specify type of the call back that registered within AUDIO API.
function Pointer to the function which are called by specified event happened..

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_INVALID_CALLBACK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function installs a call back function specified by function, which will be called when the condition
specified by MMAC_AUDIO_CallBack_Event is met.
This function is intended to be a flexible way of external code being informed of a hardware interrupt
condition.
This call back must be explicitly removed by calling this function with a NULL pointer as the function
argument.
Callback function’s prototype is as follows.
void function_name(UI32 dwParam);

Callback function can obtain 32bit unsigned long parameter.


The function MMAC_AUDIO_Initialise() must be called at first otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned. The function MMAC_AUDIO_SetConfiguration() must then be called
otherwise MMAC_AUDIO_NOT_CONFIGURED will be returned. If function is a NULL pointer then the
value MMAC_AUDIO_INVALID_CALLBACK will be returned.
User can not use AUDIO API function in call-back function because this API always return semaphore
error.
Regarding StreamDMA call-back (full/near full/near empty/empty interrupt) – the argument is that when
StreamDMA Channel0 interrupt is detected the bit0 assigned as 1 otherwise it is assign as 0. When
StreamDMA Channel1 interrupt is detected the bit1 assign as 1 otherwise it is assign as 0.
Regarding Audio call-back (error/AVSYNC interrupt) - when audio firmware is busy the argument
becomes 1, when not busy the argument becomes 0.

42
In the case of normal decoding, the empty and the nearly empty interrupt occur at frequent. The upper
layer application of the API should pay attention to the CPU time by these interrupts.
For all call-back events, these call-back functions must not call the audio API.
If the audio API is called in the call-back function, the semaphore acquire error happens and all software
processes is not processed.
A reason of AUDIO API and RAM AUDIO API can not work in HISR.
For the communicating audio firmware, the audio API acquires the access semaphore to avoid
access collision before any access to audio firmware. And when current task is HISR, all of
acquire semaphore with time-out is become error. Therefore AUDIO API and RAM AUDIO API
are can not work in HISR.
A reason of all software process is not processed
The AUDIO API use semaphore to protects command interface to communicating audio firmware,
and to protects AUDIO API internal data structure with multi-task environment. Therefore same
as above reason AUDIO API and RAM AUDIO API is not process.

See Also
None

Sample Code
< tba >

43
MMAC_AUDIO_SelectDecoderMode

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SelectDecoderMode(
MMAC_AUDIO_DECODE_MODE mode1,
MMAC_AUDIO_THROUGH_MODE mode2
)

Includes
#include “mmac/audio.h”

Inputs
mode1 Specify the Audio Firmware Mode for Decode.
mode2 Specify the Audio Firmware Mode for pass through.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function selects which stream type is input to.
This function specifies the stream type of the decoded stream by mode1 and specifies the stream passed
through by mode2. This function is available when all decoder outputs (audio decoder output, tone, PCM
playback) are stopped. This function also controls the stream output of SPDIF start. When mode2 is not
specified as MMAC_AUDIO_THROUGH_MODE_NONE, and if the first time called this API after
Initialise or Reset, this API sets up StreamDMA channel1 to use for pass through. The function
MMAC_AUDIO_Initialise() must be called at first otherwise MMAC_AUDIO_NOT_INITIALISED will
be returned. The function MAC_AUDIO_SetConfiguration() must then be called otherwise
MMAC_AUDIO_NOT_CONFIGURED will be returned.

See Also
None

Sample Code
< tba >

44
MMAC_AUDIO_Pause

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Pause(MMAC_BOOL enablePauseFlag);

Includes
#include “mmac/audio.h”

Inputs
enablePauseFlag If MMAC_TRUE pause the decoder.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL
MMAC_AUDIO_NOT_SUPPORTED

Description
This function pause or unpause the audio decoder depending on the state of enablePauseFlag. The
attention is necessary so as not to become audio buffer full during the pause. When the stream such as the
channel switching changes it is not this function and please use MMAC_AUDIO_Decode().
MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_INITIALISED will
be returned. The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise
MMAC_AUDIO_NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

45
MMAC_AUDIO_SetVolumeEx

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetVolumeEx(
MMAC_AUDIO_VOLUMEINFO *volume
)

Includes
#include “mmac/audio.h”

Inputs
volume Pointer to volume configuration structure.

Outputs
None.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_FAIL

Description
This function sets the volume configuration of each output channel individually. The output channels are
TV left/right, VTR left/right, Tone left/right, PCM left/right, and SL/SR, C and LFE for AC3.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

46
MMAC_AUDIO_GetAAUheaderMPEG

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetAAUheaderMPEG(
UI32 *aau);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
stream_status A Pointer to bit field of audio stream status
bits[31:16] all ‘0’.
bits[15:14] Layer
00: Reserved
01: Layer3
10: Layer2
11: Layer1
bits[13:12] Sampling frequency
00: 44.1kHz
01: 48kHz
10: 32kHz
11: Reserved
bits[11:10] mode
00: Stereo
01: Joint stereo
10: Dual
11: Mono
bits[9:6] itrate
Value L1 L2 L3 Value L1 L2 L3
0000 Free 1000 256 128 112
0001 32 32 32 1001 288 160 128
0010 64 48 40 1010 320 192 160
0011 96 56 48 1011 352 224 192
0100 128 64 56 1100 384 256 224
0101 160 80 64 1101 416 320 256
0110 192 96 80 1110 448 384 320
0111 224 112 96 1111 Forbidden

47
bit[5] Eror protection
0: Error checking
1: Errors ignored
bits[4:3] Emphasis
00: No emphasis
01: 50/15us
10: Reserved
11: CCITT J.17
bit[2] Private (recerved
bit[1] Cpy protection
0: Not protected.
1: Protected.
bit[0 Original
0: Copy
1: Original

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_SUPPORTED
MMAC_AUDIO_FAIL

Description
This function gets MPEG stream status.

See Also
None.

Sample Code
< tba >

48
MMAC_AUDIO_GetAAUheaderMP3

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetAAUheaderMP3(
UI32 *aau);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
stream_status A Pointer to bit field of audio stream status
bits[31:16] all ‘0’.
bits[15:14] Layer
00: Reserved
01: Layer3
10: Layer2
11: Layer1
bits[13:12] Sampling frequency
00: 44.1kHz
01: 48kHz
10: 32kHz
11: Reserved
bits[11:10] mode
00: Stereo
01: Joint stereo
10: Dual
11: Mono
bits[9:6] itrate
Value L1 L2 L3 Value L1 L2 L3
0000 Free 1000 256 128 112
0001 32 32 32 1001 288 160 128
0010 64 48 40 1010 320 192 160
0011 96 56 48 1011 352 224 192
0100 128 64 56 1100 384 256 224
0101 160 80 64 1101 416 320 256
0110 192 96 80 1110 448 384 320
0111 224 112 96 1111 Forbidden

49
bit[5] Eror protection
0: Error checking
1: Errors ignored
bits[4:3] Emphasis
00: No emphasis
01: 50/15us
10: Reserved
11: CCITT J.17
bit[2] Private (recerved
bit[1] Cpy protection
0: Not protected.
1: Protected.
bit[0 Original
0: Copy
1: Original

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_SUPPORTED
MMAC_AUDIO_FAIL

Description
This function gets MP3 stream status.

See Also
None.

Sample Code
< tba >

50
MMAC_AUDIO_GetAC3StreamStatus

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetAC3StreamStatus(
UI32 *stream_status,
UI32 *ch_config
);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
stream_status A Pointer to bit field of AC3 stream status
bits[31:30] Sampling frequency
00: 48kHz
01: 44.1kHz
10: 32kHz
11: Reserved
bits[29:28] mode
00: Dual mono
01: Mono
10: Stereo
11: Reserved
bits[27:23] Bitrate
Value Rate Value Rate Value Rate Value Rate
00000 32 00101 80 01010 192 01111 448
00001 40 00110 96 01011 224 10000 512
00010 48 00111 112 01100 256 10001 576
00011 56 01000 128 01101 320 10010 640
00100 64 01001 160 01110 384

bits[22:18] all ‘0’.


bit[17] Copy protection
0: Not protected.
1: Protected.
bit[16] Original
0: Copy
1: Original
bits[15:11] stream ID

51
bits[10:8] stream mode:
000: Main audio service
001: Main audio service minus dialogue
010: Associated service; visually impaired
011: Associated service; hearing impaired
100: Associated service; dialogue
101: Associated service; commentary
110: Associated service; emergency flash
111: Associated service; voice over (acmod=’001’)
bits[7:5] acmode:
010-111: Main audio service: Karaoke
bit[4:0] all ‘0’.
ch_config A Pointer to bit field of AC3 channel configuration
bits[31:16] all ‘0’.
bits[15:13] Coding configuration.
000: 1+1
001: 1/0
010: 2/0
011: 3/0
100: 2/1
101: 3/1
110: 2/2
111: 3/2
bit[12] LEF On or Off.
0: Off
1: On
bits[11:10] Centre mix level
00: -3dB
01: -4.5dB
10: -6dB
11: User
bits[9:8] Surround mix level
00: 0dB
01: -3dB
10: -6dB
11: User

52
bits[7:6] Dolby surround mode
00: No indication
01: No Dolby Surround encoding
10: Dolby Surround encoding
bits[5:0] all ‘0’.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_SUPPORTED
MMAC_AUDIO_FAIL

Description
This function gets AC3 stream status and channel configuration.

See Also
None.

Sample Code
< tba >

53
MMAC_AUDIO_GetAAUHeaderStatus

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetAAUHeaderStatus(
MMAC_AUDIO_AAU_HEADER *aauheader
);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
aauheader Pointer to structure of AAU header

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_NOT_SUPPORTED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_FAIL

Description
This function gets AAU header status.
Now, only the AAU header status of MPEG is acquirable.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

54
MMAC_AUDIO_GetAC3HeaderStatus

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetAC3HeaderStatus(
MMAC_AUDIO_AC3_HEADER_STATUS *ac3header
);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
ac3header Pointer to structure of AC-3 header.

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_NOT_SUPPORTED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_FAIL

Description
This function gets AC-3 header status.
Now, only the AC-3 header status of the part of all AC-3 status is acquirable.
This function returns MMAC_AUDIO_NOT_SUPPORTED, if the Audio Firmware does not correspond
to AC-3 decoding.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

55
MMAC_AUDIO_SetRefStc

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetRefStc(
MMAC_AUDIO_REF_STC audio0stc,
MMAC_AUDIO_REF_STC audio1stc
);

Includes
#include “mmac/audio.h”

Inputs
audio0stc STC which should be referred by Audio channel0.
audio1stc STC which should be referred by Audio channel1.

Outputs
None

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_INVALID_PARAM

Description
This function sets referenced STC for audio channel 0 and 1.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

56
MMAC_AUDIO_SetSPDIFChannelStatus

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetSPDIFChannelStatus(
MMAC_AUDIO_SPDIF_CHANNEL_STATUS *channel_status
);

Includes
#include “mmac/audio.h”

Inputs
channel_status Pointer to structure of S/PDIF channel status

Outputs
None

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_FAIL
MMAC_AUDIO_NOSEMAPHORE_AVAILABLE

Description
This function sets S/PDIF channel status.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

57
MMAC_AUDIO_GetSPDIFChannelStatus

Function Prototype
MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetSPDIFChannelStatus(
MMAC_AUDIO_SPDIF_CHANNEL_STATUS *channel_status
);

Includes
#include “mmac/audio.h”

Inputs
None

Outputs
channel_status Pointer to structure of S/PDIF channel status

Event Notification
N/A

Return Codes
MMAC_AUDIO_OK
MMAC_AUDIO_NOT_INITIALISED
MMAC_AUDIO_NOT_CONFIGURED
MMAC_AUDIO_INVALID_PARAM
MMAC_AUDIO_NOSEMAPHORE_AVAILABLE

Description
This function sets S/PDIF channel status.
The function MMAC_AUDIO_Initialise() must be called at first, otherwise MMAC_AUDIO_NOT_
INITIALISED will be returned.
The function MMAC_AUDIO_SetConfiguration() must then be called, otherwise MMAC_AUDIO_
NOT_CONFIGURED will be returned.

See Also
MMAC_AUDIO_SetConfiguration
MMAC_AUDIO_Initialise

Sample Code
< tba >

58
3 Type Definitions

Includes

#include “mmac/audio.h”

Definitions

typedef enum
{
MMAC_AUDIO_OK = 0,
MMAC_AUDIO_ALREADY_STARTED,
MMAC_AUDIO_ALREADY_STOPPED,
MMAC_AUDIO_DECODER_BUSY,
MMAC_AUDIO_INVALID_CALLBACK,
MMAC_AUDIO_OUT_OF_RANGE,
MMAC_AUDIO_NOT_INITIALISED,
MMAC_AUDIO_INVALID_PARAM,
MMAC_AUDIO_NOT_CONFIGURED,
MMAC_AUDIO_ALREADY_INITIALISED,
MMAC_AUDIO_MUTED,
MMAC_AUDIO_FAIL,
MMAC_AUDIO_INVALID_FORMAT,
MMAC_AUDIO_NOT_SUPPORTED,
MMAC_AUDIO_NOSEMAPHORE_AVAILABLE
} MMAC_AUDIO_RESULT_CODE;

typedef enum
{
MMAC_AUDIO_MONO = 0x01,
MMAC_AUDIO_STEREO,
MMAC_AUDIO_LEFT_TO_BOTH,
MMAC_AUDIO_RIGHT_TO_BOTH,
MMAC_AUDIO_AUTOMATIC
} MMAC_AUDIO_CHANNELS;

typedef enum
{
MMAC_AUDIO_ASYNC,
MMAC_AUDIO_SYNC
} MMAC_AUDIO_STARTUP_MODE;

typedef enum
{
MMAC_AUDIO_STEREO_STREAM = 0x00,
MMAC_AUDIO_JOINT_STEREO_STREAM,
MMAC_AUDIO_DUAL_CHANNEL_STREAM,
MMAC_AUDIO_SINGLE_CHANNEL_STREAM,
MMAC_AUDIO_NO_STREAM
} MMAC_AUDIO_STREAM;

59
typedef enum
{
MMAC_AUDIO_NO_OUTPUT = 0,
MMAC_AUDIO_MPEG_ONLY = 1,
MMAC_AUDIO_TONE_ONLY = 4,
MMAC_AUDIO_MPEG_AND_EXT = 3,
MMAC_AUDIO_MPEG_AND_TONE= 5,
MMAC_AUDIO_MPEG_EXT_TONE= 7
} MMAC_AUDIO_MIX;

typedef enum
{
MMAC_AUDIO_BITWIDTH16 =0,
MMAC_AUDIO_BITWIDTH18 =1,
MMAC_AUDIO_BITWIDTH20 =2,
MMAC_AUDIO_BITWIDTH24 =3
} MMAC_AUDIO_BITWIDTH;

typedef enum
{
MMAC_AUDIO_SAMPLE_FREQ_16K,
MMAC_AUDIO_SAMPLE_FREQ_32K,
MMAC_AUDIO_SAMPLE_FREQ_22K05,
MMAC_AUDIO_SAMPLE_FREQ_24K,
MMAC_AUDIO_SAMPLE_FREQ_44K1,
MMAC_AUDIO_SAMPLE_FREQ_48K,
MMAC_AUDIO_SAMPLE_FREQ_AUTO
} MMAC_AUDIO_SAMPLE_FREQ;

typedef enum
{
MMAC_AUDIO_BITRATE_CLK32 =0,
MMAC_AUDIO_BITRATE_CLK48 =1,
MMAC_AUDIO_BITRATE_CLK64 =2
} MMAC_AUDIO_BITRATE_CLK;

typedef enum
{
MMAC_AUDIO_FS_384, /* indicate audio master clock is 384 */
MMAC_AUDIO_FS_256, /* indicate audio master clock is 256 */
MMAC_AUDIO_FS_512 /* indicate audio master clock is 256 */
} MMAC_AUDIO_FS;

typedef struct
{
MMAC_AUDIO_STARTUP_MODE startUpMode;
MMAC_AUDIO_CHANNELS steering;
MMAC_AUDIO_STREAM streamStatus;
MMAC_AUDIO_MIX outputMix;
MMAC_AUDIO_BITWIDTH bitWidth;
MMAC_AUDIO_BITRATE_CLK bitsPerSecond;
MMAC_AUDIO_FS fs;
MMAC_AUDIO_SAMPLE_FREQ frequency;
} MMAC_AUDIO_CONFIGURATION;

60
typedef struct
{
UI16 frequency;
I8 level;
} MMAC_AUDIO_TONEINFO;

/*************************************************************
in EMMA2 user manual
tone frequency is depend on audio output frequency.

when audio output frequency is 16KHz , available tone frequency is from


15.62Hz to 1984.37Hz
when audio output frequency is 32KHz , available tone frequency is from
31.25Hz to 3968.75Hz
when audio output frequency is 22.05KHz, available tone frequency is from
21.53Hz to 2734.72Hz
when audio output frequency is 44.10KHz, available tone frequency is from
43.06Hz to 5469.43Hz
when audio output frequency is 24KHz , available tone frequency is from
23.43Hz to 2976.56Hz
when audio output frequency is 48KHz , available tone frequency is from
46.87Hz to 5953.13Hz

therefore commonly available is from 47Hz to 1984Hz


actually use is 93Hz to 1984Hz
*************************************************************/

#define MMAC_AUDIO_MIN_FREQ (0x05d)


#define MMAC_AUDIO_MAX_FREQ (0x7c0)
#define MMAC_AUDIO_MAX_TONE_FREQ_REGISTER (0x7f)

#define MMAC_AUDIO_MAX_VOLUME (0x55)

#define MMAC_AUDIO_MPEG_MIX (0x01)


#define MMAC_AUDIO_PCM_MIX (0x02)
#define MMAC_AUDIO_TONE_MIX (0x04)

/****************************************************************
* For Audio Output setting selection
****************************************************************/
typedef enum
{
MMAC_AUDIO_OUTPUTSELECT_SPDIF_LR = 0x00,
MMAC_AUDIO_OUTPUTSELECT_SPDIF_MIX = 0x01,
MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM0 = 0x02,
MMAC_AUDIO_OUTPUTSELECT_SPDIF_STREAM1 = 0x03
} MMAC_AUDIO_OUTPUTSELECT_SPDIF;

typedef enum
{
MMAC_AUDIO_OUTPUTSELECT_PCM1_MIX = 0x00,
MMAC_AUDIO_OUTPUTSELECT_PCM1_LR = 0x01
} MMAC_AUDIO_OUTPUTSELECT_PCM1;

61
typedef enum
{
MMAC_AUDIO_OUTPUTSELECT_PCM2_SLSR = 0x00,
MMAC_AUDIO_OUTPUTSELECT_PCM2_MIX = 0x01
} MMAC_AUDIO_OUTPUTSELECT_PCM2;

typedef struct
{
MMAC_AUDIO_OUTPUTSELECT_SPDIF spdifout;
MMAC_AUDIO_OUTPUTSELECT_PCM1 pcm1out;
MMAC_AUDIO_OUTPUTSELECT_PCM2 pcm2out;
} MMAC_AUDIO_OUTPUT_SELECTOR;

/****************************************************************
* For Audio Input setting selection
****************************************************************/

typedef enum
{
MMAC_AUDIO_CODED_AUDIO0_PLAY = 0x00, /* audio decoder launch
stream from stream0 */
MMAC_AUDIO_CODED_AUDIO1_PLAY = 0x01, /* audio decoder launch
stream from stream1 */
MMAC_AUDIO_EXT_CODED_AUDIO_PLAY = 0x02 /* audio decoder launch
stream from spdif */
} MMAC_AUDIO_INPUT_PLAYTYPE;

typedef enum
{
MMAC_AUDIO_CODED_AUDIO_TYPE_PES = 0x00,
MMAC_AUDIO_CODED_AUDIO_TYPE_MPEG = 0x01,
MMAC_AUDIO_CODED_AUDIO_TYPE_PS_PES = 0x02
} MMAC_AUDIO_INPUT_CODED_AUDIO_TYPE;

typedef struct
{
MMAC_AUDIO_INPUT_PLAYTYPE playsel;
MMAC_AUDIO_INPUT_CODED_AUDIO_TYPE audio0type;
MMAC_AUDIO_INPUT_CODED_AUDIO_TYPE audio1type;
} MMAC_AUDIO_INPUT_SELECTOR;

/****************************************************************
* For Select decoder mode
****************************************************************/
typedef enum
{
MMAC_AUDIO_DECODE_MODE_MPEG,
MMAC_AUDIO_DECODE_MODE_MP3,
MMAC_AUDIO_DECODE_MODE_AC3_2CH,
MMAC_AUDIO_DECODE_MODE_AC3_5CH,
MMAC_AUDIO_DECODE_MODE_LPCM_2CH,
MMAC_AUDIO_DECODE_MODE_LPCM_6CH
} MMAC_AUDIO_DECODE_MODE;

62
typedef enum
{
MMAC_AUDIO_THROUGH_MODE_MPEG,
MMAC_AUDIO_THROUGH_MODE_AAC,
MMAC_AUDIO_THROUGH_MODE_AC3,
MMAC_AUDIO_THROUGH_MODE_DTS,
MMAC_AUDIO_THROUGH_MODE_MP3,
MMAC_AUDIO_THROUGH_MODE_NONE
} MMAC_AUDIO_THROUGH_MODE;

/*******************************************
* For Notification
*******************************************/
typedef enum
{
MMAC_AUDIO_CALLBACK_STREAMFULLINTERRUPT =0x01, /* class of
StreamDMA interrupt. argument is stream0 or stream1 */
MMAC_AUDIO_CALLBACK_STREAMNEARFULLINTERRUPT =0x02, /* class of
StreamDMA interrupt. argument is stream0 or stream1 */
MMAC_AUDIO_CALLBACK_STREAMNEAREMPTYINTERRUPT=0x03, /* class of
StreamDMA interrupt. argument is stream0 or stream1 */
MMAC_AUDIO_CALLBACK_STREAMEMPTYINTERRUPT =0x04, /* class of
StreamDMA interrupt. recommend not use this type */
MMAC_AUDIO_CALLBACK_AUDIOFIRMWAREERROR =0x05, /* class of
AUDIOFWError. argument not available */
MMAC_AUDIO_CALLBACK_PESINTERRUPT =0x06 /* class of
AUDIOFWPES. argument not available */
} MMAC_AUDIO_CALLBACK_EVENT;

typedef void (*MMAC_AUDIO_CALLBACK_FUNCTION)(UI32 argument);

typedef struct{
MMAC_BOOL id;
UI8 layer;
MMAC_BOOL protection;
UI8 bitrate_index;
UI8 freq_index;
MMAC_BOOL padding;
MMAC_BOOL private_bit;
UI8 mode;
UI8 extension;
MMAC_BOOL copyright;
MMAC_BOOL original_copy;
UI8 emphasis;
} MMAC_AUDIO_AAU_HEADER;

typedef struct {
UI8 fscod;
UI8 frmsizecod;
UI8 bsid;
UI8 bsmod;
UI8 acmod;
UI8 cmixlev;
UI8 surmixlev;
UI8 dsurmod;
UI8 lfeon;
UI8 langcod;
MMAC_BOOL audprodie;
UI8 mixlevel;
UI8 roomtyp;
UI8 langcod2;
MMAC_BOOL audprodi2e;
UI8 mixlevel2;
UI8 roomtyp2;

63
MMAC_BOOL copyrightb;
MMAC_BOOL origbs;
} MMAC_AUDIO_AC3_HEADER;

typedef struct{
UI8 streamid;
} MMAC_AUDIO_PES_INFO;

typedef enum
{
MMAC_AUDIO_REF_STC1,
MMAC_AUDIO_REF_STC2
} MMAC_AUDIO_REF_STC;

typedef struct
{
UI8 nControl;
UI8 nMode;
UI8 nCategoryCode;
UI8 nSource;
UI8 nChannelNumber1;
UI8 nChannelNumber2;
UI8 nFs;
UI8 nClockAccuracy;
UI8 nWordLength;
} MMAC_AUDIO_SPDIF_CHANNEL_STATUS;

/****************************************************************/
/* EXPORTED FUNCTIONS */
/****************************************************************/
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Initialise(void) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetConfiguration
( MMAC_AUDIO_CONFIGURATION *config) ;
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_GetConfiguration( MMAC_AUDIO_CONFIGURATION *config ) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Decode(MMAC_BOOL enableFlag) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Mute(MMAC_BOOL muteFlag) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetVolume( UI16 volumeLeft, UI16
volumeRight ) ;
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_TestToneEnable( MMAC_AUDIO_TONEINFO *toneInfo ) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_TestToneDisable(void) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Reset(void) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_SetOutputSelector
( MMAC_AUDIO_OUTPUT_SELECTOR *select ) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetOutputSelector
( MMAC_AUDIO_OUTPUT_SELECTOR *select ) ;
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_SetInputSelector(MMAC_AUDIO_INPUT_SELECTOR *select ) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetInputSelector
( MMAC_AUDIO_INPUT_SELECTOR *select ) ;
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_Notify (MMAC_AUDIO_CALLBACK_EVENT
event, MMAC_AUDIO_CALLBACK_FUNCTION function ) ;
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_SelectDecoderMode(MMAC_AUDIO_DECODE_MODE
mode1,MMAC_AUDIO_THROUGH_MODE mode2);
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_GetAAUHeaderStatus( MMAC_AUDIO_AAU_HEADER *aauheader );
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_GetAC3HeaderStatus( MMAC_AUDIO_AC3_HEADER *ac3header );
extern MMAC_AUDIO_RESULT_CODE MMAC_AUDIO_GetPesStatus( MMAC_AUDIO_PES_INFO
*pesinfo );

64
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_GetSPDIFChannelStatus( MMAC_AUDIO_SPDIF_CHANNEL_STATUS
*channel_status );
extern MMAC_AUDIO_RESULT_CODE
MMAC_AUDIO_SetSPDIFChannelStatus( MMAC_AUDIO_SPDIF_CHANNEL_STATUS
*channel_status );

65
4 Revision History
Title: API Specification: Audio
Ref: API_Audio.doc

Date Doc API Details of change Ref.


Ver. Ver.
0.01 Initial Revision. J-SH
J-HN
0.02 Name changed EMMA2_xxxx -> MMAC_xxxx_V2 etc.
0.03 Some function prototype and description is changed.
Functionally limitation of audio API toward Enhanced
MultiMedia Architecture ver. 1.
0.04 Description of many functions modified by implementation.
Also following MMAC input. Function to record external
input data added.
0.05 Functionality of PCM handling from AUDIO API removed.
Some AUDIO API descriptions changed.
0.06 Addition of some limitation about TONE and modification of
some API description. Revision history abridged.
0.07 Fatal problem regarding Channel Change in AUDIO API
spec. - API spec modified to include the problem.
Majorchange: TONE and PCM is available after decoder
started. TONE and PCM also stopped by decoder stop.
Delete PausePlay and ContinuePlay functionality same as
MMAC_AUDIO_Decode. Change callback identify symbol
to only use upper-character. Description about
MMAC_AUDIO_Notify added. Update enum variable of
MMAC_AUDIO_STARTUP_MODE.
0.08 Addition of error code of MMAC_AUDIO_GetStatus, when
audio is not configured. Removed 3 limitations and added 1
limitation to avoid audio problem.
0.09 Addition of limitation. Deletion of Firmware Related three-
function from MMAC request. Revision history abridged.
Modification of audio.h. Removal of description of user not
necessary. Update to description of some functions.
Changes to specification of
MMAC_AUDIO_SetRateconvFilter().
0.10 Modified API document by MMAC request. Addition of
description for argument of MMAC_AUDIO_Notify and
addition of limitation for it.
0.11 delete bit width parameter of MMAC_AUDIO_BITWIDTH8
and Modified sample source about
MMAC_AUDIO_SetVolume(). Addition of description of bit
rate clock and audio master clock. Update mix mode
definition by hardware specification.
0.12 MMAC_AUDIO_SetRateconvFilter function as this function
is only internally used in RAM AUDIO API . Add description
of data type. and Add description from view of
implementation. Modify the member name of
MMAC_AUDIO_INPUT_SELECTOR to remove
underscore.

66
Date Doc API Details of change Ref.
Ver. Ver.
15-09-01 0.13 Add description of audio synchronisation when VIDEO API
control audio API synchronisation. AUDIO API is modified
to acquire semaphore in HISR and can return error code.
07-08-02 0.14 Doc reformatted. M-RI
2002-10-01 0.15 Removed device applicability, calling modes and M-RL
atchitectural overview sections.
2002-12-09 1.0 For release – same as v0.15 M-RJI
2003-06-26 1.1 Doc number added. Same as v1.0 M-RJI
2004-02-10 1.11 Added description for new function. M-HG
MMAC_AUDIO_Pause(), MMAC_AUDIO_SetVolumeEx(),
MMAC_AUDIO_GetAAUheaderMPEG(),
MMAC_AUDIO_GetAAUheaderMP3(),
MMAC_AUDIO_GetAC3StreamStatus(),
MMAC_AUDIO_GetAAUHeaderStatus(),
MMAC_AUDIO_GetAC3HeaderStatus(),
MMAC_AUDIO_GetPesStatus(),
MMAC_AUDIO_SetRefStc(),
MMAC_AUDIO_GetSPDIFChannelStatus(),
MMAC_AUDIO_SetSPDIFChannelStatus().
2004-02-11 1.2 Format check for issue. M-RJI

67

You might also like