xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡介

該工程是一個畢業設計的代碼,功能已經全部實現并且測試正常,代碼包括按鍵驅動、音頻庫的移植、應用程序三部分。具體使用方法請參照解壓后README.txt里面的說明,如有疑問,請隨時發郵件

資源截圖

代碼片段和文件信息

/*
?*?????mp3播放器控制程序
?* ???功能:
?* ?k1:播放、暫停
?* ?k2:停止播放
?* ?k3:上一首
?* ?k4:下一首
?*?????附加:歌曲自動循環播放
?*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?

/*共享內存申請標記*/
#define?PERM?S_IRUSR|S_IWUSR

/*雙向循環列表:存放歌曲名*/
struct?song
{
char?songname[20];
struct?song?*prev;
struct?song?*next;
};

/*孫子進程id號*/
pid_t?gradchild;

/*子進程id號*/
pid_t?pid;

/*共享內存描述標記*/
int?shmid;

char?*p_addr;

/*播放標記*/
int?first_key=1;
int?play_flag=0;

/*************************************************
Function?name:?play
Parameter????:?struct?song?*
Description ?:?播放函數
Return ?:?void
Argument?????:?void
Autor?&?date?:?ada?091207
**************************************************/
void?play(struct?song?*currentsong)
{
pid_t?fd;
char?*c_addr;
char?*p;
int?len;
char?my_song[30]=“/mp3/song/“;
while(currentsong)
{
/*創建子進程,即孫子進程*/
fd?=?fork();
if(fd?==?-1)
{
perror(“fork“);
exit(1);
}
else?if(fd?==?0)
{
/*把歌曲名加上根路徑*/
strcat(my_songcurrentsong->songname);
p?=?my_song;
len?=?strlen(p);

/*去掉文件名最后的‘\n‘*/
my_song[len-1]=‘\0‘;

printf(“THIS?SONG?IS?%s\n“my_song);
execl(“/mp3/madplay““madplay“my_songNULL);
printf(“\n\n\n“);
}
else
{
/*內存映射*/
c_addr?=?shmat(shmid00);

/*把孫子進程的id和當前播放歌曲的節點指針傳入共享內存*/
memcpy(c_addr&fdsizeof(pid_t));
memcpy(c_addr?+?sizeof(pid_t)+1¤tsong4);
/*使用wait阻塞孫子進程,直到孫子進程播放完才能被喚醒;
??當被喚醒時,表示播放MP3期間沒有按鍵按下,則繼續順序播放下一首MP3*/
if(fd?==?wait(NULL))
{
currentsong?=?currentsong->next;
printf(“THE?NEXT?SONG?IS?%s\n“currentsong->songname);
}
}
}
}

/*************************************************
Function?name:?creat_song_list
Parameter????:?void
Description ?:?創建歌曲名的雙向循環鏈表
Return ?:?struct?song?*
Argument?????:?void
Autor?&?date?:?ada?09.12.07
**************************************************/
struct?song?*creat_song_list(void)
{
FILE?*fd;
size_t?size;
size_t?len;
char?*line?=?NULL;
struct?song?*head;
struct?song?*p1;
struct?song?*p2;
system(“ls?/mp3/song?>song_list“);
fd?=?fopen(“song_list““r“);

p1?=?(struct?song?*)malloc(sizeof(struct?song));

printf(“==================================song?list=====================================\n“);
system(“ls?/mp3/song“);
printf(“\n“);
printf(“================================================================================\n“);
size?=?getline(&line&lenfd);

strncpy(p1->songnamelinestrlen(line));
head?=?p1;
while((size?=?getline(&line&lenfd))?!=?-1)
{
p2?=?p1;
p1?=?(struct?song?*)malloc(sizeof(struct?song));
strncpy(p1->songnamelinestrlen(line));
p2->next?=?p1;
p1->prev?=?p2;
}
p1->next?=?head;
head->prev?=?p1;
p1?=?NULL;
p2?=?NULL;
system(“rm?-rf?song_list“);
return?head;
}
/**********

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-07-05?00:03??mp3player\
?????文件????????2764??2013-07-05?00:06??mp3player\README.txt
?????目錄???????????0??2013-07-05?00:02??mp3player\app\
?????文件?????????120??2013-05-27?20:22??mp3player\app\Makefile
?????文件???????13533??2013-05-27?20:22??mp3player\app\mp3player
?????文件????????8773??2013-05-27?20:11??mp3player\app\mp3player.c
?????目錄???????????0??2013-07-05?00:02??mp3player\driver\
?????文件?????????317??2013-05-27?20:25??mp3player\driver\.mini2440_buttons.ko.cmd
?????文件???????15956??2013-05-27?20:25??mp3player\driver\.mini2440_buttons.mod.o.cmd
?????文件???????24781??2013-05-27?20:25??mp3player\driver\.mini2440_buttons.o.cmd
?????目錄???????????0??2013-07-05?00:08??mp3player\driver\.tmp_versions\
?????文件?????????240??2013-05-27?20:38??mp3player\driver\Makefile
?????文件????????4963??2013-05-27?20:08??mp3player\driver\mini2440_buttons.c
?????文件???????????0??2013-05-27?20:39??mp3player\driver\modules.order
?????目錄???????????0??2013-07-05?00:08??mp3player\kernel\
?????目錄???????????0??2013-07-05?00:02??mp3player\lib\
?????文件??????338143??2013-05-27?20:09??mp3player\lib\libid3tag-0.15.1b.tar.gz
?????文件??????502379??2013-05-27?20:09??mp3player\lib\libmad-0.15.1b.tar.gz
?????文件??????215028??2013-05-27?20:09??mp3player\lib\mad-0.10.1b.tar.gz
?????文件??????590929??2013-05-27?20:09??mp3player\lib\madplay-0.15.2b.tar.gz
?????文件??????181144??2013-05-27?20:09??mp3player\lib\zlib-1.1.4.tar.gz

評論

共有 條評論