Nut/OS  4.10.3
API Reference
VLSI VS10XX

MP3 Decoder. More...

Collaboration diagram for VLSI VS10XX:

Data Structures

struct  VS_HEADERINFO

Defines

#define VS_OPCODE_READ   3
#define VS_OPCODE_WRITE   2
#define VS_FLUSH_BYTES   2048
#define VS_STATUS_STOPPED   0
#define VS_STATUS_RUNNING   1
#define VS_STATUS_EOF   2
#define VS_STATUS_EMPTY   4
#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   10
 Milliseconds to wait after hardware reset.
#define VS10XX_SWRST_RECOVER   VS10XX_HWRST_RECOVER
 Milliseconds to wait after software reset.
#define VS10XX_SCI_MODE   0
#define VS10XX_SCI_RATE   (VS10XX_FREQ / 4)
#define VS10XX_SDI_MODE   0
#define VS10XX_SDI_RATE   (VS10XX_FREQ / 4)
#define SciReset(act)
#define SciSetMode()   (-1)
#define SciSetSpeed()
#define SciSelect()
#define SciDeselect()
#define SciByte(b)   0
#define SdiSetMode()   (-1)
#define SdiSetSpeed()
#define SdiSelect()
#define SdiDeselect()
#define SdiByte(b)   0

Functions

int VsPlayerInit (void)
 Initialize the VS10XX hardware interface.
int VsPlayerReset (uint16_t mode)
 Software reset the decoder.
int VsPlayerSetMode (uint16_t mode)
 Set mode register of the decoder.
int VsPlayerKick (void)
 Start playback.
int VsPlayerStop (void)
 Stops the playback.
int VsPlayerFlush (void)
 Sets up decoder internal buffer flushing.
ureg_t VsPlayerInterrupts (ureg_t enable)
 Enable or disable player interrupts.
ureg_t VsPlayerThrottle (ureg_t on)
 Throttle decoder activity.
uint16_t VsPlayTime (void)
 Returns play time since last reset.
unsigned int VsGetStatus (void)
 Returns status of the player.
int VsGetHeaderInfo (VS_HEADERINFO *vshi)
 Query MP3 stream header information.
uint16_t VsMemoryTest (void)
 Initialize decoder memory test and return result.
int VsSetVolume (ureg_t left, ureg_t right)
 Set volume.
int VsBeep (uint8_t fsin, uint8_t ms)
 Sine wave beep.

Mode Control Register

#define VS_MODE_REG   0
 Register index.
#define VS_SM_DIFF   0x0001
 Left channel inverted.
#define VS_SM_LAYER12   0x0002
 Allow MPEG Layers I & II.
#define VS_SM_FFWD   0x0002
 VS1001K fast forward.
#define VS_SM_RESET   0x0004
 Soft reset.
#define VS_SM_MP12   0x0008
 VS1001 MPEG Layers I & II enable.
#define VS_SM_OUTOFWAV   0x0008
 Jump out of wave decoding.
#define VS_SM_PDOWN   0x0010
 Power down.
#define VS_SM_DAC   0x0020
 VS1001K unknown function.
#define VS_SM_TESTS   0x0020
 Allow SDI tests.
#define VS_SM_DACMONO   0x0040
 VS1001K unknown function.
#define VS_SM_STREAM   0x0040
 Stream mode.
#define VS_SM_BASS   0x0080
 VS1001K bass/treble enhancer.
#define VS_SM_DACT   0x0100
 Active edge of the data clock.
#define VS_SM_BYTEORD   0x0200
 
#define VS_SM_SDIORD   0x0200
 SDI most significant bit last.
#define VS_SM_IBMODE   0x0400
 VS1001K master mode.
#define VS_SM_SDISHARE   0x0400
 Share SPI chip select.
#define VS_SM_IBCLK   0x0800
 VS1001K master mode clock speed.
#define VS_SM_SDINEW   0x0800
 VS1002 native SDI mode.
#define VS_SM_ADPCM   0x1000
 ADPCM recording.
#define VS_SM_ADPCM_HP   0x2000
 ADPCM high pass filter.
#define VS_SM_LINE_IN   0x4000
 ADPCM recording selector.
#define VS_SM_CLK_RANGE   0x8000
 Input clock range.

Status Register

#define VS_STATUS_REG   1
 Register index.
#define VS_SS_AVOL   0x0003
 Internal analog volume control mask.
#define VS_SS_AVOL_LSB   0
 Internal analog volume control LSB.
#define VS_SS_APDOWM1   0x0004
 Internal analog power down.
#define VS_SS_APDOWN2   0x0008
 Analog driver power down.
#define VS_SS_VER   0x0070
 Version mask.
#define VS_SS_VER_LSB   4
 Version LSB.

VS1001 internal frequency control register.

#define VS_INT_FCTLH_REG   2
 Register index.

Bass/Treble Enhancer Register

#define VS_BASS_REG   2
 Register index.
#define VS_SB_FREQLIMIT   0x000F
 Bass enhancer lower limit frequency mask.
#define VS_SB_FREQLIMIT_LSB   0
 Lower limit frequency LSB.
#define VS_SB_AMPLITUDE   0x00F0
 Bass enhancement mask.
#define VS_SB_AMPLITUDE_LSB   4
 Bass enhancement LSB.
#define VS_ST_FREQLIMIT   0x000F
 Treble control lower limit frequency mask.
#define VS_ST_FREQLIMIT_LSB   0
 Lower limit frequency LSB.
#define VS_ST_AMPLITUDE   0x00F0
 Treble control mask.
#define VS_ST_AMPLITUDE_LSB   4
 Bass enhancement LSB.

Clock Frequency and Multiplier Register

#define VS_CLOCKF_REG   3
 Register index.
#define VS_SC_FREQ   0x7FFF
 Clock frequency mask.
#define VS_SC_X3FREQ   0x07FF
 VS1003/VS1033 clock frequency mask.
#define VS_SC_FREQ_LSB   0
 Clock frequency LSB.
#define VS_SC_ADD   0x1800
 Allowed multiplier addition.
#define VS_SC_MULT   0xE000
 Clock multiplier.
#define VS_CF_DOUBLER   0x8000
 Clock doubler enable.

Decode Time Register

#define VS_DECODE_TIME_REG   4
 Register index.

Miscellaneous Audio Data Register

#define VS_AUDATA_REG   5
 Register index.
#define VS_AD_STEREO   0x0001
 Stereo flag.
#define VS_AD_SRATE   0xFFFE
 Current sampling rate mask.
#define VS_AD_SRATE_LSB   1
 Crystal clock LSB.

RAM Read/Write Register

#define VS_WRAM_REG   6
 Register index.

RAM Read/Write Base Address Register

#define VS_WRAMADDR_REG   7
 Register index.

Stream Header Data Register 0

#define VS_HDAT0_REG   8
 Register index.

VS1103 Input Register 0

#define VS_IN0_REG   8
 Register index.

Stream Header Data Register 1

#define VS_HDAT1_REG   9
 Register index.

VS1103 Input Register 1

#define VS_IN1_REG   9
 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.

VS1103 Mixer Volume Register

#define VS_MIXERVOL_REG   12
 Register index.
#define VS_SMV_GAIN1   0x001F
#define VS_SMV_GAIN2   0x03E0
#define VS_SMV_GAIN3   0x7C00
#define VS_SMV_ACTIVE   0x8000

VS1103 IMA ADPCM Record Control Register

#define VS_ADPCMRECCTL_REG   13
 Register index.
#define VS_SARC_GAIN4   0x003F
#define VS_SARC_MANUALGAIN   0x0040
#define VS_SARC_OUTOFADPCM   0x0080

Application Control Registers

#define VS_AICTRL0_REG   12
 Application register 0 index.
#define VS_AICTRL_REG   13
 VS1001K application register 0 index.
#define VS_AICTRL1_REG   13
 Application register 1 index.
#define VS_AICTRL2_REG   14
 Application register 2 index.
#define VS_AICTRL3_REG   15
 Application register 3 index.

Detailed Description

MP3 Decoder.


Define Documentation

#define VS_OPCODE_READ   3

Definition at line 68 of file vs10xx.h.

#define VS_OPCODE_WRITE   2

Definition at line 69 of file vs10xx.h.

#define VS_MODE_REG   0

Register index.

Definition at line 78 of file vs10xx.h.

#define VS_SM_DIFF   0x0001

Left channel inverted.

Definition at line 80 of file vs10xx.h.

#define VS_SM_LAYER12   0x0002

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.

Definition at line 89 of file vs10xx.h.

#define VS_SM_FFWD   0x0002

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.

Definition at line 101 of file vs10xx.h.

#define VS_SM_RESET   0x0004

Soft reset.

Bit is cleared automatically.

Definition at line 106 of file vs10xx.h.

#define VS_SM_MP12   0x0008

VS1001 MPEG Layers I & II enable.

May not work reliable due to firmware problems.

If you enable Layer I and Layer II decoding, you are liable for any patent issues that may arise.

Definition at line 114 of file vs10xx.h.

#define VS_SM_OUTOFWAV   0x0008

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.

Definition at line 123 of file vs10xx.h.

#define VS_SM_PDOWN   0x0010

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.

Definition at line 135 of file vs10xx.h.

#define VS_SM_DAC   0x0020

VS1001K unknown function.

Definition at line 137 of file vs10xx.h.

#define VS_SM_TESTS   0x0020

Allow SDI tests.

Not required for the VS1001K, where tests are enabled by default.

Definition at line 142 of file vs10xx.h.

Referenced by VsCodecBeep().

#define VS_SM_DACMONO   0x0040

VS1001K unknown function.

Definition at line 144 of file vs10xx.h.

#define VS_SM_STREAM   0x0040

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.

Definition at line 156 of file vs10xx.h.

#define VS_SM_BASS   0x0080

VS1001K bass/treble enhancer.

Definition at line 158 of file vs10xx.h.

#define VS_SM_DACT   0x0100

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.

Definition at line 164 of file vs10xx.h.

#define VS_SM_BYTEORD   0x0200

Definition at line 166 of file vs10xx.h.

#define VS_SM_SDIORD   0x0200

SDI most significant bit last.

Bytes are, however, still sent in default order.

Definition at line 171 of file vs10xx.h.

#define VS_SM_IBMODE   0x0400

VS1001K master mode.

Untested and not recommended.

Definition at line 176 of file vs10xx.h.

#define VS_SM_SDISHARE   0x0400

Share SPI chip select.

Definition at line 178 of file vs10xx.h.

#define VS_SM_IBCLK   0x0800

VS1001K master mode clock speed.

Untested and not recommended.

Definition at line 183 of file vs10xx.h.

#define VS_SM_SDINEW   0x0800

VS1002 native SDI mode.

Default is 0 on the VS1011E and 1 on the VS1002.

Not available on the VS1001K.

Definition at line 190 of file vs10xx.h.

#define VS_SM_ADPCM   0x1000

ADPCM recording.

Available on VS1033.

Definition at line 195 of file vs10xx.h.

#define VS_SM_ADPCM_HP   0x2000

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.

Definition at line 204 of file vs10xx.h.

#define VS_SM_LINE_IN   0x4000

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.

Definition at line 212 of file vs10xx.h.

#define VS_SM_CLK_RANGE   0x8000

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.

Definition at line 220 of file vs10xx.h.

#define VS_STATUS_REG   1

Register index.

Definition at line 229 of file vs10xx.h.

#define VS_SS_AVOL   0x0003

Internal analog volume control mask.

These bits is meant to be used by the internal firmware only.

  • 0 for 0 dB
  • 1 for -6 dB
  • 3 for -12 dB

Definition at line 238 of file vs10xx.h.

#define VS_SS_AVOL_LSB   0

Internal analog volume control LSB.

Definition at line 240 of file vs10xx.h.

#define VS_SS_APDOWM1   0x0004

Internal analog power down.

This bit is meant to be used by the internal firmware only.

Definition at line 245 of file vs10xx.h.

#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 decoder with a minimum power-off transient, this bit should be set to 1 a few milliseconds before activating reset.

Definition at line 253 of file vs10xx.h.

#define VS_SS_VER   0x0070

Version mask.

  • 0 for VS1001
  • 1 for VS1011
  • 2 for VS1002 and VS1011E, see VS_SM_SDINEW
  • 3 for VS1003

Definition at line 261 of file vs10xx.h.

#define VS_SS_VER_LSB   4

Version LSB.

Definition at line 263 of file vs10xx.h.

#define VS_INT_FCTLH_REG   2

Register index.

Use only on older chip revisions?

Definition at line 275 of file vs10xx.h.

#define VS_BASS_REG   2

Register index.

For the VS1001K see VS_SM_BASS.

Definition at line 287 of file vs10xx.h.

Referenced by VsDecoderSetBass().

#define VS_SB_FREQLIMIT   0x000F

Bass enhancer lower limit frequency mask.

Specified in 10 Hz steps.

Definition at line 292 of file vs10xx.h.

#define VS_SB_FREQLIMIT_LSB   0

Lower limit frequency LSB.

Definition at line 294 of file vs10xx.h.

Referenced by VsDecoderSetBass().

#define VS_SB_AMPLITUDE   0x00F0

Bass enhancement mask.

Bass enhancement in 1 dB steps, or disabled when zero.

Definition at line 299 of file vs10xx.h.

#define VS_SB_AMPLITUDE_LSB   4

Bass enhancement LSB.

Definition at line 301 of file vs10xx.h.

Referenced by VsDecoderSetBass().

#define VS_ST_FREQLIMIT   0x000F

Treble control lower limit frequency mask.

Specified in 1 kHz steps.

Definition at line 306 of file vs10xx.h.

#define VS_ST_FREQLIMIT_LSB   0

Lower limit frequency LSB.

Definition at line 308 of file vs10xx.h.

Referenced by VsDecoderSetBass().

#define VS_ST_AMPLITUDE   0x00F0

Treble control mask.

Treble control in 1.5 dB steps, or disabled when zero.

Definition at line 313 of file vs10xx.h.

#define VS_ST_AMPLITUDE_LSB   4

Bass enhancement LSB.

Definition at line 315 of file vs10xx.h.

Referenced by VsDecoderSetBass().

#define VS_CLOCKF_REG   3

Register index.

Definition at line 324 of file vs10xx.h.

#define VS_SC_FREQ   0x7FFF

Clock frequency mask.

Should be set to crystal clock divided by 2000, if the clock is not 24.576 MHz.

Used for the VS1001, VS1011 and VS1002.

Definition at line 332 of file vs10xx.h.

#define VS_SC_X3FREQ   0x07FF

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 and VS1033.

Definition at line 340 of file vs10xx.h.

#define VS_SC_FREQ_LSB   0

Clock frequency LSB.

Definition at line 342 of file vs10xx.h.

#define VS_SC_ADD   0x1800

Allowed multiplier addition.

Used for WMA decoding with the VS1003 and VS1033.

Definition at line 347 of file vs10xx.h.

#define VS_SC_MULT   0xE000

Clock multiplier.

Used for the VS1003 and VS1033.

Definition at line 352 of file vs10xx.h.

#define VS_CF_DOUBLER   0x8000

Clock doubler enable.

Used for the VS1001, VS1011 and VS1002.

Definition at line 357 of file vs10xx.h.

#define VS_DECODE_TIME_REG   4

Register index.

This read-only register contains the decode time in full seconds or zero after resetting the decoder.

Definition at line 370 of file vs10xx.h.

#define VS_AUDATA_REG   5

Register index.

Usage on the VS1001K differs.

Definition at line 382 of file vs10xx.h.

#define VS_AD_STEREO   0x0001

Stereo flag.

Set to 1 for stereo and 0 for mono. Read-only.

Definition at line 387 of file vs10xx.h.

#define VS_AD_SRATE   0xFFFE

Current sampling rate mask.

Value is sample rate divided by 2. Writing to this register will change the sample rate on the run.

Definition at line 393 of file vs10xx.h.

#define VS_AD_SRATE_LSB   1

Crystal clock LSB.

Definition at line 395 of file vs10xx.h.

#define VS_WRAM_REG   6

Register index.

Used to upload application programs and data to instruction and data RAM.

Definition at line 407 of file vs10xx.h.

#define VS_WRAMADDR_REG   7

Register index.

Used to upload application programs and data to instruction and data RAM.

Definition at line 419 of file vs10xx.h.

#define VS_HDAT0_REG   8

Register index.

Not available in the VS1103.

Definition at line 431 of file vs10xx.h.

#define VS_IN0_REG   8

Register index.

Definition at line 440 of file vs10xx.h.

#define VS_HDAT1_REG   9

Register index.

Not available in the VS1103.

Definition at line 452 of file vs10xx.h.

#define VS_IN1_REG   9

Register index.

Definition at line 461 of file vs10xx.h.

#define VS_AIADDR_REG   10

Register index.

Definition at line 472 of file vs10xx.h.

Referenced by FeederThread().

#define VS_VOL_REG   11

Register index.

Definition at line 481 of file vs10xx.h.

#define VS_VOL_RIGHT   0x00FF

Right channel volume mask.

Attenuation is given in 0.5 dB steps or 255 for mute.

Definition at line 486 of file vs10xx.h.

#define VS_VOL_RIGHT_LSB   0

Right channel volume LSB.

Definition at line 488 of file vs10xx.h.

Referenced by FeederThread(), VsDecoderSetVolume(), and VsSetVolume().

#define VS_VOL_LEFT   0xFF00

Right channel volume mask.

Attenuation is given in 0.5 dB steps or 255 for mute.

Definition at line 493 of file vs10xx.h.

#define VS_VOL_LEFT_LSB   8

Right channel volume LSB.

Definition at line 495 of file vs10xx.h.

Referenced by FeederThread(), VsDecoderSetVolume(), and VsSetVolume().

#define VS_MIXERVOL_REG   12

Register index.

Definition at line 506 of file vs10xx.h.

#define VS_SMV_GAIN1   0x001F

Definition at line 507 of file vs10xx.h.

#define VS_SMV_GAIN2   0x03E0

Definition at line 508 of file vs10xx.h.

#define VS_SMV_GAIN3   0x7C00

Definition at line 509 of file vs10xx.h.

#define VS_SMV_ACTIVE   0x8000

Definition at line 510 of file vs10xx.h.

#define VS_ADPCMRECCTL_REG   13

Register index.

Definition at line 521 of file vs10xx.h.

#define VS_SARC_GAIN4   0x003F

Definition at line 522 of file vs10xx.h.

#define VS_SARC_MANUALGAIN   0x0040

Definition at line 523 of file vs10xx.h.

#define VS_SARC_OUTOFADPCM   0x0080

Definition at line 524 of file vs10xx.h.

#define VS_AICTRL0_REG   12

Application register 0 index.

Do not use with VS1001. Also used for mixer volume on the VS1103.

Definition at line 536 of file vs10xx.h.

#define VS_AICTRL_REG   13

VS1001K application register 0 index.

A second register is available at VS_AICTRL0_REG + 1.

Definition at line 541 of file vs10xx.h.

#define VS_AICTRL1_REG   13

Application register 1 index.

Register 0 on the VS1001. Also used for IMA ADPCM record control in the VS1103.

Definition at line 547 of file vs10xx.h.

#define VS_AICTRL2_REG   14

Application register 2 index.

Register 1 on the VS1001.

Definition at line 552 of file vs10xx.h.

#define VS_AICTRL3_REG   15

Application register 3 index.

Do not use with VS1001.

Definition at line 557 of file vs10xx.h.

#define VS_FLUSH_BYTES   2048

Definition at line 564 of file vs10xx.h.

#define VS_STATUS_STOPPED   0

Definition at line 569 of file vs10xx.h.

#define VS_STATUS_RUNNING   1

Definition at line 570 of file vs10xx.h.

#define VS_STATUS_EOF   2

Definition at line 571 of file vs10xx.h.

#define VS_STATUS_EMPTY   4

Definition at line 572 of file vs10xx.h.

#define AUDIO_VS1001K

Definition at line 91 of file vs10xx.c.

#define VS10XX_FREQ   12288000UL

Decoder crystal frequency.

Definition at line 96 of file vs10xx.c.

#define VS10XX_HWRST_DURATION   1

Minimum time in milliseconds to held hardware reset low.

Definition at line 101 of file vs10xx.c.

#define VS10XX_HWRST_RECOVER   10

Milliseconds to wait after hardware reset.

Definition at line 106 of file vs10xx.c.

#define VS10XX_SWRST_RECOVER   VS10XX_HWRST_RECOVER

Milliseconds to wait after software reset.

Definition at line 111 of file vs10xx.c.

#define VS10XX_SCI_MODE   0

Definition at line 115 of file vs10xx.c.

#define VS10XX_SCI_RATE   (VS10XX_FREQ / 4)

Definition at line 119 of file vs10xx.c.

#define VS10XX_SDI_MODE   0

Definition at line 123 of file vs10xx.c.

#define VS10XX_SDI_RATE   (VS10XX_FREQ / 4)

Definition at line 127 of file vs10xx.c.

#define SciReset (   act)

Definition at line 227 of file vs10xx.c.

#define SciSetMode ( )    (-1)

Definition at line 228 of file vs10xx.c.

#define SciSetSpeed ( )

Definition at line 229 of file vs10xx.c.

#define SciSelect (   void)

Definition at line 230 of file vs10xx.c.

#define SciDeselect (   void)

Definition at line 231 of file vs10xx.c.

#define SciByte (   b)    0

Definition at line 232 of file vs10xx.c.

#define SdiSetMode ( )    (-1)

Definition at line 309 of file vs10xx.c.

#define SdiSetSpeed ( )

Definition at line 310 of file vs10xx.c.

#define SdiSelect ( )

Definition at line 311 of file vs10xx.c.

Referenced by VsPlayerThrottle().

#define SdiDeselect ( )

Definition at line 312 of file vs10xx.c.

Referenced by VsPlayerThrottle().

#define SdiByte (   b)    0

Definition at line 313 of file vs10xx.c.


Function Documentation

int VsPlayerInit ( void  )

Initialize the VS10XX hardware interface.

Returns:
0 on success, -1 otherwise.
int VsPlayerReset ( uint16_t  mode)

Software reset the decoder.

This function is typically called after VsPlayerInit() and at the end of each track.

Parameters:
modeAny of the following flags may be or'ed (check the data sheet)
Returns:
0 on success, -1 otherwise.
int VsPlayerSetMode ( uint16_t  mode)

Set mode register of the decoder.

Parameters:
modeAny of the following flags may be or'ed (check the data sheet)
Returns:
Always 0.
int VsPlayerKick ( void  )

Start playback.

This routine will send the first MP3 data bytes to the decoder, until it is completely filled. The data buffer should have been filled before calling this routine.

Decoder interrupts will be enabled.

Returns:
0 on success, -1 otherwise.
int VsPlayerStop ( void  )

Stops the playback.

This routine will stops the MP3 playback, VsPlayerKick() may be used to resume the playback.

Returns:
0 on success, -1 otherwise.
int VsPlayerFlush ( void  )

Sets up decoder internal buffer flushing.

This routine will set up internal VS buffer flushing, unless the buffer is already empty and starts the playback if necessary. The internal VS buffer is flushed in VsPlayerFeed() at the end of the stream.

Decoder interrupts will be enabled.

Returns:
0 on success, -1 otherwise.
ureg_t VsPlayerInterrupts ( ureg_t  enable)

Enable or disable player interrupts.

This routine is typically used by applications when dealing with unprotected buffers.

Parameters:
enableDisables interrupts when zero. Otherwise interrupts are enabled.
Returns:
Zero if interrupts were disabled before this call.

Definition at line 791 of file vs10xx.c.

References NutIrqDisable(), and NutIrqEnable().

Here is the call graph for this function:

ureg_t VsPlayerThrottle ( ureg_t  on)

Throttle decoder activity.

When sharing SPI with other devices, this function should be called to disable (and re-enable) the SPI interface of the VS10XX.

Decoder interrupts must have been disabled before calling this function.

 #include <dev/vs10xx.h>

 ureg_t ief = VsPlayerInterrupts(0);
 ureg_t tef = VsPlayerThrottle(1);
 ... use other SPI devices here ...
 VsPlayerThrottle(tef);
 VsPlayerInterrupts(ief);
Parameters:
onThrottles (disables) the decoder interface if not zero. Otherwise the decoder interface is enabled again.
Returns:
Zero if the interface was enabled before this call.

Definition at line 833 of file vs10xx.c.

References SdiDeselect, and SdiSelect.

uint16_t VsPlayTime ( void  )

Returns play time since last reset.

Returns:
Play time since reset in seconds
unsigned int VsGetStatus ( void  )

Returns status of the player.

Returns:
Any of the following value:
  • VS_STATUS_STOPPED Player is ready to be started by VsPlayerKick().
  • VS_STATUS_RUNNING Player is running.
  • VS_STATUS_EOF Player has reached the end of a stream after VsPlayerFlush() has been called.
  • VS_STATUS_EMPTY Player runs out of data. VsPlayerKick() will restart it.
int VsGetHeaderInfo ( VS_HEADERINFO vshi)

Query MP3 stream header information.

Parameters:
vshiPointer to VS_HEADERINFO structure.
Returns:
0 on success, -1 otherwise.
uint16_t VsMemoryTest ( void  )

Initialize decoder memory test and return result.

Returns:
Memory test result.
  • Bit 0: Good X ROM
  • Bit 1: Good Y ROM (high)
  • Bit 2: Good Y ROM (low)
  • Bit 3: Good Y RAM
  • Bit 4: Good X RAM
  • Bit 5: Good Instruction RAM (high)
  • Bit 6: Good Instruction RAM (low)
int VsSetVolume ( ureg_t  left,
ureg_t  right 
)

Set volume.

Parameters:
leftLeft channel attenuation, provided in 0.5 dB steps. Set to 255 for ananlog power down.
rightRight channel attenuation.
Returns:
Always 0.

Definition at line 1424 of file vs10xx.c.

References VS_VOL_LEFT_LSB, VS_VOL_REG, VS_VOL_RIGHT_LSB, and VsPlayerInterrupts().

Here is the call graph for this function:

int VsBeep ( uint8_t  fsin,
uint8_t  ms 
)

Sine wave beep.

Parameters:
fsinFrequency.
msDuration.
Returns:
Always 0.