PRELIMINARY
VS1063a Prog. Guide
5
WRITING PLUGINS
5.2.1
Loading and Activating the Plugin
Loading a plugin is initiated by writing a base address to register SCI_WRAMADDR. The pro-
gram and its data is then loaded by writing data to register SCI_WRAM.
The plugin is activated by writing its start address to register SCI_AIADDR. Whenever a power-
down, hardware reset or software reset has happened, the plugin needs to be reloaded and
restarted. The reason for this is that whenever VS1063a is reset, it will clear all its data areas
so the plugin will not be intact anymore.
Note: SCI_AIADDR will not be cleared when a software reset has been performed, but you still
need to reload and reactivate the plugin.
5.2.2
Audio Path Plugin Call Conventions
The C prototype for the user plugin is as follows:
s_int16 Plugin(register s_int16 __i0 **data, register u_int16 __a1 mode, register
u_int16 __a0 n);
Legal values for
mode
are described in the following table. The user may choose how many of
the different cases are handled. All unhandled values for
mode
should return
n
.
Symbol
Value
Description
APPL_RESET
0
Reset all values, n is samplerate
APPL_AUDIO
1
Audio samples offered, n is number of L/R sample pairs
APPL_W0
2
SCI_AICTRL0 has been written to, n is register value
APPL_W1
3
SCI_AICTRL1 has been written to, n is register value
APPL_W2
4
SCI_AICTRL2 has been written to, n is register value
APPL_W3
5
SCI_AICTRL3 has been written to, n is register value
APPL_R0
6
SCI_AICTRL0 has been read from, n is register value
APPL_R1
7
SCI_AICTRL1 has been read from, n is register value
APPL_R2
8
SCI_AICTRL2 has been read from, n is register value
APPL_R3
9
SCI_AICTRL3 has been read from, n is register value
APPL_BITSTREAM
10
Obsolete, ignore
APPL_OUT_OF_DATA
11
Stream input buffer has starved
Note: It is guaranteed that the first call to the user plugin is always with
mode
= APPL_RESET.
Note: When
mode
= APPL_RESET, the user function should return its output samplerate if it is
different from the input samplerate. Otherwise, the user function may return 0.
Note: When returning from APPL_AUDIO, the user function should return the number of sam-
ples it created in the function. If the number of samples did not change, returning 0 is also
Version: 0.40, 2011-09-02
12