12.6.2.2.1 Function system_peripheral_lock_always()
Lock a given peripheral's control registers until hardware reset.
__no_inline enum status_code system_peripheral_lock_always( const uint32_t peripheral_id, const uint32_t key)
Locks a given peripheral's control registers, to deny write access to the peripheral to prevent accidental changes to the module's configuration. After lock, the only way to unlock is hardware reset.
- Warning
-
Locking an already locked peripheral will cause a CPU exception, and terminate program execution.
Data direction | Parameter name | Description |
---|---|---|
[in] |
peripheral_id |
ID for the peripheral to be locked, sourced via the SYSTEM_PERIPHERAL_ID macro |
[in] |
key |
Bitwise inverse of peripheral ID, used as key to reduce the chance of accidental locking. See Key-Argument |
Returns
Status of the peripheral lock procedure.
Return value | Description |
---|---|
STATUS_OK |
If the peripheral was successfully locked |
STATUS_ERR_INVALID_ARG |
If invalid argument(s) were supplied |