-
Notifications
You must be signed in to change notification settings - Fork 1
/
vs10xx.h
110 lines (84 loc) · 3.81 KB
/
vs10xx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// file vs10xx.h
// Headers for interfacing with the mp3 player chip.
//
// For more details about the product please check http://www.seeedstudio.com/depot/
// Copyright (c) 2010 seeed technology inc.
// Author: Icing Chang
// Version: 1.0
// Time: Oct 21, 2010
// Changing records:
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef VS10XX_H
#define VS10XX_H
#include "config.h"
/** VS10xx SCI Write Command byte is 0x02 */
#define VS_WRITE_COMMAND 0x02
/** VS10xx SCI Read Command byte is 0x03 */
#define VS_READ_COMMAND 0x03
#define SPI_MODE 0x0 /**< VS10xx register */
#define SPI_STATUS 0x1 /**< VS10xx register */
#define SPI_BASS 0x2 /**< VS10xx register */
#define SPI_CLOCKF 0x3 /**< VS10xx register */
#define SPI_DECODE_TIME 0x4 /**< VS10xx register */
#define SPI_AUDATA 0x5 /**< VS10xx register */
#define SPI_WRAM 0x6 /**< VS10xx register */
#define SPI_WRAMADDR 0x7 /**< VS10xx register */
#define SPI_HDAT0 0x8 /**< VS10xx register */
#define SPI_HDAT1 0x9 /**< VS10xx register */
#define SPI_AIADDR 0xa /**< VS10xx register */
#define SPI_VOL 0xb /**< VS10xx register */
#define SPI_AICTRL0 0xc /**< VS10xx register */
#define SPI_AICTRL1 0xd /**< VS10xx register */
#define SPI_AICTRL2 0xe /**< VS10xx register */
#define SPI_AICTRL3 0xf /**< VS10xx register */
#define SM_DIFF 0x01 /**< VS10xx register */
#define SM_JUMP 0x02 /**< VS10xx register */
#define SM_RESET 0x04 /**< VS10xx register */
#define SM_OUTOFWAV 0x08 /**< VS10xx register */
#define SM_PDOWN 0x10 /**< VS10xx register */
#define SM_TESTS 0x20 /**< VS10xx register */
#define SM_STREAM 0x40 /**< VS10xx register */
#define SM_PLUSV 0x80 /**< VS10xx register */
#define SM_DACT 0x100 /**< VS10xx register */
#define SM_SDIORD 0x200 /**< VS10xx register */
#define SM_SDISHARE 0x400 /**< VS10xx register */
#define SM_SDINEW 0x800 /**< VS10xx register */
#define SM_ADPCM 0x1000 /**< VS10xx register */
#define SM_ADPCM_HP 0x2000 /**< VS10xx register */
void TestVsRegister();
/** Execute VS1011/VS1002 Sine Test Function */
void VsSineTest();
void Mp3Reset();
/** Soft Reset of VS10xx (Between songs) */
void Mp3SoftReset();
void Mp3WriteRegister(unsigned char addressbyte,unsigned char highbyte,unsigned char lowbyte);
void Mp3WriteRegisterWithDelay(unsigned char addressbyte,unsigned char highbyte,unsigned char lowbyte);
void Mp3WriteRegisterWithDelay(unsigned char addressbyte,unsigned char highbyte,unsigned char lowbyte,int delayMicroSec);
/** Set VS10xx Volume Register */
#define Mp3SetVolume(leftchannel,rightchannel){\
Mp3WriteRegister(11,(leftchannel),(rightchannel));}
/** Read the 16-bit value of a VS10xx register */
unsigned int Mp3ReadRegister (unsigned char addressbyte);
/** Send 2048 zeros. \todo Timeouts for all DREQ busy loop waits! */
void SendZerosToVS10xx();
/** Play disk sectors from disk */
unsigned char PlayDiskSectors (unsigned int nSectorsToPlay);
/** This is called when there is free processor time, implement externally. */
void AvailableProcessorTime();
/** Soft reset without loading patch */
void Mp3SoftResetWithoutPatch();
void Mp3PowerOff();
#endif