资源简介
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
相关资源
- Quectel_LTE&5G_Linux_USB_Driver_User_Guide_V2.
- boa-0.94.13
- 嵌入式系统linux学习心得
- UCOS-II_API函数参考手册(带书签)
- 嵌入式系统原理与设计 机械工业出版
- 华为面试真题-嵌入式软件.pdf
- 嵌入式作业-交通灯使用
- 第十届蓝桥杯嵌入式方向程序设计题
- 第十届蓝桥杯嵌入式比赛备赛 资料汇
- 实验三:键盘显示自己的学号
- MC9S12G128 bootloader
- STM32制作的贪吃蛇小游戏
- 一步一步写嵌入式操作系统--ARM编程的
- 韦东山视频资料整合
- STM32F103ZET6库函数模板
- 《嵌入式Linux驱动开发教程》书中完整
- STM32嵌入式大棚系统设计
- 基于s3c2410的嵌入式时钟设计源码
- 电子相册--QT
- 嵌入式系统课程设计报告
- 基于嵌入式的电子相册设计
- 嵌入式系统设计课程设计
- 2014达内嵌入式.txt
- 韦东山嵌入式开发视频
- 2018电子设计竞赛TI公司ADS1118keil源码
- 嵌入式AD转换
- 嵌入式Linux视频教程完整视频
- 嵌入式LGUI源代码-学习嵌入式GUI设计开
- 嵌入式系统课后习题答案
- HTK嵌入式ARM移植步骤
评论
共有 条评论