\hypertarget{group__avr__io}{}\doxysubsection{$<$avr/io.h$>$\+: A\+VR device-\/specific IO definitions}
\label{group__avr__io}\index{$<$avr/io.h$>$: AVR device-\/specific IO definitions@{$<$avr/io.h$>$: AVR device-\/specific IO definitions}}
\doxysubsubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group__avr__io_gaaaa396e67cc85f68fa0474d70edf3d4c}{\+\_\+\+P\+R\+O\+T\+E\+C\+T\+E\+D\+\_\+\+W\+R\+I\+TE}}(reg,  value)
\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{io_8h}{avr/io.h}}>} }
\end{DoxyCode}


This header file includes the apropriate IO definitions for the device that has been specified by the {\ttfamily -\/mmcu=} compiler command-\/line switch. This is done by diverting to the appropriate file {\ttfamily $<$avr/io}{\itshape X\+X\+XX}{\ttfamily .h$>$} which should never be included directly. Some register names common to all A\+VR devices are defined directly within {\ttfamily $<$avr/common.\+h$>$}, which is included in {\ttfamily $<$\mbox{\hyperlink{io_8h}{avr/io.\+h}}$>$}, but most of the details come from the respective include file.

Note that this file always includes the following files\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <avr/sfr\_defs.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <avr/portpins.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <avr/common.h>}}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <avr/version.h>}}
\end{DoxyCode}
 See \mbox{\hyperlink{group__avr__sfr}{$<$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 Atmel documentation. Note that inconsistencies in naming conventions, so even identical functions sometimes get different names on different devices.

Also included are the specific names useable for interrupt function definitions as documented \mbox{\hyperlink{group__avr__interrupts_avr_signames}{here}}.

Finally, the following macros are defined\+:


\begin{DoxyItemize}
\item {\bfseries{R\+A\+M\+E\+ND}} ~\newline
 The last on-\/chip R\+AM address. ~\newline

\item {\bfseries{X\+R\+A\+M\+E\+ND}} ~\newline
 The last possible R\+AM location that is addressable. This is equal to R\+A\+M\+E\+ND for devices that do not allow for external R\+AM. For devices that allow external R\+AM, this will be larger than R\+A\+M\+E\+ND. ~\newline

\item {\bfseries{E2\+E\+ND}} ~\newline
 The last E\+E\+P\+R\+OM address. ~\newline

\item {\bfseries{F\+L\+A\+S\+H\+E\+ND}} ~\newline
 The last byte address in the Flash program space. ~\newline

\item {\bfseries{S\+P\+M\+\_\+\+P\+A\+G\+E\+S\+I\+ZE}} ~\newline
 For devices with bootloader support, the flash pagesize (in bytes) to be used for the {\ttfamily S\+PM} instruction.
\item {\bfseries{E2\+P\+A\+G\+E\+S\+I\+ZE}} ~\newline
 The size of the E\+E\+P\+R\+OM page. 
\end{DoxyItemize}

\doxysubsubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group__avr__io_gaaaa396e67cc85f68fa0474d70edf3d4c}\label{group__avr__io_gaaaa396e67cc85f68fa0474d70edf3d4c}} 
\index{$<$avr/io.h$>$: AVR device-\/specific IO definitions@{$<$avr/io.h$>$: AVR device-\/specific IO definitions}!\_PROTECTED\_WRITE@{\_PROTECTED\_WRITE}}
\index{\_PROTECTED\_WRITE@{\_PROTECTED\_WRITE}!$<$avr/io.h$>$: AVR device-\/specific IO definitions@{$<$avr/io.h$>$: AVR device-\/specific IO definitions}}
\doxyparagraph{\texorpdfstring{\_PROTECTED\_WRITE}{\_PROTECTED\_WRITE}}
{\footnotesize\ttfamily \#define \+\_\+\+P\+R\+O\+T\+E\+C\+T\+E\+D\+\_\+\+W\+R\+I\+TE(\begin{DoxyParamCaption}\item[{}]{reg,  }\item[{}]{value }\end{DoxyParamCaption})}

Write value {\ttfamily value} to IO register {\ttfamily reg} that is protected through the Xmega configuration change protection (C\+CP) mechanism. This implements the timed sequence that is required for C\+CP.

Example to modify the C\+PU clock\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{io_8h}{avr/io.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__io_gaaaa396e67cc85f68fa0474d70edf3d4c}{\_PROTECTED\_WRITE}}(CLK\_PSCTRL, CLK\_PSADIV0\_bm);}
\DoxyCodeLine{\mbox{\hyperlink{group__avr__io_gaaaa396e67cc85f68fa0474d70edf3d4c}{\_PROTECTED\_WRITE}}(CLK\_CTRL, CLK\_SCLKSEL0\_bm);}
\end{DoxyCode}
 