vscodec.h

Go to the documentation of this file.
00001 #ifndef _DEV_VSCODEC_H_
00002 #define _DEV_VSCODEC_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  * $Id: vscodec.h,v 1.1 2008/02/15 16:45:41 haraldkipp Exp $
00037  */
00038 
00039 #include <cfg/audio.h>
00040 #include <sys/device.h>
00041 
00051 
00052 /* DAC min/max gain in dB. */
00053 #ifndef AUDIO_DAC_MIN_GAIN
00054 #define AUDIO_DAC_MIN_GAIN      -127
00055 #endif
00056 #ifndef AUDIO_DAC_MAX_GAIN
00057 #define AUDIO_DAC_MAX_GAIN      0
00058 #endif
00059 
00060 /*
00061  * I/O control codes.
00062  */
00064 #define AUDIO_PLAY          0x3001
00065 
00066 #define AUDIO_CANCEL        0x3002
00067 #define AUDIO_GET_STATUS    0x3003
00068 #define AUDIO_GET_PLAYGAIN  0x3004
00069 #define AUDIO_SET_PLAYGAIN  0x3005
00070 #define AUDIO_GET_PBSIZE    0x3006
00071 #define AUDIO_SET_PBSIZE    0x3007
00072 #define AUDIO_GET_PBLEVEL   0x3008
00073 #define AUDIO_GET_PBWLOW    0x3009
00074 #define AUDIO_SET_PBWLOW    0x300A
00075 #define AUDIO_GET_PBWHIGH   0x300B
00076 #define AUDIO_SET_PBWHIGH   0x300C
00077 #define AUDIO_BEEP          0x300F
00078 
00079 #define AUDIO_GET_DECINFO   0x3010
00080 
00081 #define AUDIO_GET_DECCAPS   0x3011
00082 
00083 #define AUDIO_GET_DECFMTS   0x3012
00084 
00085 #define AUDIO_SET_DECFMTS   0x3013
00086 
00087 #define AUDIO_GET_CODINFO   0x3014
00088 
00089 #define AUDIO_GET_CODCAPS   0x3015
00090 
00091 #define AUDIO_GET_CODFMTS   0x3016
00092 
00093 #define AUDIO_SET_CODFMTS   0x3017
00094 
00095 #define AUDIO_GET_MIDINFO   0x3018
00096 
00097 #define AUDIO_GET_MIDCAPS   0x3019
00098 
00099 
00100 /*
00101  * Instruction opcodes.
00102  */
00103 #define VS_OPCODE_READ  3
00104 #define VS_OPCODE_WRITE 2
00105 
00106 
00110 /* ------------------------------------------------------------- */
00113 #define VS_MODE_REG         0
00114 
00115 #define VS_SM_DIFF          0x0001
00116 
00124 #define VS_SM_LAYER12       0x0002
00125 
00136 #define VS_SM_FFWD          0x0002
00137 
00141 #define VS_SM_RESET         0x0004
00142 
00149 #define VS_SM_MP12          0x0008
00150 
00158 #define VS_SM_OUTOFWAV      0x0008
00159 
00170 #define VS_SM_PDOWN         0x0010
00171 
00172 #define VS_SM_DAC           0x0020
00173 
00177 #define VS_SM_TESTS         0x0020
00178 
00179 #define VS_SM_DACMONO       0x0040
00180 
00191 #define VS_SM_STREAM        0x0040
00192 
00193 #define VS_SM_BASS          0x0080
00194 
00199 #define VS_SM_DACT          0x0100
00200 
00201 #define VS_SM_BYTEORD       0x0200
00202 
00206 #define VS_SM_SDIORD        0x0200
00207 
00211 #define VS_SM_IBMODE        0x0400
00212 
00213 #define VS_SM_SDISHARE      0x0400
00214 
00218 #define VS_SM_IBCLK         0x0800
00219 
00225 #define VS_SM_SDINEW        0x0800
00226 
00230 #define VS_SM_ADPCM         0x1000
00231 
00239 #define VS_SM_ADPCM_HP      0x2000
00240 
00247 #define VS_SM_LINE_IN       0x4000
00248 
00255 #define VS_SM_CLK_RANGE     0x8000
00256 
00262 /* ------------------------------------------------------------- */
00264 #define VS_STATUS_REG       1
00265 
00273 #define VS_SS_AVOL          0x0003
00274 
00275 #define VS_SS_AVOL_LSB  0
00276 
00280 #define VS_SS_APDOWM1       0x0004
00281 
00288 #define VS_SS_APDOWN2       0x0008
00289 
00299 #define VS_SS_VER           0x0070
00300 
00301 #define VS_SS_VER_LSB       4
00302 
00307 /* ------------------------------------------------------------- */
00313 #define VS_INT_FCTLH_REG    2
00314 
00319 /* ------------------------------------------------------------- */
00325 #define VS_BASS_REG         2
00326 
00330 #define VS_SB_FREQLIMIT     0x000F
00331 
00332 #define VS_SB_FREQLIMIT_LSB 0
00333 
00337 #define VS_SB_AMPLITUDE     0x00F0
00338 
00339 #define VS_SB_AMPLITUDE_LSB 4
00340 
00344 #define VS_ST_FREQLIMIT     0x000F
00345 
00346 #define VS_ST_FREQLIMIT_LSB 0
00347 
00351 #define VS_ST_AMPLITUDE     0x00F0
00352 
00353 #define VS_ST_AMPLITUDE_LSB 4
00354 
00359 /* ------------------------------------------------------------- */
00362 #define VS_CLOCKF_REG       3
00363 
00370 #define VS_SC_FREQ          0x7FFF
00371 
00378 #define VS_SC_X3FREQ        0x07FF
00379 
00380 #define VS_SC_FREQ_LSB      0
00381 
00385 #define VS_SC_ADD           0x1800
00386 
00390 #define VS_SC_MULT          0xE000
00391 
00395 #define VS_CF_DOUBLER       0x8000
00396 
00401 /* ------------------------------------------------------------- */
00408 #define VS_DECODE_TIME_REG  4
00409 
00414 /* ------------------------------------------------------------- */
00420 #define VS_AUDATA_REG       5
00421 
00425 #define VS_AD_STEREO        0x0001
00426 
00431 #define VS_AD_SRATE         0xFFFE
00432 
00433 #define VS_AD_SRATE_LSB     1
00434 
00439 /* ------------------------------------------------------------- */
00445 #define VS_WRAM_REG         6
00446 
00451 /* ------------------------------------------------------------- */
00457 #define VS_WRAMADDR_REG     7
00458 
00463 /* ------------------------------------------------------------- */
00469 #define VS_HDAT0_REG        8
00470 
00475 /* ------------------------------------------------------------- */
00478 #define VS_IN0_REG          8
00479 
00484 /* ------------------------------------------------------------- */
00490 #define VS_HDAT1_REG        9
00491 
00496 /* ------------------------------------------------------------- */
00499 #define VS_IN1_REG          9
00500 
00507 /* ------------------------------------------------------------- */
00510 #define VS_AIADDR_REG      10
00511 
00516 /* ------------------------------------------------------------- */
00519 #define VS_VOL_REG         11
00520 
00524 #define VS_VOL_RIGHT        0x00FF
00525 
00526 #define VS_VOL_RIGHT_LSB    0
00527 
00531 #define VS_VOL_LEFT         0xFF00
00532 
00533 #define VS_VOL_LEFT_LSB     8
00534 
00539 /* ------------------------------------------------------------- */
00544 #define VS_MIXERVOL_REG     12
00545 #define VS_SMV_GAIN1        0x001F
00546 #define VS_SMV_GAIN2        0x03E0
00547 #define VS_SMV_GAIN3        0x7C00
00548 #define VS_SMV_ACTIVE       0x8000
00549 
00554 /* ------------------------------------------------------------- */
00559 #define VS_ADPCMRECCTL_REG  13
00560 #define VS_SARC_GAIN4       0x003F
00561 #define VS_SARC_MANUALGAIN  0x0040
00562 #define VS_SARC_OUTOFADPCM  0x0080
00563 
00568 /* ------------------------------------------------------------- */
00574 #define VS_AICTRL0_REG     12
00575 
00579 #define VS_AICTRL_REG      13
00580 
00585 #define VS_AICTRL1_REG     13
00586 
00590 #define VS_AICTRL2_REG     14
00591 
00595 #define VS_AICTRL3_REG     15
00596 
00599 /*
00600  * Bytes needed to flush internal VS buffer (size of VS internal buffer)
00601  */
00602 #define VS_FLUSH_BYTES 2048
00603 
00604 /*
00605  * Status of the decoder
00606  */
00607 #define CODEC_STATUS_IDLE      0
00608 #define CODEC_STATUS_PLAYING   1
00609 
00610 /*
00611  * Header info filled by VsGetHeaderInfo.
00612  */
00613 #ifdef __GNUC__
00614 typedef struct __attribute__((packed)) {
00615     u_short vshi_no_crc:1;
00616     u_short vshi_layer:2;
00617     u_short vshi_id:2;
00618     u_short vshi_syncword:11;
00619 
00620     u_short vshi_emphasis:2;
00621     u_short vshi_original:1;
00622     u_short vshi_copyright:1;
00623     u_short vshi_extension:2;
00624     u_short vshi_mode:2;
00625     u_short vshi_private_bit:1;
00626     u_short vshi_pad_bit:1;
00627     u_short vshi_sample_rate:2;
00628     u_short vshi_bitrate:4;
00629 } VS_HEADERINFO;
00630 #endif
00631 
00632 extern NUTDEVICE devVsCodec;
00633 
00634 __BEGIN_DECLS
00635 /* Function prototypes */
00636 
00637 #if 0
00638 extern int VsPlayerInit(void);
00639 extern int VsPlayerReset(u_short mode);
00640 extern int VsPlayerSetMode(u_short mode);
00641 extern int VsPlayerKick(void);
00642 extern int VsPlayerStop(void);
00643 extern int VsPlayerFlush(void);
00644 extern ureg_t VsPlayerInterrupts(ureg_t enable);
00645 extern ureg_t VsPlayerThrottle(ureg_t on);
00646 
00647 extern u_short VsPlayTime(void);
00648 extern u_int VsGetStatus(void);
00649 #ifdef __GNUC__
00650 extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
00651 #endif
00652 extern u_short VsMemoryTest(void);
00653 
00654 extern int VsSetVolume(ureg_t left, ureg_t right);
00655 extern int VsBeep(u_char fsin, u_char ms);
00656 #endif
00657 
00660 __END_DECLS
00661 /* End of prototypes */
00662 
00663 #endif

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