⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 target.h

📁 Read MP3 from sd,send vs1003 decode
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzou ZLG-MCU Development Co.,LTD.
**                                      graduate school
**                                 http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: 			target.h
** Last modified Date:  2004-09-17
** Last Version: 		1.0
** Descriptions: 		header file of the specific codes for LPC2200 target boards
**				Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Created by: 			Chenmingji
** Created date:   		2004-02-02
** Version:				1.0
** Descriptions: 		The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: 		Chenmingji
** Modified date:		2004-09-17
** Version:				1.01
** Descriptions: 		Renewed the template, added codes to surport more compilers 
**
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version:	
** Descriptions: 
**
********************************************************************************************************/
#ifndef __TARGET_H 
#define __TARGET_H

    #ifdef __cplusplus
    extern "C" {
    #endif


    #ifndef IN_TARGET 

extern void Reset(void);
/*********************************************************************************************************
** Function name:			Reset
** Descriptions:			resets the target board.
** input parameters:		None
**
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/

extern void TargetInit(void);
/*********************************************************************************************************
** Function name:			TargetInit
**
** Descriptions:			Initialize the target board; it is called in a necessary place, change it as 
**							needed
**
** input parameters:		None
** Returned value:			None
**         
** Used global variables:	None
** Calling modules:			None
**
** Created by:				Chenmingji
** Created Date:			2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
    #endif

    #ifdef __cplusplus
    }
    #endif

 /* SPI macros */
 
 #define LPC2210SPI_CLK(Spccr_data)	{S0PCCR = Spccr_data;}  /* 0x73 is much slower*/
  
 #define SPIWait()							{while(!(S0PSR & 0x80));;}
 
 #define SPIPutChar( byte )					{SPIWait(); S0PDR = (byte);}
 
 #define SPIPutCharWithoutWaiting(byte)		{S0PDR = (byte);}
 
 #define SPI_RESULT_BYTE 					S0PDR


#define SPI_CLOCK				5529600		/* 正常通信时,SPI时钟频率 frequency (Hz) */

/* 
	LPC22xx_EN 硬件配置 
	Using SPI0 to communication with SPI of VS1003
	LPC2294			VS1003
	P0.4:SCK	  ---->	SCLK
	P0.5:MISO  ---->	MOSI
	P0.6:MOSI  ---->	MISO

	P0.23:OUT  ---->	XCS
*/
 
/* SCK引脚 */
#define  SPI_SCK					(0x01 << 4)						
#define  SPI_SCK_GPIO()			PINSEL0 &= ~(0x02 << 8)			/* 设置 SCK 口为GPIO口 */
#define  SPI_SCK_OUT()			IO0DIR |= SPI_SCK				/* 设置 SCK 口为输出口 */
#define	 SPI_SCK_CLR()			IO0CLR = SPI_SCK				/* 置 SCK 为低电平 */	

/* MISO 引脚 */	
#define  SPI_MISO					(0x01 << 5)						
#define  SPI_MISO_GPIO()			PINSEL0 &= ~(0x02 << 10)		/* 设置 MISO 口为GPIO口 */
#define  SPI_MISO_OUT()			IO0DIR |= SPI_MISO				/* 设置 MISO 口为输出口 */
#define	 SPI_MISO_CLR()			IO0CLR = SPI_MISO				/* 置 MISO 为低电平 */

/* MOSI 引脚 */	
#define  	SPI_MOSI					(0x01 << 6)
#define  	SPI_MOSI_GPIO()			PINSEL0 &= ~(0x02 << 12)		/* 设置 MOSI 口为GPIO口 */
#define  	SPI_MOSI_OUT()			IO0DIR |= SPI_MOSI				/* 设置 MOSI 口为输出口 */
#define	SPI_MOSI_CLR()			IO0CLR = SPI_MOSI				/* 置 MISO 为低电平 */

/* CS 引脚 */		
#define  	MP3_XCS      				(0x01 << 23)              	 	
#define  	MP3_XCS_GPIO()			PINSEL1 &= ~(0x03 << 14)		 	/* 设置 CS 口为GPIO口 */
#define  	MP3_XCS_OUT()			IO0DIR |= MP3_XCS;			 	/* 设置 CS 口为输出口 */
#define		MP3_XCS_HIGH()		IO0SET |= MP3_XCS;				/* 置 CS 为高电平 */
#define		MP3_XCS_LOW()			IO0CLR |= MP3_XCS;				/* 置 CS 为低电平 */

/* 初始化 IO 口为SPI接口 */
#define  	SPI_INIT()					PINSEL0 &= ~((0x03 << 8) + (0x03 << 10) + (0x03 << 12) + (0x03 << 14)); \
								PINSEL0 |= (0x01 << 8) + (0x01 << 10) + (0x01 << 12) + (0x01 << 14);
/*
****************************************************************** 
*	Using P0.17,P0.18,P0.19,P0.29 to control VS1003
*	LPC2294		  VS1003
*	P0.24  	 --->  XRESET
*	P0.25  	 --->  XDCS
*	P0.29  	<---  DREQ
*
*	MP3_CMD_CS     	XCS
*	MP3_DATA_REST  	XRESET
* 	MP3_DATA_CS    	XDCS
*	MP3_DATA_REQ   	DREQ  
*******************************************************************
*/

#define  MP3_DATA_REST				(0x01 << 24)		
#define  MP3_DATA_REST_GPIO()		PINSEL1 &= ~(0x03 << 16)			/* 设置 INSERT 口为GPIO口 */	
#define  MP3_DATA_REST_OUT()			IO0DIR |= MP3_DATA_REST			/* 设置 INSERT 口为输出口 */	
#define  MP3_DATA_REST_HIGH()		IO0SET |= MP3_DATA_REST				/* 置 POWER 为高电平 */
#define  MP3_DATA_REST_LOW()			IO0CLR |= MP3_DATA_REST			/* 读取 INSERT 口的状态 */



#define  MP3_DATA_CS					(0x01 << 25)	
#define  MP3_DATA_CS_GPIO()			PINSEL1 &= ~(0x03 << 18)			/* 设置 POWER 口为GPIO口 */
#define  MP3_DATA_CS_OUT()			IO0DIR |= MP3_DATA_CS				/* 设置 POWER 口为输出口 */
#define  MP3_DATA_CS_HIGH()			IO0SET |= MP3_DATA_CS				/* 置 POWER 为高电平 */
#define  MP3_DATA_CS_LOW()			IO0CLR |= MP3_DATA_CS				/* 置 POWER 为低电平 */

#define  MP3_DATA_REQ				(0x01 << 29)		
#define  MP3_DATA_REQ_GPIO()			PINSEL1 &= ~(0x03 << 26)		/* 设置 WP 口为GPIO口 */	
#define  MP3_DATA_REQ_IN()			IO0DIR &= ~MP3_DATA_REQ				/* 设置 WP 口为输出口 */	
#define  MP3_DATA_REQ_STATUS()  		(IO0PIN & MP3_DATA_REQ)	

#define   LEDCON    0xf0000000
#define   LEDON	0x5fffffff
#define   LEDOFF	0xAfffffff

#define Mp3SelectControl()		MP3_XCS_LOW()
#define Mp3DeselectControl()		MP3_XCS_HIGH()

#define Mp3SelectData()			MP3_DATA_CS_LOW()
#define Mp3DeselectData()		MP3_DATA_CS_HIGH()

#define Mp3PutInReset()		MP3_DATA_REST_LOW()
#define Mp3ReleaseFromReset()	MP3_DATA_REST_HIGH()


extern unsigned char SPIGetChar(void);
 
extern void SPI8Clocks(unsigned char nClocks);
extern void LEDStatu(unsigned long Data);


	
#endif
/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -