提交 cefc4f7a 编写于 作者: B bernard.xiong

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
上级 c28ecae7
...@@ -381,11 +381,11 @@ void mp3(char* filename) ...@@ -381,11 +381,11 @@ void mp3(char* filename)
current_offset = 0; current_offset = 0;
while (mp3_decoder_run(decoder) != -1); while (mp3_decoder_run(decoder) != -1);
close(fd);
/* delete decoder object */ /* delete decoder object */
mp3_decoder_delete(decoder); mp3_decoder_delete(decoder);
} }
close(fd);
} }
is_playing = RT_FALSE; is_playing = RT_FALSE;
} }
......
...@@ -3,8 +3,10 @@ ...@@ -3,8 +3,10 @@
#include <string.h> #include <string.h>
static rt_mq_t player_thread_mq;
rt_bool_t is_playing = RT_FALSE; 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() rt_bool_t player_is_playing()
{ {
...@@ -20,6 +22,15 @@ void player_play_file(const char* fn) ...@@ -20,6 +22,15 @@ void player_play_file(const char* fn)
/* send to message queue */ /* send to message queue */
rt_mq_send(player_thread_mq, (void*)&request, sizeof(struct player_request)); 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() void player_stop()
{ {
...@@ -49,7 +60,7 @@ void player_thread(void* parameter) ...@@ -49,7 +60,7 @@ void player_thread(void* parameter)
/* get music tag information */ /* get music tag information */
mp3(request.fn); mp3(request.fn);
player_notify_stop(); player_notify_stop();
is_playing = RT_FALSE; is_playing = RT_FALSE;
} }
...@@ -68,16 +79,21 @@ void player_thread(void* parameter) ...@@ -68,16 +79,21 @@ void player_thread(void* parameter)
void player_init() void player_init()
{ {
rt_thread_t tid; rt_err_t result;
/* create player thread */ /* create player thread */
player_thread_mq = rt_mq_create("player", sizeof(struct player_request), player_thread_mq = rt_mq_create("player", sizeof(struct player_request),
8, RT_IPC_FLAG_FIFO); 8, RT_IPC_FLAG_FIFO);
RT_ASSERT(player_thread_mq != RT_NULL); RT_ASSERT(player_thread_mq != RT_NULL);
tid = rt_thread_create("ply_bg", player_thread, RT_NULL, result = rt_thread_init(&player_thread_tid, "ply_bg", player_thread, RT_NULL,
2048, 20, 5); player_thread_stack, sizeof(player_thread_stack),
if (tid != RT_NULL) rt_thread_startup(tid); 20, 5);
player_ui_init(); if (result != RT_EOK) rt_kprintf("player thread init failed\n");
else
{
rt_thread_startup(&player_thread_tid);
player_ui_init();
}
} }
此差异已折叠。
...@@ -119,18 +119,8 @@ File 8,1,<..\..\filesystem\dfs\src\dfs_fs.c><dfs_fs.c> ...@@ -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_raw.c><dfs_raw.c>
File 8,1,<..\..\filesystem\dfs\src\dfs_util.c><dfs_util.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\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\elmfat\dfs_elm.c><dfs_elm.c>
File 8,1,<..\..\filesystem\dfs\filesystems\efsl\src\fs\vfat\fat.c><fat.c> File 8,1,<..\..\filesystem\dfs\filesystems\elmfat\ff.c><ff.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 9,1,<..\..\net\lwip\src\core\dhcp.c><dhcp.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\dns.c><dns.c>
File 9,1,<..\..\net\lwip\src\core\init.c><init.c> File 9,1,<..\..\net\lwip\src\core\init.c><init.c>
......
/* RT-Thread config file */ /* RT-Thread config file */
#ifndef __RTTHREAD_CFG_H__ #ifndef __RTTHREAD_CFG_H__
#define __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/ /* RT_NAME_MAX*/
#define RT_NAME_MAX 8 #define RT_NAME_MAX 8
/* RT_ALIGN_SIZE*/ /* RT_ALIGN_SIZE*/
#define RT_ALIGN_SIZE 4 #define RT_ALIGN_SIZE 4
/* PRIORITY_MAX*/ /* PRIORITY_MAX*/
#define RT_THREAD_PRIORITY_MAX 32 #define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second*/ /* Tick per Second*/
#define RT_TICK_PER_SECOND 100 #define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */ /* SECTION: RT_DEBUG */
/* Thread Debug*/ /* Thread Debug*/
#define RT_DEBUG #define RT_DEBUG
/* #define RT_THREAD_DEBUG */ /* #define RT_THREAD_DEBUG */
#define RT_USING_OVERFLOW_CHECK #define RT_USING_OVERFLOW_CHECK
/* Using Hook*/ /* Using Hook*/
#define RT_USING_HOOK #define RT_USING_HOOK
/* SECTION: IPC */ /* SECTION: IPC */
/* Using Semaphore*/ /* Using Semaphore*/
#define RT_USING_SEMAPHORE #define RT_USING_SEMAPHORE
/* Using Mutex*/ /* Using Mutex*/
#define RT_USING_MUTEX #define RT_USING_MUTEX
/* Using Event*/ /* Using Event*/
#define RT_USING_EVENT #define RT_USING_EVENT
/* Using MailBox*/ /* Using MailBox*/
#define RT_USING_MAILBOX #define RT_USING_MAILBOX
/* Using Message Queue*/ /* Using Message Queue*/
#define RT_USING_MESSAGEQUEUE #define RT_USING_MESSAGEQUEUE
/* SECTION: Memory Management */ /* SECTION: Memory Management */
/* Using Memory Pool Management*/ /* Using Memory Pool Management*/
#define RT_USING_MEMPOOL #define RT_USING_MEMPOOL
/* Using Dynamic Heap Management*/ /* Using Dynamic Heap Management*/
#define RT_USING_HEAP #define RT_USING_HEAP
/* Using Small MM*/ /* Using Small MM*/
#define RT_USING_SMALL_MEM #define RT_USING_SMALL_MEM
/* Using SLAB Allocator*/ /* Using SLAB Allocator*/
/* #define RT_USING_SLAB */ /* #define RT_USING_SLAB */
/* SECTION: Device System */ /* SECTION: Device System */
/* Using Device System*/ /* Using Device System*/
#define RT_USING_DEVICE #define RT_USING_DEVICE
#define RT_USING_UART1 #define RT_USING_UART1
// #define RT_USING_UART2 // #define RT_USING_UART2
// #define RT_USING_UART3 // #define RT_USING_UART3
/* SECTION: Console options */ /* SECTION: Console options */
/* the buffer size of console*/ /* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLEBUF_SIZE 128
/* SECTION: FinSH shell options */ /* SECTION: FinSH shell options */
/* Using FinSH as Shell*/ /* Using FinSH as Shell*/
#define RT_USING_FINSH #define RT_USING_FINSH
/* Using symbol table */ /* Using symbol table */
#define FINSH_USING_SYMTAB #define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION #define FINSH_USING_DESCRIPTION
#define FINSH_DEVICE_NAME "uart1" #define FINSH_DEVICE_NAME "uart1"
/* SECTION: C++ support */ /* SECTION: C++ support */
/* Using C++ support*/ /* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */ /* #define RT_USING_CPLUSPLUS */
#define RT_USING_DFS #define RT_USING_DFS
#define RT_USING_DFS_EFSL /* #define RT_USING_DFS_EFSL */
/* byte alignment for EFSL */ /* byte alignment for EFSL */
#define BYTE_ALIGNMENT #define BYTE_ALIGNMENT
// #define RT_USING_DFS_ELMFAT
#define DFS_EFLS_USING_STATIC_CACHE #define RT_USING_DFS_ELMFAT
/* SECTION: DFS options */ #define RT_DFS_ELM_WORD_ACCESS
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 1 /* SECTION: DFS options */
/* the max number of opened files */ /* the max number of mounted filesystem */
#define DFS_FD_MAX 8 #define DFS_FILESYSTEMS_MAX 2
/* the max number of cached sector */ /* the max number of opened files */
#define DFS_CACHE_MAX_NUM 4 #define DFS_FD_MAX 8
/* the max number of cached sector */
/* SECTION: lwip, a lighwight TCP/IP protocol stack */ #define DFS_CACHE_MAX_NUM 4
/* Using lighweight TCP/IP protocol stack */
#define RT_USING_LWIP /* SECTION: lwip, a lighwight TCP/IP protocol stack */
/* Using lighweight TCP/IP protocol stack */
/* Trace LwIP protocol */ #define RT_USING_LWIP
/* #define RT_LWIP_DEBUG */
/* Trace LwIP protocol */
/* LwIP uses RT-Thread Memory Management */ /* #define RT_LWIP_DEBUG */
#define RT_LWIP_USING_RT_MEM
/* LwIP uses RT-Thread Memory Management */
/* Enable ICMP protocol */ #define RT_LWIP_USING_RT_MEM
#define RT_LWIP_ICMP
/* Enable ICMP protocol */
/* Enable IGMP protocol */ #define RT_LWIP_ICMP
/* #define RT_LWIP_IGMP */
/* Enable IGMP protocol */
/* Enable UDP protocol */ /* #define RT_LWIP_IGMP */
#define RT_LWIP_UDP
/* Enable UDP protocol */
/* Enable TCP protocol */ #define RT_LWIP_UDP
#define RT_LWIP_TCP
/* Enable TCP protocol */
/* the number of simulatenously active TCP connections */ #define RT_LWIP_TCP
#define RT_LWIP_TCP_PCB_NUM 3
/* the number of simulatenously active TCP connections */
/* TCP sender buffer space */ #define RT_LWIP_TCP_PCB_NUM 3
#define RT_LWIP_TCP_SND_BUF 2048
/* TCP sender buffer space */
/* Enable SNMP protocol */ #define RT_LWIP_TCP_SND_BUF 2048
/* #define RT_LWIP_SNMP */
/* Enable SNMP protocol */
/* Using DHCP */ /* #define RT_LWIP_SNMP */
#define RT_LWIP_DHCP
/* Using DHCP */
/* Using DNS */ #define RT_LWIP_DHCP
#define RT_LWIP_DNS
/* Using DNS */
/* ip address of target */ #define RT_LWIP_DNS
#define RT_LWIP_IPADDR0 192
#define RT_LWIP_IPADDR1 168 /* ip address of target */
#define RT_LWIP_IPADDR2 1 #define RT_LWIP_IPADDR0 192
#define RT_LWIP_IPADDR3 30 #define RT_LWIP_IPADDR1 168
#define RT_LWIP_IPADDR2 1
/* gateway address of target */ #define RT_LWIP_IPADDR3 30
#define RT_LWIP_GWADDR0 192
#define RT_LWIP_GWADDR1 168 /* gateway address of target */
#define RT_LWIP_GWADDR2 1 #define RT_LWIP_GWADDR0 192
#define RT_LWIP_GWADDR3 1 #define RT_LWIP_GWADDR1 168
#define RT_LWIP_GWADDR2 1
/* mask address of target */ #define RT_LWIP_GWADDR3 1
#define RT_LWIP_MSKADDR0 255
#define RT_LWIP_MSKADDR1 255 /* mask address of target */
#define RT_LWIP_MSKADDR2 255 #define RT_LWIP_MSKADDR0 255
#define RT_LWIP_MSKADDR3 0 #define RT_LWIP_MSKADDR1 255
#define RT_LWIP_MSKADDR2 255
/* tcp thread options */ #define RT_LWIP_MSKADDR3 0
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4 /* tcp thread options */
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024 #define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
/* ethernet if thread options */ #define RT_LWIP_TCPTHREAD_STACKSIZE 1024
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4 /* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_STACKSIZE 512 #define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
/* SECTION: RT-Thread/GUI */ #define RT_LWIP_ETHTHREAD_STACKSIZE 512
#define RT_USING_RTGUI
/* SECTION: RT-Thread/GUI */
#endif #define RT_USING_RTGUI
#endif
此差异已折叠。
此差异已折叠。
/*
* 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__ #ifndef __USART_H__
#define __USART_H__ #define __USART_H__
......
...@@ -95,7 +95,7 @@ int dfs_elm_unmount(struct dfs_filesystem* fs) ...@@ -95,7 +95,7 @@ int dfs_elm_unmount(struct dfs_filesystem* fs)
RT_ASSERT(fat != RT_NULL); RT_ASSERT(fat != RT_NULL);
/* elm not support unmount */ /* elm not support unmount */
RT_ASSERT(0); rt_kprintf("elm fatfs not support unmount\n");
return 0; return 0;
} }
......
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
#ifndef _FATFS #ifndef _FATFS
#define _FATFS 0x007C #define _FATFS 0x007C
#ifdef RT_DFS_ELM_WORD_ACCESS
#define _WORD_ACCESS 1
#else
#define _WORD_ACCESS 0 #define _WORD_ACCESS 0
#endif
/* The _WORD_ACCESS option defines which access method is used to the word /* The _WORD_ACCESS option defines which access method is used to the word
/ data in the FAT structure. / data in the FAT structure.
/ /
...@@ -104,7 +109,7 @@ ...@@ -104,7 +109,7 @@
*/ */
#define _USE_LFN 1 #define _USE_LFN 0
#define _MAX_LFN 255 /* Maximum LFN length to handle (max:255) */ #define _MAX_LFN 255 /* Maximum LFN length to handle (max:255) */
/* The _USE_LFN option switches the LFN support. /* The _USE_LFN option switches the LFN support.
/ /
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册