📄 myfution.h
字号:
/**************************************************************
* ARMSYS-P, LiYuTai elec.
*
* .h file for mmc functions
************************************************************/
// #include "../Target/44b.h"
// #include "../Target/44blib.h"
#include "..\inc\44b.h"
#include "..\inc\option.h"
#include "..\inc\def.h"
#include "..\inc\config.h"
#include "..\inc\board.h"
#include "..\inc\shell.h"
/**************************
* mmc functions
*************************/
void myfution(void);
/**************************
* vs1003相关宏定义
*************************/
#ifndef VS10XX_H
#define VS10XX_H
#define VS_WRITE_COMMAND 0x02
#define VS_READ_COMMAND 0x03
#define SPI_MODE 0x0
#define SPI_STATUS 0x1
#define SPI_BASS 0x2
#define SPI_CLOCKF 0x3
#define SPI_DECODE_TIME 0x4
#define SPI_AUDATA 0x5
#define SPI_WRAM 0x6
#define SPI_WRAMADDR 0x7
#define SPI_HDAT0 0x8
#define SPI_HDAT1 0x9
#define SPI_AIADDR 0xa
#define SPI_VOL 0xb
#define SPI_AICTRL0 0xc
#define SPI_AICTRL1 0xd
#define SPI_AICTRL2 0xe
#define SPI_AICTRL3 0xf
#define SM_DIFF 0x01
#define SM_JUMP 0x02
#define SM_RESET 0x04
#define SM_OUTOFWAV 0x08
#define SM_PDOWN 0x10
#define SM_TESTS 0x20
#define SM_STREAM 0x40
#define SM_PLUSV 0x80
#define SM_DACT 0x100
#define SM_SDIORD 0x200
#define SM_SDISHARE 0x400
#define SM_SDINEW 0x800
#define SM_ADPCM 0x1000
#define SM_ADPCM_HP 0x2000
//44B0X与vs1003的接口定义
/*
I/O NAME
PD0 /xCS 输出 01
PD1 /xDCS 输出 01
PD2 SCLK 输出 01
PD3 SO 输入 00
PD4 SI 输出 01
PD5 DREQ 输入 00
PD6 /xRESET 输出 01
*/
#define MP3_XCS_H { rPDATD |= 0X01;}
#define MP3_XCS_L { rPDATD &= ~0X01;}
#define MP3_XDCS_H { rPDATD |= 0X02;}
#define MP3_XDCS_L { rPDATD &= ~0X02;}
#define MP3_SCLK_H { rPDATD |= 0X04;}
#define MP3_SCLK_L { rPDATD &= ~0X04;}
#define MP3_SI_H { rPDATD |= 0X10;}
#define MP3_SI_L { rPDATD &= ~0X10;}
#define MP3_XRESET_H { rPDATD |= 0X40;}
#define MP3_XRESET_L { rPDATD &= ~0X40;}
#define MP3_SO_IN (rPDATD & 0X08)
#define MP3_DREQ_IN (rPDATD & 0X20)
#define MP3_XRESET ( 1 << 6 )
//#define Mp3PutInReset() { IOCLR = MP3_XRESET; }
#define Mp3PutInReset() { rPDATD &= ~MP3_XRESET;}
//#define Mp3ReleaseFromReset() { IOSET = MP3_XRESET; }
#define Mp3ReleaseFromReset() { rPDATD |= MP3_XRESET; }
#define MP3_XCS 1
//#define Mp3SelectControl() { IOCLR = MP3_XCS; }
#define Mp3SelectControl() { rPDATD &= ~MP3_XCS; }
//#define Mp3DeselectControl() { IOSET = MP3_XCS; }
#define Mp3DeselectControl() { rPDATD |= MP3_XCS; }
#define MP3_XDCS ( 1 << 1 )
//#define Mp3SelectData() { IOCLR = MP3_XDCS; }
#define Mp3SelectData() { rPDATD &= ~MP3_XDCS; }
//#define Mp3DeselectData() { IOSET = MP3_XDCS; }
#define Mp3DeselectData() { rPDATD |= MP3_XDCS; }
#define MP3_DREQ ( 1 << 5 )
#define Mp3SetVolume(leftchannel,rightchannel) {Mp3WriteRegister(11,(leftchannel),(rightchannel));}//音量设置
void SoftDelay100ns(int ns); //100ns软件延时
void InitPortVS1003(void);//LPC213x与vs1003的接口的初始化
void SPIPutChar(unsigned char c);//通过SPI发送一个字节的数据
unsigned short SPIReadChar(void);
void Mp3SoftReset(void);//vs1003的软件复位
void Mp3Reset(void);//vs1003的硬件复位
void VsSineTest(void);//vs1003的正弦测试
void Mp3WriteRegister(unsigned char addressbyte,unsigned char highbyte,unsigned char lowbyte);//写vs1003寄存器
unsigned short Mp3ReadRegister(unsigned char addressbyte);//读vs1003寄存器
void Mp3Play(void);
void PlayMucsic(void);
void test_1011(void);
//int NandLoadMusic(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -