当前位置:网站首页>Implementation analysis of 1325_FreeRTOS queue sending function
Implementation analysis of 1325_FreeRTOS queue sending function
2022-08-07 15:41:00 【grey_csdn】
All learning summary: GitHub - GreyZhang/g_FreeRTOS: learning notes about FreeRTOS.
I saw the creation function of the queue earlier, and today I will analyze the implementation of the sending function of the queue.

First of all, you need to know that, like the previous creation interface, this sending interface is actually a macro-defined wrapper implementation.And the general sending interface used by the packaging, one of the parameters in this is where to send to the queue.From this point of view, the general method is actually the orderly sending of the queue, first in first out, so the newly sent information is sent to the end of the queue.

The first part of the function is to judge some conditions.First, the queue must be valid, and the equivalent is actually the success of allocating storage space to the queue.Second, if the size of the data object passed in by the queue is not 0, then the address of the incoming object cannot be NULL.Third, only when the length of the queue is 1, the copy position will be an overwrite operation.Fourth, if you need to control the sending of the queue to wait for a valid tick value, you must ensure that the scheduler is running normally.The scheduler has three states: not started, suspended, and running normally.



Data copying is actually a very simple action, which is mainly processed from the perspective of queue element insertion position (before or after), whether to overwrite writing, etc.The core action is a memcpy.Regarding the application of the return value, it does not actually take effect in my current configuration. This feature is mainly used for mutexes.In general queuing applications, scheduling control triggered by priority will not be involved.

For the time being, let's analyze according to the actual design of the current system, then skip this paragraph first.

It can be seen from this that the mechanism of queue triggering tasks is still very efficient.This does not depend on interrupt information such as tick, but carries a possible task scheduling switch request in the send action.If the priority of the task is high enough, it can be activated directly.

Regarding the processing when the queue is full, there are two cases: direct error reporting and waiting.The latter's system tolerance seems to be stronger.


When the queue is full, the processing of the queue is performed according to whether the time expires.The processing is actually divided into two states of sending and receiving. In this process, it is necessary to consider the impact of interruptions, which will change the content of the queue. The logical level of this processing needs to be considered carefully.There may be many attempts in the entire sending process, and the final exit is success or failure.



In fact, there are not many effective parts of processing in this section, mainly dealing with data transmission in the process of queue locking.

The same processing concept, there should also be a processing process on the received data.From here, we can actually have a certain understanding of the infinite loop design of the sending interface, because such data changes may be a dynamic mode.This is very interesting and reminds me of a "dynamic clearing" argument.
The above is probably the implementation of queue transmission, mainly the information processing of the borrowed linked list and the delayed linked list, with the addition of data handling in the middle.
边栏推荐
- jmter中函数助手的使用
- 苹果,设计思维的“布道者”
- [Advanced Mathematics] Advanced Number Arrangement: Common Equivalent Infinitesimals, Derivatives and Differentials, Differential Equations
- The two day summary ([18], [19])
- AdaptFormer学习笔记
- 模型预测值全零或者全一
- Solutions after data files are not deleted correctly
- make编译源码时报error: ‘for’ loop initial declarations are only allowed in C99 mode的解决办法
- mysql5.7安装和配置教程(图文超详细版)
- LeetCode Daily 2 Questions 01: Rotating Arrays (both 1200 questions)
猜你喜欢
![【通信原理】第三章 -- 随机过程[补充]](/img/47/0607ab885999d85dfcc3f8ef00c38a.png)
【通信原理】第三章 -- 随机过程[补充]
![[Principle of Database System] Chapter 4 Advanced Database Model: E/R Model and Its Design Rules and Constraints](/img/67/c6ee5068487bb812c8092fce7ad81c.png)
[Principle of Database System] Chapter 4 Advanced Database Model: E/R Model and Its Design Rules and Constraints

BTC相关收入下降34% 数字支付巨头Block整体收入下滑

RTT学习笔记8-RTT内核移植

RTT学习笔记12-串口外设和串口驱动框架

OpenCV 颜色检测| color detection
![[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form](/img/1a/e97745e62287fcf494d1479deaa632.png)
[Principle of Database System] Chapter 3 BC Normal Form, Third Normal Form and Fourth Normal Form

Chapter 219 New SSM Integration - Getting Through Mysql Database Control Transactions (including interview questions)

TCP/UDP协议

mysql5.7安装和配置教程(图文超详细版)
随机推荐
The use of function helpers in jmter
LeetCode 热题 HOT 100(7.盛最多水的容器)
make编译源码时报error: ‘for’ loop initial declarations are only allowed in C99 mode的解决办法
LeetCode每日两题01:删除排序数组中的重复项 (均1200道)
【Verilog】Verilog基础知识整理
win10 uwp BadgeLogo 颜色
实用代码使用浏览器添加书签方式来一键获取网页所需内容链接技巧分享
MCU各种相关架构分析
Qt 打开以及创建项目、运行程序
MySQL-进阶CRUD
冒泡排序的理解
嵌入式设备参数存储技巧
"Short Video" Gansu Province introduced the "14th Five-Year" cold chain logistics high-quality development plan to create a 1-hour fresh agricultural product logistics circle
1325_FreeRTOS队列发送函数的实现分析
LeetCode Daily 2 Questions 01: Delete Duplicates in Sorted Arrays (both 1200 questions)
LeetCode每日一题(911. Online Election)
OpenCV 颜色检测| color detection
C语言文件读写操作/标准IO
微信小程序——swiper内容水平垂直居中
小技巧——postman get&&post请求的使用方式