www.pudn.com > OS.rar > SACM_Decode.asm, change:2007-01-21,size:57207b
//==========================================================================
//SACM_Decode.asm: This file includes Kernel .
// It is to be prepared by design deptartment.
// name of Algorism
// Author: Arthur, SamSung,
// Date: 2003/01/28 V1.0 : Template release
//
// Note:C_DECODE_OUT_LENGTH
// 1. This template is made to facilitate the collaboration between RD5 and SA.
// 2. Consistency in programming style can benefit both parties and shorten
// the developement lead time.
// 3. Modulization can bring better integration and promote better collaboration.
// 4. Robustness design is convenient for users to adopt this algorithm.
// 5. Efficiency and Performance in coding style will enhance the core competence
// of this algorithm.
//==========================================================================
.include ..\Include\sacm.inc // for port definitions
.include ..\Include\SACM_API.inc // for Playback APIs external declarations
//must not change this Constant.inc order
.include ..\Include\Snd_ArithmConfig.inc // define compiler config const
.include ..\Include\SACM_Constant.inc // for flag / buffer constants
//================================================================
.public F_SACM_Decode_Initial_DAC
.public F_SACM_Decode_Initial_BS
.public F_SACM_Decode_Get_BS_Auto
.public F_SACM_System_Get_BS_Manual
.public F_SACM_MP3_System_Get_BS_Manual //For MP3 use xiaolei 2006/07/12
.public F_SACM_Decode_Initial_Process
.public F_SACM_Decode_Process
.public F_SACM_XXXX_Decode_Process //add only for SpeedControl xiaolei 2006/04/02
.external _GetDecodeDataFlag //xiaolei add for Decode datas end 2006/12/01
.external F_SACM_Speed_Init // in sacm.asm
.ifdef C_SND_MS02_SUPPORT
.external F_SACM_MS02_SongEvent
.endif
.ifdef C_SND_DVR_SUPPORT //for all DVR type
.public F_SACM_Encode_Process
.public F_SACM_Encode_Finish_Process
.public F_SACM_Encode_Initial_BS
.public F_SACM_Encode_Initial_Process
.public F_SACM_System_Put_BS_Manual
.external REC_STATUS //added by benwang 01.04
.external F_USER_DVR1600_EndRecord //added by benwang 01.02
.external F_USER_DVR1600_GetData // in sacm_user.asm
.external F_USER_DVR1600_WriteData
.endif
.external F_USER_GetData //xiaolei modify
.ifdef C_SND_A1600_SKIPPLAY_SUPPORT
.external _ulFrame_Count
.else
.ifdef C_SND_A1800_SKIPPLAY_SUPPORT
.external _ulFrame_Count
.endif
.endif
//.external BITRATE //mgl 2005/03/15 for not 005rom
.ifdef C_SND_A1600_SUPPORT
.external DVR1600_Play_Init //for DVR160020051027 lib xiaolei 2006/04/02
.external DVR1600_Play_Proc
.endif
.ifdef C_SND_DVR1600_SUPPORT
.external DVR1600_Rec_Init
.external DVR1600_Rec_Proc
.external DVR1600_Rec_Endp
.endif
.if 0
.ifdef C_SND_A4800_SUPPORT
.external __f_r083_ac8_decode_init
.external __f_r083_ac8_decode
.endif
.endif
.ifdef C_SND_MS01_SUPPORT
.external MS01_Dec_Init
.external MS01_DEC_PROC
.endif
.ifdef C_SND_MS02_SUPPORT
.external F_SACM_MS02_MIDI_Initial //zgq
.external F_SACM_MS02_MIDI_Play //zgq
.external F_SACM_MS02_MIDI_ServiceLoop //zgq
.endif
.ifdef C_SND_S200_SUPPORT
.external S200_DEC_INIT
.external S200_DEC_PROC
.endif
.ifdef C_SND_S480_2_SUPPORT
.external F_S480_DEC_INIT //zgq
.external F_S480_DEC_PROC
.endif
.ifdef C_SND_CELP_SUPPORT
.external S4872_DEC_INIT
.external S4872_DEC_PROC
.endif
.ifdef C_SND_S600_SUPPORT
.external S600_DEC_PROC //mgl 2005/3/15
.external S600_TTS_PROC //mgl 2005/3/15
.endif
.ifdef C_SND_S320_SUPPORT
.external S320_DEC_INIT //2005/03/31
.external S320_DEC_PROC //2005/03/31
.external R_S320_SubFrameCounter //xiaolei add 2006/05/30
.endif
.ifdef C_SND_S530_SUPPORT
.external S530_DEC_INIT //added by benwang 2004/07/13
.external S530_DEC_PROC //added by benwang 2004/07/13
.external SubFrameNO //xiaolei add for new lib 2006/05/30
.endif
.ifdef C_SND_MP3_SUPPORT
//attention that: For different plarform 2001 or 2002
.external R_SACM_MP3_Length_L, R_SACM_MP3_Length_H //add by jacky 2006.02.14
.external F_SP_SACM_MP3_SetSampleRate
.external _ulFrame_Count_MP3 //xiaolei 2006/09/12
.external _MP3Decode_Length
.external _Snd_MP3_GetDataMode //xiaolei add for MP3 decode error 2006/12/04
.comment @
.external R_MP3_SKIP_DATA_L, R_MP3_SKIP_DATA_H
//@
.endif
.ifdef C_SND_ETTS_SUPPORT
.external _ETTS_DEC_INIT
.external _ETTS_DEC_PROC
.endif
.ifdef C_SND_DVR4800_SUPPORT
.external __f_r083_ac8_encode_init
.external __f_r083_ac8_encode
.endif
.ifdef C_SND_DVR520_SUPPORT
.external F_DVR520_Dec_Init
.external F_DVR520_Enc_Init
.external F_DVR520_Encode
.external F_DVR520_Decode
.endif
.ifdef C_SND_DVR1800_SUPPORT
.external F_SACM_DVR1800_BITRATE
.external F_DVR1800_Dec_Init
.external F_DVR1800_Decode
.endif
.ifdef C_SND_A3200_SUPPORT
.external DVR3200_Play_Init
.external DVR3200_Play_Proc
.endif
.ifdef C_SND_DVR3200_SUPPORT
.external DVR3200_Rec_Init
.external DVR3200_Rec_Endp
.external DVR3200_Rec_Proc
.endif
.ifdef C_SND_S200TTS_SUPPORT
.external MODE
.external decvar_bit_pack_buffer
.endif
// .public OVERLAP_RAM_BLOCK_begin
// .public OVERLAP_RAM_BLOCK_end
// OVERLAP_RAM_BLOCK: .SECTION .ORAM //xiaolei delete the definition
// OVERLAP_RAM_BLOCK_end:
//-------------------------------
// OVERLAP_RAM_BLOCK_begin:
.include ..\Include\SACM_Decode_RAM.inc // all RAM variables
// OVERLAP_RAM_BLOCK_end:
//======================================================================================
//======================================================================================
//The following definition must be here, because the MaskROM Code fix the variable here
UserDefineRAM: .section .oram
.public R_SACM_Resouce_BS
.public R_SACM_Resouce_DS
R_SACM_Resouce_BS:
.dw 1 dup(?)
R_SACM_Resouce_DS:
.dw 1 dup(?)
.public R_SACM_XXXX_SpeedIndex
R_SACM_XXXX_SpeedIndex:
.dw 1 dup(?)
//for speed control only: xiaolei add for SpeedCountrol
.ifdef C_SpeedControl
.public R_SACM_XXXX_DAC_Out_PTR_Decode
.public R_SACM_XXXX_Decode_Out_Buffer
.define R_SACM_XXXX_DAC_Out_PTR_Decode R_SACM_DAC_Out_PTR_Decode
.define R_SACM_XXXX_Decode_Out_Buffer R_SACM_Decode_Out_Buffer
.endif
//end speed control only
//===================
//=================== //DVR1800 only
.ifdef C_2002_CODE_ICA
.public R_BITRATE
.var R_BITRATE
.endif
.public R_BITSOFEACHFRAME
.var R_BITSOFEACHFRAME
.public R_Frame_Count_L //added by guili2005/09/03 for A1600 tiaobo
.public R_Frame_Count_H //added by guili2005/09/03 for A1600 tiaobo
.var R_Frame_Count_L //added by guili2005/09/03 for A1600 tiaobo
.var R_Frame_Count_H
//==============================================================================
//==========xiaolei remove the definition here 2006/08/10 for 2002 Play======
//==============================================================================
//================================================================
SACM_DECODE_ROM_BLOCK: .SECTION .CODE
//****************************************************************
F_SACM_Decode_Initial_DAC: .proc
// move to system.asm and replaced with function call by arthur
retf;
.endp
//****************************************************************
// Function: F_SACM_Decode_Initial_BS
// Syntax: call F_SACM_Decode_Initial_BSs; (in assembly domain)
// Decription: Initialize bit stream for decoding
// Input: N/A
// Output: N/A
// Destory: N/A
// S200,all tts,MS01,MS02,S600 is different
//****************************************************************
F_SACM_Decode_Initial_BS: .proc
R1 = [R_CODEC_TYPE]
.ifdef C_SND_MS01_SUPPORT
cmp R1, C_CODEC_MS01;
je ?_MIDI_Branch
.endif
.ifdef C_SND_MS02_SUPPORT
cmp R1, C_CODEC_MS02;
je ?_MIDI_Branch;
.endif
jmp ?_Branch_1
.ifdef C_SND_MIDI_SUPPORT
?_MIDI_Branch:
R2 = 0xFFFF;
[R_SACM_Decode_Length_L] = R2;
R2 = 0x7FFF;
[R_SACM_Decode_Length_H] = R2;
goto ?_Continue_0;
.endif
?_Branch_1:
.ifdef C_SND_S600_SUPPORT
cmp R1, C_CODEC_S600
jne ?_Branch_0_
R2 = 0xFFFF
[R_SACM_Decode_Length_L] = R2
R2 = 0x7FFF
[R_SACM_Decode_Length_H] = R2
goto ?_Continue_0
.endif
?_Branch_0_:
.ifdef C_SND_A4800_SUPPORT
cmp R1, C_CODEC_A4800
jne ?_Branch_01;
R1 = [R_SACM_Decode_In_PTR]
R3 = [R1++] // Low_Length by Byte
R4 = [R1++] // High_Length by Byte
[R_SACM_Decode_In_PTR] = R1
R1=R4 LSR 4
R3=R3 ROR 1
R4=R4 LSR 1
[R_SACM_Decode_Length_L] = R3// Low_Length by Word
[R_SACM_Decode_Length_H] = R4// High_Length by Word
// jmp ?_Continue_0
goto ?_Continue_0 //modify by chengye 2006/9/1
.endif//C_SND_A4800_SUPPORT end
?_Branch_01:
.comment @ //delete by chengye 2006/9/13
.ifdef C_SND_DVR4800_SUPPORT
cmp R1, C_CODEC_DVR4800
jne ?_Branch_02
// count by byte
R1 = [R_SACM_Decode_In_PTR]
R3 = [R1++] // Low_Length by Byte
R4 = [R1++] // High_Length by Byte
[R_SACM_Decode_In_PTR] = R1
R1=R4 LSR 4
R3=R3 ROR 1
R4=R4 LSR 1
[R_SACM_Decode_Length_L] = R3// Low_Length by Word
[R_SACM_Decode_Length_H] = R4// High_Length by Word
goto ?_Continue_0
.endif//C_SND_DVR4800_SUPPORT end
@
?_Branch_02:
.comment @
.ifdef C_SND_A1800_SUPPORT
cmp R1, C_CODEC_A1800
jne ?_Branch_03
R1 = [R_SACM_Decode_In_PTR]
R3 = [R1++]
R4 = [R1++]
R4 = R4 LSR 1
R2 = R4 LSR 3
R3 = R3 ROR 1 //The unit of the length is word
[R_SACM_Decode_Length_L] = R3
[R_SACM_Decode_Length_H] = R4
R3 = [R1++]
R4 = [R1++]
call F_SACM_DVR1800_BITRATE //set the bitrate by r3,r4
[R_SACM_Decode_In_PTR] = R1
goto ?_Continue_0
.endif// end C_SND_A1800_SUPPORT
?_Branch_03:
.ifdef C_SND_A1800_SUPPORT //added by chengye 2006/9/5
.ifdef C_SND_A1800_SKIPPLAY_SUPPORT
cmp R1, C_CODEC_A1800_SKIP
jne ?_Branch_04
R1 = [R_SACM_Decode_In_PTR]
R3 = [R1++]
R4 = [R1++]
R4 = R4 LSR 1
R2 = R4 LSR 3
R3 = R3 ROR 1
[R_SACM_Decode_Length_L] = R3
[R_SACM_Decode_Length_H] = R4
R3 = [R1++]
R4 = [R1++]
call F_SACM_DVR1800_BITRATE //set the bitrate by r3,r4
[R_SACM_Decode_In_PTR] = R1
jmp ?_Continue_0
.endif// end C_SND_A1800_SUPPORT
.endif// end C_SND_A1800_SKIPPLAY_SUPPORT
@
?_Branch_04:
.ifdef C_SND_MP3_SUPPORT
cmp R1, C_CODEC_MP3
jne ?_Branch_05
r1=[R_SACM_MP3_Length_L]
[R_SACM_Decode_Length_L] = R1; //added by benwang 20060111
r1=[R_SACM_MP3_Length_H]
[R_SACM_Decode_Length_H] = R1; //added by benwang 20060111
R1 = [_MP3Decode_Length]
[R_SACM_Decode_Count_L] = R1
R1 = [_MP3Decode_Length + 1]
[R_SACM_Decode_Count_H] = R1
retf//goto ?_Continue_0 //xiaolei 直接将上次Decode的值赋给Decode_Count 2006/11/30
.endif// end C_SND_MP3_SUPPORT
?_Branch_05:
.ifdef C_SND_S200_SUPPORT
cmp R1, C_CODEC_S200
jne ?_Branch_06
R1 = [R_SACM_Decode_In_PTR];
R2 = [R1++];
R3 = [R1++];
R3 = R3 LSR 1;
R4 = R3 LSR 3;
R2 = R2 ROR 1;
[R_SACM_Decode_Length_L] = R2;
[R_SACM_Decode_Length_H] = R3;
R2 = [R1++];
R2 -= 1;
/////////// //jacky 0727
[0xb73]=r2
//////////[MODE] = R2;
///
R2 = [R1++];
// jacky 0512
[0x74]=r2
// [decvar_bit_pack_buffer] = R2;
//
[R_SACM_Decode_In_PTR] = R1;
jmp ?_Continue_0
.endif// end C_SND_S200_SUPPORT
?_Branch_06:
.ifdef C_SND_S200TTS_SUPPORT
cmp R1, C_CODEC_S200TTS
jne ?_Branch_0
R1 = [R_SACM_Decode_In_PTR];
R2 = [R1++];
R3 = [R1++];
R3 = R3 LSR 1;
R4 = R3 LSR 3;
R2 = R2 ROR 1;
[R_SACM_Decode_Length_L] = R2;
[R_SACM_Decode_Length_H] = R3;
R2 = [R1++];
R2 -= 1;
[MODE] = R2;
R2 = [R1++];
[decvar_bit_pack_buffer] = R2;
[R_SACM_Decode_In_PTR] = R1;
R1 = 0x0000;
[R_SACM_Decode_Count_L] = R1;
R1 = 0x0000;
[R_SACM_Decode_Count_H] = R1;
jmp ?_Continue_0
.endif
?_Branch_0:
R1 = [R_SACM_Decode_In_PTR]
R3 = [R1++]
R4 = [R1++]
R4 = R4 LSR 1
R2 = R4 LSR 3
R3 = R3 ROR 1
//*R3 = 0xFFFF; //benwang del 11.20
[R_SACM_Decode_Length_L] = R3
//*R4 = 0x7FFF; //benwang del 11.20
[R_SACM_Decode_Length_H] = R4
[R_SACM_Decode_In_PTR] = R1
?_Continue_0:
R1 = 0x0000
[R_SACM_Decode_Count_L] = R1
R1 = 0x0000
[R_SACM_Decode_Count_H] = R1
retf
.endp
//****************************************************************
// Function: F_SACM_Decode_Get_BS_Auto
// Syntax: call F_SACM_Decode_Get_BS_Auto; (in assembly domain)
// Decription: Get bit stream for auto mode decoding
// Input: N/A
// Output: N/A
// Destory: N/A
//****************************************************************
F_SACM_Decode_Get_BS_Auto: .proc
R1 = [R_SACM_Decode_In_PTR]
cmp R1, R_SACM_Decode_In_Buffer
je ?_Branch_0
//cmp R1, R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH
R2 = [R_DECODE_IN_LENGTH]
R2 += R_SACM_Decode_In_Buffer
cmp R1, R2
jl ?_Branch_1
R1 = R_SACM_Decode_In_Buffer
[R_SACM_Decode_In_PTR] = R1
jmp ?_Branch_2
?_Branch_1:
R2 = R_SACM_Decode_In_Buffer
//R3 = R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH
R3 = [R_DECODE_IN_LENGTH]
R3 += R_SACM_Decode_In_Buffer
?_Loop_0:
R4 = [R1++]
[R2++] = R4
cmp R1, R3
jne ?_Loop_0
[R_SACM_Decode_In_PTR] = R2
?_Branch_2:
R2 = [R_SACM_Resouce_BS]
R3 = [R_SACM_Resouce_DS]
R4 = [R_SACM_Decode_In_PTR]
//R5 = R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH
R5 = [R_DECODE_IN_LENGTH]
R5 += R_SACM_Decode_In_Buffer
?_Loop_1:
SR = R3
R1 = D:[R2++]
[R4++] = R1
cmp R2, 0x0000
jne ?_Branch_3
R3 += 0x0400;
?_Branch_3:
cmp R4, R5;
jne ?_Loop_1;
[R_SACM_Resouce_BS] = R2;
[R_SACM_Resouce_DS] = R3;
R1 = R_SACM_Decode_In_Buffer;
[R_SACM_Decode_In_PTR] = R1;
?_Branch_0:
retf;
.endp
//****************************************************************
// Function: F_SACM_System_Get_BS_Manual
// Syntax: call F_SACM_System_Get_BS_Manual; (in assembly domain)
// Decription: manual mode kernal APIs
// Input: N/A
// Output: N/A
// Destory: R1-R4
//****************************************************************
F_SACM_System_Get_BS_Manual: .proc
F_SACM_MP3_System_Get_BS_Manual: //For MP3 use also xiaolei add 2006/07/12
R1 = [R_SACM_Decode_In_PTR]
cmp R1, R_SACM_Decode_In_Buffer
je ?_Branch_0
//cmp R1, R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH
R2 = [R_DECODE_IN_LENGTH]
R2 += R_SACM_Decode_In_Buffer
cmp R1, R2
jl ?_Branch_1
R1 = R_SACM_Decode_In_Buffer
R2 = [R_CODEC_TYPE]
.ifdef C_SND_A1600_SUPPORT //2005.10.18 guili added for A1600 skip play
.ifdef C_SND_A1600_SKIPPLAY_SUPPORT
cmp R2,C_CODEC_A1600_Skip
jnz ?L_NotA1600SkipFirstReadData
R1 += 3
?L_NotA1600SkipFirstReadData:
.endif
.endif //2005.10.18 added end
.ifdef C_SND_A1800_SKIPPLAY_SUPPORT
cmp R2,C_CODEC_A1800_SKIP
jnz ?L_NotA1800SkipFirstReadData
R1 += 3 //2007/01/16
?L_NotA1800SkipFirstReadData:
.endif
[R_SACM_Decode_In_PTR] = R1
jmp ?_Branch_2
?_Branch_1:
R2 = R_SACM_Decode_In_Buffer
//R3 = R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH
R3 = [R_DECODE_IN_LENGTH]
R3 += R_SACM_Decode_In_Buffer
?_Loop_0:
R4 = [R1++];
[R2++] = R4;
cmp R1, R3;
jne ?_Loop_0;
[R_SACM_Decode_In_PTR] = R2;
?_Branch_2:
R1 = [R_SACM_Decode_In_PTR];
//R2 = R_SACM_Decode_In_Buffer + C_DECODE_IN_LENGTH;
R2 = [R_DECODE_IN_LENGTH]
R2 += R_SACM_Decode_In_Buffer
R2 -= R1;
// parameter: R1 = R_SACM_Decode_In_Buffer,
// R2 = C_DECODE_IN_LENGTH
// return with R_SACM_Decode_In_Buffer filled
.ifdef C_SND_DVR_SUPPORT
R3 = [REC_STATUS] //added by benwang 01.04
cmp R3, 0 //added by benwang 01.04
je ?_normal_GetData //cfwei20050103
?_DVR_GetData: //added by benwang 01.04
call F_USER_DVR1600_GetData //added by benwang 01.04
jmp ?_Continue_0 //added by benwang 01.04
.endif //C_SND_DVR_SUPPORT
?_normal_GetData:
push R1, R5 to [sp]
push R8, R15 to [sp]
call F_USER_GetData //added by benwang 01.04
pop R8, R15 from [sp]
pop R1, R5 from [sp]
?_Continue_0:
R1 = R_SACM_Decode_In_Buffer;
[R_SACM_Decode_In_PTR] = R1;
?_Branch_0:
retf;
.endp
//****************************************************************
// Function: F_SACM_Decode_Initial_Process
// Syntax: call F_SACM_Decode_Initial_Process; (in assembly domain)
// Decription: Initialize decode process
// Input: N/A
// Output: N/A
// Destory: N/A
//****************************************************************
F_SACM_Decode_Initial_Process: .proc
R1 = [R_CODEC_TYPE]
DS = SEG T_SACM_Decode_Initial_Process
R1 += OFFSET T_SACM_Decode_Initial_Process
R2 = DS:[R1]
R1 = SR
push r1,r2 to [sp]
retf
.endp
//========== T_SACM_Decode_Initial_Process start ==========
//don't change function order,and must put function with table in one page
T_SACM_Decode_Initial_Process:
.dw F_SACM_Decode_Init_MS01 //MS01 0
.dw F_SACM_Decode_Init_MS02 //MS02 1
.dw F_SACM_Decode_Init_A1600 //A1600 2
.dw F_SACM_Decode_Init_S200 //S200 3
.dw F_SACM_Decode_Init_S200TTS //S200TTS 4
.dw F_SACM_Decode_Init_S320 //S320 5
.dw F_SACM_Decode_Init_S320 //S320TTS 6
.dw F_SACM_Decode_Init_S480 //S480 7
.dw F_SACM_Decode_Init_S530 //S530 8
.dw F_SACM_Decode_Init_S480 //S600 9
.dw F_SACM_Decode_Init_S600TTS //S600TTS 10
.dw F_SACM_Decode_Init_S720 //S720 11
.dw F_SACM_Decode_Init_S480_2 //S480_2 12
.dw 0 //DVR 13
.dw F_SACM_Decode_Init_A1600 //DVR1600PLAY 14
.dw F_SACM_Decode_Init_A4800 //A4800 15
.dw F_SACM_Decode_Init_MP3 //SMP3 16
.dw F_SACM_Decode_Init_ETTS //ETTS 17
.dw 0 //CTTS 18
.dw 0 //CTTS_ETTS 19
.dw F_SACM_Decode_Init_A1600 //A1600Skip 20
.dw F_SACM_Decode_Init_DVR520 //DVR520 21
// .dw F_SACM_Decode_Init_DVR4800 //DVR4800 22
.dw 0 //DVR4800 22 //modify by chengye 2006/9/13
.dw F_SACM_Decode_Init_A1800 //A1800 23
.dw 0 //DVR1800 24
.dw F_SACM_Decode_Init_A3200 //A3200 25
.dw F_SACM_Decode_Init_A1800 //A1800_SKIP 26
F_SACM_Decode_Init_MS01:
.ifdef C_SND_MS01_SUPPORT
r1 = 160;
[R_DAC_OUT_LENGTH] = r1;
/////////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x032
r4=0x01
call mr
pop r3,r4 from [sp]
///////////////////////////
//call MS01_Dec_Init
.endif
retf
F_SACM_Decode_Init_MS02:
.ifdef C_SND_MS02_SUPPORT
R1 = 160; //move from kernel by benwang 01.08
[R_DAC_OUT_LENGTH] = R1; //move from kernel by benwang 01.08
R1 = MS02_DAC_16K; //sampling rate //added by benwang 2004/06/11
R2 = 8 //channel //added by benwang 2004/06/11
/////////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x14
r4=0x01
call mr
pop r3, r4 from [sp]
///////////////////////////
//call F_SACM_MS02_MIDI_Initial;
push r3, r4 to [sp]
r3=0x12
r4=0x01
call mr
pop r3,r4 from [sp]
//call F_SACM_MS02_MIDI_Play;
.endif
retf
F_SACM_Decode_Init_A1600:
.ifdef C_SND_A1600_SUPPORT
.ifdef C_SpeedControl
R1 = 256
.else
R1 = 128
.endif
[R_DAC_OUT_LENGTH] = R1;
.ifdef NANDBOOT_NOTEXT
//////////////////////////// //jacky 0512
// push r3,r4 to [sp]
// r3=0x04
// r4=0x01
// call mr
// pop r3,r4 from [sp]
////////////////////////////
.else
call DVR1600_Play_Init //for DVR160020051027 lib
.endif
.endif
retf
F_SACM_Decode_Init_A4800:
.ifdef C_SND_A4800_SUPPORT
.ifdef C_SND_A4800_SPEEDCONTROL_SUPPORT //added by chengye for SpeedControl 2006/9/12
R1 = 512
.else
r1 = 256
.endif
// R1 = 256 //delete by chengye 2006/9/12
[R_DAC_OUT_LENGTH] = R1;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/12
R1 = 256
[R_DECODE_OUT_LENGTH] = R1;
R1 = 256;
[R_SPEED_MAX_PITCH_LENGTH] = R1;
R1 = 12 ;
[R_SPEED_PITCH_STEP] = R1;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
R1 = __buf_r083_ac8_codec_save;
R2 = [R_SACM_Decode_In_PTR];
//modify by chengye 2006/9/1
// call __f_r083_ac8_decode_init;
push r3,r4 to[sp]
r3=0x1c
r4=0x01
call mr
pop r3,r4 from [sp]
[R_SACM_DECODE_IN_LENGTH] = R1;
R2 = [R_SACM_Decode_In_PTR];
R2 += R1;
[R_SACM_Decode_In_PTR] = R2;
.endif
retf
F_SACM_Decode_Init_S200:
.ifdef C_SND_S200_SUPPORT
push r3,r4 to [sp]
r3=0x00
r4=0x01
call mr
pop r3,r4 from [sp]
//call S200_DEC_INIT
.endif
retf
F_SACM_Decode_Init_S200TTS:
.ifdef C_SND_S200TTS_SUPPORT
// push r3,r4 to [sp]
// r3=0x00
// r4=0x01
// call mr
// pop r3,r4 from [sp]
call S200_DEC_INIT
.endif
retf
F_SACM_Decode_Init_S320:
.ifdef C_SND_S320_SUPPORT
call S320_DEC_INIT_Psuedo
//call S320_DEC_INIT
.endif
retf
F_SACM_Decode_Init_S480:
.ifdef C_SND_CELP_SUPPORT
.ifdef C_SND_S480720_SPEEDCONTROL_SUPPORT
R1 = 160;
[R_DAC_OUT_LENGTH] = R1;
call S4872_DEC_INIT
.else
r1 = 60
//r1 = 40
[R_DAC_OUT_LENGTH] = R1
call S4872_DEC_INIT
.endif
.endif
retf
F_SACM_Decode_Init_S720:
.ifdef C_SND_CELP_SUPPORT
.ifdef C_SND_S480720_SPEEDCONTROL_SUPPORT
R1 = 160;
[R_DAC_OUT_LENGTH] = R1;
call S4872_DEC_INIT
.else
r1 = 40
[R_DAC_OUT_LENGTH] = R1
call S4872_DEC_INIT
.endif
.endif
retf
F_SACM_Decode_Init_S530:
.ifdef C_SND_S530_SUPPORT
.ifdef C_SND_S530_SPEEDCONTROL_SUPPORT //added by zgq on 20050715
R1 = 160
.else //added by zgq on 20050715
R1 = 60 //added by zgq on 20050715
.endif //added by zgq on 20050715
[R_DAC_OUT_LENGTH] = R1
R1 = 128 ; //temp modified by benwang 2004/04/06, 8KHz
[R_SPEED_MAX_PITCH_LENGTH] = R1;
R1 = 6 ;
[R_SPEED_PITCH_STEP] = R1;
/////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x0e
r4=0x01
call mr
pop r3,r4 from [sp]
//R1 = 160;
//[R_DAC_OUT_LENGTH] = R1;
//call S530_DEC_INIT
.endif
retf
F_SACM_Decode_Init_S600TTS:
.ifdef C_SND_S600TTS_SUPPORT
R1 = 20;
[R_S600_Delay_Count]=R1
call CELP_DEC_INIT
.endif
retf
F_SACM_Decode_Init_S480_2:
.ifdef C_SND_S480_2_SUPPORT
call F_S480_2_DEC_INIT
.endif
retf
F_SACM_Decode_Init_MP3:
.ifdef C_SND_MP3_SUPPORT
push r3,r4 to [sp]
r3=0x020
r4=0x01
call mr
pop r3,r4 from [sp]
//call MP3_DEC_init_Psuedo; //added by benwang 20060111
// r1 = 1152; //added by benwang 20060111
// [R_DAC_OUT_LENGTH] = r1; //added by benwang 20060111
R1 = 0; //add by benwang 20060221
[F_BS] = R1; //add by benwang 20060221
R1 = 0; //add by benwang 20060221
[R_Fs_Ready] = R1; //add by benwang 20060221
[Mp3_FrameCount_L] = r1; //20060525
[Mp3_FrameCount_H] = r1; //20060525
.comment @
[R_MP3_SKIP_DATA_L] = R1 //xiaolei add for MP3 seek forward or back
[R_MP3_SKIP_DATA_H] = R1
//@
[MP3_TimeInfo] = r1; //20060525
.endif
retf
F_SACM_Decode_Init_ETTS:
.ifdef C_SND_ETTS_SUPPORT
R1 = 300
[R_DAC_OUT_LENGTH] = R1;
call _ETTS_DEC_INIT
.endif
retf
F_SACM_Decode_Init_DVR520:
.ifdef C_SND_DVR520_SUPPORT
.ifdef C_SND_DVR520_SPEEDCONTROL_SUPPORT //added by zgq 20051220
R1 = 320 //added by zgq 20051220
.else //added by zgq 20051220
r1 = 160 //added by zgq 20051220
.endif //added by zgq 20051220
[R_DAC_OUT_LENGTH] = R1 //added by zgq 20051220
CALL F_DVR520_Dec_Init //added by zgq 20051220
.endif
retf
.comment @ //delete by chengye 2006/9/13
F_SACM_Decode_Init_DVR4800:
.ifdef C_SND_DVR4800_SUPPORT
R1 = 256
[R_DAC_OUT_LENGTH] = R1;
R1 = __buf_r083_ac8_codec_save;
R2 = [R_SACM_DVR4800_Decode_In_PTR];
.if 0//modify by chengye 2006/9/1
// call __f_r083_ac8_decode_init;
.else
push r3,r4 to [sp]
r3=0x1c
r4=0x01
call mr
pop r3,r4 from [sp]
.endif
R2 = [R_SACM_DVR4800_Decode_In_PTR];
R2 += R1;
[R_SACM_DVR4800_Decode_In_PTR] = R2;
[R_SACM_DVR4800_DECODE_IN_LENGTH]=R1;
.endif
retf
@
F_SACM_Decode_Init_A1800:
.ifdef C_SND_A1800_SUPPORT
.ifdef C_SND_A1800_SPEEDCONTROL_SUPPORT
R1 = 640
.else
R1 = 320 //move from kernel by benwang 01.08
.endif
[R_DAC_OUT_LENGTH] = R1 //move from kernel by benwang 01.08
R1 = 256; //20060629
[R_SPEED_MAX_PITCH_LENGTH] = R1; //20060629
R1 = 12 ; //20060629
[R_SPEED_PITCH_STEP] = R1; //20060629
push r3,r4 to [sp]
r3=0x4e
r4=0x01
call mr
pop r3,r4 from [sp]
//CALL F_DVR1800_Dec_Init
.endif
retf
F_SACM_Decode_Init_A3200:
.ifdef C_SND_A3200_SUPPORT
.ifdef C_SND_A3200_SPEEDCONTROL_SUPPORT
R1 = 256
.else
r1 = 128
.endif
[R_DAC_OUT_LENGTH] = R1
///////////////////////// //added by chengye for Speed Control 2006/9/14
R1 = 128;
[R_SPEED_MAX_PITCH_LENGTH] = R1;
R1 = 6 ;
[R_SPEED_PITCH_STEP] = R1;
/////////////////////////
call DVR3200_Play_Init
.endif
retf
//======= T_SACM_Decode_Init_Process end ===========
//****************************************************************
// Function: F_SACM_Decode_Process
// Syntax: call F_SACM_Decode_Process; (in assembly domain)
// Decription: execute decode process
// Input: N/A
// Output: N/A
// Destory: R1-R4
//****************************************************************
F_SACM_XXXX_Decode_Process: //add only for speed control xiaolei 2006/03/31
F_SACM_Decode_Process: .proc
//-------------------------------
.ifdef C_SND_A1600_SKIPPLAY_SUPPORT
r1 = [_ulFrame_Count] //added by guili2005/09/03 for A1600 tiaobo
cmp r1,0xffff
jz ?L_HighAdd
r1 += 1
[_ulFrame_Count] = r1
jmp ?L_FrameCountEnd
?L_HighAdd:
r1 = 0
[_ulFrame_Count] = r1
r1 = [_ulFrame_Count+1]
r1 += 1
[_ulFrame_Count+1] = r1
?L_FrameCountEnd:
.else
.ifdef C_SND_A1800_SKIPPLAY_SUPPORT
r1 = [_ulFrame_Count] //added by guili2005/09/03 for A1600 tiaobo
cmp r1,0xffff
jz ?L_HighAdd
r1 += 1
[_ulFrame_Count] = r1
jmp ?L_FrameCountEnd
?L_HighAdd:
r1 = 0
[_ulFrame_Count] = r1
r1 = [_ulFrame_Count+1]
r1 += 1
[_ulFrame_Count+1] = r1
?L_FrameCountEnd:
.endif
.endif
//-------------------------------
R1 = [R_CODEC_TYPE]
.ifdef C_SND_MS01_SUPPORT
CMP R1, C_CODEC_MS01
JNE ?_NOT_MS01_Case
/////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x34
r4=0x01
call mr
pop r3,r4 from [sp]
///////////////////////
//call MS01_DEC_PROC
retf
?_NOT_MS01_Case:
.endif
.ifdef C_SND_MS02_SUPPORT
cmp R1, C_CODEC_MS02
jne ?L_Not_MIDI_Dec_Proc
push r3,r4 to [sp]
r3=0x16
r4=0x01
call mr
pop r3,r4 from [sp]
//call F_SACM_MS02_MIDI_ServiceLoop
// R1 = [R_SACM_Decode_In_PTR] //delete by chengye 2006/9/18
// R1 -= [R_SACM_DECODE_IN_LENGTH]
// [R_SACM_DECODE_IN_LENGTH] = R1
retf
?L_Not_MIDI_Dec_Proc:
.endif
.ifdef C_SND_ETTS_SUPPORT
CMP R1, C_CODEC_ETTS
JNE ?_NOT_ETTS_Case
call _ETTS_DEC_PROC
retf
?_NOT_ETTS_Case:
.endif
L_Not_MIDI_TTS_Proc:
//-- check Dec length start----
R1 = [R_SACM_Decode_Count_L]
R2 = [R_SACM_Decode_Count_H]
R1 +=[R_SACM_DECODE_IN_LENGTH]
R2 += 0, carry
[R_SACM_Decode_Count_L] = R1
[R_SACM_Decode_Count_H] = R2
R3 = [R_SACM_Decode_Length_L]
R4 = [R_SACM_Decode_Length_H]
CMP R2,R4
JB ?_Branch_0
CMP R1,R3
JB ?_Branch_0
R1 = [R_CODEC_TYPE]
.ifdef C_SND_S530_SUPPORT
CMP R1, C_CODEC_S530
jne ?_S320_Branch //added by zgq 2005/03/31
// R3 = [0x68]; // jacky 0512
R3 = [0xb78]
//R3 = [SubFrameNO]
CMP R3,0
JNE ?_Branch_0
jmp ?_Chk_Dec_Length_End //added by zgq 2005/03/31
?_S320_Branch: //added by zgq 2005/03/31
.endif
.ifdef C_SND_S320_SUPPORT
cmp R1, C_CODEC_S320 //added by zgq 2005/03/31
je ?_TTS320_Branch_Check //added by zgq 2005/03/31
cmp R1, C_CODEC_S320TTS //added by zgq 2005/03/31
JNE ?_Chk_Dec_Length_End //added by zgq 2005/03/31
?_TTS320_Branch_Check:
R1 = [R_S320_SubFrameCounter] //added by zgq 2005/03/31
jnz ?_Branch_0 //added by zgq 2005/03/31
jmp ?_Chk_Dec_Length_End //added by zgq 2005/03/31
?_S600_Branch: //added by zgq 2005/03/31
.endif
.ifdef C_SND_S600TTS_SUPPORT
R1 = [R_CODEC_TYPE]
CMP R1, C_CODEC_S600TTS
JNE ?_Chk_Dec_Length_End
//R3 = [SubFrame_NUM] //xiaolei modify for S530 new lib 2006/05/30
R3 = [SubFrameNO]
CMP R3,0
JNE ?_Branch_0
R1 = [R_S600_Delay_Count] //Delay Decoder
R1 -= 1
[R_S600_Delay_Count] = R1
JE ?_Chk_Dec_Length_End
call S600_ZERO_Decoder
RETF
.endif
.ifdef C_SND_MP3_SUPPORT
R1 = [R_CODEC_TYPE]
CMP R1, C_CODEC_MP3
jne ?_Chk_Dec_Length_End
//xiaolei add for some mp3 data wrong:这次流程之前解码的数据刚好出错,并且这次数据又刚好结束则将下面的标志位置回为0
R1 = 0x0000
[_Snd_MP3_GetDataMode] = R1
.ifdef C_2002_CODE_ICA
r1 = [0x871]; //< update stanwang,2005.11.17 >>
.else
r1=[0x1ec1]
.endif
cmp r1, 2
je ?_Chk_Dec_Length_End;
// r1 = [r_layer3_granule]; //< update stanwang,2005.09.22 >> //jacky 0512
.ifdef C_2002_CODE_ICA
r1 = [0xd39]; //< update stanwang,2005.09.22 >>
.else
r1=[0x2389]
.endif
cmp r1, 2;
jne ?_Chk_Dec_Length_End;
// r1 = [r_layer3_gr]; //jacky 0512
.ifdef C_2002_CODE_ICA
r1 = [0xda3];
.else
r1=[0x23f3]
.endif
cmp r1 , 1;
jne ?_Chk_Dec_Length_End;
jmp ?_Branch_0;
.endif
?_Chk_Dec_Length_End:
R1 = [R_SACM_Play_Flag]
R1 |= C_SACM_DECODE_END
[R_SACM_Play_Flag] = R1
retf
//-- decode proc --------------------------------
?_Branch_0:
// R1 = [R_SACM_Decode_In_PTR] //MP3 delete temparialy 2006/07/12
// [R_SACM_DECODE_IN_LENGTH] = R1
R1 = [R_CODEC_TYPE]
DS = SEG T_SACM_Decode_Process
R1 += OFFSET T_SACM_Decode_Process
R2 = DS:[R1]
R1 = DS
push r1, r2 to [sp]
retf
//-----------------------------------------------
_Continue_SACM_Decode:
R1 = [R_SACM_Decode_In_PTR]
R1 -= [R_SACM_DECODE_IN_LENGTH]
[R_SACM_DECODE_IN_LENGTH] = R1
.comment &
//xiaolei add 有时候虽然解码判断不为结束,但这时解码的数据已经不再是资源或者文件中的数据,在此处加入判断.
R1 = [_GetDecodeDataFlag]
cmp R1, 1
jne ?L_Return
call _Decode_ForceStop
?L_Return:
//&
retf
.endp
//========== T_SACM_Decode_Initial_Process start ==========
//don't change function order,and must put function with table in one page
F_SACM_Decode_Process_MS01:
.ifdef C_SND_MS01_SUPPORT
jmp $
//call MS01_DEC_PROC
.endif
JMP _Continue_SACM_Decode;
F_SACM_Decode_Process_MS02:
.ifdef C_SND_MS02_SUPPORT
jmp $
//call F_SACM_MS02_MIDI_ServiceLoop
.endif
JMP _Continue_SACM_Decode;
F_SACM_Decode_Process_A1600:
.ifdef C_SND_A1600_SUPPORT
R1 = [R_SACM_Decode_In_PTR];
[R_SACM_DECODE_IN_LENGTH] = R1;
.ifdef C_SpeedControl //added by zgq on 20051222
r1 = R_SACM_Decode_Out_Buffer; //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1; //added by zgq on 20051222
.else //added by zgq on 20051222
r1 = [R_SACM_DAC_Out_PTR_Decode]; //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1; //added by zgq on 20051222
.endif //added by zgq on 20051222
.ifdef NANDBOOT_NOTEXT
//////////////////////////// //jacky 0512
// push r3,r4 to [sp]
// r3=0x06
// r4=0x01
// call mr
// pop r3,r4 from [sp]
/////////////////////////////
.else
call DVR1600_Play_Proc //for DVR160020051027 lib xiaolei 2006/04/02
.endif
.endif
JMP _Continue_SACM_Decode
F_SACM_Decode_Process_A4800:
.ifdef C_SND_A4800_SUPPORT //modify by chengye 2006/9/12
.ifdef C_SND_A4800_SPEEDCONTROL_SUPPORT
r1 = R_SACM_Decode_Out_Buffer;
[R_SACM_Decode_Out_PTR] = r1;
.else
r1 = [R_SACM_DAC_Out_PTR_Decode];
[R_SACM_Decode_Out_PTR] = r1;
.endif
R2 = [R_SACM_DVR4800_Decode_In_PTR];
R5 = __buf_r083_ac8_codec_save;
/////////////////////
push r3,r4 to [sp]
r3=0x01e
r4=0x01
call mr
pop r3,r4 from [sp]
/////////////////////
// call __f_r083_ac8_decode_Psuedo;
.ifndef C_SND_A4800_SPEEDCONTROL_SUPPORT //20060629
R2 = [R_SACM_DVR4800_DAC_Out_PTR_Decode];
R2 += 256;
[R_SACM_DVR4800_DAC_Out_PTR_Decode] = R2;
.endif //20060629
R2 = [R_SACM_DVR4800_Decode_In_PTR];
R2 += R1;
[R_SACM_DVR4800_Decode_In_PTR] = R2;
[R_SACM_DVR4800_DECODE_IN_LENGTH]=R1;
.endif
retf
F_SACM_Decode_Process_S200:
.ifdef C_SND_S200_SUPPORT
R1 = [R_SACM_Decode_In_PTR];
[R_SACM_DECODE_IN_LENGTH] = R1;
//////////////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x02
r4=0x01
call mr
pop r3,r4 from [sp]
////////////////////////////////
//call S200_DEC_PROC
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_S200TTS:
.ifdef C_SND_S200TTS_SUPPORT
R1 = [R_SACM_Decode_In_PTR];
[R_SACM_DECODE_IN_LENGTH] = R1;
//////////////////////////////// //jacky 0512
// push r3,r4 to [sp]
// r3=0x02
// r4=0x01
// call mr
// pop r3,r4 from [sp]
////////////////////////////////
call S200_DEC_PROC
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_S320:
.ifdef C_SND_S320_SUPPORT
call S320_DEC_PROC
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_S480:
.ifdef C_SND_CELP_SUPPORT
.ifdef C_SND_S480720_SPEEDCONTROL_SUPPORT
call S4872_DEC_PROC
.else
call S4872_DEC_PROC
.endif
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_S480_2:
.ifdef C_SND_S480_2_SUPPORT
call F_S480_DEC_INIT
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_S530:
.ifdef C_SND_S530_SUPPORT
R1 = [R_SACM_Decode_In_PTR];
[R_SACM_DECODE_IN_LENGTH] = R1;
.ifdef C_SND_S530_SPEEDCONTROL_SUPPORT //added by zgq on 20051222
r1 = R_SACM_S530_Decode_Out_Buffer; //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1; //added by zgq on 20051222
.else //added by zgq on 20051222
r1 = [R_SACM_DAC_Out_PTR_Decode];//added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1; //added by zgq on 20051222
.endif //added by zgq on 20051222
///////////////////////////// //jacky 0512
push r3,r4 to [sp]
r3=0x010
r4=0x01
call mr
pop r3,r4 from [sp]
//////////////////////////////
//call S530_DEC_PROC
.endif
// JMP _Continue_SACM_Decode
goto _Continue_SACM_Decode //modify by chengye 2006/9/1
F_SACM_Decode_Process_S600:
.ifdef C_SND_S600_SUPPORT
call S600_DEC_PROC
.endif
// JMP _Continue_SACM_Decode
goto _Continue_SACM_Decode //modify by chengye 2006/9/1
F_SACM_Decode_Process_MP3:
.ifdef C_SND_MP3_SUPPORT
//xiaolei add the following two sentences 2006/08/09 for Decode to only one buffer
r1 = [R_SACM_DAC_Out_PTR_Decode];//added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1
R1 = [R_SACM_MP3_Decode_In_PTR]; //added by benwang 20060111
[R_SACM_MP3_DECODE_IN_LENGTH] = R1; //added by benwang 20060111
r1 = 0; //< update stanwang,2006.01.23 >> //add by benwang 20060209
// [_r_DEC_PROC_pcm_ready] = r1; //add by benwang 20060209 //jacky 0512
.ifdef C_2002_CODE_ICA
[0xca7] = r1; //add by benwang 20060209
.else
[0x22f7]=r1 //For 2002 Code
.endif
////////////////// //jacky 0512
push r3,r4 to [sp]
r5 = fr
push R5 to [sp]
r3=0x22
r4=0x01
call mr
pop R5 from [sp]
fr = r5
pop r3,r4 from [sp]
//CALL MP3_DEC_PROC_Psuedo //added by benwang 20060111
//////////////////
//add by benwang start 20060209
cmp r1 , 1; //< update stanwang,2005.10.05--if fail,refill dec_in_buf and decode again >>
je ?_L2;
//xiaolei add for MP3 Decoding Error: 对于某些MP3来说, 解码到中途的时候会出现解码出错的问题,
//这时就退出解码并置解码结束的标志位 2006/11/23
.ifdef C_SND_MP3_DECODEERROR
R1 = [R_SACM_Play_Flag]
R1 |= C_SACM_DECODE_END
[R_SACM_Play_Flag] = R1
goto _Continue_SACM_Decode
.else
//.comment #
R1 = 0x0002 //表示在MP3解码的过程中出现解码出错的问题,需要继续得到数据
[_Snd_MP3_GetDataMode] = R1
R1 = [R_SACM_Decode_In_PTR];
R1 -= [R_SACM_DECODE_IN_LENGTH];
[R_SACM_DECODE_IN_LENGTH] = R1;
call F_SACM_MP3_System_Get_BS_Manual;//< return r1:1() 0(dec_in_buf NOT full!) >>
goto L_Not_MIDI_TTS_Proc
//#
.endif
?_L2:
R1 = 0x0000
[_Snd_MP3_GetDataMode] = R1
//add by benwang end 20060209
r1 = 1; //< update stanwang,2006.01.23 >> //add by benwang 20060209
// [_r_DEC_PROC_pcm_ready] = r1; //add by benwang 20060209 //jacky 0512
.ifdef C_2002_CODE_ICA
[0xca7] = r1; //add by benwang 20060209
.else
[0x22f7]=r1
.endif
R1 = [R_Fs_Ready]; //add by benwang 20060221
cmp R1, 0; //add by benwang 20060221
jne ?_Fs_Ready; //add by benwang 20060221
call F_SP_SACM_MP3_SetSampleRate; //added by benwang 20060111
R1 = 1; //add by benwang 20060221
[R_Fs_Ready] = R1; //add by benwang 20060221
?_Fs_Ready: //add by benwang 20060221
// call MP3_DEC_PROC
.endif //C_SND_MP3_SUPPORT end
//xiaolei add for MP3 Time DisPlay Normal 2006/09/12 only used for MP3, So Put these sentences here
.ifdef C_SND_MP3_SUPPORT
//For External C Use:
R1 = [R_SACM_Decode_In_PTR];
R1 -= [R_SACM_DECODE_IN_LENGTH];
r2 = [_ulFrame_Count_MP3]
cmp r2,0xffff
jz ?L_HighAdd_MP3
r2 += r1
[_ulFrame_Count_MP3] = r2
jmp ?L_FrameCountEnd_MP3
?L_HighAdd_MP3:
r2 = 0
[_ulFrame_Count_MP3] = r2
r2 = [_ulFrame_Count_MP3 + 1]
r2 += 1
[_ulFrame_Count_MP3 + 1] = r2
?L_FrameCountEnd_MP3:
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_ETTS:
.ifdef C_SND_ETTS_SUPPORT
call _ETTS_DEC_PROC
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_DVR520:
.ifdef C_SND_DVR520_SUPPORT
R1 = [R_SACM_Decode_In_PTR]; //added by chengye 2006/9/14
[R_SACM_DECODE_IN_LENGTH] = R1;
.ifdef C_SND_DVR520_SPEEDCONTROL_SUPPORT //xiaoloei modify 2006/04/01
r1 = R_SACM_Decode_Out_Buffer //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.else //added by zgq on 20051222
r1 = [R_SACM_DAC_Out_PTR_Decode]//added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.endif //added by zgq on 20051222
call F_DVR520_Decode //added by zgq on 20051220
.endif
goto _Continue_SACM_Decode
.comment @
F_SACM_Decode_Process_DVR4800:
.ifdef C_SND_DVR4800_SUPPORT
R1 = [R_SACM_DVR4800_DAC_Out_PTR_Decode]
R2 = [R_SACM_DVR4800_Decode_In_PTR]
R3 = __buf_r083_ac8_codec_save
//modify by chengye 2006/9/1
// call __f_r083_ac8_decode
push r3,r4 to [sp]
r3=0x1e
r4=0x01
call mr
pop r3,r4 from [sp]
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/3
R2 = [R_SACM_DVR4800_DAC_Out_PTR_Decode];
R2 += 256;
[R_SACM_DVR4800_DAC_Out_PTR_Decode] = R2;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
R2 = [R_SACM_DVR4800_Decode_In_PTR]
R2 += R1
[R_SACM_DVR4800_Decode_In_PTR] = R2
.endif
goto _Continue_SACM_Decode //xiaolei modify JMP to goto
@
F_SACM_Decode_Process_A1800:
.ifdef C_SND_A1800_SUPPORT
R1 = [R_SACM_Decode_In_PTR]
[R_SACM_DECODE_IN_LENGTH] = R1
.ifdef C_SND_A1800_SPEEDCONTROL_SUPPORT //added by zgq on 20051222
r1 = R_SACM_Decode_Out_Buffer //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.else //added by zgq on 20051222
r1 = [R_SACM_DAC_Out_PTR_Decode]//added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.endif //added by zgq on 20051222
push r3, r4 to [sp]
r3 = 0x50
r4 = 0x01
call mr
pop r3, r4 from [sp]
//CALL F_DVR1800_Decode
.endif
goto _Continue_SACM_Decode
F_SACM_Decode_Process_A3200:
.ifdef C_SND_A3200_SUPPORT
R1 = [R_SACM_Decode_In_PTR]
[R_SACM_DECODE_IN_LENGTH] = R1
.ifdef C_SND_A3200_SPEEDCONTROL_SUPPORT //added by zgq on 20051222
r1 = R_SACM_Decode_Out_Buffer //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.else //added by zgq on 20051222
r1 = [R_SACM_DAC_Out_PTR_Decode] //added by zgq on 20051222
[R_SACM_Decode_Out_PTR] = r1 //added by zgq on 20051222
.endif //added by zgq on 20051222
CALL DVR3200_Play_Proc
.endif
goto _Continue_SACM_Decode
T_SACM_Decode_Process:
.dw F_SACM_Decode_Process_MS01 //MS01 0
.dw F_SACM_Decode_Process_MS02 //MS02 1
.dw F_SACM_Decode_Process_A1600 //A1600 2
.dw F_SACM_Decode_Process_S200 //S200 3
.dw F_SACM_Decode_Process_S200TTS //S200TTS 4
.dw F_SACM_Decode_Process_S320 //S320 5
.dw F_SACM_Decode_Process_S320 //S320TTS 6
.dw F_SACM_Decode_Process_S480 //S480 7
.dw F_SACM_Decode_Process_S530 //S530 8
.dw F_SACM_Decode_Process_S600 //S600 9
.dw F_SACM_Decode_Process_S600 //S600TTS 10
.dw F_SACM_Decode_Process_S480 //S720 11
.dw F_SACM_Decode_Process_S480_2 //S480_2 12
.dw 0 //DVR 13
.dw F_SACM_Decode_Process_A1600 //DVR1600PLAY 14
.dw F_SACM_Decode_Process_A4800 //A4800 15
.dw F_SACM_Decode_Process_MP3 //SMP3 16
.dw F_SACM_Decode_Process_ETTS //ETTS 17
.dw 0 //CTTS 18
.dw 0 //CTTS_ETTS 19
.dw F_SACM_Decode_Process_A1600 //A1600Skip 20
.dw F_SACM_Decode_Process_DVR520 //DVR520 21 xiaolei add 2006/04/01
// .dw F_SACM_Decode_Process_DVR4800 //DVR4800 xiaolei add 2006/04/01
.dw 0 //DVR4800 //modify by chengye 2006/9/13
.dw F_SACM_Decode_Process_A1800 //A1800 23
.dw 0 //DVR1800 24
.dw F_SACM_Decode_Process_A3200 //A3200 25
.dw F_SACM_Decode_Process_A1800 //A1800SKIP 26
//===============================================================
// encode API
//===============================================================
//****************************************************************
.ifdef C_SND_DVR_SUPPORT //for all DVR
//****************************************************************
F_SACM_Encode_Initial_BS: .proc
R1 = 0x0000;
[R_SACM_Decode_Count_L] = R1
[R_SACM_Decode_Count_H] = R1
// R2 = [R_SACM_Encode_Out_PTR] //xiaolei delete 2006/05/31 for DVR1600 play OK
// [R_SACM_Encode_Out_PTR]=R2
retf
.endp
//****************************************************************
// Function: F_SACM_System_Put_BS_Manual
// Syntax: F_SACM_System_Put_BS_Manual; (in assembly domain)
// Decription: manual mode kernal APIs
// Input: N/A
// Output: N/A
// Destory: R1-R4
//****************************************************************
F_SACM_System_Put_BS_Manual: .proc
R1 = [R_SACM_Encode_Out_PTR]
cmp R1, R_SACM_Encode_Out_Buffer
je ?_Branch_0
R1 = R_SACM_Encode_Out_Buffer
R2 = [R_SACM_Encode_Out_PTR]
R2 -= R1
push R8, R15 to [sp]
call F_USER_DVR1600_WriteData //Start Adr:R1; Length:R2 // write
pop R8, R15 from [sp]
R2 = R_SACM_Encode_Out_Buffer
[R_SACM_Encode_Out_PTR] = R2
?_Branch_0:
retf
.endp
//****************************************************************
// Function: F_SACM_Encode_Initial_Process
// Syntax: call F_SACM_Encode_Initial_Process; (in assembly domain)
// Decription: Initialize encode process
// Input: N/A
// Output: N/A
// Destory: N/A
//****************************************************************
//.external F_SACM_DVR1600_ADC_TimerDiv2_Init_
F_SACM_Encode_Initial_Process: .proc
R1 = [R_CODEC_TYPE]
.ifdef C_SND_DVR1600_SUPPORT
cmp R1, C_CODEC_DVR//C_CODEC_DVR1600PLAY //xiaolei modify 2006/05/31
jne ?DVRloop_1
R1 = 0
[decvar_Hbufx] = R1
[decvar_Hbufy + 0] = R1
[decvar_Hbufy + 1] = R1
R1 = 128//C_ADC_IN_LENGTH //zgq 2005/03
[R_ADC_IN_LENGTH] = r1 //zgq 2005/03
// R1 = [BITRATE] //xiaolei delete for DVR1600 OK
.ifdef NANDBOOT_NOTEXT
//////////////////////
// push r3,r4 to [sp]
// r3=0x08
// r4=0x01
// call mr
// pop r3,r4 from [sp]
//////////////////////
.else
call DVR1600_Rec_Init
.endif
// jmp L_DVRloop_3
goto L_DVRloop_3 //modify by chengye 2006/9/14
.endif//C_SND_DVR1600_SUPPORT
?DVRloop_1:
.ifdef C_SND_DVR4800_SUPPORT
cmp R1, C_CODEC_DVR4800
jne L_DVRloop_2
R1 = __buf_r083_ac8_codec_save
R2 = [BITRATE] // data rate idx
// R3 = [R_SACM_Encode_Out_PTR];
R5 = [R_SACM_Encode_Out_PTR]; //modify by chengye 2006/9/13
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/3
push r4 to [sp]
R4 = OFFSET _f_r083_ac8_encode_init_nextaddr1
push R4 to [SP]; // PUSH PC
R4 = SR & 0x003F
R4 = R4 | SEG _f_r083_ac8_encode_init_nextaddr1
push R4 to [SP]; // PUSH CS
r4=0x018
push r4 to [sp]
r4=sr& (~0x03f)
r4|=0x01
push r4 to [sp]
retf
_f_r083_ac8_encode_init_nextaddr1:
pop r4 from [sp]
//call __f_r083_ac8_encode_init_Psuedo;
R2 = [R_SACM_Encode_Out_PTR];
R2 += R1;
[R_SACM_Encode_Out_PTR] = R2;
[R_ENCODE_OUT_LENGTH] = R1;
R1 = 256
[R_ADC_IN_LENGTH] = r1;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
jmp L_DVRloop_3
.endif//C_SND_DVR4800_SUPPORT end
L_DVRloop_2:
.ifdef C_SND_DVR520_SUPPORT
cmp R1, C_CODEC_DVR520
jne ?DVRloop_4
R1 = 0
[decvar_Hbufx] = R1
[decvar_Hbufy + 0] = R1
[decvar_Hbufy + 1] = R1
R1 = 160
[R_ADC_IN_LENGTH] = r1
R1 = 0
[R_ENCODE_OUT_LENGTH] = R1
call F_DVR520_Enc_Init
jmp L_DVRloop_3
.endif//C_SND_DVR520_SUPPORT end
?DVRloop_4:
.ifdef C_SND_DVR1800_SUPPORT //SPL162002 ICA didn't support 1800
cmp R1, C_CODEC_DVR1800 //added by chengye 2006/9/9
// jne L_DVRloop_3
jne ?DVRloop_5
R1 = 0
[decvar_Hbufx] = R1
[decvar_Hbufy + 0] = R1
[decvar_Hbufy + 1] = R1
R1 = 320
[R_ADC_IN_LENGTH] = r1
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/5
push r3,r4 to [sp]
r3=0x4a
r4=0x01
call mr
pop r3,r4 from [sp]
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// call F_DVR1800_Enc_Init
jmp L_DVRloop_3
.endif //C_SND_DVR1800_SUPPORT end
?DVRloop_5: //added by chengye 2006/9/14
.ifdef C_SND_DVR3200_SUPPORT
cmp R1, C_CODEC_DVR3200
jne L_DVRloop_3
R1 = 0;
[decvar_Hbufx] = R1;
[decvar_Hbufy + 0] = R1;
[decvar_Hbufy + 1] = R1;
R1 = 128;
[R_ADC_IN_LENGTH] = r1;
call DVR3200_Rec_Init;
.endif //C_SND_DVR3200_SUPPORT end
L_DVRloop_3:
retf
.endp
//****************************************************************
//****************************************************************
F_SACM_Encode_Finish_Process: .proc//Not compare the codec type temparialy
R1 = [R_CODEC_TYPE]
.ifdef C_SND_DVR1600_SUPPORT
cmp R1, C_CODEC_DVR//1600PLAY
jne ?_DVR4800
.ifdef NANDBOOT_NOTEXT
/////////////////// //jacky 0512
// push r3,r4 to [sp]
// r3=0x0c
// r4=0x01
// call mr
// pop r3,r4 from [sp]
.else
call DVR1600_Rec_Endp
.endif
.endif
?_DVR4800:
.ifdef C_SND_DVR4800_SUPPORT
cmp R1, C_CODEC_DVR4800
jne ?_DVR520
.endif
?_DVR520:
.ifdef C_SND_DVR520_SUPPORT
cmp R1, C_CODEC_DVR520
// jne ?_DVREND
jne ?_DVR3200
.endif
?_DVR3200: //added by chengye 2006/9/13
.ifdef C_SND_DVR3200_SUPPORT
cmp R1, C_CODEC_DVR3200
jne ?_DVREND
call DVR3200_Rec_Endp;
.endif
.ifdef C_SND_DVR1800_SUPPORT
//Nothing
.endif
?_DVREND:
retf
.endp
//****************************************************************
// Function: F_SACM_Encode_Process
// Syntax: call F_SACM_Encode_Process; (in assembly domain)
// Decription: execute encode process
// Input: N/A
// Output: N/A
// Destory: R1-R4
//****************************************************************
F_SACM_Encode_Process: .proc
R2 = [R_SACM_Play_Flag]
R1 = R_SACM_ADC_In_Buffer
R2 = R2 &C_SACM_DECODE_ODD
JNE Read_EVEN
//R1 += C_ENCODE_IN_LENGTH; //Read_ODD
R1 += [R_ADC_IN_LENGTH]
Read_EVEN:
//====================A1600 DVR=============================
push r3 to [sp]
R3 = [R_CODEC_TYPE]
.ifdef C_SND_DVR1600_SUPPORT //for DVR1600 Play only
cmp R3, C_CODEC_DVR//1600PLAY
je ?DVR1600loop
goto loop520
?DVR1600loop:
// FRACTION OFF //for DVR1600 play xiaolei delete 2006/05/31
// FIR_MOV OFF
.define Remove_DC_DVR1600 1
.if Remove_DC_DVR1600
push R1 to [SP];
R2 = 128;
[n_xfct3] = R2; //local variable
R2 = R1; //Out_Buffer Start address
R1 -= 1; //In_Buffer Start address
R3 = [R1];
push R3 to [SP];
R3 = [decvar_Hbufx];
[R1] = R3;
?_Loop_0:
R3 = 0x7EB7;
R4 = [decvar_Hbufy + 0];
MR = R4 * R3, US;
R5 = R4;
R3 = 0x7EB7;
R4 = [decvar_Hbufy + 1];
MR = R4 * R3, SS;
R3 += R5;
R4 += 0, CARRY;
R3 = R3 LSL 1;
R5 = R3 LSL 3;
R4 = R4 ROL 1;
[temp_l_xfct3] = R3;
[temp_h_xfct3] = R4;
R5 = [R1++];
R5 -= [R1];
R5 = -R5;
R3 = 0;
R4 = R5 ASR 4;
R3 = R3 ROR 1;
R4 = R5 ASR 1;
R3 += [temp_l_xfct3];
R4 += [temp_h_xfct3], CARRY;
[decvar_Hbufy + 0] = R3;
[decvar_Hbufy + 1] = R4;
R3 = R3 LSL 4;
R4 = R4 ROL 1;
[R2++] = R4;
R3 = [n_xfct3];
R3 -= 1;
[n_xfct3] = R3;
JNE ?_Loop_0;
pop R3 from [SP];
pop R1 from [SP];
R2 = R1 - 1;
[R2] = R3;
R2 = R2 + 128;
R3 = [R2];
[decvar_Hbufx] = R3;
.endif
R2 = [R_SACM_Encode_Out_PTR]
[R_ENCODE_OUT_LENGTH] = R2
.ifdef NANDBOOT_NOTEXT
//////////////////////// //jacky 0512
// push r3,r4 to [sp]
// r3=0x0a
// r4=0x01
// call mr
// pop r3,r4 from [sp]
//////////////////////// //jacky 0512
.else
call DVR1600_Rec_Proc //INPUT:R1;ADC_In_PTR
.endif
R2 = [R_SACM_Encode_Out_PTR]
R2 -= [R_ENCODE_OUT_LENGTH]
[R_ENCODE_OUT_LENGTH] = R2
R1 = [R_SACM_Encode_Count_L]
R2 = [R_SACM_Encode_Count_H]
R1 += [R_ENCODE_OUT_LENGTH]
R2 += 0, carry
[R_SACM_Encode_Count_L] = R1
[R_SACM_Encode_Count_H] = R2
goto DVRloopend
// retf;
.endif//end C_SND_DVR1600_SUPPORT
//======================520 DVR=============================
loop520:
.ifdef C_SND_DVR520_SUPPORT
cmp R3, C_CODEC_DVR520
je DVR520
goto DVR4800loop
DVR520:
[R_SACM_DVR520_ADC_In_PTR_Encode]=R1
.define Remove_DC_DVR520 1 //added by zgq on 20051221
.if Remove_DC_DVR520 //added by zgq on 20051221
push R1 to [SP]
R2 = 128
[n_xfct3] = R2 //local variable
R2 = R1 //Out_Buffer Start address
R1 -= 1 //In_Buffer Start address
R3=[R1]
push R3 to [SP]
R3=[decvar_Hbufx]
[R1]=R3
?_Loop_0:
R3 = 0x7EB7
R4 = [decvar_Hbufy + 0]
MR = R4 * R3, US
R5 = R4
R3 = 0x7EB7
R4 = [decvar_Hbufy + 1];
MR = R4 * R3, SS
R3 += R5
R4 += 0, CARRY
R3 = R3 LSL 1
R5 = R3 LSL 3
R4 = R4 ROL 1
[temp_l_xfct3] = R3
[temp_h_xfct3] = R4
R5 = [R1++]
R5 -= [R1]
R5 = -R5
R3 = 0
R4 = R5 ASR 4
R3 = R3 ROR 1
R4 = R5 ASR 1
R3 += [temp_l_xfct3]
R4 += [temp_h_xfct3], CARRY;
[decvar_Hbufy + 0] = R3;
[decvar_Hbufy + 1] = R4;
R3 = R3 LSL 4;
R4 = R4 ROL 1;
[R2++]= R4;
R3 = [n_xfct3];
R3 -= 1;
[n_xfct3] = R3;
JNE ?_Loop_0;
pop R3 from [SP];
pop R1 from [SP];
R2=R1-1;
[R2]=R3;
R2=R2+128;
R3 = [R2];
[decvar_Hbufx] = R3;
.endif
R2 = [R_SACM_Encode_Out_PTR];
[R_ENCODE_OUT_LENGTH] = R2;
call F_DVR520_Encode;
R2 = [R_SACM_Encode_Out_PTR];
R2 -= [R_ENCODE_OUT_LENGTH];
[R_ENCODE_OUT_LENGTH] = R2;
R1 = [R_SACM_Encode_Count_L];
R2 = [R_SACM_Encode_Count_H];
R1 += [R_ENCODE_OUT_LENGTH];
R2 += 0, carry;
[R_SACM_Encode_Count_L] = R1;
[R_SACM_Encode_Count_H] = R2;
goto DVRloopend
// retf;
.endif //C_SND_DVR520_SUPPORT end
//====================SPEECH4800 DVR=============================
DVR4800loop:
.ifdef C_SND_DVR4800_SUPPORT
cmp R3, C_CODEC_DVR4800
je DVR4800
goto DVR3200loop
DVR4800:
fir_mov off; //zgq 20060928
// fraction off; //zgq 20060928
R2 = [R_SACM_DVR4800_Encode_Out_PTR];
// R3 = __buf_r083_ac8_codec_save;
R5 = __buf_r083_ac8_codec_save; //modify by chengye 2006/9/13
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/3
push r4 to [sp]
R4 = OFFSET _f_r083_ac8_encode_nextaddr
push R4 to [SP]; // PUSH PC
R4 = SR & 0x003F
R4 = R4 | SEG _f_r083_ac8_encode_nextaddr
push R4 to [SP]; // PUSH CS
r4=0x01a
push r4 to [sp]
r4=sr& (~0x03f)
r4|=0x01
push r4 to [sp]
retf
_f_r083_ac8_encode_nextaddr:
pop r4 from [sp]
//call __f_r083_ac8_encode_Psuedo;
R2 = [R_SACM_Encode_Out_PTR];
R2 += R1;
[R_SACM_Encode_Out_PTR] = R2;
[R_ENCODE_OUT_LENGTH] = R1;
R1 = [R_SACM_Encode_Count_L];
R2 = [R_SACM_Encode_Count_H];
R1 += [R_ENCODE_OUT_LENGTH];
R2 += 0, carry;
[R_SACM_Encode_Count_L] = R1;
[R_SACM_Encode_Count_H] = R2;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
goto DVRloopend
.endif//C_SND_DVR4800_SUPPORT
//=======================AUDIO3200 DVR=======================
DVR3200loop:
.ifdef C_SND_DVR3200_SUPPORT
cmp R3, C_CODEC_DVR3200
//modify by chengye 2006/9/1
// jne DVR1800loop
je DVR3200loop1
goto DVR1800loop
DVR3200loop1:
//modify by chengye end 2006/9/1
.define Remove_DC_AUDIO3200 1 //add by benwang 20051220
.if Remove_DC_AUDIO3200 //add by benwang 20051220
push R1 to [SP];
R2 = 128;
[n_xfct3] = R2; //local variable
R2 = R1; //Out_Buffer Start address
R1 -= 1; //In_Buffer Start address
R3 = [R1];
push R3 to [SP];
R3 = [decvar_Hbufx];
[R1] = R3;
?_Loop_0:
R3 = 0x7EB7;
R4 = [decvar_Hbufy + 0];
MR = R4 * R3, US;
R5 = R4;
R3 = 0x7EB7;
R4 = [decvar_Hbufy + 1];
MR = R4 * R3, SS;
R3 += R5;
R4 += 0, CARRY;
R3 = R3 LSL 1;
R5 = R3 LSL 3;
R4 = R4 ROL 1;
[temp_l_xfct3] = R3;
[temp_h_xfct3] = R4;
R5 = [R1++];
R5 -= [R1];
R5 = -R5;
R3 = 0;
R4 = R5 ASR 4;
R3 = R3 ROR 1;
R4 = R5 ASR 1;
R3 += [temp_l_xfct3];
R4 += [temp_h_xfct3], CARRY;
[decvar_Hbufy + 0] = R3;
[decvar_Hbufy + 1] = R4;
R3 = R3 LSL 4;
R4 = R4 ROL 1;
[R2++] = R4;
R3 = [n_xfct3];
R3 -= 1;
[n_xfct3] = R3;
JNE ?_Loop_0;
pop R3 from [SP];
pop R1 from [SP];
R2 = R1 - 1;
[R2] = R3;
R2 = R2 + 128;
R3 = [R2];
[decvar_Hbufx] = R3;
.endif //add by benwang 20051220
R2 = [R_SACM_Encode_Out_PTR];
[R_ENCODE_OUT_LENGTH] = R2;
call DVR3200_Rec_Proc; //INPUT:R1;ADC_In_PTR
R2 = [R_SACM_Encode_Out_PTR];
R2 -= [R_ENCODE_OUT_LENGTH];
[R_ENCODE_OUT_LENGTH] = R2;
R1 = [R_SACM_Encode_Count_L];
R2 = [R_SACM_Encode_Count_H];
R1 += [R_ENCODE_OUT_LENGTH];
R2 += 0, carry;
[R_SACM_Encode_Count_L] = R1;
[R_SACM_Encode_Count_H] = R2
goto DVRloopend
.endif//C_SND_DVR3200_SUPPORT
DVR1800loop:
.ifdef C_SND_DVR1800_SUPPORT
cmp R3, C_CODEC_DVR1800
je DVR1800
goto DVRloopend
DVR1800:
[R_SACM_DVR1800_ADC_In_PTR_Encode]=R1; //added by chengye 2006/9/5
.define Remove_DC_DVR1800 1
// [R_SACM_DAC_Out_PTR_Decode] = r1; //wgp add 20060529
.if Remove_DC_DVR1800 //added by wgp on 20060530
push R1 to [SP]
R2 = 128
[n_xfct3] = R2 //local variable
R2 = R1 //Out_Buffer Start address
R1 -= 1 //In_Buffer Start address
R3 = [R1]
push R3 to [SP]
R3 = [decvar_Hbufx]
[R1] = R3
?DVR1800:
R3 = 0x7EB7
R4 = [decvar_Hbufy + 0]
MR = R4 * R3, US
R5 = R4
R3 = 0x7EB7
R4 = [decvar_Hbufy + 1]
MR = R4 * R3, SS
R3 += R5
R4 += 0, CARRY
R3 = R3 LSL 1
R5 = R3 LSL 3
R4 = R4 ROL 1
[temp_l_xfct3] = R3
[temp_h_xfct3] = R4
R5 = [R1++]
R5 -= [R1]
R5 = -R5
R3 = 0
R4 = R5 ASR 4
R3 = R3 ROR 1
R4 = R5 ASR 1
R3 += [temp_l_xfct3]
R4 += [temp_h_xfct3], CARRY
[decvar_Hbufy + 0] = R3
[decvar_Hbufy + 1] = R4
R3 = R3 LSL 4
R4 = R4 ROL 1
[R2++] = R4
R3 = [n_xfct3]
R3 -= 1
[n_xfct3] = R3
JNE ?DVR1800
pop R3 from [SP]
pop R1 from [SP]
R2 = R1 - 1
[R2] = R3
R2 = R2 + 128
R3 = [R2]
[decvar_Hbufx] = R3
.endif
R2 = [R_SACM_Encode_Out_PTR]
[R_ENCODE_OUT_LENGTH] = R2
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//added by chengye 2006/9/5
push r3,r4 to [sp]
r3=0x4c
r4=0x01
call mr
pop r3,r4 from [sp]
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// call F_DVR1800_Encode //INPUT:R1;ADC_In_PTR
R2 = [R_SACM_Encode_Out_PTR]
R2 -= [R_ENCODE_OUT_LENGTH]
[R_ENCODE_OUT_LENGTH] = R2
R1 = [R_SACM_Encode_Count_L]
R2 = [R_SACM_Encode_Count_H]
R1 += [R_ENCODE_OUT_LENGTH]
R2 += 0, carry
[R_SACM_Encode_Count_L] = R1
[R_SACM_Encode_Count_H] = R2
.endif//C_SND_DVR1800_SUPPORT end
DVRloopend:
pop r3 from [sp]
retf
.endp
.endif //===C_SND_DVR_SUPPORT end===//xaiolei modify for different DVR 2006/04/01
//****************************************************************
//****************************************************************
.ifdef C_SND_S600_SUPPORT
S600_ZERO_Decoder:
R1=0;
[R_SACM_DECODE_IN_LENGTH]=R1;
R2=60;
[R_DECODE_OUT_LENGTH]=R2;
R3=R_SACM_Decode_Out_Buffer;
R2+=R3;
?_LOOP:
[R3++]=R1;
CMP R3,R2;
JNE ?_LOOP;
RETF;
.endif
.public _Decode_ForceStop
_Decode_ForceStop:
push R1 to [sp]
R1 = [R_SACM_Play_Flag]
R1 |= C_SACM_DECODE_END
[R_SACM_Play_Flag] = R1
pop R1 from [sp]
retf
//****** end of SACM_decode.asm *******************************