FreeRTOS API Reference

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

Previous topic - Next topic

tha

https://www.freertos.org/a00128.html



INCLUDE_uxTaskPriorityGet ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

ได้รับ the priority ของ task ใดๆ.

Parameters:

     xTask           Handle of the task ที่ถูกสอบถาม. ส่งผ่าน a NULL handle ส่งผลให้ the priority ของ the calling task ถูกส่งกลับ.

Returns:

     The priority ของ xTask


tha

https://www.freertos.org/a00129.html



INCLUDE_vTaskPrioritySet ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

ตั้งค่า the priority ของ task ใดๆ.

A context switch จะเกิดขึ้นก่อน the function รีเทิร์นถ้า the priority ที่กำลังถูกเซ็ตสูงกว่า the currently executing task.

Parameters:

     xTask                    Handle of the task ที่ priority กำลังถูกเซ็ต. A NULL handle เซ็ต the priority ของ the calling task.

     uxNewPriority        The priority ที่ the task จะถูกเซ็ต.

                                 Priorities ถูกถือสิทธิ์จะน้อยกว่า configMAX_PRIORITIES. ถ้า configASSERT ไม่ถูกกำหนด, priorities จะถูกจำกัดไว้ที่
                                 (configMAX_PRIORITIES - 1).


tha

https://www.freertos.org/a00130.html



INCLUDE_vTaskSuspend ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

ระงับ task ใดๆ. เมื่อถูกระงับ a task จะไม่ได้รับ microcontroller processing time ใดๆ, ไม่ว่า priority ของมันเป็นเท่าใด.

การเรียกไปยัง vTaskSuspend จะไม่เกิดการสะสม - เช่น การเรียก vTaskSuspend () สองครั้งใน task เดียวกันยังคงต้องการการเรียก vTaskResume () เพียงครั้งเดียวเพื่อพร้อม the suspended task.

Parameters:

     xTaskToSuspend          Handle to the task ที่กำลังถูกระงับ. ส่งผ่าน a NULL handle จะเป็นเหตุให้ the calling task ถูกระงับ.



tha

https://www.freertos.org/a00131.html



INCLUDE_vTaskSuspend ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

กลับมาทำงานต่อ a suspended task.

A task ที่ถูกระงับแล้วโดยการเรียกหนึ่งครั้งหรือมากกว่านั้นไปยัง vTaskSuspend () จะทำให้รันได้อีกครั้งโดยการเรียกครั้งเดียวไปยัง vTaskResume ().

Parameters:

     xTaskToResume         Handle to the task ที่กำลังถูกพร้อม.


tha

https://www.freertos.org/taskresumefromisr.html



INCLUDE_vTaskSuspend and INCLUDE_xTaskResumeFromISR ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

A function เพื่อกลับมาทำงานต่อ a suspended task ที่สามารถถูกเรียกจากภายใน an ISR.

A task ที่ถูกระงับแล้วโดยการเรียกหนึ่งครั้งหรือมากกว่านั้นไปยัง vTaskSuspend () จะทำให้รันได้อีกครั้งโดยการเรียกครั้งเดียวไปยัง xTaskResumeFromISR().

xTaskResumeFromISR() โดยทั่วไปแล้วถือว่าเป็นฟังชั่นที่อันตรายเนื่องจากการกระทำของมันไม่ได้ถูกล็อคไว้.  ด้วยเหตุผลนี้ จึงไม่ควรใช้เพื่อซิงโครไนซ์ a task กับ an interrupt หากมีโอกาสที่ the interrupt สามารถมาถึงก่อน the task ถูกระงับ, และดังนั้น the interrupt จะหายไป.  ใช้ a semaphore, หรือ a direct to task notification ดีกว่า, จะช่วยหลีกเลี่ยงเหตุการณ์นี้. ตัวอย่างการทำงานที่ใช้ a direct to task notification ถูกจัดให้มี.

Parameters:

     xTaskToResume         Handle to the task ที่กำลังพร้อม.

Returns:

     pdTRUE ถ้าการกลับมาทำงานต่อ the task ส่งผลให้เกิด a context switch, ถ้าเป็นอย่างอื่น pdFALSE. นี้ถูกใช้โดย the ISR เพื่อตัดสินว่า a context switch
     อาจถูกต้องการหลังจาก the ISR หรือไม่.




tha

https://www.freertos.org/xTaskAbortDelay.html



บังคับให้ a task ออกจาก the Blocked state, และเข้าสู่ the Ready state, ถึงแม้ว่า the event ที่ the task เคยอยู่ใน the Blocked state เพื่อรอนั้นจะไม่เกิดขึ้น, และ timeout ที่ระบุใดๆไม่ได้หมดเวลาลง.

INCLUDE_xTaskAbortDelay ต้องถูกกำหนดเป็น 1 สำหรับฟังชั่นนี้มีใช้ให้ประโยชน์. ดู the RTOS Configuration documentation สำหรับข้อมูลเพิ่มเติม.

Parameters:

     xTask         The handle of the task ที่จะถูกบังคับให้ออกจาก the Blocked state.

                      เพื่อรับ a task's handle ที่สร้าง the task โดยใช้ xTaskCreate() และใช้ประโยชน์จาก the pxCreatedTask parameter, หรือสร้าง the task
                      โดยใช้ xTaskCreateStatic() และเก็บ the returned value, หรือใช้ the task's name ในการเรียกถึง xTaskGetHandle().

Returns:

     ถ้า the task ที่อ้างอิงโดย xTask ไม่อยู่ใน the Blocked state ดังนั้น pdFAIL จะถูกรีเทิร์น. ถ้าเป็นอย่างอื่น pdPASS จะถูกรีเทิร์น.


tha