|
AVR-LibC
2.3.0
Standard C library for AVR-GCC
|
AVR-LibC Manual |
![]() ![]() |
AVR-LibC Sources |
|||
Main Page |
User Manual |
Library Reference |
FAQ |
Example Projects |
Index |
Macros | |
| #define | _PROTECTED_WRITE(reg, value) |
| #define | _PROTECTED_WRITE_SPM(reg, value) |
This header file includes the appropriate IO definitions for the device that has been specified by the -mmcu= compiler command-line option. This is done by diverting to the appropriate file <avr/ioXXXX.h> which should never be included directly. Some register names common to all AVR devices are defined directly within <avr/common.h>, which is included in <avr/io.h>, but most of the details come from the respective include file.
Note that this header always includes the following ones:
See <avr/sfr_defs.h>: Special function registers for more details about that header file.
Included are definitions of the IO register set and their respective bit values as specified in the device manual. Note that due to inconsistencies in naming conventions, so even identical functions sometimes get different names on different devices.
Also included are the specific names useable for interrupt service routines as documented here.
Finally, the following macros are defined:
The last on-chip RAM address.
The last possible RAM location that is addressable. This is equal to RAMEND for devices that do not allow for external RAM. For devices that allow external RAM, this will be larger than RAMEND.
The last EEPROM address.
The last byte address in the Flash program space.
For devices with bootloader support, the flash pagesize (in bytes) to be used for the SPM instruction.
| #define _PROTECTED_WRITE | ( | reg, | |
| value | |||
| ) |
Write value value to IO register reg that is protected through the Xmega or AVRrc configuration change protection (CCP) mechanism. This implements the timed sequence that is required for CCP.
This macro requires that the address of reg is a compile-time constant. When that is not the case, the ccp_write_io() function can be used.
Example to modify the CPU clock:
| #define _PROTECTED_WRITE_SPM | ( | reg, | |
| value | |||
| ) |
Write value value to register reg that is protected through the Xmega or ATtiny102/104 configuration change protection (CCP) key for self programming (SPM). This implements the timed sequence that is required for CCP.
This macro requires that the address of reg is a compile-time constant. When that is not the case, the ccp_write_spm() function can be used.
Example to modify the CPU clock:
1.9.6