<< Previous | Next >>

OSFlagAccept

OS_FLAGS OSFlagAccept( OS_FLAG_GRP * pgrp, OS_FLAGS flags, INT8U wait_type, INT8U * err );

Description

This function is called to check the status of a combination of bits to be set or cleared in an event flag group. Your application can check for ANY bit to be set/cleared or ALL bits to be set/cleared.

This call does not block if the desired flags are not present.

Parameters

pgrp
Pointer to the desired event flag group.

flags
Bit pattern indicating which bit(s) (i.e. flags) you wish to check. E.g., if your application wants to wait for bits 0 and 1 then flags should be 0x03.

wait_type
Specifies whether you are checking for ALL bits to be set/cleared or ANY of the bits to be set/cleared. You can specify the following argument:

  • OS_FLAG_WAIT_CLR_ALL - You will check ALL bits in flags to be clear (0)

  • OS_FLAG_WAIT_CLR_ANY - You will check ANY bit in flags to be clear (0)

  • OS_FLAG_WAIT_SET_ALL - You will check ALL bits in flags to be set (1)

  • OS_FLAG_WAIT_SET_ANY - You will check ANY bit in flags to be set (1)

NOTE Add OS_FLAG_CONSUME if you want the event flag to be consumed by the call. Example, to wait for any flag in a group AND then clear the flags that are present, set the wait_type parameter to:

OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME

err
Pointer to an error code. Possible values are:

  • OS_NO_ERR - No error

  • OS_ERR_EVENT_TYPE - Not pointing to an event flag group

  • OS_FLAG_ERR_WAIT_TYPE - Proper wait_type argument not specified.

  • OS_FLAG_INVALID_PGRP - null pointer passed instead of the event flag group handle.

  • OS_FLAG_ERR_NOT_RDY - Flags not available.

Return value

The state of the flags in the event flag group.

Library

OS_FLAG.C (Prior to DC 8:UCOS2.LIB)


Dynamic C Functions << Previous | Next >> rabbit.com