📄 vs10xx.h
字号:
/********************************************************************************************************
* 文 件 名 : VX10xx.h
* 程 序 员 : (CaiJie) hnclcj@gmail.com
* (c) Copyright 2007-2007, CaiJie
* All Rights Reserved
* 创建日期 :
* 说 明 :
* 修改日期 :
* 修改版本 :
* 说 明 :
********************************************************************************************************/
#ifdef VS_GLOBLAS
#define VS_EXT
#else
#define VS_EXT extern
#endif
/********************************************************************************************************
* End Of File
********************************************************************************************************/
#define VS_MODULE_EN 1 // VS驱动函数库
#if VS_MODULE_EN > 0
// --------------- Instruction opcodes ----------------
#define VS_OPCODE_READ 3 //
#define VS_OPCODE_WRITE 2 //
// --------------- Decoder registers ------------------
#define VS_MODE_REG 0x00 // 模式
#define VS_STATUS_REG 0x01 // 状态
#define VS_BASS_REG 0x02 // BASS
#define VS_CLOCKF_REG 0x03 // 时钟
#define VS_DECODE_TIME_REG 0x04 // 解码
#define VS_AUDATA_REG 0x05 //
#define VS_WRAM_REG 0x06 //
#define VS_WRAMADDR_REG 0x07 //
#define VS_HDAT0_REG 0x08 //
#define VS_HDAT1_REG 0x09 //
#define VS_A1ADDR_REG 0x0a //
#define VS_VOL_REG 0x0b // 音量
#define VS_A1CTRL_REG 0x0c //
// --------------- Mode register bits -----------------
#define VS_SM_DIFF 0x0001 //
#define VS_SM_FFWD 0x0002 //
#define VS_SM_RESET 0x0004 //
#define VS_SM_MP12 0x0008 //
#define VS_SM_PDOWN 0x0010 //
#define VS_SM_DAC 0x0020 //
#define VS_SM_DACMONO 0x0040 //
#define VS_SM_BASS 0x0080 //
#define VS_SM_DACT 0x0100 //
#define VS_SM_BYTEORD 0x0200 //
#define VS_SM_IBMODE 0x0400 //
#define VS_SM_IBCLK 0x0800 //
// --------------- Clock register bits ----------------
#define VS_CF_DOUBLER 0x8000 //
// Bytes needed to flush internal VS buffer (size of VS interbal buffer)
#define VS_FLUSH_BYTES 2048 //
// -------------- Status of the decoder ---------------
#define VS_STATUS_STOPPED 0 //
#define VS_STATUS_RUNNING 1 //
#define VS_STATUS_EOF 2 //
#define VS_STATUS_EMPTY 4 //
#define VS_TREMBLE_VALUE 8 // 0~15, 8 means off
#define VS_TREMBLE_LOW_FS 8 // 0~15, 0Hz-15KHz, lower frequency of tremble enhancement
#define VS_BASS_VALUE 0 // 0~15, 0 means off
#define VS_BASS_HIGH_FS 8 // 2~15, up limit frequency of bass enhancement
#define VS_DEFAULT_BASS_TREMBLE ((VS_TREMBLE_VALUE<<12)|(VS_TREMBLE_LOW_FS<<8)|(VS_BASS_VALUE<<4)|(VS_BASS_HIGH_FS))
#define VS_DEFAULT_VOLUME 0x2828 // default volumn
//#define VS_CLOCK_REG 0xe000 // XTALI*4.5, 12.288*4.5 = 55.296, a bit higher than the maxmum frequency
#define VS_CLOCK_REG 0xc000 // 0xc00 is fow VS1003 or higher version
//#define VS_CLOCK_REG 0x9800 // 0x9800 is for VS1011 VS1002
#endif
/********************************************************************************************************
* IO
********************************************************************************************************/
#if VS_MODULE_EN > 0
#define VS_DREQ_DDR IO0DIR
#define VS_DREQ_PORT_HIGH IO0SET
#define VS_DREQ_PORT_LOW IO0CLR
#define VS_DREQ_PIN IO0PIN
#define VS_DREQ 15 //INT2
#define VS_RST_DDR IO0DIR
#define VS_RST_PORT_HIGH IO0SET
#define VS_RST_PORT_LOW IO0CLR
#define VS_RST_PIN IO0PIN
#define VS_RST 21
#define VS_XCS_DDR IO0DIR
#define VS_XCS_PORT_HIGH IO0SET
#define VS_XCS_PORT_LOW IO0CLR
#define VS_XCS_PIN IO0PIN
#define VS_XCS 22
#define VS_XDCS_DDR IO0DIR
#define VS_XDCS_PORT_HIGH IO0SET
#define VS_XDCS_PORT_LOW IO0CLR
#define VS_XDCS_PIN IO0PIN
#define VS_XDCS 23
/*******************************************************************************************************/
#define VS_DREQ_HIGH() SETBIT(VS_DREQ_PORT_HIGH, VS_DREQ)
#define VS_DREQ_LOW() SETBIT(VS_DREQ_PORT_LOW, VS_DREQ)
#define VS_RST_HIGH() SETBIT(VS_RST_PORT_HIGH, VS_RST)
#define VS_RST_LOW() SETBIT(VS_RST_PORT_LOW, VS_RST)
#define VS_XCS_HIGH() SETBIT(VS_XCS_PORT_HIGH, VS_XCS)
#define VS_XCS_LOW() SETBIT(VS_XCS_PORT_LOW, VS_XCS)
#define VS_XDCS_HIGH() SETBIT(VS_XDCS_PORT_HIGH, VS_XDCS)
#define VS_XDCS_LOW() SETBIT(VS_XDCS_PORT_LOW, VS_XDCS)
#endif
/********************************************************************************************************
* 结构及变量
********************************************************************************************************/
#if VS_MODULE_EN > 0
typedef struct { // Header info filled by VsGetHeaderInfo.
INT16U vshi_no_crc :1;
INT16U vshi_layer :2;
INT16U vshi_id :2;
INT16U vshi_syncword :11;
INT16U vshi_emphasis :2;
INT16U vshi_original :1;
INT16U vshi_copyright :1;
INT16U vshi_extension :2;
INT16U vshi_mode :2;
INT16U vshi_private_bit :1;
INT16U vshi_pad_bit :1;
INT16U vshi_sample_rate :2;
INT16U vshi_bitrate :4;
} VS_HEADERINFO;
#endif
/********************************************************************************************************
* 功能函数
********************************************************************************************************/
#if VS_MODULE_EN > 0
BOOL VSInit (void);
void VSDataNWr (INT8U *pDatBuf, INT8U len);
BOOL VSDataReqCheck (void);
INT16U VSDecTimeRd (void);
void VSDecTimeSet (INT8U hour, INT8U min, INT8U sec);
void VSFillZero (void);
void VSSetVol (INT8U lvol, INT8U rvol);
void VSSoftRst (void);
#endif
/********************************************************************************************************
* End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -