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

📄 main.c

📁 在s3c44b0下利用SD卡进行WAV文件(FAT16格式)播放的源程序
💻 C
字号:
#include <string.h>
#include <stdio.h>
#include "Target\44b.h"
#include "Target\44blib.h"
#include "fat16\fat16.h"
#include "iistest\uda1341.h"

//extern void Rtc_Init(void);
//extern void Flash_Tools(void);
//extern INT8U SD_ReadBlock(INT32U blockaddr, INT8U *recbuf);  
extern INT8U SD_Initialize(void);	  
extern unsigned char ReadBuffer1;
extern unsigned char *RAM_ADDRESS;
unsigned char buff[12];
unsigned char buf1[512];
unsigned char buf2[2048];

unsigned char *s;


void * function[][2]=
{
	(void *)fat16_Nandflash_test, "Fat16 test   ",
	//(void *)Flash_Tools,          "Flash Read   ",
	0,0
};
	
/****
void Rtc_Init(void)
{
    rRTCCON = 0x01;	
    rBCDYEAR = YEAR;
    rBCDMON  = MONTH;
    rBCDDAY  = DAY;	// SUN:1 MON:2 TUE:3 WED:4 THU:5 FRI:6 SAT:7
    rBCDDATE = DATE;
    rBCDHOUR = HOUR;
    rBCDMIN  = MIN;
    rBCDSEC  = SEC;
	rRTCCON = 0x0;    
}
****/	


/*
void test(void)
{
	int i,blknum,r_w,a,b,start_num,r_w_num;
	Uart_Printf("Please choose read or write.\n");
	Uart_Printf("  1:Read one\n  2:Read more\n  3:Write one\n  4:Write more\n");        
	r_w=Uart_GetIntNum();

    if(r_w==1 || r_w==2) Uart_Printf("Input number of the block start to read\n");
    if(r_w==3 || r_w==4) Uart_Printf("Input number of the block start to write\n");  
		
	start_num=Uart_GetIntNum();
	
	if(r_w==2) 
	{
		Uart_Printf("Input number of read\n");  
		r_w_num=Uart_GetIntNum();
	}
	
	if(r_w==4) 
	{
		Uart_Printf("Input number of write\n");  
		r_w_num=Uart_GetIntNum();
	}

	if(r_w==1)
	{ 
		SD_ReadBlock(start_num, buf1);
			
		s=buf1;
		if(start_num>=2 && start_num<=479)//当读的是FAT表时将16位的颠倒一下
		{
			for(i=1;i<=256;i++)
			{
				a = *s++;
				b = *s++;
				Uart_Printf("%2x  ",b);
				Uart_Printf("%2x  ",a);
				if((i%8)==0) Uart_Printf("\n");
			}
		}
		else
		{
			for(i=1;i<=512;i++)
			{
				Uart_Printf("%2x  ",*s++);
				if((i%16)==0) Uart_Printf("\n");
			}
		}
	}
		
		if(r_w==2) 
	{
		SD_ReadMultiBlock(start_num, r_w_num, buf2);
			
		s=(buf2+512);
		for(i=1;i<=1024;i++)
		{
			Uart_Printf("%2x  ",*s++);
			if((i%16)==0)
			Uart_Printf("\n");
			if((i%512)==0)
			Uart_Printf("\n");
		}
	}
		
	if(r_w==3) 
	{
		for(i=0;i<512;i++)  buf1[i]=0x78;
		SD_WriteBlock(start_num, buf1);
	}
		
	if(r_w==4) 
	{
		for(i=0;i<512;i++)  buf1[i]=0x68;
		SD_WriteMultiBlock(start_num, r_w_num,buf1);
	}		   	
}
*/



void Main(void)
{
	int i;
	
	rSYSCFG=CACHECFG;	// Using 8KB Cache//
	Port_Init();
	//Rtc_Init();
	Uart_Init(0,115200);
	Led_Display(0xf);
	Delay(0);
	//Beep(0x1);
	Uart_Select(0); //Select UART0//
   
	Led_Display(0x0);
 
	for(i=0;i<5;i++) SD_Initialize();//SD卡初始化
	
	while(1)
	{
		i=0;
			
		while(1)
		{ 	
			RAM_ADDRESS = &ReadBuffer1;//把地址强制转换成长整型
			fat16_Nandflash_test();
			Test1341();
			//rIISCON |=0x1;
			//while(1);

		}
	}
}

⌨️ 快捷键说明

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