You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB
Groff

.TH "<avr/io.h>: AVR device-specific IO definitions" 3 "24 Jun 2019" "Version 2.0.0" "avr-libc" \" -*- nroff -*-
.ad l
.nh
.SH NAME
<avr/io.h>: AVR device-specific IO definitions \-
.SS "Defines"
.in +1c
.ti -1c
.RI "#define \fB_PROTECTED_WRITE\fP(reg, value)"
.br
.ti -1c
.RI "#define \fB_PROTECTED_WRITE_SPM\fP(reg, value)"
.br
.in -1c
.SH "Detailed Description"
.PP
.PP
.nf
#include <avr/io.h>
.fi
.PP
.PP
This header file includes the apropriate IO definitions for the device that has been specified by the \fC-mmcu=\fP compiler command-line switch. This is done by diverting to the appropriate file \fC<avr/io\fP\fIXXXX\fP\fC.h>\fP which should never be included directly. Some register names common to all AVR devices are defined directly within \fC<avr/common.h>\fP, which is included in \fC<\fBavr/io.h\fP>\fP, but most of the details come from the respective include file.
.PP
Note that this file always includes the following files:
.PP
.nf
#include <avr/sfr_defs.h>
#include <avr/portpins.h>
#include <avr/common.h>
#include <avr/version.h>
.fi
.PP
See \fB<avr/sfr_defs.h>: Special function registers\fP for more details about that header file.
.PP
Included are definitions of the IO register set and their respective bit values as specified in the Atmel documentation. Note that inconsistencies in naming conventions, so even identical functions sometimes get different names on different devices.
.PP
Also included are the specific names useable for interrupt function definitions as documented \fBhere\fP.
.PP
Finally, the following macros are defined:
.PP
.IP "\(bu" 2
\fBRAMEND\fP
.br
The last on-chip RAM address.
.br
.IP "\(bu" 2
\fBXRAMEND\fP
.br
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.
.br
.IP "\(bu" 2
\fBE2END\fP
.br
The last EEPROM address.
.br
.IP "\(bu" 2
\fBFLASHEND\fP
.br
The last byte address in the Flash program space.
.br
.IP "\(bu" 2
\fBSPM_PAGESIZE\fP
.br
For devices with bootloader support, the flash pagesize (in bytes) to be used for the \fCSPM\fP instruction.
.IP "\(bu" 2
\fBE2PAGESIZE\fP
.br
The size of the EEPROM page.
.PP
.SH "Define Documentation"
.PP
.SS "#define _PROTECTED_WRITE(reg, value)"Write value \fCvalue\fP to IO register \fCreg\fP that is protected through the Xmega configuration change protection (CCP) mechanism. This implements the timed sequence that is required for CCP.
.PP
Example to modify the CPU clock:
.PP
.nf
#include <avr/io.h>
_PROTECTED_WRITE(CLK_PSCTRL, CLK_PSADIV0_bm);
_PROTECTED_WRITE(CLK_CTRL, CLK_SCLKSEL0_bm);
.fi
.PP
.SS "#define _PROTECTED_WRITE_SPM(reg, value)"Write value \fCvalue\fP to register \fCreg\fP that is protected through the Xmega configuration change protection (CCP) key for self programming (SPM). This implements the timed sequence that is required for CCP.
.PP
Example to modify the CPU clock:
.PP
.nf
#include <avr/io.h>
_PROTECTED_WRITE_SPM(NVMCTRL_CTRLA, NVMCTRL_CMD_PAGEERASEWRITE_gc);
.fi
.PP
.SH "Author"
.PP
Generated automatically by Doxygen for avr-libc from the source code.