12.6.2.1.1 Function system_peripheral_lock()

Lock a given peripheral's control registers.

__no_inline enum status_code system_peripheral_lock( 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.

Warning

Locking an already locked peripheral will cause a CPU exception, and terminate program execution.

Table 12-2. 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-3. Return Values
Return valueDescription

STATUS_OK

If the peripheral was successfully locked

STATUS_ERR_INVALID_ARG

If invalid argument(s) were supplied