CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
PAC Interface

Driver API for PAC (plib_pac.h) More...

Typedefs

typedef void(* PAC_CALLBACK_HANDLER) (void)
 PAC callback function type.
 

Enumerations

enum  PAC_PROTECTION { PAC_PROTECTION_CLEAR = 0x01 , PAC_PROTECTION_SET = 0x02 , PAC_PROTECTION_SET_AND_LOCK = 0x03 }
 PAC protection modes for a peripheral. More...
 
enum  PAC_PERIPHERAL
 Peripheral identifiers for PAC operations. More...
 

Functions

void PAC_Initialize (void)
 Initializes the PAC module.
 
void PAC_EnableEvent (void)
 Enables PAC event output.
 
void PAC_DisableEvent (void)
 Disables PAC event output.
 
void PAC_WriteProtectControl (PAC_PERIPHERAL peripheral, PAC_PROTECTION operation)
 Controls protection for a peripheral.
 
bool PAC_PeripheralIsProtected (PAC_PERIPHERAL peripheral)
 Checks if a peripheral is protected.
 
bool PAC_PeripheralHasError (PAC_PERIPHERAL peripheral)
 Checks if a peripheral has an error.
 
void PAC_ClearPeripheralError (PAC_PERIPHERAL peripheral)
 Clears error status of a peripheral.
 
uint32_t PAC_GetAHBErrorFlags (void)
 Gets AHB error flags.
 
void PAC_ClearAHBErrorFlags (uint32_t mask)
 Clears specific AHB error flags.
 
void PAC_EnableInterrupt (void)
 Enables PAC interrupts.
 
void PAC_DisableInterrupt (void)
 Disables PAC interrupts.
 
bool PAC_InterruptIsEnabled (void)
 Checks if PAC interrupt is enabled.
 
void PAC_ClearInterruptFlag (void)
 Clears PAC interrupt flag.
 
void PAC_SetCallbackHandler (PAC_CALLBACK_HANDLER callback)
 Registers a PAC callback function.
 

Description

Driver API for PAC (plib_pac.h)

Usage Example

The following example demonstrates typical usage of the PAC peripheral:

#include "plib_pac.h"
#include <pic32c.h>
#include <stdint.h>
/* Example callback function for PAC interrupts */
void MyPACCallback(void)
{
/*PAC violation was successfully caught*/
}
int32_t configure_PAC(void)
{
/*Initialize the PAC module*/
/*Enable PAC event output*/
/* Register the user callback handler for PAC interrupts */
PAC_SetCallbackHandler(&MyPACCallback);
/*Enable the PAC interrupts*/
/* Write-protect SERCOM0 */
PAC_WriteProtectControl(PAC_PERIPHERAL_SERCOM0, PAC_PROTECTION_SET);
/*Check if the Peripheral is protected*/
if (PAC_PeripheralIsProtected(PAC_PERIPHERAL_SERCOM0))
{
/* Peripheral is protected */
}
else
{
/* Peripheral is not protected */
}
return 0;
}
void PAC_WriteProtectControl(PAC_PERIPHERAL peripheral, PAC_PROTECTION operation)
Controls protection for a peripheral.
void PAC_SetCallbackHandler(PAC_CALLBACK_HANDLER callback)
Registers a PAC callback function.
void PAC_Initialize(void)
Initializes the PAC module.
void PAC_EnableInterrupt(void)
Enables PAC interrupts.
void PAC_EnableEvent(void)
Enables PAC event output.
bool PAC_PeripheralIsProtected(PAC_PERIPHERAL peripheral)
Checks if a peripheral is protected.
@ PAC_PROTECTION_SET
Definition plib_pac.h:59
Peripheral Access Controller (PAC) PLIB APIs.

Typedef Documentation

◆ PAC_CALLBACK_HANDLER

typedef void(* PAC_CALLBACK_HANDLER) (void)

PAC callback function type.

Parameters
None.

Enumeration Type Documentation

◆ PAC_PERIPHERAL

Peripheral identifiers for PAC operations.

Important portability rule: The numeric values MUST match the device's PERID encoding used by PAC.WrCtrl.PERID (as defined by the device header/SVD). Do not rely on enum auto-numbering or on a "common" instance list, because peripheral instances vary by device.

◆ PAC_PROTECTION

PAC protection modes for a peripheral.

Enumerator
PAC_PROTECTION_CLEAR 
PAC_PROTECTION_SET 
PAC_PROTECTION_SET_AND_LOCK 

Function Documentation

◆ PAC_ClearAHBErrorFlags()

void PAC_ClearAHBErrorFlags ( uint32_t mask)

Clears specific AHB error flags.

Parameters
maskMask of error flags to clear.
Returns
void

◆ PAC_ClearInterruptFlag()

void PAC_ClearInterruptFlag ( void )

Clears PAC interrupt flag.

Returns
void

◆ PAC_ClearPeripheralError()

void PAC_ClearPeripheralError ( PAC_PERIPHERAL peripheral)

Clears error status of a peripheral.

Parameters
peripheralThe target peripheral.
Returns
void

◆ PAC_DisableEvent()

void PAC_DisableEvent ( void )

Disables PAC event output.

Returns
void

◆ PAC_DisableInterrupt()

void PAC_DisableInterrupt ( void )

Disables PAC interrupts.

Returns
void

◆ PAC_EnableEvent()

void PAC_EnableEvent ( void )

Enables PAC event output.

Returns
void

◆ PAC_EnableInterrupt()

void PAC_EnableInterrupt ( void )

Enables PAC interrupts.

Returns
void

◆ PAC_GetAHBErrorFlags()

uint32_t PAC_GetAHBErrorFlags ( void )

Gets AHB error flags.

Returns
Bitmask of AHB error flags.

◆ PAC_Initialize()

void PAC_Initialize ( void )

Initializes the PAC module.

This function sets up the PAC for use.

Returns
void

◆ PAC_InterruptIsEnabled()

bool PAC_InterruptIsEnabled ( void )

Checks if PAC interrupt is enabled.

Returns
true if enabled, false otherwise.

◆ PAC_PeripheralHasError()

bool PAC_PeripheralHasError ( PAC_PERIPHERAL peripheral)

Checks if a peripheral has an error.

Parameters
peripheralThe target peripheral.
Returns
true if an error is detected, false otherwise.

◆ PAC_PeripheralIsProtected()

bool PAC_PeripheralIsProtected ( PAC_PERIPHERAL peripheral)

Checks if a peripheral is protected.

Parameters
peripheralThe target peripheral.
Returns
true if the peripheral is protected, false otherwise.

◆ PAC_SetCallbackHandler()

void PAC_SetCallbackHandler ( PAC_CALLBACK_HANDLER callback)

Registers a PAC callback function.

Parameters
callbackUser-defined callback function.
contextUser data passed to callback.
Returns
void

◆ PAC_WriteProtectControl()

void PAC_WriteProtectControl ( PAC_PERIPHERAL peripheral,
PAC_PROTECTION operation )

Controls protection for a peripheral.

Parameters
peripheralThe target peripheral.
operationThe protection operation to perform.
Returns
void