| 1 | /**************************************************************************//** |
| 2 | * @file ADMP441.h |
| 3 | * @brief Implementation of header file for ADMP441. |
| 4 | * @author ATofan ([email protected]) |
| 5 | * |
| 6 | ******************************************************************************* |
| 7 | * Copyright 2011(c) Analog Devices, Inc. |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
| 12 | * are permitted provided that the following conditions are met: |
| 13 | * - Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * - Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in |
| 17 | * the documentation and/or other materials provided with the |
| 18 | * distribution. |
| 19 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 20 | * contributors may be used to endorse or promote products derived |
| 21 | * from this software without specific prior written permission. |
| 22 | * - The use of this software may or may not infringe the patent rights |
| 23 | * of one or more patent holders. This license does not release you |
| 24 | * from the requirement that you obtain separate licenses from these |
| 25 | * patent holders to use this software. |
| 26 | * - Use of the software either in source or binary form, must be run |
| 27 | * on or directly connected to an Analog Devices Inc. component. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED |
| 30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY |
| 31 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 32 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 34 | * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 35 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 36 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | ******************************************************************************* |
| 41 | * SVN Revision: 468 |
| 42 | ******************************************************************************/ |
| 43 | #ifndef ADMP441_H_ |
| 44 | #define ADMP441_H_ |
| 45 | |
| 46 | /*****************************************************************************/ |
| 47 | /************************ Constants Definitions ******************************/ |
| 48 | /*****************************************************************************/ |
| 49 | // Wave Canonical File Format |
| 50 | // To be written at the beginning of the *.wav file |
| 51 | #define CHUNK_RIFF_ID 0x52494646 // R I F F - big endian |
| 52 | #define CHUNK_SIZE bigToLittle(4 + 8 + SUB1_SIZE_CALC + 8 + CHUNK2_SZ_CALC) // Chunk Size - little endian |
| 53 | #define WAVE_FORMAT 0x57415645 // W A V E - big endian |
| 54 | #define SUBCHUNK1_ID 0x666d7420 // f m t - big endian |
| 55 | #define SUBCHUNK1_SIZE 0x10000000 // 16 for PCM, - little endian |
| 56 | #define SUB1_SIZE_CALC 16 // Subchunk1 Size used for calculations |
| 57 | #define AUDIO_FORMAT 0x0100 // Audio Format, 1 for PCM - little endian |
| 58 | #define NR_CHANNELS 0x0100 // Number of Channels - 1 - little endian |
| 59 | #define SAMPLE_RATE 0xA0BE0000 // Audio Sample Rate - 48800 - little endian |
| 60 | #define BYTE_RATE 0x80fa0200 // SR * NrCh * NrBits / 8 - little endian |
| 61 | #define BLOCK_ALIGN 0x0400 // NrCh * NrBits / 8 - little endian |
| 62 | #define NR_BITS 0x2000 // Number of bits - little endian |
| 63 | #define SUBCHUNK2_ID 0x64617461 // d a t a - big endian |
| 64 | #define SUBCHUNK2_SIZE bigToLittle(nrSamples * 1 * 32 / 8) // size of data - little endian |
| 65 | #define CHUNK2_SZ_CALC (nrSamples * 1 * 32 / 8) // Subchunk2 Size used for calculations |
| 66 | |
| 67 | #endif /* ADMP441_H_ */ |