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

📄 main.c

📁 usoc在北京博创兴业有限公司的实验平台s3c2410上运行。 2. 各实验的全部源代码分别存放在各实验目录下面。
💻 C
字号:
/***************************************************************************\
	Copyright (c) 2004-2007 www.up-tech.com, All rights reserved.
	by allan_hua	2005.12.28
\***************************************************************************/
/***************************************************************************\
    #说明: C main 函数,开发的初始化定义,初始化文件系统并调用
           MP3的解码和播放函数播放歌曲!

\***************************************************************************/

#include"../ucos-ii/includes.h"               /* uC/OS interface */
#include "../ucos-ii/add/osaddition.h"
#include "../inc/drivers.h"
#include "OSFile.h"
#include "../inc/sys/lib.h"
#include "../src/gui/gui.h"
#include "reg2410.h"
#include <string.h>
#include <stdio.h>

#pragma import(__use_no_semihosting_swi)  // ensure no functions that use semihosting 

char TextFilename[]="/sys/ucos/fj/ttdl.mp3";
FILE* pfile;                           //定义文件结构指针
U32 DataCount=0;
/***************************************************************/

int mp3_input_read(unsigned char *buf, int len)
{  
    //读取MP3原始数据
    DataCount=fread(buf,512,(len/512),pfile); //读取文件数据  
    //如果已经读到文件的结尾
    if(!DataCount) 
      {
         fclose(pfile);
      }    
    return(DataCount);
}

char*  mALLOc(size_t);

int main(void)
{
  	ARMTargetInit();        // do target (uHAL based ARM system) initialisation //
  	ISR_Init();             // ISR 初始化
	OSInit();               // needed by uC/OS-II //
	OSInitUart();           // Uart 初始化
    initOSFile();           // 文件系统初始化
   // ucos2_malloc_init ();
	pfile=fopen(TextFilename,"r");       //打开文件
	if(pfile==NULL){                     //文件打开失败
		LCD_printf("\n   Can't Open file!\n");
		while(1);
	}
    Uart_Printf(0,"\nMPEG Audio Decoder 0.14.2(bate)-Copyright (C) 2000-2001 Robert Leslie\n"); // 串口输出信息
    
	LCD_printf("\n   Start to play song!\n");  // LCD输出信息
   	LCD_printf("\n   The song is playing!\n"); // LCD输出信息
   	Uart_Printf(0,"\nThe song is playing!\n");
    start_mp3_decode();                        // 歌曲解码播放
    Uart_Printf(0,"End!\n");                   // 串口输出信息
	LCD_printf("\n   The player stopped!\n");  // LCD输出信息

    while(1);
   
	return 0;
}

⌨️ 快捷键说明

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