UC/OSⅡ basic functions

Publisher:TranquilSilenceLatest update time:2015-09-09 Source: eefocusKeywords:UCOSⅡ Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
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)
Keywords:UCOSⅡ Reference address:UC/OSⅡ basic functions

Previous article:MDK alignment setting
Next article:Detailed explanation of how μC/OS-II detects the actual usage of the task stack

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号