資源簡介
RT-Thread 是一款主要由中國開源社區主導開發的開源實時操作系統。實時線程操作系統不僅僅是一個單一的實時操作系統內核,它也是一個完整的應用系統,包含了實時、嵌入式系統相關的各個組件:TCP/IP協議棧,文件系統,libc接口,圖形用戶界面等。性能優于一般的ucos-ii系統。

代碼片段和文件信息
/*
?*?File??????:?app.c
?*?This?file?is?part?of?RT-Thread?RTOS
?*?COPYRIGHT?(C)?2006?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://openlab.rt-thread.com/license/LICENSE
?*
?*?Change?Logs:
?*?Date???????????Author???????Notes
?*?2009-01-05?????Bernard??????the?first?version
?*/
/**
?*?@addtogroup?STM32
?*/
/*@{*/
#include?
#include?
char?thread1_stack[0x120];
char?thread2_stack[0x120];
struct?rt_thread?thread1;
struct?rt_thread?thread2;
void?thread1_entry(void*?parameter)
{
rt_uint32_t?i?=?0;
while?(1)
{
rt_kprintf(“thread1?-->?%d\n“?++i);
rt_thread_delay(100);
}
}
/*?UART?received?msg?structure?*/
struct?rx_msg
{
rt_device_t?dev;
rt_size_t?size;
};
/*?message?queue?for?Rx?*/
static?rt_mq_t?rx_mq;
static?char?uart_rx_buffer[64];
rt_err_t?uart_input(rt_device_t?dev?rt_size_t?size)
{
struct?rx_msg?msg;
msg.dev??=?dev;
msg.size?=?size;
/*?send?message?to?message?queue?*/
rt_mq_send(rx_mq?&msg?sizeof(struct?rx_msg));
return?RT_EOK;
}
void?thread2_entry(void*?parameter)
{
struct?rx_msg?msg;
int?count?=?0;
rt_device_t?device?write_device;
rt_err_t?result?=?RT_EOK;
device?=?rt_device_find(“uart3“);
if?(device?!=?RT_NULL)
{
rt_device_set_rx_indicate(device?uart_input);
rt_device_open(device?RT_DEVICE_OFLAG_RDWR);
}
/*?set?write?device?*/
write_device?=?device;
device?=?rt_device_find(“uart2“);
if?(device?!=?RT_NULL)
{
rt_device_set_rx_indicate(device?uart_input);
rt_device_open(device?RT_DEVICE_OFLAG_RDWR);
}
while?(1)
{
result?=?rt_mq_recv(rx_mq?&msg?sizeof(struct?rx_msg)?50);
if?(result?==?-RT_ETIMEOUT)
{
/*?rx?timeout?*/
rt_kprintf(“Thread2?count:%d\n“?++count);
//?rt_device_write(device?0?&test_str[0]?sizeof(test_str)?-?1);
}
if?(result?==?RT_EOK)
{
rt_uint32_t?rx_length;
rx_length?=?(sizeof(uart_rx_buffer)?-?1)?>?msg.size??
msg.size?:?sizeof(uart_rx_buffer)?-?1;
rx_length?=?rt_device_read(msg.dev?0?&uart_rx_buffer[0]?rx_length);
uart_rx_buffer[rx_length]?=?‘\0‘;
rt_kprintf(“%s“?&uart_rx_buffer[0]);
rt_device_write(msg.dev?0?&uart_rx_buffer[0]?rx_length);
/*?write?to?device:uart3?too?*/
if?(write_device?!=?RT_NULL)
rt_device_write(write_device?0?&uart_rx_buffer[0]?rx_length);
}
}
}
#ifdef?RT_USING_DFS
/*?dfs?init?*/
#include?
/*?dfs?filesystem:EFS?filesystem?init?*/
#include?
/*?dfs?Filesystem?APIs?*/
#include?
#endif
/*?thread?phase?init?*/
void?rt_init_thread_entry(void?*parameter)
{
/*?Filesystem?Initialization?*/
#ifdef?RT_USING_DFS
{
/*?init?the?device?filesystem?*/
dfs_init();
/*?init?the?efsl?filesystam*/
efsl_init();
/*?mount?sd?card?fat?partition?1?as?root?directory?*/
if?(dfs_mount(“sd0“?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2009-05-05?10:29??rt-thread?0.3.0\
?????文件?????????721??2009-03-22?18:49??rt-thread?0.3.0\AUTHORS
?????目錄???????????0??2009-05-05?10:29??rt-thread?0.3.0\bsp\
?????目錄???????????0??2009-05-05?10:29??rt-thread?0.3.0\bsp\stm32f103vb\
?????文件????????3869??2009-05-05?10:29??rt-thread?0.3.0\bsp\stm32f103vb\application.c
?????文件????????6091??2009-04-29?20:14??rt-thread?0.3.0\bsp\stm32f103vb\board.c
?????文件?????????566??2009-04-12?14:19??rt-thread?0.3.0\bsp\stm32f103vb\board.h
?????文件????????9403??2009-05-04?07:01??rt-thread?0.3.0\bsp\stm32f103vb\cortexm3_macro.s
?????目錄???????????0??2009-05-05?10:29??rt-thread?0.3.0\bsp\stm32f103vb\library\
?????目錄???????????0??2009-05-05?10:29??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\
?????文件????????2225??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\cortexm3_macro.h
?????文件???????18854??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_adc.h
?????文件????????6911??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_bkp.h
?????文件???????12279??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_can.h
?????文件????????1881??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_crc.h
?????文件????????9598??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_dac.h
?????文件????????2865??2009-05-04?20:17??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_dbgmcu.h
?????文件???????17974??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_dma.h
?????文件????????5776??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_exti.h
?????文件???????13996??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_flash.h
?????文件???????18005??2009-05-04?20:17??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_fsmc.h
?????文件???????14820??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_gpio.h
?????文件???????15693??2009-05-04?20:17??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_i2c.h
?????文件????????3414??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_iwdg.h
?????文件????????3200??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_lib.h
?????文件??????500262??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_map.h
?????文件???????19198??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_nvic.h
?????文件????????3865??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_pwr.h
?????文件???????14783??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_rcc.h
?????文件????????3619??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_rtc.h
?????文件???????18326??2008-09-21?15:16??rt-thread?0.3.0\bsp\stm32f103vb\library\inc\stm32f10x_sdio.h
............此處省略166個文件信息
- 上一篇:franc2dl數值模擬
- 下一篇:播放黑屏的需要先安裝視頻驅動.txt
評論
共有 條評論