English
Language : 

VS1033 Datasheet, PDF (44/70 Pages) List of Unclassifed Manufacturers – MP3/AAC/WMA/MIDI AUDIO CODEC
VLSI
Solution y
VS1033a PRELIMINARY
VS1033A
9. OPERATION
void RecordAdpcm1003(void) { /* VS1003b/VS1023 */
u_int16 w = 0, idx = 0;
... /* Check and locate free space on disk */
SetMp3Vol(0x1414);
WriteMp3SpiReg(SCI_BASS,
/* Recording monitor volume */
0); /* Bass/treble disabled */
WriteMp3SpiReg(SCI_CLOCKF, 0x4430); /* 2.0x 12.288MHz */
Wait(100);
WriteMp3SpiReg(SCI_AICTRL0, 12); /* Div -> 12=8kHz 8=12kHz 6=16kHz */
Wait(100);
WriteMp3SpiReg(SCI_AICTRL1, 0);
/* Auto gain */
Wait(100);
if (line_in) {
WriteMp3SpiReg(SCI_MODE, 0x5804); /* Normal SW reset + other bits */
} else {
WriteMp3SpiReg(SCI_MODE, 0x1804); /* Normal SW reset + other bits */
}
for (idx=0; idx < sizeof(header); idx++) { /* Save header first */
db[idx] = header[idx];
}
/* Fix rate if needed */
/*db[24] = rate;*/
/*db[25] = rate>>8;*/
/* Record loop */
while (recording_on) {
do {
w = ReadMp3SpiReg(SCI_HDAT1);
} while (w < 256 || w > 896);
while (idx < 512) {
w = ReadMp3SpiReg(SCI_HDAT0);
/* Resynchronize if IMA sync is lost */
while ((idx & 255) == sizeof(header)+2 && (w & 0xFF)) {
do {
w = ReadMp3SpiReg(SCI_HDAT1);
} while (w < 256);
w = ReadMp3SpiReg(SCI_HDAT0);
}
db[idx++] = w>>8;
db[idx++] = w&0xFF;
}
idx = 0;
write_block(datasector++, db); /* Write output block to disk */
}
... /* Fix WAV header information */
... /* Then update FAT information */
ResetMP3();
/* Normal reset, restore default settings */
SetMp3Vol(vol);
}
Version 0.6, 2005-01-05
44