Data Structures | |
struct | _VS_PLUGIN_INFO |
struct | _VS_WRAM_DATA |
struct | _VS_PARAMX_INFO |
struct | VS_HEADERINFO |
struct | _VSDCB |
Internal codec control block. More... | |
Defines | |
#define | AUDIO0_DAC_MIN_GAIN -127 |
#define | AUDIO0_DAC_MAX_GAIN 0 |
#define | AUDIO_DAC_MIN_GAIN AUDIO0_DAC_MIN_GAIN |
#define | AUDIO_DAC_MAX_GAIN AUDIO0_DAC_MAX_GAIN |
#define | AUDIO_DAC_MAX_TREB 8 |
#define | AUDIO_DAC_MAX_TFIN 15 |
#define | AUDIO_DAC_MAX_BASS 15 |
#define | AUDIO_DAC_MAX_BFIN 15 |
#define | AUDIO_SETWRITETIMEOUT 0x010d |
#define | AUDIO_GETWRITETIMEOUT 0x010e |
#define | AUDIO_PLAY 0x3001 |
Immediately start playing. | |
#define | AUDIO_CANCEL 0x3002 |
Immediately stop playing and discard buffer. | |
#define | AUDIO_GET_STATUS 0x3003 |
#define | AUDIO_GET_PLAYGAIN 0x3004 |
#define | AUDIO_SET_PLAYGAIN 0x3005 |
#define | AUDIO_GET_PBSIZE 0x3006 |
#define | AUDIO_SET_PBSIZE 0x3007 |
#define | AUDIO_GET_PBLEVEL 0x3008 |
#define | AUDIO_GET_PBWLOW 0x3009 |
#define | AUDIO_SET_PBWLOW 0x300A |
#define | AUDIO_GET_PBWHIGH 0x300B |
#define | AUDIO_SET_PBWHIGH 0x300C |
#define | AUDIO_BEEP 0x300F |
#define | AUDIO_GET_DECINFO 0x3010 |
Retrieve decoder information. | |
#define | AUDIO_GET_DECCAPS 0x3011 |
Retrieve decoder capabilities. | |
#define | AUDIO_GET_DECFMTS 0x3012 |
Retrieve decoder formats. | |
#define | AUDIO_FMT_PLUGIN 0x00000001 |
#define | AUDIO_FMT_WAV_PCM 0x00000002 |
#define | AUDIO_FMT_WAV_ADPCM 0x00000004 |
#define | AUDIO_FMT_WAV_IMA_ADPCM 0x00000008 |
#define | AUDIO_FMT_VORBIS 0x00000100 |
#define | AUDIO_FMT_MPEG1_L1 0x00001000 |
#define | AUDIO_FMT_MPEG1_L2 0x00002000 |
#define | AUDIO_FMT_MPEG1_L3 0x00004000 |
#define | AUDIO_FMT_MPEG2_AAC 0x00010000 |
#define | AUDIO_FMT_MPEG4_AAC 0x00020000 |
#define | AUDIO_FMT_WMA_V2 0x00100000 |
#define | AUDIO_FMT_WMA_V7 0x00200000 |
#define | AUDIO_FMT_WMA_V8 0x00400000 |
#define | AUDIO_FMT_WMA_V9 0x00800000 |
#define | AUDIO_SET_DECFMTS 0x3013 |
Enable or disable specific decoder formats. | |
#define | AUDIO_GET_CODINFO 0x3014 |
Retrieve encoder information. | |
#define | AUDIO_GET_CODCAPS 0x3015 |
Retrieve encoder capabilities. | |
#define | AUDIO_GET_CODFMTS 0x3016 |
Retrieve encoder formats. | |
#define | AUDIO_SET_CODFMTS 0x3017 |
Enable or disable specific encoder formats. | |
#define | AUDIO_GET_MIDINFO 0x3018 |
Retrieve midi information. | |
#define | AUDIO_GET_MIDCAPS 0x3019 |
Retrieve midi capabilities. | |
#define | AUDIO_FMT_GMIDI1 0x00000001 |
#define | AUDIO_FMT_GMIDI2 0x00000002 |
#define | AUDIO_FMT_SPMIDI0 0x00000004 |
#define | AUDIO_SET_TREB 0x301a |
Set audio enhancement treble value. | |
#define | AUDIO_GET_TREB 0x301b |
Get audio enhancement treble value. | |
#define | AUDIO_SET_TFIN 0x301c |
Set audio enhancement treble frequency. | |
#define | AUDIO_GET_TFIN 0x301d |
Get audio enhancement treble frequency. | |
#define | AUDIO_SET_BASS 0x301e |
Set audio enhancement bass value. | |
#define | AUDIO_GET_BASS 0x301f |
Get audio enhancement bass value. | |
#define | AUDIO_SET_BFIN 0x3020 |
Set audio enhancement bass frequency. | |
#define | AUDIO_GET_BFIN 0x3021 |
Get audio enhancement bass frequency. | |
#define | AUDIO_PLUGIN_UPLOAD 0x3030 |
Upload plug-in. | |
#define | AUDIO_IRQ_ENABLE 0x3031 |
Enable interrupts. | |
#define | AUDIO_SET_ICLOCK 0x3032 |
Set internal clock. | |
#define | AUDIO_WRITE_CMEM 0x3038 |
Upload into WRAM. | |
#define | AUDIO_SET_PARAMX 0x3040 |
Set parametric x. | |
#define | AUDIO_GET_PARAMX 0x3041 |
Get parametric x. | |
#define | VSP4_CHIP_ID_OFF 0x00 |
#define | VSP4_VERSION_OFF 0x02 |
#define | VSP4_CONFIG1_OFF 0x03 |
#define | VSP4_PLAY_SPEED_OFF 0x04 |
#define | VSP4_BIT_RATE_PER_100_OFF 0x05 |
#define | VSP4_END_FILL_BYTE_OFF 0x06 |
#define | VSP4_RATE_TUNE_OFF 0x07 |
#define | VSP4_PLAY_MODE_OFF 0x09 |
#define | VSP4_SAMPLE_COUNTER_OFF 0x0a |
#define | VSP4_VU_METER_OFF 0x0c |
#define | VSP4_AD_MIXER_GAIN_OFF 0x0d |
#define | VSP4_AD_MIXER_CONFIG_OFF 0x0e |
#define | VSP4_PCM_MIXER_RATE_OFF 0x0f |
#define | VSP4_PCM_MIXER_FREE_OFF 0x10 |
#define | VSP4_PCM_MIXER_VOL_OFF 0x11 |
#define | VSP4_EQ5_PARAMS_OFF(i) (0x12 + (i)) |
#define | VSP4_EQ5_UPDATED_OFF 0x1c |
#define | VSP4_SPEED_SHIFTER_OFF 0x1d |
#define | VSP4_EAR_SPEAKER_LEVEL_OFF 0x1e |
#define | VSP4_SDI_FREE_OFF 0x1f |
#define | VSP4_AUDIO_FILL_OFF 0x20 |
#define | VSP4_LATEST_SOF_OFF 0x25 |
#define | VSP4_POSITION_MSEC_OFF 0x27 |
#define | VSP4_RESYNC_OFF 0x29 |
#define | VSP4_ENC_TX_UART_DIV_OFF 0x2a |
#define | VSP4_ENC_TX_UART_BYTE_SPEED_OFF 0x2b |
#define | VSP4_ENC_TX_PAUSE_GPIO_OFF 0x2c |
#define | VSP4_ENC_SEC_ADAPT_MULTIPLIER_OFF 0x2d |
#define | VSP4_ENC_CHANNEL_MAX_OFF 0x3c |
#define | VSP4_ENC_SERIAL_NUMBER_OFF 0x3e |
#define | VSP4_WMA_CUR_PACKET_SIZE_OFF 0x2a |
#define | VSP4_WMA_PACKET_SIZE_OFF 0x2c |
#define | VSP4_AAC_SCE_FOUND_MASK_OFF 0x2a |
#define | VSP4_AAC_CPE_FOUND_MASK_OFF 0x2b |
#define | VSP4_AAC_LFE_FOUND_MASK_OFF 0x2c |
#define | VSP4_AAC_PLAY_SELECT_OFF 0x2d |
#define | VSP4_AAC_DYN_COMPRESS_OFF 0x2e |
#define | VSP4_AAC_DYN_BOOST_OFF 0x2f |
#define | VSP4_AAC_SBR_AND_PS_STATUS_OFF 0x30 |
#define | VSP4_AAC_SBR_PS_FLAGS_OFF 0x31 |
#define | VSP4_VORBIS_GAIN_OFF 0x2a |
#define | VS_PLAYMODE_MONO_OUTPUT_ON ox0001 |
#define | VS_PLAYMODE_PAUSE_ON 0x0002 |
#define | VS_PLAYMODE_VUMETER_ON 0x0004 |
#define | VS_PLAYMODE_ADMIXER_ON 0x0008 |
#define | VS_PLAYMODE_PCMMIXER_ON 0x0010 |
#define | VS_PLAYMODE_EQ5_ON 0x0020 |
#define | VS_PLAYMODE_SPEEDSHIFTER_ON 0x0040 |
#define | VS_OPCODE_READ 3 |
#define | VS_OPCODE_WRITE 2 |
#define | VS_FLUSH_BYTES 2048 |
Application register 0 index. | |
#define | CODEC_STATUS_IDLE 0 |
#define | CODEC_STATUS_PLAYING 1 |
#define | CODEC_STATUS_RECORDING 2 |
#define | VSCODEC_CMD_TIMEOUT NUT_WAIT_INFINITE |
Minimum time in milliseconds to held hardware reset low. | |
#define | VSCODEC_DATA_CHUNK_SIZE 32 |
Number of data bytes we can send without checking DREQ. | |
#define | AUDIO_VS1001K |
#define | VS10XX_FREQ 12288000UL |
Decoder crystal frequency. | |
#define | VS10XX_HWRST_DURATION 1 |
Minimum time in milliseconds to held hardware reset low. | |
#define | VS10XX_HWRST_RECOVER 4 |
Milliseconds to wait after hardware reset. | |
#define | VS10XX_SWRST_RECOVER 2 |
Milliseconds to wait after software reset. | |
#define | VS10XX_SCI_MODE 0 |
#define | VS10XX_SCI_RATE (VS10XX_FREQ / 6) |
#define | VS10XX_SDI_MODE 0 |
#define | VS10XX_SDI_RATE (VS10XX_FREQ / 6) |
#define | VSREQ_PLAY 0x00000001 |
#define | VSREQ_CANCEL 0x00000002 |
#define | VSREQ_BEEP 0x00000004 |
Typedefs | |
typedef struct _VS_PLUGIN_INFO | VS_PLUGIN_INFO |
typedef struct _VS_WRAM_DATA | VS_WRAM_DATA |
typedef struct _VS_PARAMX_INFO | VS_PARAMX_INFO |
typedef struct _VSDCB | VSDCB |
Internal codec control block. | |
typedef struct _VSDCB | VSDCB |
Functions | |
int | VsCodecWaitReady (NUTDEVICE *dev, uint32_t tmo) |
Wait until codec is ready. | |
uint16_t | VsCodecReg (NUTDEVICE *dev, uint_fast8_t op, uint_fast8_t reg, uint_fast16_t val) |
uint16_t | VsCodecMode (NUTDEVICE *dev, uint_fast16_t flags, uint_fast16_t mask) |
Read and modify VLSI audio codec mode flags. | |
int | VsDecoderSetVolume (NUTDEVICE *dev, int left, int right) |
Set volume. | |
int | VsDecoderSetBass (NUTDEVICE *dev, int treb, int tfin, int bass, int bfin) |
Set Bass. | |
uint16_t | VsCodecBeep (NUTDEVICE *dev, uint16_t fsin) |
Start or stop sine wave beeper. | |
int | VsDecoderBufferInit (NUTDEVICE *dev, uint32_t size) |
void | FeederThread (void *arg) |
int | VsCodecIOCtl (NUTDEVICE *dev, int req, void *conf) |
Handle I/O controls for audio codec. | |
int | VsCodecRead (NUTFILE *nfp, void *data, int len) |
Read from the encoder. | |
int | VsCodecWrite (NUTFILE *nfp, const void *data, int len) |
Write to decoder. | |
int | VsCodecWrite_P (NUTFILE *nfp, PGM_P buffer, int len) |
Write program data to decoder. | |
NUTFILE * | VsCodecOpen (NUTDEVICE *dev, const char *name, int mode, int acc) |
int | VsCodecClose (NUTFILE *nfp) |
Variables | |
uint8_t | zero_chunk [VSCODEC_DATA_CHUNK_SIZE] |
NUTDEVICE | devVsCodec |
VS10XX device information structure. | |
NUTDEVICE | devSpiVsCodec0 |
uint8_t | zero_chunk [VSCODEC_DATA_CHUNK_SIZE] |
NUTDEVICE | devVsCodec |
VS10XX device information structure. | |
Mode Control Register | |
#define | VS_MODE_REG 0 |
Register index. | |
#define | VS_SM_DIFF 0x0001 |
Left channel inverted. | |
#define | VS_SM_RESET 0x0004 |
Allow MPEG Layers I & II. | |
#define | VS_SM_DACT 0x0100 |
VS1001 MPEG Layers I & II enable. | |
#define | VS_SM_BITORD 0x0200 |
Data bus bit order. | |
#define | VS_SM_SDIORD 0x0200 |
SDI most significant bit last. | |
Status Register | |
Untested and not recommended. Note, that this bit is available on the VS1001 only and is used as a chip select mode flag on other members of the VS10xx family. Share SPI chip select. VS1001K master mode clock speed. Untested and not recommended. Note, that this bit is available on the VS1001 only and is used as an SDI mode flag on other members of the VS10xx family. VS1002 native SDI mode. Default is 0 on the VS1011E and 1 on the VS1002. Not available on the VS1001K. ADPCM recording. Available on VS1033 and VS1053. ADPCM high pass filter. If set at the same time as VS_SM_ADPCM and VS_SM_RESET, ADPCM mode will start with a high-pass filter. This may help intelligibility of speech when there is lots of background noise. Available on VS1033. ADPCM recording selector. Used to select the input for ADPCM recording. If cleared, microphone input is used. If set to 1, LINEIN is used instead. Available on VS1033 and VS1053. Input clock range. Activates a clock divider at the XTAL input. Should be set as soon as possible after a chip reset. Available on VS1033 and VS1053. | |
#define | VS_STATUS_REG 1 |
Register index. | |
#define | VS_SS_APDOWM1 0x0004 |
Internal analog volume control mask. | |
#define | VS_SS_APDOWN2 0x0008 |
Analog driver power down. | |
#define | VS_SS_VER 0x00F0 |
Version mask. | |
#define | VS_SS_VER_LSB 4 |
Version LSB. | |
#define | VS1001_SS_VER 0 |
#define | VS1011_SS_VER 1 |
#define | VS1011E_SS_VER 2 |
#define | VS1002_SS_VER 2 |
#define | VS1003_SS_VER 3 |
#define | VS1053_SS_VER 4 |
#define | VS1033_SS_VER 5 |
#define | VS1063_SS_VER 6 |
#define | VS1103_SS_VER 7 |
Clock Frequency and Multiplier Register | |
On some earlier chips, audio interrupts may be missed when writing to this register. For the VS1001K see VS_SM_BASS. | |
#define | VS_CLOCKF_REG 3 |
Register index. | |
Decode Time Register | |
Should be set to crystal clock divided by 2000, if the clock is not 24.576 MHz. Must be set before beginning decoding MP3 data. Otherwise the sample rate will not be set correctly. Used for the VS1001, VS1011 and VS1002. VS1003/VS1033 clock frequency mask. Should be set to crystal clock divided by 4000, if the clock is not 12.288 MHz. Used for the VS1003, VS1033 and VS1053. Allowed multiplier addition. Used for WMA decoding with the VS1003, VS1033 and VS1053. Summand 0.5 is not available on the VS1053. Clock multiplier. Available on the VS1003, VS1033 and VS1053. However, multiplier 1.5 is not available on the VS1053. Clock doubler enable. Used for the VS1001, VS1011 and VS1002. | |
#define | VS_DECODE_TIME_REG 4 |
Register index. | |
Miscellaneous Audio Data Register | |
#define | VS_AUDATA_REG 5 |
Register index. | |
#define | VS_AD_STEREO 0x8000 |
Stereo flag. | |
RAM Read/Write Register | |
Value is sample rate divided by 2. Writing to this register will change the sample rate on the run. To reduce the digital power consumption when idle, you can set a low sample rate. Current bit rate mask. Current sampling rate index mask. | |
#define | VS_WRAM_REG 6 |
Register index. | |
RAM Read/Write Base Address Register | |
#define | VS_WRAMADDR_REG 7 |
Register index. | |
Application Start Address Register | |
Used to activate previously uploaded application programs. | |
#define | VS_AIADDR_REG 10 |
Register index. | |
Volume Control Register | |
#define | VS_VOL_REG 11 |
Register index. | |
#define | VS_VOL_RIGHT 0x00FF |
Right channel volume mask. | |
#define | VS_VOL_RIGHT_LSB 0 |
Right channel volume LSB. | |
#define | VS_VOL_LEFT 0xFF00 |
Right channel volume mask. | |
#define | VS_VOL_LEFT_LSB 8 |
Right channel volume LSB. | |
#define | VS_VOL_MAX 0x0000 |
#define | VS_VOL_MIN 0xFEFE |
#define | VS_VOL_OFF 0xFFFF |
Internal Command Flags | |
#define | VSREQ_PLAY 0x00000001 |
Force immediate player start. | |
#define | VSREQ_CANCEL 0x00000002 |
Force immediate player stop. | |
#define | VSREQ_VOLUPD 0x00000004 |
Volume update. | |
#define | VSREQ_AUDIOE 0x00000008 |
Audio enhancement update. | |
#define | VSREQ_BEEP 0x00000010 |
Sine wave test. | |
#define | VSREQ_RECORD 0x00000020 |
Start recording. |
#define AUDIO0_DAC_MIN_GAIN -127 |
#define AUDIO0_DAC_MAX_GAIN 0 |
#define AUDIO_DAC_MIN_GAIN AUDIO0_DAC_MIN_GAIN |
#define AUDIO_DAC_MAX_GAIN AUDIO0_DAC_MAX_GAIN |
#define AUDIO_DAC_MAX_TREB 8 |
Referenced by VsDecoderSetBass().
#define AUDIO_DAC_MAX_TFIN 15 |
Referenced by VsDecoderSetBass().
#define AUDIO_DAC_MAX_BASS 15 |
Referenced by VsDecoderSetBass().
#define AUDIO_DAC_MAX_BFIN 15 |
Referenced by VsDecoderSetBass().
#define AUDIO_SETWRITETIMEOUT 0x010d |
#define AUDIO_GETWRITETIMEOUT 0x010e |
#define AUDIO_PLAY 0x3001 |
Immediately start playing.
#define AUDIO_CANCEL 0x3002 |
Immediately stop playing and discard buffer.
#define AUDIO_GET_STATUS 0x3003 |
#define AUDIO_GET_PLAYGAIN 0x3004 |
#define AUDIO_SET_PLAYGAIN 0x3005 |
#define AUDIO_GET_PBSIZE 0x3006 |
#define AUDIO_SET_PBSIZE 0x3007 |
#define AUDIO_GET_PBLEVEL 0x3008 |
#define AUDIO_GET_PBWLOW 0x3009 |
#define AUDIO_SET_PBWLOW 0x300A |
#define AUDIO_GET_PBWHIGH 0x300B |
#define AUDIO_SET_PBWHIGH 0x300C |
#define AUDIO_BEEP 0x300F |
#define AUDIO_GET_DECINFO 0x3010 |
Retrieve decoder information.
#define AUDIO_GET_DECCAPS 0x3011 |
Retrieve decoder capabilities.
#define AUDIO_GET_DECFMTS 0x3012 |
Retrieve decoder formats.
#define AUDIO_FMT_PLUGIN 0x00000001 |
#define AUDIO_FMT_WAV_PCM 0x00000002 |
#define AUDIO_FMT_WAV_ADPCM 0x00000004 |
#define AUDIO_FMT_WAV_IMA_ADPCM 0x00000008 |
Referenced by VsCodecOpen().
#define AUDIO_FMT_VORBIS 0x00000100 |
Referenced by VsCodecOpen(), and VsCodecRead().
#define AUDIO_FMT_MPEG1_L1 0x00001000 |
#define AUDIO_FMT_MPEG1_L2 0x00002000 |
#define AUDIO_FMT_MPEG1_L3 0x00004000 |
#define AUDIO_FMT_MPEG2_AAC 0x00010000 |
#define AUDIO_FMT_MPEG4_AAC 0x00020000 |
#define AUDIO_FMT_WMA_V2 0x00100000 |
#define AUDIO_FMT_WMA_V7 0x00200000 |
#define AUDIO_FMT_WMA_V8 0x00400000 |
#define AUDIO_FMT_WMA_V9 0x00800000 |
#define AUDIO_SET_DECFMTS 0x3013 |
Enable or disable specific decoder formats.
#define AUDIO_GET_CODINFO 0x3014 |
Retrieve encoder information.
#define AUDIO_GET_CODCAPS 0x3015 |
Retrieve encoder capabilities.
#define AUDIO_GET_CODFMTS 0x3016 |
Retrieve encoder formats.
#define AUDIO_SET_CODFMTS 0x3017 |
Enable or disable specific encoder formats.
#define AUDIO_GET_MIDINFO 0x3018 |
Retrieve midi information.
#define AUDIO_GET_MIDCAPS 0x3019 |
Retrieve midi capabilities.
#define AUDIO_FMT_GMIDI1 0x00000001 |
#define AUDIO_FMT_GMIDI2 0x00000002 |
#define AUDIO_FMT_SPMIDI0 0x00000004 |
#define AUDIO_SET_TREB 0x301a |
Set audio enhancement treble value.
Referenced by VsCodecIOCtl().
#define AUDIO_GET_TREB 0x301b |
Get audio enhancement treble value.
#define AUDIO_SET_TFIN 0x301c |
Set audio enhancement treble frequency.
Referenced by VsCodecIOCtl().
#define AUDIO_GET_TFIN 0x301d |
Get audio enhancement treble frequency.
#define AUDIO_SET_BASS 0x301e |
Set audio enhancement bass value.
Referenced by VsCodecIOCtl().
#define AUDIO_GET_BASS 0x301f |
Get audio enhancement bass value.
#define AUDIO_SET_BFIN 0x3020 |
Set audio enhancement bass frequency.
Referenced by VsCodecIOCtl().
#define AUDIO_GET_BFIN 0x3021 |
Get audio enhancement bass frequency.
#define AUDIO_PLUGIN_UPLOAD 0x3030 |
Upload plug-in.
Referenced by VsCodecIOCtl().
#define AUDIO_IRQ_ENABLE 0x3031 |
Enable interrupts.
Referenced by VsCodecOpen().
#define AUDIO_SET_ICLOCK 0x3032 |
Set internal clock.
#define AUDIO_WRITE_CMEM 0x3038 |
Upload into WRAM.
Referenced by VsCodecIOCtl().
#define AUDIO_SET_PARAMX 0x3040 |
Set parametric x.
#define AUDIO_GET_PARAMX 0x3041 |
Get parametric x.
#define VSP4_CHIP_ID_OFF 0x00 |
#define VSP4_VERSION_OFF 0x02 |
#define VSP4_CONFIG1_OFF 0x03 |
#define VSP4_PLAY_SPEED_OFF 0x04 |
#define VSP4_BIT_RATE_PER_100_OFF 0x05 |
#define VSP4_END_FILL_BYTE_OFF 0x06 |
#define VSP4_RATE_TUNE_OFF 0x07 |
#define VSP4_PLAY_MODE_OFF 0x09 |
#define VSP4_SAMPLE_COUNTER_OFF 0x0a |
#define VSP4_VU_METER_OFF 0x0c |
#define VSP4_AD_MIXER_GAIN_OFF 0x0d |
#define VSP4_AD_MIXER_CONFIG_OFF 0x0e |
#define VSP4_PCM_MIXER_RATE_OFF 0x0f |
#define VSP4_PCM_MIXER_FREE_OFF 0x10 |
#define VSP4_PCM_MIXER_VOL_OFF 0x11 |
#define VSP4_EQ5_PARAMS_OFF | ( | i | ) | (0x12 + (i)) |
#define VSP4_EQ5_UPDATED_OFF 0x1c |
#define VSP4_SPEED_SHIFTER_OFF 0x1d |
#define VSP4_EAR_SPEAKER_LEVEL_OFF 0x1e |
#define VSP4_SDI_FREE_OFF 0x1f |
#define VSP4_AUDIO_FILL_OFF 0x20 |
#define VSP4_LATEST_SOF_OFF 0x25 |
#define VSP4_POSITION_MSEC_OFF 0x27 |
#define VSP4_RESYNC_OFF 0x29 |
#define VSP4_ENC_TX_UART_DIV_OFF 0x2a |
#define VSP4_ENC_TX_UART_BYTE_SPEED_OFF 0x2b |
#define VSP4_ENC_TX_PAUSE_GPIO_OFF 0x2c |
#define VSP4_ENC_SEC_ADAPT_MULTIPLIER_OFF 0x2d |
#define VSP4_ENC_CHANNEL_MAX_OFF 0x3c |
#define VSP4_ENC_SERIAL_NUMBER_OFF 0x3e |
#define VSP4_WMA_CUR_PACKET_SIZE_OFF 0x2a |
#define VSP4_WMA_PACKET_SIZE_OFF 0x2c |
#define VSP4_AAC_SCE_FOUND_MASK_OFF 0x2a |
#define VSP4_AAC_CPE_FOUND_MASK_OFF 0x2b |
#define VSP4_AAC_LFE_FOUND_MASK_OFF 0x2c |
#define VSP4_AAC_PLAY_SELECT_OFF 0x2d |
#define VSP4_AAC_DYN_COMPRESS_OFF 0x2e |
#define VSP4_AAC_DYN_BOOST_OFF 0x2f |
#define VSP4_AAC_SBR_AND_PS_STATUS_OFF 0x30 |
#define VSP4_AAC_SBR_PS_FLAGS_OFF 0x31 |
#define VSP4_VORBIS_GAIN_OFF 0x2a |
#define VS_PLAYMODE_MONO_OUTPUT_ON ox0001 |
#define VS_PLAYMODE_PAUSE_ON 0x0002 |
#define VS_PLAYMODE_VUMETER_ON 0x0004 |
#define VS_PLAYMODE_ADMIXER_ON 0x0008 |
#define VS_PLAYMODE_PCMMIXER_ON 0x0010 |
#define VS_PLAYMODE_EQ5_ON 0x0020 |
#define VS_PLAYMODE_SPEEDSHIFTER_ON 0x0040 |
#define VS_OPCODE_READ 3 |
#define VS_OPCODE_WRITE 2 |
#define VS_MODE_REG 0 |
Register index.
#define VS_SM_DIFF 0x0001 |
Left channel inverted.
#define VS_SM_RESET 0x0004 |
Allow MPEG Layers I & II.
Determines whether it is allowed to decode MPEG 1 and 2 Layers I and II in addition to Layer III. If you enable Layer I and Layer II decoding, you are liable for any patent issues that may arise. Joint licensing of MPEG 1.0 / 2.0 Layer III does not cover all patents pertaining to Layers I and II.
VS1001K fast forward.
By setting this bit, the player starts to accept data at a high speed, and just decodes the audio headers silently without playing any audio data. This can be used to fast-forward data with safe landing. Register VS_DECODE_TIME_REG is updated during a fast-forward just as normal.
Note, that this bit is available on the VS1001K only and is used as MPEG Layer I & II enable on other members of the VS10xx family.
Soft reset.
Bit is cleared automatically.
#define VS_SM_DACT 0x0100 |
VS1001 MPEG Layers I & II enable.
This bit is marked unused in later VS1001 datasheet versions and may not work due to firmware problems.
Note, that this bit was available on the VS1001K only and is used as a cancel flag on other members of the VS10xx family.
If you enable Layer I and Layer II decoding, you are liable for any patent issues that may arise.
Jump out of wave decoding.
Set this bit to stop WAV, WMA and MIDI file playing before the end of the file has been reached. Continue sending zeros for WAV and more data for MIDI and WMA until this bit is cleared again.
Not available on the VS1001K.
Stop decoding in the middle.
Set this bit to stop decoding a in the middle, and continue sending data honouring DREQ. When this flag is detected by a codec, it will stop decoding and discard stream buffer content. The flag is cleared automatically and SCI HDAT1 will also be cleared.
Available on the VS1053.
Power down.
During powerdown, no audio is played and no SDI operations are performed. It is recommended to set VS_VOL_REG to 0xFFFF before setting this bit.
For best power down efficiency, activate hardware reset.
Not available on the VS1011. Although defined, this is not implemented in the VS1001K firmware.
EarSpeaker spatial processing.
VS1001K DAC mode.
16-bit DAC mode if set, MP3 mode otherwise.
This bit is marked unused in later VS1001 datasheet versions and may not work due to firmware problems.
Note, that this bit was available on the VS1001 only and is used as a test mode flag on other members of the VS10xx family.
Allow SDI tests.
Not required for the VS1001K, where tests are enabled by default.
VS1001K DAC mono mode.
DAC mono mode if set, stereo mode otherwise.
This bit is marked unused in later VS1001 datasheet versions and may not work due to firmware problems.
Note, that this bit was available on the VS1001 only and is used as a streaming mode flag on other members of the VS10xx family.
Stream mode.
When stream mode is activated, data should be sent with as even intervals as possible (and preferable with data blocks of less than 512 bytes). The decoder makes every attempt to keep its input buffer half full by changing its playback speed upto 5%. For best quality sound, the average speed error should be within 0.5%, the bitrate should not exceed 160 kbit/s and VBR should not be used.
Not available on the VS1001K.
VS1001K bass/treble enhancer.
When set, this bit turns on the built-in bass and treble enhancer.
Active edge of the data clock.
If clear data is read at the rising edge, and if set data is read at the falling edge.
#define VS_SM_BITORD 0x0200 |
Data bus bit order.
When clear the most significant bit is sent first, which is the default. This register bit has no effect on the SCI bus.
#define VS_SM_SDIORD 0x0200 |
SDI most significant bit last.
Same as VS_SM_BITORD.
#define VS_STATUS_REG 1 |
Register index.
#define VS_SS_APDOWM1 0x0004 |
Internal analog volume control mask.
These bits is meant to be used by the internal firmware only.
Reference voltage selection.
If AVDD is at least higher than 3.3V, then this bit can be set to select 1.65V reference voltage to increase the analog output swing.
See VS_SS_AD_CLOCK for more information about using this bit with the VS1053b.
AD clock divider.
This bit can be set to divide the AD modulator frequency by 2.
Due to a firmware bug in VS1053b, volume calculation routine clears VS_SS_AD_CLOCK and VS_SS_VREF_1_65 bits. Write to VS_STATUS_REG or VS_VOL_REG as well as sample rate change with bass enhancer or treble control actived, causes the volume calculation routine to be called.
As a workaround you can write to VS_STATUS_REG through VS_WRAMADDR_REG and VS_WRAM_REG after each volume change. Write 0xC001 to VS_WRAMADDR_REG, then write the value to VS_WRAM_REG. However, the difference in performance between the modes is not significant, so it is easier to just use the default mode.
Internal analog power down.
This bit is meant to be used by the internal firmware only.
#define VS_SS_APDOWN2 0x0008 |
Analog driver power down.
This bit is typically controlled by the internal firmware. However, if the application wants to power down the VS1001 and VS1011 with a minimum power-off transient, this bit should be set to 1 a few milliseconds before activating reset.
With newer chips set the volume register to 0xFFFF a few milliseconds before reset.
#define VS_SS_VER 0x00F0 |
Version mask.
#define VS_SS_VER_LSB 4 |
Version LSB.
#define VS1001_SS_VER 0 |
#define VS1011_SS_VER 1 |
#define VS1011E_SS_VER 2 |
#define VS1002_SS_VER 2 |
#define VS1003_SS_VER 3 |
#define VS1053_SS_VER 4 |
#define VS1033_SS_VER 5 |
#define VS1063_SS_VER 6 |
#define VS1103_SS_VER 7 |
#define VS_CLOCKF_REG 3 |
Register index.
#define VS_DECODE_TIME_REG 4 |
Register index.
This register contains the decode time in full seconds or zero after resetting the decoder.
The user may change the value of this register. However, in that case the new value should be written twice.
#define VS_AUDATA_REG 5 |
Register index.
Usage on the VS1001K differs.
#define VS_AD_STEREO 0x8000 |
Stereo flag.
1 for stereo and 0 for mono. Read-only.
On the VS1001K the most significant bit is used as a stereo indicator.
#define VS_WRAM_REG 6 |
Register index.
Used to upload application programs and data to instruction and data RAM.
#define VS_WRAMADDR_REG 7 |
Register index.
Used to upload application programs and data to instruction and data RAM.
#define VS_AIADDR_REG 10 |
Register index.
#define VS_VOL_REG 11 |
Register index.
After hardware reset, volume is at maximum value. Software reset does not change volume settings.
Setting this register to VS_VOL_OFF will put the chip in analog power down mode.
On some earlier chips, audio interrupts may be missed when writing to this register. This will not happen on the VS1053, where volume changes are delayed until the next batch of samples are sent to the audio FIFO.
#define VS_VOL_RIGHT 0x00FF |
Right channel volume mask.
Attenuation is given in 0.5 dB steps or 255 for mute.
#define VS_VOL_RIGHT_LSB 0 |
Right channel volume LSB.
#define VS_VOL_LEFT 0xFF00 |
Right channel volume mask.
Attenuation is given in 0.5 dB steps or 255 for mute.
#define VS_VOL_LEFT_LSB 8 |
Right channel volume LSB.
#define VS_VOL_MAX 0x0000 |
#define VS_VOL_MIN 0xFEFE |
#define VS_VOL_OFF 0xFFFF |
#define VS_FLUSH_BYTES 2048 |
Application register 0 index.
Do not use with VS1001. Also used for mixer volume on the VS1103.
VS1001K application register 0 index.
A second register is available at VS_AICTRL_REG + 1.
Application register 1 index.
Register 0 on the VS1001. Also used for IMA ADPCM record control in the VS1103.
Application register 2 index.
Register 1 on the VS1001.
Application register 3 index.
Do not use with VS1001.
#define CODEC_STATUS_IDLE 0 |
#define CODEC_STATUS_PLAYING 1 |
#define CODEC_STATUS_RECORDING 2 |
Referenced by FeederThread().
#define VSCODEC_CMD_TIMEOUT NUT_WAIT_INFINITE |
Minimum time in milliseconds to held hardware reset low.
Referenced by VsCodecReg().
#define VSCODEC_DATA_CHUNK_SIZE 32 |
Number of data bytes we can send without checking DREQ.
#define VSREQ_PLAY 0x00000001 |
Force immediate player start.
Referenced by FeederThread(), and VsCodecIOCtl().
#define VSREQ_CANCEL 0x00000002 |
Force immediate player stop.
Referenced by FeederThread(), and VsCodecIOCtl().
#define VSREQ_VOLUPD 0x00000004 |
Volume update.
Referenced by FeederThread(), and VsCodecIOCtl().
#define VSREQ_AUDIOE 0x00000008 |
Audio enhancement update.
Referenced by FeederThread(), and VsCodecIOCtl().
#define VSREQ_BEEP 0x00000010 |
Sine wave test.
Referenced by FeederThread(), and VsCodecIOCtl().
#define VSREQ_RECORD 0x00000020 |
Start recording.
Referenced by FeederThread(), and VsCodecRead().
#define AUDIO_VS1001K |
#define VS10XX_FREQ 12288000UL |
Decoder crystal frequency.
#define VS10XX_HWRST_DURATION 1 |
Minimum time in milliseconds to held hardware reset low.
#define VS10XX_HWRST_RECOVER 4 |
Milliseconds to wait after hardware reset.
#define VS10XX_SWRST_RECOVER 2 |
Milliseconds to wait after software reset.
#define VS10XX_SCI_MODE 0 |
#define VS10XX_SCI_RATE (VS10XX_FREQ / 6) |
#define VS10XX_SDI_MODE 0 |
#define VS10XX_SDI_RATE (VS10XX_FREQ / 6) |
#define VSREQ_PLAY 0x00000001 |
Referenced by FeederThread().
#define VSREQ_CANCEL 0x00000002 |
Referenced by FeederThread().
#define VSREQ_BEEP 0x00000004 |
Referenced by FeederThread().
typedef struct _VS_PLUGIN_INFO VS_PLUGIN_INFO |
typedef struct _VS_WRAM_DATA VS_WRAM_DATA |
typedef struct _VS_PARAMX_INFO VS_PARAMX_INFO |
Wait until codec is ready.
dev | Sepcifies the codec device. |
tmo | Maximum number of milliseconds to wait. |
References _VSDCB::dcb_feedme, _VSDCB::dcb_isready, _NUTDEVICE::dev_dcb, and NutEventWait().
Referenced by FeederThread(), and VsCodecReg().
uint16_t VsCodecReg | ( | NUTDEVICE * | dev, |
uint_fast8_t | op, | ||
uint_fast8_t | reg, | ||
uint_fast16_t | val | ||
) |
References _VSDCB::dcb_sendcmd, _NUTDEVICE::dev_dcb, VSCODEC_CMD_TIMEOUT, and VsCodecWaitReady().
Referenced by FeederThread(), VsCodecMode(), VsDecoderSetBass(), and VsDecoderSetVolume().
uint16_t VsCodecMode | ( | NUTDEVICE * | dev, |
uint_fast16_t | flags, | ||
uint_fast16_t | mask | ||
) |
Read and modify VLSI audio codec mode flags.
Set both, flags and mask to zero to read the flags without change.
dev | Specifies the audio codec device. |
flags | Mode flags to set. All other flags are disabled, if they appear in the mask. |
mask | Mode flags to update. All other flags are left unchanged. |
References NutSleep(), rc, VS_MODE_REG, VS_OPCODE_READ, VS_OPCODE_WRITE, VS_SM_RESET, and VsCodecReg().
Referenced by FeederThread(), VsCodecBeep(), and VsCodecOpen().
int VsDecoderSetVolume | ( | NUTDEVICE * | dev, |
int | left, | ||
int | right | ||
) |
Set volume.
dev | Specifies the audio codec device. |
left | Left channel gain in db. |
right | Right channel gain in db. |
References AUDIO_DAC_MAX_GAIN, AUDIO_DAC_MIN_GAIN, _VSDCB::dcb_lvol, _VSDCB::dcb_rvol, _NUTDEVICE::dev_dcb, VS_OPCODE_WRITE, VS_VOL_LEFT_LSB, VS_VOL_REG, VS_VOL_RIGHT_LSB, and VsCodecReg().
Referenced by FeederThread().
int VsDecoderSetBass | ( | NUTDEVICE * | dev, |
int | treb, | ||
int | tfin, | ||
int | bass, | ||
int | bfin | ||
) |
Set Bass.
dev | Specifies the audio codec device. |
treb | Treble amplitude x 1.5dB. |
tset | Treble frequency limit x 1000Hz |
bass | Bass amplitude x 1dB. |
bset | Bass frequency limit x 10Hz |
References AUDIO_DAC_MAX_BASS, AUDIO_DAC_MAX_BFIN, AUDIO_DAC_MAX_TFIN, AUDIO_DAC_MAX_TREB, _VSDCB::dcb_bass, _VSDCB::dcb_bfin, _VSDCB::dcb_tfin, _VSDCB::dcb_treb, _NUTDEVICE::dev_dcb, VS_BASS_REG, VS_OPCODE_WRITE, VS_SB_AMPLITUDE_LSB, VS_SB_FREQLIMIT_LSB, VS_ST_AMPLITUDE_LSB, VS_ST_FREQLIMIT_LSB, and VsCodecReg().
Referenced by FeederThread().
Start or stop sine wave beeper.
Old, VS1001 compatible routine, which supports a limit number of frequencies only. It will try to find the best value.
dev | Specifies the audio codec device. |
fsin | Frequency, or 0 to switch beeper off. |
References _VSDCB::dcb_senddata, _NUTDEVICE::dev_dcb, rc, VS_SM_RESET, VS_SM_TESTS, and VsCodecMode().
Referenced by FeederThread().
References CODEC_STATUS_IDLE, _VSDCB::dcb_pbstat, _VSDCB::dcb_pbwhi, _VSDCB::dcb_pbwlo, _NUTDEVICE::dev_dcb, NULL, NutSegBufAvailable(), and NutSegBufInit().
Referenced by VsCodecIOCtl().
void FeederThread | ( | void * | arg | ) |
References _BV, CODEC_STATUS_IDLE, CODEC_STATUS_PLAYING, CODEC_STATUS_RECORDING, _VSDCB::dcb_bass, _VSDCB::dcb_bfin, _VSDCB::dcb_bufque, _VSDCB::dcb_clvol, _VSDCB::dcb_crvol, _VSDCB::dcb_feedme, _VSDCB::dcb_isready, _VSDCB::dcb_lvol, _VSDCB::dcb_pbstat, _VSDCB::dcb_pbwhi, _VSDCB::dcb_pbwlo, _VSDCB::dcb_recvdata, _VSDCB::dcb_rvol, _VSDCB::dcb_scmd, _VSDCB::dcb_senddata, _VSDCB::dcb_sinefreq, _VSDCB::dcb_slvol, _VSDCB::dcb_srvol, _VSDCB::dcb_tfin, _VSDCB::dcb_treb, _NUTDEVICE::dev_dcb, NULL, NUT_IRQMODE_RISINGEDGE, NUT_WAIT_INFINITE, NutEventPost(), NutEventWait(), NutIrqEnable(), NutIrqSetMode(), NutRegisterIrqHandler(), NutSegBufReadLast(), NutSegBufReadRequest(), NutSegBufReset(), NutSegBufUsed(), NutSegBufWriteLast(), NutSegBufWriteRequest(), NutSleep(), NutThreadSetPriority(), outr, SPI_MODFDIS, SPI_MSTR, SPI_NCPHA, SPI_SCBR_LSB, VS_AIADDR_REG, VS_HDAT1_REG, VS_OPCODE_READ, VS_OPCODE_WRITE, VS_VOL_LEFT_LSB, VS_VOL_REG, VS_VOL_RIGHT_LSB, VsBeep(), VsCodecBeep(), VsCodecMode(), VsCodecReg(), VsCodecWaitReady(), VsDecoderSetBass(), VsDecoderSetVolume(), VSREQ_AUDIOE, VSREQ_BEEP, VSREQ_CANCEL, VSREQ_PLAY, VSREQ_RECORD, and VSREQ_VOLUPD.
int VsCodecIOCtl | ( | NUTDEVICE * | dev, |
int | req, | ||
void * | conf | ||
) |
Handle I/O controls for audio codec.
dev | Specifies the audio codec device. |
References AUDIO_BEEP, AUDIO_CANCEL, AUDIO_GET_CODCAPS, AUDIO_GET_CODINFO, AUDIO_GET_DECCAPS, AUDIO_GET_DECINFO, AUDIO_GET_MIDCAPS, AUDIO_GET_MIDINFO, AUDIO_GET_PBLEVEL, AUDIO_GET_PBSIZE, AUDIO_GET_PBWHIGH, AUDIO_GET_PBWLOW, AUDIO_GET_PLAYGAIN, AUDIO_GET_STATUS, AUDIO_GETWRITETIMEOUT, AUDIO_PLAY, AUDIO_PLUGIN_UPLOAD, AUDIO_SET_BASS, AUDIO_SET_BFIN, AUDIO_SET_PBSIZE, AUDIO_SET_PBWHIGH, AUDIO_SET_PBWLOW, AUDIO_SET_PLAYGAIN, AUDIO_SET_TFIN, AUDIO_SET_TREB, AUDIO_SETWRITETIMEOUT, AUDIO_WRITE_CMEM, CODEC_STATUS_IDLE, CODEC_STATUS_PLAYING, _VSDCB::dcb_bass, _VSDCB::dcb_bfin, _VSDCB::dcb_cod_caps, _VSDCB::dcb_control, _VSDCB::dcb_dec_caps, _VSDCB::dcb_feedme, _VSDCB::dcb_lvol, _VSDCB::dcb_midi_caps, _VSDCB::dcb_pbstat, _VSDCB::dcb_pbwhi, _VSDCB::dcb_pbwlo, _VSDCB::dcb_rvol, _VSDCB::dcb_scmd, _VSDCB::dcb_sinefreq, _VSDCB::dcb_tfin, _VSDCB::dcb_treb, _VSDCB::dcb_wtmo, _NUTDEVICE::dev_dcb, NutEventPost(), NutSegBufAvailable(), NutSegBufUsed(), rc, VsDecoderBufferInit(), VSREQ_AUDIOE, VSREQ_BEEP, VSREQ_CANCEL, VSREQ_PLAY, and VSREQ_VOLUPD.
Referenced by VsCodecOpen().
int VsCodecRead | ( | NUTFILE * | nfp, |
void * | data, | ||
int | len | ||
) |
Read from the encoder.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to VsCodecOpen(). |
data | Pointer to the data buffer. If NULL, the buffered data will be flushed. |
len | Number of bytes to read. If 0, all buffered data will be flushed. |
References AUDIO_FMT_VORBIS, CODEC_STATUS_IDLE, CODEC_STATUS_PLAYING, _VSDCB::dcb_bufque, _VSDCB::dcb_cod_mode, _VSDCB::dcb_feedme, _VSDCB::dcb_pbstat, _VSDCB::dcb_rtmo, _VSDCB::dcb_scmd, _NUTDEVICE::dev_dcb, memcpy(), _NUTFILE::nf_dev, NULL, NutEventPost(), NutEventWait(), NutSegBufReadLast(), NutSegBufReadRequest(), rc, and VSREQ_RECORD.
int VsCodecWrite | ( | NUTFILE * | nfp, |
const void * | data, | ||
int | len | ||
) |
Write to decoder.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to VsCodecOpen(). |
data | Pointer to the data buffer. If NULL, the buffered data will be flushed. |
len | Number of bytes that are available in the buffer. If 0, all buffered data will be flushed. |
References _VSDCB::dcb_bufque, _VSDCB::dcb_feedme, _VSDCB::dcb_wtmo, _NUTDEVICE::dev_dcb, memcpy(), _NUTFILE::nf_dev, NULL, NutEventPost(), NutEventWait(), NutSegBufWriteLast(), NutSegBufWriteRequest(), and rc.
int VsCodecWrite_P | ( | NUTFILE * | nfp, |
PGM_P | buffer, | ||
int | len | ||
) |
Write program data to decoder.
Similar to VsCodecWrite() except that the data is expected in program memory.
This function is implemented for CPUs with Harvard Architecture only.
This function is called by the low level output routines of the C runtime library, using the _NUTDEVICE::dev_write_P entry.
nfp | Pointer to a NUTFILE structure, obtained by a previous call to VsCodecOpen(). |
buffer | Pointer to the data in program space. If zero, then the output buffer will be flushed. |
len | Number of bytes to write. |
References _O_WRONLY, AUDIO_FMT_VORBIS, AUDIO_FMT_WAV_IMA_ADPCM, AUDIO_IRQ_ENABLE, _VSDCB::dcb_cod_mode, _NUTDEVICE::dev_dcb, malloc(), _NUTFILE::nf_dev, _NUTFILE::nf_fcb, _NUTFILE::nf_next, NULL, NutSegBufReset(), strcmp(), VS_SM_RESET, VsCodecIOCtl(), and VsCodecMode().
int VsCodecClose | ( | NUTFILE * | nfp | ) |
References _VSDCB::dcb_wtmo, _NUTDEVICE::dev_dcb, free(), _NUTFILE::nf_dev, and rc.
uint8_t zero_chunk[VSCODEC_DATA_CHUNK_SIZE] |
VS10XX device information structure.
An application must pass a pointer to this structure to NutRegisterDevice() before using this driver.
The device is named audio0.
uint8_t zero_chunk[VSCODEC_DATA_CHUNK_SIZE] |
{ 0, {'a', 'u', 'd', 'i', 'o', '0', 0, 0, 0}, IFTYP_CHAR, 0, 0, 0, &dcb, VsInit, VsIOCtl, NULL, VsWrite, VsWrite_P, VsOpen, VsClose, NULL }
VS10XX device information structure.
An application must pass a pointer to this structure to NutRegisterDevice() before using this driver.
The device is named audio0.