PAC Driver

The Peripheral Access Controller (PAC) provides write protection for registers of the peripherals.

The user can use periph_lock to enable a selected peripheral's write-protection, and periph_unlock to disable the selected peripheral's write-protection.

If a peripheral is write-protected, and if a write access is performed, data will not be written.

Summary of the API's Functional Features

The API provides functions to:
  • Lock(enable write-protection)

  • Unlock(disable write-protection)

  • Get the write-protection state

Summary of Configuration Options

No PAC parameter needed to be configured in START.

Driver Implementation Description

Limitations

  • Double write-protection or double unprotection may lead to an access error

Example of Usage

The following shows a simple example of using the PAC to lock GCLK peripheral.

          /**
           * Lock GCLK.
           */
          void pac_example(void)
          {
              bool stat;
              periph_get_lock_state(GCLK, &stat);
              if (!stat) {
                  periph_lock(GCLK);
              }
          }
        

Dependencies

  • PAC peripheral and clocks