Part Number Hot Search : 
100AC BD526XG D62501 PLA10 B1424 3A0683 DSV321SR M35070
Product Description
Full Text Search
 

To Download AP77016-B07 Datasheet File

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


  Datasheet File OCR Text:
  user?s manual target device pd77110 pd77113a pd77114 pd77115 sAP77016-B07 mp3 audio decoder middleware document no. u15134ej4v0um00 (4th edition) date published september 2002 ns cp(n) printed in japan 1999 ? 2001
user?s manual u15134ej4v0um 2 [memo]
user?s manual u15134ej4v0um 3 windows is either a registered trademark or a trademark of microsoft corporation in the united states and/or other countries. m8e 00. 4 the information in this document is current as of september, 2002. the information is subject to change without notice. for actual design-in, refer to the latest publications of nec's data sheets or data books, etc., for the most up-to-date specifications of nec semiconductor products. not all products and/or types are available in every country. please check with an nec 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 prior written consent of nec. nec assumes no responsibility for any errors that may appear in this document. nec does not assume any liability for infringement of patents, copyrights or other intellectual pr operty rights of third parties by or arising from the use of nec semiconductor 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 pr operty rights of nec 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 customer's equipment shall be done under the full responsibility of customer. nec assumes no responsibility for any losses incurred by customers or third parties arising from the use of these circuits, software and information. while nec endeavours to enhance the quality, reliability and safety of nec semiconductor 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 semiconductor products, customers must incorporate sufficient safety measures in their design, such as redundancy, fire-containment, and anti-failure features. nec semiconductor products are classified into the following three quality grades: "standard", "special" and "specific". the "specific" quality grade applies only to semiconductor products developed based on a customer-designated "quality assurance program" for a specific application. the recommended applications of a semiconductor product depend on its quality grade, as indicated below. customers must check the quality grade of each semiconductor 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": tr ansportation 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 semiconductor products is "standard" unless otherwise expressly specified in nec's data sheets or data books, etc. if customers wish to use nec semiconductor products in applications not intended by nec, they must contact an nec sales representative in advance to determine nec's willingness to support a given application. (note) (1) "nec" as used in this statement means nec corporation and also includes its majority-owned subsidiaries. (2) "nec semiconductor products" means any semiconductor product developed or manufactured by or for nec (as defined above). ? ? ? ? ? ?
user ? s manual u15134ej4v0um 4 regional information some information contained in this document may vary from country to country. before using any nec product in your application, piease 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.) santa clara, california tel: 408-588-6000 800-366-9782 fax: 408-588-6130 800-729-9288 nec electronics hong kong ltd. hong kong tel: 2886-9318 fax: 2886-9022/9044 nec electronics hong kong ltd. seoul branch seoul, korea tel: 02-528-0303 fax: 02-528-4411 nec electronics shanghai, ltd. shanghai, p.r. china tel: 021-6841-1138 fax: 021-6841-1137 nec electronics taiwan ltd. taipei, taiwan tel: 02-2719-2377 fax: 02-2719-5951 nec electronics singapore pte. ltd. novena square, singapore tel: 253-8311 fax: 250-3583 nec do brasil s.a. electron devices division guarulhos-sp, brasil tel: 11-6462-6810 fax: 11-6462-6829 j02.4 nec electronics (europe) gmbh duesseldorf, germany tel: 0211-65 03 01 fax: 0211-65 03 327  sucursal en espa ? a madrid, spain tel: 091-504 27 87 fax: 091-504 28 60 v lizy-villacoublay, france tel: 01-30-67 58 00 fax: 01-30-67 58 99  succursale fran ? aise  filiale italiana milano, italy tel: 02-66 75 41 fax: 02-66 75 42 99  branch the netherlands eindhoven, the netherlands tel: 040-244 58 45 fax: 040-244 45 80  branch sweden taeby, sweden tel: 08-63 80 820 fax: 08-63 80 388  united kingdom branch milton keynes, uk tel: 01908-691-133 fax: 01908-670-290
user ? s manual u15134ej4v0um 5 major revisions in this edition page description p.27 modification of description in 2.2.5 mp3_geterrorstatus function the mark shows major revised points.
6 user ? s manual u15134ej4v0um 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, 77018, 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, and 77115 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. chapter 1 overview chapter 2 library specifications chapter 3 installation chapter 4 system examples appendix 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 user ? s manual architecture . to learn about pd77016 family hardware functions refer to pd77016 family user ? s 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 caution : information requiring particular attention remark : supplementary information numerical representation: binary ... xxxx or 0bxxxx decimal ... xxxx hexadecimal ... 0xxxxx
user ? s manual u15134ej4v0um 7 related documents the related documents listed below may include preliminary versions. however, preliminary versions are not marked as such. documents related to devices pamphlet data sheet user ? s manual application note document name part number architecture instructions basic software pd77110 u12395e u12801e u14623e u13116e u11958e pd77111 pd77112 pd77113a u14373e pd77114 pd77115 u14867e documents related to development tools document name document no. function u14397e rx77016 user ? s manual configuration tool u14404e rx77016 application note host api u14371e caution the related documents listed above are subject to change without notice. be sure to use the latest version of each document for designing.
8 user ? s manual u15134ej4v0um contents chapter 1 overview .......................................................................................................... ...............10 1.1 middleware.................................................................................................................. ................10 1.2 mp3 audio decoder ........................................................................................................... ........10 1.2.1 decoder outline........................................................................................................... ...................10 1.3 product overview............................................................................................................ ...........12 1.3.1 features.................................................................................................................. .......................12 1.3.2 functions ................................................................................................................. ......................12 1.3.3 operating environment ..................................................................................................... .............12 1.3.4 performance ............................................................................................................... ...................14 1.3.5 directory configuration ................................................................................................... ................14 1.4 compressed data format...................................................................................................... ....15 1.4.1 header .................................................................................................................... .......................15 1.4.2 crc ....................................................................................................................... ........................16 1.4.3 side information.......................................................................................................... ...................17 1.4.4 audio data................................................................................................................ ......................17 1.4.5 additional data ........................................................................................................... ....................17 1.5 timing diagram .............................................................................................................. ............17 chapter 2 library specifications ........................................................................................... .18 2.1 library overview ............................................................................................................ ............18 2.2 function specifications..................................................................................................... ........19 2.2.1 mp3_initdec function ...................................................................................................... ...............19 2.2.2 mp3_dec function.......................................................................................................... ................20 2.2.3 mp3_getversion function ................................................................................................... ...........24 2.2.4 mp3_getstatus function .................................................................................................... ............25 2.2.5 mp3_geterrorstatus function ............................................................................................... .........27 2.3 application processing flow ................................................................................................. ...28 2.3.1 data flow................................................................................................................. .......................29 chapter 3 installation ...................................................................................................... ............30 3.1 installation procedure...................................................................................................... ..........30 3.2 sample program creation procedure ......................................................................................30 3.3 symbol naming regulations ................................................................................................... .31 3.4 sample program processing flow ...........................................................................................31 chapter 4 system example ................................................................................................... .......33 4.1 simulation environment using timing files...........................................................................33 4.2 operation ................................................................................................................... .................33 appendix sample program source ..........................................................................................36
user ? s manual u15134ej4v0um 9 list of figures figure no. title page 1-1 sample configuration of decoding ............................................................................................ .................... 10 1-2 compressed data format ...................................................................................................... ....................... 15 1-3 decoder timing diagram...................................................................................................... ......................... 17 2-1 scratch area memory image ................................................................................................... ...................... 19 2-2 user-defined input buffer ................................................................................................... ........................... 21 2-3 user-defined output buffer for stereo channel ............................................................................... ............. 21 2-4 user-defined output buffer for single channel............................................................................... .............. 22 2-5 user-defined output buffer for lsf and stereo channel....................................................................... ....... 22 2-6 user-defined output buffer for lsf and single channel ....................................................................... ....... 23 2-7 skip size of read pointer................................................................................................... ........................... 27 2-8 application processing flow (decoder) ....................................................................................... .................. 28 2-9 sample data flow ............................................................................................................ ............................. 29 3-1 sample program processing flow (1) .......................................................................................... ................. 31 3-2 sample program processing flow (2) .......................................................................................... ................. 32 list of tables table no. title page 1-1 sampling frequencies ........................................................................................................ ........................... 10 1-2 bit rates ................................................................................................................... ..................................... 11 1-3 required memory sizes ....................................................................................................... ......................... 12 1-4 scratch areas ............................................................................................................... ................................. 13 1-5 software tools.............................................................................................................. ................................. 13 1-6 mips needed in one frame decompression processing ........................................................................... .. 14 1-7 details of header section ................................................................................................... ........................... 15 1-8 relationship of bit values to bit rates ..................................................................................... ..................... 16 1-9 relationship of bit values to sampling frequencies .......................................................................... ........... 16 1-10 size of side information................................................................................................... .............................. 17 2-1 list of library functions................................................................................................... .............................. 18 2-2 frequencies of mp3_getstatus() return value r2 .............................................................................. ......... 26 2-3 bit rates of mp3_getstatus() return value r4 ................................................................................ ............ 26
10 user ? s manual u15134ej4v0um 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 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-B07 is middleware that provides mp3 decoding functions. 1.2 mp3 audio decoder in this manual, audio signal encoding and decoding methods mpeg-1 audio layer-3 and mpeg-2 audio layer-3 lsf (low sampling frequency) are called mp3. the relevant standards for these are iso/iec 11172-3 and iso/iec 13818-3. sAP77016-B07 complies with this decoding method. the compressed data is data that encodes a digital signal converted to 16-bit linear pcm data after sampling an analog signal at frequencies shown in table 1-1. table 1-1. sampling frequencies mpeg-1 audio layer-3 [hz] mpeg-2 audio layer-3 lsf [hz] 44100 22050 48000 24000 32000 16000 1.2.1 decoder outline figure 1-1 is a sample configuration of decoding using sAP77016-B07. figure 1-1. sample configuration of decoding same sampling frequency as dac dac 8 to 320 kbps decoder (mp3) (mp3 encode data) out in
chapter 1 overview user ? s manual u15134ej4v0um 11 (1) mp3 encode data mp3 encode data is data sampled at frequencies shown in table 1-1 (16-bit linear pcm data) and encoded at a fixed bit rate from table 1-2 or a variable bit rate. table 1-2. bit rates mpeg-1 audio layer-3 [kbps] mpeg-2 audio layer-3 lsf [kbps] 32 8 40 16 48 24 56 32 64 40 80 48 96 56 112 64 128 80 160 96 192 112 224 128 256 144 320 160 (2) decoder the decoder reads input data, performs decoding, and outputs 16-bit linear pcm data. sAP77016-B07 decodes and outputs a maximum of two channels. finally, it performs crc processing as error compensation. (3) dac the dac converts 16-bit linear pcm data to an analog signal. the dac must operate at the sampling frequency attached to the encoded data. if the sampling frequency of the encoded data differs from the dac, separate frequency conversion software (such as a rate converter) is needed.
chapter 1 overview 12 user ? s manual u15134ej4v0um 1.3 product overview 1.3.1 features (1) employs iso/iec standardized mp3 decoder algorithm (2) bit rate can be fixed bit rate of table 1-2 or variable bit rate (3) input data is 16-bit linear pcm data sampled at frequencies shown in table 1-1 and encoded at a fixed bit rate from table 1-2 or a variable bit rate (4) output data is 16-bit linear pcm data of the same frequency as the input data sampling frequency (5) 1152 samples/frame/channel (mpeg1), 576 samples/frame/channel (mpeg2), decoding (6) provides crc as error compensation (7) does not handle free format (8) supports 2-channel decoding 1.3.2 functions (1) decompression processing decompression processing converts compressed data to one frame of 16-bit linear pcm data. (2) error compensation crc is performed as error compensation processing. 1.3.3 operating environment (1) operable dsps: pd77110, 77113a, 77114, 77115 (2) required memory size: sAP77016-B07 requires memory sizes shown in the following table. table 1-3. required memory sizes memory type size [kwords] instruction memory ? 6.4 scratch area 2.3 ram static area 2.2 x memory rom 1.7 scratch area 0.6 ram static area 3.7 y memory rom 5.4 caution one word of instruction memory is 32 bits. one word of x memory or y memory is 16 bits.
chapter 1 overview user ? s manual u15134ej4v0um 13 a scratch area is a memory area that can be discarded when sAP77016-B07 is not operating. the user can use scratch areas when sAP77016-B07 is not operating. however, caution is required when using these areas. since sAP77016-B07 will use these areas again when it operates, if a user has set information in scratch areas, the set information cannot be guaranteed. refer to table 1-4 if using scratch areas. table 1-4. scratch areas memory public symbol name size [words] x memory lib_scratch_x 2304 y memory lib_scratch_y 576 scratch areas are reserved by the user and set using the mp3_initdec function. specification of align/at is not necessary when declaring lib_scratch_x or lib_scratch_y. a static area is a memory area that cannot be discarded even when sAP77016-B07 is not operating. a user cannot use a static area. besides these, input data buffers and output buffers are needed. in the sample program described later, 1442 words are used as an input data buffer and 2304 words as two output buffers, for a total of three buffers. although it is possible to increase the size of the input data buffer, do not decrease it or it may affect operations. the output buffer size cannot be changed. however, the number of buffers can be changed. (3) required d/a specs d/a 2 ch, 16-bit resolution, sampling frequency shown in table 1-1 (4) software tools (windows tm version) table 1-5. software tools relevant dsp software tools pd77016 family dsp tools wb77016 (workbench) hsm77016 (high-speed simulator)
chapter 1 overview 14 user ? s manual u15134ej4v0um 1.3.4 performance table 1-6 shows the mips values that are necessary in order to execute decompression processing for one frame in real time. table 1-6. mips needed in one frame decompression processing conditions dsp: pd77110 (operating frequency 75 mhz, 75 mips) sampling frequency 32 khz [mips] 44.1 khz [mips] 48 khz [mips] logical note 1 maximum mips value approx. 26 approx. 35 approx. 37 measured note 2 maximum mips value 22.6 31.1 33.9 decompression measured note 2 average mips value 19.2 26.4 28.7 crc logical note 1 value 0.4 0.5 0.5 notes 1. logical means that the value is calculated by taking the maximum number of cycles for the number of loops, number of repeats, and algorithm processing route in a program. 2. measured means that the value was measured by actually executing sAP77016-B07 on a real machine using a bit rate of 320 kbps and stereo (2-channel) encoded data. 1.3.5 directory configuration the directory configuration of sAP77016-B07 is shown below. a summary of each directory is shown below. (1) library this directory contains library files. (2) smp --- mp3dec this directory contains sample program source files and header files. it also provides timing files described later. library m3dram.lib : library for pd77110, 77115 m3drom.lib : library for pd77113a, 77114 smp mp3dec m3d_dec.h : library header file (for decoder) m3d_err.h : header file for error information sample.prj : project file sample.h : header file for sample program sample.asm : sample source file sam_data.asm : data area file sam_int.asm : source file for interrupt servicing sample.tmg : timing file serclk.tmg : timing file for clocks input serially serout16.tmg : timing file for saving serial output in file
chapter 1 overview user ? s manual u15134ej4v0um 15 1.4 compressed data format for details of the compressed data format, refer to standards ( iso/iec 11172-3, jis x 4323 ). sAP77016-B07 specifications conform to standards. however, sAP77016-B07 is not in compliance with free format on a bitrate_index of ? 0000 ? . figure 1-2 shows the format structure of compressed data. figure 1-2. compressed data format frame frame frame frame frame header crc side information audio data additional data compressed data (1 file) 1 frame 1.4.1 header headers contain information such as the sampling frequency, bit rate, and mode for synchronizing. table 1-7. details of header section information number of bits used value frame sync word 12 ? 1111 1111 1111 ? : fixed value id 1 ? 1 ? : mpeg-1 ? 0 ? : mpeg-2 layer 2 ? 11 ? : layer1/ ? 10 ? : layer2/ ? 01 ? : layer3 protection bit 1 ? 0': has crc ? 1 ? : no crc bit rate 4 refer to table 1-8 relationship of bit values to bit rates. sampling frequency 2 refer to table 1-9 relationship of bit values to sampling frequencies. padding bit 1 ? 1 ? : 1 byte is added to frame note 1 ? 0 ? : 1 byte not added to frame private bit 1 not used mode 2 ? 00 ? : stereo ? 10 ? : dual_channel ? 01 ? : joint_stereo ? 11 ? : single_channel mode extension 2 ? 00 ? : is_off, ms_off ? 10 ? : is_off, ms_on ? 01 ? : is_on, ms_off ? 11 ? : is_on, ms_on note 2 copyright 1 ? 0 ? : no copyright ? 1 ? : copyright protected original/copy distinction 1 ? 0 ? : copy ? 1 ? : original emphasis 2 ? 00 ? : no emphasis ? 10 ? : reserved ? 01 ? : 50/15 s ? 11 ? : ccitt j.17 notes 1. for a sampling frequency of 44.1 khz, 1 byte is added to adjust frame ends. 2. ? is ? designates intensity stereo and ? ms ? ms stereo.
chapter 1 overview 16 user ? s manual u15134ej4v0um table 1-8. relationship of bit values to bit rates value mpeg-1 audio layer-3 [kbps] mpeg-2 audio layer-3 lsf [kbps] ? 0000 ? free format note ? 0001 ? 32 8 ? 0010 ? 40 16 ? 0011 ? 48 24 ? 0100 ? 56 32 ? 0101 ? 64 40 ? 0110 ? 80 48 ? 0111 ? 96 56 ? 1000 ? 112 64 ? 1001 ? 128 80 ? 1010 ? 160 96 ? 1011 ? 192 112 ? 1100 ? 224 128 ? 1101 ? 256 144 ? 1110 ? 320 160 ? 1111 ? setting prohibited note not supported by sAP77016-B07 table 1-9. relationship of bit values to sampling frequencies value mpeg-1 audio layer-3 [hz] mpeg-2 audio layer-3 lsf [hz] ? 00 ? 44100 22050 ? 01 ? 48000 24000 ? 10 ? 32000 16000 ? 11 ? setting prohibited 1.4.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.
chapter 1 overview user ? s manual u15134ej4v0um 17 1.4.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-10. table 1-10. size of side information mpeg-1 audio layer-3 [byte] mpeg-2 audio layer-3 lsf [byte] monaural 17 9 stereo 32 17 1.4.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.4.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. sAP77016-B07 does not perform any processing on this data. it does not even read it. 1.5 timing diagram figure 1-3. decoder timing diagram obtain compressed data mp3 decompression processing user application 16-bit linear pcm data output interrupt handler 1 frame of audio data 1 frame of 16-bit linear pcm data 1 frame of compressed data decoder (1) (2) (3) (4) (1) read 1 frame of compressed data and pass it to decompression processing. (2) convert 1 frame of compressed data to 1 frame of decompressed data. (3) buffer decompressed data. besides this, perform application processing such as rate conversion. (4) perform d/a conversion of 1 frame of 16-bit linear pcm data.
18 user ? s manual u15134ej4v0um chapter 2 library specifications 2.1 library overview sAP77016-B07 provides the following five functions. table 2-1. list of library functions function name function mp3_initdec initialize decompression processing mp3_dec decompression processing mp3_getversion obtain version information mp3_getstatus obtain status information mp3_geterrorstatus obtain error information
chapter 2 library specifications user ? s manual u15134ej4v0um 19 2.2 function specifications specifications when calling each library function are shown below. 2.2.1 mp3_initdec function [classification] mp3 decoder initialization processing [function name] mp3_initdec [summary of function] initializes ram areas and sets parameters used by sAP77016-B07 [format] call mp3_initdec [arguments] r0 length of input mp3 data (bytes) r1 to r5 reserved r6l starting address of lib_scratch_x r7l starting address of lib_scratch_y [return value] none [function] set the sub-band filter, imdct, reverse quantization, stereo, crc, and main processing parameters and initialize ram areas used by the mp3 decoder. [registers used] r0, r6, r7, dp0, dp4 [hardware resourcement] maximum stack level 2 maximum loop stack level 0 maximum number of repeats 576 maximum number of cycles 4636 caution the mp3_initdec function initializes only ram areas that the mp3 decoder uses. initialization of user-defined ram areas (such as i/o buffers) should be performed in a user program. in addition, the user should reserve lib_scratch_x and lib_scratrch_y areas in advance. figure 2-1. scratch area memory image starting address: r6l lib_scratch_x 2304 words lib_scratch_x 576 words starting address: r7l x memory y memory
chapter 2 library specifications 20 user ? s manual u15134ej4v0um 2.2.2 mp3_dec function [classification] mp3 decoder processing [function name] mp3_dec [summary of function] expands specified compressed data to one frame of audio data. [format] call mp3_dec [arguments] r0 0: decode 1: skip 1 frame of decoding r7 set the read order of identical addresses at the input buffer (user-defined) read pointer ( figure 2-2 ) 0: use from higher byte of address indicated by dp2 1: use from lower byte of address indicated by dp2 dp2 set the input buffer (user-defined) read pointer ( figure 2-2 ) dp3 set the input buffer (user-defined) write pointer ( figure 2-2 ) dp4 set to output data buffer (user-defined) pointer dmx set to size of input buffer (user-defined) ? 1 dmy set to size of output buffer (user-defined) ? 1 [return value] dp2 returns input buffer (user-defined) read pointer ( figure 2-2 ) used in next decoding r7 returns higher byte if input buffer (user-defined) read pointer ( figure 2-2 ) is 0 and lower byte if it is 1 used in next decoding [function] mp3_dec takes the address shown in dp2 and r7 as the start of input data and performs decompression on compressed data until just before the address specified in dp3. normally, the arguments dp2 and r7 use the return values of dp2 and r7 from the previous decoding. the sample program in the appendix has a two-frame output buffer. this is so that while mp3_dec outputs one frame, another frame of data can be output to the d/a. the compressed data is a stream of bit units. [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 resourcement] maximum stack level 5 maximum loop stack level 3 maximum number of repeats 256 maximum mips value 37 mips (if there is no error encoding) 37.5 mips (if there is error encoding)
chapter 2 library specifications user ? s manual u15134ej4v0um 21 (1) user-defined input buffer figure 2-2. user-defined input buffer (2) user-defined output buffer granule: internal processing unit of mp3 decoder. normally, two granules are decoded within one frame. however, one granule is decoded within one frame if lsf. sample: smallest unit of 16-bit linear pcm data output (i) for stereo channel figure 2-3. user-defined output buffer for stereo channel read pointer: dp2 write pointer: dp3 decode data from here size of buffer ? 1 = dmx pointer to output pcm buffer: dp4 l r l r size of entire buffer ? 1 = dmy granule 1 576 samples 2 ch granule 2 576 samples 2 ch
chapter 2 library specifications 22 user ? s manual u15134ej4v0um (ii) for single channel figure 2-4. user-defined output buffer for single channel (iii) for lsf and stereo channel figure 2-5. user-defined output buffer for lsf and stereo channel pointer to output pcm buffer: dp4 l/r l/r free l/r l/r size of entire buffer ? 1 = dmy granule 1 576 samples 1 ch granule 2 576 samples 1 ch pointer to output pcm buffer: dp4 free l r size of entire buffer ? 1 = dmy granule 1 576 samples 2 ch
chapter 2 library specifications user ? s manual u15134ej4v0um 23 (iv) for lsf and single channel figure 2-6. user-defined output buffer for lsf and single channel l r pointer to output pcm buffer: dp4 free size of entire buffer ? 1 = dmy granule 1 576 samples 1 ch
chapter 2 library specifications 24 user ? s manual u15134ej4v0um 2.2.3 mp3_getversion function [classification] version information acquisition [function name] mp3_getversion [summary of function] returns the version of the library. [format] call mp3_getversion [arguments] none [return value] r0h major version number r0l minor version number [function] return the version number of the sAP77016-B07 library in a 32-bit value. version when r0 = 0x00 ? 0x0001 ? 0x0100: v1.01 [registers used] r0 [hardware resourcement] maximum stack level 0 maximum loop stack level 0 maximum number of repeats 0 maximum number of cycles 6
chapter 2 library specifications user ? s manual u15134ej4v0um 25 2.2.4 mp3_getstatus function [classification] status information acquisition [function name] mp3_getstatus [summary of function] obtains the status of the mp3 decoder. information from the decoding performed just before this function was called is returned as the status. [format] call mp3_getstatus [arguments] none [return value] r0 0: mpeg-2 audio layer-3 lsf other: mpeg-1 audio layer-3 r1 0: monaural other: stereo r2 index value of sampling frequency ( table 2-2 ) r3 0: normal decoding other: skip 1 frame of decoding r4 index value of bit rate ( table 2-3 ) [function] obtain status information and set registers. [registers used] r0, r1, r2, r3, r4 [hardware resourcement] maximum stack level 0 maximum loop stack level 0 maximum number of repeats 0 maximum number of cycles 15
chapter 2 library specifications 26 user ? s manual u15134ej4v0um table 2-2. frequencies of mp3_getstatus() return value r2 value of r2 mpeg-1 audio layer-3 [hz] mpeg-2 audio layer-3 lsf [hz] 0x00 44100 22050 0x01 48000 24000 0x02 32000 16000 table 2-3. bit rates of mp3_getstatus() return value r4 value of r4 mpeg-1 audio layer-3 [kbps] mpeg-2 audio layer-3 lsf [kbps] 0x00 free format note 0x01 32 8 0x02 40 16 0x03 48 24 0x04 56 32 0x05 64 40 0x06 80 48 0x07 96 56 0x08 112 64 0x09 128 80 0x0a 160 96 0x0b 192 112 0x0c 224 128 0x0d 256 144 0x0e 320 160 note not supported by sAP77016-B07
chapter 2 library specifications user ? s manual u15134ej4v0um 27 2.2.5 mp3_geterrorstatus function [classification] error information acquisition [function name] mp3_geterrorstatus [summary of function] obtain mp3 decoder error information. [format] call mp3_geterrorstatus [arguments] none [return value] r0l error status r1l skip size (number of bytes) [function] obtain the error information of the mp3 decoder using r0l and r1l. use this function after calling the mp3_dec function. ? the following values are returned for r0l as error information. name value contents mp3_dec_no_error 0x0000 normal resumable mp3_dec_crc_error 0x0001 crc error resumable mp3_dec_header_found_error 0x0002 header detection error resumable mp3_dec_bitstream_error 0x0003 bit stream abnormality  the size of bit stream in the input buffer is zero.  no data found at the point which ? main_data_begin ? in the bit stream indicates. the bit stream is abnormal. resumable (i) crc error this is a crc error. at this time, dp2 and r7 (read pointer) have been moved to the position next to the end of the frame that is to be decoded. (ii) header detection error either the file is not an mp3 file or the file may have been corrupted. the user should suspend decoding or continue by filling the input buffer with the bit stream up to where the mp3_dec function detected a header. (iii) bit stream abnormality either the bit stream needed in decoding is inadequate or the bit stream is abnormal. the user must fill the bit stream. set the read pointer and write pointer to appropriate values and execute the mp3_dec function again. ? skip size of return value this is the size skipped from the read pointer until the next frame header when the frame header is detected. if the read pointer does not indicate the frame header, the value skipped is returned as the byte size. figure 2-7. skip size of read pointer data next frame read pointer skip size
chapter 2 library specifications 28 user ? s manual u15134ej4v0um [registers used] r0, r1 [hardware resourcement] maximum stack level 0 maximum loop stack level 0 maximum number of repeats 0 maximum number of cycles 5 2.3 application processing flow figure 2-8 shows an example of the processing of an application that uses the mp3 decoder. figure 2-8. application processing flow (decoder) audio output initialization processing start decoder initialization call mp3_initdec ? da initial setup ? interrupt enable, etc. decoder data input processing decode processing call mp3_dec input buffer host i/f output buffer serial output end of compressed data decision processing end no yes the audio data i/o processing section of the interrupt handler is processing that depends on the hardware of the target system. consequently, the user should design it to suit the target system.
chapter 2 library specifications user ? s manual u15134ej4v0um 29 2.3.1 data flow figure 2-9 shows an example of the data flow when decoding. data in the input buffer must be set in order from msb to lsb. for example, place the data 0x1234, 0x5678, ... in the order 0x12, 0x34, 0x56, 0x78, .... figure 2-9. sample data flow input data 0x1234, 0x5678, 0x12 msb 0x56 0x34 lsb 0x78 input buffer main program decoder mp3_dec 16 bits length output buffer 1 decoded data output buffer 2 copy pcm data serial output middleware section user description section interrupt handler l r 16 bits length l r
30 user ? s manual u15134ej4v0um chapter 3 installation 3.1 installation procedure the sAP77016-B07 (mp3 decoder middleware) is supplied on a 3.5-inch floppy disk (1.44 mb). the procedure for installing the sAP77016-B07 in the host machine is outlined below. (1) set the floppy disk in the floppy disk drive and copy the files to the directory where software tools are used (e.g. c:\dsptools). the following is an example of when files are copied from the a drive to the c drive. a:\>xcopy /s *.* c:\dsptools (2) confirm that the files have been copied. refer to 1.3.5 directory configuration for details on the directories. a:\>dir c:\dsptools 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 chapter 4 system example regarding timing files. the following is an explanation of how to build the mp3 decoder middleware sample program. (1) start up the wb77016 (workbench). (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). (5) open the sample.lnk file. example specify sample.lnk with the open command on the file menu. (6) open timing files (sample.tmg, serclk.tmg, serot16.tmg). serclk.tmg and serot16.tmg are files provided by hsm77016 (high-speed simulator) in example. example specify sample.tmg with the open command on the file menu.
chapter 3 installation user ? s manual u15134ej4v0um 31 3.3 symbol naming regulations the symbols used in this library are named according to the following regulations. classification regulation function name, variable name mp3_xxxx macro, constant name mp3_xxxx section name _ _mp3_xxxx (two leading underscores) 3.4 sample program processing flow figures 3-1 and 3-2 show the processing of a sample program that uses the mp3 decoder. figure 3-1. sample program processing flow (1) initialize registers initialize decoder mp3_initdec obtain input file size from host start initialization to start decoding
chapter 3 installation 32 user ? s manual u15134ej4v0um figure 3-2. sample program processing flow (2) receive data from host start decoding temporary suspension flag mp3 decoder mp3_dec end of file check end decoding obtain status information mp3_getstatus errors? process errors error check mp3_geterrorstatus no yes yes yes no no
user ? s manual u15134ej4v0um 33 chapter 4 system example 4.1 simulation environment using timing files an example in which an audio decoding decompression-processing simulator and timing files are used is shown below. encoded data is input, and then output frame by frame after each frame has undergone compression/decompression processing. [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: sample.tmg 4.2 operation <1> start up the hsm77016 (high-speed simulator) <2> open sample.lnk created in 3.2 sample program creation procedure. example specify sample.lnk with open command on the file menu. <3> open the timing files (sample.tmg, serclk.tmg, serot16.tmg). serclk.tmg and serot16.tmg are files provided by hsm77016 (high-speed simulator) in example. example specify sample.tmg with open command on the file menu. <4> make the wait settings. example set waits to the dwtr/iwtr registers in the setting windows opened by selecting periphery register on the window menu. <5> execute with run. (a) timing file sample.tmg hsm77016 (high-speed simulator) provides a function for simulating external i/o using a timing file. (b) data file input (16-bit data) data is input from a file via the host interface. an example of the description format is shown below.
chapter 4 system example 34 user ? s manual u15134ej4v0um ? ? ? ? preparation local data ; compressed data storage variable local size ; mp3 file size (bytes) set debug_id = 1 ; select target open input "mp3data.dat" ; file name of mp3 file converted to text data set size = 888058 ; mp3 file size (size of binary file in bytes) ? ? ? ? input processing (16-bit data) set pin hcs = 1 ; terminate any write access, which might set pin hwr = 1 ; be active set pin hrd = 1 ; ; send mp3 file size wait cond pin hwe == 0 ; wait till write is allowed wait cond pin hcs == 1 ; and no read is in progress set pin hcs = 0 ; perform the access... set port ha = 0 ; select higher byte of hdt set pin hwr = 0 ; start input set port hd = (size>>16)&0xff ; input low byte to host port wait 100ns ; access duration set pin hwr = 1 ; end output set pin hcs = 1 ; terminate first access... wait 5ns ; delay set port ha = 1 ; select higher byte of hdt wait 5ns ; delay set pin hcs = 0 ; performe second access... set pin hwr = 0 ; start output set port hd = (size>>24)&0xff ; input high byte to host port wait 100ns ; access duration set pin hwr = 1 ; end input set pin hcs = 1 ; end access wait 1 ; wait cond pin hwe == 0 ; wait till write is allowed wait cond pin hcs == 1 ; and no read is in progress set pin hcs = 0 ; perform the access... set port ha = 0 ; select higher byte of hdt set pin hwr = 0 ; start input set port hd = (size>>0)&0xff ; input low byte to host port wait 100ns ; access duration set pin hcs = 1 ; terminate first access... set pin hwr = 1 ; end output wait 5ns ; delay set port ha = 1 ; select higher byte of hdt wait 5ns ; delay set pin hcs = 0 ; performe second access... set pin hwr = 0 ; start output set port hd = (size>>8)&0xff ; input high byte to host port wait 100ns ; access duration set pin hwr = 1 ; end input set pin hcs = 1 ; end access do exit size<=0 ; wait cond pin hwe == 0 ; wait till write is allowed wait cond pin hcs == 1 ; and no read is in progress set pin hcs = 0 ; perform the access... set port ha = 0 ; select higher byte of hdt set pin hwr = 0 ; start input input data ; input host data to temp variable (1/2)
chapter 4 system example user ? s manual u15134ej4v0um 35 set port hd = data&0xff ; input low byte to host port wait 100ns ; access duration set pin hcs = 1 ; terminate first access... set pin hwr = 1 ; end output wait 5ns ; delay set port ha = 1 ; select higher byte of hdt wait 5ns ; delay set pin hwr = 0 ; start output set pin hcs = 0 ; performe second access... set port hd = (data>>8)&0xff ; input high byte to host port wait 100ns ; access duration set pin hwr = 1 ; end input set pin hcs = 1 ; end access set size = size-2 ; enddo close input wait cond (reg ip & 0xffff)==(mp3_mon_input_bs_finish & 0xffff) (2/2) mp3_mon_input_bs_finish is a label name that is defined at the beginning of the sample program source. ? ? ? ? termination break ; terminate end
36 user ? s manual u15134ej4v0um appendix sample program source ? ? ? ? sample.h #define mp3_sample_input_buff_size (1440+2) #define hdt 0x3806 #define hst 0x3807 #define sdt1 0x3800 #define sst1 0x3801 #define sdt2 0x3802 #define sst2 0x3803 ;scratch area extrn lib_scratch_x ;xram, size= 2304 word extrn lib_scratch_y ;xram, size= 576 word extrn mp3_sample_input_read_ptr ; extrn mp3_sample_input_read_byte_flag ; extrn mp3_sample_input_write_ptr ; extrn mp3_sample_dat_length ;data length extrn mp3_sample_remain_length ; extrn mp3_sample_decode_length ;decoded data length extrn mp3_sample_error_frame_count ;error counter extrn mp3_sample_command_stop_flag ; extrn mp3_sample_command_skip_flag ; extrn mp3_sample_lsf_frame_odd ; extrn mp3_sample_input_buff ; extrn mp3_sample_pcm_buff1 ; extrn mp3_sample_pcm_buff2 ; extrn mp3_sample_int_so1_output_ptr ; extrn mp3_sample_int_so1_output_dmx ; extrn mp3_sample_int_so1_output_dn ; extrn mp3_sample_int_saver0e ; extrn mp3_sample_int_saver0h ; extrn mp3_sample_int_saver0l ; extrn mp3_sample_int_savedp4 ; extrn mp3_sample_int_savedn4 ; extrn mp3_sample_int_savedmy ; extrn mp3_sample_int1_saver0e ; extrn mp3_sample_int1_saver0h ; extrn mp3_sample_int1_saver0l ;
appendix sample program so urce user ? s manual u15134ej4v0um 37 ? ? ? ? sample.asm /******************************************************/ /* */ /* mp3 decoder middle ware */ /* */ /* sample.asm */ /* */ /* */ /******************************************************/ #include "m3d_dec.h" #include "sample.h" #include "m3d_err.h" ;for evaluation public mp3_mon_input_bs_finish ;debug symbol public mp3_mon_decode_result ;debug symbol extrn mp3_sample_copy_mono ; extrn mp3_sample_copy_stereo ; /******************************************************** mp3_dec define constant mp3_dec_output_pcm_buffer_size user define constant mp3_sample_input_buff_size user define variable mp3_sample_input_write_ptr user input buffer write pointer mp3_sample_input_read_ptr user input buffer read pointer (mp3_dec use) mp3_sample_input_read_byte_flag user input buffer read byte flag (mp3_dec use) mp3_sample_dat_length file length mp3_sample_remain_length remain file length mp3_sample_decode_length decoded data length mp3_sample_error_frame_count error counter user define buffer mp3_sample_input_buff ds mp3_sample_input_buff_size input buffer mp3_sample_pcm_buff1 ds mp3_dec_output_pcm_buffer_size output buffer page1 mp3_sample_pcm_buff2 ds mp3_dec_output_pcm_buffer_size output buffer page2 ********************************************************/ __sample_start_main imseg at 0x200 ; jmp mp3_sample_init_start ; jmp sample main module __sample_main imseg ; mp3_sample_init_start: /******************* initial routine ****************/ r0l = 0x0401 ; *hst:x = r0l ; /******************* init register ****************/ ; init reg clr(r0) ; clr(r1) ; clr(r2) ; clr(r3) ; clr(r4) ; clr(r5) ; clr(r6) ; clr(r7) ; dn0 = 0x01 ; dn1 = 0x01 ; dn2 = 0x01 ; dn3 = 0x01 ; dn4 = 0x01 ; dn5 = 0x01 ; dn6 = 0x01 ; dn7 = 0x01 ; dp0 = 0x0 ; dp1 = 0x0 ; dp2 = 0x0 ; dp3 = 0x0 ; dp4 = 0x0 ; dp5 = 0x0 ; dp6 = 0x0 ; dp7 = 0x0 ; dmx = 0x01 ; dmy = 0x01 ; (1/5)
appendix sample program so urce 38 user ? s manual u15134ej4v0um /************* init interrupt handler variable ************/ r0l = mp3_sample_pcm_buff2 ; *mp3_sample_int_so1_output_ptr:y = r0l ; /*************** init output buffer **************/ clr(r0) ; dp4 = mp3_sample_pcm_buff2 ; rep mp3_dec_output_pcm_buffer_size * 4 ; *dp4++ = r0l ; dp4 = mp3_sample_pcm_buff1 ; rep mp3_dec_output_pcm_buffer_size * 4 ; *dp4++ = r0l ; /******************* init sst register ****************/ r0l = 0x200 ; *sst1:x = r0l ; *sst2:x = r0l ; nop ; /******************* init interrupt mask ****************/ clr(r0) ; r0l = sr ; r0 = r0 | 0x03ff ; ; ho/hi/so1/int1/int2 enable r0 = r0 & 0x7fdc ; sr = r0l ; nop ; *sdt1:x = r0h ; *sdt2:x = r0h ; /************* receive file length from host ************/ r0l= *hst:x ; r0 = r0 & 1 ; if(r0!=0) jmp $-2 ; clr(r1) ; r2=*hdt:x ; r0l= *hst:x ; r0 = r0 & 1 ; if(r0!=0) jmp $-2 ; r2l=*hdt:x ; /*************** init user variable **************/ *mp3_sample_dat_length:x = r2h ; data length[byte] *mp3_sample_dat_length+1:x = r2l ; *mp3_sample_remain_length:x = r2h ; *mp3_sample_remain_length+1:x = r2l ; clr(r0) ; *mp3_sample_decode_length:x = r0h ;decoded length[byte] *mp3_sample_decode_length+1:x = r0l ; *mp3_sample_error_frame_count:x = r0l ; error counter clr(r0) ; *mp3_sample_lsf_frame_odd:y = r0l ; r0l = mp3_sample_input_buff ; *mp3_sample_input_write_ptr:y = r0l ; user input buffer write ptr *mp3_sample_input_read_ptr:y = r0l ; user input buffer read ptr *mp3_sample_input_read_byte_flag:y = r0l ; *mp3_sample_command_stop_flag:y = r0l ; *mp3_sample_command_skip_flag:y = r0l ; /*************** init input buffer **************/ dp0 = mp3_sample_input_buff ; clr(r0) ; rep mp3_sample_input_buff_size ; *dp0++ = r0l ; /*************** init output pcm buffer **************/ dp4 = mp3_sample_pcm_buff2 ; rep mp3_dec_output_pcm_buffer_size * 4 ; *dp4++ = r0l ; dp4 = mp3_sample_pcm_buff1 ; rep mp3_dec_output_pcm_buffer_size * 4 ; *dp4++ = r0l ; /******************* init decoder ****************/ clr(r0) ; r0 = *mp3_sample_dat_length:x ; r0l = *mp3_sample_dat_length+1:x ; r6l = lib_scratch_x ; r7l = lib_scratch_y ; call mp3_initdec ; (2/5)
appendix sample program so urce user ? s manual u15134ej4v0um 39 mp3_sample_main: ; sample main module /*************** decode start *****************/ clr(r0) ; r0l = *mp3_sample_input_write_ptr:y ; bit_stream write ptr dp2 = r0l ; dmx = mp3_sample_input_buff_size-1 ; dn2 = 1 ; /*************** calc input buffer blank size *****************/ clr(r1) ; r1l = *mp3_sample_input_read_ptr:y ; r0 = r1 - r0 ; if(r0>0) jmp $ + 2 ; r0 = r0 + mp3_sample_input_buff_size ; r0[word] r0 = r0 - 1 ; r0 = r0 sll 0x01 ; r0[byte] /************** calc receive data size *****************/ r2 = *mp3_sample_remain_length:x ; r2l = *mp3_sample_remain_length+1:x ; r1 = r0 - r2 ; ; if( r1 > 0 ) r0 = r2 ; /*********** if get size == 0 jmp mp3_dec **********/ if (r0 <= 0 ) jmp skip_read_bs ; /*************** get data from host ****************/ r0 = r0 + 1 ; r0 = r0 sra 1 ; r0[byte] -> r0[word] clr(r1) ; loop r0l { ; r1l= *hst:x ; r1 = r1 & 1 ; if(r1!=0) jmp $-2 ; r1l=*hdt:x ; *dp2%%=r1l ; nop ; nop ; nop ; } /***************** remain_length update ******************/ r0 = r0 sll 1 ; r0[word] -> r0[byte] r2 = r2 - r0 ; *mp3_sample_remain_length:x = r2h ;remain file length update *mp3_sample_remain_length+1:x = r2l ; /********* *mp3_sample_inpup_write_ptr:y update *********/ ;bit_stream write ptr update r0l = dp2 ; *mp3_sample_input_write_ptr:y=r0l ; /****************** check stop mode ******************/ clr(r0) ; r0l = *mp3_sample_command_stop_flag:y ; if(r0 != 0 ) jmp mp3_sample_main ; skip_read_bs: /****************** set register *******************/ ; dp2 = read_ptr dmx = input_buff_size -1 ; dp3 = write_ptr ; dmx = ; r7l = byte_flag ; dp4 = output_pcm r0l = dp2 ; dp3 = r0l ;write_ptr r0l = *mp3_sample_input_read_ptr:y ; dp2 = r0l ; dmx = mp3_sample_input_buff_size -1 ; dp4 = mp3_sample_pcm_buff1 ; dmy = (mp3_dec_output_pcm_buffer_size*4) -1 ; clr(r7) ; r7l = *mp3_sample_input_read_byte_flag:y ; clr(r0) ; r0l = *mp3_sample_command_skip_flag:y ; /****************** exec mp3 decode *******************/ call mp3_dec ; call main program (3/5)
appendix sample program so urce 40 user ? s manual u15134ej4v0um /********** mp3_sample_decode_length update **********/ clr(r0) ; r0l = *mp3_sample_input_read_ptr:y ; clr(r1) ; r1l = dp2 ; r0 = r1 - r0 ; *mp3_sample_input_read_ptr:y = r1l ; if(r0 > 0) jmp $ + 2 ; r0 = r0 + mp3_sample_input_buff_size ; r0 = r0 sll 0x01 ;word->byte r3 = *mp3_sample_decode_length:x ; r3l = *mp3_sample_decode_length+1:x ; r3 = r3 + r0 ; *mp3_sample_decode_length:x = r3h ; *mp3_sample_decode_length+1:x = r3l ; *mp3_sample_input_read_byte_flag:y = r7l ; /************* check remain file size *************/ r0 = *mp3_sample_dat_length:x ; r0l = *mp3_sample_dat_length+1:x ; r0 = r0 - r3 ; /**************** jump end_of_file check routine ****************/ if(r0 <= 0) jmp input_bs_end_chk ; /***************** error routine *********************/ call mp3_geterrorstatus ; ; r0: 0:ok other:error if (r0 != 0) jmp mon_error ;jump error routine call mp3_getstatus ; ; r0 0:lsf other:normal ; r1 mono/stereo 0:mono other:stereo ; r2 sample freq (index) ; r3 skip 0:normal other:skip ; r4 bitrate ;copy decoded pcm data dmy = (mp3_dec_output_pcm_buffer_size*4) -1 ; dn5 = 0x01 ; dn4 = 0x01 ; if(r0 != 0 ) jmp _chk_copy_normal ; _chk_copy_lsf: clr(r0) ; r0l = *mp3_sample_lsf_frame_odd:y ; dp4 = mp3_sample_pcm_buff1 ; if(r0 != 0 ) jmp _frame_odd ; _frame_even: dp5 = mp3_sample_pcm_buff2 ; r0l = 0x01 ; *mp3_sample_lsf_frame_odd:y = r0l ; _wait_lsf_even: clr(r0) ; r0l = *mp3_sample_int_so1_output_ptr:y ; r0 = r0 - (mp3_sample_pcm_buff2 + 576*2) ; if(r0 < 0 ) jmp _wait_lsf_even ; jmp _copy_lsf ; _frame_odd: dp5 = mp3_sample_pcm_buff2 + 576*2 ; r0l = 0x00 ; *mp3_sample_lsf_frame_odd:y = r0l ; _wait_lsf_odd: clr(r0) ; r0l = *mp3_sample_int_so1_output_ptr:y ; r0 = r0 - (mp3_sample_pcm_buff2 + 576*2) ; if(r0 >= 0 ) jmp _wait_lsf_odd ; _copy_lsf: if(r1 == 0) call mp3_sample_copy_mono ; if(r1 != 0) call mp3_sample_copy_stereo ; jmp mp3_mon_decode_result ; _chk_copy_normal: dp4 = mp3_sample_pcm_buff1 ; dp5 = mp3_sample_pcm_buff2 ; _wait_gr1: clr(r0) ; r0l = *mp3_sample_int_so1_output_ptr:y ; r0 = r0 - (mp3_sample_pcm_buff2 + 576*2) ; if(r0 < 0 ) jmp _wait_gr1 ; if(r1 == 0) call mp3_sample_copy_mono ; if(r1 != 0) call mp3_sample_copy_stereo ; _wait_gr2: clr(r0) ; r0l = *mp3_sample_int_so1_output_ptr:y ; r0 = r0 - (mp3_sample_pcm_buff2 + 576*2) ; if(r0 >= 0 ) jmp _wait_gr2 ; if(r1 == 0) call mp3_sample_copy_mono ; if(r1 != 0) call mp3_sample_copy_stereo ; (4/5)
appendix sample program so urce user ? s manual u15134ej4v0um 41 /**************** jump mp3_sample_main ****************/ mp3_mon_decode_result: jmp mp3_sample_main ; /***************** check end of file *******************/ input_bs_end_chk: r2 = *mp3_sample_dat_length:x ; r2l = *mp3_sample_dat_length+1:x ; r1 = r2 - r3 ; if(r1 > 0) jmp skip_read_bs ; /***************** decode finish *******************/ mp3_mon_input_bs_finish: /*************** clear output buffer **************/ clr(r0) ; dp4 = mp3_sample_pcm_buff1 ; rep mp3_dec_output_pcm_buffer_size*4 ; *dp4++ = r0l ; dp4 = mp3_sample_pcm_buff2 ; rep mp3_dec_output_pcm_buffer_size*4 ; *dp4++ = r0l ; input_bs_finish: clr(r0) ; stk = r0l ; r0l = stk ; nop ; ; stop ; nop ; jmp 0x200 ; /******************* error routine *********************/ /******** *mp3_sample_error_frame_count:x += 1 *********/ mon_error: clr(r1) ; r1l = *mp3_sample_error_frame_count:x ; r1 = r1 + 1 ; *mp3_sample_error_frame_count:x = r1l ; ; goto error type routine r1 = r0 ^ mp3_dec_crc_error ; if(r1 ==0) jmp _error_return ; r1 = r0 ^ mp3_dec_headder_found_error ; if(r1 ==0) jmp _header_error ;restartable error ; if(r1 ==0) jmp _error_finish ;fatal error r1 = r0 ^ mp3_dec_bitstream_error ; if(r1 ==0) jmp _error_return ;restartable error r1 = r0 ^ mp3_dec_bit_rate_error ; if(r1 ==0) jmp _error_finish ;fatal error r1 = r0 ^ mp3_dec_free_format_error ; if(r1 ==0) jmp _error_finish ;fatal error r1 = r0 ^ mp3_dec_layer_error ; if(r1 ==0) jmp _error_finish ;fatal error r1 = r0 ^ mp3_dec_sample_rate_error ; if(r1 ==0) jmp _error_finish ;fatal error mp3_mon_error_finish: _error_finish: /**************** fatal error routine *****************/ ; finish routine stop ; halt ; /**************** restartable error ****************/ _header_error: r0 = *mp3_sample_remain_length:x ; r0l = *mp3_sample_remain_length+1:x ; r0 = r0 - (17*2) ; if(r0<=0) jmp input_bs_finish ; _error_return: ; if( r0 ==0 ) call 1frame_repeat ;1frame repeat ; if( r0 !=0 ) call 1frame_skip ;1frame skip ; call 1frame_mute ; ; call mp3_sample_pcmbuf_wait_with_crc_error ; jmp mp3_sample_main ; end ; (5/5)
appendix sample program so urce 42 user ? s manual u15134ej4v0um ? ? ? ? sam_data.asm #include "m3d_dec.h" #define mp3_sample_input_buff_size ( 1440 + 2 ) public mp3_sample_input_read_ptr ;user input buffer read pointer (mp3_dec use) public mp3_sample_input_read_byte_flag ;user input buffer read byte flag (mp3_dec use) public mp3_sample_input_write_ptr ;user input buffer write pointer public mp3_sample_dat_length ;file length public mp3_sample_remain_length ;remain data length public mp3_sample_decode_length ;decoded data length public mp3_sample_error_frame_count ;error counter public mp3_sample_command_stop_flag ;user skop mode flag public mp3_sample_command_skip_flag ;user skip mode flag public mp3_sample_input_buff ;user input buffer public mp3_sample_pcm_buff1 ;user output buffer page1 public mp3_sample_pcm_buff2 ;user output buffer page2 public mp3_sample_int_so1_output_ptr ;user interrupt handler output pointer public mp3_sample_int_so1_output_dmx ;user interrupt handler output dmx public mp3_sample_int_so1_output_dn ;user interrupt handler output dn public mp3_sample_lsf_frame_odd ;user lsf mode page flag public mp3_sample_int_saver0e ; public mp3_sample_int_saver0h ; public mp3_sample_int_saver0l ; public mp3_sample_int_savedp4 ; public mp3_sample_int_savedn4 ; public mp3_sample_int_savedmy ; public mp3_sample_int1_saver0e ; public mp3_sample_int1_saver0h ; public mp3_sample_int1_saver0l ; __mp3_sample_input_buff xramseg align mp3_sample_input_buff: ds mp3_sample_input_buff_size ; __mp3_sample_output_pcm_buff1 yramseg align mp3_sample_pcm_buff1: ds mp3_dec_output_pcm_buffer_size*4 __mp3_sample_output_pcm_buff2 yramseg align mp3_sample_pcm_buff2: ds mp3_dec_output_pcm_buffer_size*4 __mp3_sample_data_y1 yramseg mp3_sample_input_read_ptr: ds 1 ; mp3_sample_input_read_byte_flag:ds 1 ; mp3_sample_input_write_ptr: ds 1 ; mp3_sample_command_stop_flag: ds 1 ; mp3_sample_command_skip_flag: ds 1 ; mp3_sample_int_so1_output_ptr: ds 1 ; mp3_sample_int_so1_output_dmx: ds 1 ; mp3_sample_int_so1_output_dn: ds 1 ; mp3_sample_lsf_frame_odd: ds 1 ; __mp3_sample_data_x1 xramseg mp3_sample_dat_length: ds 2 ;file length mp3_sample_remain_length: ds 2 ; mp3_sample_decode_length: ds 2 ;decoded data length mp3_sample_error_frame_count: ds 1 ;error counter mp3_sample_int_saver0e: ds 1 ; mp3_sample_int_saver0h: ds 1 ; mp3_sample_int_saver0l: ds 1 ; mp3_sample_int_savedp4: ds 1 ; mp3_sample_int_savedn4: ds 1 ; mp3_sample_int_savedmy: ds 1 ; mp3_sample_int1_saver0e: ds 1 ; mp3_sample_int1_saver0h: ds 1 ; mp3_sample_int1_saver0l: ds 1 ; end
appendix sample program so urce user ? s manual u15134ej4v0um 43 ? ? ? ? sam_int.asm #include "m3d_dec.h" #include "sample.h" #include "m3d_err.h" public mp3_sample_copy_mono ; public mp3_sample_copy_stereo ; _mp3_sample_intvector imseg at 0x0210 mp3_sample_int_int1: call mp3_sample_command_stop ; reti ; nop ; nop ; mp3_sample_int_int2: call mp3_sample_command_skip ; reti ; nop ; nop ; mp3_sample_int_int3: nop ; reti ; nop ; nop ; mp3_sample_int_int4: nop ; reti ; nop ; nop ; mp3_sample_int_si1: ; call mp3_sample_int_si1_main ; nop ; reti ; nop ; nop ; mp3_sample_int_so1: call mp3_sample_int_si1_main ; reti ; nop ; nop ; mp3_sample_int_si2: nop ; nop ; nop ; nop ; mp3_sample_int_so2: nop ; nop ; nop ; nop ; mp3_sample_int_hi: nop ; reti ; nop ; nop ; mp3_sample_int_ho: nop ; reti ; nop ; nop ; _mp3_sample_int imseg mp3_sample_int_si1_main: ; interrupt for pcm data output ; save register *mp3_sample_int_saver0e:x = r0e ; *mp3_sample_int_saver0h:x = r0h ; *mp3_sample_int_saver0l:x = r0l ; r0l = dp4 ; *mp3_sample_int_savedp4:x = r0l ; r0l = dn4 ; *mp3_sample_int_savedn4:x = r0l ; r0l = dmy ; *mp3_sample_int_savedmy:x = r0l ; (1/3)
appendix sample program so urce 44 user ? s manual u15134ej4v0um r0l = *mp3_sample_int_so1_ptr:y ; r0l = *mp3_sample_int_so1_output_ptr:y ; dp4 = r0l ; ; r0l = *mp3_sample_int_so1_dmy:y ; ; dmy = r0l ; dmy = (mp3_dec_output_pcm_buffer_size*4) -1 ; ; r0l = *mp3_sample_int_so1_dn4:y ; ; dn4 = r0l ; dn4 = 0x01 ; ; output pcm data to sdt1 sdt2 port r0l = *dp4%% ; *sdt1:y = r0l ; r0l = dp4 ; ; *mp3_sample_int_so1_ptr:y = r0l ; *mp3_sample_int_so1_output_ptr:y= r0l ; ; load register r0l = *mp3_sample_int_savedmy:x ; dmy = r0l ; r0l = *mp3_sample_int_savedn4:x ; dn4 = r0l ; r0l = *mp3_sample_int_savedp4:x ; dp4 = r0l ; r0l = *mp3_sample_int_saver0l:x ; r0h = *mp3_sample_int_saver0h:x ; r0e = *mp3_sample_int_saver0e:x ; ret ; /**************** user command *****************/ /**************** stop command *****************/ mp3_sample_command_stop: *mp3_sample_int1_saver0e:x = r0e ; *mp3_sample_int1_saver0h:x = r0h ; *mp3_sample_int1_saver0l:x = r0l ; clr(r0) ; r0l = *mp3_sample_command_stop_flag:y ; if(r0 == 0) jmp _stop_off ; _stop_on: r0l = 0x01 ; *mp3_sample_command_stop_flag:y = r0l ; ; stop output interrupt r0l = sr ; r0 = r0 | 0x00f0 ; mask si1 so1 si2 so2 sr = r0l ; jmp _end_command ; _stop_off: clr(r0) ; *mp3_sample_command_stop_flag:y = r0l ; ; run output interrupt r0l = sr ; r0 = r0 & 0xff0f ; mask canncel si1 so1 si2 so2 sr = r0l ; jmp _end_command ; /***************** skip command *****************/ mp3_sample_command_skip: *mp3_sample_int1_saver0e:x = r0e ; *mp3_sample_int1_saver0h:x = r0h ; *mp3_sample_int1_saver0l:x = r0l ; clr(r0) ; r0l = *mp3_sample_command_skip_flag:y ; if(r0 != 0) jmp _skip_off ; _skip_on: r0l = 0x01 ; *mp3_sample_command_skip_flag:y = r0l ; jmp _end_command ; _skip_off: clr(r0) ; *mp3_sample_command_skip_flag:y = r0l ; _end_command: ; r0l = *mp3_sample_int1_saver0l:x ; r0h = *mp3_sample_int1_saver0h:x ; r0e = *mp3_sample_int1_saver0e:x ; ret ; (2/3)
appendix sample program so urce user ? s manual u15134ej4v0um 45 /***************** copy decoded pcm data *****************/ mp3_sample_copy_mono: ; copy data 1gra ; mono to stereo monaural, so copy same data twice ; dp4 = mp3_sample_pcm_buff1 ; ; dp5 = mp3_sample_pcm_buff2 ; ; dn5 = 0x01 ; ; dmy = 576 * 2 ; ; loop 576 { ; r0l = *dp4++ ; *dp5%% = r0l ; *dp5%% = r0l ; } ; ret ; mp3_sample_copy_stereo: ; copy 1 gra pcm data ; ; dp4 = mp3_sample_pcm_buff1 ; ; dp5 = mp3_sample_pcm_buff2 ; ; dn5 = 0x01 ; ; dmy = 576 * 2 ; ; loop 576*2 { ; r0l = *dp4++ ; *dp5%% = r0l ; } ; ret ; end (3/3)
46 user ? s manual u15134ej4v0um [memo]
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. hong kong, philippines, oceania nec electronics hong kong ltd. fax: +852-2886-9022/9044 korea nec electronics hong kong ltd. seoul branch fax: +82-2-528-4411 p.r. china nec electronics shanghai, ltd. nec electronics taiwan ltd. fax: +86-21-6841-1137 address north america nec electronics inc. corporate communications dept. fax: +1-800-729-9288 +1-408-588-6130 europe nec electronics (europe) gmbh market communication dept. fax: +49-211-6503-274 south america nec do brasil s.a. fax: +55-11-6462-6829 taiwan asian nations except philippines nec electronics singapore pte. ltd. fax: +886-2-2719-5951 fax: +65-250-3583 japan nec semiconductor technical hotline fax: +81- 44-435-9608 i would like to report the following error/make the following suggestion: document title: document number: page number: thank you for your kind support. if possible, please fax the referenced page or drawing. excellent good acceptable poor document rating clarity technical accuracy organization cs 02.3 name company from: tel. fax facsimile message


▲Up To Search▲   

 
Price & Availability of AP77016-B07

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

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


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