ETC AP703000-B04

User’s Manual
µSAP703000-B04,
µSAP70732-B04
ADPCM middleware
Target device
µSAP703000-B04 : V850 familyTM
µSAP70732-B04 : V810 familyTM
Document No. U11381EJ2V0UM00 (2nd edition)
Date Published July 1998 N CP(K)
Printed in Japan
©
Printed in Japan
1996
[MEMO]
2
V810 Family, V850 Family, V810, V821, V850/SA1, V852, V853, and V854 are trademarks of NEC Corp.
Green Hills Software is a trademark of Green Hills Software, Inc.
PC DOS is a trademark of IBM Corp.
Windows and MS-DOS are either registered trademarks or trademarks of Microsoft Corporation in the United
States and/or other countries.
UNIX is a registered trademark licensed by X/Open Company Limited in the US and other countries.
SUN4 is a trademark of Sun Microsystems, Inc.
The information in this document is subject to change without notice.
No part of this document may be copied or reproduced in any form or by any means without the prior written
consent of NEC Corporation. NEC Corporation assumes no responsibility for any errors which may appear in
this document.
NEC Corporation does not assume any liability for infringement of patents, copyrights or other intellectual
property rights of third parties by or arising from use of a device described herein or any other liability arising
from use of such device. No license, either express, implied or otherwise, is granted under any patents,
copyrights or other intellectual property rights of NEC Corporation or of others.
M7A 96.10
3
Regional Information
Some information contained in this document may vary from country to country. Before using any NEC
product in your application, please contact the NEC 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 Inc. (U.S.)
NEC Electronics (Germany) GmbH
NEC Electronics Hong Kong Ltd.
Santa Clara, California
Tel: 408-588-6000
800-366-9782
Fax: 408-588-6130
800-729-9288
Benelux Office
Eindhoven, The Netherlands
Tel: 040-2445845
Fax: 040-2444580
Hong Kong
Tel: 2886-9318
Fax: 2886-9022/9044
NEC Electronics Hong Kong Ltd.
Velizy-Villacoublay, France
Tel: 01-30-67 58 00
Fax: 01-30-67 58 99
Seoul Branch
Seoul, Korea
Tel: 02-528-0303
Fax: 02-528-4411
NEC Electronics (France) S.A.
NEC Electronics Singapore Pte. Ltd.
Milton Keynes, UK
Tel: 01908-691-133
Fax: 01908-670-290
Spain Office
Madrid, Spain
Tel: 01-504-2787
Fax: 01-504-2860
United Square, Singapore 1130
Tel: 65-253-8311
Fax: 65-250-3583
NEC Electronics Italiana s.r.1.
NEC Electronics (Germany) GmbH
Milano, Italy
Tel: 02-66 75 41
Fax: 02-66 75 42 99
Scandinavia Office
Taeby, Sweden
Tel: 08-63 80 820
Fax: 08-63 80 388
NEC Electronics (France) S.A.
NEC Electronics (Germany) GmbH
Duesseldorf, Germany
Tel: 0211-65 03 02
Fax: 0211-65 03 490
NEC Electronics (UK) Ltd.
NEC Electronics Taiwan Ltd.
Taipei, Taiwan
Tel: 02-719-2377
Fax: 02-719-5951
NEC do Brasil S.A.
Cumbica-Guarulhos-SP, Brasil
Tel: 011-6465-6810
Fax: 011-6465-6829
J98. 2
4
MAJOR REVISIONS IN THIS EDITION
Page
Contents
p.20
Change of 1.3.2 (3) Supported tools
p.21
Change of 1.3.4 Directory configuration
p.43
Change of 3.1.1 V810 family
p.43
Change of 3.1.2 V850 family
p.44
Change of 3.1.3 Directory and file
p.45
Change of 3.2.1 UNIX version
p.46
Change of 3.2.2 MS-DOS/PC DOS version
p.47
Change of 3.3 Creating Sample Program
p.49
Change of APPENDIX SOURCE PROGRAM OF sample.c
The mark
shows major revised points.
5
[MEMO]
6
PREFACE
Readers
This manual is intended for user engineers who wish to design and develop application
systems using the V810 family/V850 family .
Purpose
The purpose of this manual is to help user engineers understand the middleware that
supports the design and development V810 family/V850 family application systems.
Organization
This manual contains the following items:
• General
• Library specification
• Installation
• Appendix
How to read this manual
It is assumed that the readers of this manual have a general knowledge of electrical
engineering, logic circuits, microcomputers, and the C language.
To understand the hardware functions of the V810 family/V850 family
→ Refer to the user’s manuals (hardware) of each product.
To understand the instruction functions of the V810 family/V850 family
→ Refer to the user’s manuals (architecture) of each product.
Legend
Data significance
: Most-significant digit on left, least-significant digit on right
Active low
: xxx (bar over pin and signal names)
Memory map address: Top-low, bottom-high
Note
in the text
Note
: Description of
Caution
: Important information
Remark
: Supplement
Numeric notation
: Binary
Decimal
... ×××× or ××××B
... ××××
Hexadecimal ... ××××H or 0× ××××
Prefix indicating power of 2 (address space, memory capacity)
K (kilo) = 210 = 1024
M (mega) = 220 = 10242
G (giga) = 230 = 10243
7
Related documents
Some of the related documents listed below are preliminary versions but not so specified
here.
Documents related to V810 family
Product Name
Nickname
Data Sheet
Device Name
User’s Manual
Hardware
V810TM
µPD70732
U10691E
U10661E
V821TM
µPD70741
U11678E
U10077E
Architecture
U10082E
Documents related to V850 family
Product Name
Nickname
V852TM
V853TM
V854TM
V850/SA1TM
8
Data Sheet
Device Name
User’s Manual
Hardware
µPD703002
U11826E
µPD70P3002
U11827E
µPD703003, 703003A, 703005A U12261E
µPD70F3003
U12036E
µPD70F3003A, 70F3025A
U13189E
µPD703008
Planned
µPD703008Y
Planned
µPD70F3008
U12756E
µPD70F3008Y
U12755E
µPD703015
Planned
µPD703015Y
Planned
µPD70F3017
Planned
µPD70F3017Y
Planned
U10038E
U10913E
U11969E
U12768E
Architecture
U10243E
Document related to V810 family development tools (user’s manual)
Document Name
CA732 (C compiler)
RX732 (Real-time OS)
Document Number
Operation
(UNIXTM
Operation
(WindowsTM
based)
based)
U11013E
U11068E
Assembly language
U11016E
C language
U11010E
Fundamental
U10346E
Nucleus installation
U10347E
Technical
U10490E
Documents related to V850 family development tools (user’s manual)
Document Name
Document Number
IE-703002-MC (In-circuit emulator for V851, V852, V853, V854, V850/SA1) U11595E
IE-703003-MC-EM1 (In-circuit emulator option board for V853)
U11596E
IE-703008-MC-EM1 (In-circuit emulator option board for V854)
U12420E
IE-703017-MC-EM1 (In-circuit emulator option board for V850/SA1)
U12898E
CA850 (C compiler)
U12839E
ID850 (C source debugger)
RX850 (real-time OS)
Operation (UNIX based)
Operation (Windows based)
U12827E
C language
U12840E
Assembly language
U10543E
Project manager (Windows based)
U11991E
Operation (Windows based)
U11196E
Installation (UNIX based)
U12210E
Fundamental
U12861E
Technical
U13002E
Nucleus installation
U11038E
Installation (UNIX based)
U12863E
Installation (Windows based)
U12862E
Debugger (Windows based)
U11158E
AZ850 (system performance analyzer) – operation
U11181E
For inquiries about the tools produced by Green Hills SoftwareTM, Inc. (GHS),
please contact:
Green Hills Software, Inc.
510 Castillo Street, Santa Barbara,
California 93101
Tel: 805-965-6044
Web site: http://www.ghs.com
9
[MEMO]
10
CONTENTS
CHAPTER 1 GENERAL ........................................................................................................................ 15
1.1
1.2
1.3
Middleware ....................................................................................................................... 15
ADPCM ............................................................................................................................. 15
1.2.1
PCM-to-linear conversion block ............................................................................................
17
1.2.2
ADPCM compression block ..................................................................................................
17
1.2.3
ADPCM expansion block ......................................................................................................
18
1.2.4
Linear-to-PCM conversion block ...........................................................................................
18
1.2.5
Synchronous coding correction block ...................................................................................
18
Product Outline ................................................................................................................ 19
1.3.1
Features ................................................................................................................................
19
1.3.2
Operating environment .........................................................................................................
19
1.3.3
Performance ..........................................................................................................................
20
1.3.4
Directory configuration ..........................................................................................................
21
CHAPTER 2 LIBRARY SPECIFICATIONS ........................................................................................... 23
2.1
2.2
2.3
2.4
2.5
Function ........................................................................................................................... 23
2.1.1
Compression processing ......................................................................................................
23
2.1.2
Expansion processing ...........................................................................................................
24
RAM .................................................................................................................................. 25
Data Type ......................................................................................................................... 25
2.3.1
int pcm_mlaw ........................................................................................................................
25
2.3.2
int pcm_alaw .........................................................................................................................
25
2.3.3
int linear_enc .........................................................................................................................
26
2.3.4
int linear_dec .........................................................................................................................
26
2.3.5
int adpcm_32kbps .................................................................................................................
26
2.3.6
int adpcm_16kbps .................................................................................................................
26
Error Processing ............................................................................................................. 27
Function Specifications .................................................................................................. 27
2.5.1
Initialization function ..............................................................................................................
27
2.5.2
Compression function ...........................................................................................................
28
2.5.3
Expansion function ................................................................................................................
34
CHAPTER 3 INSTALLATION ............................................................................................................... 43
3.1
3.2
3.3
Supply Format ................................................................................................................. 43
3.1.1
V810 family ...........................................................................................................................
43
3.1.2
V850 family ...........................................................................................................................
43
3.1.3
Directory and file ...................................................................................................................
44
File Expansion to Host Machine .................................................................................... 45
3.2.1
UNIX version .........................................................................................................................
45
3.2.2
MS-DOS/PC DOS version ....................................................................................................
46
Creating Sample Program .............................................................................................. 47
11
3.4
3.5
Changing Location .......................................................................................................... 48
Symbol Name Convention .............................................................................................. 48
APPENDIX SOURCE PROGRAM OF sample.c .................................................................................. 49
12
LIST OF FIGURES
Figure No.
Title
Page
1-1
Recommendation G.726 ...................................................................................................................
15
1-2
Concept of ADPCM ...........................................................................................................................
16
1-3
Organization of ADPCM Processing .................................................................................................
16
1-4
Organization of ADPCM Compression Block ....................................................................................
17
1-5
Organization of ADPCM Expansion Block ........................................................................................
18
2-1
Compression Flow ............................................................................................................................
23
2-2
Expansion Processing Flow ..............................................................................................................
24
3-1
Organization of Sample Program ......................................................................................................
47
13
LIST OF TABLES
Table No.
14
Title
Page
1-1
V810 Performance ............................................................................................................................
20
1-2
V853 Performance ............................................................................................................................
20
2-1
Compression Functions ....................................................................................................................
23
2-2
Expansion Functions .........................................................................................................................
24
CHAPTER 1 GENERAL
This chapter explains the middleware and ADPCM decoder.
1.1 Middleware
Middleware is a software group tuned to draw out the full performance of a processor.
Because many high-performance RISC processors are available today, the processing conventionally implemented by dedicated hardware can now be realized by a high-performance RISC processor and software. The
software used for this purpose is called middleware.
NEC supplies human-machine interface and signal processing technologies in the form of middleware. It provides
excellent system solutions to satisfy the various needs of users.
This ADPCM middleware is a library that compresses and expands speech code (telephone quality).
Remark RISC: Reduced Instruction Set Computer
1.2 ADPCM
The ADPCM of this middleware codes speech in the analog telephone band (0.3 to 3.4 kHz) stipulated by ITUT Recommendation G.726.
Recommendation G.726 was issued in 1990 by adding 40-kbps ADPCM, 24-kbps ADPCM, and 16-kbps ADPCM
to Recommendation G.721 (32-kbps ADPCM) which was adopted as an international standard of telephone quality
coding in 1988.
This middleware supports the 32-kbps ADPCM and 16-kbps ADPCM of Recommendation G.726.
Remark ADPCM: Adaptive Differential Pulse Code Modulation
ITU-T: International Telecommunication Union-Telecommunication standardization sector
Figure 1-1. Recommendation G.726
Recommendation G.726
Recommendation G.721
40-kbps ADPCM
32-kbps ADPCMNote
24-kbps ADPCM
16-kbps ADPCMNote
Note Supported by this middleware.
15
CHAPTER 1
GENERAL
The interface of ADPCM is based on the 64-kbps PCM code stipulated by ITU-T Recommendation G.711. This
is because the 64-kbps PCM of Recommendation G.721 has been widely used as an international standard telephone
quality coding method, and because ADPCM was developed as a standard to improve the compression rate.
The 64-kbps PCM of ITU-T Recommendation G.711 limits the bandwidth to 0.3 to 3.4 kHz by using a bandpass
filter and codes analog speech signals sampled at 8 kHz into 8-bit digital signals by means of non-linear quantization.
The 64-kbps PCM has two modes: µ-law mode (used in Japan and North America) and A-law mode (used in Europe).
ADPCM is a standard for further compressing the speech codes compressed by means of 64-kbps PCM.
Figure 1-2. Concept of ADPCM
Compression
PCM code
ADPCM code
32 kbps : 8 kHz × 4 bits
16 kbps : 8 kHz × 2 bits
64 kbps : 8 kHz × 8 bits
Expansion
The compression/expansion processing of ADPCM is described next.
The compression processing of ADPCM is performed by a PCM-to-linear conversion block and an ADPCM
compression block, as shown in Figure 1-3.
The expansion processing of ADPCM is performed by an ADPCM expansion block, linear-to-PCM conversion
block, and synchronous coding correction block, as shown in Figure 1-3. The expansion processing prevents
degradation of the sound quality by repeatedly compressing and expanding speech data, by using the synchronous
coding correction block, when incorporated to an existing digital (64-kbps PCM) communication network.
Figure 1-3. Organization of ADPCM Processing
Compression processing
8 bits
PCM-to-linear
conversion block
14 bits
ADPCM
compression block
32 kbps : 4 bits
16 kbps : 2 bits
PCM code
ADPCM code
Internal variables
8 bits
Synchronous coding
correction block
8 bits
Linear-to-PCM
conversion block
Expansion processing
16
16 bits
ADPCM
expansion block
CHAPTER 1
GENERAL
1.2.1 PCM-to-linear conversion block
This block converts a 64-kbps PCM code (8 bits) into a linear code (14 bits: expressed as 2’s complement).
The PCM code in the µ-law mode is converted by a PCM decoder conforming to Recommendation G.711.
The PCM code in the A-law mode is converted by a PCM decoder conforming to Recommendation G.711. The
resulting value is doubled and then adjusted to 14 bits.
1.2.2 ADPCM compression block
This block compresses a linear code (14 bits) to an ADPCM code (32 kbps: 4 bits, 16 kbps: 2 bits) in the following
procedure (refer to Figure 1-4):
(1) A predicted signal is subtracted from the input signal (linear code) to calculate a differential signal.
(2) The differential signal is coded by using an adaptive quantization unit.
For 32-kbps ADPCM, the differential signal is coded to 4 bits by using a 15 level adaptive quantization unit.
For 16-kbps ADPCM, the differential signal is coded to 2 bits by using a 4 level adaptive quantization unit.
This coded signal is an ADPCM code and is the output of the compression processing.
(3) An adaptive reverse quantization unit is used to generate a quantized differential signal from the ADPCM code.
(4) The quantized differential signal is added to the predicted signal to reproduce the input signal.
(5) An adaptive prediction unit is used to calculated the predicted value of the next input signal from the reproduced
signal and quantized differential signal.
Figure 1-4. Organization of ADPCM Compression Block
Linear code
(14 bits)
+
+
Differential
signal
–
Predicted
signal
Adaptive
quantization unit
32 kbps : 15 levels
16 kbps : 4 levels
Reproduced
signal
Adaptive
prediction unit
ADPCM code
(32 kbps : 4 bits)
(16 kbps : 2 bits)
+
+
+
Quantized
differential signal
Adaptive reverse
quantization unit
32 kbps : 15 levels
16 kbps : 4 levels
17
CHAPTER 1
GENERAL
1.2.3 ADPCM expansion block
This block expands an ADPCM code (32 kbps: 4 bits, 16 kbps: 2 bits) to a reproduced linear code (16 bits) in the
following procedure (refer to Figure 1-5):
(1) A quantized differential signal is generated from the ADPCM code by using an adaptive reverse quantization
unit.
(2) The input signal is reproduced by adding the quantized differential signal to a predicted signal. This signal
is the output signal of the ADPCM expansion processing.
(3) An adaptive prediction unit is used to calculate the predicted value of the next input signal from the reproduced
signal and quantized differential signal.
Figure 1-5. Organization of ADPCM Expansion Block
ADPCM code
(32 kbps : 4 bits)
(16 kbps : 2 bits)
Quantized
Reproduced
Adaptive reverse
+
signal
quantization unit differential signal
+
32 kbps : 15 levels
16 kbps : 4 levels
+
Predicted
signal
Reproduced linear code
(16 bits)
Adaptive
prediction unit
1.2.4 Linear-to-PCM conversion block
This block converts a reproduced linear code (16 bits) to a 64-kbps PCM code (8 bits).
The PCM code in the µ-law mode is converted by a PCM coder conforming to Recommendation G.711.
The PCM code in the A-law mode is converted by a PCM coder conforming to Recommendation G.711 after the
reproduced linear code has been adjusted (1/2)
1.2.5 Synchronous coding correction block
The synchronous coding block corrects for cumulative distortion that may take place when compression from PCM
to ADPCM and expansion from ADPCM to PCM (synchronous tandem coding) are repeatedly performed.
The value of the reproduced linear code, which is the input signal, is corrected by simulating the ADPCM code
to be compressed next by using the PCM-to-linear conversion block described in 1.2.1 and in steps (1) and (2)
described in 1.2.2 ADPCM compression block, so that the value of the reproduced linear code is the same as that
of the current ADPCM code.
18
CHAPTER 1
GENERAL
1.3 Product Outline
1.3.1 Features
Conforms to the international ADPCM standard (ITU-T Recommendation G.726).
(1) Bit rate
The following two bit rates are supported:
• 32-kbps ADPCM (compresses 1 sampling data to 4 bits)
• 16-kbps ADPCM (compresses 1 sampling data to 2 bits)
(2) 64 kbps PCM code interface
The following two modes conforming to the international 64-kbps PCM standard (ITU-T Recommendation
G.711) are supported:
• µ-law mode
• A-law mode
If synchronous tandem coding is not performed for expansion, a mode in which the synchronous coding
correction function is deleted from the ITU-T Recommendation G.726, with increased execution speed, is
supported.
(3) Linear code interface
A liner code interface that deletes the functions (mutual conversion of 64 kbps PCM code and linear code and
synchronous coding correction) that are related to the 64-kbps PCM code interface and that can be deleted
from the international standard of ADPCM (ITU-T Recommendation G.726) is supported.
Remark The linear code interface does not support synchronous tandem coding.
1.3.2 Operating environment
(1) Target CPU
• V810 family
• V850 family
(2) Necessary memory
• ROM: total capacity of 9K bytes or less (The capacity varies depending on the functions to be linked.)
• RAM: 80 bytes max.
19
CHAPTER 1
GENERAL
(3) Supported tools
(a) V810 family
• NEC C compiler package: CA732 (Windows 3.1 or above, SUN4™)
• GHS C compiler/assembler: C-V810 (Windows 3.1 or above, SUN4)
(b) V850 family
• NEC C compiler package: CA850 (Windows 3.1 or above, SUN4)
• GHS C compiler/assembler: C-V850 (Windows 3.1 or above, SUN4)
1.3.3 Performance
The processing time per sampling data is shown below.
(1) V810
[Condition] 25 MHz, 32-bit bus, cache OFF, 0 wait ROM/RAM
Table 1-1. V810 Performance
Compression/Expansion
Compression
Expansion
Processing Time
Linear code interface
62 µs max.
PCM code interface
63 µs max.
Linear code interface (synchronous tandem coding
59 µs max.
not supported)
PCM code interface (synchronous tandem coding
61 µs max.
not supported)
PCM code interface
66 µs max.
(2) V853
[Condition] 33 MHz, internal ROM/RAM, 0 wait, external RAM (speech data)
Table 1-2. V853 Performance
Compression/Expansion
Compression
Expansion
Processing Time
Linear code interface
29 µs max.
PCM code interface
30 µs max.
Linear code interface (synchronous tandem coding
28 µs max.
not supported)
PCM code interface (synchronous tandem coding
29 µs max.
not supported)
PCM code interface
20
31 µs max.
CHAPTER 1
GENERAL
1.3.4 Directory configuration
The directory configuration of the middleware library ADPCM is as follows:
(1) V810 family (software version: Ver. 1.00)
./
nectools
lib810
smp810
libadpcm. a
adpcm
sample. c
makefile
linear o
expect_e.o
expect_d.o
ghstools
lib810
smp810
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
(2) V850 family (software version: Ver. 1.01)
./
nectools
lib850
smp850
libadpcm. a
adpcm
sample. c
makefile
linear.o
expect_e.o
expect_d.o
startup.s
sample.lnk
ghstools
lib850
smp850
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
startup.s
dfile
21
[MEMO]
22
CHAPTER 2 LIBRARY SPECIFICATIONS
2.1 Function
2.1.1 Compression processing
Speech data is compressed to ADPCM codes of 32 kbps or 16 kbps. The speech data which is input is classified
according to functions corresponding to linear codes and 64-kbps PCM codes (µ-law, A-law).
Table 2-1. Compression Functions
Function Classification
Input Data Type → Compressed Data Type
→ 32-kbps ADPCM
adpcm_132_enc ( )
Linear code
adpcm_pm32_enc ( )
64-kbps PCM code (µ-law) → 32-kbps ADPCM
adpcm_pa32_enc ( )
64-kbps PCM code (A-law) → 32-kbps ADPCM
adpcm_I16_enc ( )
Linear code
adpcm_pm16_enc ( )
64-kbps PCM code (µ-law) → 16-kbps ADPCM
adpcm_pa16_enc ( )
64-kbps PCM code (A-law) → 16-kbps ADPCM
→ 16-kbps ADPCM
Figure 2-1. Compression Flow
Start
ADPCM initialization
Input of speech data
Library sections
ADPCM compression
Storage of
compressed data
No
End ?
Yes
End
23
CHAPTER 2
LIBRARY SPECIFICATIONS
2.1.2 Expansion processing
Compressed data (ADPCM codes of 32 kbps or 16 kbps) is expanded to speech data. The speech data which
is output is classified according to functions corresponding to linear codes and 64-kbps PCM codes (µ-law, A-law).
Table 2-2. Expansion Functions
Function Classification
Compressed Data Type → Output Data Type
adpcm_l32_dec ( )
32-kbps ADPCM
→ linear code
adpcm_pm32_dec ( )
32-kbps ADPCM
→ 64-kbps PCM code (µ-law)
adpcm_pa32_dec ( )
32-kbps ADPCM
→ 64-kbps PCM code (A-law)
)Note
32-kbps ADPCM
→ 64-kbps PCM code (µ-law)
adpcm_tpa32_dec ( )Note
32-kbps ADPCM
→ 64-kbps PCM code (A-law)
adpcm_I16_dec ( )
64-kbps ADPCM
→ linear code
adpcm_pm16_dec ( )
16-kbps ADPCM
→ 64-kbps PCM code (µ-law)
adpcm_pa16_dec ( )
16-kbps ADPCM
→ 64-kbps PCM code (A-law)
adpcm_tpm16_dec ( )Note
16-kbps ADPCM
→ 64-kbps PCM code (µ-law)
)Note
16-kbps ADPCM
→ 64-kbps PCM code (A-law)
adpcm_tpm32_dec (
adpcm_tpa16_dec (
Note These functions support tandem synchronous coding.
Figure 2-2. Expansion Processing Flow
Start
ADPCM initialization
Reads compressed data
ADPCM expansion
Outputs expanded data
No
End ?
Yes
End
24
Library sections
CHAPTER 2
LIBRARY SPECIFICATIONS
2.2 RAM
Be sure to secure the determined memory capacity (resident area) for each of the compression and expansion
processing with this library. To secure the resident area, perform the following in the user application:
int work[16]
Manage the resident area in the user application, and specify a pointer (first address) with the input parameter
of the compression/expansion function. Do not destroy the contents of the resident area until the compression/
expansion processing sequence is completed. The operation is not guaranteed if the resident area is destroyed. This
library also uses the following stack area for the compression/expansion functions:
• V810 family version: 3 words (12 bytes)
• V850 family version: 2 words (8 bytes)
2.3 Data Type
This section describes the data used with this library. Each data type is standardized to int width (32 bits) to increase
the processing speed. Note that the valid range is not checked in each function.
2.3.1 int pcm_mlaw
[Contents]
64-kbps PCM code (µ-law)
[Description] 8-bit data (Zero-extend up to bit 31.)
[Valid range] 0 to 255
31
24 23
16 15
8 7
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Zero extension
2.3.2 int pcm_alaw
[Contents]
64-kbps PCM code (A-law)
[Description] 8-bit data (Zero-extend up to bit 31.)
[Valid range] 0 to 255
31
24 23
16 15
8 7
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Zero extension
25
CHAPTER 2
LIBRARY SPECIFICATIONS
2.3.3 int linear_enc
[Contents]
Linear code (compression processing argument)
[Description] 14-bit data (expressed as 2’s complement. Sign-extend up to bit 31.)
[Valid range] –8192 to 8191
31
24 23
16 15
8 7
0
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
Sign extension
2.3.4 int linear_dec
[Contents]
Linear code (expansion processing return value)
[Description] 16-bit data (expressed as 2’s complement. Sign-extended up to bit 31)
[Valid range] –32768 to 32767
31
24 23
16 15
8 7
0
8 7
0
∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
Sign extension
2.3.5 int adpcm_32kbps
[Contents]
32-kbps ADPCM code
[Description] 4-bit data (Zero-extend up to bit 31.)
[Valid range] 1 to 15
31
24 23
16 15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Zero extension
2.3.6 int adpcm_16kbps
[Contents]
16-kbps ADPCM code
[Description] 2-bit data (Zero-extend up to bit 31.)
[Valid range] 0 to 3
31
24 23
16 15
8 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Zero extension
26
0
CHAPTER 2
LIBRARY SPECIFICATIONS
2.4 Error Processing
The functions of the ADPCM library do not have an error processing functions like outputting an error code as a
return value. This is because the value outside the valid range in the middle of calculation is limited (saturated) by
the Recommendation and therefore, errors do not exist. However, errors, such as NMI, may occur. If these errors
occur, deal with them in the user application by managing flags before and after function calls.
2.5 Function Specifications
The ADPCM library supplies a total of 17 functions including an initialization function, six compression (encoder)
functions, and 10 expansion (decoder) functions. These functions are described next.
2.5.1 Initialization function
(1) adpcm_init function
This function initializes the encoder and decoder.
Secure a resident area (64 bytes) for the processing of the encoder and decoder in the application program,
and use the addresses of that area as arguments.
Be sure to call the adpcm_init function before performing an encoder/decoder processing sequence.
[Classification]
ADPCM initialization (common to encoder and decoder)
[Function name] adpcm_init
[Outline]
Initializes the resident area of the ADPCM encoder and decoder.
[Format]
void adpcm_init (init *work);
[Argument]
Type
int
Argument
work [16]
Description
First address of resident area (64 bytes)
[Return value]
None
[Feature]
Initializes the resident area for the encode and decode processing.
Caution After calling the adpcm_init function, do not destroy the resident RAM area until the encode and decode
processing sequence is completed. If the resident area is destroyed, the operation is not guaranteed.
27
CHAPTER 2
LIBRARY SPECIFICATIONS
2.5.2 Compression function
(1) adpcm_I32_enc function
This function performs 32-kbps ADPCM encode processing of the linear code interface.
It encodes a linear code given by the input parameter, and returns a 32-kbps ADPCM code as a return value.
Of the parameters to be passed to the adpcm_I32_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
32-kbps ADPCM encode processing (linear code interface)
[Function name] adpcm_I32_enc
[Outline]
Encodes a specified linear code to a 32-kbps ADPCM code.
[Format]
int adpcm_I32_enc (int linear_enc, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
linear_enc
Linear code
Type
int
Return Value
adpcm_32
Description
32-kbps ADPCM code
[Feature]
Encodes sampling data given by a linear code to a 32-kbps ADPCM code.
[Remark]
The following function is deleted from the 32-kbps ADPCM encoder of ITU-T
Recommendation.
• Conversion from 64-kbps PCM code to linear code
28
CHAPTER 2
LIBRARY SPECIFICATIONS
(2) adpcm_pm32_enc function
This function performs 32-kbps ADPCM encode processing of the µ-law PCM code interface.
It encodes a 64-kbps µ-law PCM code given by the input parameter, and returns a 32-kbps ADPCM code as
a return value.
Of the parameters to be passed to the adpcm_pm32_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
32-kbps ADPCM encode processing (µ-law PCM code interface)
[Function name] adpcm_pm32_enc
[Outline]
Encodes a specified 64-kbps µ-law PCM code to a 32-kbps ADPCM code.
[Format]
int adpcm_pm32_enc (int pcm_mlaw, int *work)
[Argument]
[Return value]
Type
Description
int
work [16]
First address of resident area (64 bytes)
int
pcm_mlaw
64-kbps µ-law PCM
Type
int
[Feature]
Argument
Return Value
adpcm_32
Description
32-kbps ADPCM code
Encodes sampling data given by a 64-kbps µ-law PCM code to a 32-kbps ADPCM code.
29
CHAPTER 2
LIBRARY SPECIFICATIONS
(3) adpcm_pa32_enc function
This function performs 32-kbps ADPCM encode processing of the A-law PCM code interface.
It encodes a 64-kbps A-law PCM code given by the input parameter, and returns a 32-kbps ADPCM code as
a return value.
Of the parameters to be passed to the adpcm_pa32_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
32-kbps ADPCM encode processing (A-law PCM code interface)
[Function name] adpcm_pa32_enc
[Outline]
Encodes a specified a 64-kbps A-law PCM code to a 32-kbps ADPCM code.
[Format]
int adpcm_pa32_enc (int pcm_alaw, int *work)
[Argument]
[Return value]
Type
30
Description
int
work [16]
First address of resident area (64 bytes)
int
pcm_alaw
64-kbps A-law PCM code
Type
int
[Feature]
Argument
Return Value
adpcm_32
Description
32-kbps ADPCM code
Encodes sampling data given by a 64-kbps A-law code to a 32-kbps ADPCM code.
CHAPTER 2
LIBRARY SPECIFICATIONS
(4) adpcm_I16_enc function
This function performs 16-kbps ADPCM encode processing of the linear code interface.
It encodes a linear code given by the input parameter, and returns a 16-kbps ADPCM code as a return value.
Of the parameters to be passed to the adpcm_I16_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
16-kbps ADPCM encode processing (A-law PCM code interface)
[Function name] adpcm_I16_enc
[Outline]
Encodes a specified linear code to a 32-kbps ADPCM code.
[Format]
int adpcm_I16_enc (int pcm_alaw, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
linear_enc
Linear code
Type
int
Return Value
adpcm_16
Description
16-kbps ADPCM code
[Feature]
Encodes sampling data given by a linear code to a 16-kbps ADPCM code.
[Remark]
The following function is deleted from the 16-kbps ADPCM encoder of ITU-T
Recommendation.
• Conversion from 64-kbps PCM code to linear code
31
CHAPTER 2
LIBRARY SPECIFICATIONS
(5) adpcm_pm16_enc function
This function performs 16-kbps ADPCM encode processing of the µ-law PCM code interface.
It encodes a 64-kbps µ-law PCM code given by the input parameter, and returns a 16-kbps ADPCM code as
a return value.
Of the parameters to be passed to the adpcm_pm16_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
16-kbps ADPCM encode processing (µ-law PCM code interface)
[Function name] adpcm_pm16_enc
[Outline]
Encodes a specified a 64-kbps µ-law PCM code to a 16-kbps ADPCM code.
[Format]
int adpcm_pm16_enc (int pcm_mlaw, int *work)
[Argument]
[Return value]
Type
32
Description
int
work [16]
First address of resident area (64 bytes)
int
pcm_mlaw
64-kbps µ-law PCM code
Type
int
[Feature]
Argument
Return Value
adpcm_16
Description
16-kbps ADPCM code
Encodes sampling data given by a 64-kbps µ-law PCM code to a 16-kbps ADPCM code.
CHAPTER 2
LIBRARY SPECIFICATIONS
(6) adpcm_pa16_enc function
This function performs 16-kbps ADPCM encode processing of the A-law PCM code interface.
It encodes a 64-kbps A-law PCM code given by the input parameter, and returns a 16-kbps ADPCM code as
a return value.
Of the parameters to be passed to the adpcm_pa16_enc function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for encode processing.
[Classification]
16-kbps ADPCM encode processing (A-law PCM code interface)
[Function name] adpcm_pa16_enc
[Outline]
Encodes a specified a 64-kbps A-law PCM code to a 16-kbps ADPCM code.
[Format]
int adpcm_pa16_enc (int pcm_alaw, int *work)
[Argument]
[Return value]
Type
Description
int
work [16]
First address of resident area (64 bytes)
int
pcm_alaw
64-kbps A-law PCM code
Type
int
[Feature]
Argument
Return Value
adpcm_16
Description
16-kbps ADPCM code
Encodes sampling data given by a 64-kbps A-law PCM code to a 16-kbps ADPCM code.
33
CHAPTER 2
LIBRARY SPECIFICATIONS
2.5.3 Expansion function
(1) adpcm_I32_dec function
This function performs 32-kbps ADPCM decode processing of the linear code interface.
It decodes a 32-kbps ADPCM code given by the input parameter, and returns a linear code as a return value.
Of the parameters to be passed to the adpcm_I32_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
32-kbps ADPCM decode processing (linear code interface)
[Function name] adpcm_I32_dec
[Outline]
Decodes a specified 32-kbps ADPCM code to a linear code.
[Format]
int adpcm_I32_dec (int adpcm-32, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm-32
32-kbps ADPCM code
Type
int
Return Value
linear_dec
Description
Linear code
[Feature]
Decodes sampling data given by a 32-kbps ADPCM code to a linear code.
[Remark]
The following function is deleted from the 32-kbps ADPCM decoder of ITU-T
Recommendation.
• Conversion from linear code to 64-kbps PCM code
• Synchronous coding correction
34
CHAPTER 2
LIBRARY SPECIFICATIONS
(2) adpcm_pm32_dec function
This function performs 32-kbps ADPCM decode processing of the µ-law PCM code interface.
It decodes a 32-kbps ADPCM code given by the input parameter, and returns a 64-kbps µ-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_pm32_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
32-kbps ADPCM decode processing (µ-law PCM code interface)
[Function name] adpcm_pm32_dec
[Outline]
Decodes a specified a 32-kbps ADPCM code to a 64-kbps µ-law PCM code.
[Format]
int adpcm_pm32_dec (int adpcm-32, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_32
32-kbps ADPCM code
Type
int
Return Value
pcm_mlaw
Description
64-kbps µ-law PCM code
[Feature]
Decodes sampling data given by a 32-kbps ADPCM code to a 64-kbps µ-law PCM code.
[Remark]
The following function is deleted from the 32-kbps ADPCM decoder of ITU-T
Recommendation.
• Synchronous coding correction.
35
CHAPTER 2
LIBRARY SPECIFICATIONS
(3) adpcm_pa32_dec function
This function performs 32-kbps ADPCM decode processing of the A-law PCM code interface.
It decodes a 32-kbps ADPCM code given by the input parameter, and returns a 64-kbps A-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_pa32_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
32-kbps ADPCM decode processing (A-law PCM code interface)
[Function name] adpcm_pa32_dec
[Outline]
Decodes a specified a 32-kbps ADPCM code to a 64-kbps A-law PCM code.
[Format]
int adpcm_pa32_dec (int adpcm-32, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_32
32-kbps ADPCM code
Type
int
Return Value
pcm_alaw
Description
64-kbps A-law PCM code
[Feature]
Decodes sampling data given by a 32-kbps ADPCM code to a 64-kbps A-law PCM code.
[Remark]
The following function is deleted from the 32-kbps ADPCM decoder of ITU-T
Recommendation.
• Synchronous coding correction.
36
CHAPTER 2
LIBRARY SPECIFICATIONS
(4) adpcm_tpm32_dec function
This function performs 32-kbps ADPCM decode processing of the µ-law PCM code interface.
It decodes a 32-kbps ADPCM code given by the input parameter, and returns a 64-kbps µ-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_tpm32_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
32-kbps ADPCM decode processing (µ-law PCM code interface)
[Function name] adpcm_tpm32_dec
[Outline]
Decodes a specified a 32-kbps ADPCM code to a 64-kbps µ-law PCM code.
[Format]
int adpcm_tpm32_dec (int adpcm-32, int *work)
[Argument]
[Return value]
Type
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_32
32-kbps ADPCM code
Type
int
[Feature]
Argument
Return Value
pcm_mlaw
Description
64-kbps µ-law PCM code
Decodes sampling data given by a 32-kbps ADPCM code to a 64-kbps µ-law PCM code.
37
CHAPTER 2
LIBRARY SPECIFICATIONS
(5) adpcm_tpa32_dec function
This function performs 32-kbps ADPCM decode processing of the A-law PCM code interface.
It decodes a 32-kbps ADPCM code given by the input parameter, and returns a 64-kbps A-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_tpa32_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
32-kbps ADPCM decode processing (A-law PCM code interface)
[Function name] adpcm_tpa32_dec
[Outline]
Decodes a specified a 32-kbps ADPCM code to a 64-kbps A-law PCM code.
[Format]
int adpcm_tpa32_dec (int adpcm_32, int *work)
[Argument]
[Return value]
Type
38
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_32
32-kbps ADPCM code
Type
int
[Feature]
Argument
Return Value
pcm_alaw
Description
64-kbps A-law PCM code
Decodes sampling data given by a 32-kbps ADPCM code to a 64-kbps A-law PCM code.
CHAPTER 2
LIBRARY SPECIFICATIONS
(6) adpcm_I16_dec function
This function performs 16-kbps ADPCM decode processing of the linear code interface.
It decodes a 16-kbps ADPCM code given by the input parameter, and returns a linear code as a return value.
Of the parameters to be passed to the adpcm_I16_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
16-kbps ADPCM decode processing (linear code interface)
[Function name] adpcm_I16_dec
[Outline]
Decodes a specified a 16-kbps ADPCM code to a linear code.
[Format]
int adpcm_I16_dec (int adpcm_16, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_16
16-kbps ADPCM code
Type
int
Return Value
linear_dec
Description
Linear code
[Feature]
Decodes sampling data given by a 16-kbps ADPCM code to a linear code.
[Remark]
The following function is deleted from the 32-kbps ADPCM decoder of ITU-T
Recommendation.
• Conversion from linear code to 64-kbps PCM code.
• Synchronous coding correction
39
CHAPTER 2
LIBRARY SPECIFICATIONS
(7) adpcm_pm16_dec function
This function performs 16-kbps ADPCM decode processing of the µ-law PCM code interface.
It decodes a 16-kbps ADPCM code given by the input parameter, and returns a 64-kbps µ-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_pm16_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
16-kbps ADPCM decode processing (µ-law PCM code interface)
[Function name] adpcm_pm16_dec
[Outline]
Decodes a specified 16-kbps ADPCM code to a µ-law PCM code.
[Format]
int adpcm_pm16_dec (int adpcm_16, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_16
16-kbps ADPCM code
Type
int
Return Value
pcm_mlaw
Description
64-kbps µ-law PCM code
[Feature]
Decodes sampling data given by a 16-kbps ADPCM code to a 64-kbps µ-law PCM code.
[Remark]
The following function is deleted from the 16-kbps ADPCM decoder of ITU-T
Recommendation.
• Synchronous coding correction
40
CHAPTER 2
LIBRARY SPECIFICATIONS
(8) adpcm_pa16_dec function
This function performs 16-kbps ADPCM decode processing of the A-law PCM code interface.
It decodes a 16-kbps ADPCM code given by the input parameter, and returns a 64-kbps A-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_pa16_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
16-kbps ADPCM decode processing (A-law PCM code interface)
[Function name] adpcm_pa16_dec
[Outline]
Decodes a specified 16-kbps ADPCM code to a 64-kbps A-law PCM code.
[Format]
int adpcm_pa16_dec (int adpcm_16, int *work)
[Argument]
[Return value]
Type
Argument
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_16
16-kbps ADPCM code
Type
int
Return Value
pcm_alaw
Description
64-kbps A-law PCM code
[Feature]
Decodes sampling data given by a 16-kbps ADPCM code to a 64-kbps A-law PCM code.
[Remark]
The following function is deleted from the 16-kbps ADPCM decoder of ITU-T
Recommendation.
• Synchronous coding correction
41
CHAPTER 2
LIBRARY SPECIFICATIONS
(9) adpcm_tpm16_dec function
This function performs 16-kbps ADPCM decode processing of the µ-law PCM code interface.
It decodes a 16-kbps ADPCM code given by the input parameter, and returns a 64-kbps µ-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_tpm16_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
16-kbps ADPCM decode processing (µ-law PCM code interface)
[Function name] adpcm_tpm16_dec
[Outline]
Decodes a specified 16-kbps ADPCM code to a µ-law PCM code.
[Format]
int adpcm_tpm16_dec (int adpcm_16, int *work)
[Argument]
[Return value]
Type
Argument
int
work [16]
First address of resident area (64 bytes)
int
adpcm_16
16-kbps ADPCM code
Type
Return Value
int
[Feature]
Description
pcm_mlaw
Description
64-kbps µ-law PCM code
Decodes sampling data given by a 16-kbps ADPCM code to a 64-kbps µ-law PCM code.
(10) adpcm_tpa16_dec function
This function performs 16-kbps ADPCM decode processing of the A-law PCM code interface.
It decodes a 16-kbps ADPCM code given by the input parameter, and returns a 64-kbps A-law PCM code as
a return value.
Of the parameters to be passed to the adpcm_tpa16_dec function, specify the same address as that passed
to the adpcm_init function as the address of the resident area for decode processing.
[Classification]
16-kbps ADPCM decode processing (A-law PCM code interface)
[Function name] adpcm_tpa16_dec
[Outline]
Decodes a specified 16-kbps ADPCM code to a 64-kbps A-law PCM code.
[Format]
int adpcm_tpa16_dec (int adpcm_16, int *work)
[Argument]
[Return value]
Type
42
Description
int
work [16]
First address of resident area (64 bytes)
int
adpcm_16
16-kbps ADPCM code
Type
int
[Feature]
Argument
Return Value
pcm_alaw
Description
64-kbps A-law PCM code
Decodes sampling data given by a 16-kbps ADPCM code to a 64-kbps A-law PCM code.
CHAPTER 3 INSTALLATION
3.1 Supply Format
The middleware library ADPCM is a library for developing applications using NEC or GHS tools. Therefore, it is
available in two media, one for NEC tools and the other for GHS tools. The contents of the supply media are as follows:
3.1.1 V810 family
./
nectools
lib810
smp810
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
ghstools
lib810
smp810
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
3.1.2 V850 family
./
nectools
lib850
smp850
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
startup.s
sample.lnk
ghstools
lib850
smp850
libadpcm.a
adpcm
sample.c
makefile
linear.o
expect_e.o
expect_d.o
startup.s
dfile
43
CHAPTER 3
INSTALLATION
3.1.3 Directory and file
The functions of each directory and file are as follows:
(1) nectools
Contains the ADPCM program used to develop applications using NEC tools.
(2) ghstools
Contains the ADPCM program used to develop applications using GHS tools.
(3) lib850
Contains the library of the ADPCM.
(4) smp810/adpcm, smp850/adpcm
Contains a sample program using the ADPCM and sample speech data.
44
CHAPTER 3
INSTALLATION
3.2 File Expansion to Host Machine
This section describes the procedure, for the UNIX version (SUN4) and MS-DOSTM/PC DOSTM version, to transfer
the files from the supply media to the host machine.
3.2.1 UNIX version
The UNIX version is available in two media: CGMT and 3.5” FD. The ADPCM files are stored in these media in
the tar format. The procedure for installing ADPCM to the host machine is as follows.
<1> Create a directory to install the ADPCM. In this example, a directory named mw_adpcm is created.
% mkdir mw_adpcm <CR>
<2> Move to the created directory.
% cd mw_adpcm <CR>
<3> Insert the supply media.
• Insert the CGMT in the magnetic tape unit.
• Insert the 3.5” FD in the floppy disk drive.
<4> Execute the tar command to expand the files on disk. The special file name to be specified differs depending
on the host machine.
In this example, only the files for NEC tools are expanded, assuming that the special file name is /dev/rst8.
% tar -xvof /dev/rst8 nectools <CR>
To expand the files for GHS tools, input the following:
% tar -xvof /dev/rst8 ghstools <CR>
<5> Confirm that the files have been installed. For each directory, refer to 3.1 Supply Format.
% ls -CFR <CR>
45
CHAPTER 3
INSTALLATION
3.2.2 MS-DOS/PC DOS version
The MS-DOS/PC DOS version is supplied on a 3.5” FD. Install the ADPCM on the host machine in the following
procedure:
<1> Create a directory to which the ADPCM is to be installed. In this example, a directory named mw_adpcm
is created in drive A.
A> md mw_adpcm <CR>
<2> Move to the created directory.
A> cd mw_adpcm <CR>
<3> Insert the supply media in the floppy disk drive. In this example, insert the disk in drive C.
<4> Execute the xcopy command to expand the files. In this example, only the files for NEC tools are expanded.
A> xcopy c: \nectools . /s /e /v <CR>
Similarly, expand the files for GHS tools as follows:
A> xcopy c: \ghstools . /s /e /v <CR>
<5> Confirm that the files have been installed. For each directory, refer to 3.1 Supply Format.
A> dir a: \nectools <CR>
46
CHAPTER 3
INSTALLATION
3.3 Creating Sample Program
The directory smp810 (V810 family version) or smp850 (V850 family version) stores a sample program using the
compression function and expansion function of 32 kbps ADPCM (linear code interface) and speech data (refer to
APPENDIX for the source program of sample.c).
The sample program compresses a data array called linear_enc stored in the file linear.o, and the result of
compression is stored in an array called adpcm_32. Next, this compressed data is expanded and the result of decoding
(expansion) is stored in an array called linear_dec.
Figure 3-1. Organization of Sample Program
7
cnt=1
cnt=2
Compression
cnt=3
cnt=4
cnt=5
cnt=6
4 3
0 (Bit)
cnt=2
cnt=1
cnt=4
cnt=6
cnt=3
cnt=5
Expansion
cnt=1
cnt=2
cnt=3
cnt=4
cnt=5
cnt=6
unsigned char adpcm_32 [cnt]
short linear_enc [cnt]
(linear.o)
short linear_dec [cnt]
In the example given below, sample program “make”, NEC tools, and UNIX version are used.
<1> Move to the directory containing the sample program.
% cd mw_adpcm/nectools/smp810/adpcm <CR>
<2> Change startup.c in accordance with the target, by using an editor. startup.c supplied as a sample describes
only initialization of the stack pointer.
<3> Execute the make command to create sample.elf
% make sample.elf <CR>
<4> Confirm that sample.elf has been created.
% ls - l sample.elf <CR>
<5> Download the sample program to the target using an in-circuit emulator and execute it.
47
CHAPTER 3
INSTALLATION
3.4 Changing Location
The ADPCM library is given the following section name. The location can be changed in accordance with the user’s
target.
Section Name
Type
Description
.ad_text
.text
Text (instruction code)
.ad_data
.data
Table data (constant)
3.5 Symbol Name Convention
The symbol names used in the ADPCM library are in compliance with the following convention. When using the
symbol names in combination with other applications, be careful not to duplicate them.
Classification
Function/symbol
48
Convention
“adpcm_” is prefixed.
APPENDIX SOURCE PROGRAM OF sample.c
--- sample.c--extern short linear_enc[0x4000];
unsigned char adpcm_32[0x4000/2];
short linear_dec[0x4000];
int work[16];
void
encoder ()
{
unsigned register int cnt;
adpcm_init( work );
for( cnt=0; cnt<0x4000; cnt++ ) {
if(cnt & 1){
adpcm_32[cnt>>1]|=((unsigned char)adpcm_132_enc((int)linear_enc[cnt],
work)) << 4;
}
else{
adpcm_32[cnt>>1]=(unsigned char)adpcm_132_enc((int)linear_enc[cnt],
work);
}
}
}
void
decoder ()
{
unsigned register int cnt;
adpcm_init( work );
for( cnt = 0; cnt<0x4000; cnt++ ){
if(cnt & 1){
linear_dec[cnt] = (short)adpcm_132_dec( ((int)adpcm_32[cnt>>1]) >> 4,
work );
}
else{
linear_dec[cnt] = (short)adpcm_132_dec( ((int)adpcm_32[cnt>>1]) & 0xf,
work );
}
}
}
main ()
{
encoder();
decoder();
}
49
[MEMO]
50
Facsimile Message
From:
Name
Company
Tel.
Although NEC has taken all possible steps
to ensure that the documentation supplied
to our customers is complete, bug free
and up-to-date, we readily accept that
errors may occur. Despite all the care and
precautions we've taken, you may
encounter problems in the documentation.
Please complete this form whenever
you'd like to report errors or suggest
improvements to us.
FAX
Address
Thank you for your kind support.
North America
Hong Kong, Philippines, Oceania
NEC Electronics Inc.
NEC Electronics Hong Kong Ltd.
Corporate Communications Dept. Fax: +852-2886-9022/9044
Fax: 1-800-729-9288
1-408-588-6130
Korea
Europe
NEC Electronics Hong Kong Ltd.
NEC Electronics (Europe) GmbH
Seoul Branch
Technical Documentation Dept.
Fax: 02-528-4411
Fax: +49-211-6503-274
South America
NEC do Brasil S.A.
Fax: +55-11-6465-6829
Asian Nations except Philippines
NEC Electronics Singapore Pte. Ltd.
Fax: +65-250-3583
Japan
NEC Semiconductor Technical Hotline
Fax: 044-548-7900
Taiwan
NEC Electronics Taiwan Ltd.
Fax: 02-719-5951
I would like to report the following error/make the following suggestion:
Document title:
Document number:
Page number:
If possible, please fax the referenced page or drawing.
Document Rating
Excellent
Good
Acceptable
Poor
Clarity
Technical Accuracy
Organization
CS 98.2