PxRegisterRead()
Read a value from a SFR register.
- APPLIES TO
-
8.2.0
- SYNOPSIS
-
PxULong_t PxRegisterRead (volatile PxULong_t *addr); - ARGUMENTS
|
- RETURN VALUES
-
-
Value of the desired register
-
0 on error. If 0 is returned, the caller has to check the task error code with
PxGetError().
-
- ERROR CODES
-
PXERR_ACCESS_RIGHTThe task has not the right to access peripheral registers
PXERR_PROT_ILL_REGIONaddris not within additional protection region - DESCRIPTION
-
PxRegisterReadreturns the content of the peripheral registeraddrif the calling task has read access right to this special function register. It should only be used from a task (not from a handler).The peripheral register
addrmust be covered in the additional protection region table passed in the element ts_protect_region ofPxTaskSpec_tduringPxTaskCreate.
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
addrhas to be a valid pointer to a special function register (V).
-
- After call
-
-
PxGetErrormust be called to check if an error has occurred. (F)
-
- Best Practice
-
-
The peripheral register
addrmust be covered in the additional protection region table passed in the elementts_protect_regionofPxTaskSpec_tduringPxTaskCreate.
-
- USAGE
-
#include "pxdef.h" PxULong_t registerReadReturn = PxRegisterRead(addr); if (0 == registerReadReturn) { // Report error errorCode = PxGetError(); }