/* Atomic addition primitive. 
is atomically added to the value at <target>, placing the result at <target>, and the old value from <target> is returned. */
atomic_val_t atomic_add(atomic_t *target, atomic_val_t value)
/* Atomic addition primitive. 
is atomically added to the value at <target>, placing the result at <target>, and the old value from <target> is returned. */
atomic_val_t atomic_add(atomic_t *target, atomic_val_t value)
{
    unsigned int key;
    atomic_val_t ret;
    key = irq_lock();
    ret = *target;
    *target += value;
    irq_unlock(key);
    return ret;
}