亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mp3_player_06.c

?? MG64+VS1003+SDCARD+nokia5110 之多的MP3
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*****************************************************/
/*                mp3 player V2.1                                                   */
/* Description : A mp3 player support lrc sd & U disk                 */
/* Platform     : AVRStudio4.13 + WinAVR20070525  m64        */
/* Author       : Michael Zhang - 章其波                            */
/* Email         : sudazqb@163.com                                          */
/* MSN          : zhangqibo_1985@hotmail.com                          */
/* Date          : 2007-11-03                                                    */
/* NOT FOR COMMERCIAL USE,     ALL RIGHT RESERVED!         */
/*****************************************************/

/*********************  old  ***************************/
/*                   MP3/Wma/Midi播放器                      */
/*  環境WinAVR 20060421                                      */
/*  作者:Bozai(章其波)                                    */
/*  E-mail:sudazqb@163.com                                  */
/*  2006年12月12日                                           */
/*************************************************************/
/*  20080205: a bug fixed(about lyric search, name comparision error )  */
/*  20071211: add low battery indication & remove all uart output, add message for sara ye */
/*  20071210: modify code for zl0801's mp3 PCB */
/*  20071122: add teminal control code                                   */
/*  20071121: solve glitch problem when playing 320Kbps files            */
/*  20071109: add & modify function for any directory music file playing */
/*  20071103: add function for lyric display                             */


#include<avr/io.h>
#include<avr/eeprom.h>
#include"CH375/CH375.h"
#include"FAT/FAT.h"
#include"UART/UART.H"
#include"VS1003B/VS1003B.h"
#include<avr/pgmspace.h>
#include"LCD/LCD_ASCII.h"
#include"LCD/LCD.H" 
#include"LCD/LCD_GBK.h"
#include"MMC_SD/MMC_SD.h"
#include"LCD/LCD_APP.h"
#include<avr/interrupt.h>
//#include"IDE/IDE.h"

#define STOP_KEY 1

#define uint unsigned int

#define ENTER_KEY 0x0d
#define BACK_KEY  0x08
#define ESC_KEY   0x1b
#define MAX       64

#if STOP_KEY
	#define MODE _BV(PE7)
	#define STOP _BV(PE6)
#else
	#define MODE _BV(PE6)
	#define STOP _BV(PE7)
#endif

#define NEXT _BV(PE3)
#define UP   _BV(PE5)
#define DOWN _BV(PE4)
#define PREV _BV(PE2)

#define LCD_BL PG3
#define LCD_BL_CON DDRG |= 1<<LCD_BL
#define LCD_BL_ON  PORTG &= ~(1<<LCD_BL)
#define LCD_BL_OFF  PORTG |= 1<<LCD_BL
#define LCD_BL_INV PORTG ^= 1<<LCD_BL

#define MP3 1
#define WMA 2
#define MID 3
#define WAV 4

//mode
#define REPET_ALL 0
#define REPET_ONE 1
#define RANDOM    2

/* enum for ICON */
enum IconTag
{
	Playing,Pause,RepetAll,RepetOne,Shuffle,Time,Music,Speaker
};

/* Long name buffer and flag */
extern unsigned char LongNameBuffer[MAX_LONG_NAME_SIZE];
extern unsigned char LongNameFlag;

/* indicate if the file system is FAT32 , ortherwise it is FAT16, note FAT12 is not supported */
extern BYTE FAT32_Enable;

extern WORD SectorsPerClust;//每簇扇區數
extern WORD FirstDataSector;//第一個數據扇區數

//struct FileInfoStruct FileInfo;//文件信息

struct direntry MusicInfo;	/* Music file information, 32Bytes short directory record, contain the short name and others */
struct direntry LrcInfo;	/* lyric file information, 32Bytes short directory record, the short name and others */


/* The path of the music file & lyric file , caution: each driectory should long longer than 8, that is not support long name*/
#if FIX_DIRECTORY
#define MUSIC_PATH "\\music"
#endif

#define LRC_PATH "\\lrc"

void (*BootLoaderEntry)(void) = 0xf800;	/* boot loader entry, bootloader size: 2048Bytes */

uint16 totalsongs;	/* total number of songs*/
uint8 type;			/* current song's file type, mp3 wma mid or wav */
uint8 lrc =0;			/* Gloable variable to indicate wether the songs has a lyric file, 1 means have */
uint8 HanziEnable = 0;	/* Gloable variable to indicate wether the firmware are exist, and 1 means exist */

/* Time tag structure */
struct LrcStruct_s {
	struct LrcStruct_s * next;	/* the next node */
	uint32 time;				/* Time */
	uint16 eeaddr;			/* Address, start with 0, value greater than MAXLRCDATSIZE is the eeprom address*/
};


struct LrcStructHead_s {
	struct LrcStruct_s *header;	/* Pointer to the first node of time tag struct */
#define TI_LEN 32
	uint8 title[TI_LEN];			/* Title */
#define AR_LEN 16
	uint8 artist[AR_LEN];			/* Artist */
	uint16 offset;					/* Offset */
       uint8 sign;					/* "1" means "+", and "0" means "-" */
};

#define DEBUG 0	/* Macro for DEBUG, if 1 DEBUG message will show throw the UART */


struct LrcStructHead_s LrcStructHead;	/* Gloable struct variable to record the lyric info */

/* Use to record the time tag info */
#define MAXITEM 80
uint8 lrcbuffer[sizeof(struct LrcStruct_s) * MAXITEM];

/* Use to record the lyric data */
#define MAXLRCDATSIZE 650			/* Max data size in SRAM, other will be store in EEPROM */
uint8 lrcdatbuf[MAXLRCDATSIZE];


uint8 track[128];			/* stroe the information of songs (bit set indicate songs has been played) */

void ClearTrackInfo()		/* cleare the array track[128] */
{
	uint8 i;
	for(i=0;i<128;i++)track[i] = 0;
}

uint8 SetTrack(uint16 songs)/* set the track bit, return 1 means the song has been played */
{
	uint8 byte_offset;
	uint8 bit_offset;
	songs--;
	byte_offset = songs/8;
	bit_offset = songs%8;
	if(track[byte_offset] & (1<<bit_offset))return 1;
	else
	{
		track[byte_offset] |= 1<<bit_offset;
		return 0;
	}
}

/*void nextline()
{
	USART_putchar(0x0d);
	USART_putchar(0x0a);
}*/

void Delay(uint16 n)//延時
{
	while(n--)asm("nop");
}

//Timer initialization offer seed of the srandom()
void Timer1_Initial()
{
	TCNT1H=0x00;
	TCNT1L=0x00;
	TCCR1A=0x03;
	TCCR1B=0x01;
	ICR1H=0xff;
	ICR1L=0xff;
}

uint8 strcomp(uint8 * src, uint8 * dst) /* String compare */
{
	while(*src)
	{
		if(*src++ != *dst++)return 0;
	}
	return 1;
}

uint8 strcomp_noncase(uint8 * src, uint8 * dst)/*we should make sure the src is upcase*/
{
	uint8 * p1 = src, * p2 = dst;
	while(*p1)
	{
		if((*p1 == *p2) || ((*p1<*p2)&&((*p2-*p1) == 0x20 )) )
		{
			p1 ++;
			p2 ++;
		}
		else return 0;
	}
	return 1;
}

/* Lyric proccess fuction */
#if FIX_DIRECTORY
uint8 LrcProc(uint8 *LongNameBuffer, uint8 isLongName) /* Parameter is the song's long name or short name, note: do not contain the extention*/
#else
uint8 LrcProc(uint8 *LongNameBuffer,WORD music_record_addr, uint8 isLongName) /* Parameter is the song's long name or short name, note: do not contain the extention*/
#endif
{
	/* lyric time tag struct pointer for process*/
	struct LrcStruct_s * LrcStruct_p;
	struct LrcStruct_s * LrcStruct_p_up, * LrcStruct_p_temp,* LrcStruct_p_down;
	struct LrcStruct_s * LrcStruct_p_header;
		
	uint16 lrcaddr;		/* The address to store each lyric */
	uint8 part;			/* the sector number of one cluster */
	uint16 i;				/* loop variable for gerneral perpus */
	uint16 j;
	uint8 temp;			/* temp variable */
	uint8 * buffer;		/* buffer pointer, later will use malloc to get the data area for it*/
	uint16 min,sec,ms;	/* temp variable for time tag process, minter, second, and milisecond */
	uint8 sector;			/* sector number to record current sector, with variable j to determine wether the file is ended*/
	uint8 totalsect;		/* total sectors the file contains */
	uint16 leftbytes;		/* how many data contained in the last sector */
	uint32 p;			/* cluster number of file, next ,etc */
	uint8 mscnt;			/* counter for ms, you konw 2.3 means 2300ms not 2003ms, so need this variable to determin this*/
       
	LrcStructHead.header = (struct LrcStruct_s *)lrcbuffer;	/* set lrc info struct 's header to the buffer */

#if FIX_DIRECTORY
	if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo,isLongName)==0)	/* search the path specified, and if found lyric file it will return 0*/
#else
	if(SearchLrc(LRC_PATH,LongNameBuffer,&LrcInfo,music_record_addr,isLongName)==0)	/* search the path specified, and if found lyric file it will return 0*/
#endif
	{ 
//		printf_P(PSTR("\r\n\r\n*****************************************************"));
//		printf_P(PSTR("\r\nFound LRC file!"));
//		printf_P(PSTR("\r\n\r\nAnalyzing LRC file ...........\r\n"));
	   
		lrc = 1;								/* Set the flag */
		lrcaddr = 0;							/* Clear the address */
	   
		LrcStruct_p = LrcStructHead.header;		/* intialize the sigle direction node */
		for(i=0;i<MAXITEM-1;i++)
		{
			LrcStruct_p->next = LrcStruct_p + 1;
			LrcStruct_p = LrcStruct_p->next;
		}
		LrcStruct_p->next = 0;
		LrcStruct_p = LrcStructHead.header;
								  
		LrcStructHead.offset = 0;				/* clear the lyc info struct */
		LrcStructHead.title[0] = '\0';
		LrcStructHead.artist[0] = '\0';
	   
		buffer = malloc(520);					/* allocate memory for read the lyric file */
		if(buffer==0)
		{
			#if DEBUG
			printf_P(PSTR("\r\nERROR: No enough memory!"));
			#endif
			return 1;
		}

		p = LrcInfo.deStartCluster+(((unsigned long)LrcInfo.deHighClust)<<16);	/* Calculate the first cluster of the lyric file */
		totalsect = LrcInfo.deFileSize/512; /*計算扇區數			//calculate the total sectors */
		leftbytes = LrcInfo.deFileSize%512; /*計算剩余的字節數	//calculate the left bytes */	
		sector=0;				/* clear the sector counter */

/*  here to start analyze the lyric file */    
		while(1)
		{
			for(part=0;part<SectorsPerClust;part++)	/* first loop for read a sector of a culster */
			{
				if(FAT_LoadPartCluster(p,part,buffer))
				{
					#if DEBUG
						printf_P(PSTR("\r\nERROR: Failed to read one sector"));
					#endif
					free(buffer);
					return 1;
				}
				for(j=0;j<512;)	/* second loop for analyze each byte of the sector */
				{
					if(sector == totalsect && j == leftbytes)	/* see if it is the end of file */
					{
						part = SectorsPerClust;		/* next loop it will get out */
						break;
					}
					if(buffer[j] == '[')			/* if it is the "[" : the tag start */
					{
						#if DEBUG
							printf_P(PSTR("\r\nfound tag start ["));
						#endif
/**********************************************************************************************************/                                    
						i = 0;
						if(strcomp_noncase("TI:",&buffer[j+1]))		/* string compare to check if this is a title tag */
						{
							j+=4;		/* count add 4 */
							while(1)		/* store the title */
							{
								temp = buffer[j++];
								if(temp == 0x0d || temp == 0x0a || temp == ']' || i> (TI_LEN - 2)) /* title ended */
									break;
								LrcStructHead.title[i++] = temp;
							}
							LrcStructHead.title[i] = 0;	/* need a 0 to end the string */
                        
							#if DEBUG
								printf_P(PSTR(" found title tag: %s ]"),LrcStructHead.title);
							#else
							//	printf_P(PSTR("\r\nTitle  : %s "),LrcStructHead.title);
							#endif
                                            
						}
/**********************************************************************************************************/						
						else if(strcomp_noncase("AR:",&buffer[j+1]))	/* string compare to check if this is a artist tag */
						{
							j+=4;	/* count += 4 */
							while(1)	/* store the content */
							{
								temp = buffer[j++];
								if(temp == 0x0d || temp == 0x0a || temp == ']' || i>(AR_LEN - 2))	/* tag ended */
									break;
								LrcStructHead.artist[i++] = temp;
							}
							LrcStructHead.artist[i] = 0;		/* need a 0 to end the string */
                        
							#if DEBUG
   								printf_P(PSTR(" found artist tag: %s ]"),LrcStructHead.artist);
							#else
							//	printf_P(PSTR("\r\nArtist : %s "),LrcStructHead.artist);
							#endif
	 
						}
/**********************************************************************************************************/
						else if(strcomp_noncase("OFFSET:",&buffer[j+1]))	/* string compare to check if this is a offset tag */
						{
							j+=8;	/* count += 8 */
						
							LrcStructHead.offset = 0;	/* default value, in case the tag like this [offset:] */
 							LrcStructHead.sign = 1;

							#if DEBUG
								printf_P(PSTR(" found offset tag: "));
							#else
								//printf_P(PSTR("\r\n"));
							#endif
                                           
							while(1)	/* proceed the offset */
							{
								temp = buffer[j++];

								#if DEBUG
									USART_putchar(temp);
								#endif
                                                       
								if(temp == ']')break;	/* tag end */
								if(temp == '-')			/* sign */
								{
									LrcStructHead.sign = 0;
									continue;
								}
								LrcStructHead.offset *= 10;			/* calculate the value */
								LrcStructHead.offset += (temp-0x30);
							}
                                           
							#if DEBUG
								printf_P(PSTR("the value in the structure is : %d"),LrcStructHead.offset);
							#endif
                                             
						}
/**********************************************************************************************************/					
						else if(strcomp_noncase("BY:",&buffer[j+1]))	/* string compare to check if this is a By tag */
						{											/* but we do not need this tag */
							j+=4;
                                              
							#if DEBUG
								printf_P(PSTR(" found by tag: "));
							#endif
                                               
							while(1)
							{
								temp = buffer[j++];

								#if DEBUG
									USART_putchar(temp);
								#endif
                                                       
								if(temp == 0x0d || temp == 0x0a || temp == ']' ||i>30)break;
							}
						}
/**********************************************************************************************************/									 
						else if(strcomp_noncase("AL:",&buffer[j+1]))	/* string compare to check if this is a album tag */
						{
							j+=4;

							#if DEBUG
								printf_P(PSTR(" found al tag: "));
							#else
							//	printf_P(PSTR("\r\nAlbum  : "));
							#endif

							while(1)
							{
								temp = buffer[j++];   
								if(temp == 0x0d || temp == 0x0a || temp == ']' ||i>30)break;
							//	USART_putchar(temp);
							}
						}
/**********************************************************************************************************/									   
						else		/* otherwise this must the time tag or other not recognize tag */
						{
							j+=1;
							/****************************************************************/
							if(sector == totalsect && j == leftbytes + 1) goto end; /* if the file is end */
							if(j == 512)	/* wether the sector is end, need to read the next sector */
							{
								if(part == (SectorsPerClust - 1))	/* if need to read next cluster */
								{
									//p=FAT_NextCluster_NEW(p);//讀下一簇數據			//read next cluster
									p=FAT_NextCluster(p);
									if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//如果無后續簇則結束,	//no more cluster  
									{
										#if DEBUG
											printf_P(PSTR("\r\nNo next cluster or read next cluster error"));
										#endif
										goto end;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区在线观看| 国产农村妇女精品| 国产视频一区二区在线观看| 亚洲综合色视频| 国产麻豆午夜三级精品| 欧美体内she精高潮| 国产欧美日韩在线视频| 亚洲制服欧美中文字幕中文字幕| 一区二区三区视频在线看| 国产精品资源网| 欧美日韩中文字幕一区| 最新热久久免费视频| 国产一区二区三区美女| 日韩女优av电影在线观看| 亚洲一区二区精品久久av| 99re热这里只有精品视频| 精品国产乱码久久久久久免费| 五月婷婷综合网| 欧美天天综合网| 亚洲国产va精品久久久不卡综合| 成人精品免费视频| 国产亚洲精品福利| 精品国产乱码久久久久久老虎| 一本色道**综合亚洲精品蜜桃冫| 欧美亚洲国产一区二区三区| 日本丶国产丶欧美色综合| 欧美另类变人与禽xxxxx| 欧美va日韩va| 国产欧美精品区一区二区三区 | 亚洲国产成人va在线观看天堂| 99天天综合性| 中文字幕在线播放不卡一区| 99re8在线精品视频免费播放| 中文字幕一区二区三区视频| 一区二区三区国产| 波多野结衣中文字幕一区二区三区| 久久精品人人爽人人爽| 懂色av一区二区三区免费看| 中文字幕在线视频一区| 亚洲欧美日韩小说| 在线观看日韩国产| 热久久一区二区| 亚洲主播在线观看| 国产精品午夜在线观看| 91在线观看美女| 亚洲va中文字幕| 国产suv精品一区二区三区| 久久久亚洲午夜电影| 久久福利资源站| 日韩三级伦理片妻子的秘密按摩| 狠狠色综合色综合网络| 国产精品视频第一区| 色综合久久99| 日本不卡不码高清免费观看| 久久青草欧美一区二区三区| 播五月开心婷婷综合| 一区二区三区中文字幕精品精品| 欧美日韩另类一区| 国产裸体歌舞团一区二区| 亚洲乱码国产乱码精品精可以看 | 国产在线精品免费av| 国产精品热久久久久夜色精品三区 | 欧美一区二区美女| 国产成人在线免费| 亚洲综合久久久| 久久免费精品国产久精品久久久久| 国产精品综合视频| 亚洲精品国产精品乱码不99| 欧美三级午夜理伦三级中视频| 精品亚洲欧美一区| 中国色在线观看另类| 欧美猛男gaygay网站| 国产一区二区美女| 一区二区三区毛片| 欧美高清一级片在线观看| 欧美日韩日日摸| 成人av片在线观看| 奇米色777欧美一区二区| 欧美极品少妇xxxxⅹ高跟鞋| 精品伊人久久久久7777人| 久久久五月婷婷| 欧美日韩一区二区三区高清| 国产98色在线|日韩| 蜜臀av一区二区在线免费观看 | 日本伊人精品一区二区三区观看方式| 久久丝袜美腿综合| 欧美男人的天堂一二区| 国产成人免费视频一区| 亚洲尤物在线视频观看| 欧美一级高清片| 在线视频中文字幕一区二区| 成人小视频免费在线观看| 在线亚洲一区观看| 午夜精彩视频在线观看不卡| 亚洲一区二区高清| 五月天丁香久久| 精品一区二区三区久久| 国产乱人伦偷精品视频不卡| 国产成人鲁色资源国产91色综| 粉嫩aⅴ一区二区三区四区| 色哟哟在线观看一区二区三区| 欧美视频中文一区二区三区在线观看| 欧美伊人精品成人久久综合97| 欧美日韩国产免费一区二区| 日韩欧美国产一区在线观看| 中文字幕久久午夜不卡| 一区二区视频在线看| 日韩国产一区二| 国产激情91久久精品导航| 日本国产一区二区| 欧美人妇做爰xxxⅹ性高电影| 久久午夜羞羞影院免费观看| 国产精品国产三级国产| 午夜av一区二区| 国产91丝袜在线观看| 欧美撒尿777hd撒尿| 国产蜜臀97一区二区三区| 亚洲动漫第一页| 丁香婷婷综合色啪| 91精品国产综合久久国产大片| 欧美激情一区二区三区四区| 亚洲成人资源网| 成人av网站在线| 日韩视频一区二区三区| 亚洲精品免费在线| 国产精品一品视频| 欧美人xxxx| 亚洲色图一区二区三区| 国产一区二区美女诱惑| 欧美日韩国产在线播放网站| 亚洲国产精品精华液2区45| 亚洲图片欧美视频| 99麻豆久久久国产精品免费 | 国产精品青草综合久久久久99| 国产原创一区二区三区| 色噜噜久久综合| 国产女同互慰高潮91漫画| 午夜精品一区在线观看| 91亚洲永久精品| 国产亚洲人成网站| 九九久久精品视频 | 91精品国产麻豆| 亚洲三级在线免费| 成人伦理片在线| 久久久久久久国产精品影院| 日韩有码一区二区三区| 在线观看日韩一区| 亚洲黄色免费网站| 99精品国产热久久91蜜凸| 久久嫩草精品久久久精品| 蜜臀国产一区二区三区在线播放| 精品视频在线看| 亚洲国产精品久久久久婷婷884 | 亚洲午夜久久久久| 色婷婷久久综合| 1024成人网| 91麻豆自制传媒国产之光| 日本一区二区三区视频视频| 国产一区二三区好的| 日韩一区和二区| 三级成人在线视频| 在线电影一区二区三区| 日本欧美加勒比视频| 欧美日韩高清在线| 奇米综合一区二区三区精品视频| 欧美日韩不卡在线| 麻豆专区一区二区三区四区五区| 欧美一区二区三区四区视频| 日本午夜精品视频在线观看 | 91久久精品网| 亚洲综合免费观看高清在线观看| 91蜜桃网址入口| 亚洲一区二区三区四区中文字幕 | 国产a视频精品免费观看| 国产拍揄自揄精品视频麻豆| 国产不卡高清在线观看视频| 国产亚洲欧美日韩在线一区| 丰满白嫩尤物一区二区| 国产精品福利一区二区三区| 色综合天天综合色综合av| 一区二区三区自拍| 欧美一区午夜视频在线观看| 精品一区二区在线视频| 久久精子c满五个校花| 成人永久aaa| 亚洲激情男女视频| 欧美日韩小视频| 久久99精品国产麻豆婷婷| 国产三级精品三级在线专区| 91香蕉视频黄| 久久精品国产免费| 国产精品每日更新| 欧美亚洲综合一区| 国产一区二区三区日韩| 中文字幕在线不卡| 制服丝袜激情欧洲亚洲| 国产高清视频一区| 一区二区三区在线看| 884aa四虎影成人精品一区| 国产一区二区不卡|