AP77016-B19 [ETC]

USAP77016-B19 User's Manual | User's Manual[03/2003] ; USAP77016 - B19用户手册|用户手册[ 03/2003 ]\n
AP77016-B19
型号: AP77016-B19
厂家: ETC    ETC
描述:

USAP77016-B19 User's Manual | User's Manual[03/2003]
USAP77016 - B19用户手册|用户手册[ 03/2003 ]\n

文件: 总54页 (文件大小:175K)
中文:  中文翻译
下载:  下载PDF数据表文档文件
User’s Manual  
µSAP77016-B19  
MP3 Audio Encoder Middleware  
Target Device  
µPD77110  
µPD77113A  
µPD77114  
µPD77115  
µPD77210  
µPD77213  
Document No. U16553EJ1V0UM00 (1st edition)  
Date Published March 2003 NS CP(N)  
2003  
Printed in Japan  
[MEMO]  
2
User’s Manual U16553EJ1V0UM  
Windows is either a registered trademark or a trademark of Microsoft Corporation in the United States  
and/or other countries.  
The information in this document is current as of March, 2003. The information is subject to change  
without notice. For actual design-in, refer to the latest publications of NEC Electronics data sheets or  
data books, etc., for the most up-to-date specifications of NEC Electronics products. Not all  
products and/or types are available in every country. Please check with an NEC Electronics sales  
representative for availability and additional information.  
No part of this document may be copied or reproduced in any form or by any means without the prior  
written consent of NEC Electronics. NEC Electronics assumes no responsibility for any errors that may  
appear in this document.  
NEC Electronics does not assume any liability for infringement of patents, copyrights or other intellectual  
property rights of third parties by or arising from the use of NEC Electronics products listed in this document  
or any other liability arising from the use of such products. No license, express, implied or otherwise, is  
granted under any patents, copyrights or other intellectual property rights of NEC Electronics or others.  
Descriptions of circuits, software and other related information in this document are provided for illustrative  
purposes in semiconductor product operation and application examples. The incorporation of these  
circuits, software and information in the design of a customer's equipment shall be done under the full  
responsibility of the customer. NEC Electronics assumes no responsibility for any losses incurred by  
customers or third parties arising from the use of these circuits, software and information.  
While NEC Electronics endeavors to enhance the quality, reliability and safety of NEC Electronics products,  
customers agree and acknowledge that the possibility of defects thereof cannot be eliminated entirely. To  
minimize risks of damage to property or injury (including death) to persons arising from defects in NEC  
Electronics products, customers must incorporate sufficient safety measures in their design, such as  
redundancy, fire-containment and anti-failure features.  
NEC Electronics products are classified into the following three quality grades: "Standard", "Special" and  
"Specific".  
The "Specific" quality grade applies only to NEC Electronics products developed based on a customer-  
designated "quality assurance program" for a specific application. The recommended applications of an NEC  
Electronics product depend on its quality grade, as indicated below. Customers must check the quality grade of  
each NEC Electronics product before using it in a particular application.  
"Standard": Computers, office equipment, communications equipment, test and measurement equipment, audio  
and visual equipment, home electronic appliances, machine tools, personal electronic equipment  
and industrial robots.  
"Special": Transportation equipment (automobiles, trains, ships, etc.), traffic control systems, anti-disaster  
systems, anti-crime systems, safety equipment and medical equipment (not specifically designed  
for life support).  
"Specific": Aircraft, aerospace equipment, submersible repeaters, nuclear reactor control systems, life  
support systems and medical equipment for life support, etc.  
The quality grade of NEC Electronics products is "Standard" unless otherwise expressly specified in NEC  
Electronics data sheets or data books, etc. If customers wish to use NEC Electronics products in applications  
not intended by NEC Electronics, they must contact an NEC Electronics sales representative in advance to  
determine NEC Electronics' willingness to support a given application.  
(Note)  
(1)  
"NEC Electronics" as used in this statement means NEC Electronics Corporation and also includes its  
majority-owned subsidiaries.  
(2)  
"NEC Electronics products" means any product developed or manufactured by or for NEC Electronics (as  
defined above).  
M8E 02. 11-1  
3
User’s Manual U16553EJ1V0UM  
Regional Information  
Some information contained in this document may vary from country to country. Before using any NEC  
Electronics product in your application, pIease contact the NEC Electronics office in your country to  
obtain a list of authorized representatives and distributors. They will verify:  
Device availability  
Ordering information  
Product release schedule  
Availability of related technical literature  
Development environment specifications (for example, specifications for third-party tools and  
components, host computers, power plugs, AC supply voltages, and so forth)  
Network requirements  
In addition, trademarks, registered trademarks, export restrictions, and other legal issues may also vary  
from country to country.  
NEC Electronics America, Inc. (U.S.)  
Santa Clara, California  
Tel: 408-588-6000  
NEC Electronics Hong Kong Ltd.  
Hong Kong  
Tel: 2886-9318  
Filiale Italiana  
Milano, Italy  
Tel: 02-66 75 41  
Fax: 02-66 75 42 99  
800-366-9782  
Fax: 2886-9022/9044  
Fax: 408-588-6130  
NEC Electronics Hong Kong Ltd.  
Seoul Branch  
Seoul, Korea  
Tel: 02-528-0303  
Fax: 02-528-4411  
Branch The Netherlands  
Eindhoven, TheNetherlands  
Tel: 040-244 58 45  
800-729-9288  
NEC Electronics (Europe) GmbH  
Duesseldorf, Germany  
Tel: 0211-65 03 01  
Fax: 040-244 45 80  
Tyskland Filial  
Taeby, Sweden  
Tel: 08-63 80 820  
Fax: 08-63 80 388  
Fax: 0211-65 03 327  
NEC Electronics Shanghai, Ltd.  
Shanghai, P.R. China  
Tel: 021-6841-1138  
Sucursal en España  
Madrid, Spain  
Tel: 091-504 27 87  
Fax: 091-504 28 60  
Fax: 021-6841-1137  
United Kingdom Branch  
Milton Keynes, UK  
Tel: 01908-691-133  
Fax: 01908-670-290  
NEC Electronics Taiwan Ltd.  
Taipei, Taiwan  
Tel: 02-2719-2377  
Succursale Française  
Vélizy-Villacoublay, France  
Tel: 01-30-67 58 00  
Fax: 02-2719-5951  
Fax: 01-30-67 58 99  
NEC Electronics Singapore Pte. Ltd.  
Novena Square, Singapore  
Tel: 6253-8311  
Fax: 6250-3583  
J02.11  
4
Users Manual U16553EJ1V0UM  
PREFACE  
Target Readers  
This manual is for users who design and develop µPD77016 Family application systems.  
µPD77016 Family is the generic name for the µPD7701x family (µPD77015, 77016,  
77017, 77018A, 77019), the µPD77111 Family (µPD77110, 77111, 77112, 77113A,  
77114, 77115) and the µPD77210 Family (µPD77210, 77213). However, this manual is  
for µPD77110, 77113A, 77114, 77115, 77210, and 77213 devices.  
Purpose  
The purpose of this manual is to help users understand the supporting middleware when  
designing and developing µPD77016 Family application systems.  
Organization  
This manual consists of the following contents.  
OVERVIEW  
LIBRARY SPECIFICATIONS  
INSTALLATION  
SYSTEM EXAMPLE  
SAMPLE PROGRAM SOURCE  
How to Read This Manual It is assumed that the reader of this manual has general knowledge in the fields of  
electrical engineering, logic circuits, microcontrollers, and the C language.  
To learn about µPD77111 Family hardware functions  
Refer to µPD77111 Family Users Manual Architecture.  
To learn about µPD77210 Family hardware functions  
Refer to µPD77210 Family Users Manual Architecture.  
To learn about µPD77016 Family instructions  
Refer to µPD77016 Family Users Manual Instruction.  
Conventions  
Data significance:  
Higher digits on the left and lower digits on the right  
Active low representation: XXX (overscore over pin or signal name)  
Note:  
Footnote for item marked with Note in the text  
Information requiring particular attention  
Supplementary information  
Caution:  
Remark:  
Numerical representation: Binary ... XXXX or 0bXXXX  
Decimal ... XXXX  
Hexadecimal ... 0xXXXX  
5
Users Manual U16553EJ1V0UM  
Related Documents  
The related documents listed below may include preliminary versions. However,  
preliminary versions are not marked as such.  
Documents Related to Devices  
Part Number  
Pamphlet  
Data Sheet  
U12801E  
Users Manual  
Application Note  
Basic Software  
U11958E  
Architecture  
U14623E  
Instructions  
U13116E  
µ PD77110  
U12395E  
µ PD77111  
µ PD77112  
µ PD77113A  
µ PD77114  
µ PD77115  
µ PD77210  
µ PD77213  
U14373E  
U14867E  
U15203E  
U15807E  
Documents Related to Development Tools  
Document Name  
Document No.  
U14397E  
RX77016 Users Manual  
Function  
Configuration Tool  
HOST API  
U14404E  
RX77016 Application Note  
U14371E  
Documents Related to Middleware  
Document Name  
Document No.  
U15134E  
µ SAP77106-B07 User's Manual (MP3 Decoder)  
µ SAP77106-B19 User's Manual (MP3 Encoder)  
This manual  
Documents Related to Standard  
Document Name  
ISO/IEC 11172-3:1993 Information technology - Coding of moving pictures and associated audio for digital storage Media  
at up to about 1.5 Mbit/s - Part3  
JIS X 4323-1995 Information technology of Japan Industrial Standard - Coding of moving pictures and associated audio  
for digital storage Media at up to about 1.5 Mbit/s - Part3: Audio (MR-4284 1995.10.27)  
ISO/IEC 13818-3 Information technology - Generic coding of moving pictures and associated audio information - Part 3:  
Audio  
JIS X 4327 Generic coding of moving pictures and associated audio information - Part 3: Audio  
Caution The related documents listed above are subject to change without notice. Be sure to use the latest  
version of each document for designing.  
6
Users Manual U16553EJ1V0UM  
CONTENTS  
CHAPTER 1 OVERVIEW ..........................................................................................................................10  
1.1 Middleware....................................................................................................................................................10  
1.2 MP3 Audio Encoder .....................................................................................................................................10  
1.2.1 Encoder outline.................................................................................................................................11  
1.3 Compressed Data Format ...........................................................................................................................14  
1.3.1 Header ..............................................................................................................................................15  
1.3.2 CRC ..................................................................................................................................................16  
1.3.3 Side information ................................................................................................................................17  
1.3.4 Audio data.........................................................................................................................................17  
1.3.5 Additional data ..................................................................................................................................17  
1.4 Product Overview.........................................................................................................................................18  
1.4.1 Features............................................................................................................................................18  
1.4.2 Function ............................................................................................................................................18  
1.4.3 Operating environment......................................................................................................................19  
1.4.4 Performance......................................................................................................................................20  
1.4.5 Directory configuration......................................................................................................................21  
CHAPTER 2 LIBRARY SPECIFICATIONS .............................................................................................22  
2.1 Library Overview..........................................................................................................................................22  
2.2 Application Processing Flow......................................................................................................................23  
2.3 Function Specifications ..............................................................................................................................24  
2.3.1 MP3ENC_Start function....................................................................................................................24  
2.3.2 MP3ENC_Encode function ...............................................................................................................25  
2.3.3 MP3ENC_Stop function ....................................................................................................................26  
2.3.4 MP3ENC_GetVersion function..........................................................................................................27  
2.4 Parameters Necessary for Compression...................................................................................................28  
2.5 Memory Structure ........................................................................................................................................29  
2.5.1 Scratch area......................................................................................................................................29  
2.5.2 Static area.........................................................................................................................................29  
2.5.3 Input buffer........................................................................................................................................30  
2.5.4 Output buffer .....................................................................................................................................31  
CHAPTER 3 INSTALLATION ...................................................................................................................32  
3.1 Installation Procedure .................................................................................................................................32  
3.2 Sample Program Creation Procedure ........................................................................................................33  
3.3 Symbol Naming Conventions .....................................................................................................................34  
CHAPTER 4 SYSTEM EXAMPLE...........................................................................................................35  
4.1 Simulation Environment Using Timing File...............................................................................................35  
4.2 Operation......................................................................................................................................................35  
7
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE ..........................................................................................36  
A.1 Header File (mp3enc.h)...............................................................................................................................36  
A.2 Sample Source File (sample.asm).............................................................................................................37  
A.3 Timing File for Parameter Information (value.tmg)..............................................................................47  
A.4 Timing File for Data Input (pcm_in.tmg) ...................................................................................................49  
A.5 Timing File for Data Output (stream_out.tmg)..........................................................................................52  
8
Users Manual U16553EJ1V0UM  
LIST OF FIGURES  
Figure No.  
Title  
Page  
1-1. Encoder Configuration Example ..........................................................................................................................11  
1-2. System Configuration Example............................................................................................................................11  
1-3. Timing Diagram....................................................................................................................................................13  
1-4. Compressed Data Format....................................................................................................................................14  
2-1. Application Processing Flow................................................................................................................................23  
2-2. Structure Consisting of Parameters Necessary for Compression........................................................................28  
2-3. User-Defined Input Buffer (PCM Buffer)...............................................................................................................30  
2-4. Output Buffer (Bit Stream Buffer) .........................................................................................................................31  
LIST OF TABLES  
Table No.  
Title  
Page  
1-1. Sampling Frequencies .........................................................................................................................................10  
1-2. Number of Words of Input Data ...........................................................................................................................11  
1-3. Selectable Bit Rates.............................................................................................................................................12  
1-4. Details of Header Section ....................................................................................................................................15  
1-5. Relationship of Bit Values to Bit Rates.................................................................................................................16  
1-6. Relationship of Bit Values to Sampling Frequencies............................................................................................16  
1-7. Size of Side Information.......................................................................................................................................17  
1-8. Required Memory Sizes.......................................................................................................................................19  
1-9. Software Tools......................................................................................................................................................19  
1-10. MIPS Values of 1-Frame Compression Processing (Measured Values) ............................................................20  
2-1. List of Library Functions.......................................................................................................................................22  
2-2. Values to Specify Sampling Frequency................................................................................................................28  
2-3. Symbol Name/Memory Sizes...............................................................................................................................29  
2-4. Input Buffer Size...................................................................................................................................................30  
3-1. Symbol Naming Conventions...............................................................................................................................34  
9
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.1 Middleware  
Middleware is the name given to a group of software that has been tuned so that it draws out the maximum  
performance of the processor and enables processing that is conventionally performed by hardware to be performed  
by software.  
The concept of middleware was introduced with the development of a new high-speed processor, the DSP, in order  
to facilitate operation of the environments integrated in the system.  
By providing appropriate speech codec and image data compression/decompression-type middleware, NEC  
Electronics is offering users the kind of technology essential in the realization of a multimedia system for the  
µPD77016 Family, and is continuing its promotion of system development.  
µSAP77016-B19 is middleware that provides MP3-technology encoding functions.  
1.2 MP3 Audio Encoder  
MP3 is a method used for coding or decoding high-quality audio signals for storage media. It includes MPEG-1  
Audio Layer-3 and MPEG-2 Audio Layer-3 LSF (Low Sampling Frequency). The µSAP77016-B19 conforms to this  
coding method.  
The compressed data format of MPEG-1 Audio Layer-3 conforms to ISO/IEC 11172-3, and that of MPEG-2 Audio  
Layer-3 conforms to ISO/IEC 13818-3. MP3 handles 16-bit linear PCM audio data sampled at a frequency from 16  
kHz to 48 kHz (refer to Table 1-1).  
Table 1-1. Sampling Frequencies  
MPEG-1 Audio Layer-3  
[Hz]  
MPEG-2 Audio Layer-3 LSF  
[Hz]  
32000  
44100  
48000  
16000  
22050  
24000  
10  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.2.1 Encoder outline  
Figure 1-1 shows an example of the configuration of an encoder using the µSAP77016-B19. Figure 1-2 shows an  
example of the configuration of a system that includes an encoder using the µSAP77016-B19.  
Figure 1-1. Encoder Configuration Example  
Sampling frequency  
16 kHz to 48 kHz  
Selectable bit rates  
8 kbps to 320 kbps  
16-bit  
ADC  
IN  
Encoder (MP3)  
OUT  
(Compression data)  
(Analog audio data)  
(16-bit linear  
PCM data)  
Figure 1-2. System Configuration Example  
CD  
player  
Evaluation board  
AUDIO SERIAL INTERFACE  
LINE IN  
DSP  
PARALLEL PORT  
PC  
(1) Input data  
The input data is 16-bit linear PCM data sampled at 16 kHz to 48 kHz (refer to Table 1-1).  
Table 1-2 shows the number of words of input data per frame.  
Table 1-2. Number of Words of Input Data  
Compression Ratio  
Number of Number of Words of  
Channels  
Input Audio Data  
MPEG-1  
1
2
1
2
1152  
2304  
576  
Audio Layer-3  
MPEG-2  
Audio Layer-3 LSF  
1152  
Remark 1 word = 16 bits  
11  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
(2) MP3 audio encoder  
The MP3 audio encoder reads 16-bit linear PCM data and outputs data while controlling the code quantity at a set  
bit rate. The bit rate per frame is variable.  
Table 1-3 shows the bit rates that can be set.  
Table 1-3. Selectable Bit Rates  
MPEG-1 Audio Layer-3  
[kbps]  
MPEG-2 Audio Layer-3 LSF  
[kbps]  
32  
40  
8
16  
48  
24  
56  
32  
64  
40  
80  
48  
96  
56  
112  
128  
160  
192  
224  
256  
320  
64  
80  
96  
112  
128  
144  
160  
12  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
(3) Timing diagram  
Figure 1-3 shows the timing diagram of the MP3 audio encoder.  
Figure 1-3.Timing Diagram  
16-bit linear PCM data of 1 frame  
Compressed data of 1 frame  
Audio serial input  
interrupt handler  
<1>  
MP3 compression  
processing  
<2>  
Bit stream output  
User application  
<3>  
<4>  
0
Time  
Audio input data length of 1 frame  
<1> 16-bit linear PCM data of one frame is input.  
<2> The 16-bit linear PCM data of one frame is buffered and compressed.  
<3> The compressed data is buffered and output.  
<4> The user performs appropriate processing.  
13  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.3 Compressed Data Format  
The compressed data format conforms to ISO/IEC 11172-3 and/or JIS X4323. However, the µSAP77016-B19  
does not support the free format when the bitrate_index is 0000. The compressed data consists of a number of bit  
streams, each of which is called a frame.  
Figure 1-4 shows the structure of the compressed data format.  
Figure 1-4. Compressed Data Format  
Compressed data (1 file)  
Frame  
Frame  
CRC  
Frame  
Frame  
Frame  
1 frame  
Header  
Side information  
Additional data  
Audio data  
14  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.3.1 Header  
Headers contain information such as the sampling frequency, bit rate, and mode for synchronizing.  
Table 1-4. Details of Header Section  
Information  
Number of  
Bits Used  
Value  
Frame sync word  
ID  
12  
1
1111 1111 1111: Fixed value  
1: MPEG-1  
0: MPEG-2  
Layer  
2
1
11: Layer1/10: Layer2/01: Layer3  
(Fixed to 01 in the µ SAP77016-B19.)  
Protection bit  
0': Has CRC  
1: No CRC  
(Fixed to 1 in the µ SAP77016-B19.)  
Bit rate  
4
2
Refer to Table 1-5 Relationship of Bit Values to Bit Rates.  
Sampling frequency  
Refer to Table 1-6 Relationship of Bit Values to Sampling  
Frequencies.  
Padding bit  
1
1: 1 byte is added to frameNote 1  
0: 1 byte not added to frame  
Not used (Fixed to 0 in the µ SAP77016-B19.)  
Private bit  
Mode  
1
2
00: stereo  
01: joint_stereo  
10: dual_channel  
11: single_channel  
(In the µ SAP77016-B19, fixed to 01 in the case of stereo,  
and 11 in the case of mono.)  
Mode extensionNote 2  
2
00: is_off, ms_off  
10: is_off, ms_on  
01: is_on, ms_off  
11: is_on, ms_on  
(Fixed to 10 in the µ SAP77016-B19.)  
Copyright  
1
1
2
0: no copyright  
1: copyright protected  
(Fixed to 0 in the µ SAP77016-B19.)  
Original/copy distinction  
Emphasis  
0: copy  
1: original  
(Fixed to 1 in the µ SAP77016-B19.)  
01: 50/15 µ s  
11: CCITT J.17  
00: no emphasis  
10: reserved  
(Fixed to 00 in the µ SAP77016-B19.)  
Notes 1. For a sampling frequency of 44.1 kHz, 1 byte is added to adjust frame ends.  
2. isdesignates intensity stereo and msMS stereo.  
15  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
Table 1-5. Relationship of Bit Values to Bit Rates  
Value  
MPEG-1 Audio Layer-3  
[kbps]  
MPEG-2 Audio Layer-3 LSF  
[kbps]  
0000’  
0001’  
0010’  
0011’  
0100’  
0101’  
0110’  
0111’  
1000’  
1001’  
1010’  
1011’  
1100’  
1101’  
1110’  
1111’  
Free formatNote  
32  
40  
8
16  
48  
24  
56  
32  
64  
40  
80  
48  
96  
56  
112  
128  
160  
192  
224  
256  
320  
64  
80  
96  
112  
128  
144  
160  
Setting prohibited  
Note Not supported by µSAP77016-B19  
Table 1-6. Relationship of Bit Values to Sampling Frequencies  
Value  
MPEG-1 Audio Layer-3  
[Hz]  
MPEG-2 Audio Layer-3 LSF  
[Hz]  
00’  
01’  
10’  
11’  
44100  
48000  
32000  
22050  
24000  
16000  
Setting prohibited  
1.3.2 CRC  
There are two bytes of information that follow the header only when the header protection bit indicates that CRC is  
in effect. If it is not in effect, the two bytes of information do not exist.  
In the case of the µSAP77016-B19, the data is output without CRC.  
16  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.3.3 Side information  
Side information includes information such as the starting position of audio data in a frame and the decoding  
method as information needed in decoding audio data.  
The size of side information is shown in Table 1-7.  
Table 1-7. Size of Side Information  
MPEG-1 Audio Layer-3  
[byte]  
MPEG-2 Audio Layer-3 LSF  
[byte]  
Mono  
17  
32  
9
Stereo  
17  
1.3.4 Audio data  
This is data related to an audio sample. The starting position of the audio data is set in the side information. Audio  
data can start in the same frame as the side information that shows the position of the audio data or it can start in a  
preceding frame.  
Moreover, the starting position of audio data is not limited to one frame before. It also can start two frames before.  
Refer to ISO/IEC 11172-3 for details about audio data.  
1.3.5 Additional data  
This is a segment in which data that the user can define is loaded. This data sometimes does not exist in a frame.  
This data is not appended in the µSAP77016-B19.  
17  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.4 Product Overview  
1.4.1 Features  
Supports mono (single channel) and stereo (joint stereo).  
16-bit linear PCM data input.  
Code quantity control at set bit rate (refer to Table 1-5 Relationship of Bit Values to Bit Rates). The bit rate  
per frame is variable. A variable bit rate (VBR) is not supported.  
Sampling frequency: 32 kHz/44.1 kHz/48 kHz for MPEG-1 Audio Layer-3; 16 kHz/22.05 kHz/24 kHz for  
MPEG-2 Audio Layer-3 LSF (refer to Table 1-6 Relationship of Bit Values to Sampling Frequencies).  
In mono mode (1 channel), codes 1152 samples/frame for MPEG-1 Audio Layer-3, and 576 samples/frame for  
MPEG-2 Audio Layer-3 LSF.  
In stereo mode (2 channels), codes 2304 samples/frame for MPEG-1 Audio Layer-3, and 1152 samples/frame  
for MPEG-2 Audio Layer-3 LSF.  
MS stereo supported; intensity stereo not supported.  
1.4.2 Function  
The µSAP77016-B19 converts 16-bit linear PCM data of one frame into compressed data.  
18  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.4.3 Operating environment  
(1) Operable DSPs:  
µPD77110, 77113A, 77114, 77115, 77210, 77213  
(2) Required memory size:  
The µSAP77016-B19 requires memory sizes shown in the following table.  
Table 1-8. Required Memory Sizes  
Memory  
Type  
Size [Kwords]  
6.6  
Instruction  
memory  
X memory  
Y memory  
RAM  
Scratch area  
Static area  
4.9  
2.3  
3.1  
2.5  
3.2  
0.2  
0.8  
ROM  
RAM  
Scratch area  
Static area  
Library area  
ROM  
Caution Place the X memory and Y memory areas used for the library in the internal ROM/RAM  
space.  
The µ SAP77016-B19 uses a certain area as both a scratch area and bit stream buffer  
area. The required memory size shown above does not include the input buffer (PCM  
buffer) for audio data. Refer to 2.5.3 Input buffer.  
Remark One word of instruction memory is 32 bits.  
One word of X memory or Y memory is 16 bits.  
(3) Required A/D converter specifications  
2 channels, 16-bit resolution, sampling frequency shown in Table 1-1 Sampling Frequencies.  
(4) Software tools (Windows® version)  
Table 1-9. Software Tools  
Relevant DSP  
Software Tools  
µ PD77110 Family  
WB77016 (Workbench (Assembler/Linker))  
HSM77016 (High-speed simulator)  
ID77016 (Debugger)  
µ PD77210 Family  
Atair Developer Studio (Workbench (Assembler/Linker))  
µ PD7721x High-speed simulator  
µ PD7721x Debugger  
Remark These DSP software tools are produced by Atair Software GmbH.  
19  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.4.4 Performance  
Table 1-10 shows the MIPS values (measured values) necessary for real-time execution of processing of one  
frame.  
Measurement conditions  
Simulator: HSM77016 (µPD77016 high-speed simulator)  
Evaluation result:The processing speed is measured when a stereo/mono audio file is compressed, and the  
average value and maximum value are calculated.  
The processing speed of only the MP3ENC_Encode function is included in compression. The  
processing speed of the other functions and interrupt handlers is not included.  
Table 1-10. MIPS Values of 1-Frame Compression Processing (Measured Values)  
(a) MPEG-1 Audio Layer-3  
Sampling frequency [kHz]  
Setting bit rate [kbps]  
32  
44.1  
96  
48  
64  
96  
128  
47.5  
23.0  
70.7  
38.3  
64  
128  
53.8  
25.9  
79.1  
40.9  
64  
96  
128  
56.0  
27.0  
84.2  
44.0  
Average value  
[MIPS]  
Stereo  
44.5  
22.7  
68.0  
37.6  
45.0  
23.0  
69.2  
38.0  
49.3  
25.1  
77.3  
42.4  
50.0  
25.9  
75.5  
42.6  
51.4  
26.2  
76.2  
41.3  
51.6  
26.9  
73.7  
42.7  
Mono  
Stereo  
Mono  
Maximum value  
[MIPS]  
(b) MPEG-2 Audio Layer-3 LSF  
Sampling frequency [kHz]  
Setting bit rate [kbps]  
16  
22.05  
24  
64  
96  
128  
23.2  
11.9  
36.8  
20.7  
64  
96  
128  
31.5  
15.8  
51.9  
29.0  
64  
96  
128  
34.8  
17.4  
56.5  
33.6  
Average value  
[MIPS]  
Stereo  
22.6  
11.2  
36.2  
21.2  
23.0  
11.5  
37.4  
20.9  
30.8  
15.3  
51.7  
27.6  
31.1  
15.5  
48.8  
28.2  
31.7  
17.1  
54.7  
30.3  
34.1  
16.9  
53.4  
33.7  
Mono  
Stereo  
Mono  
Maximum value  
[MIPS]  
Remark These MIPS values were measured when evaluation was made by NEC Electronics. The maximum  
values do not guarantee the worst values.  
20  
Users Manual U16553EJ1V0UM  
CHAPTER 1 OVERVIEW  
1.4.5 Directory configuration  
The directory configuration of the µPSAP77016-B19 is shown below.  
library  
smp  
m3eram.lib:  
m3erom.lib:  
mp3enc.h:  
sample.prj:  
sample.asm:  
value.tmg:  
Library for PD77110, 77115, 77210  
µ
Library for PD77113A, 77114, 77213  
µ
mp3enc  
Header file  
Project file  
Sample source file  
Timing file for parameter information  
Timing file for data input  
pcm_in.tmg:  
stream_out.tmg: Timing file for data output  
A summary of each directory is shown below.  
library  
This directory contains library files.  
smp/mp3enc  
This directory contains sample program source files, header files and timing files.  
21  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.1 Library Overview  
µSAP77016-B19 provides the following four functions.  
Table 2-1. List of Library Functions  
Function Name Function  
MP3ENC_Start  
Initialization  
MP3ENC_Encode  
MP3ENC_Stop  
Compression process  
Termination process  
MP3ENC_GetVersion  
Obtain version information  
22  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.2 Application Processing Flow  
Figure 2-1 shows an example of the processing of an application that uses µSAP77016-B19.  
Figure 2-1. Application Processing Flow  
Start  
Data I/O initialization processing  
· AD initial setup  
· Interrupt enable, etc.  
Muted data input to PCM buffer  
Encoder initialization  
call MP3ENC_Start  
Audio serial input  
interrupt handler  
Encode processing  
call MP3ENC_Encode  
16-bit liner PCM  
data input  
Processing to output compressed data  
of bit stream buffer from host I/F  
Encode processing  
call MP3ENC_Encode  
Yes  
End of encoder?  
No  
Processing to output compressed data  
of bit stream buffer from host I/F  
No  
1 frame of  
sampling count?  
Termination processing  
call MP3ENC_Stop  
Yes  
Processing to input data to  
PCM buffer  
Encode processing  
call MP3ENC_Encode  
Encode processing  
call MP3ENC_Encode  
Processing to output compressed data  
of bit stream buffer from host I/F  
Processing to output compressed data  
of bit stream buffer from host I/F  
Termination processing  
call MP3ENC_Stop  
Remark The 16-bit linear PCM data input processing of the interrupt handler is dependent upon the hardware of  
the target system. Therefore, the user should design the input processing in accordance with their  
target system.  
23  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.3 Function Specifications  
2.3.1 MP3ENC_Start function  
The MP3ENC_Start function initializes each parameter used by the encoder. Call this function only once before  
using the MP3ENC_Encode function.  
[Classification]  
MP3 encoder initialization processing  
MP3ENC_Start  
[Function name]  
[Summary of function] Initializes the parameters used by the µSAP77016-B19  
[Format]  
call MP3ENC_Start  
[Arguments]  
R0L First address of static area in X memoryNote  
R1L First address of scratch area in X memoryNote  
R2L First address of static area in Y memoryNote  
R3L First address of scratch area in Y memoryNote  
None  
[Return value]  
[Registers used]  
r0, r1, r2, r3, r4, r7,  
dp0, dp4, dp5  
[Hardware resources] Maximum stack level  
Maximum loop stack level  
2
1
Maximum number of repeats  
3214  
11642  
Maximum number of cycles  
Note For the memory, refer to 2.5 Memory Structure.  
Caution Secure the scratch memory area and static memory area before calling this function.  
24  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.3.2 MP3ENC_Encode function  
The MP3ENC_Encode function compresses audio data equivalent to the number of words of data shown in Table  
1-2 Number of Words of Input Data at a specified bit rate.  
[Classification]  
MP3 encode processing  
MP3ENC_Encode  
[Function name]  
[Summary of function] Compresses the 16-bit linear PCM data in the PCM buffer and then outputs the compressed  
data to the bit stream buffer.  
[Format]  
call MP3ENC_Encode  
[Arguments]  
R0L First address of structure consisting of parameters necessary for compressing in X  
memoryNote 1  
R1L First address of input buffer (PCM buffer) for data input for encoder in X memoryNote 2  
R2L First address of output buffer (bit stream buffer) for data output from encoder in X  
memoryNote 2, 3  
R3L First address of static area in X memoryNote 2  
R4L First address of static area in Y memoryNote 2  
R0L When 0 or greater: Size of compressed bit stream (number of bytes)  
When negative: Error  
[Return value]  
[Registers used]  
r0, r1, r2, r3, r4, r5, r6, r7,  
dp0, dp1, dp2, dp3, dp4, dp5, dp6, dp7,  
dn0, dn1, dn2, dn3, dn4, dn5, dn6, dn7,  
dmx, dmy  
[Hardware resources] Maximum stack level  
Maximum loop stack level  
7
2
Maximum number of repeats  
Maximum MIPS value  
31  
84.2 MIPS (48 kHz sampling, 128 kbps, stereo)  
Notes 1. For the parameters necessary for compression, refer to 2.4 Parameters Necessary for Compression.  
2. For the memory area and I/O buffers, refer to 2.5 Memory Structure.  
3. The first address of the output buffer (bit stream buffer) is the same as that of the scratch area in X  
memory.  
Caution On completion of encoding, the user should perform the following procedure. This can prevent the  
previous audio data from affecting compression of the next audio data.  
(1) Input muted data of 1 frame to the PCM buffer frame (refer to Table 1-2 Number of Words of  
Input Data).  
(2) Call the MP3ENC_Encode function twice.  
(3) Call the MP3ENC_Stop function once.  
(4) Call the MP3ENC_Encode function once.  
(5) Call the MP3ENC_Stop function once.  
25  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.3.3 MP3ENC_Stop function  
The MP3ENC_Stop function terminates encoder processing. For the procedure after terminating encoding, refer to  
Figure 2-1 Application Processing Flow.  
[Classification]  
[Function name]  
[Function]  
MP3 encoder termination processing  
MP3ENC_Stop  
Terminates the encoder processing of the µSAP77016-B19.  
[Format]  
call MP3ENC_Stop  
[Arguments]  
R0L: 1 (during the encode termination processing: first call)  
0 (during the encode termination processing: second call)  
During the encode terminating processing, when calling the MP3ENC_Stop function for the  
first time, set 1; for the second time, set 0.  
[Return value]  
None  
[Registers used]  
r0, r7,  
dp4, dp5  
[Hardware resources] Maximum stack level  
Maximum loop stack level  
2
1
Maximum number of repeats  
0
Maximum number of cycles  
79  
26  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.3.4 MP3ENC_GetVersion function  
The MP3ENC_GetVersion function returns the version number of the µSAP77016-B19.  
[Classification]  
[Function name]  
[Function]  
Version information acquisition  
MP3ENC_GetVersion  
Returns the version number of the µSAP77016-B19 library in a 32-bit value.  
Version when R0 = 0x000x00010x0100: V1.01  
[Format]  
call MP3ENC_GetVersion  
[Arguments]  
[Return value]  
None  
R0H Major version number  
R0L Minor version number  
r0  
[Registers used]  
[Hardware resources] Maximum stack level  
Maximum loop stack level  
0
0
0
6
Maximum number of repeats  
Maximum number of cycles  
27  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.4 Parameters Necessary for Compression  
Secure a structure (refer to Figure 2-2) consisting of the parameters necessary for compression on X memory.  
Set the information for each parameter to this structure just once between the execution of the MP3ENC_Start and  
MP3ENC_Encoder functions.  
Figure 2-2. Structure Consisting of Parameters Necessary for Compression  
First address of  
structure: R0L  
<1> _Header_bitrate_index: 1 word  
<2> _Header_sampling_frequency: 1 word  
<3> _Header_padding_bit: 1 word  
<4> _Header_mode: 1 word  
5 words  
<5> _Header_mode_extension: 1 word  
<1> _Header_bitrate_index (1 word): This parameter sets the bit rate. For the setting values, refer to Table  
1-5 Relationship of Bit Values to Bit Rates.  
For example, to set a bit rate of 16 kbps using MPEG-2 Audio Layer-3 LSF, set 0x2.  
<2> _Header_sampling_frequency (1 word): This parameter specifies the sampling frequency. The setting  
values for this word are listed in Table 2-2.  
For example, to set a frequency of 16000 Hz using MPEG-2 Audio Layer-3 LSF, set 0x6.  
Table 2-2. Values to Specify Sampling Frequency  
Compression Method  
MPEG-1  
Value  
0x0  
0x1  
0x2  
0x3  
0x4  
0x5  
0x6  
0x7  
Frequency [Hz]  
44100  
Audio Layer-3  
48000  
32000  
Setting prohibited  
22050  
MPEG-2  
Audio Layer-3 LSF  
24000  
16000  
Setting prohibited  
<3> _Header_padding_bit (1 word): This parameter does not need to be specified by users. Set any values  
here.  
<4> _Header_mode (1 word): Set 0x3 when the number of channels is one and 0x1 when two.  
<5> _Header_mode_extension (1 word): This parameter does not need to be specified by users. Set any  
values here.  
28  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.5 Memory Structure  
With the µSAP77016-B19, the user must define the memory area and input buffer area necessary for processing.  
The scratch memory area and static memory area must be separately defined. For the size of each memory area,  
refer to Table 2-3.  
Table 2-3. Symbol Name/Memory Sizes  
Symbol Name  
scratch_x_area  
scratch_y_area  
static_x_area  
static_y_area  
Size [Words]  
5000  
X/Y Plane  
Description  
Scratch area  
X
Y
X
Y
2533  
Scratch area  
Static area  
Static area  
2304  
3214  
Caution Place the X memory and Y memory areas used for the library in the internal ROM/RAM space.  
The size of the scratch memory area and static memory area shown above does not include the  
input buffer (PCM buffer). Refer to 2.5.3 Input buffer.  
2.5.1 Scratch area  
The scratch area is a memory area that can be discarded when it is not used by the µSAP77016-B19.  
The user can use the scratch area freely after encoding processing of one frame.  
When the µSAP77016-B19 uses this area again, however, the information set by the user to this area is not  
guaranteed.  
Example SCRATCH_X  
xramseg  
scratch_x_area: ds 5000  
SCRATCH_Y  
yramseg  
scratch_y_area: ds 2533  
Caution The µ SAP77016-B19 also uses the scratch area in X memory as the bit stream buffer.  
Therefore, copy the encode data (bit stream) that is output to the scratch area (bit stream  
buffer) in X memory to another area after completing encoding of one frame, and then perform  
the encoding for the next frame.  
2.5.2 Static area  
The static area is a memory area that cannot be discarded even when the µSAP77016-B19 does not operate. The  
user must not use the static area.  
If the user manipulates this area after initialization, the correct operation of the µSAP77016-B19 cannot be  
guaranteed.  
Example STATIC_X  
static_x_area:  
xramseg  
ds 2304  
STATIC_Y  
yramseg  
static_y_area:  
ds 3214  
29  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.5.3 Input buffer  
The input buffer is an area to which audio data (16-bit linear PCM data) is input. The user must secure an area for  
the input buffer in X memory. The required input buffer size is shown in Table 2-4.  
The user can freely use the input buffer area after encoding of one frame. If the input buffer area is manipulated  
during encoding, correct operation is not guaranteed.  
Table 2-4. Input Buffer Size  
Compression Ratio  
Number of Number of Words of  
Required Input  
Channels  
Input Audio Data  
Buffer Size [word]  
MPEG-1  
1
2
1
2
1152  
2304  
576  
1152 or more  
2304 or more  
576 or more  
1152 or more  
Audio Layer-3  
MPEG-2  
Audio Layer-3 LSF  
1152  
Remark 1 word = 16 bits  
Figure 2-3. User-Defined Input Buffer (PCM Buffer)  
First address of  
input buffer: R1L  
L
R
Size of input buffer  
MPEG-1 Audio Layer-3  
Mono (1 channel): 1152 words or more  
Stereo (2 channels): 2304 words or more  
MPEG-2 Audio Layer-3 LSF  
Mono (1 channel): 576 words or more  
Stereo (2 channels): 1152 words or more  
30  
Users Manual U16553EJ1V0UM  
CHAPTER 2 LIBRARY SPECIFICATIONS  
2.5.4 Output buffer  
The output buffer (bit stream buffer) is an area from which bit stream data is output. The µSAP77016-B19  
specifies a certain area as both a scratch area and bit stream buffer area. Therefore, the user does not need to  
secure the output buffer in an area other than the scratch area in X memory.  
After encoding of one frame, the user can use the output buffer area freely when the output encode data (bit  
stream)Note is copied to another area. If the output buffer area is manipulated during encoding, correct operation is  
not guaranteed.  
Note The maximum size of the bit stream that is output during encoding of one frame is 1872 words.  
Caution The µ SAP77016-B19 also uses the scratch area in X memory as the bit stream buffer. Therefore,  
copy the encode data (bit stream) that is output to the scratch area (bit stream buffer) in X memory  
to another area after completing encoding of one frame, and then perform the encoding for the next  
frame.  
Figure 2-4. Output Buffer (Bit Stream Buffer)  
First address of  
output buffer: R2L  
Size of output buffer  
5000 words  
Remark The first address of the output buffer (bit stream buffer) is the same as that of the scratch area in X memory.  
31  
Users Manual U16553EJ1V0UM  
CHAPTER 3 INSTALLATION  
3.1 Installation Procedure  
The µSAP77016-B19 (MP3 audio encoder middleware) is supplied on a CD-ROM. The procedure for installing the  
µSAP77016-B19 in the host machine is outlined below.  
<1> Set the CD-ROM in the CD-ROM drive and copy the files to the directory where WB77016 and HSM77016  
(DSP tools) are used (e.g. C:\DSPTools).  
The following is an example of when files are copied from the Q drive to the C drive.  
Q:\>xcopy /s *.* C:\DSPTools<CR>  
<2> Confirm that the files have been copied. Refer to 1.4.5 Directory configuration for details on the  
directories.  
C:\>dir C:\DSPTools<CR>  
32  
Users Manual U16553EJ1V0UM  
CHAPTER 3 INSTALLATION  
3.2 Sample Program Creation Procedure  
A sample program is stored in the smp directory.  
The sample program operates on HSM77016 (high-speed simulator) Ver. 2.32 or later. Using the timing files  
described later makes it possible to simulate data I/O. Refer to APPENDIX SAMPLE PROGRAM SOURCE  
regarding timing files.  
The following is an explanation of how to build a sample program of the µSAP77016-B19.  
<1> Start up the WB77016 (workbench) Ver.2.4 or later.  
<2> Open the sample.prj project file.  
Example Specify sample.prj with the Open Project command on the Project menu.  
<3> Execute Build and confirm that sample.lnk has been created.  
Example The sample.lnk file can be created by selecting the Build All command from the Make menu.  
<4> Start up the HSM77016 (high-speed simulator) Ver.2.32 or later.  
<5> Open the sample.lnk file.  
Example Specify sample.lnk with the Open command on the File menu.  
<6> Open timing files (value.tmg, pcm_in.tmg, stream_out.tmg).  
Example Specify value.tmg with the Open command on the File menu.  
33  
Users Manual U16553EJ1V0UM  
CHAPTER 3 INSTALLATION  
3.3 Symbol Naming Conventions  
Table 3-1 shows the naming conventions of the symbols used for the µSAP77016-B19. Do not use symbol names  
in duplicate when other applications are used in combination.  
Table 3-1. Symbol Naming Conventions  
Classification  
Convention  
Function name, code segment name (IMSEG), MP3ENC_XXXX  
constant segment name (ROMSEG/RAMSEG),  
constant name, variable area name  
Remark XXXX is an alphanumeric character string.  
34  
Users Manual U16553EJ1V0UM  
CHAPTER 4 SYSTEM EXAMPLE  
4.1 Simulation Environment Using Timing File  
The simulation environment of the compression processing of the µSAP77016-B19 is shown below. Audio data  
(16-bit linear PCM data) is input and compressed in 1-frame units, and the compressed data is output.  
[Software environment]  
High-speed simulator: HSM77016 Ver.2.32 or later  
Sample program: sample.lnk (created in 3.2 Sample Program Creation Procedure)  
Timing file: value.tmg, pcm_in.tmg, stream_out.tmg  
4.2 Operation  
<1> Start up the high-speed simulator.  
<2> Open sample.lnk created in 3.2 Sample Program Creation Procedure.  
Example Specify sample.lnk by clicking file open.  
<3> Open the timing files (value.tmg, pcm_in.tmg, stream_out.tmg).  
Example Specify value.tmg by clicking file open.  
<4> Execute using Run.  
35  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
A.1 Header File (mp3enc.h)  
/*----------------------------------------------------------------------*/  
/* File Information */  
/*----------------------------------------------------------------------*/  
/*  
/*  
/*  
/*  
/*  
/*  
/*  
/*  
Name  
Type  
Version  
Date  
CPU  
: mp3enc.h  
*/  
*/  
*/  
*/  
*/  
*/  
*/  
*/  
: header file  
: 1.00  
: 2002 Nov 26  
: uPD7701x Family  
Assembler : WB77016 Ver 2.4  
About : Header  
/*----------------------------------------------------------------------*/  
/*  
/*  
/*  
/*  
Copyright (C) NEC Electronics Corporation 2002  
NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY  
*/  
*/  
*/  
*/  
All rights reserved by NEC Electronics Corporation.  
Use of copyright notice does not evidence publication  
/*----------------------------------------------------------------------*/  
#ifndef  
#define  
__mp3enc_h  
__mp3enc_h  
#define  
#define  
#define  
#define  
MP3ENC_SCRATCH_AREA_X_SIZE  
MP3ENC_SCRATCH_AREA_Y_SIZE  
MP3ENC_STATIC_AREA_X_SIZE  
MP3ENC_STATIC_AREA_Y_SIZE  
5000  
2533  
2304  
3214  
#define  
HeaderSize  
5
;typedef struct {  
;
short  
short  
short  
short  
short  
bitrate_index  
sampling_frequency  
padding_bit  
mode  
;
;
;
;
mode_extension  
;}  
extrn  
extrn  
extrn  
extrn  
MP3ENC_Start  
MP3ENC_Encode  
MP3ENC_Stop  
MP3ENC_GetVersion  
#endif  
36  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
A.2 Sample Source File (sample.asm)  
(1/10)  
/*----------------------------------------------------------------------*/  
/* File Information */  
/*----------------------------------------------------------------------*/  
/*  
/*  
/*  
/*  
/*  
/*  
/*  
/*  
Name  
Type  
Version  
Date  
CPU  
: sample.asm  
*/  
*/  
*/  
*/  
*/  
*/  
*/  
*/  
: Assembler program module  
: 1.00  
: 2002 Nov 26  
: uPD7701x Family  
Assembler : WB77016 Ver 2.4  
About : sample  
/*----------------------------------------------------------------------*/  
/*  
/*  
/*  
/*  
Copyright (C) NEC Electronics Corporation 2002  
NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY  
*/  
*/  
*/  
*/  
All rights reserved by NEC Electronics Corporation.  
Use of copyright notice does not evidence publication  
/*----------------------------------------------------------------------*/  
#include "mp3enc.h"  
/*----------------------------------------------------------------------*/  
#defineBitstreamBufferSize  
#definePcmBufferSize  
MP3ENC_SCRATCH_AREA_X_SIZE  
1152*2  
#defineheader_bitrate_index  
#defineheader_sampling_frequency  
#defineheader_padding_bit  
#defineheader_mode  
_Header_bitrate_index:x  
_Header_sampling_frequency:x  
_Header_padding_bit:x  
_Header_mode:x  
#defineheader_mode_extension  
_Header_mode_extension:x  
#defineOutputBufferFlag  
#definevalued  
_OutputBufferFlag:x  
_valued:x  
#defineBitstreamLength_H  
#defineBitstreamLength_L  
#defineframe  
_BitstreamLength:x  
_BitstreamLength+1:x  
_frame:x  
#defineChannel  
_Channel:x  
#definebitrate_H  
#definebitrate_L  
#definestream_length  
#defineFW_out_flag  
#defineFW_run_flag  
_bitrate:x  
_bitrate+1:x  
_stream_length:x  
_FW_out_flag:x  
_FW_run_flag:x  
/*----------------------------------------------------------------------*/  
MAIN_CTRL_WORKxramseg at 0x0ff0  
_Channel:  
ds  
ds  
ds  
ds  
1
2
1
1
_bitrate:  
_OutputBufferFlag:  
_valued:  
37  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(2/10)  
Header:  
_Header_bitrate_index:  
_Header_sampling_frequency:  
_Header_padding_bit:  
_Header_mode:  
ds  
ds  
ds  
ds  
ds  
1
1
1
1
1
; use in timing file  
_Header_mode_extension:  
_BitstreamLength:  
_frame:  
ds  
ds  
2
1
_stream_length:  
_FW_out_flag:  
_FW_run_flag:  
ds  
ds  
ds  
1
1
1
; use in timing file  
; use in timing file  
; use in timing file  
MAIN_X_WORK1 xramseg at 0x2000  
PCM:  
ds  
ds  
ds  
ds  
ds  
ds  
PcmBufferSize  
MAIN_Y_WORK  
yramseg at 0x2000  
xramseg  
OutBitstreamBuffer:  
0x1000  
STATIC_X  
static_x_area:  
MP3ENC_STATIC_AREA_X_SIZE  
MP3ENC_SCRATCH_AREA_X_SIZE  
MP3ENC_STATIC_AREA_Y_SIZE  
MP3ENC_SCRATCH_AREA_Y_SIZE  
SCRATCH_X  
xramseg  
__BitstreamBuffer:  
STATIC_Y  
yramseg  
static_y_area:  
SCRATCH_Y  
yramseg  
scratch_y_area:  
;------------------------------------------------  
VECTOR imseg at 0x200  
%define (JmpVect(addr))  
(
jmp addr;  
nop;  
nop;  
nop;  
)
%define (NopVect)  
(
nop;  
reti;  
nop;  
nop;  
)
38  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(3/10)  
ivReset:  
%JmpVect(StartUp)  
;
;
;
;
%NopVect  
%NopVect  
%NopVect  
ivINT1:  
ivINT2:  
ivINT3:  
ivINT4:  
ivINT5:  
ivINT6:  
ivINT7:  
ivINT8:  
ivINT9:  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
%NopVect  
;
;
;
;
;
;
;
;
;
;
;
;
ivINT10:  
%NopVect  
ivINT11:  
%NopVect  
ivINT12:  
%NopVect  
MAIN  
imseg at 0x240  
%define(Initialize)  
(
clr (r0)  
r1 = r0  
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
r2 = r0  
r3 = r0  
r4 = r0  
r5 = r0  
r6 = r0  
r7 = r0  
dp0 = r0l  
dp1 = r0l  
dp2 = r0l  
dp3 = r0l  
dp4 = r0l  
dp5 = r0l  
dp6 = r0l  
dp7 = r0l  
dn0 = r0l  
39  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(4/10)  
dn1 = r0l  
dn2 = r0l  
dn3 = r0l  
dn4 = r0l  
dn5 = r0l  
dn6 = r0l  
dn7 = r0l  
dmx = r0l  
dmy = r0l  
sp = r0l  
;
;
;
;
;
;
;
;
;
;
;
;
;
;
lsp = r0l  
r0l = 0xffff  
sr = r0l  
eir = r0l  
)
StartUp:  
%Initialize  
;
clr (r0)  
;
;
;
;
;
;
;
dp0 = __BitstreamBuffer  
rep BitstreamBufferSize  
*dp0++ = r0h  
dp0 = PCM  
rep PcmBufferSize  
*dp0++ = r0h  
*OutputBufferFlag = r0h  
*valued = r0h  
;
;
;
*stream_length = r0h  
r0l = static_x_area  
r1l = __BitstreamBuffer  
r2l = static_y_area  
r3l = scratch_y_area  
call MP3ENC_Start  
;MP3ENC_Start (static_x_area, (scratch_y_area=)__BitstreamBuffer,  
;
;
;
;
static_y_area, scratch_y_area)  
clr (r0)  
;run_flag = 0  
*FW_run_flag = r0h  
r0 = *FW_run_flag  
if (r0 == 0) jmp $-1  
;
;while (run_flag == 0) {}  
;
;; header analysis ;; (MSB) ;; 22+2+4+16 = 44byte -> 22word  
dp0 = PCM  
rep 22/2  
;
;fread (buff, 1, 22, fi)  
r0 = *dp0++  
r0 = *dp0++  
*Channel = r0h  
;
;fread (&Channel, 1, 2, fi)  
;
r0l = *dp0++  
r0eh = *dp0++  
;fread (&freq, 1, 4, fi)  
;
;fread (buff, 1, 16, fi)  
40  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(5/10)  
clr (r1)  
;index = 0  
r2 = r0 - 44100  
if (r2 == 0) jmp _break  
r1 = r1 + 1  
;switch (freq) {  
;case 44100: index = 0;  
break  
;
r2 = r0 - 48000  
if (r2 == 0) jmp _break  
r1 = r1 + 1  
;case 48000: index = 1;  
break  
break  
;
;
r2 = r0 - 32000  
;case 32000: index = 2;  
if (r2 == 0) jmp _break  
r1 = r1 + 2  
;
;
r2 = r0 - 22050  
if (r2 == 0) jmp _break  
r1 = r1 + 1  
;case 22050: index = 4;  
break  
break  
break  
;
;
r2 = r0 - 24000  
if (r2 == 0) jmp _break  
r1 = r1 + 1  
;case 24000: index = 5;  
;
;
r2 = r0 - 16000  
if (r2 == 0) jmp _break  
jmp $  
;case 16000: index = 6;  
;
;defualt:  
;}  
exit  
_break:  
*header_sampling_frequency = r1l;header.sampling_frequency = index  
clr (r0)  
;
r1 = r0 + 1  
;k = 1  
r0l = *Channel  
;if (Channel != 2)  
r2 = r0 - 2  
;
;
;
k += 2  
if (r2 != 0) r1 = r1 + 1  
if (r2 != 0) r1 = r1 + 1  
*header_mode = r1l  
;header.mode = k  
clr (r1)  
;
r0 = r1 + 64000  
nop  
;64kbps  
;
;
;
*bitrate_H = r0h  
*bitrate_L = r0l  
r1l = *header_sampling_frequency;  
r2 = r1 - 4  
;
r0 = *bitrate_H  
r0l = *bitrate_L  
clr (r1)  
;
;
;
if (r2 >= 0) jmp _MPEG2  
;if (header.sampling_frequency < 4) {  
;
_MPEG1:  
r2 = r0 & 7  
;
;
;
;
;
;
;
;
switch (bitrate) {  
if (r2 != 0) jmp _break2  
r0 = r0 sra 3  
r2 = r0 - (32000/8)  
r1 = r1 + 1  
case 32000:  
index = 1  
break  
if (r2 == 0) jmp _break2  
r2 = r0 - (40000/8)  
r1 = r1 + 1  
case 40000:  
index = 2  
41  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(6/10)  
if (r2 == 0) jmp _break2  
r2 = r0 - (48000/8)  
r1 = r1 + 1  
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
break  
case 48000:  
index = 3  
if (r2 == 0) jmp _break2  
r2 = r0 - (56000/8)  
r1 = r1 + 1  
break  
case 56000:  
index = 4  
if (r2 == 0) jmp _break2  
r2 = r0 - (64000/8)  
r1 = r1 + 1  
break  
case 64000:  
index = 5  
if (r2 == 0) jmp _break2  
r2 = r0 - (80000/8)  
r1 = r1 + 1  
break  
case 80000:  
index = 6  
if (r2 == 0) jmp _break2  
r2 = r0 - (96000/8)  
r1 = r1 + 1  
break  
case 96000:  
index = 7  
if (r2 == 0) jmp _break2  
r2 = r0 - (112000/8)  
r1 = r1 + 1  
break  
case 112000:  
index = 8  
if (r2 == 0) jmp _break2  
r2 = r0 - (128000/8)  
r1 = r1 + 1  
break  
case 128000:  
index = 9  
if (r2 == 0) jmp _break2  
r2 = r0 - (160000/8)  
r1 = r1 + 1  
break  
case 160000:  
index = 10  
if (r2 == 0) jmp _break2  
r2 = r0 - (192000/8)  
r1 = r1 + 1  
break  
case 192000:  
index = 11  
if (r2 == 0) jmp _break2  
r2 = r0 - (224000/8)  
r1 = r1 + 1  
break  
case 224000:  
index = 12  
if (r2 == 0) jmp _break2  
r2 = r0 - (256000/8)  
r1 = r1 + 1  
break  
case 256000:  
index = 13  
if (r2 == 0) jmp _break2  
r2 = r0 - (320000/8)  
r1 = r1 + 1  
break  
case 320000:  
index = 14  
if (r2 == 0) jmp _break2  
clr (r1)  
default:  
index = 0  
jmp _break2  
}
_MPEG2:  
;} else {  
r2 = r0 & 3  
;
;
;
;
;
;
;
;
;
;
;
switch (bitrate) {  
if (r2 != 0) jmp _break2  
r0 = r0 sra 2  
r2 = r0 - (8000/4)  
r1 = r1 + 1  
case 8000:  
index = 1  
if (r2 == 0) jmp _break2  
r2 = r0 - (16000/4)  
r1 = r1 + 1  
break  
case 16000:  
index = 2  
if (r2 == 0) jmp _break2  
r2 = r0 - (24000/4)  
r1 = r1 + 1  
break  
case 24000:  
index = 3  
42  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(7/10)  
if (r2 == 0) jmp _break2  
r2 = r0 - (32000/4)  
r1 = r1 + 1  
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;}  
;
break  
case 32000:  
index = 4  
if (r2 == 0) jmp _break2  
r2 = r0 - (40000/4)  
r1 = r1 + 1  
break  
case 40000:  
index = 5  
if (r2 == 0) jmp _break2  
r2 = r0 - (48000/4)  
r1 = r1 + 1  
break  
case 48000:  
index = 6  
if (r2 == 0) jmp _break2  
r2 = r0 - (56000/4)  
r1 = r1 + 1  
break  
case 56000:  
index = 7  
if (r2 == 0) jmp _break2  
r2 = r0 - (64000/4)  
r1 = r1 + 1  
break  
case 64000:  
index = 8  
if (r2 == 0) jmp _break2  
r2 = r0 - (80000/4)  
r1 = r1 + 1  
break  
case 80000:  
index = 9  
if (r2 == 0) jmp _break2  
r2 = r0 - (96000/4)  
r1 = r1 + 1  
break  
case 96000:  
index = 10  
if (r2 == 0) jmp _break2  
r2 = r0 - (112000/4)  
r1 = r1 + 1  
break  
case 112000:  
index = 11  
if (r2 == 0) jmp _break2  
r2 = r0 - (128000/4)  
r1 = r1 + 1  
break  
case 128000:  
index = 12  
if (r2 == 0) jmp _break2  
r2 = r0 - (144000/4)  
r1 = r1 + 1  
break  
case 144000:  
index = 13  
if (r2 == 0) jmp _break2  
r2 = r0 - (160000/4)  
r1 = r1 + 1  
break  
case 160000:  
index = 14  
if (r2 == 0) jmp _break2  
clr (r1)  
default:  
index = 0  
}
_break2:  
*header_bitrate_index = r1l  
clr (r0)  
;
*frame = r0h  
;frame = 0  
*BitstreamLength_H = r0h  
*BitstreamLength_L = r0l  
;BitstreamLength = 0  
;
_while1:  
;while (1) {  
clr (r0)  
;
;
;
;
;
run_flag = 0  
*FW_run_flag = r0h  
r0 = *FW_run_flag  
if (r0 == 0) jmp $-1  
if (r0 < 0) jmp _break1  
while (run_flag == 0) {}  
if (run_flag < 0) break  
43  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(8/10)  
r0l = Header  
;
;
;
;
;
;
;
;
ret = MP3ENC_Encode (&Header, PCM, BitstreamBuffer,  
static_x_area, static_y_area)  
r1l = PCM  
r2l = __BitstreamBuffer  
r3l = static_x_area  
r4l = static_y_area  
call MP3ENC_Encode  
if (r0 < 0) jmp _exit  
call CopyOutputBuffer  
if (ret < 0) exit(ret)  
CopyOutputBuffer (ret, BitstreamBuffer)  
r1l = *frame  
r1 = r1 + 1  
*frame = r1l  
;
;
;
frame++  
jmp _while1  
;}  
_break1:  
;; MP3ENC_Stop process ;;  
clr (r0)  
;
;
;
;
dp0 = PCM  
rep 1152*2  
*dp0++ = r0h  
r1 = r0 + PCM  
;ret = MP3ENC_Encode (&Header, PCM, BitstreamBuffer,  
r2 = r0 + __BitstreamBuffer ;  
static_x_area, static_y_area)  
r0l = Header  
;
r3l = static_x_area  
r4l = static_y_area  
call MP3ENC_Encode  
if (r0 < 0) jmp _exit  
call CopyOutputBuffer  
r0l = Header  
;
;
;
;if (ret < 0) exit(ret)  
;CopyOutputBuffer (ret, BitstreamBuffer)  
;ret = MP3ENC_Encode (&Header, PCM, BitstreamBuffer,  
r1l = PCM  
;
;
;
;
;
static_x_area, static_y_area)  
r2l = __BitstreamBuffer  
r3l = static_x_area  
r4l = static_y_area  
call MP3ENC_Encode  
if (r0 < 0) jmp _exit  
call CopyOutputBuffer  
;if (ret < 0) exit(ret)  
;CopyOutputBuffer (ret, BitstreamBuffer)  
r0l = 1  
;FinalFrame = 1  
;
call MP3ENC_Stop  
r0l = Header  
;ret = MP3ENC_Encode (&Header, PCM, BitstreamBuffer,  
r1l = PCM  
;
;
;
;
;
static_x_area, static_y_area)  
r2l = __BitstreamBuffer  
r3l = static_x_area  
r4l = static_y_area  
call MP3ENC_Encode  
if (r0 < 0) jmp _exit  
call CopyOutputBuffer  
;if (ret < 0) exit(ret)  
;CopyOutputBuffer (ret, BitstreamBuffer)  
44  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(9/10)  
clr (r0)  
;FinalFrame = 0  
;
call MP3ENC_Stop  
r0 = *OutputBufferFlag  
if (r0 == 0) jmp _exit  
r0 = *valued  
;
;
;
*OutBitstreamBuffer:y = r0h  
;
;
;
r0l = 1  
*stream_length = r0l  
clr (r1)  
;
;
;
;
*FW_out_flag = r1h  
r1 = *FW_out_flag  
if (r1 == 0) jmp $-1  
_exit:  
clr (r0)  
;
r0l = 0x2222  
;length = 0x2222  
*stream_length = r0l  
*FW_out_flag = r0h  
*FW_run_flag = r0h  
jmp StartUp  
;
;out_flag = 0  
;run_flag = 0  
;
;; Copy from BitstreamBuffer to output buffer ;;  
CopyOutputBuffer:  
if (r0 == 0) ret  
;
r1 = *BitstreamLength_H  
r1l = *BitstreamLength_L  
r1 += r0  
;
;
;
;
;
*BitstreamLength_H = r1h  
*BitstreamLength_L = r1l  
dp4 = OutBitstreamBuffer  
dp0 = __BitstreamBuffer  
r2 = *OutputBufferFlag  
if (r2 != 0) jmp _L1  
;wpt = OutBitstreamBuffer  
;rpt = BitstreamBuffer  
;if (OutputBufferFlag == 0) {  
;
r1 = r0 sra 1  
*stream_length = r1l  
r2 = r0 & 1  
;
;
;
;
;
;
;
;
;
;
;
count = len >> 1  
loop r1l {  
for ( ; count > 0; count--) {  
r1 = *dp0++  
tmp = *rpt++  
*dp4++ = r1h  
*wpt++ = tmp  
}
}
*OutputBufferFlag = r2l  
if (r2 == 0) jmp _L2  
r1 = *dp0  
if (len & 1) {  
valued = *rpt  
}
*valued = r1h  
45  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(10/10)  
jmp _L2  
;}  
_L1:  
;else {  
r1 = r0 sra 1  
r2 = r0 & 1  
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
count = len >> 1  
if (len & 1)  
count++  
if (r2 != 0) r1 = r1 + 1  
*stream_length = r1l  
r0 = *valued  
tmp = valued << 8  
r0 = r0 sra 8  
loop r1l {  
for ( ; count > 0; count--) {  
r0l = *dp0++  
tmp |= *rpt++  
tmp <<= 8  
r0 = r0 sll 8  
*dp4++ = r0h  
*wpt++ = (tmp >> 16)  
tmp <<= 8  
r0 = r0 sll 8  
}
}
r0 = r0 sll 8  
*valued = r0h  
clr (r1)  
valued = tmp >> 16  
*wpt = valued  
if (r2 == 0) r1 = r1 + 1  
*OutputBufferFlag = r1l  
_L2:  
;}  
clr (r1)  
;
;
;
;
*FW_out_flag = r1l  
r1 = *FW_out_flag  
if (r1 == 0) jmp $-1  
ret  
;return  
end  
46  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
A.3 Timing File for Parameter Information (value.tmg)  
(1/2)  
;;----------------------------------------------------------------------  
;; File Information  
;;----------------------------------------------------------------------  
;; Name  
;; Type  
;; Version  
;; Date  
;; CPU  
: value.tmg  
: Timing File  
: 1.00  
: 2002 Nov 26  
: uPD7701x Family  
;; Assembler : WB77016 Ver2.4  
;; About  
: for MP3 audio encoder Version 1.00  
;;  
;;----------------------------------------------------------------------  
;; Copyright (C) NEC Electronics Corporation 2002  
;; NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY  
;; All rights reserved by NEC Corporation.  
;; Use of copyright notice does not evidence publication  
;;----------------------------------------------------------------------  
global Channel, FW_run_flag, FW_out_flag, stream_length, pcm_start, stream_start  
global InstAddrBitrate, InstAddrLSF, Sampling  
; MPEG1 / 32kHz / stereo  
global s32_01, s32_02, s32_03  
; bitrate  
global b320, b256, b224, b192  
global b144, b024, b016, b008  
; for MPEG1  
; for MPEG2  
global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032  
; for MPEG1/2  
local MPEG1_MASK, MPEG2_MASK  
;;; address setting ;;;  
set  
set  
set  
set  
set  
set  
set  
Channel  
= 0x0ff0;;  
= 0x0ff6;;  
= 0x0ffd;;  
= 0x0ffe;;  
= 0x0fff;;  
= 0x2000;;  
= 0x2000;;  
Sampling  
stream_length  
FW_out_flag  
FW_run_flag  
pcm_start  
stream_start  
set  
set  
InstAddrBitrate = 0x0296;;  
InstAddrLSF = 0x02fd;;  
;;; bitrate flag setting ;;;  
set  
set  
set  
set  
set  
set  
set  
b320 = 1 << 17  
b256 = 1 << 16  
b224 = 1 << 15  
b192 = 1 << 14  
b160 = 1 << 13  
b144 = 1 << 12  
b128 = 1 << 11  
47  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(2/2)  
set  
set  
set  
set  
set  
set  
set  
set  
set  
set  
set  
b112 = 1 << 10  
b096 = 1 << 9  
b080 = 1 << 8  
b064 = 1 << 7  
b056 = 1 << 6  
b048 = 1 << 5  
b040 = 1 << 4  
b032 = 1 << 3  
b024 = 1 << 2  
b016 = 1 << 1  
b008 = 1 << 0  
;;; mask flag setting ;;;  
set  
set  
MPEG1_MASK = b320|b256|b224|b192|b160|b128|b112|b096|b080|b064|b056|b048|b040|b032  
MPEG2_MASK = b160|b144|b128|b112|b096|b080|b064|b056|b048|b040|b032|b024|b016|b008  
sub FlagClear  
;;; zero clear ;;;  
set  
set  
set  
s32_01 = 0  
s32_02 = 0  
s32_03 = 0  
endsub  
sub FlagMask  
;;; masking ;;;  
set  
set  
set  
s32_01 = s32_01 & MPEG1_MASK  
s32_02 = s32_02 & MPEG1_MASK  
s32_03 = s32_03 & MPEG1_MASK  
endsub  
;;; main ;;;  
FlagClear  
set s32_02 = b040  
FlagMask  
end  
48  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
A.4 Timing File for Data Input (pcm_in.tmg)  
(1/3)  
;;----------------------------------------------------------------------  
;; File Information  
;;----------------------------------------------------------------------  
;; Name  
;; Type  
;; Version  
;; Date  
;; CPU  
: pcm_in.tmg  
: Timing File  
: 1.00  
: 2002 Nov 26  
: uPD7701x Family  
;; Assembler : WB77016 Ver2.4  
;; About  
: for MP3 audio encoder Version 1.00  
;;  
;;----------------------------------------------------------------------  
;; Copyright (C) NEC Electronics Corporation 2002  
;; NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY  
;; All rights reserved by NEC Corporation.  
;; Use of copyright notice does not evidence publication  
;;----------------------------------------------------------------------  
global Channel, FW_run_flag, FW_out_flag, stream_length, pcm_start  
global InstAddrBitrate, InstAddrLSF, Sampling  
; MPEG1 / 32kHz / stereo  
global s32_01, s32_02, s32_03  
; bitrate  
global b320, b256, b224, b192  
global b144, b024, b016, b008  
; for MPEG1  
; for MPEG2  
global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032  
; for MPEG1/2  
global size, sz  
local data, pcm  
local bitrate  
sub hanten  
; (data)  
set data = ((data >> 8) & 0xff) | ((data & 0xff) << 8)  
endsub  
sub WriteData  
hanten  
set *pcm:x = data  
set pcm = pcm + 1  
endsub  
sub Writting ; (size, sz)  
local tmp  
set pcm = pcm_start  
if (size >= sz)  
rept sz  
input data  
WriteData  
endrept  
49  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(2/3)  
set size = size - sz  
else  
set tmp = sz - size  
rept size  
input data  
WriteData  
endrept  
set data = 0  
rept tmp  
WriteData  
endrept  
set size = 0  
endif  
endsub  
sub wave2stream  
input format hex  
input size  
set *FW_run_flag:x = 1  
wait cond (*FW_run_flag:x != 1)  
set sz = 22  
Writting  
set *FW_run_flag:x = 1  
wait cond ip == InstAddrBitrate  
set r0 = bitrate  
wait cond ip == InstAddrLSF  
set sz = 576  
if (*Sampling:x < 4)  
set sz = sz << 1  
endif  
if (*Channel:x != 1)  
set sz = sz << 1  
endif  
do  
set *FW_run_flag:x = 1  
wait cond (*FW_run_flag:x != 1)  
exit (size < sz)  
Writting  
enddo  
set *FW_run_flag:x = -1  
wait cond (*FW_run_flag:x != -1)  
endsub  
50  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(3/3)  
;;; Wait for initialize ;;;  
wait 1  
if (s32_02)  
if (s32_02 & b040)  
open input "02u32.dat"  
set bitrate = 40000  
wave2stream  
close input  
endif  
endif  
break  
end  
51  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
A.5 Timing File for Data Output (stream_out.tmg)  
(1/2)  
;;----------------------------------------------------------------------  
;; File Information  
;;----------------------------------------------------------------------  
;; Name  
;; Type  
;; Version  
;; Date  
;; CPU  
: stream_out.tmg  
: Timing File  
: 1.00  
: 2002 Nov 26  
: uPD7701x Family  
;; Assembler : WB77016 Ver2.4  
;; About  
: for MP3 audio encoder Version 1.00  
;;  
;;----------------------------------------------------------------------  
;; Copyright (C) NEC Electronics Corporation 2002  
;; NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY  
;; All rights reserved by NEC Corporation.  
;; Use of copyright notice does not evidence publication  
;;----------------------------------------------------------------------  
global FW_out_flag, stream_length, stream_start  
; MPEG1 / 32kHz / stereo  
global s32_01, s32_02, s32_03  
; bitrate  
global b320, b256, b224, b192  
global b144, b024, b016, b008  
; for MPEG1  
; for MPEG2  
global b160, b128, b112, b096, b080, b064, b056, b048, b040, b032  
; for MPEG1/2  
sub wave2stream2  
local data, rpt, length  
output #10 format dec  
do  
set *FW_out_flag:x = 1  
wait cond *FW_out_flag:x != 1  
set length = *stream_length:x  
exit length >= 0x2000  
if (length)  
set rpt = stream_start  
rept length  
set data = *rpt:y  
output #10 data  
set rpt = rpt + 1  
endrept  
endif  
enddo  
endsub  
52  
Users Manual U16553EJ1V0UM  
APPENDIX SAMPLE PROGRAM SOURCE  
(2/2)  
;;; main ;;;  
wait 1  
if (s32_02)  
if (s32_02 & b040)  
open output #10 "02u32u40.dat"  
wave2stream2  
close output #10  
endif  
endif  
end  
53  
Users Manual U16553EJ1V0UM  
[MEMO]  
54  
Users Manual U16553EJ1V0UM  

相关型号:

AP777

Magic Sensor IC
APLUS

AP778

GENERAL DESCRIPTION
APLUS

AP778-01

GENERAL DESCRIPTION
APLUS

AP7811GM

Low On-Resistance, Fast Switching
A-POWER

AP78L05

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05SG-13

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05SG-A

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05SL-13

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05SL-A

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05VG-13

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05VG-A

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES

AP78L05VL-13

5V OUTPUT 3-TERMINAL POSITIVE REGULATOR
DIODES