提交 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)
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();
}
}
此差异已折叠。
......@@ -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>
......
/* RT-Thread config file */
#ifndef __RTTHREAD_CFG_H__
#define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/
#define RT_NAME_MAX 8
/* RT_ALIGN_SIZE*/
#define RT_ALIGN_SIZE 4
/* PRIORITY_MAX*/
#define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second*/
#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
/* Thread Debug*/
#define RT_DEBUG
/* #define RT_THREAD_DEBUG */
#define RT_USING_OVERFLOW_CHECK
/* Using Hook*/
#define RT_USING_HOOK
/* SECTION: IPC */
/* Using Semaphore*/
#define RT_USING_SEMAPHORE
/* Using Mutex*/
#define RT_USING_MUTEX
/* Using Event*/
#define RT_USING_EVENT
/* Using MailBox*/
#define RT_USING_MAILBOX
/* Using Message Queue*/
#define RT_USING_MESSAGEQUEUE
/* SECTION: Memory Management */
/* Using Memory Pool Management*/
#define RT_USING_MEMPOOL
/* Using Dynamic Heap Management*/
#define RT_USING_HEAP
/* Using Small MM*/
#define RT_USING_SMALL_MEM
/* Using SLAB Allocator*/
/* #define RT_USING_SLAB */
/* SECTION: Device System */
/* Using Device System*/
#define RT_USING_DEVICE
#define RT_USING_UART1
// #define RT_USING_UART2
// #define RT_USING_UART3
/* SECTION: Console options */
/* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 128
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
#define RT_USING_FINSH
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_DEVICE_NAME "uart1"
/* SECTION: C++ support */
/* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */
#define RT_USING_DFS
#define RT_USING_DFS_EFSL
/* byte alignment for EFSL */
#define BYTE_ALIGNMENT
// #define RT_USING_DFS_ELMFAT
#define DFS_EFLS_USING_STATIC_CACHE
/* SECTION: DFS options */
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 1
/* the max number of opened files */
#define DFS_FD_MAX 8
/* the max number of cached sector */
#define DFS_CACHE_MAX_NUM 4
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
/* Using lighweight TCP/IP protocol stack */
#define RT_USING_LWIP
/* Trace LwIP protocol */
/* #define RT_LWIP_DEBUG */
/* LwIP uses RT-Thread Memory Management */
#define RT_LWIP_USING_RT_MEM
/* Enable ICMP protocol */
#define RT_LWIP_ICMP
/* Enable IGMP protocol */
/* #define RT_LWIP_IGMP */
/* Enable UDP protocol */
#define RT_LWIP_UDP
/* Enable TCP protocol */
#define RT_LWIP_TCP
/* the number of simulatenously active TCP connections */
#define RT_LWIP_TCP_PCB_NUM 3
/* TCP sender buffer space */
#define RT_LWIP_TCP_SND_BUF 2048
/* Enable SNMP protocol */
/* #define RT_LWIP_SNMP */
/* Using DHCP */
#define RT_LWIP_DHCP
/* Using DNS */
#define RT_LWIP_DNS
/* ip address of target */
#define RT_LWIP_IPADDR0 192
#define RT_LWIP_IPADDR1 168
#define RT_LWIP_IPADDR2 1
#define RT_LWIP_IPADDR3 30
/* gateway address of target */
#define RT_LWIP_GWADDR0 192
#define RT_LWIP_GWADDR1 168
#define RT_LWIP_GWADDR2 1
#define RT_LWIP_GWADDR3 1
/* mask address of target */
#define RT_LWIP_MSKADDR0 255
#define RT_LWIP_MSKADDR1 255
#define RT_LWIP_MSKADDR2 255
#define RT_LWIP_MSKADDR3 0
/* tcp thread options */
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
/* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
/* SECTION: RT-Thread/GUI */
#define RT_USING_RTGUI
#endif
/* RT-Thread config file */
#ifndef __RTTHREAD_CFG_H__
#define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/
#define RT_NAME_MAX 8
/* RT_ALIGN_SIZE*/
#define RT_ALIGN_SIZE 4
/* PRIORITY_MAX*/
#define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second*/
#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
/* Thread Debug*/
#define RT_DEBUG
/* #define RT_THREAD_DEBUG */
#define RT_USING_OVERFLOW_CHECK
/* Using Hook*/
#define RT_USING_HOOK
/* SECTION: IPC */
/* Using Semaphore*/
#define RT_USING_SEMAPHORE
/* Using Mutex*/
#define RT_USING_MUTEX
/* Using Event*/
#define RT_USING_EVENT
/* Using MailBox*/
#define RT_USING_MAILBOX
/* Using Message Queue*/
#define RT_USING_MESSAGEQUEUE
/* SECTION: Memory Management */
/* Using Memory Pool Management*/
#define RT_USING_MEMPOOL
/* Using Dynamic Heap Management*/
#define RT_USING_HEAP
/* Using Small MM*/
#define RT_USING_SMALL_MEM
/* Using SLAB Allocator*/
/* #define RT_USING_SLAB */
/* SECTION: Device System */
/* Using Device System*/
#define RT_USING_DEVICE
#define RT_USING_UART1
// #define RT_USING_UART2
// #define RT_USING_UART3
/* SECTION: Console options */
/* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 128
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
#define RT_USING_FINSH
/* Using symbol table */
#define FINSH_USING_SYMTAB
#define FINSH_USING_DESCRIPTION
#define FINSH_DEVICE_NAME "uart1"
/* SECTION: C++ support */
/* Using C++ support*/
/* #define RT_USING_CPLUSPLUS */
#define RT_USING_DFS
/* #define RT_USING_DFS_EFSL */
/* byte alignment for EFSL */
#define BYTE_ALIGNMENT
#define RT_USING_DFS_ELMFAT
#define RT_DFS_ELM_WORD_ACCESS
/* SECTION: DFS options */
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2
/* the max number of opened files */
#define DFS_FD_MAX 8
/* the max number of cached sector */
#define DFS_CACHE_MAX_NUM 4
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
/* Using lighweight TCP/IP protocol stack */
#define RT_USING_LWIP
/* Trace LwIP protocol */
/* #define RT_LWIP_DEBUG */
/* LwIP uses RT-Thread Memory Management */
#define RT_LWIP_USING_RT_MEM
/* Enable ICMP protocol */
#define RT_LWIP_ICMP
/* Enable IGMP protocol */
/* #define RT_LWIP_IGMP */
/* Enable UDP protocol */
#define RT_LWIP_UDP
/* Enable TCP protocol */
#define RT_LWIP_TCP
/* the number of simulatenously active TCP connections */
#define RT_LWIP_TCP_PCB_NUM 3
/* TCP sender buffer space */
#define RT_LWIP_TCP_SND_BUF 2048
/* Enable SNMP protocol */
/* #define RT_LWIP_SNMP */
/* Using DHCP */
#define RT_LWIP_DHCP
/* Using DNS */
#define RT_LWIP_DNS
/* ip address of target */
#define RT_LWIP_IPADDR0 192
#define RT_LWIP_IPADDR1 168
#define RT_LWIP_IPADDR2 1
#define RT_LWIP_IPADDR3 30
/* gateway address of target */
#define RT_LWIP_GWADDR0 192
#define RT_LWIP_GWADDR1 168
#define RT_LWIP_GWADDR2 1
#define RT_LWIP_GWADDR3 1
/* mask address of target */
#define RT_LWIP_MSKADDR0 255
#define RT_LWIP_MSKADDR1 255
#define RT_LWIP_MSKADDR2 255
#define RT_LWIP_MSKADDR3 0
/* tcp thread options */
#define RT_LWIP_TCPTHREAD_PRIORITY 10
#define RT_LWIP_TCPTHREAD_MBOX_SIZE 4
#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
/* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_PRIORITY 12
#define RT_LWIP_ETHTHREAD_MBOX_SIZE 4
#define RT_LWIP_ETHTHREAD_STACKSIZE 512
/* SECTION: RT-Thread/GUI */
#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__
#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.
/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册