你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32 如何快速创建 FREERTOS和RTX 工程  

[复制链接]
lovewyufeng 发布时间:2015-1-8 12:08
阅读主题, 点击返回1楼
收藏 14 评论96 发布时间:2015-1-8 12:08
96个回答
moyanming2013 回答时间:2015-1-8 15:58:52
前来支持
我是东哥 回答时间:2015-1-8 16:20:57
看Freertos头文件Semphr.h的注释。
2) Resource management.
*    In this usage scenario the count value indicates the number of resources
*    available.  To obtain control of a resource a task must first obtain a
*    semaphore - decrementing the semaphore count value.  When the count value
*    reaches zero there are no free resources.  When a task finishes with the
*    resource it 'gives' the semaphore back - incrementing the semaphore count
*    value.  In this case it is desirable for the initial count value to be
*    equal to the maximum count value, indicating that all resources are free.
我是东哥 回答时间:2015-1-8 16:28:35
这种用法应该是先take,再give回去。而不是像第一种用法(也就是楼主说的常用用法)那样,需要先give,然后才能take。
我是东哥 回答时间:2015-1-8 16:31:40
刚刚贴的代码怎么不见了?再贴一遍头文件中的注释,很明了:
* Counting semaphores are typically used for two things:
*
* 1) Counting events.
*
*    In this usage scenario an event handler will 'give' a semaphore each time
*    an event occurs (incrementing the semaphore count value), and a handler
*    task will 'take' a semaphore each time it processes an event
*    (decrementing the semaphore count value).  The count value is therefore
*    the difference between the number of events that have occurred and the
*    number that have been processed.  In this case it is desirable for the
*    initial count value to be zero.
*
* 2) Resource management.
*
*    In this usage scenario the count value indicates the number of resources
*    available.  To obtain control of a resource a task must first obtain a
*    semaphore - decrementing the semaphore count value.  When the count value
*    reaches zero there are no free resources.  When a task finishes with the
*    resource it 'gives' the semaphore back - incrementing the semaphore count
*    value.  In this case it is desirable for the initial count value to be
*    equal to the maximum count value, indicating that all resources are free.
lovewyufeng 回答时间:2015-1-8 21:29:57
我是东哥 发表于 2015-1-8 16:28
这种用法应该是先take,再give回去。而不是像第一种用法(也就是楼主说的常用用法)那样,需要先give,然后 ...

是的  因为我的 资源一开始是不可用的  

这是典型的 生产消费问题

串口接收数据(生产)

线程消费数据  

一开始是没有现成的数据的

而这个 函数接口  只能以另一种方式使用那就是一开始就存在资源,这在实际使用中是不合理的!!
serge 回答时间:2015-1-8 21:50:06
支持楼主,留下记号,还能拿钱
lovewyufeng 回答时间:2015-1-9 08:38:07
serge 发表于 2015-1-8 21:50
支持楼主,留下记号,还能拿钱

哈哈 你来晚了钱都被他们拿完了~~
ataudio 回答时间:2015-1-13 14:16:31
楼主强帖,当然要支持了。好好向楼主学习。
maxiaoxiaoq 回答时间:2015-1-13 14:21:50
好贴,正好用的着啊。。
w453509596 回答时间:2015-1-13 23:25:01
楼主写的太好了,刚拿到开发板,我要好好学习一下

所属标签

STM32团队

意法半导体微控制器和微处理器拥有广泛的产品线,包含低成本的8位单片机和基于ARM® Cortex®-M0、M0+、M3、M4、M33、M7及A7内核并具备丰富外设选择的32位微控制器及微处理器


最新内容

相似技术帖

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版