mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
change play thread to static thread. use elm fatfs on radio project.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@329 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
1 parent
c28ecae7ed
commit
cefc4f7aa5
10 files changed
+3834
-3808
No files matched your search
@@ -381,11 +381,11 @@ void mp3(char* filename)
|
||||
|
||||
current_offset = 0;
|
||||
while (mp3_decoder_run(decoder) != -1);
|
||||
close(fd);
|
||||
|
||||
/* delete decoder object */
|
||||
mp3_decoder_delete(decoder);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
is_playing = RT_FALSE;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static rt_mq_t player_thread_mq;
|
||||
rt_bool_t is_playing = RT_FALSE;
|
||||
static rt_mq_t player_thread_mq;
|
||||
static struct rt_thread player_thread_tid;
|
||||
static rt_uint8_t player_thread_stack[0x400];
|
||||
|
||||
rt_bool_t player_is_playing()
|
||||
{
|
||||
@@ -20,6 +22,15 @@ void player_play_file(const char* fn)
|
||||
/* send to message queue */
|
||||
rt_mq_send(player_thread_mq, (void*)&request, sizeof(struct player_request));
|
||||
}
|
||||
#ifdef RT_USING_FINSH
|
||||
#include <finsh.h>
|
||||
static const char _fn[] = "/005.mp3";
|
||||
void play()
|
||||
{
|
||||
player_play_file(_fn);
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(play, play mp3 file test);
|
||||
#endif
|
||||
|
||||
void player_stop()
|
||||
{
|
||||
@@ -49,7 +60,7 @@ void player_thread(void* parameter)
|
||||
|
||||
/* get music tag information */
|
||||
mp3(request.fn);
|
||||
|
||||
|
||||
player_notify_stop();
|
||||
is_playing = RT_FALSE;
|
||||
}
|
||||
@@ -68,16 +79,21 @@ void player_thread(void* parameter)
|
||||
|
||||
void player_init()
|
||||
{
|
||||
rt_thread_t tid;
|
||||
rt_err_t result;
|
||||
|
||||
/* create player thread */
|
||||
player_thread_mq = rt_mq_create("player", sizeof(struct player_request),
|
||||
8, RT_IPC_FLAG_FIFO);
|
||||
RT_ASSERT(player_thread_mq != RT_NULL);
|
||||
|
||||
tid = rt_thread_create("ply_bg", player_thread, RT_NULL,
|
||||
2048, 20, 5);
|
||||
if (tid != RT_NULL) rt_thread_startup(tid);
|
||||
|
||||
player_ui_init();
|
||||
result = rt_thread_init(&player_thread_tid, "ply_bg", player_thread, RT_NULL,
|
||||
player_thread_stack, sizeof(player_thread_stack),
|
||||
20, 5);
|
||||
|
||||
if (result != RT_EOK) rt_kprintf("player thread init failed\n");
|
||||
else
|
||||
{
|
||||
rt_thread_startup(&player_thread_tid);
|
||||
player_ui_init();
|
||||
}
|
||||
}
|
||||
+182
-193
File diff suppressed because it is too large.
Load diff
@@ -119,18 +119,8 @@ File 8,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c>
|
||||
File 8,1,<..\..\filesystem\dfs\src\dfs_raw.c><dfs_raw.c>
|
||||
File 8,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.c>
|
||||
File 8,1,<..\..\filesystem\dfs\src\dfs_posix.c><dfs_posix.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\dir.c><dir.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\file.c><file.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fs.c><fs.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ls.c><ls.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\time.c><time.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\ui.c><ui.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\plibc.c><plibc.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\efs.c><efs.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\extract.c><extract.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\base\partition.c><partition.c>
|
||||
File 8,1,<..\..\filesystem\dfs\src\dfs_cache.c><dfs_cache.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\elmfat\dfs_elm.c><dfs_elm.c>
|
||||
File 8,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c><ff.c>
|
||||
File 9,1,<..\..\net\lwip\src\core\dhcp.c><dhcp.c>
|
||||
File 9,1,<..\..\net\lwip\src\core\dns.c><dns.c>
|
||||
File 9,1,<..\..\net\lwip\src\core\init.c><init.c>
|
||||
|
||||
+163
-161
File diff suppressed because it is too large.
Load diff
+3156
-3146
File diff suppressed because it is too large.
Load diff
+285
-285
File diff suppressed because it is too large.
Load diff
@@ -1,3 +1,17 @@
|
||||
/*
|
||||
* File : usart.h
|
||||
* This file is part of RT-Thread RTOS
|
||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rt-thread.org/license/LICENSE
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2009-01-05 Bernard the first version
|
||||
*/
|
||||
|
||||
#ifndef __USART_H__
|
||||
#define __USART_H__
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ int dfs_elm_unmount(struct dfs_filesystem* fs)
|
||||
RT_ASSERT(fat != RT_NULL);
|
||||
|
||||
/* elm not support unmount */
|
||||
RT_ASSERT(0);
|
||||
rt_kprintf("elm fatfs not support unmount\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,12 @@
|
||||
#ifndef _FATFS
|
||||
#define _FATFS 0x007C
|
||||
|
||||
#ifdef RT_DFS_ELM_WORD_ACCESS
|
||||
#define _WORD_ACCESS 1
|
||||
#else
|
||||
#define _WORD_ACCESS 0
|
||||
#endif
|
||||
|
||||
/* The _WORD_ACCESS option defines which access method is used to the word
|
||||
/ data in the FAT structure.
|
||||
/
|
||||
@@ -104,7 +109,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#define _USE_LFN 1
|
||||
#define _USE_LFN 0
|
||||
#define _MAX_LFN 255 /* Maximum LFN length to handle (max:255) */
|
||||
/* The _USE_LFN option switches the LFN support.
|
||||
/
|
||||
|
||||
Reference in new issue
Block a user