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.

Table 12-6. Parameters
Data directionParameter nameDescription

[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.

Table 12-7. Return Values
Return valueDescription

STATUS_OK

If the peripheral was successfully locked

STATUS_ERR_INVALID_ARG

If invalid argument(s) were supplied