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

📄 target.c

📁 Read MP3 from sd,send vs1003 decode
💻 C
字号:
/****************************************Copyright (c)**************************************************
**
**                                 http://www.dinchen.com.tw
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			target.c
** 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
********************************************************************************************************/

#define IN_TARGET
#include "config.h"

/*********************************************************************************************************
** Function name:			IRQ_Exception
**
** Descriptions:			interrupt exceptional handler , 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:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void __irq IRQ_Exception(void)
{
    while(1);                   //  change it to your code 这一句替换为自己的代码
}

/*********************************************************************************************************
** Function name:			FIQ_Exception
**
** Descriptions:			Fast interrupt exceptional handler , 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:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void FIQ_Exception(void)
{
    while(1);                   // change it to your code  这一句替换为自己的代码
}

/*********************************************************************************************************
** 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:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
       void TargetInit(void)
{
    /* 添加自己的代码 */
    /* Add your codes here */
}

/*********************************************************************************************************
** Function name:			TargetResetInit
**
** Descriptions:			Initialize the target board before running the main() function; User may
**							change it as needed, but may not deleted it.
**
** 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:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
        void TargetResetInit(void)
{
/*#ifdef __DEBUG    
    MEMMAP = 0x3;                   //remap
#endif

#ifdef __OUT_CHIP    
    MEMMAP = 0x3;                   //remap
#endif

#ifdef __IN_CHIP    
    MEMMAP = 0x1;                   //remap
#endif
*/

#ifdef __DEBUG    				  //开发板上JP10接为:Bank0-RAM,Bank1-Flash,JP9接为:OUTSIDE
	MEMMAP = 0x3;                 //remap
	BCFG0 =  0x10001460; 		  //外部RAM
	BCFG1  = 0x10000460;		  //外部Flash
#endif

#ifdef __OUT_CHIP				  //开发板上JP10接为:Bank0-Flash,Bank1-RAM,JP9接为:OUTSIDE
	MEMMAP = 0x3;                 //remap
	BCFG0  = 0x10000460;		  //外部FLASH
	BCFG1  = 0x10001460;		  //外部RAM
#endif

#ifdef __IN_CHIP    			  //开发板上JP10接为:Bank0-RAM,Bank1-Flash,JP9接为:INSIDE
	MEMMAP = 0x1;                 //remap
	BCFG0  = 0x10001460;		  //外部RAM
	BCFG1  = 0x10000460;		  //外部Flash
#endif


    PINSEL0 = (PINSEL0 & 0x0000) | 0x1500;
    PINSEL1 = (PINSEL1 & 0x0000) ;


/* 设置系统各部分时钟 */
/* Set system timers for each component */
    PLLCON = 1;
#if (Fpclk / (Fcclk / 4)) == 1
    VPBDIV = 0;
#endif
#if (Fpclk / (Fcclk / 4)) == 2
    VPBDIV = 2;
#endif
#if (Fpclk / (Fcclk / 4)) == 4
    VPBDIV = 1;
#endif

#if (Fcco / Fcclk) == 2
    PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
#endif
#if (Fcco / Fcclk) == 4
    PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
#endif
#if (Fcco / Fcclk) == 8
    PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
#endif
#if (Fcco / Fcclk) == 16
    PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
#endif
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
    while((PLLSTAT & (1 << 10)) == 0);
    PLLCON = 3;
    PLLFEED = 0xaa;
    PLLFEED = 0x55;
    
    /* 设置存储器加速模块 */
    /* Set memory accelerater module*/
    MAMCR = 0;
#if Fcclk < 20000000
    MAMTIM = 1;
#else
#if Fcclk < 40000000
    MAMTIM = 2;
#else
    MAMTIM = 3;
#endif
#endif
    MAMCR = 2;
    
    /* 初始化VIC */
    /* initialize VIC*/
    VICIntEnClr = 0xffffffff;
    VICVectAddr = 0;
    VICIntSelect = 0;

    /* 添加自己的代码 */
    /* Add your codes here */
////////////////////////////////////////////////////////////////////////
	// initialize io port and spi0
	
	


////////////////////////////////////////////////////////////////////////    

}

/*********************************************************************************************************
** Function name:		SPIGetChar
**
** Descriptions:		get spi data 
**
** input parameters:		none
** Returned value:		none
**         
** Used global variables:	none
** Calling modules:		None
**
** Created by:			JOSEPH
** Created Date:		2006/10/19
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/

 unsigned char SPIGetChar()
 {
	SPIPutCharWithoutWaiting(0xff); /* send 0xff */
   	SPIWait(); /* wait for the byte to transfer */
   	return SPI_RESULT_BYTE; /* Return the received byte */
 }
   
 /*********************************************************************************************************
** Function name:		SPI8Clocks
**
** Descriptions:		get spi datas 
**
** input parameters:		nClocks
** Returned value:		none
**         
** Used global variables:	none
** Calling modules:		None
**
** Created by:			JOSEPH
** Created Date:		2006/11/07
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/

 void SPI8Clocks(unsigned char nClocks)
 {
   	while (nClocks--)
   		{
     			SPIPutCharWithoutWaiting(0xff);
     			SPIWait();
   		}
 }
/*********************************************************************************************************
** Function name:		LEDStatu
**
** Descriptions:		set led status 
**
** input parameters:		Data
** Returned value:		none
**         
** Used global variables:	none
** Calling modules:		None
**
** Created by:			JOSEPH
** Created Date:		2006/11/07
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/

void LEDStatu(unsigned long Data)
{
	    IO2CLR = Data;       // 输出LED显示数据

            IO2SET = 0xffffffff;
}

/*********************************************************************************************************
**                  The implementations for some library functions
**                  For more details, please refer to the ADS compiler handbook and The library 
**					function manual
**                  User could change it as needed       
********************************************************************************************************/

#include "rt_sys.h"
#include "stdio.h"

#pragma import(__use_no_semihosting_swi)
#pragma import(__use_two_region_memory)

        int __rt_div0(int a)
{
    a = a;
    return 0;
}

        int fputc(int ch,FILE *f)
{
    ch = ch;
    f = f;
    return 0;
}

    int fgetc(FILE *f)
{
    f = f;
    return 0;
}


        int _sys_close(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}

        int _sys_write(FILEHANDLE fh, const unsigned char * buf,
                      unsigned len, int mode)
{
    fh = fh;
    buf = buf;
    len =len;
    mode = mode;
    return 0;
}
        int _sys_read(FILEHANDLE fh, unsigned char * buf,
                     unsigned len, int mode)
{
    fh = fh;
    buf = buf;
    len =len;
    mode = mode;
    
    return 0;
}

       void _ttywrch(int ch)
{
    ch = ch;
}

        int _sys_istty(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}
        int _sys_seek(FILEHANDLE fh, long pos)
{
    fh = fh;
    return 0;
}
        int _sys_ensure(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}

        long _sys_flen(FILEHANDLE fh)
{
    fh = fh;
    return 0;
}
       int _sys_tmpnam(char * name, int sig, unsigned maxlen)
{
    name = name;
    sig = sig;
    maxlen = maxlen;
    return 0;
}

        void _sys_exit(int returncode)
{
    returncode = returncode;
}

        char *_sys_command_string(char * cmd, int len)
{
    cmd = cmd;
    len = len;
    return 0;
}


/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

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