FreeRTOS API Reference

Started by tha, December 07, 2021, 06:05:54 AM

Previous topic - Next topic

tha



Returns:

     The task handle ที่เกี่ยวข้องกับ the Idle task. The Idle task ถูกสร้างโดยอัตโนมัติเมื่อ the RTOS scheduler ถูกสตาร์ท.

tha



ส่งคืนกลับเป็น an enumerated type ถึง the state ซึ่ง a task มีอยู่ในเวลาที่ eTaskGetState() ถูกปฏิบัติแล้ว.

INCLUDE_eTaskGetState ต้องถูกเซ็ตเป็น 1 ใน FreeRTOSConfig.h เพื่อ eTaskGetState() มีให้ใช้เป็นประโยชน์.

ดู vTaskGetInfo() ด้วย.

Parameters:

     xTask          The handle of the subject task (the task ที่ถูกสอบถาม).

Returns:

     ตารางด้านล่างแสดงรายการค่าที่ eTaskGetState() จะส่งคืนกลับสำหรับแต่ละสถานะที่เป็นไปได้ที่ the task ที่อ้างอิงโดยพารามิเตอร์ xTask สามารถมีอยู่ได้


tha



ค้นหาชื่อของ a task จาก the task's handle.

Parameters:

     xTaskToQuery       The handle of the task ที่กำลังถูกสอบถาม. xTaskToQuery สามารถถูกเซ็ตเป็น NULL เพื่อสอบถามชื่อของ the calling task.

Returns:

     A pointer ไปยัง the subject task's name, ซึ่งเป็นมาตรฐาน C string ที่สิ้นสุดด้วยค่า NULL.


tha

xTaskGetHandle

task.h

TaskHandle_t xTaskGetHandle( const char *pcNameToQuery );

ค้นหา the handle of a task จาก the task's name.

หมายเหตุ: ฟังก์ชันนี้ใช้เวลาค่อนข้างนานถึงจะเสร็จ และควรเรียกเพียงครั้งเดียวสำหรับแต่ละ task. เมื่อ the handle of a task ถูกได้รับแล้วมันสามารถถูกเก็บแบบ locally
                  สำหรับการใช้ซ้ำ.

INCLUDE_xTaskGetHandle ต้องถูกเซ็ตเป็น 1 ใน FreeRTOSConfig.h เพื่อ xTaskGetHandle() มีให้ใช้เป็นประโยชน์.

Parameters:

     pcNameToQuery    The text name (เป็นมาตรฐาน C ที่สิ้นสุดด้วยค่า NULL string) ของ the task ซึ่ง the handle จะถูกรีเทิร์น.

                                        ดู the pcName parameter of the xTaskCreate() and xTaskCreateStatic() API functions สำหรับข้อมูลเกี่ยวกับการตั้งค่า
                                        the text name of a task.

Returns:

     ถ้า a task ที่ the name ส่งผ่านใน pcNameToQuery สามารถหาตำแหน่งได้ดังนั้น the handle of the task จะถูกส่งคืนกลับ, มิฉะนั้น NULL จะถูกส่งคืนกลับ.

tha

xTaskGetTickCount

task.h

volatile TickType_t xTaskGetTickCount( void );

ฟังชั่นนี้ไม่สามารถถูกเรียกจาก an ISR. ใช้ xTaskGetTickCountFromISR() แทน.

Returns:

     จำนวน ticks ตั้งแต่ vTaskStartScheduler ถูกเรียก.

tha

xTaskGetTickCountFromISR

task.h

volatile TickType_t xTaskGetTickCountFromISR( void );

A version ของ xTaskGetTickCount() ที่สามารถถูกเรียกจาก an ISR.

Returns:

     จำนวน ticks ตั้งแต่ vTaskStartScheduler ถูกเรียก.

tha

xTaskGetSchedulerState

task.h

BaseType_t xTaskGetSchedulerState( void );

Returns:

     หนึ่งในค่าคงที่ต่อไปนี้ (ที่กำหนดไว้ใน task.h): taskSCHEDULER_NOT_STARTED, taskSCHEDULER_RUNNING, taskSCHEDULER_SUSPENDED.

     INCLUDE_xTaskGetSchedulerState or configUSE_TIMERS ต้องถูกเซ็ตเป็น 1 ใน FreeRTOSConfig.h เพื่อฟังชั่นนี้มีให้ใช้เป็นประโยชน์.

tha

uxTaskGetNumberOfTasks

task.h

UBaseType_t uxTaskGetNumberOfTasks( void );

Returns:

     จำนวนของ tasks ที่ the RTOS kernel ปัจจุบันกำลังจัดการอยู่. นี้รวม ready, blocked and suspended tasks ทั้งหมด. A task ที่ถูกลบแล้วแต่ยังไม่ได้ถูก
     ปล่อยฟรีโดย the idle task จะถูกรวมในการนับด้วย.