switch (wait_type) {
case OS_FLAG_WAIT_SET_ALL: /* See if all required flags are set */
flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags); /* Extract only the bits we want */
if (flags_rdy == flags) { /* Must match ALL the bits that we want */
if (consume == OS_TRUE) { /* See if we need to consume the flags */
pgrp->OSFlagFlags &= (OS_FLAGS)~flags_rdy; /* Clear ONLY the flags we wanted */
}
} else { *perr = OS_ERR_FLAG_NOT_RDY;
}
OS_EXIT_CRITICAL();
break;
case OS_FLAG_WAIT_SET_ANY:
flags_rdy = (OS_FLAGS)(pgrp->OSFlagFlags & flags); /* Extract only the bits we want */
if (flags_rdy != (OS_FLAGS)0) { /* See if any flag set */
if (consume == OS_TRUE) { /* See if we need to consume the flags */
pgrp->OSFlagFlags &= (OS_FLAGS)~flags_rdy; /* Clear ONLY the flags we got */
}
} else {
*perr = OS_ERR_FLAG_NOT_RDY;
}
OS_EXIT_CRITICAL();
break;