CTL_STATUS_t ctl_transport_rmw_32b_register(CTL_TRANSPORT_t *self,
                                            int reg,
                                            unsigned long mask,
                                            unsigned long value);

ctl_transport_rmw_32b_register reads, updates, and writes four consecutive 8-bit registers starting at address reg on the device associated with transport self. The register is modified by replacing existing bits with new bits from value where the the corresponding bits in mask are non-zero.

The value written back to the register is:

(not mask and value-of-register) or (value and mask).

Return Value

ctl_transport_rmw_32b_register returns a standard status code.

Thread Safety

ctl_transport_rmw_32b_register is thread-safe if the transport self has a mutex associated with it. ctl_transport_rmw_32b_register ensures an atomic update of the register by locking the transport before reading the register and unlocking it after writing the register.