UC/OSⅡ Basic Functions *************************************************** ************************************ * Event Flags Management * * OSFlagAccept() Check event flag group function (flag group pointer, event flag bit, way to wait for event flag bit, error code pointer) * OSFlagCreate() creates an event flag group (initial value, error code) * OSFlagDel() deletes an event flag group (pointer, condition value, error value) * OSFlagPend() Wait for the event flag of the event flag group (event group pointer, flag to be checked, method of waiting for the event flag, * Allows waiting clock ticks, error code clock ticks) * OSFlagPost() sets or clears the flag bit in the event flag group (pointer, flag bit, condition value, error code) * OSFlagQuery() queries the current event flag status of the event flag group (pointer to the event flag group, pointer to the error code) *************************************************** ************************************ *************************************************** ************************************ * MESSAGE MAILBOX MANAGEMENT * * OSMboxAccept () Check the message mailbox (message mailbox pointer) * OSMboxCreate () creates and initializes a message mailbox (the msg parameter is not empty and contains content) * OSMboxDel() deletes the message mailbox (message mailbox pointer, deletion condition, error code pointer) * OSMboxPend () Wait for a message mailbox function (message mailbox pointer, clock beats allowed to wait, code error pointer) * OSMboxPost () Send message function (message mailbox pointer, the message to be actually sent to the task) * OSMboxPostOpt () sends a message to the mailbox (mailbox pointer, message, condition) * OSMboxQuery () queries the current status of a mailbox (semaphore pointer, status data structure pointer) *************************************************** ************************************ *************************************************** ************************************ * Memory Management * OSMemCreate () creates and initializes a memory area (starting address, number of memory blocks required, memory block size, returns an error pointer) * OSMemGet () allocates a memory block from a memory area * OSMemPut () releases a memory block. The memory block must be released back to the originally requested memory area. * OSMemQuery () Get information about the memory area *************************************************** ************************************ *************************************************** ************************************ * MUTUAL EXCLUSION SEMAPHORE MANAGEMENT * * OSMutexAccept () Gets a mutex semaphore without waiting [task does not hang] (semaphore pointer, error code) * OSMutexCreate () Create and initialize a mutex semaphore (priority inheritance priority (PIP), error code pointer) * OSMutexDel () deletes the mutex semaphore (signal pointer, deletion condition, error pointer) * OSMutexPend () Wait for a mutex semaphore (pointer, wait timeout limit, error code pointer) * OSMutexPost () Release a mutex semaphore (mutex semaphore pointer) * OSMutexQuery () queries the current state of a mutex semaphore (mutex semaphore pointer, state data structure pointer) *************************************************** ************************************ *************************************************** ************************************ * Message Queue Management * * OSQAccept () checks whether the required message is already in the message queue (pointer to the message queue) * OSQCreate () creates a message queue (base address of the message memory area (pointer array), size of the message memory area) * OSQDel () deletes a message queue (message queue pointer, deletion condition, error pointer) * OSQFlush () clears the message queue (pointer to the message queue) * OSQPend () Task waits for messages in the message queue (message queue pointer, clock beats allowed to wait, code error pointer) * OSQPost () sends a message to the message queue FIFO (message queue pointer, sent message) * OSQPostFront () sends a message to the message queue LIFO (message queue pointer, sent message) * OSQPostOpt () sends a message to the message queue LIFO (message queue pointer, message to be sent, sending conditions) * OSQQuery () queries the current state of a message queue (semaphore pointer, state data structure pointer) *************************************************** ************************************ The queue control block is a data structure used to maintain message queue information. It contains the following fields. Here, we still add A [.] to indicate that they are a field in a data structure. * 1).OSQPtr: Links all queue control blocks in the free queue control block. Once a message queue is created, this field is no longer useful. * 2).OSQStart: is a pointer to the starting address of the pointer array of the message queue. The user application must define this array before using the message queue. * 3).OSQEnd: is a pointer to the next address of the end unit of the message queue. This pointer makes the message queue form a circular buffer. * 4).OSQIn: is a pointer to the location in the message queue where the next message is inserted. When .OSQIn and .OSQEnd are equal, .OSQIn is adjusted to point to The starting unit of the message queue. * 5).OSQOut: is a pointer to the location of the next message to be taken out of the message queue. When .OSQOut and .OSQEnd are equal, .OSQOut is adjusted to point to the starting unit of the message queue. * 6).OSQSize: is the total number of units in the message queue. This value is determined by the user application when the message queue is established. In uC/OS-II, the maximum value can be 65,535. * 7).OSQEntries: is the current number of messages in the message queue. When the message queue is empty, the value is 0. When the message queue is full, the value is the same as .OSQSize. When the message queue is just created, the value is 0. *************************************************** ************************************ /* *************************************************** ********************************************** * Task Management * * OSTaskChangePrio () Change the priority of a task (task old priority, task new priority) * OSTaskCreate () creates a task (task code pointer, transfer parameter pointer, allocate task stack top pointer, task priority) * OSTaskCreateExt () creates an extended task (task code pointer/pass parameter pointer/allocate task stack top pointer/allocate task priority * //(Future) priority identifier (same as priority)/allocate task stack bottom pointer/specify stack capacity (for inspection) * //Pointer to user-added data field/create task setting options) * OSTaskDel () deletes the task (task priority) * OSTaskDelReq () Requests a task to delete other tasks or itself? (Task priority) * OSTaskResume () wakes up a task suspended by OSTaskSuspend() function (task priority) * OSTaskStkChk () Check the task stack status (task priority, check stack data structure) * OSTaskSuspend () unconditionally suspends a task (task priority) * OSTaskQuery () Get task information (task pointer, save data structure pointer) *************************************************** ************************************ /* *************************************************** ************************************ * Clock management items (TIME MANAGEMENT) * * OSTimeDly () task delay function (number of clock beats) * OSTimeDlyHMSM () Delay a task for a certain time (set hours, minutes, seconds, milliseconds) * OSTimeDlyResume () wakes up a task (priority) using the OSTimeDly() or OSTimeDlyHMSM() function * OSTimeGet () Get the current system clock value * OSTimeSet () sets the current system clock value *************************************************** ************************************ /****************************************************** ************************************ * Miscellaneous function definitions * * OSInit() initializes UCOS-II function * OSIntEnter() interrupt function is executing * OSIntExit() The interrupt function has been completed (out of interruption) * OSSchedLock() locks the scheduler * OSSchedUnlock() unlocks the scheduler * OSStart() starts multiple tasks * OSStatInit() Statistics task initialization * OSVersion() Get the version number *************************************************** ************************************ /****************************************************** ************************************ * INTERNAL FUNCTION PROTOTYPES * You cannot use them in your application (Your application MUST NOT call these functions) * * OS_Dummy() creates a virtual function * OS_EventTaskRdy() makes a task enter the ready state (OS_EVENT *pevent, void *msg, INT8U msk) * OS_EventTaskWait() puts a task into a state of waiting for an event to occur (ECB pointer) * OS_EventTO() sets the task to ready state due to timeout (ECB pointer) * OS_EventWaitListInit() Event control block list initialization (event control block pointer) * OS_FlagInit() initializes the event flag structure * OS_FlagUnlink() deletes this OS_FLAG_NODE from the waiting task list of the event flag group (OS_FLAG_NODE *pnode) * OS_MemInit() initializes the memory partition * OS_QInit() initializes the event queue structure * OS_Sched() task scheduling function * OS_TaskIdle() idle task function (pointing to a data structure) * OS_TaskStat() Statistics task (points to a data structure) * OS_TCBInit() initializes the task control block TCB (priority pointer, top stack pointer, bottom stack pointer, task identifier, * Stack capacity, extension pointer, options)
Previous article:MDK alignment setting
Next article:Detailed explanation of how μC/OS-II detects the actual usage of the task stack
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- 6678 single core spi programming steps
- KiCad 9-minute quick tutorial
- Soso takes you around Huawei Developer Conference 2020 (tons of beautiful pictures)
- C2000GPRS connection failure
- An Active Filter Experiment
- Must-see! Illustrated guide to the Internet of Things
- #国芯经验有奖作文# Come and share your days of being addicted to "playing with Guoxin and looking for alternatives"
- The role of the diode at the input point of the comparator LM393
- Please help! The ADC sampling fluctuation in stm32h743 is very large, and the 16-bit resolution exceeds the 8-bit fluctuation
- Apply for ufun learning board, introductory & deep learning simulation, engineering skills