Nut/OS  4.10.3
API Reference
vs10xx.h
Go to the documentation of this file.
00001 #ifndef _DEV_VS10XX_H_
00002 #define _DEV_VS10XX_H_
00003 /*
00004  * Copyright (C) 2001-2007 by egnite Software GmbH. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer.
00012  * 2. Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  * 3. Neither the name of the copyright holders nor the names of
00016  *    contributors may be used to endorse or promote products derived
00017  *    from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00022  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00023  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00024  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00025  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00026  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00027  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00028  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00029  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  * For additional information see http://www.ethernut.de/
00033  */
00034 
00035 /*
00036  * $Log$
00037  * Revision 1.3  2009/01/17 11:26:47  haraldkipp
00038  * Getting rid of two remaining BSD types in favor of stdint.
00039  * Replaced 'u_int' by 'unsinged int' and 'uptr_t' by 'uintptr_t'.
00040  *
00041  * Revision 1.2  2008/08/11 06:59:59  haraldkipp
00042  * BSD types replaced by stdint types (feature request #1282721).
00043  *
00044  * Revision 1.1  2007/04/12 08:59:55  haraldkipp
00045  * VS10XX decoder support added.
00046  *
00047  */
00048 
00049 #include <cfg/audio.h>
00050 #include <sys/types.h>
00051 #include <stdint.h>
00052 
00062 
00063 
00064 
00065 /*
00066  * Instruction opcodes.
00067  */
00068 #define VS_OPCODE_READ  3
00069 #define VS_OPCODE_WRITE 2
00070 
00071 
00075 /* ------------------------------------------------------------- */
00078 #define VS_MODE_REG         0
00079 
00080 #define VS_SM_DIFF          0x0001
00081 
00089 #define VS_SM_LAYER12       0x0002
00090 
00101 #define VS_SM_FFWD          0x0002
00102 
00106 #define VS_SM_RESET         0x0004
00107 
00114 #define VS_SM_MP12          0x0008
00115 
00123 #define VS_SM_OUTOFWAV      0x0008
00124 
00135 #define VS_SM_PDOWN         0x0010
00136 
00137 #define VS_SM_DAC           0x0020
00138 
00142 #define VS_SM_TESTS         0x0020
00143 
00144 #define VS_SM_DACMONO       0x0040
00145 
00156 #define VS_SM_STREAM        0x0040
00157 
00158 #define VS_SM_BASS          0x0080
00159 
00164 #define VS_SM_DACT          0x0100
00165 
00166 #define VS_SM_BYTEORD       0x0200
00167 
00171 #define VS_SM_SDIORD        0x0200
00172 
00176 #define VS_SM_IBMODE        0x0400
00177 
00178 #define VS_SM_SDISHARE      0x0400
00179 
00183 #define VS_SM_IBCLK         0x0800
00184 
00190 #define VS_SM_SDINEW        0x0800
00191 
00195 #define VS_SM_ADPCM         0x1000
00196 
00204 #define VS_SM_ADPCM_HP      0x2000
00205 
00212 #define VS_SM_LINE_IN       0x4000
00213 
00220 #define VS_SM_CLK_RANGE     0x8000
00221 
00227 /* ------------------------------------------------------------- */
00229 #define VS_STATUS_REG       1
00230 
00238 #define VS_SS_AVOL          0x0003
00239 
00240 #define VS_SS_AVOL_LSB  0
00241 
00245 #define VS_SS_APDOWM1       0x0004
00246 
00253 #define VS_SS_APDOWN2       0x0008
00254 
00261 #define VS_SS_VER           0x0070
00262 
00263 #define VS_SS_VER_LSB       4
00264 
00269 /* ------------------------------------------------------------- */
00275 #define VS_INT_FCTLH_REG    2
00276 
00281 /* ------------------------------------------------------------- */
00287 #define VS_BASS_REG         2
00288 
00292 #define VS_SB_FREQLIMIT     0x000F
00293 
00294 #define VS_SB_FREQLIMIT_LSB 0
00295 
00299 #define VS_SB_AMPLITUDE     0x00F0
00300 
00301 #define VS_SB_AMPLITUDE_LSB 4
00302 
00306 #define VS_ST_FREQLIMIT     0x000F
00307 
00308 #define VS_ST_FREQLIMIT_LSB 0
00309 
00313 #define VS_ST_AMPLITUDE     0x00F0
00314 
00315 #define VS_ST_AMPLITUDE_LSB 4
00316 
00321 /* ------------------------------------------------------------- */
00324 #define VS_CLOCKF_REG       3
00325 
00332 #define VS_SC_FREQ          0x7FFF
00333 
00340 #define VS_SC_X3FREQ        0x07FF
00341 
00342 #define VS_SC_FREQ_LSB      0
00343 
00347 #define VS_SC_ADD           0x1800
00348 
00352 #define VS_SC_MULT          0xE000
00353 
00357 #define VS_CF_DOUBLER       0x8000
00358 
00363 /* ------------------------------------------------------------- */
00370 #define VS_DECODE_TIME_REG  4
00371 
00376 /* ------------------------------------------------------------- */
00382 #define VS_AUDATA_REG       5
00383 
00387 #define VS_AD_STEREO        0x0001
00388 
00393 #define VS_AD_SRATE         0xFFFE
00394 
00395 #define VS_AD_SRATE_LSB     1
00396 
00401 /* ------------------------------------------------------------- */
00407 #define VS_WRAM_REG         6
00408 
00413 /* ------------------------------------------------------------- */
00419 #define VS_WRAMADDR_REG     7
00420 
00425 /* ------------------------------------------------------------- */
00431 #define VS_HDAT0_REG        8
00432 
00437 /* ------------------------------------------------------------- */
00440 #define VS_IN0_REG          8
00441 
00446 /* ------------------------------------------------------------- */
00452 #define VS_HDAT1_REG        9
00453 
00458 /* ------------------------------------------------------------- */
00461 #define VS_IN1_REG          9
00462 
00469 /* ------------------------------------------------------------- */
00472 #define VS_AIADDR_REG      10
00473 
00478 /* ------------------------------------------------------------- */
00481 #define VS_VOL_REG         11
00482 
00486 #define VS_VOL_RIGHT        0x00FF
00487 
00488 #define VS_VOL_RIGHT_LSB    0
00489 
00493 #define VS_VOL_LEFT         0xFF00
00494 
00495 #define VS_VOL_LEFT_LSB     8
00496 
00501 /* ------------------------------------------------------------- */
00506 #define VS_MIXERVOL_REG     12
00507 #define VS_SMV_GAIN1        0x001F
00508 #define VS_SMV_GAIN2        0x03E0
00509 #define VS_SMV_GAIN3        0x7C00
00510 #define VS_SMV_ACTIVE       0x8000
00511 
00516 /* ------------------------------------------------------------- */
00521 #define VS_ADPCMRECCTL_REG  13
00522 #define VS_SARC_GAIN4       0x003F
00523 #define VS_SARC_MANUALGAIN  0x0040
00524 #define VS_SARC_OUTOFADPCM  0x0080
00525 
00530 /* ------------------------------------------------------------- */
00536 #define VS_AICTRL0_REG     12
00537 
00541 #define VS_AICTRL_REG      13
00542 
00547 #define VS_AICTRL1_REG     13
00548 
00552 #define VS_AICTRL2_REG     14
00553 
00557 #define VS_AICTRL3_REG     15
00558 
00561 /*
00562  * Bytes needed to flush internal VS buffer (size of VS interbal buffer)
00563  */
00564 #define VS_FLUSH_BYTES 2048
00565 
00566 /*
00567  * Status of the decoder
00568  */
00569 #define VS_STATUS_STOPPED 0
00570 #define VS_STATUS_RUNNING 1
00571 #define VS_STATUS_EOF     2
00572 #define VS_STATUS_EMPTY   4
00573 
00574 /*
00575  * Header info filled by VsGetHeaderInfo.
00576  */
00577 #ifdef __GNUC__
00578 typedef struct __attribute__((packed)) {
00579     uint16_t vshi_no_crc:1;
00580     uint16_t vshi_layer:2;
00581     uint16_t vshi_id:2;
00582     uint16_t vshi_syncword:11;
00583 
00584     uint16_t vshi_emphasis:2;
00585     uint16_t vshi_original:1;
00586     uint16_t vshi_copyright:1;
00587     uint16_t vshi_extension:2;
00588     uint16_t vshi_mode:2;
00589     uint16_t vshi_private_bit:1;
00590     uint16_t vshi_pad_bit:1;
00591     uint16_t vshi_sample_rate:2;
00592     uint16_t vshi_bitrate:4;
00593 } VS_HEADERINFO;
00594 #endif
00595 
00596 __BEGIN_DECLS
00597 /* Function prototypes */
00598 
00599 extern int VsPlayerInit(void);
00600 extern int VsPlayerReset(uint16_t mode);
00601 extern int VsPlayerSetMode(uint16_t mode);
00602 extern int VsPlayerKick(void);
00603 extern int VsPlayerStop(void);
00604 extern int VsPlayerFlush(void);
00605 extern ureg_t VsPlayerInterrupts(ureg_t enable);
00606 extern ureg_t VsPlayerThrottle(ureg_t on);
00607 
00608 extern uint16_t VsPlayTime(void);
00609 extern unsigned int VsGetStatus(void);
00610 #ifdef __GNUC__
00611 extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
00612 #endif
00613 extern uint16_t VsMemoryTest(void);
00614 
00615 extern int VsSetVolume(ureg_t left, ureg_t right);
00616 extern int VsBeep(uint8_t fsin, uint8_t ms);
00617 
00620 __END_DECLS
00621 /* End of prototypes */
00622 
00623 #endif