FreeRTOS/Demo/RISC-V_RV64_PolarFire_SoftConsole/polarfire_hal/platform/mpfs_hal/common/mss_util.c
/**
 * mpfs_sync_val_compare_and_swap()
 * this works on the E51 / U54s, and operates equivalently to the
 * __sync_val_compare_and_swap() intrinsic.  It works by using a separate
 * static lock, and then emulating the behaviour of the lr.w.aq instruction
 * Required as lr/sr instructions are not supported on the E51 and are only
 * supported on L1 cached back memory types. These limitations are not present
 * with this function.
 * @param ptr
 * @param oldval
 * @param newval
 */
mpfs_sync_val_compare_and_swap()
this works on the E51 / U54s, and operates equivalently to the
sync_val_compare_and_swap() intrinsic.  It works by using a separate
static lock, and then emulating the behaviour of the lr.w.aq instruction
Required as lr/sr instructions are not supported on the E51 and are only
supported on L1 cached back memory types. These limitations are not present
with this function.
mpfs_sync_val_compare_and_swap () this works on the E51 / U54s and operates equivalently to the sync_val_compare_and_swap () intrinsic . It works by using a separate static lock and then emulating the behaviour of the lr . w . aq instruction Required as lr / sr instructions are not supported on the E51 and are only supported on L1 cached back memory types . These limitations are not present with this function .
long mpfs_sync_val_compare_and_swap(volatile long *ptr, long oldval, long newval)
{
        long result = *ptr;
        (void)mpfs_sync_bool_compare_and_swap(ptr, oldval, newval);
        return result;
}
long mpfs_sync_val_compare_and_swap ( volatile long * ptr , long oldval , long newval ) { long result = * ptr ; ( void ) mpfs_sync_bool_compare_and_swap ( ptr , oldval , newval ) ; return result ; }
mpfs_sync_val_compare_and_swap()
 this works on the E51 / U54s, and operates equivalently to the
 __sync_val_compare_and_swap() intrinsic.
mpfs_sync_val_compare_and_swap () this works on the E51 / U54s and operates equivalently to the __sync_val_compare_and_swap () intrinsic .