/* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_and(atomic_t *target, atomic_val_t value)
/* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_and(atomic_t *target, atomic_val_t value)
{
    CPSR_ALLOC();
    atomic_val_t old_value;
    RHINO_CPU_INTRPT_DISABLE();
    old_value = *target;
    *target &= value;
    RHINO_CPU_INTRPT_ENABLE();
    return old_value;
}