00001 #ifndef _DEV_VSCODEC_H_
00002 #define _DEV_VSCODEC_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <cfg/audio.h>
00040 #include <sys/device.h>
00041
00051
00052
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
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
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
00601
00602 #define VS_FLUSH_BYTES 2048
00603
00604
00605
00606
00607 #define CODEC_STATUS_IDLE 0
00608 #define CODEC_STATUS_PLAYING 1
00609
00610
00611
00612
00613 #ifdef __GNUC__
00614 typedef struct __attribute__((packed)) {
00615 uint16_t vshi_no_crc:1;
00616 uint16_t vshi_layer:2;
00617 uint16_t vshi_id:2;
00618 uint16_t vshi_syncword:11;
00619
00620 uint16_t vshi_emphasis:2;
00621 uint16_t vshi_original:1;
00622 uint16_t vshi_copyright:1;
00623 uint16_t vshi_extension:2;
00624 uint16_t vshi_mode:2;
00625 uint16_t vshi_private_bit:1;
00626 uint16_t vshi_pad_bit:1;
00627 uint16_t vshi_sample_rate:2;
00628 uint16_t vshi_bitrate:4;
00629 } VS_HEADERINFO;
00630 #endif
00631
00632 extern NUTDEVICE devVsCodec;
00633
00634 __BEGIN_DECLS
00635
00636
00637 #if 0
00638 extern int VsPlayerInit(void);
00639 extern int VsPlayerReset(uint16_t mode);
00640 extern int VsPlayerSetMode(uint16_t 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 uint16_t VsPlayTime(void);
00648 extern u_int VsGetStatus(void);
00649 #ifdef __GNUC__
00650 extern int VsGetHeaderInfo(VS_HEADERINFO *vshi);
00651 #endif
00652 extern uint16_t VsMemoryTest(void);
00653
00654 extern int VsSetVolume(ureg_t left, ureg_t right);
00655 extern int VsBeep(uint8_t fsin, uint8_t ms);
00656 #endif
00657
00660 __END_DECLS
00661
00662
00663 #endif