Microchip® Advanced Software Framework

pac.c File Reference

SAM Peripheral Access Controller Driver.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include "pac.h"

Functions

__no_inline enum status_code system_peripheral_lock (const uint32_t peripheral_id, const uint32_t key)
 Lock a given peripheral's control registers. More...
 
__no_inline enum status_code system_peripheral_lock_always (const uint32_t peripheral_id, const uint32_t key)
 Lock a given peripheral's control registers until hardware reset. More...
 
__no_inline enum status_code system_peripheral_unlock (const uint32_t peripheral_id, const uint32_t key)
 Unlock a given peripheral's control registers. More...
 

__no_inline enum status_code system_peripheral_lock_always ( const uint32_t  peripheral_id,
const uint32_t  key 
)

Lock a given peripheral's control registers until hardware reset.

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.
Parameters
[in]peripheral_idID for the peripheral to be locked, sourced via the SYSTEM_PERIPHERAL_ID macro
[in]keyBitwise 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 values
STATUS_OKIf the peripheral was successfully locked
STATUS_ERR_INVALID_ARGIf invalid argument(s) were supplied

References Assert, STATUS_ERR_INVALID_ARG, and STATUS_OK.