PxRegisterSetMask_Hnd()

Write all bits of value to a SFR register according to the mask (handler function).

APPLIES TO

8.2.0

SYNOPSIS
PxError_t PxRegisterSetMask_Hnd (volatile PxULong_t *addr, PxULong_t mask, PxULong_t val);
ARGUMENTS
addr

Address of the desired register to modify

mask

Mask of bits to modify

val

Value to write to the register

RETURN VALUES
  • PXROS error code

ERROR CODES

PXERR_ACCESS_RIGHT

The task has not the right to access peripheral registers

PXERR_PROT_ILL_REGION

addr is not within additional protection region

DESCRIPTION

PxRegisterSetMask_Hnd sets the bits described in mask of the peripheral register addr to val if the calling task has write access right to this special function register. It should only be used from handlers running in a task’s context.

The peripheral register addr must be covered in the additional protection region table passed in the element ts_protect_region of PxTaskSpec_t during PxTaskCreate.

IMPLEMENTATION GUIDELINES
Before call
  • This function should be called from handlers only. (V)

  • addr has to be a valid pointer to a special function register (V).

After call
  • The function returns PXERR_NOERROR if the register could be modified. Any other return value describes an error, which has to be interpreted (C).

Best Practice
  • The peripheral register addr must be covered in the additional protection region table passed in the element ts_protect_region of PxTaskSpec_t during PxTaskCreate of the task which has installed the handler.

USAGE
#include "pxdef.h"

PxError_t error = PxRegisterSetMask_Hnd(addr, mask, val);

if (error != PXERR_NOERROR) {
    // Report error
}