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: vs10xx.h,v $
00037  * Revision 1.2  2008/08/11 06:59:59  haraldkipp
00038  * BSD types replaced by stdint types (feature request #1282721).
00039  *
00040  * Revision 1.1  2007/04/12 08:59:55  haraldkipp
00041  * VS10XX decoder support added.
00042  *
00043  */
00044 
00045 #include <cfg/audio.h>
00046 #include <sys/types.h>
00047 #include <stdint.h>
00048 
00058 
00059 
00060 
00061 /*
00062  * Instruction opcodes.
00063  */
00064 #define VS_OPCODE_READ  3
00065 #define VS_OPCODE_WRITE 2
00066 
00067 
00071 /* ------------------------------------------------------------- */
00074 #define VS_MODE_REG         0
00075 
00076 #define VS_SM_DIFF          0x0001
00077 
00085 #define VS_SM_LAYER12       0x0002
00086 
00097 #define VS_SM_FFWD          0x0002
00098 
00102 #define VS_SM_RESET         0x0004
00103 
00110 #define VS_SM_MP12          0x0008
00111 
00119 #define VS_SM_OUTOFWAV      0x0008
00120 
00131 #define VS_SM_PDOWN         0x0010
00132 
00133 #define VS_SM_DAC           0x0020
00134 
00138 #define VS_SM_TESTS         0x0020
00139 
00140 #define VS_SM_DACMONO       0x0040
00141 
00152 #define VS_SM_STREAM        0x0040
00153 
00154 #define VS_SM_BASS          0x0080
00155 
00160 #define VS_SM_DACT          0x0100
00161 
00162 #define VS_SM_BYTEORD       0x0200
00163 
00167 #define VS_SM_SDIORD        0x0200
00168 
00172 #define VS_SM_IBMODE        0x0400
00173 
00174 #define VS_SM_SDISHARE      0x0400
00175 
00179 #define VS_SM_IBCLK         0x0800
00180 
00186 #define VS_SM_SDINEW        0x0800
00187 
00191 #define VS_SM_ADPCM         0x1000
00192 
00200 #define VS_SM_ADPCM_HP      0x2000
00201 
00208 #define VS_SM_LINE_IN       0x4000
00209 
00216 #define VS_SM_CLK_RANGE     0x8000
00217 
00223 /* ------------------------------------------------------------- */
00225 #define VS_STATUS_REG       1
00226 
00234 #define VS_SS_AVOL          0x0003
00235 
00236 #define VS_SS_AVOL_LSB  0
00237 
00241 #define VS_SS_APDOWM1       0x0004
00242 
00249 #define VS_SS_APDOWN2       0x0008
00250 
00257 #define VS_SS_VER           0x0070
00258 
00259 #define VS_SS_VER_LSB       4
00260 
00265 /* ------------------------------------------------------------- */
00271 #define VS_INT_FCTLH_REG    2
00272 
00277 /* ------------------------------------------------------------- */
00283 #define VS_BASS_REG         2
00284 
00288 #define VS_SB_FREQLIMIT     0x000F
00289 
00290 #define VS_SB_FREQLIMIT_LSB 0
00291 
00295 #define VS_SB_AMPLITUDE     0x00F0
00296 
00297 #define VS_SB_AMPLITUDE_LSB 4
00298 
00302 #define VS_ST_FREQLIMIT     0x000F
00303 
00304 #define VS_ST_FREQLIMIT_LSB 0
00305 
00309 #define VS_ST_AMPLITUDE     0x00F0
00310 
00311 #define VS_ST_AMPLITUDE_LSB 4
00312 
00317 /* ------------------------------------------------------------- */
00320 #define VS_CLOCKF_REG       3
00321 
00328 #define VS_SC_FREQ          0x7FFF
00329 
00336 #define VS_SC_X3FREQ        0x07FF
00337 
00338 #define VS_SC_FREQ_LSB      0
00339 
00343 #define VS_SC_ADD           0x1800
00344 
00348 #define VS_SC_MULT          0xE000
00349 
00353 #define VS_CF_DOUBLER       0x8000
00354 
00359 /* ------------------------------------------------------------- */
00366 #define VS_DECODE_TIME_REG  4
00367 
00372 /* ------------------------------------------------------------- */
00378 #define VS_AUDATA_REG       5
00379 
00383 #define VS_AD_STEREO        0x0001
00384 
00389 #define VS_AD_SRATE         0xFFFE
00390 
00391 #define VS_AD_SRATE_LSB     1
00392 
00397 /* ------------------------------------------------------------- */
00403 #define VS_WRAM_REG         6
00404 
00409 /* ------------------------------------------------------------- */
00415 #define VS_WRAMADDR_REG     7
00416 
00421 /* ------------------------------------------------------------- */
00427 #define VS_HDAT0_REG        8
00428 
00433 /* ------------------------------------------------------------- */
00436 #define VS_IN0_REG          8
00437 
00442 /* ------------------------------------------------------------- */
00448 #define VS_HDAT1_REG        9
00449 
00454 /* ------------------------------------------------------------- */
00457 #define VS_IN1_REG          9
00458 
00465 /* ------------------------------------------------------------- */
00468 #define VS_AIADDR_REG      10
00469 
00474 /* ------------------------------------------------------------- */
00477 #define VS_VOL_REG         11
00478 
00482 #define VS_VOL_RIGHT        0x00FF
00483 
00484 #define VS_VOL_RIGHT_LSB    0
00485 
00489 #define VS_VOL_LEFT         0xFF00
00490 
00491 #define VS_VOL_LEFT_LSB     8
00492 
00497 /* ------------------------------------------------------------- */
00502 #define VS_MIXERVOL_REG     12
00503 #define VS_SMV_GAIN1        0x001F
00504 #define VS_SMV_GAIN2        0x03E0
00505 #define VS_SMV_GAIN3        0x7C00
00506 #define VS_SMV_ACTIVE       0x8000
00507 
00512 /* ------------------------------------------------------------- */
00517 #define VS_ADPCMRECCTL_REG  13
00518 #define VS_SARC_GAIN4       0x003F
00519 #define VS_SARC_MANUALGAIN  0x0040
00520 #define VS_SARC_OUTOFADPCM  0x0080
00521 
00526 /* ------------------------------------------------------------- */
00532 #define VS_AICTRL0_REG     12
00533 
00537 #define VS_AICTRL_REG      13
00538 
00543 #define VS_AICTRL1_REG     13
00544 
00548 #define VS_AICTRL2_REG     14
00549 
00553 #define VS_AICTRL3_REG     15
00554 
00557 /*
00558  * Bytes needed to flush internal VS buffer (size of VS interbal buffer)
00559  */
00560 #define VS_FLUSH_BYTES 2048
00561 
00562 /*
00563  * Status of the decoder
00564  */
00565 #define VS_STATUS_STOPPED 0
00566 #define VS_STATUS_RUNNING 1
00567 #define VS_STATUS_EOF     2
00568 #define VS_STATUS_EMPTY   4
00569 
00570 /*
00571  * Header info filled by VsGetHeaderInfo.
00572  */
00573 #ifdef __GNUC__
00574 typedef struct __attribute__((packed)) {
00575     uint16_t vshi_no_crc:1;
00576     uint16_t vshi_layer:2;
00577     uint16_t vshi_id:2;
00578     uint16_t vshi_syncword:11;
00579 
00580     uint16_t vshi_emphasis:2;
00581     uint16_t vshi_original:1;
00582     uint16_t vshi_copyright:1;
00583     uint16_t vshi_extension:2;
00584     uint16_t vshi_mode:2;
00585     uint16_t vshi_private_bit:1;
00586     uint16_t vshi_pad_bit:1;
00587     uint16_t vshi_sample_rate:2;
00588     uint16_t vshi_bitrate:4;
00589 } VS_HEADERINFO;
00590 #endif
00591 
00592 __BEGIN_DECLS
00593 /* Function prototypes */
00594 
00595 extern int VsPlayerInit(void);
00596 extern int VsPlayerReset(uint16_t mode);
00597 extern int VsPlayerSetMode(uint16_t mode);
00598 extern int VsPlayerKick(void);
00599 extern int VsPlayerStop(void);
00600 extern int VsPlayerFlush(void);
00601 extern ureg_t VsPlayerInterrupts(ureg_t enable);
00602 extern ureg_t VsPlayerThrottle(ureg_t on);
00603 
00604 extern uint16_t VsPlayTime(void);
00605 extern u_int VsGetStatus(void);
00606 #ifdef __GNUC__
00607 extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
00608 #endif
00609 extern uint16_t VsMemoryTest(void);
00610 
00611 extern int VsSetVolume(ureg_t left, ureg_t right);
00612 extern int VsBeep(uint8_t fsin, uint8_t ms);
00613 
00616 __END_DECLS
00617 /* End of prototypes */
00618 
00619 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/