PxMsgSetProtection()
Set protection mode of a message.
- APPLIES TO
-
1.0.0
- SYNOPSIS
-
PxError_t PxMsgSetProtection (PxMsg_t msgid, PxProtectType_t protection); - ARGUMENTS
|
|
|
- RETURN VALUES
-
-
PXROS error code
-
- ERROR CODES
-
PXERR_MSG_ILLMSGThe passed message handle is invalid
PXERR_MSG_ILLUSERThe calling task is not the user of the message
PXERR_PROT_PERMISSIONThe calling task has no permission to change the protection
PXERR_MSG_ILLOWNERThe calling task is not the owner of the message
PXERR_PROT_ILL_HANDLEInvalid pair number is given
PXERR_REQUEST_INVALID_PARAMETERRequest with invalid parameter
PXERR_ILL_NULLPOINTER_PARAMETERIllegal null pointer parameter in the call
PXERR_PROT_ILL_SIZEThe size of the protection region is not valid
PXERR_PROT_ILL_ALIGNAlignment of protection region is not valid
- DESCRIPTION
-
PxMsgSetProtectionsets the protection mode for the data area of a given message objectmsgid. The task has to be the owner (creator) of the messagemsgid! The following values are possible:-
NoAccessProtection, the caller has no access to the messages data area -
ReadProtection, the caller has read only access to the messages data area -
WriteProtection, the caller has write only access to the messages data area -
WRProtection, the caller has read and write access to the messages data area
The protection mode can only be changed if the caller has the appropriate permission. For example, the caller cannot set
WriteProtectionif it has no write access to the data area. -
- IMPLEMENTATION GUIDELINES
-
- Before call
-
-
msgidmust be a valid message object, requested viaPxMsgRequest…orPxMsgEnvelop…or received by aPxMsgReceive…call (V). This id may be checked with one of the following macros:-
PxMsgIdIsValid()must be true. -
PxMsgIdGet()must not be_PXIllegalObjId. -
PxMsgIdError()must bePXERR_NOERRORotherwise the returned error code has to be interpreted (C).
-
-
protectionmust be of typePxProtectType_tand may have one of the following values (V):-
NoAccessProtectionneither read nor write access -
ReadProtectionread access -
WriteProtectionwrite access -
WRProtectionread and write access
-
-
- After call
-
-
The function returns
PXERR_NOERRORif the message’s protection mode is changed. Any other return value describes an error, which has to be interpreted (C).
-
- Best Practice
-
-
No restrictions.
-
- SEE ALSO
- USAGE
-
#include "pxdef.h" PxError_t Err = PxMsgSetProtection(msgid, ReadPermission); if (Err != PXERR_NOERROR) { // Report error }