VxWorks Operating System Guide (with) Common System Call

xiaoxiao2021-03-06  14

Attachment: Common system call

1. TasksPawn creates (generated and activated) new tasks

Int taskspawn

(

Char * name, / * New task name * /

INT Priority, / * Task priority * /

INT OPTIONS, / * Task Options * /

INT stacksize, / * task stack size * /

Funcptr entrypt, / * task portfolio function * /

INT ARG1, / * Task entry function belt parameters 1 ~ 10 * /

INT Arg2, int Arg3,

INT Arg4, int Arg5,

INT Arg6, int Arg7,

INT Arg8, int Arg9,

Int Arg10

)

The function runs successfully returns the task ID number, otherwise it is ERROR.

Several modes of the task options are as follows:

Name value describes VX_FP_TASKVX_NO_STACK_FILLVX_PRIVATE_ENVVX_UNBREAKEVX_SUPERVISOR_MODE0X80x1000x800X2 Running with floating point coprocessor without using the 0xee population stack with private environment Run Task breakpoint failure user task common value

2. Taskdelete deletes a task

Status Taskdelete

(

INT TID / * Deletes the ID number of the task * /

)

Delete the task of the specified ID number and release the memory occupied by the task

3. TaskDelay delay task

Status Taskdelay

(

INT Ticks / * Delayed Time Tick * /

)

Task delays provide a simple processing method for a certain task sleep for a certain period of time, generally used for periodic cyclic execution of the task. When the input parameter is NO_WAIT (which is zero), it indicates the tail of the delayed task to the same priority ready queue.

4. Tasksuspend task suspension

Status Taskspend

(

INT TID / * Suspended Task ID Number * /

)

5.TaskResume recovery task

Status TaskResume

(

INT TID / * Recovered Task ID Number * /

)

6. msgqcreate Create and initialize the message queue

#include

MSG_Q_ID MSGQCREATE

(

INT MAXMSGS, / * The maximum number of messages that you can accommodate * /

INT MAXMSGLENGTH, / * Maximum length of each message * /

INT OPTIONS / * Message Ying Method * /

)

There are two ways to enter the message: MSG_Q_FIFO advancement first out, according to time, the order is successful; MSG_Q_Priority takes into account by message priority.

7.msgqsend Sends a message package to a message queue

Status msgqsend

(

MSG_Q_ID MSGQID, / * The sent message queue name * /

Char * buffer, / * Message package buffer pointer * /

UINT NBYTES, / * Message Package * /

INT TIMEOUT, / * Wait length * /

INT Priority / * Priority * /

)

This function will send the length of Nbytes buffer Buffer message package to message queue msgqid. If the task is waiting to receive the message package of the message queue, the message will be sent immediately to the first waiting task. If there is no task waiting for this message, the message package is kept in the message queue.

Parameters Timeout indicate that when the message queue is full, the time waiting for the message queue is waiting for time. If you have no space available in this time, the message package is discarded. It has two special values: no_wait (0) returns immediately, regardless of whether the message packet is sent; Wait_Forever (-1) has always been available for a message queue. Parameter priority specifies the priority of the message sent, may be: msg_pri_normal (0) normal priority, place the message in the tail of the message queue; MSG_PRI_URGENT (1) emergency message, place the message in the header of the message queue.

8.msgqRecEive Receive message

Int msgqreceive

(

MSG_Q_ID msgqid, / * message queue ID number of receiving messages * /

Char * buffer, / * Buffer pointer for receiving messages * /

UINT MAXNBYTES, / * buffer length * /

INT TIMEOUT / * Waiting time * /

)

This function receives the message from the message queue MSGQID, copies it to the maximum length of the MaxNbytes buffer BUFFER. If the length of the message package exceeds MaxNbytes, the excess part is discarded. Waiting time Timeout has two special values: no_wait (0) returns immediately; Wait_Forever (-1) has been waiting for messages to be available.

9.MSGQDelete Delete a message queue

Status msgqdelete

(

MSG_Q_ID MSGQID / * Message Queue Id Number of To Delete * /

)

Any task of sending or receiving messages that receives the message queue will be solved and returned Errno.

10. WDCREATE creates a watchdog timer

WDOG_ID WDCREATE (VOID)

11. WDSTART start timer

Status WDStart

(

WDOG_ID WDID, / * Watch Dog Timer ID Number * /

INT delay, / * delay value, ticking status * /

Funcptr proutine, / * Timeout function * /

INT Parameter / * Parameters for timeout functions * /

)

12. WDCANCEL cancels a currently working timer

Status WDCANCEL

(

WDOG_ID WDID / * Canceled Timer ID Number * /

)

This function is just a delay value of the timer to cancel its work.

13. WDDELETE Delete Timer

Status WDDELETE

(

WDOG_ID WDID / * Deleted Timer ID Number * /

)

14. SEMBCREATE creation and initialize the binary semaphore

SEM_ID SEMBCREATE

(

INT OPTIONS, / * Semand options * /

SEM_B_STATE INITIALSTATE / * Semand initialization status value * /

)

Signal initialization status values ​​have two: SEM_FULL (1) or SEM_EMPTY (0). Option parameters indicate that the ensembled ways of blocking tasks: based on priority (SEM_Q_PRIORITY) and advanced first out (SEM_Q_FIFO).

15. Semccreate creates and initializes the counting semaphore

SEM_ID SEMCCREATE

(

INT OPTIONS, / * Semand options * /

INT INITIALCOUNT / * Semand initialization count value * /

)

Option parameters indicate the incorporation of the blocked task: Based on priority (SEM_Q_PRIORITY) and advanced first out (SEM_Q_FIFO). 16. semgive gives a semaphore

STATUS SEMGIVE

(

Sem_id SEMID / * Stext Number * /

)

17. SemTake gets the semaphore

Status Semtake

(

Sem_id Semid / * Sitting ID Number * /

INT TIMEOUT / * Waiting time * /

)

If the task is not available in the specified time, the function sematake returns an error. Waiting time value WAIT_FOREVER and NO_WAIT indicates that they have been waiting and not waiting.

18. SEMDELETE Delete Sample

Status Semdelete

(

Sem_id semid / * Sample ID number to delete * /

)

This function releases resources associated with this semaphore, all waiting for this semaphore.

转载请注明原文地址:https://www.9cbs.com/read-50186.html

New Post(0)