Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

已更新 2025年6月

xSendEventStructToIPTask()

[以太网驱动程序移植 API]

FreeRTOS_IP_Private.h

1BaseType_t xSendEventStructToIPTask( const IPStackEvent_t *pxEvent, TickType_t xTimeout );
2

xSendEventStructToIPTask() 在整个嵌入式 TCP/IP 堆栈的 实现中被用于将各种事件发送至 RTOS 任务, 该任务正在运行嵌入式 TCP/IP 堆栈。该函数可供网络端口层使用, 以便网络端口层可以将接收事件发送到相同的 RTOS 任务。

参数:

  • pxEvent

    指向 IPStackEvent_t 类型的结构体的指针。

    1typedef struct IP_TASK_COMMANDS
    2{
    3 /* Specifies the type of event being posted to the RTOS task. Must be set to
    4 eNetworkRxEvent to signify a receive event. */
    5 eIPEvent_t eEventType;
    6
    7 /* Points to additional data about the event. Set pvData to the address
    8 of the network buffer descriptor that references the received frame. */
    9 void *pvData;

} IPStackEvent_t;

1*IPStackEvent_t 类型*
2
3+ *xTimeout*
4
5 无法立即发送消息时,等待发送消息的时间(以 RTOS tick 为单位),
6 消息将发送至 RTOS 任务,
7 该任务正在运行嵌入式 TCP/IP 堆栈。
8 如果
9 [网络事件队列已满](../TCP_IP_Configuration.md#ipconfigEVENT_QUEUE_LENGTH),则可能无法立即发送消息。
10
11
12**返回:**
13
14如果事件已成功发送至 RTOS 任务,
15而该任务正在运行嵌入式 TCP/IP 堆栈,则返回 pdPASS。如果 xTimeout 大于
16零,则调用任务可能已保持在阻塞状态(因此
17不消耗任何 CPU 时间)以等待消息发送,但
18在函数返回之前,消息已成功发送。
19
20如果由于网络事件队列已满而无法向 RTOS 任务发送事件,
21(该任务正在运行嵌入式 TCP/IP 堆栈),[](../TCP_IP_Configuration.md#ipconfigEVENT_QUEUE_LENGTH)
22则返回 pdFAIL。如果 xTimeout 大于零,则
23调用任务可能已保持在阻塞状态以等待
24网络事件队列上的可用空间,但在那之前
25阻塞时间已过期。
26
27
28**用法示例:**
29
30[“将 FreeRTOS 移植到不同的微控制器”](../Embedded_Ethernet_Porting.md)页面上提供了示例
31。在该页面搜索 xSendEventStructToIPTask() 以查找示例
32源代码。
33
34