code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
\section{Software Overview} \label{sw_sec} This section presents an overview of the firmware developed for the iNEMO board and the application developed for the Android device. \subsection{Firmware} \label{fw_sec} The firmware for the iNEMO board is based on the real-time operating system FreeRTOS, version 7\footnote{The FreeRTOS Project: \url{http://www.freertos.org}}. Most of the code is taken from the original code furnished by STMicroelectronics: in particular, the libraries to manage sensors, ports and internal communication have been totally reused without any change. The main contributes to the firmware of this work are the support of Android Open ADK and the implementation of a set of tasks to allow communication with the Android device. As said in section \ref{hw_sec}, USB Host functionality is provided by an USB Host Shield that integrates the Maxim MAX3421E USB host controller. Hence, to support the communication on the USB through the MAX3421E, USB control library and MAX3421E driver, developed by Circuits@Home\footnote{Circuits@Home: \url{http://www.circuitsathome.com}} for the Arduino Platform, have been adapted to STM32 microcontrollers family. At the higher level of the software stack there is the Android Accessory library: it has been implemented according to the indications furnished by the Android Developer's Guide. {\bf Figure \ref{fig:sw_stack}} shows the software stack for the support of Android Open ADK. \begin{center} \includegraphics[width=0.5\linewidth]{pics/sw_stack.eps} \captionof{figure}{Software stack for the support of Android Open ADK.} \label{fig:sw_stack} \end{center} The communication with the Android device is guaranteed by 3 tasks: \begin{itemize} \item Accessory Task: it manages the communication according to the Accessory protocol and can awake the Command Task in order the process the messages received from the Android device. \item Command Task: it parses the messages received from the Android device and builds the response messages. It can awake the Data Task. \item Data Task: it sends messages containing data received from the sensors integrated on the board. \end{itemize} The Accessory task is always active: it examines the USB bus to check if an Android device is attached. In case a device is found, the Accessory Task establishes a connection with it (see section \ref{adk_sec}). Once the device is in Accessory mode, the Accessory Task waits for messages from it. When a message is received, it is sent to the queue on which the Command Task is waiting for. Then, the Command Task can retrieve the message sent from the device and parse it. According to the contents of the message, the Command Task sends an appropriate response message and eventually enables or disables the Data Task. When enabled, the Data Task sends the data retrieved from the sensors of the board to the Android device. Keil uVision 4 has been used as development environment and debugger for the realization of the firmware. The main issue encountered in using this IDE was the limitation on the code size (32KB) present in the free version (MDK-Lite): this forced us to eliminate, for the moment, the support of gyroscopes, magnetometer and pressure sensor, even if the libraries for them are ready to be used. For this reason, one of the future goal for this work is to implement a completely open compile chain (probably based on gcc), in order to get rid of the limitations imposed by Keil uVision IDE. \subsection{Android Application} \label{apk_sec} The Android application is composed of 3 activities: \begin{itemize} \item UsbAccessoryActivity: this activity is responsible for detecting if the board is attached to the device. In case the board is attached, after having requested the permission to the user, this activity starts the INemoDemoActivity and terminates. An intent filter for the \textit{USB\_ACCESSORY\_ATTACHED} action is added to the Manifest, in order to make the UsbAccessoryActivity capable of detecting the iNEMO board. \item INemoDemoActivity: this is the main activity of the application. It is responsible for managing the communication with the board and updating the layout of the application. \item SettingsActivity: this activity lets the user modify the acquisition parameters. In particular it is possible to modify the acquisition rate, choose the enabled sensors or change the settings of the enabled sensors. \end{itemize} The communication protocol presented in section \ref{cp_sec} has been fully implemented in the class CommunicationFrame. The details regarding the frame format of the messages are all contained in this class: this allows separating the specific implementation of the protocol from the rest of the application, allowing in this way to easily change the communication protocol without much effort. When the application is started, if the iNEMO board is detached, the splash screen shown in {\bf Figure \ref{fig:no_dev}} is displayed. \begin{center} \includegraphics[width=0.6\linewidth]{pics/no_dev.eps} \captionof{figure}{Splash screen shown when the iNEMO board is detached.} \label{fig:no_dev} \end{center} When the board is attached, some introductive information on the board is shown and the user has the possibility to start the connection (see {\bf Figure \ref{fig:connect}}). \begin{center} \includegraphics[width=0.6\linewidth]{pics/connect.eps} \captionof{figure}{Screen shown when the iNEMO board is attached.} \label{fig:connect} \end{center} When the connection is established, the application retrieves from the board information about the device identifier, the firmware and hardware version, the acquisition parameters and the sensors enabled. The user has the possibility to disconnect from the board, modify the acquisition parameters or start the acquisition (see {\bf Figure \ref{fig:connected}}). \begin{center} \includegraphics[width=0.6\linewidth]{pics/connected.eps} \captionof{figure}{Screen shown when the connection with the board is established.} \label{fig:connected} \end{center} The settings view ({\bf Figure \ref{fig:settings}}) allows the user to modify the acquisition parameters and to choose which sensors have to be enabled. \begin{center} \includegraphics[width=0.6\linewidth]{pics/settings.eps} \captionof{figure}{Settings view.} \label{fig:settings} \end{center} Finally, during the acquisition phase, the application retrieves the data originated by the sensors of the board and shows them in a textual way (see {\bf Figure \ref{fig:acquisition}}). A future development is to shows sensor data in a graphical way (sliding graphs as in the Windows application iNEMO Suite). \begin{center} \includegraphics[width=0.6\linewidth]{pics/acquisition.eps} \captionof{figure}{Acquisition view.} \label{fig:acquisition} \end{center} As can be noticed, the layout is quite basic: another future development is to improve the graphic of the application.
zz314326255--adkping
iNEMO-accessory/report/sections/sec5.tex
TeX
oos
6,965
\section{Hardware Overview} \label{hw_sec} This section describes the hardware setup needed for enabling Android Open ADK on STM32-based kits. In particular, STEVAL-MKI062V2 (iNEMO) \cite{STM_inemo} board has been used in this demo application, but the work presented can be easily adapted to whatever STM32 based board. The STEVAL-MKI062V2 is the second generation of the iNEMO module family. It combines accelerometers, gyroscopes and magnetometers with pressure and temperature sensors to provide 3-axis sensing of linear, angular and magnetic motion, complemented with temperature and barometer/altitude readings, offering in this way a 10 degrees of freedom (DOF) platform. More specifically, the board integrates five STMicroelectronics sensors: a 2-axis roll-and-pitch gyroscope, a 1-axis yaw gyroscope, a 6-axis geomagnetic module, a pressure sensor, and a temperature sensor (see {\bf Figure \ref{fig:inemov2}}). \begin{center} \includegraphics[width=0.95\linewidth]{pics/inemov2.eps} \captionof{figure}{iNEMO V2 platform.} \label{fig:inemov2} \end{center} As we said, the communication between the board and the Android device is realized using the Android Open ADK: according to this protocol the iNEMO acts as the USB host (powers the bus and enumerates devices) and the Android-powered device acts as the USB device (see section \ref{adk_sec} for more details). Since the iNEMO does not natively integrate a USB port, it is necessary to use a USB Host Shield in order to provide USB Host functionality to the board. In this work it has been used the USB Host Shield furnished by Sparkfun\footnote{Sparkfun USB Host Shield: \url{http://www.sparkfun.com/products/9947}}, but whatever equivalent board offering Maxim MAX3421E\cite{max3421e} USB host controller can be adopted. The iNEMO board communicates with the Host Shield through a Serial Peripheral Interface (SPI) bus: as a matter of fact, the Extended Connector (J8) of the iNEMO provides an SPI interface and 4 GPIOs (see {\bf Figure \ref{fig:j8}}) that can be used to control the Shield. \begin{center} \includegraphics[width=0.95\linewidth]{pics/j8.eps} \captionof{figure}{Extended Connector (J8) schematic.} \label{fig:j8} \end{center} The connections between the iNEMO board and the USB Host Shield are shown in {\bf Figure \ref{fig:spi}}. This picture shows also that the Shield must be powered by means of an external power supply (9V) on VIn pin. \begin{center} \includegraphics[width=0.95\linewidth]{pics/SPI_wirings.eps} \captionof{figure}{Connections between the iNEMO board and the USB Host Shield.} \label{fig:spi} \end{center} For debugging purposes, a TTL-232R-PCB by FTDI\cite{ttl232r} has been connected to the 6-pin COM J4 connector of the iNEMO board. {\bf Figure \ref{fig:connections}} shows an overview of the components used in this work and the connections between them. \begin{center} \includegraphics[width=0.95\linewidth]{pics/connections.eps} \captionof{figure}{Overview of the hardware used.} \label{fig:connections} \end{center}
zz314326255--adkping
iNEMO-accessory/report/sections/sec2.tex
TeX
oos
3,048
\section{Communication Protocol} \label{cp_sec} As said in section \ref{adk_sec}, Android Open ADK allows the accessory to exchange generic data with the Android device. A communication protocol is needed to structure this data, in order to allow iNEMO board to correctly communicate with the Android device. At the beginning of this work we had two options for the choice of the protocol: \begin{itemize} \item define a brand new protocol, maybe taking a cue from OpenDMTP\footnote{The OpenDMTP Project: \url{http://www.opendmtp.org}}; \item adapting the original protocol defined by STM for the communication with the Windows application INEMO Suite. \end{itemize} We think that the second option is the best one for the following reasons: \begin{itemize} \item it allows to maintain a continuity whit what has already been developed by STMicroelectronics; \item the original protocol is designed to best exploit the features of the board and to fit into the libraries written for it; \item it is not useful to write a new protocol that makes the same things that the original one does, but simply with a different format for the exchanged messages. \end{itemize} Therefore, an overview of the original protocol is now presented. The messages exchanged by the board have a standard frame that can be described as a sequence of fields in a specific order. The frame format is composed of a header and an optional payload. The header is composed of three mandatory (M) fields, each of which is 1 byte in length, while the payload is an optional field whose maximum length is 61 bytes (this limit can be exceeded by setting the LF/MF field, as explained below). {\bf Figure \ref{fig:frame_format}} shows the general frame format. \begin{center} \includegraphics[width=1\linewidth]{pics/frame_format.eps} \captionof{figure}{General frame format.} \label{fig:frame_format} \end{center} The frame control field is 1 byte in length and contains information defining the frame type and other control flags (see {\bf Figure \ref{fig:control_field}}). \begin{center} \includegraphics[width=1\linewidth]{pics/control_field.eps} \captionof{figure}{Frame control field.} \label{fig:control_field} \end{center} The frame type subfield is 2 bits in length and is set to one of the values listed in {\bf Table \ref{tab:frame_list}}. \begin{center} \begin{tabularx}{0.9\linewidth}{|>{\centering\arraybackslash}X|>{\centering\arraybackslash}X|} \hline \textbf{Value} & \textbf{Frame Type} \\ \hlinewd{1.5pt} 00 & CONTROL \\ \hline 01 & DATA \\ \hline 10 & ACK \\ \hline 11 & NACK \\ \hline \end{tabularx} \captionof{table}{Frame type list} \label{tab:frame_list} \end{center} The ACK subfield is 1 bit in length and specifies whether an acknowledgement is required from the recipient on receipt of a DATA or CONTROL frame. If this field is set to one, the recipient sends an acknowledgment frame only if, upon reception, the frame passes all required levels of filtering. If this subfield is set to zero, the recipient device does not send an acknowledgment frame. It is possible to embed a payload in an acknowledgment frame (piggybacking) to send useful information to the transmitter and avoid further transactions. When the ACK field is set to one, and if, upon reception, the frame does not pass the required level of filtering, the recipient sends a no-acknowledgment frame (NACK), whose payload is an error code (e.g. unsupported command, value out of range,...). In the ACK and/or NACK frames the ACK field is set to zero and ignored upon reception. The LF/MF (last fragment / more fragment) subfield is 1 bit in length and it is used for fragmentation and reassembling. This field is set to zero to indicate a single frame or the last frame of a multiple-frame transaction. This field is set to 1 to indicate that other frames follow, all belonging to the same transaction. The frame version subfield is 2 bits in length and is set to ``00'' at this time. The QoS (Quality of Service) subfield is 2 bits in length and is set to one of the values listed in {\bf Table \ref{tab:qos_list}}. This subfield allows the application to exchange and process data and control frames with different priorities. \begin{center} \begin{tabularx}{0.9\linewidth}{|>{\centering\arraybackslash}X|>{\centering\arraybackslash}X|} \hline \textbf{Value} & \textbf{QoS} \\ \hlinewd{1.5pt} 00 & Normal Priority \\ \hline 01 & Medium Priority \\ \hline 10 & High Priority \\ \hline \end{tabularx} \captionof{table}{Frame type list} \label{tab:qos_list} \end{center} Returning to the frame format, the length field is 1 byte in length and contains the number of bytes that follow. Admitted values are in the range 1 to 62. The message ID is 1 byte in length and contains an identifier used to distinguish the messages. The frames are classified in four types: \begin{enumerate} \item Communication control frames. \item Board information frames. \item Sensor setting frames. \item Acquisition sensor data frames. \end{enumerate} A detailed description of the different frames can be found in the documentation about the Communication Protocol provided by STMicroelectronics\cite{STM_protocol}. {\bf Figure \ref{fig:adk_handshake}} shows the exchanged messages between the board and the Android device during a successful connection initialization. \begin{center} \includegraphics[width=0.95\linewidth]{pics/adk_handshake.eps} \captionof{figure}{Sequence diagram of the handshake process.} \label{fig:adk_handshake} \end{center}
zz314326255--adkping
iNEMO-accessory/report/sections/sec4.tex
TeX
oos
5,593
\section{Android Open ADK} \label{adk_sec} The iNEMO board and the Android-powered device communicate on a USB bus. USB is an asymmetric protocol in that one participant acts as a USB Host and all other participants are USB Devices. The USB Host has two important tasks. The first is to be the bus master and control which device sends data at what times. The second key task is to provide power, since USB is a powered bus (see {\bf Figure \ref{fig:usb_normal}}). The problem with supporting accessories on Android in the traditional way is that relatively few devices support Host mode. Android Open ADK offers an answer to this problem, inverting the normal USB relationship. \begin{center} \includegraphics[width=1\linewidth]{pics/usb_normal.eps} \captionof{figure}{Normal USB relationship.} \label{fig:usb_normal} \end{center} During the Google I/O 2011 conference, Google announced the Android Open Accessory APIs for Android. These APIs allow USB accessories to connect to Android devices running Android 3.1 or Android 2.3.4 without special licensing or fees. The new ``accessory mode'' does not require the Android device to support USB Host mode. In accessory mode the Android phone or tablet acts as the USB Device and the accessory acts as the USB Host. This means that the accessory is the bus master and provides power (see {\bf Figure \ref{fig:usb_accessory}}). \begin{center} \includegraphics[width=1\linewidth]{pics/usb_accessory.eps} \captionof{figure}{Inverted USB relationship: the accessory acts as the USB host.} \label{fig:usb_accessory} \end{center} Building an Open Accessory is quite simple, as the only HW requirements are to include a USB host and provide power to the Android device. The accessory needs to implement a simple handshake to establish a bi-directional connection with an application running on the Android device. The handshake starts when the accessory detects that a device has been connected to it. The Android device will identify itself with the VID/PID that are defined by the manufacturer and the model of the device. The accessory then sends a control transaction to the Android device asking if it supports accessory mode. Once the accessory confirms the Android device supports accessory mode, it sends a series of strings to the Android device using control transactions. These strings allow the Android device to identify compatible applications as well as provide a URL that Android will use if a suitable app is not found. Next the accessory sends a control transaction to the Android device telling it to enter accessory mode. The Android device then drops off the bus and reappears with a new VID/PID combination. The new VID/PID corresponds to a device in accessory mode, which is Google's VID 0x18D1, and PID 0x2D01 or 0x2D00. Once an appropriate application is started on the Android side, the accessory can now communicate with it using the first Bulk IN and Bulk OUT endpoints. The protocol is quite easy to implement on the accessory: a complete tutorial on the implementation of Open ADK can be found in the USB section of the official Android Developer's Guide\footnote{Android Developer's Guide: \url{http://developer.android.com/guide/index.html}}.
zz314326255--adkping
iNEMO-accessory/report/sections/sec3.tex
TeX
oos
3,234
% Macros for Scientific Word 3.0 documents saved with the LaTeX filter. %Copyright (C) 1994-97 TCI Software Research, Inc. \typeout{TCILATEX Macros for Scientific Word 3.0 <05 August 1998>.} \typeout{NOTICE: This macro file is NOT proprietary and may be freely copied and distributed.} % \makeatletter % %%%%%%%%%%%%%%%%%%%%%% % macros for time \newcount\@hour\newcount\@minute\chardef\@x10\chardef\@xv60 \def\tcitime{ \def\@time{% \@minute\time\@hour\@minute\divide\@hour\@xv \ifnum\@hour<\@x 0\fi\the\@hour:% \multiply\@hour\@xv\advance\@minute-\@hour \ifnum\@minute<\@x 0\fi\the\@minute }}% %%%%%%%%%%%%%%%%%%%%%% % macro for hyperref \@ifundefined{hyperref}{\def\hyperref#1#2#3#4{#2\ref{#4}#3}}{} % macro for external program call \@ifundefined{qExtProgCall}{\def\qExtProgCall#1#2#3#4#5#6{\relax}}{} %%%%%%%%%%%%%%%%%%%%%% % % macros for graphics % \def\FILENAME#1{#1}% % \def\QCTOpt[#1]#2{% \def\QCTOptB{#1} \def\QCTOptA{#2} } \def\QCTNOpt#1{% \def\QCTOptA{#1} \let\QCTOptB\empty } \def\Qct{% \@ifnextchar[{% \QCTOpt}{\QCTNOpt} } \def\QCBOpt[#1]#2{% \def\QCBOptB{#1} \def\QCBOptA{#2} } \def\QCBNOpt#1{% \def\QCBOptA{#1} \let\QCBOptB\empty } \def\Qcb{% \@ifnextchar[{% \QCBOpt}{\QCBNOpt} } \def\PrepCapArgs{% \ifx\QCBOptA\empty \ifx\QCTOptA\empty {}% \else \ifx\QCTOptB\empty {\QCTOptA}% \else [\QCTOptB]{\QCTOptA}% \fi \fi \else \ifx\QCBOptA\empty {}% \else \ifx\QCBOptB\empty {\QCBOptA}% \else [\QCBOptB]{\QCBOptA}% \fi \fi \fi } \newcount\GRAPHICSTYPE %\GRAPHICSTYPE 0 is for TurboTeX %\GRAPHICSTYPE 1 is for DVIWindo (PostScript) %%%(removed)%\GRAPHICSTYPE 2 is for psfig (PostScript) \GRAPHICSTYPE=\z@ \def\GRAPHICSPS#1{% \ifcase\GRAPHICSTYPE%\GRAPHICSTYPE=0 \special{ps: #1}% \or%\GRAPHICSTYPE=1 \special{language "PS", include "#1"}% %%%\or%\GRAPHICSTYPE=2 %%% #1% \fi }% % \def\GRAPHICSHP#1{\special{include #1}}% % % \graffile{ body } %#1 % { contentswidth (scalar) } %#2 % { contentsheight (scalar) } %#3 % { vertical shift when in-line (scalar) } %#4 \def\graffile#1#2#3#4{% %%% \ifnum\GRAPHICSTYPE=\tw@ %%% %Following if using psfig %%% \@ifundefined{psfig}{\input psfig.tex}{}% %%% \psfig{file=#1, height=#3, width=#2}% %%% \else %Following for all others % JCS - added BOXTHEFRAME, see below \bgroup \leavevmode \@ifundefined{bbl@deactivate}{\def~{\string~}}{\activesoff} \raise -#4 \BOXTHEFRAME{% \hbox to #2{\raise #3\hbox to #2{\null #1\hfil}}}% \egroup }% % % A box for drafts \def\draftbox#1#2#3#4{% \leavevmode\raise -#4 \hbox{% \frame{\rlap{\protect\tiny #1}\hbox to #2% {\vrule height#3 width\z@ depth\z@\hfil}% }% }% }% % \newcount\draft \draft=\z@ \let\nographics=\draft \newif\ifwasdraft \wasdraftfalse % \GRAPHIC{ body } %#1 % { draft name } %#2 % { contentswidth (scalar) } %#3 % { contentsheight (scalar) } %#4 % { vertical shift when in-line (scalar) } %#5 \def\GRAPHIC#1#2#3#4#5{% \ifnum\draft=\@ne\draftbox{#2}{#3}{#4}{#5}% \else\graffile{#1}{#3}{#4}{#5}% \fi }% % \def\addtoLaTeXparams#1{% \edef\LaTeXparams{\LaTeXparams #1}}% % % JCS - added a switch BoxFrame that can % be set by including X in the frame params. % If set a box is drawn around the frame. \newif\ifBoxFrame \BoxFramefalse \newif\ifOverFrame \OverFramefalse \newif\ifUnderFrame \UnderFramefalse \def\BOXTHEFRAME#1{% \hbox{% \ifBoxFrame \frame{#1}% \else {#1}% \fi }% } \def\doFRAMEparams#1{\BoxFramefalse\OverFramefalse\UnderFramefalse\readFRAMEparams#1\end}% \def\readFRAMEparams#1{% \ifx#1\end% \let\next=\relax \else \ifx#1i\dispkind=\z@\fi \ifx#1d\dispkind=\@ne\fi \ifx#1f\dispkind=\tw@\fi \ifx#1t\addtoLaTeXparams{t}\fi \ifx#1b\addtoLaTeXparams{b}\fi \ifx#1p\addtoLaTeXparams{p}\fi \ifx#1h\addtoLaTeXparams{h}\fi \ifx#1X\BoxFrametrue\fi \ifx#1O\OverFrametrue\fi \ifx#1U\UnderFrametrue\fi \ifx#1w \ifnum\draft=1\wasdrafttrue\else\wasdraftfalse\fi \draft=\@ne \fi \let\next=\readFRAMEparams \fi \next }% % %Macro for In-line graphics object % \IFRAME{ contentswidth (scalar) } %#1 % { contentsheight (scalar) } %#2 % { vertical shift when in-line (scalar) } %#3 % { draft name } %#4 % { body } %#5 % { caption} %#6 \def\IFRAME#1#2#3#4#5#6{% \bgroup \let\QCTOptA\empty \let\QCTOptB\empty \let\QCBOptA\empty \let\QCBOptB\empty #6% \parindent=0pt% \leftskip=0pt \rightskip=0pt \setbox0 = \hbox{\QCBOptA}% \@tempdima = #1\relax \ifOverFrame % Do this later \typeout{This is not implemented yet}% \show\HELP \else \ifdim\wd0>\@tempdima \advance\@tempdima by \@tempdima \ifdim\wd0 >\@tempdima \textwidth=\@tempdima \setbox1 =\vbox{% \noindent\hbox to \@tempdima{\hfill\GRAPHIC{#5}{#4}{#1}{#2}{#3}\hfill}\\% \noindent\hbox to \@tempdima{\parbox[b]{\@tempdima}{\QCBOptA}}% }% \wd1=\@tempdima \else \textwidth=\wd0 \setbox1 =\vbox{% \noindent\hbox to \wd0{\hfill\GRAPHIC{#5}{#4}{#1}{#2}{#3}\hfill}\\% \noindent\hbox{\QCBOptA}% }% \wd1=\wd0 \fi \else %\show\BBB \ifdim\wd0>0pt \hsize=\@tempdima \setbox1 =\vbox{% \unskip\GRAPHIC{#5}{#4}{#1}{#2}{0pt}% \break \unskip\hbox to \@tempdima{\hfill \QCBOptA\hfill}% }% \wd1=\@tempdima \else \hsize=\@tempdima \setbox1 =\vbox{% \unskip\GRAPHIC{#5}{#4}{#1}{#2}{0pt}% }% \wd1=\@tempdima \fi \fi \@tempdimb=\ht1 \advance\@tempdimb by \dp1 \advance\@tempdimb by -#2% \advance\@tempdimb by #3% \leavevmode \raise -\@tempdimb \hbox{\box1}% \fi \egroup% }% % %Macro for Display graphics object % \DFRAME{ contentswidth (scalar) } %#1 % { contentsheight (scalar) } %#2 % { draft label } %#3 % { name } %#4 % { caption} %#5 \def\DFRAME#1#2#3#4#5{% \begin{center} \let\QCTOptA\empty \let\QCTOptB\empty \let\QCBOptA\empty \let\QCBOptB\empty \ifOverFrame #5\QCTOptA\par \fi \GRAPHIC{#4}{#3}{#1}{#2}{\z@} \ifUnderFrame \nobreak\par\nobreak#5\QCBOptA \fi \end{center}% }% % %Macro for Floating graphic object % \FFRAME{ framedata f|i tbph x F|T } %#1 % { contentswidth (scalar) } %#2 % { contentsheight (scalar) } %#3 % { caption } %#4 % { label } %#5 % { draft name } %#6 % { body } %#7 \def\FFRAME#1#2#3#4#5#6#7{% %If float.sty loaded and float option is 'h', change to 'H' (gp) 1998/09/05 \@ifundefined{floatstyle} {%floatstyle undefined (and float.sty not present), no change \begin{figure}[#1]% } {%floatstyle DEFINED \ifx#1h%Only the h parameter, change to H \begin{figure}[H]% \else \begin{figure}[#1]% \fi } \let\QCTOptA\empty \let\QCTOptB\empty \let\QCBOptA\empty \let\QCBOptB\empty \ifOverFrame #4 \ifx\QCTOptA\empty \else \ifx\QCTOptB\empty \caption{\QCTOptA}% \else \caption[\QCTOptB]{\QCTOptA}% \fi \fi \ifUnderFrame\else \label{#5}% \fi \else \UnderFrametrue% \fi \begin{center}\GRAPHIC{#7}{#6}{#2}{#3}{\z@}\end{center}% \ifUnderFrame #4 \ifx\QCBOptA\empty \caption{}% \else \ifx\QCBOptB\empty \caption{\QCBOptA}% \else \caption[\QCBOptB]{\QCBOptA}% \fi \fi \label{#5}% \fi \end{figure}% }% % % % \FRAME{ framedata f|i tbph x F|T } %#1 % { contentswidth (scalar) } %#2 % { contentsheight (scalar) } %#3 % { vertical shift when in-line (scalar) } %#4 % { caption } %#5 % { label } %#6 % { name } %#7 % { body } %#8 % % framedata is a string which can contain the following % characters: idftbphxFT % Their meaning is as follows: % i, d or f : in-line, display, or floating % t,b,p,h : LaTeX floating placement options % x : fit contents box to contents % F or T : Figure or Table. % Later this can expand % to a more general float class. % % \newcount\dispkind% \def\makeactives{ \catcode`\"=\active \catcode`\;=\active \catcode`\:=\active \catcode`\'=\active \catcode`\~=\active } \bgroup \makeactives \gdef\activesoff{% \def"{\string"} \def;{\string;} \def:{\string:} \def'{\string'} \def~{\string~} %\bbl@deactivate{"}% %\bbl@deactivate{;}% %\bbl@deactivate{:}% %\bbl@deactivate{'}% } \egroup \def\FRAME#1#2#3#4#5#6#7#8{% \bgroup \ifnum\draft=\@ne \wasdrafttrue \else \wasdraftfalse% \fi \def\LaTeXparams{}% \dispkind=\z@ \def\LaTeXparams{}% \doFRAMEparams{#1}% \ifnum\dispkind=\z@\IFRAME{#2}{#3}{#4}{#7}{#8}{#5}\else \ifnum\dispkind=\@ne\DFRAME{#2}{#3}{#7}{#8}{#5}\else \ifnum\dispkind=\tw@ \edef\@tempa{\noexpand\FFRAME{\LaTeXparams}}% \@tempa{#2}{#3}{#5}{#6}{#7}{#8}% \fi \fi \fi \ifwasdraft\draft=1\else\draft=0\fi{}% \egroup }% % % This macro added to let SW gobble a parameter that % should not be passed on and expanded. \def\TEXUX#1{"texux"} % % Macros for text attributes: % \def\BF#1{{\bf {#1}}}% \def\NEG#1{\leavevmode\hbox{\rlap{\thinspace/}{$#1$}}}% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % macros for user - defined functions \def\limfunc#1{\mathop{\rm #1}}% \def\func#1{\mathop{\rm #1}\nolimits}% % macro for unit names \def\unit#1{\mathop{\rm #1}\nolimits}% % % miscellaneous \long\def\QQQ#1#2{% \long\expandafter\def\csname#1\endcsname{#2}}% \@ifundefined{QTP}{\def\QTP#1{}}{} \@ifundefined{QEXCLUDE}{\def\QEXCLUDE#1{}}{} \@ifundefined{Qlb}{\def\Qlb#1{#1}}{} \@ifundefined{Qlt}{\def\Qlt#1{#1}}{} \def\QWE{}% \long\def\QQA#1#2{}% \def\QTR#1#2{{\csname#1\endcsname #2}}%(gp) Is this the best? \long\def\TeXButton#1#2{#2}% \long\def\QSubDoc#1#2{#2}% \def\EXPAND#1[#2]#3{}% \def\NOEXPAND#1[#2]#3{}% \def\PROTECTED{}% \def\LaTeXparent#1{}% \def\ChildStyles#1{}% \def\ChildDefaults#1{}% \def\QTagDef#1#2#3{}% % Constructs added with Scientific Notebook \@ifundefined{correctchoice}{\def\correctchoice{\relax}}{} \@ifundefined{HTML}{\def\HTML#1{\relax}}{} \@ifundefined{TCIIcon}{\def\TCIIcon#1#2#3#4{\relax}}{} \if@compatibility \typeout{Not defining UNICODE or CustomNote commands for LaTeX 2.09.} \else \providecommand{\UNICODE}[2][]{} \providecommand{\CustomNote}[3][]{\marginpar{#3}} \fi % % Macros for style editor docs \@ifundefined{StyleEditBeginDoc}{\def\StyleEditBeginDoc{\relax}}{} % % Macros for footnotes \def\QQfnmark#1{\footnotemark} \def\QQfntext#1#2{\addtocounter{footnote}{#1}\footnotetext{#2}} % % Macros for indexing. % \@ifundefined{TCIMAKEINDEX}{}{\makeindex}% % % Attempts to avoid problems with other styles \@ifundefined{abstract}{% \def\abstract{% \if@twocolumn \section*{Abstract (Not appropriate in this style!)}% \else \small \begin{center}{\bf Abstract\vspace{-.5em}\vspace{\z@}}\end{center}% \quotation \fi }% }{% }% \@ifundefined{endabstract}{\def\endabstract {\if@twocolumn\else\endquotation\fi}}{}% \@ifundefined{maketitle}{\def\maketitle#1{}}{}% \@ifundefined{affiliation}{\def\affiliation#1{}}{}% \@ifundefined{proof}{\def\proof{\noindent{\bfseries Proof. }}}{}% \@ifundefined{endproof}{\def\endproof{\mbox{\ \rule{.1in}{.1in}}}}{}% \@ifundefined{newfield}{\def\newfield#1#2{}}{}% \@ifundefined{chapter}{\def\chapter#1{\par(Chapter head:)#1\par }% \newcount\c@chapter}{}% \@ifundefined{part}{\def\part#1{\par(Part head:)#1\par }}{}% \@ifundefined{section}{\def\section#1{\par(Section head:)#1\par }}{}% \@ifundefined{subsection}{\def\subsection#1% {\par(Subsection head:)#1\par }}{}% \@ifundefined{subsubsection}{\def\subsubsection#1% {\par(Subsubsection head:)#1\par }}{}% \@ifundefined{paragraph}{\def\paragraph#1% {\par(Subsubsubsection head:)#1\par }}{}% \@ifundefined{subparagraph}{\def\subparagraph#1% {\par(Subsubsubsubsection head:)#1\par }}{}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % These symbols are not recognized by LaTeX \@ifundefined{therefore}{\def\therefore{}}{}% \@ifundefined{backepsilon}{\def\backepsilon{}}{}% \@ifundefined{yen}{\def\yen{\hbox{\rm\rlap=Y}}}{}% \@ifundefined{registered}{% \def\registered{\relax\ifmmode{}\r@gistered \else$\m@th\r@gistered$\fi}% \def\r@gistered{^{\ooalign {\hfil\raise.07ex\hbox{$\scriptstyle\rm\text{R}$}\hfil\crcr \mathhexbox20D}}}}{}% \@ifundefined{Eth}{\def\Eth{}}{}% \@ifundefined{eth}{\def\eth{}}{}% \@ifundefined{Thorn}{\def\Thorn{}}{}% \@ifundefined{thorn}{\def\thorn{}}{}% % A macro to allow any symbol that requires math to appear in text \def\TEXTsymbol#1{\mbox{$#1$}}% \@ifundefined{degree}{\def\degree{{}^{\circ}}}{}% % % macros for T3TeX files \newdimen\theight \def\Column{% \vadjust{\setbox\z@=\hbox{\scriptsize\quad\quad tcol}% \theight=\ht\z@\advance\theight by \dp\z@\advance\theight by \lineskip \kern -\theight \vbox to \theight{% \rightline{\rlap{\box\z@}}% \vss }% }% }% % \def\qed{% \ifhmode\unskip\nobreak\fi\ifmmode\ifinner\else\hskip5\p@\fi\fi \hbox{\hskip5\p@\vrule width4\p@ height6\p@ depth1.5\p@\hskip\p@}% }% % \def\cents{\hbox{\rm\rlap/c}}% \def\miss{\hbox{\vrule height2\p@ width 2\p@ depth\z@}}% % \def\vvert{\Vert}% %always translated to \left| or \right| % \def\tcol#1{{\baselineskip=6\p@ \vcenter{#1}} \Column} % % \def\dB{\hbox{{}}}% %dummy entry in column \def\mB#1{\hbox{$#1$}}% %column entry \def\nB#1{\hbox{#1}}% %column entry (not math) % \@ifundefined{note}{\def\note{$^{\dag}}}{}% % \def\newfmtname{LaTeX2e} % No longer load latexsym. This is now handled by SWP, which uses amsfonts if necessary \ifx\fmtname\newfmtname \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} \DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt} \DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf} \DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} \DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl} \DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc} \fi % % Greek bold macros % Redefine all of the math symbols % which might be bolded - there are % probably others to add to this list \def\alpha{{\Greekmath 010B}}% \def\beta{{\Greekmath 010C}}% \def\gamma{{\Greekmath 010D}}% \def\delta{{\Greekmath 010E}}% \def\epsilon{{\Greekmath 010F}}% \def\zeta{{\Greekmath 0110}}% \def\eta{{\Greekmath 0111}}% \def\theta{{\Greekmath 0112}}% \def\iota{{\Greekmath 0113}}% \def\kappa{{\Greekmath 0114}}% \def\lambda{{\Greekmath 0115}}% \def\mu{{\Greekmath 0116}}% \def\nu{{\Greekmath 0117}}% \def\xi{{\Greekmath 0118}}% \def\pi{{\Greekmath 0119}}% \def\rho{{\Greekmath 011A}}% \def\sigma{{\Greekmath 011B}}% \def\tau{{\Greekmath 011C}}% \def\upsilon{{\Greekmath 011D}}% \def\phi{{\Greekmath 011E}}% \def\chi{{\Greekmath 011F}}% \def\psi{{\Greekmath 0120}}% \def\omega{{\Greekmath 0121}}% \def\varepsilon{{\Greekmath 0122}}% \def\vartheta{{\Greekmath 0123}}% \def\varpi{{\Greekmath 0124}}% \def\varrho{{\Greekmath 0125}}% \def\varsigma{{\Greekmath 0126}}% \def\varphi{{\Greekmath 0127}}% \def\nabla{{\Greekmath 0272}} \def\FindBoldGroup{% {\setbox0=\hbox{$\mathbf{x\global\edef\theboldgroup{\the\mathgroup}}$}}% } \def\Greekmath#1#2#3#4{% \if@compatibility \ifnum\mathgroup=\symbold \mathchoice{\mbox{\boldmath$\displaystyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\textstyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\scriptstyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\scriptscriptstyle\mathchar"#1#2#3#4$}}% \else \mathchar"#1#2#3#4% \fi \else \FindBoldGroup \ifnum\mathgroup=\theboldgroup % For 2e \mathchoice{\mbox{\boldmath$\displaystyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\textstyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\scriptstyle\mathchar"#1#2#3#4$}}% {\mbox{\boldmath$\scriptscriptstyle\mathchar"#1#2#3#4$}}% \else \mathchar"#1#2#3#4% \fi \fi} \newif\ifGreekBold \GreekBoldfalse \let\SAVEPBF=\pbf \def\pbf{\GreekBoldtrue\SAVEPBF}% % \@ifundefined{theorem}{\newtheorem{theorem}{Theorem}}{} \@ifundefined{lemma}{\newtheorem{lemma}[theorem]{Lemma}}{} \@ifundefined{corollary}{\newtheorem{corollary}[theorem]{Corollary}}{} \@ifundefined{conjecture}{\newtheorem{conjecture}[theorem]{Conjecture}}{} \@ifundefined{proposition}{\newtheorem{proposition}[theorem]{Proposition}}{} \@ifundefined{axiom}{\newtheorem{axiom}{Axiom}}{} \@ifundefined{remark}{\newtheorem{remark}{Remark}}{} \@ifundefined{example}{\newtheorem{example}{Example}}{} \@ifundefined{exercise}{\newtheorem{exercise}{Exercise}}{} \@ifundefined{definition}{\newtheorem{definition}{Definition}}{} \@ifundefined{mathletters}{% %\def\theequation{\arabic{equation}} \newcounter{equationnumber} \def\mathletters{% \addtocounter{equation}{1} \edef\@currentlabel{\theequation}% \setcounter{equationnumber}{\c@equation} \setcounter{equation}{0}% \edef\theequation{\@currentlabel\noexpand\alph{equation}}% } \def\endmathletters{% \setcounter{equation}{\value{equationnumber}}% } }{} %Logos \@ifundefined{BibTeX}{% \def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}}{}% \@ifundefined{AmS}% {\def\AmS{{\protect\usefont{OMS}{cmsy}{m}{n}% A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}}{}% \@ifundefined{AmSTeX}{\def\AmSTeX{\protect\AmS-\protect\TeX\@}}{}% % % This macro is a fix to eqnarray \def\@@eqncr{\let\@tempa\relax \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% \else \def\@tempa{&}\fi \@tempa \if@eqnsw \iftag@ \@taggnum \else \@eqnnum\stepcounter{equation}% \fi \fi \global\tag@false \global\@eqnswtrue \global\@eqcnt\z@\cr} \def\TCItag{\@ifnextchar*{\@TCItagstar}{\@TCItag}} \def\@TCItag#1{% \global\tag@true \global\def\@taggnum{(#1)}} \def\@TCItagstar*#1{% \global\tag@true \global\def\@taggnum{#1}} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \def\tfrac#1#2{{\textstyle {#1 \over #2}}}% \def\dfrac#1#2{{\displaystyle {#1 \over #2}}}% \def\binom#1#2{{#1 \choose #2}}% \def\tbinom#1#2{{\textstyle {#1 \choose #2}}}% \def\dbinom#1#2{{\displaystyle {#1 \choose #2}}}% \def\QATOP#1#2{{#1 \atop #2}}% \def\QTATOP#1#2{{\textstyle {#1 \atop #2}}}% \def\QDATOP#1#2{{\displaystyle {#1 \atop #2}}}% \def\QABOVE#1#2#3{{#2 \above#1 #3}}% \def\QTABOVE#1#2#3{{\textstyle {#2 \above#1 #3}}}% \def\QDABOVE#1#2#3{{\displaystyle {#2 \above#1 #3}}}% \def\QOVERD#1#2#3#4{{#3 \overwithdelims#1#2 #4}}% \def\QTOVERD#1#2#3#4{{\textstyle {#3 \overwithdelims#1#2 #4}}}% \def\QDOVERD#1#2#3#4{{\displaystyle {#3 \overwithdelims#1#2 #4}}}% \def\QATOPD#1#2#3#4{{#3 \atopwithdelims#1#2 #4}}% \def\QTATOPD#1#2#3#4{{\textstyle {#3 \atopwithdelims#1#2 #4}}}% \def\QDATOPD#1#2#3#4{{\displaystyle {#3 \atopwithdelims#1#2 #4}}}% \def\QABOVED#1#2#3#4#5{{#4 \abovewithdelims#1#2#3 #5}}% \def\QTABOVED#1#2#3#4#5{{\textstyle {#4 \abovewithdelims#1#2#3 #5}}}% \def\QDABOVED#1#2#3#4#5{{\displaystyle {#4 \abovewithdelims#1#2#3 #5}}}% % % Macros for text size operators: % \def\tint{\mathop{\textstyle \int}}% \def\tiint{\mathop{\textstyle \iint }}% \def\tiiint{\mathop{\textstyle \iiint }}% \def\tiiiint{\mathop{\textstyle \iiiint }}% \def\tidotsint{\mathop{\textstyle \idotsint }}% \def\toint{\mathop{\textstyle \oint}}% \def\tsum{\mathop{\textstyle \sum }}% \def\tprod{\mathop{\textstyle \prod }}% \def\tbigcap{\mathop{\textstyle \bigcap }}% \def\tbigwedge{\mathop{\textstyle \bigwedge }}% \def\tbigoplus{\mathop{\textstyle \bigoplus }}% \def\tbigodot{\mathop{\textstyle \bigodot }}% \def\tbigsqcup{\mathop{\textstyle \bigsqcup }}% \def\tcoprod{\mathop{\textstyle \coprod }}% \def\tbigcup{\mathop{\textstyle \bigcup }}% \def\tbigvee{\mathop{\textstyle \bigvee }}% \def\tbigotimes{\mathop{\textstyle \bigotimes }}% \def\tbiguplus{\mathop{\textstyle \biguplus }}% % % %Macros for display size operators: % \def\dint{\mathop{\displaystyle \int}}% \def\diint{\mathop{\displaystyle \iint }}% \def\diiint{\mathop{\displaystyle \iiint }}% \def\diiiint{\mathop{\displaystyle \iiiint }}% \def\didotsint{\mathop{\displaystyle \idotsint }}% \def\doint{\mathop{\displaystyle \oint}}% \def\dsum{\mathop{\displaystyle \sum }}% \def\dprod{\mathop{\displaystyle \prod }}% \def\dbigcap{\mathop{\displaystyle \bigcap }}% \def\dbigwedge{\mathop{\displaystyle \bigwedge }}% \def\dbigoplus{\mathop{\displaystyle \bigoplus }}% \def\dbigodot{\mathop{\displaystyle \bigodot }}% \def\dbigsqcup{\mathop{\displaystyle \bigsqcup }}% \def\dcoprod{\mathop{\displaystyle \coprod }}% \def\dbigcup{\mathop{\displaystyle \bigcup }}% \def\dbigvee{\mathop{\displaystyle \bigvee }}% \def\dbigotimes{\mathop{\displaystyle \bigotimes }}% \def\dbiguplus{\mathop{\displaystyle \biguplus }}% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NOTE: The rest of this file is read only if amstex has not been % loaded. This section is used to define amstex constructs in the % event they have not been defined. % % \ifx\ds@amstex\relax \message{amstex already loaded}\makeatother\endinput% 2.09 compatability \else \@ifpackageloaded{amsmath}% {\message{amsmath already loaded}\makeatother\endinput} {} \@ifpackageloaded{amstex}% {\message{amstex already loaded}\makeatother\endinput} {} \@ifpackageloaded{amsgen}% {\message{amsgen already loaded}\makeatother\endinput} {} \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% % % % Macros to define some AMS LaTeX constructs when % AMS LaTeX has not been loaded % % These macros are copied from the AMS-TeX package for doing % multiple integrals. % \let\DOTSI\relax \def\RIfM@{\relax\ifmmode}% \def\FN@{\futurelet\next}% \newcount\intno@ \def\iint{\DOTSI\intno@\tw@\FN@\ints@}% \def\iiint{\DOTSI\intno@\thr@@\FN@\ints@}% \def\iiiint{\DOTSI\intno@4 \FN@\ints@}% \def\idotsint{\DOTSI\intno@\z@\FN@\ints@}% \def\ints@{\findlimits@\ints@@}% \newif\iflimtoken@ \newif\iflimits@ \def\findlimits@{\limtoken@true\ifx\next\limits\limits@true \else\ifx\next\nolimits\limits@false\else \limtoken@false\ifx\ilimits@\nolimits\limits@false\else \ifinner\limits@false\else\limits@true\fi\fi\fi\fi}% \def\multint@{\int\ifnum\intno@=\z@\intdots@ %1 \else\intkern@\fi %2 \ifnum\intno@>\tw@\int\intkern@\fi %3 \ifnum\intno@>\thr@@\int\intkern@\fi %4 \int}% %5 \def\multintlimits@{\intop\ifnum\intno@=\z@\intdots@\else\intkern@\fi \ifnum\intno@>\tw@\intop\intkern@\fi \ifnum\intno@>\thr@@\intop\intkern@\fi\intop}% \def\intic@{% \mathchoice{\hskip.5em}{\hskip.4em}{\hskip.4em}{\hskip.4em}}% \def\negintic@{\mathchoice {\hskip-.5em}{\hskip-.4em}{\hskip-.4em}{\hskip-.4em}}% \def\ints@@{\iflimtoken@ %1 \def\ints@@@{\iflimits@\negintic@ \mathop{\intic@\multintlimits@}\limits %2 \else\multint@\nolimits\fi %3 \eat@}% %4 \else %5 \def\ints@@@{\iflimits@\negintic@ \mathop{\intic@\multintlimits@}\limits\else \multint@\nolimits\fi}\fi\ints@@@}% \def\intkern@{\mathchoice{\!\!\!}{\!\!}{\!\!}{\!\!}}% \def\plaincdots@{\mathinner{\cdotp\cdotp\cdotp}}% \def\intdots@{\mathchoice{\plaincdots@}% {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}% {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}% {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}}% % % % These macros are for doing the AMS \text{} construct % \def\RIfM@{\relax\protect\ifmmode} \def\text{\RIfM@\expandafter\text@\else\expandafter\mbox\fi} \let\nfss@text\text \def\text@#1{\mathchoice {\textdef@\displaystyle\f@size{#1}}% {\textdef@\textstyle\tf@size{\firstchoice@false #1}}% {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% \glb@settings} \def\textdef@#1#2#3{\hbox{{% \everymath{#1}% \let\f@size#2\selectfont #3}}} \newif\iffirstchoice@ \firstchoice@true % %These are the AMS constructs for multiline limits. % \def\Let@{\relax\iffalse{\fi\let\\=\cr\iffalse}\fi}% \def\vspace@{\def\vspace##1{\crcr\noalign{\vskip##1\relax}}}% \def\multilimits@{\bgroup\vspace@\Let@ \baselineskip\fontdimen10 \scriptfont\tw@ \advance\baselineskip\fontdimen12 \scriptfont\tw@ \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ \lineskiplimit\lineskip \vbox\bgroup\ialign\bgroup\hfil$\m@th\scriptstyle{##}$\hfil\crcr}% \def\Sb{_\multilimits@}% \def\endSb{\crcr\egroup\egroup\egroup}% \def\Sp{^\multilimits@}% \let\endSp\endSb % % %These are AMS constructs for horizontal arrows % \newdimen\ex@ \ex@.2326ex \def\rightarrowfill@#1{$#1\m@th\mathord-\mkern-6mu\cleaders \hbox{$#1\mkern-2mu\mathord-\mkern-2mu$}\hfill \mkern-6mu\mathord\rightarrow$}% \def\leftarrowfill@#1{$#1\m@th\mathord\leftarrow\mkern-6mu\cleaders \hbox{$#1\mkern-2mu\mathord-\mkern-2mu$}\hfill\mkern-6mu\mathord-$}% \def\leftrightarrowfill@#1{$#1\m@th\mathord\leftarrow \mkern-6mu\cleaders \hbox{$#1\mkern-2mu\mathord-\mkern-2mu$}\hfill \mkern-6mu\mathord\rightarrow$}% \def\overrightarrow{\mathpalette\overrightarrow@}% \def\overrightarrow@#1#2{\vbox{\ialign{##\crcr\rightarrowfill@#1\crcr \noalign{\kern-\ex@\nointerlineskip}$\m@th\hfil#1#2\hfil$\crcr}}}% \let\overarrow\overrightarrow \def\overleftarrow{\mathpalette\overleftarrow@}% \def\overleftarrow@#1#2{\vbox{\ialign{##\crcr\leftarrowfill@#1\crcr \noalign{\kern-\ex@\nointerlineskip}$\m@th\hfil#1#2\hfil$\crcr}}}% \def\overleftrightarrow{\mathpalette\overleftrightarrow@}% \def\overleftrightarrow@#1#2{\vbox{\ialign{##\crcr \leftrightarrowfill@#1\crcr \noalign{\kern-\ex@\nointerlineskip}$\m@th\hfil#1#2\hfil$\crcr}}}% \def\underrightarrow{\mathpalette\underrightarrow@}% \def\underrightarrow@#1#2{\vtop{\ialign{##\crcr$\m@th\hfil#1#2\hfil $\crcr\noalign{\nointerlineskip}\rightarrowfill@#1\crcr}}}% \let\underarrow\underrightarrow \def\underleftarrow{\mathpalette\underleftarrow@}% \def\underleftarrow@#1#2{\vtop{\ialign{##\crcr$\m@th\hfil#1#2\hfil $\crcr\noalign{\nointerlineskip}\leftarrowfill@#1\crcr}}}% \def\underleftrightarrow{\mathpalette\underleftrightarrow@}% \def\underleftrightarrow@#1#2{\vtop{\ialign{##\crcr$\m@th \hfil#1#2\hfil$\crcr \noalign{\nointerlineskip}\leftrightarrowfill@#1\crcr}}}% %%%%%%%%%%%%%%%%%%%%% \def\qopnamewl@#1{\mathop{\operator@font#1}\nlimits@} \let\nlimits@\displaylimits \def\setboxz@h{\setbox\z@\hbox} \def\varlim@#1#2{\mathop{\vtop{\ialign{##\crcr \hfil$#1\m@th\operator@font lim$\hfil\crcr \noalign{\nointerlineskip}#2#1\crcr \noalign{\nointerlineskip\kern-\ex@}\crcr}}}} \def\rightarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ $#1\copy\z@\mkern-6mu\cleaders \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill \mkern-6mu\mathord\rightarrow$} \def\leftarrowfill@#1{\m@th\setboxz@h{$#1-$}\ht\z@\z@ $#1\mathord\leftarrow\mkern-6mu\cleaders \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill \mkern-6mu\box\z@$} \def\projlim{\qopnamewl@{proj\,lim}} \def\injlim{\qopnamewl@{inj\,lim}} \def\varinjlim{\mathpalette\varlim@\rightarrowfill@} \def\varprojlim{\mathpalette\varlim@\leftarrowfill@} \def\varliminf{\mathpalette\varliminf@{}} \def\varliminf@#1{\mathop{\underline{\vrule\@depth.2\ex@\@width\z@ \hbox{$#1\m@th\operator@font lim$}}}} \def\varlimsup{\mathpalette\varlimsup@{}} \def\varlimsup@#1{\mathop{\overline {\hbox{$#1\m@th\operator@font lim$}}}} % %Companion to stackrel \def\stackunder#1#2{\mathrel{\mathop{#2}\limits_{#1}}}% % % % These are AMS environments that will be defined to % be verbatims if amstex has not actually been % loaded % % \begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 \catcode `\{=12 \catcode `\}=12 \catcode`\\=12 |gdef|@alignverbatim#1\end{align}[#1|end[align]] |gdef|@salignverbatim#1\end{align*}[#1|end[align*]] |gdef|@alignatverbatim#1\end{alignat}[#1|end[alignat]] |gdef|@salignatverbatim#1\end{alignat*}[#1|end[alignat*]] |gdef|@xalignatverbatim#1\end{xalignat}[#1|end[xalignat]] |gdef|@sxalignatverbatim#1\end{xalignat*}[#1|end[xalignat*]] |gdef|@gatherverbatim#1\end{gather}[#1|end[gather]] |gdef|@sgatherverbatim#1\end{gather*}[#1|end[gather*]] |gdef|@gatherverbatim#1\end{gather}[#1|end[gather]] |gdef|@sgatherverbatim#1\end{gather*}[#1|end[gather*]] |gdef|@multilineverbatim#1\end{multiline}[#1|end[multiline]] |gdef|@smultilineverbatim#1\end{multiline*}[#1|end[multiline*]] |gdef|@arraxverbatim#1\end{arrax}[#1|end[arrax]] |gdef|@sarraxverbatim#1\end{arrax*}[#1|end[arrax*]] |gdef|@tabulaxverbatim#1\end{tabulax}[#1|end[tabulax]] |gdef|@stabulaxverbatim#1\end{tabulax*}[#1|end[tabulax*]] |endgroup \def\align{\@verbatim \frenchspacing\@vobeyspaces \@alignverbatim You are using the "align" environment in a style in which it is not defined.} \let\endalign=\endtrivlist \@namedef{align*}{\@verbatim\@salignverbatim You are using the "align*" environment in a style in which it is not defined.} \expandafter\let\csname endalign*\endcsname =\endtrivlist \def\alignat{\@verbatim \frenchspacing\@vobeyspaces \@alignatverbatim You are using the "alignat" environment in a style in which it is not defined.} \let\endalignat=\endtrivlist \@namedef{alignat*}{\@verbatim\@salignatverbatim You are using the "alignat*" environment in a style in which it is not defined.} \expandafter\let\csname endalignat*\endcsname =\endtrivlist \def\xalignat{\@verbatim \frenchspacing\@vobeyspaces \@xalignatverbatim You are using the "xalignat" environment in a style in which it is not defined.} \let\endxalignat=\endtrivlist \@namedef{xalignat*}{\@verbatim\@sxalignatverbatim You are using the "xalignat*" environment in a style in which it is not defined.} \expandafter\let\csname endxalignat*\endcsname =\endtrivlist \def\gather{\@verbatim \frenchspacing\@vobeyspaces \@gatherverbatim You are using the "gather" environment in a style in which it is not defined.} \let\endgather=\endtrivlist \@namedef{gather*}{\@verbatim\@sgatherverbatim You are using the "gather*" environment in a style in which it is not defined.} \expandafter\let\csname endgather*\endcsname =\endtrivlist \def\multiline{\@verbatim \frenchspacing\@vobeyspaces \@multilineverbatim You are using the "multiline" environment in a style in which it is not defined.} \let\endmultiline=\endtrivlist \@namedef{multiline*}{\@verbatim\@smultilineverbatim You are using the "multiline*" environment in a style in which it is not defined.} \expandafter\let\csname endmultiline*\endcsname =\endtrivlist \def\arrax{\@verbatim \frenchspacing\@vobeyspaces \@arraxverbatim You are using a type of "array" construct that is only allowed in AmS-LaTeX.} \let\endarrax=\endtrivlist \def\tabulax{\@verbatim \frenchspacing\@vobeyspaces \@tabulaxverbatim You are using a type of "tabular" construct that is only allowed in AmS-LaTeX.} \let\endtabulax=\endtrivlist \@namedef{arrax*}{\@verbatim\@sarraxverbatim You are using a type of "array*" construct that is only allowed in AmS-LaTeX.} \expandafter\let\csname endarrax*\endcsname =\endtrivlist \@namedef{tabulax*}{\@verbatim\@stabulaxverbatim You are using a type of "tabular*" construct that is only allowed in AmS-LaTeX.} \expandafter\let\csname endtabulax*\endcsname =\endtrivlist % macro to simulate ams tag construct % This macro is a fix to the equation environment \def\endequation{% \ifmmode\ifinner % FLEQN hack \iftag@ \addtocounter{equation}{-1} % undo the increment made in the begin part $\hfil \displaywidth\linewidth\@taggnum\egroup \endtrivlist \global\tag@false \global\@ignoretrue \else $\hfil \displaywidth\linewidth\@eqnnum\egroup \endtrivlist \global\tag@false \global\@ignoretrue \fi \else \iftag@ \addtocounter{equation}{-1} % undo the increment made in the begin part \eqno \hbox{\@taggnum} \global\tag@false% $$\global\@ignoretrue \else \eqno \hbox{\@eqnnum}% $$ BRACE MATCHING HACK $$\global\@ignoretrue \fi \fi\fi } \newif\iftag@ \tag@false \def\TCItag{\@ifnextchar*{\@TCItagstar}{\@TCItag}} \def\@TCItag#1{% \global\tag@true \global\def\@taggnum{(#1)}} \def\@TCItagstar*#1{% \global\tag@true \global\def\@taggnum{#1}} \@ifundefined{tag}{ \def\tag{\@ifnextchar*{\@tagstar}{\@tag}} \def\@tag#1{% \global\tag@true \global\def\@taggnum{(#1)}} \def\@tagstar*#1{% \global\tag@true \global\def\@taggnum{#1}} }{} % Do not add anything to the end of this file. % The last section of the file is loaded only if % amstex has not been. \makeatother \endinput
zz314326255--adkping
iNEMO-accessory/report/tcilatex.tex
TeX
oos
34,825
% This file was created with JabRef 2.3.1. % Encoding: UTF-8 @manual{STM_inemo, author = {STMicroelectronics}, title = {STEVAL-MKI062V2, iNEMO (iNErtial MOdule) demonstration board based on MEMS devices and STM32F103RE}, year = {2010} } @manual{STM_protocol, author = {STMicroelectronics}, title = {STEVAL-MKI062V2 communication protocol}, year = {2011} } @manual{Google_ADK_presentation, author = {Jeff Brown and Erik Gilling and Mike Lockwood}, title = {Introducing Android Open Accessories and ADK}, organization = {Google IO 2011}, year = {2011} } @manual{STM_ADK_presentation, author = {David Siorpaes}, title = {Android ADK updates}, year = {2011} } @manual{max3421e, author = {Maxim}, title = {MAX3421E Datasheet}, year = {2007} } @manual{ttl232r, author = {FTDI}, title = {TTL-232R-PCB, Datasheet}, year = {2010} }
zz314326255--adkping
iNEMO-accessory/report/Report.bib
BibTeX
oos
870
/** ****************************************************************************** * @file stm32f10x_crc.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the CRC firmware * library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_CRC_H #define __STM32F10x_CRC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup CRC * @{ */ /** @defgroup CRC_Exported_Types * @{ */ /** * @} */ /** @defgroup CRC_Exported_Constants * @{ */ /** * @} */ /** @defgroup CRC_Exported_Macros * @{ */ /** * @} */ /** @defgroup CRC_Exported_Functions * @{ */ void CRC_ResetDR(void); uint32_t CRC_CalcCRC(uint32_t Data); uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); uint32_t CRC_GetCRC(void); void CRC_SetIDRegister(uint8_t IDValue); uint8_t CRC_GetIDRegister(void); #endif /* __STM32F10x_CRC_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_crc.h
C
oos
1,980
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : cortexm3_macro.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : Header file for cortexm3_macro.s. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __CORTEXM3_MACRO_H #define __CORTEXM3_MACRO_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_type.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void __WFI(void); void __WFE(void); void __SEV(void); void __ISB(void); void __DSB(void); void __DMB(void); void __SVC(void); u32 __MRS_CONTROL(void); void __MSR_CONTROL(u32 Control); void __SETPRIMASK(void); void __RESETPRIMASK(void); void __SETFAULTMASK(void); void __RESETFAULTMASK(void); void __BASEPRICONFIG(u32 NewPriority); u32 __GetBASEPRI(void); u16 __REV_HalfWord(u16 Data); u32 __REV_Word(u32 Data); #endif /* __CORTEXM3_MACRO_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/cortexm3_macro.h
C
oos
2,172
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_rcc.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * RCC firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_RCC_H #define __STM32F10x_RCC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ typedef struct { u32 SYSCLK_Frequency; u32 HCLK_Frequency; u32 PCLK1_Frequency; u32 PCLK2_Frequency; u32 ADCCLK_Frequency; }RCC_ClocksTypeDef; /* Exported constants --------------------------------------------------------*/ /* HSE configuration */ #define RCC_HSE_OFF ((u32)0x00000000) #define RCC_HSE_ON ((u32)0x00010000) #define RCC_HSE_Bypass ((u32)0x00040000) #define IS_RCC_HSE(HSE) ((HSE == RCC_HSE_OFF) || (HSE == RCC_HSE_ON) || \ (HSE == RCC_HSE_Bypass)) /* PLL entry clock source */ #define RCC_PLLSource_HSI_Div2 ((u32)0x00000000) #define RCC_PLLSource_HSE_Div1 ((u32)0x00010000) #define RCC_PLLSource_HSE_Div2 ((u32)0x00030000) #define IS_RCC_PLL_SOURCE(SOURCE) ((SOURCE == RCC_PLLSource_HSI_Div2) || \ (SOURCE == RCC_PLLSource_HSE_Div1) || \ (SOURCE == RCC_PLLSource_HSE_Div2)) /* PLL multiplication factor */ #define RCC_PLLMul_2 ((u32)0x00000000) #define RCC_PLLMul_3 ((u32)0x00040000) #define RCC_PLLMul_4 ((u32)0x00080000) #define RCC_PLLMul_5 ((u32)0x000C0000) #define RCC_PLLMul_6 ((u32)0x00100000) #define RCC_PLLMul_7 ((u32)0x00140000) #define RCC_PLLMul_8 ((u32)0x00180000) #define RCC_PLLMul_9 ((u32)0x001C0000) #define RCC_PLLMul_10 ((u32)0x00200000) #define RCC_PLLMul_11 ((u32)0x00240000) #define RCC_PLLMul_12 ((u32)0x00280000) #define RCC_PLLMul_13 ((u32)0x002C0000) #define RCC_PLLMul_14 ((u32)0x00300000) #define RCC_PLLMul_15 ((u32)0x00340000) #define RCC_PLLMul_16 ((u32)0x00380000) #define IS_RCC_PLL_MUL(MUL) ((MUL == RCC_PLLMul_2) || (MUL == RCC_PLLMul_3) ||\ (MUL == RCC_PLLMul_4) || (MUL == RCC_PLLMul_5) ||\ (MUL == RCC_PLLMul_6) || (MUL == RCC_PLLMul_7) ||\ (MUL == RCC_PLLMul_8) || (MUL == RCC_PLLMul_9) ||\ (MUL == RCC_PLLMul_10) || (MUL == RCC_PLLMul_11) ||\ (MUL == RCC_PLLMul_12) || (MUL == RCC_PLLMul_13) ||\ (MUL == RCC_PLLMul_14) || (MUL == RCC_PLLMul_15) ||\ (MUL == RCC_PLLMul_16)) /* System clock source */ #define RCC_SYSCLKSource_HSI ((u32)0x00000000) #define RCC_SYSCLKSource_HSE ((u32)0x00000001) #define RCC_SYSCLKSource_PLLCLK ((u32)0x00000002) #define IS_RCC_SYSCLK_SOURCE(SOURCE) ((SOURCE == RCC_SYSCLKSource_HSI) || \ (SOURCE == RCC_SYSCLKSource_HSE) || \ (SOURCE == RCC_SYSCLKSource_PLLCLK)) /* AHB clock source */ #define RCC_SYSCLK_Div1 ((u32)0x00000000) #define RCC_SYSCLK_Div2 ((u32)0x00000080) #define RCC_SYSCLK_Div4 ((u32)0x00000090) #define RCC_SYSCLK_Div8 ((u32)0x000000A0) #define RCC_SYSCLK_Div16 ((u32)0x000000B0) #define RCC_SYSCLK_Div64 ((u32)0x000000C0) #define RCC_SYSCLK_Div128 ((u32)0x000000D0) #define RCC_SYSCLK_Div256 ((u32)0x000000E0) #define RCC_SYSCLK_Div512 ((u32)0x000000F0) #define IS_RCC_HCLK(HCLK) ((HCLK == RCC_SYSCLK_Div1) || (HCLK == RCC_SYSCLK_Div2) || \ (HCLK == RCC_SYSCLK_Div4) || (HCLK == RCC_SYSCLK_Div8) || \ (HCLK == RCC_SYSCLK_Div16) || (HCLK == RCC_SYSCLK_Div64) || \ (HCLK == RCC_SYSCLK_Div128) || (HCLK == RCC_SYSCLK_Div256) || \ (HCLK == RCC_SYSCLK_Div512)) /* APB1/APB2 clock source */ #define RCC_HCLK_Div1 ((u32)0x00000000) #define RCC_HCLK_Div2 ((u32)0x00000400) #define RCC_HCLK_Div4 ((u32)0x00000500) #define RCC_HCLK_Div8 ((u32)0x00000600) #define RCC_HCLK_Div16 ((u32)0x00000700) #define IS_RCC_PCLK(PCLK) ((PCLK == RCC_HCLK_Div1) || (PCLK == RCC_HCLK_Div2) || \ (PCLK == RCC_HCLK_Div4) || (PCLK == RCC_HCLK_Div8) || \ (PCLK == RCC_HCLK_Div16)) /* RCC Interrupt source */ #define RCC_IT_LSIRDY ((u8)0x01) #define RCC_IT_LSERDY ((u8)0x02) #define RCC_IT_HSIRDY ((u8)0x04) #define RCC_IT_HSERDY ((u8)0x08) #define RCC_IT_PLLRDY ((u8)0x10) #define RCC_IT_CSS ((u8)0x80) #define IS_RCC_IT(IT) (((IT & (u8)0xE0) == 0x00) && (IT != 0x00)) #define IS_RCC_GET_IT(IT) ((IT == RCC_IT_LSIRDY) || (IT == RCC_IT_LSERDY) || \ (IT == RCC_IT_HSIRDY) || (IT == RCC_IT_HSERDY) || \ (IT == RCC_IT_PLLRDY) || (IT == RCC_IT_CSS)) #define IS_RCC_CLEAR_IT(IT) (((IT & (u8)0x60) == 0x00) && (IT != 0x00)) /* USB clock source */ #define RCC_USBCLKSource_PLLCLK_1Div5 ((u8)0x00) #define RCC_USBCLKSource_PLLCLK_Div1 ((u8)0x01) #define IS_RCC_USBCLK_SOURCE(SOURCE) ((SOURCE == RCC_USBCLKSource_PLLCLK_1Div5) || \ (SOURCE == RCC_USBCLKSource_PLLCLK_Div1)) /* ADC clock source */ #define RCC_PCLK2_Div2 ((u32)0x00000000) #define RCC_PCLK2_Div4 ((u32)0x00004000) #define RCC_PCLK2_Div6 ((u32)0x00008000) #define RCC_PCLK2_Div8 ((u32)0x0000C000) #define IS_RCC_ADCCLK(ADCCLK) ((ADCCLK == RCC_PCLK2_Div2) || (ADCCLK == RCC_PCLK2_Div4) || \ (ADCCLK == RCC_PCLK2_Div6) || (ADCCLK == RCC_PCLK2_Div8)) /* LSE configuration */ #define RCC_LSE_OFF ((u8)0x00) #define RCC_LSE_ON ((u8)0x01) #define RCC_LSE_Bypass ((u8)0x04) #define IS_RCC_LSE(LSE) ((LSE == RCC_LSE_OFF) || (LSE == RCC_LSE_ON) || \ (LSE == RCC_LSE_Bypass)) /* RTC clock source */ #define RCC_RTCCLKSource_LSE ((u32)0x00000100) #define RCC_RTCCLKSource_LSI ((u32)0x00000200) #define RCC_RTCCLKSource_HSE_Div128 ((u32)0x00000300) #define IS_RCC_RTCCLK_SOURCE(SOURCE) ((SOURCE == RCC_RTCCLKSource_LSE) || \ (SOURCE == RCC_RTCCLKSource_LSI) || \ (SOURCE == RCC_RTCCLKSource_HSE_Div128)) /* AHB peripheral */ #define RCC_AHBPeriph_DMA ((u32)0x00000001) #define RCC_AHBPeriph_SRAM ((u32)0x00000004) #define RCC_AHBPeriph_FLITF ((u32)0x00000010) #define IS_RCC_AHB_PERIPH(PERIPH) (((PERIPH & 0xFFFFFFEA) == 0x00) && (PERIPH != 0x00)) /* APB2 peripheral */ #define RCC_APB2Periph_AFIO ((u32)0x00000001) #define RCC_APB2Periph_GPIOA ((u32)0x00000004) #define RCC_APB2Periph_GPIOB ((u32)0x00000008) #define RCC_APB2Periph_GPIOC ((u32)0x00000010) #define RCC_APB2Periph_GPIOD ((u32)0x00000020) #define RCC_APB2Periph_GPIOE ((u32)0x00000040) #define RCC_APB2Periph_ADC1 ((u32)0x00000200) #define RCC_APB2Periph_ADC2 ((u32)0x00000400) #define RCC_APB2Periph_TIM1 ((u32)0x00000800) #define RCC_APB2Periph_SPI1 ((u32)0x00001000) #define RCC_APB2Periph_USART1 ((u32)0x00004000) #define RCC_APB2Periph_ALL ((u32)0x00005E7D) #define IS_RCC_APB2_PERIPH(PERIPH) (((PERIPH & 0xFFFFA182) == 0x00) && (PERIPH != 0x00)) /* APB1 peripheral */ #define RCC_APB1Periph_TIM2 ((u32)0x00000001) #define RCC_APB1Periph_TIM3 ((u32)0x00000002) #define RCC_APB1Periph_TIM4 ((u32)0x00000004) #define RCC_APB1Periph_WWDG ((u32)0x00000800) #define RCC_APB1Periph_SPI2 ((u32)0x00004000) #define RCC_APB1Periph_USART2 ((u32)0x00020000) #define RCC_APB1Periph_USART3 ((u32)0x00040000) #define RCC_APB1Periph_I2C1 ((u32)0x00200000) #define RCC_APB1Periph_I2C2 ((u32)0x00400000) #define RCC_APB1Periph_USB ((u32)0x00800000) #define RCC_APB1Periph_CAN ((u32)0x02000000) #define RCC_APB1Periph_BKP ((u32)0x08000000) #define RCC_APB1Periph_PWR ((u32)0x10000000) #define RCC_APB1Periph_ALL ((u32)0x1AE64807) #define IS_RCC_APB1_PERIPH(PERIPH) (((PERIPH & 0xE519B7F8) == 0x00) && (PERIPH != 0x00)) /* Clock source to output on MCO pin */ #define RCC_MCO_NoClock ((u8)0x00) #define RCC_MCO_SYSCLK ((u8)0x04) #define RCC_MCO_HSI ((u8)0x05) #define RCC_MCO_HSE ((u8)0x06) #define RCC_MCO_PLLCLK_Div2 ((u8)0x07) #define IS_RCC_MCO(MCO) ((MCO == RCC_MCO_NoClock) || (MCO == RCC_MCO_HSI) || \ (MCO == RCC_MCO_SYSCLK) || (MCO == RCC_MCO_HSE) || \ (MCO == RCC_MCO_PLLCLK_Div2)) /* RCC Flag */ #define RCC_FLAG_HSIRDY ((u8)0x20) #define RCC_FLAG_HSERDY ((u8)0x31) #define RCC_FLAG_PLLRDY ((u8)0x39) #define RCC_FLAG_LSERDY ((u8)0x41) #define RCC_FLAG_LSIRDY ((u8)0x61) #define RCC_FLAG_PINRST ((u8)0x7A) #define RCC_FLAG_PORRST ((u8)0x7B) #define RCC_FLAG_SFTRST ((u8)0x7C) #define RCC_FLAG_IWDGRST ((u8)0x7D) #define RCC_FLAG_WWDGRST ((u8)0x7E) #define RCC_FLAG_LPWRRST ((u8)0x7F) #define IS_RCC_FLAG(FLAG) ((FLAG == RCC_FLAG_HSIRDY) || (FLAG == RCC_FLAG_HSERDY) || \ (FLAG == RCC_FLAG_PLLRDY) || (FLAG == RCC_FLAG_LSERDY) || \ (FLAG == RCC_FLAG_LSIRDY) || (FLAG == RCC_FLAG_PINRST) || \ (FLAG == RCC_FLAG_PORRST) || (FLAG == RCC_FLAG_SFTRST) || \ (FLAG == RCC_FLAG_IWDGRST)|| (FLAG == RCC_FLAG_WWDGRST)|| \ (FLAG == RCC_FLAG_LPWRRST)) #define IS_RCC_CALIBRATION_VALUE(VALUE) (VALUE <= 0x1F) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void RCC_DeInit(void); void RCC_HSEConfig(u32 RCC_HSE); void RCC_AdjustHSICalibrationValue(u8 HSICalibrationValue); void RCC_HSICmd(FunctionalState NewState); void RCC_PLLConfig(u32 RCC_PLLSource, u32 RCC_PLLMul); void RCC_PLLCmd(FunctionalState NewState); void RCC_SYSCLKConfig(u32 RCC_SYSCLKSource); u8 RCC_GetSYSCLKSource(void); void RCC_HCLKConfig(u32 RCC_HCLK); void RCC_PCLK1Config(u32 RCC_PCLK1); void RCC_PCLK2Config(u32 RCC_PCLK2); void RCC_ITConfig(u8 RCC_IT, FunctionalState NewState); void RCC_USBCLKConfig(u32 RCC_USBCLKSource); void RCC_ADCCLKConfig(u32 RCC_ADCCLK); void RCC_LSEConfig(u32 RCC_LSE); void RCC_LSICmd(FunctionalState NewState); void RCC_RTCCLKConfig(u32 RCC_RTCCLKSource); void RCC_RTCCLKCmd(FunctionalState NewState); void RCC_GetClocksFreq(RCC_ClocksTypeDef* RCC_Clocks); void RCC_AHBPeriphClockCmd(u32 RCC_AHBPeriph, FunctionalState NewState); void RCC_APB2PeriphClockCmd(u32 RCC_APB2Periph, FunctionalState NewState); void RCC_APB1PeriphClockCmd(u32 RCC_APB1Periph, FunctionalState NewState); void RCC_APB2PeriphResetCmd(u32 RCC_APB2Periph, FunctionalState NewState); void RCC_APB1PeriphResetCmd(u32 RCC_APB1Periph, FunctionalState NewState); void RCC_BackupResetCmd(FunctionalState NewState); void RCC_ClockSecuritySystemCmd(FunctionalState NewState); void RCC_MCOConfig(u8 RCC_MCO); FlagStatus RCC_GetFlagStatus(u8 RCC_FLAG); void RCC_ClearFlag(void); ITStatus RCC_GetITStatus(u8 RCC_IT); void RCC_ClearITPendingBit(u8 RCC_IT); #endif /* __STM32F10x_RCC_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_rcc.h
C
oos
13,794
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_adc.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * ADC firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_ADC_H #define __STM32F10x_ADC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* ADC Init structure definition */ typedef struct { u32 ADC_Mode; FunctionalState ADC_ScanConvMode; FunctionalState ADC_ContinuousConvMode; u32 ADC_ExternalTrigConv; u32 ADC_DataAlign; u8 ADC_NbrOfChannel; }ADC_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* ADC dual mode -------------------------------------------------------------*/ #define ADC_Mode_Independent ((u32)0x00000000) #define ADC_Mode_RegInjecSimult ((u32)0x00010000) #define ADC_Mode_RegSimult_AlterTrig ((u32)0x00020000) #define ADC_Mode_InjecSimult_FastInterl ((u32)0x00030000) #define ADC_Mode_InjecSimult_SlowInterl ((u32)0x00040000) #define ADC_Mode_InjecSimult ((u32)0x00050000) #define ADC_Mode_RegSimult ((u32)0x00060000) #define ADC_Mode_FastInterl ((u32)0x00070000) #define ADC_Mode_SlowInterl ((u32)0x00080000) #define ADC_Mode_AlterTrig ((u32)0x00090000) #define IS_ADC_MODE(MODE) ((MODE == ADC_Mode_Independent) || \ (MODE == ADC_Mode_RegInjecSimult) || \ (MODE == ADC_Mode_RegSimult_AlterTrig) || \ (MODE == ADC_Mode_InjecSimult_FastInterl) || \ (MODE == ADC_Mode_InjecSimult_SlowInterl) || \ (MODE == ADC_Mode_InjecSimult) || \ (MODE == ADC_Mode_RegSimult) || \ (MODE == ADC_Mode_FastInterl) || \ (MODE == ADC_Mode_SlowInterl) || \ (MODE == ADC_Mode_AlterTrig)) /* ADC extrenal trigger sources for regular channels conversion --------------*/ #define ADC_ExternalTrigConv_T1_CC1 ((u32)0x00000000) #define ADC_ExternalTrigConv_T1_CC2 ((u32)0x00020000) #define ADC_ExternalTrigConv_T1_CC3 ((u32)0x00040000) #define ADC_ExternalTrigConv_T2_CC2 ((u32)0x00060000) #define ADC_ExternalTrigConv_T3_TRGO ((u32)0x00080000) #define ADC_ExternalTrigConv_T4_CC4 ((u32)0x000A0000) #define ADC_ExternalTrigConv_Ext_IT11 ((u32)0x000C0000) #define ADC_ExternalTrigConv_None ((u32)0x000E0000) #define IS_ADC_EXT_TRIG(TRIG1) ((TRIG1 == ADC_ExternalTrigConv_T1_CC1) || \ (TRIG1 == ADC_ExternalTrigConv_T1_CC2) || \ (TRIG1 == ADC_ExternalTrigConv_T1_CC3) || \ (TRIG1 == ADC_ExternalTrigConv_T2_CC2) || \ (TRIG1 == ADC_ExternalTrigConv_T3_TRGO) || \ (TRIG1 == ADC_ExternalTrigConv_T4_CC4) || \ (TRIG1 == ADC_ExternalTrigConv_Ext_IT11) || \ (TRIG1 == ADC_ExternalTrigConv_None)) /* ADC data align ------------------------------------------------------------*/ #define ADC_DataAlign_Right ((u32)0x00000000) #define ADC_DataAlign_Left ((u32)0x00000800) #define IS_ADC_DATA_ALIGN(ALIGN) ((ALIGN == ADC_DataAlign_Right) || \ (ALIGN == ADC_DataAlign_Left)) /* ADC channels --------------------------------------------------------------*/ #define ADC_Channel_0 ((u8)0x00) #define ADC_Channel_1 ((u8)0x01) #define ADC_Channel_2 ((u8)0x02) #define ADC_Channel_3 ((u8)0x03) #define ADC_Channel_4 ((u8)0x04) #define ADC_Channel_5 ((u8)0x05) #define ADC_Channel_6 ((u8)0x06) #define ADC_Channel_7 ((u8)0x07) #define ADC_Channel_8 ((u8)0x08) #define ADC_Channel_9 ((u8)0x09) #define ADC_Channel_10 ((u8)0x0A) #define ADC_Channel_11 ((u8)0x0B) #define ADC_Channel_12 ((u8)0x0C) #define ADC_Channel_13 ((u8)0x0D) #define ADC_Channel_14 ((u8)0x0E) #define ADC_Channel_15 ((u8)0x0F) #define ADC_Channel_16 ((u8)0x10) #define ADC_Channel_17 ((u8)0x11) #define IS_ADC_CHANNEL(CHANNEL) ((CHANNEL == ADC_Channel_0) || (CHANNEL == ADC_Channel_1) || \ (CHANNEL == ADC_Channel_2) || (CHANNEL == ADC_Channel_3) || \ (CHANNEL == ADC_Channel_4) || (CHANNEL == ADC_Channel_5) || \ (CHANNEL == ADC_Channel_6) || (CHANNEL == ADC_Channel_7) || \ (CHANNEL == ADC_Channel_8) || (CHANNEL == ADC_Channel_9) || \ (CHANNEL == ADC_Channel_10) || (CHANNEL == ADC_Channel_11) || \ (CHANNEL == ADC_Channel_12) || (CHANNEL == ADC_Channel_13) || \ (CHANNEL == ADC_Channel_14) || (CHANNEL == ADC_Channel_15) || \ (CHANNEL == ADC_Channel_16) || (CHANNEL == ADC_Channel_17)) /* ADC sampling times --------------------------------------------------------*/ #define ADC_SampleTime_1Cycles5 ((u8)0x00) #define ADC_SampleTime_7Cycles5 ((u8)0x01) #define ADC_SampleTime_13Cycles5 ((u8)0x02) #define ADC_SampleTime_28Cycles5 ((u8)0x03) #define ADC_SampleTime_41Cycles5 ((u8)0x04) #define ADC_SampleTime_55Cycles5 ((u8)0x05) #define ADC_SampleTime_71Cycles5 ((u8)0x06) #define ADC_SampleTime_239Cycles5 ((u8)0x07) #define IS_ADC_SAMPLE_TIME(TIME) ((TIME == ADC_SampleTime_1Cycles5) || \ (TIME == ADC_SampleTime_7Cycles5) || \ (TIME == ADC_SampleTime_13Cycles5) || \ (TIME == ADC_SampleTime_28Cycles5) || \ (TIME == ADC_SampleTime_41Cycles5) || \ (TIME == ADC_SampleTime_55Cycles5) || \ (TIME == ADC_SampleTime_71Cycles5) || \ (TIME == ADC_SampleTime_239Cycles5)) /* ADC extrenal trigger sources for injected channels conversion -------------*/ #define ADC_ExternalTrigInjecConv_T1_TRGO ((u32)0x00000000) #define ADC_ExternalTrigInjecConv_T1_CC4 ((u32)0x00001000) #define ADC_ExternalTrigInjecConv_T2_TRGO ((u32)0x00002000) #define ADC_ExternalTrigInjecConv_T2_CC1 ((u32)0x00003000) #define ADC_ExternalTrigInjecConv_T3_CC4 ((u32)0x00004000) #define ADC_ExternalTrigInjecConv_T4_TRGO ((u32)0x00005000) #define ADC_ExternalTrigInjecConv_Ext_IT15 ((u32)0x00006000) #define ADC_ExternalTrigInjecConv_None ((u32)0x00007000) #define IS_ADC_EXT_INJEC_TRIG(TRIG) ((TRIG == ADC_ExternalTrigInjecConv_T1_TRGO) || \ (TRIG == ADC_ExternalTrigInjecConv_T1_CC4) || \ (TRIG == ADC_ExternalTrigInjecConv_T2_TRGO) || \ (TRIG == ADC_ExternalTrigInjecConv_T2_CC1) || \ (TRIG == ADC_ExternalTrigInjecConv_T3_CC4) || \ (TRIG == ADC_ExternalTrigInjecConv_T4_TRGO) || \ (TRIG == ADC_ExternalTrigInjecConv_Ext_IT15) || \ (TRIG == ADC_ExternalTrigInjecConv_None)) /* ADC injected channel selection --------------------------------------------*/ #define ADC_InjectedChannel_1 ((u8)0x14) #define ADC_InjectedChannel_2 ((u8)0x18) #define ADC_InjectedChannel_3 ((u8)0x1C) #define ADC_InjectedChannel_4 ((u8)0x20) #define IS_ADC_INJECTED_CHANNEL(CHANNEL) ((CHANNEL == ADC_InjectedChannel_1) || \ (CHANNEL == ADC_InjectedChannel_2) || \ (CHANNEL == ADC_InjectedChannel_3) || \ (CHANNEL == ADC_InjectedChannel_4)) /* ADC analog watchdog selection ---------------------------------------------*/ #define ADC_AnalogWatchdog_SingleRegEnable ((u32)0x00800200) #define ADC_AnalogWatchdog_SingleInjecEnable ((u32)0x00400200) #define ADC_AnalogWatchdog_SingleRegOrInjecEnable ((u32)0x00C00200) #define ADC_AnalogWatchdog_AllRegEnable ((u32)0x00800000) #define ADC_AnalogWatchdog_AllInjecEnable ((u32)0x00400000) #define ADC_AnalogWatchdog_AllRegAllInjecEnable ((u32)0x00C00000) #define ADC_AnalogWatchdog_None ((u32)0x00000000) #define IS_ADC_ANALOG_WATCHDOG(WATCHDOG) ((WATCHDOG == ADC_AnalogWatchdog_SingleRegEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_SingleInjecEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_SingleRegOrInjecEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_AllRegEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_AllInjecEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_AllRegAllInjecEnable) || \ (WATCHDOG == ADC_AnalogWatchdog_None)) /* ADC interrupts definition -------------------------------------------------*/ #define ADC_IT_EOC ((u16)0x0220) #define ADC_IT_AWD ((u16)0x0140) #define ADC_IT_JEOC ((u16)0x0480) #define IS_ADC_IT(IT) (((IT & (u16)0xF81F) == 0x00) && (IT != 0x00)) #define IS_ADC_GET_IT(IT) ((IT == ADC_IT_EOC) || (IT == ADC_IT_AWD) || \ (IT == ADC_IT_JEOC)) /* ADC flags definition ------------------------------------------------------*/ #define ADC_FLAG_AWD ((u8)0x01) #define ADC_FLAG_EOC ((u8)0x02) #define ADC_FLAG_JEOC ((u8)0x04) #define ADC_FLAG_JSTRT ((u8)0x08) #define ADC_FLAG_STRT ((u8)0x10) #define IS_ADC_CLEAR_FLAG(FLAG) (((FLAG & (u8)0xE0) == 0x00) && (FLAG != 0x00)) #define IS_ADC_GET_FLAG(FLAG) ((FLAG == ADC_FLAG_AWD) || (FLAG == ADC_FLAG_EOC) || \ (FLAG == ADC_FLAG_JEOC) || (FLAG == ADC_FLAG_JSTRT) || \ (FLAG == ADC_FLAG_STRT)) /* ADC thresholds ------------------------------------------------------------*/ #define IS_ADC_THRESHOLD(THRESHOLD) (THRESHOLD <= 0xFFF) /* ADC injected offset -------------------------------------------------------*/ #define IS_ADC_OFFSET(OFFSET) (OFFSET <= 0xFFF) /* ADC injected length -------------------------------------------------------*/ #define IS_ADC_INJECTED_LENGTH(LENGTH) ((LENGTH >= 0x1) && (LENGTH <= 0x4)) /* ADC injected rank ---------------------------------------------------------*/ #define IS_ADC_INJECTED_RANK(RANK) ((RANK >= 0x1) && (RANK <= 0x4)) /* ADC regular length --------------------------------------------------------*/ #define IS_ADC_REGULAR_LENGTH(LENGTH) ((LENGTH >= 0x1) && (LENGTH <= 0x10)) /* ADC regular rank ----------------------------------------------------------*/ #define IS_ADC_REGULAR_RANK(RANK) ((RANK >= 0x1) && (RANK <= 0x10)) /* ADC regular discontinuous mode number -------------------------------------*/ #define IS_ADC_REGULAR_DISC_NUMBER(NUMBER) ((NUMBER >= 0x1) && (NUMBER <= 0x8)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void ADC_DeInit(ADC_TypeDef* ADCx); void ADC_Init(ADC_TypeDef* ADCx, ADC_InitTypeDef* ADC_InitStruct); void ADC_StructInit(ADC_InitTypeDef* ADC_InitStruct); void ADC_Cmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_DMACmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_ITConfig(ADC_TypeDef* ADCx, u16 ADC_IT, FunctionalState NewState); void ADC_ResetCalibration(ADC_TypeDef* ADCx); FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef* ADCx); void ADC_StartCalibration(ADC_TypeDef* ADCx); FlagStatus ADC_GetCalibrationStatus(ADC_TypeDef* ADCx); void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef* ADCx); void ADC_DiscModeChannelCountConfig(ADC_TypeDef* ADCx, u8 Number); void ADC_DiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_RegularChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel, u8 Rank, u8 ADC_SampleTime); void ADC_ExternalTrigConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); u16 ADC_GetConversionValue(ADC_TypeDef* ADCx); u32 ADC_GetDualModeConversionValue(void); void ADC_AutoInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_InjectedDiscModeCmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_ExternalTrigInjectedConvConfig(ADC_TypeDef* ADCx, u32 ADC_ExternalTrigInjecConv); void ADC_ExternalTrigInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); void ADC_SoftwareStartInjectedConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState); FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus(ADC_TypeDef* ADCx); void ADC_InjectedChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel, u8 Rank, u8 ADC_SampleTime); void ADC_InjectedSequencerLengthConfig(ADC_TypeDef* ADCx, u8 Length); void ADC_SetInjectedOffset(ADC_TypeDef* ADCx, u8 ADC_InjectedChannel, u16 Offset); u16 ADC_GetInjectedConversionValue(ADC_TypeDef* ADCx, u8 ADC_InjectedChannel); void ADC_AnalogWatchdogCmd(ADC_TypeDef* ADCx, u32 ADC_AnalogWatchdog); void ADC_AnalogWatchdogThresholdsConfig(ADC_TypeDef* ADCx, u16 HighThreshold, u16 LowThreshold); void ADC_AnalogWatchdogSingleChannelConfig(ADC_TypeDef* ADCx, u8 ADC_Channel); void ADC_TempSensorCmd(FunctionalState NewState); FlagStatus ADC_GetFlagStatus(ADC_TypeDef* ADCx, u8 ADC_FLAG); void ADC_ClearFlag(ADC_TypeDef* ADCx, u8 ADC_FLAG); ITStatus ADC_GetITStatus(ADC_TypeDef* ADCx, u16 ADC_IT); void ADC_ClearITPendingBit(ADC_TypeDef* ADCx, u16 ADC_IT); #endif /*__STM32F10x_ADC_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_adc.h
C
oos
16,394
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_systick.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * SysTick firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_SYSTICK_H #define __STM32F10x_SYSTICK_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* SysTick clock source */ #define SysTick_CLKSource_HCLK_Div8 ((u32)0xFFFFFFFB) #define SysTick_CLKSource_HCLK ((u32)0x00000004) #define IS_SYSTICK_CLK_SOURCE(SOURCE) ((SOURCE == SysTick_CLKSource_HCLK) || \ (SOURCE == SysTick_CLKSource_HCLK_Div8)) /* SysTick counter state */ #define SysTick_Counter_Disable ((u32)0xFFFFFFFE) #define SysTick_Counter_Enable ((u32)0x00000001) #define SysTick_Counter_Clear ((u32)0x00000000) #define IS_SYSTICK_COUNTER(COUNTER) ((COUNTER == SysTick_Counter_Disable) || \ (COUNTER == SysTick_Counter_Enable) || \ (COUNTER == SysTick_Counter_Clear)) /* SysTick Flag */ #define SysTick_FLAG_COUNT ((u8)0x30) #define SysTick_FLAG_SKEW ((u8)0x5E) #define SysTick_FLAG_NOREF ((u8)0x5F) #define IS_SYSTICK_FLAG(FLAG) ((FLAG == SysTick_FLAG_COUNT) || \ (FLAG == SysTick_FLAG_SKEW) || \ (FLAG == SysTick_FLAG_NOREF)) #define IS_SYSTICK_RELOAD(RELOAD) ((RELOAD > 0) || (RELOAD <= 0xFFFFFF)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void SysTick_CLKSourceConfig(u32 SysTick_CLKSource); void SysTick_SetReload(u32 Reload); void SysTick_CounterCmd(u32 SysTick_Counter); void SysTick_ITConfig(FunctionalState NewState); u32 SysTick_GetCounter(void); FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG); #endif /* __STM32F10x_SYSTICK_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_systick.h
C
oos
3,295
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_nvic.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * NVIC firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_NVIC_H #define __STM32F10x_NVIC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* NVIC Init Structure definition */ typedef struct { u8 NVIC_IRQChannel; u8 NVIC_IRQChannelPreemptionPriority; u8 NVIC_IRQChannelSubPriority; FunctionalState NVIC_IRQChannelCmd; } NVIC_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* IRQ Channels --------------------------------------------------------------*/ #define WWDG_IRQChannel ((u8)0x00) /* Window WatchDog Interrupt */ #define PVD_IRQChannel ((u8)0x01) /* PVD through EXTI Line detection Interrupt */ #define TAMPER_IRQChannel ((u8)0x02) /* Tamper Interrupt */ #define RTC_IRQChannel ((u8)0x03) /* RTC global Interrupt */ #define FLASH_IRQChannel ((u8)0x04) /* FLASH global Interrupt */ #define RCC_IRQChannel ((u8)0x05) /* RCC global Interrupt */ #define EXTI0_IRQChannel ((u8)0x06) /* EXTI Line0 Interrupt */ #define EXTI1_IRQChannel ((u8)0x07) /* EXTI Line1 Interrupt */ #define EXTI2_IRQChannel ((u8)0x08) /* EXTI Line2 Interrupt */ #define EXTI3_IRQChannel ((u8)0x09) /* EXTI Line3 Interrupt */ #define EXTI4_IRQChannel ((u8)0x0A) /* EXTI Line4 Interrupt */ #define DMAChannel1_IRQChannel ((u8)0x0B) /* DMA Channel 1 global Interrupt */ #define DMAChannel2_IRQChannel ((u8)0x0C) /* DMA Channel 2 global Interrupt */ #define DMAChannel3_IRQChannel ((u8)0x0D) /* DMA Channel 3 global Interrupt */ #define DMAChannel4_IRQChannel ((u8)0x0E) /* DMA Channel 4 global Interrupt */ #define DMAChannel5_IRQChannel ((u8)0x0F) /* DMA Channel 5 global Interrupt */ #define DMAChannel6_IRQChannel ((u8)0x10) /* DMA Channel 6 global Interrupt */ #define DMAChannel7_IRQChannel ((u8)0x11) /* DMA Channel 7 global Interrupt */ #define ADC_IRQChannel ((u8)0x12) /* ADC global Interrupt */ #define USB_HP_CAN_TX_IRQChannel ((u8)0x13) /* USB High Priority or CAN TX Interrupts */ #define USB_LP_CAN_RX0_IRQChannel ((u8)0x14) /* USB Low Priority or CAN RX0 Interrupts */ #define CAN_RX1_IRQChannel ((u8)0x15) /* CAN RX1 Interrupt */ #define CAN_SCE_IRQChannel ((u8)0x16) /* CAN SCE Interrupt */ #define EXTI9_5_IRQChannel ((u8)0x17) /* External Line[9:5] Interrupts */ #define TIM1_BRK_IRQChannel ((u8)0x18) /* TIM1 Break Interrupt */ #define TIM1_UP_IRQChannel ((u8)0x19) /* TIM1 Update Interrupt */ #define TIM1_TRG_COM_IRQChannel ((u8)0x1A) /* TIM1 Trigger and Commutation Interrupt */ #define TIM1_CC_IRQChannel ((u8)0x1B) /* TIM1 Capture Compare Interrupt */ #define TIM2_IRQChannel ((u8)0x1C) /* TIM2 global Interrupt */ #define TIM3_IRQChannel ((u8)0x1D) /* TIM3 global Interrupt */ #define TIM4_IRQChannel ((u8)0x1E) /* TIM4 global Interrupt */ #define I2C1_EV_IRQChannel ((u8)0x1F) /* I2C1 Event Interrupt */ #define I2C1_ER_IRQChannel ((u8)0x20) /* I2C1 Error Interrupt */ #define I2C2_EV_IRQChannel ((u8)0x21) /* I2C2 Event Interrupt */ #define I2C2_ER_IRQChannel ((u8)0x22) /* I2C2 Error Interrupt */ #define SPI1_IRQChannel ((u8)0x23) /* SPI1 global Interrupt */ #define SPI2_IRQChannel ((u8)0x24) /* SPI2 global Interrupt */ #define USART1_IRQChannel ((u8)0x25) /* USART1 global Interrupt */ #define USART2_IRQChannel ((u8)0x26) /* USART2 global Interrupt */ #define USART3_IRQChannel ((u8)0x27) /* USART3 global Interrupt */ #define EXTI15_10_IRQChannel ((u8)0x28) /* External Line[15:10] Interrupts */ #define RTCAlarm_IRQChannel ((u8)0x29) /* RTC Alarm through EXTI Line Interrupt */ #define USBWakeUp_IRQChannel ((u8)0x2A) /* USB WakeUp from suspend through EXTI Line Interrupt */ #define IS_NVIC_IRQ_CHANNEL(CHANNEL) ((CHANNEL == WWDG_IRQChannel) || \ (CHANNEL == PVD_IRQChannel) || \ (CHANNEL == TAMPER_IRQChannel) || \ (CHANNEL == RTC_IRQChannel) || \ (CHANNEL == FLASH_IRQChannel) || \ (CHANNEL == RCC_IRQChannel) || \ (CHANNEL == EXTI0_IRQChannel) || \ (CHANNEL == EXTI1_IRQChannel) || \ (CHANNEL == EXTI2_IRQChannel) || \ (CHANNEL == EXTI3_IRQChannel) || \ (CHANNEL == EXTI4_IRQChannel) || \ (CHANNEL == DMAChannel1_IRQChannel) || \ (CHANNEL == DMAChannel2_IRQChannel) || \ (CHANNEL == DMAChannel3_IRQChannel) || \ (CHANNEL == DMAChannel4_IRQChannel) || \ (CHANNEL == DMAChannel5_IRQChannel) || \ (CHANNEL == DMAChannel6_IRQChannel) || \ (CHANNEL == DMAChannel7_IRQChannel) || \ (CHANNEL == ADC_IRQChannel) || \ (CHANNEL == USB_HP_CAN_TX_IRQChannel) || \ (CHANNEL == USB_LP_CAN_RX0_IRQChannel) || \ (CHANNEL == CAN_RX1_IRQChannel) || \ (CHANNEL == CAN_SCE_IRQChannel) || \ (CHANNEL == EXTI9_5_IRQChannel) || \ (CHANNEL == TIM1_BRK_IRQChannel) || \ (CHANNEL == TIM1_UP_IRQChannel) || \ (CHANNEL == TIM1_TRG_COM_IRQChannel) || \ (CHANNEL == TIM1_CC_IRQChannel) || \ (CHANNEL == TIM2_IRQChannel) || \ (CHANNEL == TIM3_IRQChannel) || \ (CHANNEL == TIM4_IRQChannel) || \ (CHANNEL == I2C1_EV_IRQChannel) || \ (CHANNEL == I2C1_ER_IRQChannel) || \ (CHANNEL == I2C2_EV_IRQChannel) || \ (CHANNEL == I2C2_ER_IRQChannel) || \ (CHANNEL == SPI1_IRQChannel) || \ (CHANNEL == SPI2_IRQChannel) || \ (CHANNEL == USART1_IRQChannel) || \ (CHANNEL == USART2_IRQChannel) || \ (CHANNEL == USART3_IRQChannel) || \ (CHANNEL == EXTI15_10_IRQChannel) || \ (CHANNEL == RTCAlarm_IRQChannel) || \ (CHANNEL == USBWakeUp_IRQChannel)) /* System Handlers -----------------------------------------------------------*/ #define SystemHandler_NMI ((u32)0x00001F) /* NMI Handler */ #define SystemHandler_HardFault ((u32)0x000000) /* Hard Fault Handler */ #define SystemHandler_MemoryManage ((u32)0x043430) /* Memory Manage Handler */ #define SystemHandler_BusFault ((u32)0x547931) /* Bus Fault Handler */ #define SystemHandler_UsageFault ((u32)0x24C232) /* Usage Fault Handler */ #define SystemHandler_SVCall ((u32)0x01FF40) /* SVCall Handler */ #define SystemHandler_DebugMonitor ((u32)0x0A0080) /* Debug Monitor Handler */ #define SystemHandler_PSV ((u32)0x02829C) /* PSV Handler */ #define SystemHandler_SysTick ((u32)0x02C39A) /* SysTick Handler */ #define IS_CONFIG_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault) || \ (HANDLER == SystemHandler_UsageFault)) #define IS_PRIORITY_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault) || \ (HANDLER == SystemHandler_UsageFault) || \ (HANDLER == SystemHandler_SVCall) || \ (HANDLER == SystemHandler_DebugMonitor) || \ (HANDLER == SystemHandler_PSV) || \ (HANDLER == SystemHandler_SysTick)) #define IS_GET_PENDING_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault) || \ (HANDLER == SystemHandler_SVCall)) #define IS_SET_PENDING_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_NMI) || \ (HANDLER == SystemHandler_PSV) || \ (HANDLER == SystemHandler_SysTick)) #define IS_CLEAR_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_PSV) || \ (HANDLER == SystemHandler_SysTick)) #define IS_GET_ACTIVE_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault) || \ (HANDLER == SystemHandler_UsageFault) || \ (HANDLER == SystemHandler_SVCall) || \ (HANDLER == SystemHandler_DebugMonitor) || \ (HANDLER == SystemHandler_PSV) || \ (HANDLER == SystemHandler_SysTick)) #define IS_FAULT_SOURCE_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_HardFault) || \ (HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault) || \ (HANDLER == SystemHandler_UsageFault) || \ (HANDLER == SystemHandler_DebugMonitor)) #define IS_FAULT_ADDRESS_SYSTEM_HANDLER(HANDLER) ((HANDLER == SystemHandler_MemoryManage) || \ (HANDLER == SystemHandler_BusFault)) /* Vector Table Base ---------------------------------------------------------*/ #define NVIC_VectTab_RAM ((u32)0x20000000) #define NVIC_VectTab_FLASH ((u32)0x00000000) #define IS_NVIC_VECTTAB(VECTTAB) ((VECTTAB == NVIC_VectTab_RAM) || \ (VECTTAB == NVIC_VectTab_FLASH)) /* System Low Power ----------------------------------------------------------*/ #define NVIC_LP_SEVONPEND ((u8)0x10) #define NVIC_LP_SLEEPDEEP ((u8)0x04) #define NVIC_LP_SLEEPONEXIT ((u8)0x02) #define IS_NVIC_LP(LP) ((LP == NVIC_LP_SEVONPEND) || \ (LP == NVIC_LP_SLEEPDEEP) || \ (LP == NVIC_LP_SLEEPONEXIT)) /* Preemption Priority Group -------------------------------------------------*/ #define NVIC_PriorityGroup_0 ((u32)0x700) /* 0 bits for pre-emption priority 4 bits for subpriority */ #define NVIC_PriorityGroup_1 ((u32)0x600) /* 1 bits for pre-emption priority 3 bits for subpriority */ #define NVIC_PriorityGroup_2 ((u32)0x500) /* 2 bits for pre-emption priority 2 bits for subpriority */ #define NVIC_PriorityGroup_3 ((u32)0x400) /* 3 bits for pre-emption priority 1 bits for subpriority */ #define NVIC_PriorityGroup_4 ((u32)0x300) /* 4 bits for pre-emption priority 0 bits for subpriority */ #define IS_NVIC_PRIORITY_GROUP(GROUP) ((GROUP == NVIC_PriorityGroup_0) || \ (GROUP == NVIC_PriorityGroup_1) || \ (GROUP == NVIC_PriorityGroup_2) || \ (GROUP == NVIC_PriorityGroup_3) || \ (GROUP == NVIC_PriorityGroup_4)) #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) (PRIORITY < 0x10) #define IS_NVIC_SUB_PRIORITY(PRIORITY) (PRIORITY < 0x10) #define IS_NVIC_OFFSET(OFFSET) (OFFSET < 0x3FFFFF) #define IS_NVIC_BASE_PRI(PRI) ((PRI > 0x00) && (PRI < 0x10)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NVIC_DeInit(void); void NVIC_SCBDeInit(void); void NVIC_PriorityGroupConfig(u32 NVIC_PriorityGroup); void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); void NVIC_StructInit(NVIC_InitTypeDef* NVIC_InitStruct); void NVIC_SETPRIMASK(void); void NVIC_RESETPRIMASK(void); void NVIC_SETFAULTMASK(void); void NVIC_RESETFAULTMASK(void); void NVIC_BASEPRICONFIG(u32 NewPriority); u32 NVIC_GetBASEPRI(void); u16 NVIC_GetCurrentPendingIRQChannel(void); ITStatus NVIC_GetIRQChannelPendingBitStatus(u8 NVIC_IRQChannel); void NVIC_SetIRQChannelPendingBit(u8 NVIC_IRQChannel); void NVIC_ClearIRQChannelPendingBit(u8 NVIC_IRQChannel); u16 NVIC_GetCurrentActiveHandler(void); ITStatus NVIC_GetIRQChannelActiveBitStatus(u8 NVIC_IRQChannel); u32 NVIC_GetCPUID(void); void NVIC_SetVectorTable(u32 NVIC_VectTab, u32 Offset); void NVIC_GenerateSystemReset(void); void NVIC_GenerateCoreReset(void); void NVIC_SystemLPConfig(u8 LowPowerMode, FunctionalState NewState); void NVIC_SystemHandlerConfig(u32 SystemHandler, FunctionalState NewState); void NVIC_SystemHandlerPriorityConfig(u32 SystemHandler, u8 SystemHandlerPreemptionPriority, u8 SystemHandlerSubPriority); ITStatus NVIC_GetSystemHandlerPendingBitStatus(u32 SystemHandler); void NVIC_SetSystemHandlerPendingBit(u32 SystemHandler); void NVIC_ClearSystemHandlerPendingBit(u32 SystemHandler); ITStatus NVIC_GetSystemHandlerActiveBitStatus(u32 SystemHandler); u32 NVIC_GetFaultHandlerSources(u32 SystemHandler); u32 NVIC_GetFaultAddress(u32 SystemHandler); #endif /* __STM32F10x_NVIC_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_nvic.h
C
oos
16,376
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_can.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * CAN firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_CAN_H #define __STM32F10x_CAN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* CAN init structure definition */ typedef struct { FunctionalState CAN_TTCM; FunctionalState CAN_ABOM; FunctionalState CAN_AWUM; FunctionalState CAN_NART; FunctionalState CAN_RFLM; FunctionalState CAN_TXFP; u8 CAN_Mode; u8 CAN_SJW; u8 CAN_BS1; u8 CAN_BS2; u8 CAN_Clock; u16 CAN_Prescaler; } CAN_InitTypeDef; /* CAN filter init structure definition */ typedef struct { u8 CAN_FilterNumber; u8 CAN_FilterMode; u8 CAN_FilterScale; u16 CAN_FilterIdHigh; u16 CAN_FilterIdLow; u16 CAN_FilterMaskIdHigh; u16 CAN_FilterMaskIdLow; u16 CAN_FilterFIFOAssignment; FunctionalState CAN_FilterActivation; } CAN_FilterInitTypeDef; /* CAN Tx message structure definition */ typedef struct { u32 StdId; u32 ExtId; u8 IDE; u8 RTR; u8 DLC; u8 Data[8]; } CanTxMsg; /* CAN Rx message structure definition */ typedef struct { u32 StdId; u32 ExtId; u8 IDE; u8 RTR; u8 DLC; u8 Data[8]; u8 FMI; } CanRxMsg; /* Exported constants --------------------------------------------------------*/ /* CAN sleep constants */ #define CANINITFAILED ((u8)0x00) /* CAN initialization failed */ #define CANINITOK ((u8)0x01) /* CAN initialization failed */ /* CAN operating mode */ #define CAN_Mode_Normal ((u8)0x00) /* normal mode */ #define CAN_Mode_LoopBack ((u8)0x01) /* loopback mode */ #define CAN_Mode_Silent ((u8)0x02) /* silent mode */ #define CAN_Mode_Silent_LoopBack ((u8)0x03) /* loopback combined with silent mode */ #define IS_CAN_MODE(MODE) ((MODE == CAN_Mode_Normal) || (MODE == CAN_Mode_LoopBack)|| \ (MODE == CAN_Mode_Silent) || (MODE == CAN_Mode_Silent_LoopBack)) /* CAN synchronisation jump width */ #define CAN_SJW_0tq ((u8)0x00) /* 0 time quantum */ #define CAN_SJW_1tq ((u8)0x01) /* 1 time quantum */ #define CAN_SJW_2tq ((u8)0x02) /* 2 time quantum */ #define CAN_SJW_3tq ((u8)0x03) /* 3 time quantum */ #define IS_CAN_SJW(SJW) ((SJW == CAN_SJW_0tq) || (SJW == CAN_SJW_1tq)|| \ (SJW == CAN_SJW_2tq) || (SJW == CAN_SJW_3tq)) /* time quantum in bit segment 1 */ #define CAN_BS1_1tq ((u8)0x00) /* 1 time quantum */ #define CAN_BS1_2tq ((u8)0x01) /* 2 time quantum */ #define CAN_BS1_3tq ((u8)0x02) /* 3 time quantum */ #define CAN_BS1_4tq ((u8)0x03) /* 4 time quantum */ #define CAN_BS1_5tq ((u8)0x04) /* 5 time quantum */ #define CAN_BS1_6tq ((u8)0x05) /* 6 time quantum */ #define CAN_BS1_7tq ((u8)0x06) /* 7 time quantum */ #define CAN_BS1_8tq ((u8)0x07) /* 8 time quantum */ #define CAN_BS1_9tq ((u8)0x08) /* 9 time quantum */ #define CAN_BS1_10tq ((u8)0x09) /* 10 time quantum */ #define CAN_BS1_11tq ((u8)0x0A) /* 11 time quantum */ #define CAN_BS1_12tq ((u8)0x0B) /* 12 time quantum */ #define CAN_BS1_13tq ((u8)0x0C) /* 13 time quantum */ #define CAN_BS1_14tq ((u8)0x0D) /* 14 time quantum */ #define CAN_BS1_15tq ((u8)0x0E) /* 15 time quantum */ #define CAN_BS1_16tq ((u8)0x0F) /* 16 time quantum */ #define IS_CAN_BS1(BS1) (BS1 <= CAN_BS1_16tq) /* time quantum in bit segment 2 */ #define CAN_BS2_1tq ((u8)0x00) /* 1 time quantum */ #define CAN_BS2_2tq ((u8)0x01) /* 2 time quantum */ #define CAN_BS2_3tq ((u8)0x02) /* 3 time quantum */ #define CAN_BS2_4tq ((u8)0x03) /* 4 time quantum */ #define CAN_BS2_5tq ((u8)0x04) /* 5 time quantum */ #define CAN_BS2_6tq ((u8)0x05) /* 6 time quantum */ #define CAN_BS2_7tq ((u8)0x06) /* 7 time quantum */ #define CAN_BS2_8tq ((u8)0x07) /* 8 time quantum */ #define IS_CAN_BS2(BS2) (BS2 <= CAN_BS2_8tq) /* CAN clock selected */ #define CAN_Clock_8MHz ((u8)0x00) /* 8MHz XTAL clock selected */ #define CAN_Clock_APB ((u8)0x01) /* APB clock selected */ #define IS_CAN_CLOCK(CLOCK) ((CLOCK == CAN_Clock_8MHz) || (CLOCK == CAN_Clock_APB)) /* CAN clock prescaler */ #define IS_CAN_PRESCALER(PRESCALER) ((PRESCALER >= 1) && (PRESCALER <= 1024)) /* CAN filter number */ #define IS_CAN_FILTER_NUMBER(NUMBER) (NUMBER <= 13) /* CAN filter mode */ #define CAN_FilterMode_IdMask ((u8)0x00) /* id/mask mode */ #define CAN_FilterMode_IdList ((u8)0x01) /* identifier list mode */ #define IS_CAN_FILTER_MODE(MODE) ((MODE == CAN_FilterMode_IdMask) || \ (MODE == CAN_FilterMode_IdList)) /* CAN filter scale */ #define CAN_FilterScale_16bit ((u8)0x00) /* 16-bit filter scale */ #define CAN_FilterScale_32bit ((u8)0x01) /* 2-bit filter scale */ #define IS_CAN_FILTER_SCALE(SCALE) ((SCALE == CAN_FilterScale_16bit) || \ (SCALE == CAN_FilterScale_32bit)) /* CAN filter FIFO assignation */ #define CAN_FilterFIFO0 ((u8)0x00) /* Filter FIFO 0 assignment for filter x */ #define CAN_FilterFIFO1 ((u8)0x01) /* Filter FIFO 1 assignment for filter x */ #define IS_CAN_FILTER_FIFO(FIFO) ((FIFO == CAN_FilterFIFO0) || \ (FIFO == CAN_FilterFIFO1)) /* CAN Tx */ #define IS_CAN_TRANSMITMAILBOX(TRANSMITMAILBOX) (TRANSMITMAILBOX <= ((u8)0x02)) #define IS_CAN_STDID(STDID) (STDID <= ((u32)0x7FF)) #define IS_CAN_EXTID(EXTID) (EXTID <= ((u32)0x3FFFF)) #define IS_CAN_DLC(DLC) (DLC <= ((u8)0x08)) /* CAN identifier type */ #define CAN_ID_STD ((u32)0x00000000) /* Standard Id */ #define CAN_ID_EXT ((u32)0x00000004) /* Extended Id */ #define IS_CAN_IDTYPE(IDTYPE) ((IDTYPE == CAN_ID_STD) || (IDTYPE == CAN_ID_EXT)) /* CAN remote transmission request */ #define CAN_RTR_DATA ((u32)0x00000000) /* Data frame */ #define CAN_RTR_REMOTE ((u32)0x00000002) /* Remote frame */ #define IS_CAN_RTR(RTR) ((RTR == CAN_RTR_DATA) || (RTR == CAN_RTR_REMOTE)) /* CAN transmit constants */ #define CANTXFAILED ((u8)0x00) /* CAN transmission failed */ #define CANTXOK ((u8)0x01) /* CAN transmission succeeded */ #define CANTXPENDING ((u8)0x02) /* CAN transmission pending */ #define CAN_NO_MB ((u8)0x04) /* CAN cell did not provide an empty mailbox */ /* CAN receive FIFO number constants */ #define CAN_FIFO0 ((u8)0x00) /* CAN FIFO0 used to receive */ #define CAN_FIFO1 ((u8)0x01) /* CAN FIFO1 used to receive */ #define IS_CAN_FIFO(FIFO) ((FIFO == CAN_FIFO0) || (FIFO == CAN_FIFO1)) /* CAN sleep constants */ #define CANSLEEPFAILED ((u8)0x00) /* CAN did not enter the sleep mode */ #define CANSLEEPOK ((u8)0x01) /* CAN entered the sleep mode */ /* CAN wake up constants */ #define CANWAKEUPFAILED ((u8)0x00) /* CAN did not leave the sleep mode */ #define CANWAKEUPOK ((u8)0x01) /* CAN leaved the sleep mode */ /* CAN flags */ #define CAN_FLAG_EWG ((u32)0x00000001) /* Error Warning Flag */ #define CAN_FLAG_EPV ((u32)0x00000002) /* Error Passive Flag */ #define CAN_FLAG_BOF ((u32)0x00000004) /* Bus-Off Flag */ #define IS_CAN_FLAG(FLAG) ((FLAG == CAN_FLAG_EWG) || (FLAG == CAN_FLAG_EPV) ||\ (FLAG == CAN_FLAG_BOF)) /* CAN interrupts */ #define CAN_IT_RQCP0 ((u8)0x05) /* Request completed mailbox 0 */ #define CAN_IT_RQCP1 ((u8)0x06) /* Request completed mailbox 1 */ #define CAN_IT_RQCP2 ((u8)0x07) /* Request completed mailbox 2 */ #define CAN_IT_TME ((u32)0x00000001) /* Transmit mailbox empty */ #define CAN_IT_FMP0 ((u32)0x00000002) /* FIFO 0 message pending */ #define CAN_IT_FF0 ((u32)0x00000004) /* FIFO 0 full */ #define CAN_IT_FOV0 ((u32)0x00000008) /* FIFO 0 overrun */ #define CAN_IT_FMP1 ((u32)0x00000010) /* FIFO 1 message pending */ #define CAN_IT_FF1 ((u32)0x00000020) /* FIFO 1 full */ #define CAN_IT_FOV1 ((u32)0x00000040) /* FIFO 1 overrun */ #define CAN_IT_EWG ((u32)0x00000100) /* Error warning */ #define CAN_IT_EPV ((u32)0x00000200) /* Error passive */ #define CAN_IT_BOF ((u32)0x00000400) /* Bus-off */ #define CAN_IT_LEC ((u32)0x00000800) /* Last error code */ #define CAN_IT_ERR ((u32)0x00008000) /* Error */ #define CAN_IT_WKU ((u32)0x00010000) /* Wake-up */ #define CAN_IT_SLK ((u32)0x00020000) /* Sleep */ #define IS_CAN_IT(IT) ((IT == CAN_IT_RQCP0) || (IT == CAN_IT_RQCP1) ||\ (IT == CAN_IT_RQCP2) || (IT == CAN_IT_TME) ||\ (IT == CAN_IT_FMP0) || (IT == CAN_IT_FF0) ||\ (IT == CAN_IT_FOV0) || (IT == CAN_IT_FMP1) ||\ (IT == CAN_IT_FF1) || (IT == CAN_IT_FOV1) ||\ (IT == CAN_IT_EWG) || (IT == CAN_IT_EPV) ||\ (IT == CAN_IT_BOF) || (IT == CAN_IT_LEC) ||\ (IT == CAN_IT_ERR) || (IT == CAN_IT_WKU) ||\ (IT == CAN_IT_SLK)) /* Exported macro ------------------------------------------------------------*/ /* Exported function protypes ----------------------------------------------- */ void CAN_DeInit(void); u8 CAN_Init(CAN_InitTypeDef* CAN_InitStruct); void CAN_FilterInit(CAN_FilterInitTypeDef* CAN_FilterInitStruct); void CAN_StructInit(CAN_InitTypeDef* CAN_InitStruct); void CAN_ITConfig(u32 CAN_IT, FunctionalState NewState); u8 CAN_Transmit(CanTxMsg* TxMessage); u32 CAN_TransmitStatus(u8 TransmitMailbox); void CAN_CancelTransmit(u8 Mailbox); void CAN_FIFORelease(u8 FIFONumber); u8 CAN_MessagePending(u8 FIFONumber); void CAN_Receive(u8 FIFONumber, CanRxMsg* RxMessage); u8 CAN_Sleep(void); u8 CAN_WakeUp(void); FlagStatus CAN_GetFlagStatus(u32 CAN_FLAG); void CAN_ClearFlag(u32 CAN_FLAG); ITStatus CAN_GetITStatus(u32 CAN_IT); void CAN_ClearITPendingBit(u32 CAN_IT); #endif /* __STM32F10x_CAN_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_can.h
C
oos
12,163
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_tim.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * TIM firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_TIM_H #define __STM32F10x_TIM_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* TIM Base Init structure definition */ typedef struct { u16 TIM_Period; /* Period value */ u16 TIM_Prescaler; /* Prescaler value */ u16 TIM_ClockDivision; /* Timer clock division */ u16 TIM_CounterMode; /* Timer Counter mode */ } TIM_TimeBaseInitTypeDef; /* TIM Output Compare Init structure definition */ typedef struct { u16 TIM_OCMode; /* Timer Output Compare Mode */ u16 TIM_Channel; /* Timer Channel */ u16 TIM_Pulse; /* PWM or OC Channel pulse length */ u16 TIM_OCPolarity; /* PWM, OCM or OPM Channel polarity */ } TIM_OCInitTypeDef; /* TIM Input Capture Init structure definition */ typedef struct { u16 TIM_ICMode; /* Timer Input Capture Mode */ u16 TIM_Channel; /* Timer Channel */ u16 TIM_ICPolarity; /* Input Capture polarity */ u16 TIM_ICSelection; /* Input Capture selection */ u16 TIM_ICPrescaler; /* Input Capture prescaler */ u8 TIM_ICFilter; /* Input Capture filter */ } TIM_ICInitTypeDef; /* Exported constants -------------------------------------------------------*/ /* TIM Ouput Compare modes --------------------------------------------------*/ #define TIM_OCMode_Timing ((u16)0x0000) #define TIM_OCMode_Active ((u16)0x0010) #define TIM_OCMode_Inactive ((u16)0x0020) #define TIM_OCMode_Toggle ((u16)0x0030) #define TIM_OCMode_PWM1 ((u16)0x0060) #define TIM_OCMode_PWM2 ((u16)0x0070) #define IS_TIM_OC_MODE(MODE) ((MODE == TIM_OCMode_Timing) || \ (MODE == TIM_OCMode_Active) || \ (MODE == TIM_OCMode_Inactive) || \ (MODE == TIM_OCMode_Toggle)|| \ (MODE == TIM_OCMode_PWM1) || \ (MODE == TIM_OCMode_PWM2)) /* TIM Input Capture modes --------------------------------------------------*/ #define TIM_ICMode_ICAP ((u16)0x0007) #define TIM_ICMode_PWMI ((u16)0x0006) #define IS_TIM_IC_MODE(MODE) ((MODE == TIM_ICMode_ICAP) || \ (MODE == TIM_ICMode_PWMI)) /* TIM One Pulse Mode -------------------------------------------------------*/ #define TIM_OPMode_Single ((u16)0x0008) #define TIM_OPMode_Repetitive ((u16)0x0000) #define IS_TIM_OPM_MODE(MODE) ((MODE == TIM_OPMode_Single) || \ (MODE == TIM_OPMode_Repetitive)) /* TIM Channel --------------------------------------------------------------*/ #define TIM_Channel_1 ((u16)0x0000) #define TIM_Channel_2 ((u16)0x0001) #define TIM_Channel_3 ((u16)0x0002) #define TIM_Channel_4 ((u16)0x0003) #define IS_TIM_CHANNEL(CHANNEL) ((CHANNEL == TIM_Channel_1) || \ (CHANNEL == TIM_Channel_2) || \ (CHANNEL == TIM_Channel_3) || \ (CHANNEL == TIM_Channel_4)) /* TIM Clock Division CKD ---------------------------------------------------*/ #define TIM_CKD_DIV1 ((u16)0x0000) #define TIM_CKD_DIV2 ((u16)0x0100) #define TIM_CKD_DIV4 ((u16)0x0200) #define IS_TIM_CKD_DIV(DIV) ((DIV == TIM_CKD_DIV1) || \ (DIV == TIM_CKD_DIV2) || \ (DIV == TIM_CKD_DIV4)) /* TIM Counter Mode ---------------------------------------------------------*/ #define TIM_CounterMode_Up ((u16)0x0000) #define TIM_CounterMode_Down ((u16)0x0010) #define TIM_CounterMode_CenterAligned1 ((u16)0x0020) #define TIM_CounterMode_CenterAligned2 ((u16)0x0040) #define TIM_CounterMode_CenterAligned3 ((u16)0x0060) #define IS_TIM_COUNTER_MODE(MODE) ((MODE == TIM_CounterMode_Up) || \ (MODE == TIM_CounterMode_Down) || \ (MODE == TIM_CounterMode_CenterAligned1) || \ (MODE == TIM_CounterMode_CenterAligned2) || \ (MODE == TIM_CounterMode_CenterAligned3)) /* TIM Output Compare Polarity ----------------------------------------------*/ #define TIM_OCPolarity_High ((u16)0x0000) #define TIM_OCPolarity_Low ((u16)0x0002) #define IS_TIM_OC_POLARITY(POLARITY) ((POLARITY == TIM_OCPolarity_High) || \ (POLARITY == TIM_OCPolarity_Low)) /* TIM Input Capture Polarity -----------------------------------------------*/ #define TIM_ICPolarity_Rising ((u16)0x0000) #define TIM_ICPolarity_Falling ((u16)0x0002) #define IS_TIM_IC_POLARITY(POLARITY) ((POLARITY == TIM_ICPolarity_Rising) || \ (POLARITY == TIM_ICPolarity_Falling)) /* TIM Input Capture Channel Selection -------------------------------------*/ #define TIM_ICSelection_DirectTI ((u16)0x0001) #define TIM_ICSelection_IndirectTI ((u16)0x0002) #define TIM_ICSelection_TRGI ((u16)0x0003) #define IS_TIM_IC_SELECTION(SELECTION) ((SELECTION == TIM_ICSelection_DirectTI) || \ (SELECTION == TIM_ICSelection_IndirectTI) || \ (SELECTION == TIM_ICSelection_TRGI)) /* TIM Input Capture Prescaler ----------------------------------------------*/ #define TIM_ICPSC_DIV1 ((u16)0x0000) #define TIM_ICPSC_DIV2 ((u16)0x0004) #define TIM_ICPSC_DIV4 ((u16)0x0008) #define TIM_ICPSC_DIV8 ((u16)0x000C) #define IS_TIM_IC_PRESCALER(PRESCALER) ((PRESCALER == TIM_ICPSC_DIV1) || \ (PRESCALER == TIM_ICPSC_DIV2) || \ (PRESCALER == TIM_ICPSC_DIV4) || \ (PRESCALER == TIM_ICPSC_DIV8)) /* TIM Input Capture Filer Value ---------------------------------------------*/ #define IS_TIM_IC_FILTER(ICFILTER) (ICFILTER <= 0xF) /* TIM interrupt sources ----------------------------------------------------*/ #define TIM_IT_Update ((u16)0x0001) #define TIM_IT_CC1 ((u16)0x0002) #define TIM_IT_CC2 ((u16)0x0004) #define TIM_IT_CC3 ((u16)0x0008) #define TIM_IT_CC4 ((u16)0x0010) #define TIM_IT_Trigger ((u16)0x0040) #define IS_TIM_IT(IT) (((IT & (u16)0xFFA0) == 0x0000) && (IT != 0x0000)) #define IS_TIM_GET_IT(IT) ((IT == TIM_IT_Update) || \ (IT == TIM_IT_CC1) || \ (IT == TIM_IT_CC2) || \ (IT == TIM_IT_CC3) || \ (IT == TIM_IT_CC4) || \ (IT == TIM_IT_Trigger)) /* TIM DMA Base address -----------------------------------------------------*/ #define TIM_DMABase_CR1 ((u16)0x0000) #define TIM_DMABase_CR2 ((u16)0x0001) #define TIM_DMABase_SMCR ((u16)0x0002) #define TIM_DMABase_DIER ((u16)0x0003) #define TIM_DMABase_SR ((u16)0x0004) #define TIM_DMABase_EGR ((u16)0x0005) #define TIM_DMABase_CCMR1 ((u16)0x0006) #define TIM_DMABase_CCMR2 ((u16)0x0007) #define TIM_DMABase_CCER ((u16)0x0008) #define TIM_DMABase_CNT ((u16)0x0009) #define TIM_DMABase_PSC ((u16)0x000A) #define TIM_DMABase_ARR ((u16)0x000B) #define TIM_DMABase_CCR1 ((u16)0x000D) #define TIM_DMABase_CCR2 ((u16)0x000E) #define TIM_DMABase_CCR3 ((u16)0x000F) #define TIM_DMABase_CCR4 ((u16)0x0010) #define TIM_DMABase_DCR ((u16)0x0012) #define IS_TIM_DMA_BASE(BASE) ((BASE == TIM_DMABase_CR1) || \ (BASE == TIM_DMABase_CR2) || \ (BASE == TIM_DMABase_SMCR) || \ (BASE == TIM_DMABase_DIER) || \ (BASE == TIM_DMABase_SR) || \ (BASE == TIM_DMABase_EGR) || \ (BASE == TIM_DMABase_CCMR1) || \ (BASE == TIM_DMABase_CCMR2) || \ (BASE == TIM_DMABase_CCER) || \ (BASE == TIM_DMABase_CNT) || \ (BASE == TIM_DMABase_PSC) || \ (BASE == TIM_DMABase_ARR) || \ (BASE == TIM_DMABase_CCR1) || \ (BASE == TIM_DMABase_CCR2) || \ (BASE == TIM_DMABase_CCR3) || \ (BASE == TIM_DMABase_CCR4) || \ (BASE == TIM_DMABase_DCR)) /* TIM DMA Burst Length -----------------------------------------------------*/ #define TIM_DMABurstLength_1Byte ((u16)0x0000) #define TIM_DMABurstLength_2Bytes ((u16)0x0100) #define TIM_DMABurstLength_3Bytes ((u16)0x0200) #define TIM_DMABurstLength_4Bytes ((u16)0x0300) #define TIM_DMABurstLength_5Bytes ((u16)0x0400) #define TIM_DMABurstLength_6Bytes ((u16)0x0500) #define TIM_DMABurstLength_7Bytes ((u16)0x0600) #define TIM_DMABurstLength_8Bytes ((u16)0x0700) #define TIM_DMABurstLength_9Bytes ((u16)0x0800) #define TIM_DMABurstLength_10Bytes ((u16)0x0900) #define TIM_DMABurstLength_11Bytes ((u16)0x0A00) #define TIM_DMABurstLength_12Bytes ((u16)0x0B00) #define TIM_DMABurstLength_13Bytes ((u16)0x0C00) #define TIM_DMABurstLength_14Bytes ((u16)0x0D00) #define TIM_DMABurstLength_15Bytes ((u16)0x0E00) #define TIM_DMABurstLength_16Bytes ((u16)0x0F00) #define TIM_DMABurstLength_17Bytes ((u16)0x1000) #define TIM_DMABurstLength_18Bytes ((u16)0x1100) #define IS_TIM_DMA_LENGTH(LENGTH) ((LENGTH == TIM_DMABurstLength_1Byte) || \ (LENGTH == TIM_DMABurstLength_2Bytes) || \ (LENGTH == TIM_DMABurstLength_3Bytes) || \ (LENGTH == TIM_DMABurstLength_4Bytes) || \ (LENGTH == TIM_DMABurstLength_5Bytes) || \ (LENGTH == TIM_DMABurstLength_6Bytes) || \ (LENGTH == TIM_DMABurstLength_7Bytes) || \ (LENGTH == TIM_DMABurstLength_8Bytes) || \ (LENGTH == TIM_DMABurstLength_9Bytes) || \ (LENGTH == TIM_DMABurstLength_10Bytes) || \ (LENGTH == TIM_DMABurstLength_11Bytes) || \ (LENGTH == TIM_DMABurstLength_12Bytes) || \ (LENGTH == TIM_DMABurstLength_13Bytes) || \ (LENGTH == TIM_DMABurstLength_14Bytes) || \ (LENGTH == TIM_DMABurstLength_15Bytes) || \ (LENGTH == TIM_DMABurstLength_16Bytes) || \ (LENGTH == TIM_DMABurstLength_17Bytes) || \ (LENGTH == TIM_DMABurstLength_18Bytes)) /* TIM DMA sources ----------------------------------------------------------*/ #define TIM_DMA_Update ((u16)0x0100) #define TIM_DMA_CC1 ((u16)0x0200) #define TIM_DMA_CC2 ((u16)0x0400) #define TIM_DMA_CC3 ((u16)0x0800) #define TIM_DMA_CC4 ((u16)0x1000) #define TIM_DMA_Trigger ((u16)0x4000) #define IS_TIM_DMA_SOURCE(SOURCE) (((SOURCE & (u16)0xA0FF) == 0x0000) && (SOURCE != 0x0000)) /* TIM External Trigger Prescaler -------------------------------------------*/ #define TIM_ExtTRGPSC_OFF ((u16)0x0000) #define TIM_ExtTRGPSC_DIV2 ((u16)0x1000) #define TIM_ExtTRGPSC_DIV4 ((u16)0x2000) #define TIM_ExtTRGPSC_DIV8 ((u16)0x3000) #define IS_TIM_EXT_PRESCALER(PRESCALER) ((PRESCALER == TIM_ExtTRGPSC_OFF) || \ (PRESCALER == TIM_ExtTRGPSC_DIV2) || \ (PRESCALER == TIM_ExtTRGPSC_DIV4) || \ (PRESCALER == TIM_ExtTRGPSC_DIV8)) /* TIM Input Trigger Selection ---------------------------------------------*/ #define TIM_TS_ITR0 ((u16)0x0000) #define TIM_TS_ITR1 ((u16)0x0010) #define TIM_TS_ITR2 ((u16)0x0020) #define TIM_TS_ITR3 ((u16)0x0030) #define TIM_TS_TI1F_ED ((u16)0x0040) #define TIM_TS_TI1FP1 ((u16)0x0050) #define TIM_TS_TI2FP2 ((u16)0x0060) #define TIM_TS_ETRF ((u16)0x0070) #define IS_TIM_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM_TS_ITR0) || \ (SELECTION == TIM_TS_ITR1) || \ (SELECTION == TIM_TS_ITR2) || \ (SELECTION == TIM_TS_ITR3) || \ (SELECTION == TIM_TS_TI1F_ED) || \ (SELECTION == TIM_TS_TI1FP1) || \ (SELECTION == TIM_TS_TI2FP2) || \ (SELECTION == TIM_TS_ETRF)) #define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM_TS_ITR0) || \ (SELECTION == TIM_TS_ITR1) || \ (SELECTION == TIM_TS_ITR2) || \ (SELECTION == TIM_TS_ITR3)) #define IS_TIM_TIX_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM_TS_TI1F_ED) || \ (SELECTION == TIM_TS_TI1FP1) || \ (SELECTION == TIM_TS_TI2FP2)) /* TIM External Trigger Polarity --------------------------------------------*/ #define TIM_ExtTRGPolarity_Inverted ((u16)0x8000) #define TIM_ExtTRGPolarity_NonInverted ((u16)0x0000) #define IS_TIM_EXT_POLARITY(POLARITY) ((POLARITY == TIM_ExtTRGPolarity_Inverted) || \ (POLARITY == TIM_ExtTRGPolarity_NonInverted)) /* TIM Prescaler Reload Mode ------------------------------------------------*/ #define TIM_PSCReloadMode_Update ((u16)0x0000) #define TIM_PSCReloadMode_Immediate ((u16)0x0001) #define IS_TIM_PRESCALER_RELOAD(RELOAD) ((RELOAD == TIM_PSCReloadMode_Update) || \ (RELOAD == TIM_PSCReloadMode_Immediate)) /* TIM Forced Action --------------------------------------------------------*/ #define TIM_ForcedAction_Active ((u16)0x0050) #define TIM_ForcedAction_InActive ((u16)0x0040) #define IS_TIM_FORCED_ACTION(ACTION) ((ACTION == TIM_ForcedAction_Active) || \ (ACTION == TIM_ForcedAction_InActive)) /* TIM Encoder Mode ---------------------------------------------------------*/ #define TIM_EncoderMode_TI1 ((u16)0x0001) #define TIM_EncoderMode_TI2 ((u16)0x0002) #define TIM_EncoderMode_TI12 ((u16)0x0003) #define IS_TIM_ENCODER_MODE(MODE) ((MODE == TIM_EncoderMode_TI1) || \ (MODE == TIM_EncoderMode_TI2) || \ (MODE == TIM_EncoderMode_TI12)) /* TIM Event Source ---------------------------------------------------------*/ #define TIM_EventSource_Update ((u16)0x0001) #define TIM_EventSource_CC1 ((u16)0x0002) #define TIM_EventSource_CC2 ((u16)0x0004) #define TIM_EventSource_CC3 ((u16)0x0008) #define TIM_EventSource_CC4 ((u16)0x0010) #define TIM_EventSource_Trigger ((u16)0x0040) #define IS_TIM_EVENT_SOURCE(SOURCE) (((SOURCE & (u16)0xFFA0) == 0x0000) && (SOURCE != 0x0000)) /* TIM Update Source --------------------------------------------------------*/ #define TIM_UpdateSource_Global ((u16)0x0000) #define TIM_UpdateSource_Regular ((u16)0x0001) #define IS_TIM_UPDATE_SOURCE(SOURCE) ((SOURCE == TIM_UpdateSource_Global) || \ (SOURCE == TIM_UpdateSource_Regular)) /* TIM Ouput Compare Preload State ------------------------------------------*/ #define TIM_OCPreload_Enable ((u16)0x0008) #define TIM_OCPreload_Disable ((u16)0x0000) #define IS_TIM_OCPRELOAD_STATE(STATE) ((STATE == TIM_OCPreload_Enable) || \ (STATE == TIM_OCPreload_Disable)) /* TIM Ouput Compare Fast State ---------------------------------------------*/ #define TIM_OCFast_Enable ((u16)0x0004) #define TIM_OCFast_Disable ((u16)0x0000) #define IS_TIM_OCFAST_STATE(STATE) ((STATE == TIM_OCFast_Enable) || \ (STATE == TIM_OCFast_Disable)) /* TIM Trigger Output Source ------------------------------------------------*/ #define TIM_TRGOSource_Reset ((u16)0x0000) #define TIM_TRGOSource_Enable ((u16)0x0010) #define TIM_TRGOSource_Update ((u16)0x0020) #define TIM_TRGOSource_OC1 ((u16)0x0030) #define TIM_TRGOSource_OC1Ref ((u16)0x0040) #define TIM_TRGOSource_OC2Ref ((u16)0x0050) #define TIM_TRGOSource_OC3Ref ((u16)0x0060) #define TIM_TRGOSource_OC4Ref ((u16)0x0070) #define IS_TIM_TRGO_SOURCE(SOURCE) ((SOURCE == TIM_TRGOSource_Reset) || \ (SOURCE == TIM_TRGOSource_Enable) || \ (SOURCE == TIM_TRGOSource_Update) || \ (SOURCE == TIM_TRGOSource_OC1) || \ (SOURCE == TIM_TRGOSource_OC1Ref) || \ (SOURCE == TIM_TRGOSource_OC2Ref) || \ (SOURCE == TIM_TRGOSource_OC3Ref) || \ (SOURCE == TIM_TRGOSource_OC4Ref)) /* TIM Slave Mode -----------------------------------------------------------*/ #define TIM_SlaveMode_Reset ((u16)0x0004) #define TIM_SlaveMode_Gated ((u16)0x0005) #define TIM_SlaveMode_Trigger ((u16)0x0006) #define TIM_SlaveMode_External1 ((u16)0x0007) #define IS_TIM_SLAVE_MODE(MODE) ((MODE == TIM_SlaveMode_Reset) || \ (MODE == TIM_SlaveMode_Gated) || \ (MODE == TIM_SlaveMode_Trigger) || \ (MODE == TIM_SlaveMode_External1)) /* TIM TIx External Clock Source --------------------------------------------*/ #define TIM_TIxExternalCLK1Source_TI1 ((u16)0x0050) #define TIM_TIxExternalCLK1Source_TI2 ((u16)0x0060) #define TIM_TIxExternalCLK1Source_TI1ED ((u16)0x0040) #define IS_TIM_TIXCLK_SOURCE(SOURCE) ((SOURCE == TIM_TIxExternalCLK1Source_TI1) || \ (SOURCE == TIM_TIxExternalCLK1Source_TI2) || \ (SOURCE == TIM_TIxExternalCLK1Source_TI1ED)) /* TIM Master Slave Mode ----------------------------------------------------*/ #define TIM_MasterSlaveMode_Enable ((u16)0x0080) #define TIM_MasterSlaveMode_Disable ((u16)0x0000) #define IS_TIM_MSM_STATE(STATE) ((STATE == TIM_MasterSlaveMode_Enable) || \ (STATE == TIM_MasterSlaveMode_Disable)) /* TIM Flags ----------------------------------------------------------------*/ #define TIM_FLAG_Update ((u16)0x0001) #define TIM_FLAG_CC1 ((u16)0x0002) #define TIM_FLAG_CC2 ((u16)0x0004) #define TIM_FLAG_CC3 ((u16)0x0008) #define TIM_FLAG_CC4 ((u16)0x0010) #define TIM_FLAG_Trigger ((u16)0x0040) #define TIM_FLAG_CC1OF ((u16)0x0200) #define TIM_FLAG_CC2OF ((u16)0x0400) #define TIM_FLAG_CC3OF ((u16)0x0800) #define TIM_FLAG_CC4OF ((u16)0x1000) #define IS_TIM_GET_FLAG(FLAG) ((FLAG == TIM_FLAG_Update) || \ (FLAG == TIM_FLAG_CC1) || \ (FLAG == TIM_FLAG_CC2) || \ (FLAG == TIM_FLAG_CC3) || \ (FLAG == TIM_FLAG_CC4) || \ (FLAG == TIM_FLAG_Trigger) || \ (FLAG == TIM_FLAG_CC1OF) || \ (FLAG == TIM_FLAG_CC2OF) || \ (FLAG == TIM_FLAG_CC3OF) || \ (FLAG == TIM_FLAG_CC4OF)) #define IS_TIM_CLEAR_FLAG(FLAG) (((FLAG & (u16)0xE1A0) == 0x0000) && (FLAG != 0x0000)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/ void TIM_DeInit(TIM_TypeDef* TIMx); void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); void TIM_OCInit(TIM_TypeDef* TIMx, TIM_OCInitTypeDef* TIM_OCInitStruct); void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef* TIM_ICInitStruct); void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct); void TIM_OCStructInit(TIM_OCInitTypeDef* TIM_OCInitStruct); void TIM_ICStructInit(TIM_ICInitTypeDef* TIM_ICInitStruct); void TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); void TIM_ITConfig(TIM_TypeDef* TIMx, u16 TIM_IT, FunctionalState NewState); void TIM_DMAConfig(TIM_TypeDef* TIMx, u16 TIM_DMABase, u16 TIM_DMABurstLength); void TIM_DMACmd(TIM_TypeDef* TIMx, u16 TIM_DMASource, FunctionalState Newstate); void TIM_InternalClockConfig(TIM_TypeDef* TIMx); void TIM_ITRxExternalClockConfig(TIM_TypeDef* TIMx, u16 TIM_InputTriggerSource); void TIM_TIxExternalClockConfig(TIM_TypeDef* TIMx, u16 TIM_TIxExternalCLKSource, u16 TIM_ICPolarity, u8 ICFilter); void TIM_ETRClockMode1Config(TIM_TypeDef* TIMx, u16 TIM_ExtTRGPrescaler, u16 TIM_ExtTRGPolarity, u8 ExtTRGFilter); void TIM_ETRClockMode2Config(TIM_TypeDef* TIMx, u16 TIM_ExtTRGPrescaler, u16 TIM_ExtTRGPolarity, u8 ExtTRGFilter); void TIM_SelectInputTrigger(TIM_TypeDef* TIMx, u16 TIM_InputTriggerSource); void TIM_PrescalerConfig(TIM_TypeDef* TIMx, u16 Prescaler, u16 TIM_PSCReloadMode); void TIM_CounterModeConfig(TIM_TypeDef* TIMx, u16 TIM_CounterMode); void TIM_ForcedOC1Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction); void TIM_ForcedOC2Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction); void TIM_ForcedOC3Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction); void TIM_ForcedOC4Config(TIM_TypeDef* TIMx, u16 TIM_ForcedAction); void TIM_ARRPreloadConfig(TIM_TypeDef* TIMx, FunctionalState Newstate); void TIM_SelectCCDMA(TIM_TypeDef* TIMx, FunctionalState Newstate); void TIM_OC1PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload); void TIM_OC2PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload); void TIM_OC3PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload); void TIM_OC4PreloadConfig(TIM_TypeDef* TIMx, u16 TIM_OCPreload); void TIM_OC1FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast); void TIM_OC2FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast); void TIM_OC3FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast); void TIM_OC4FastConfig(TIM_TypeDef* TIMx, u16 TIM_OCFast); void TIM_UpdateDisableConfig(TIM_TypeDef* TIMx, FunctionalState Newstate); void TIM_EncoderInterfaceConfig(TIM_TypeDef* TIMx, u16 TIM_EncoderMode, u16 TIM_IC1Polarity, u16 TIM_IC2Polarity); void TIM_GenerateEvent(TIM_TypeDef* TIMx, u16 TIM_EventSource); void TIM_OC1PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity); void TIM_OC2PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity); void TIM_OC3PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity); void TIM_OC4PolarityConfig(TIM_TypeDef* TIMx, u16 TIM_OCPolarity); void TIM_UpdateRequestConfig(TIM_TypeDef* TIMx, u16 TIM_UpdateSource); void TIM_SelectHallSensor(TIM_TypeDef* TIMx, FunctionalState Newstate); void TIM_SelectOnePulseMode(TIM_TypeDef* TIMx, u16 TIM_OPMode); void TIM_SelectOutputTrigger(TIM_TypeDef* TIMx, u16 TIM_TRGOSource); void TIM_SelectSlaveMode(TIM_TypeDef* TIMx, u16 TIM_SlaveMode); void TIM_SelectMasterSlaveMode(TIM_TypeDef* TIMx, u16 TIM_MasterSlaveMode); void TIM_SetAutoreload(TIM_TypeDef* TIMx, u16 Autoreload); void TIM_SetCompare1(TIM_TypeDef* TIMx, u16 Compare1); void TIM_SetCompare2(TIM_TypeDef* TIMx, u16 Compare2); void TIM_SetCompare3(TIM_TypeDef* TIMx, u16 Compare3); void TIM_SetCompare4(TIM_TypeDef* TIMx, u16 Compare4); void TIM_SetIC1Prescaler(TIM_TypeDef* TIMx, u16 TIM_IC1Prescaler); void TIM_SetIC2Prescaler(TIM_TypeDef* TIMx, u16 TIM_IC2Prescaler); void TIM_SetIC3Prescaler(TIM_TypeDef* TIMx, u16 TIM_IC3Prescaler); void TIM_SetIC4Prescaler(TIM_TypeDef* TIMx, u16 TIM_IC4Prescaler); void TIM_SetClockDivision(TIM_TypeDef* TIMx, u16 TIM_CKD); u16 TIM_GetCapture1(TIM_TypeDef* TIMx); u16 TIM_GetCapture2(TIM_TypeDef* TIMx); u16 TIM_GetCapture3(TIM_TypeDef* TIMx); u16 TIM_GetCapture4(TIM_TypeDef* TIMx); u16 TIM_GetCounter(TIM_TypeDef* TIMx); u16 TIM_GetPrescaler(TIM_TypeDef* TIMx); FlagStatus TIM_GetFlagStatus(TIM_TypeDef* TIMx, u16 TIM_FLAG); void TIM_ClearFlag(TIM_TypeDef* TIMx, u16 TIM_FLAG); ITStatus TIM_GetITStatus(TIM_TypeDef* TIMx, u16 TIM_IT); void TIM_ClearITPendingBit(TIM_TypeDef* TIMx, u16 TIM_IT); #endif /*__STM32F10x_TIM_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_tim.h
C
oos
28,319
/** ****************************************************************************** * @file stm32f10x_spi.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the SPI firmware * library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_SPI_H #define __STM32F10x_SPI_H /* Includes ------------------------------------------------------------------*/ //#include "stm32f10x.h" #include "stm32f10x_map.h" #define uint16_t unsigned short #define uint8_t unsigned char #define uint32_t unsigned long #define RCC_APB1Periph_SPI3 ((uint32_t)0x00008000) #define SPI3_BASE (APB1PERIPH_BASE + 0x3C00) #define SPI3 ((SPI_TypeDef *) SPI3_BASE) #define GPIO_Remap_SPI3 ( 1UL << 28UL ) /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup SPI * @{ */ /** @defgroup SPI_Exported_Types * @{ */ /** * @brief SPI Init structure definition */ typedef struct { uint16_t SPI_Direction; uint16_t SPI_Mode; uint16_t SPI_DataSize; uint16_t SPI_CPOL; uint16_t SPI_CPHA; uint16_t SPI_NSS; uint16_t SPI_BaudRatePrescaler; uint16_t SPI_FirstBit; uint16_t SPI_CRCPolynomial; }SPI_InitTypeDef; /** * @brief I2S Init structure definition */ typedef struct { uint16_t I2S_Mode; uint16_t I2S_Standard; uint16_t I2S_DataFormat; uint16_t I2S_MCLKOutput; uint16_t I2S_AudioFreq; uint16_t I2S_CPOL; }I2S_InitTypeDef; /** * @} */ /** @defgroup SPI_Exported_Constants * @{ */ #define IS_SPI_ALL_PERIPH(PERIPH) (((*(uint32_t*)&(PERIPH)) == SPI1_BASE) || \ ((*(uint32_t*)&(PERIPH)) == SPI2_BASE) || \ ((*(uint32_t*)&(PERIPH)) == SPI3_BASE)) #define IS_SPI_23_PERIPH(PERIPH) (((*(uint32_t*)&(PERIPH)) == SPI2_BASE) || \ ((*(uint32_t*)&(PERIPH)) == SPI3_BASE)) /** @defgroup SPI_data_direction_mode * @{ */ #define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000) #define SPI_Direction_2Lines_RxOnly ((uint16_t)0x0400) #define SPI_Direction_1Line_Rx ((uint16_t)0x8000) #define SPI_Direction_1Line_Tx ((uint16_t)0xC000) #define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \ ((MODE) == SPI_Direction_2Lines_RxOnly) || \ ((MODE) == SPI_Direction_1Line_Rx) || \ ((MODE) == SPI_Direction_1Line_Tx)) /** * @} */ /** @defgroup SPI_master_slave_mode * @{ */ #define SPI_Mode_Master ((uint16_t)0x0104) #define SPI_Mode_Slave ((uint16_t)0x0000) #define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \ ((MODE) == SPI_Mode_Slave)) /** * @} */ /** @defgroup SPI_data_size * @{ */ #define SPI_DataSize_16b ((uint16_t)0x0800) #define SPI_DataSize_8b ((uint16_t)0x0000) #define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DataSize_16b) || \ ((DATASIZE) == SPI_DataSize_8b)) /** * @} */ /** @defgroup SPI_Clock_Polarity * @{ */ #define SPI_CPOL_Low ((uint16_t)0x0000) #define SPI_CPOL_High ((uint16_t)0x0002) #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \ ((CPOL) == SPI_CPOL_High)) /** * @} */ /** @defgroup SPI_Clock_Phase * @{ */ #define SPI_CPHA_1Edge ((uint16_t)0x0000) #define SPI_CPHA_2Edge ((uint16_t)0x0001) #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \ ((CPHA) == SPI_CPHA_2Edge)) /** * @} */ /** @defgroup SPI_Slave_Select_management * @{ */ #define SPI_NSS_Soft ((uint16_t)0x0200) #define SPI_NSS_Hard ((uint16_t)0x0000) #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \ ((NSS) == SPI_NSS_Hard)) /** * @} */ /** @defgroup SPI_BaudRate_Prescaler_ * @{ */ #define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000) #define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008) #define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010) #define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018) #define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020) #define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028) #define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030) #define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038) #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \ ((PRESCALER) == SPI_BaudRatePrescaler_4) || \ ((PRESCALER) == SPI_BaudRatePrescaler_8) || \ ((PRESCALER) == SPI_BaudRatePrescaler_16) || \ ((PRESCALER) == SPI_BaudRatePrescaler_32) || \ ((PRESCALER) == SPI_BaudRatePrescaler_64) || \ ((PRESCALER) == SPI_BaudRatePrescaler_128) || \ ((PRESCALER) == SPI_BaudRatePrescaler_256)) /** * @} */ /** @defgroup SPI_MSB_LSB_transmission * @{ */ #define SPI_FirstBit_MSB ((uint16_t)0x0000) #define SPI_FirstBit_LSB ((uint16_t)0x0080) #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \ ((BIT) == SPI_FirstBit_LSB)) /** * @} */ /** @defgroup I2S_Mode * @{ */ #define I2S_Mode_SlaveTx ((uint16_t)0x0000) #define I2S_Mode_SlaveRx ((uint16_t)0x0100) #define I2S_Mode_MasterTx ((uint16_t)0x0200) #define I2S_Mode_MasterRx ((uint16_t)0x0300) #define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \ ((MODE) == I2S_Mode_SlaveRx) || \ ((MODE) == I2S_Mode_MasterTx) || \ ((MODE) == I2S_Mode_MasterRx) ) /** * @} */ /** @defgroup I2S_Standard * @{ */ #define I2S_Standard_Phillips ((uint16_t)0x0000) #define I2S_Standard_MSB ((uint16_t)0x0010) #define I2S_Standard_LSB ((uint16_t)0x0020) #define I2S_Standard_PCMShort ((uint16_t)0x0030) #define I2S_Standard_PCMLong ((uint16_t)0x00B0) #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \ ((STANDARD) == I2S_Standard_MSB) || \ ((STANDARD) == I2S_Standard_LSB) || \ ((STANDARD) == I2S_Standard_PCMShort) || \ ((STANDARD) == I2S_Standard_PCMLong)) /** * @} */ /** @defgroup I2S_Data_Format * @{ */ #define I2S_DataFormat_16b ((uint16_t)0x0000) #define I2S_DataFormat_16bextended ((uint16_t)0x0001) #define I2S_DataFormat_24b ((uint16_t)0x0003) #define I2S_DataFormat_32b ((uint16_t)0x0005) #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DataFormat_16b) || \ ((FORMAT) == I2S_DataFormat_16bextended) || \ ((FORMAT) == I2S_DataFormat_24b) || \ ((FORMAT) == I2S_DataFormat_32b)) /** * @} */ /** @defgroup I2S_MCLK_Output * @{ */ #define I2S_MCLKOutput_Enable ((uint16_t)0x0200) #define I2S_MCLKOutput_Disable ((uint16_t)0x0000) #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOutput_Enable) || \ ((OUTPUT) == I2S_MCLKOutput_Disable)) /** * @} */ /** @defgroup I2S_Audio_Frequency * @{ */ #define I2S_AudioFreq_48k ((uint16_t)48000) #define I2S_AudioFreq_44k ((uint16_t)44100) #define I2S_AudioFreq_22k ((uint16_t)22050) #define I2S_AudioFreq_16k ((uint16_t)16000) #define I2S_AudioFreq_8k ((uint16_t)8000) #define I2S_AudioFreq_Default ((uint16_t)2) #define IS_I2S_AUDIO_FREQ(FREQ) (((FREQ) == I2S_AudioFreq_48k) || \ ((FREQ) == I2S_AudioFreq_44k) || \ ((FREQ) == I2S_AudioFreq_22k) || \ ((FREQ) == I2S_AudioFreq_16k) || \ ((FREQ) == I2S_AudioFreq_8k) || \ ((FREQ) == I2S_AudioFreq_Default)) /** * @} */ /** @defgroup I2S_Clock_Polarity * @{ */ #define I2S_CPOL_Low ((uint16_t)0x0000) #define I2S_CPOL_High ((uint16_t)0x0008) #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_Low) || \ ((CPOL) == I2S_CPOL_High)) /** * @} */ /** @defgroup SPI_I2S_DMA_transfer_requests * @{ */ #define SPI_I2S_DMAReq_Tx ((uint16_t)0x0002) #define SPI_I2S_DMAReq_Rx ((uint16_t)0x0001) #define IS_SPI_I2S_DMAREQ(DMAREQ) ((((DMAREQ) & (uint16_t)0xFFFC) == 0x00) && ((DMAREQ) != 0x00)) /** * @} */ /** @defgroup SPI_NSS_internal_software_mangement * @{ */ #define SPI_NSSInternalSoft_Set ((uint16_t)0x0100) #define SPI_NSSInternalSoft_Reset ((uint16_t)0xFEFF) #define IS_SPI_NSS_INTERNAL(INTERNAL) (((INTERNAL) == SPI_NSSInternalSoft_Set) || \ ((INTERNAL) == SPI_NSSInternalSoft_Reset)) /** * @} */ /** @defgroup SPI_CRC_Transmit_Receive * @{ */ #define SPI_CRC_Tx ((uint8_t)0x00) #define SPI_CRC_Rx ((uint8_t)0x01) #define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_Tx) || ((CRC) == SPI_CRC_Rx)) /** * @} */ /** @defgroup SPI_direction_transmit_receive * @{ */ #define SPI_Direction_Rx ((uint16_t)0xBFFF) #define SPI_Direction_Tx ((uint16_t)0x4000) #define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_Direction_Rx) || \ ((DIRECTION) == SPI_Direction_Tx)) /** * @} */ /** @defgroup SPI_I2S_interrupts_definition * @{ */ #define SPI_I2S_IT_TXE ((uint8_t)0x71) #define SPI_I2S_IT_RXNE ((uint8_t)0x60) #define SPI_I2S_IT_ERR ((uint8_t)0x50) #define IS_SPI_I2S_CONFIG_IT(IT) (((IT) == SPI_I2S_IT_TXE) || \ ((IT) == SPI_I2S_IT_RXNE) || \ ((IT) == SPI_I2S_IT_ERR)) #define SPI_I2S_IT_OVR ((uint8_t)0x56) #define SPI_IT_MODF ((uint8_t)0x55) #define SPI_IT_CRCERR ((uint8_t)0x54) #define I2S_IT_UDR ((uint8_t)0x53) #define IS_SPI_I2S_CLEAR_IT(IT) (((IT) == SPI_IT_CRCERR)) #define IS_SPI_I2S_GET_IT(IT) (((IT) == SPI_I2S_IT_RXNE) || ((IT) == SPI_I2S_IT_TXE) || \ ((IT) == I2S_IT_UDR) || ((IT) == SPI_IT_CRCERR) || \ ((IT) == SPI_IT_MODF) || ((IT) == SPI_I2S_IT_OVR)) /** * @} */ /** @defgroup SPI_I2S_flags_definition * @{ */ #define SPI_I2S_FLAG_RXNE ((uint16_t)0x0001) #define SPI_I2S_FLAG_TXE ((uint16_t)0x0002) #define I2S_FLAG_CHSIDE ((uint16_t)0x0004) #define I2S_FLAG_UDR ((uint16_t)0x0008) #define SPI_FLAG_CRCERR ((uint16_t)0x0010) #define SPI_FLAG_MODF ((uint16_t)0x0020) #define SPI_I2S_FLAG_OVR ((uint16_t)0x0040) #define SPI_I2S_FLAG_BSY ((uint16_t)0x0080) #define IS_SPI_I2S_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CRCERR)) #define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \ ((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CRCERR) || \ ((FLAG) == I2S_FLAG_UDR) || ((FLAG) == I2S_FLAG_CHSIDE) || \ ((FLAG) == SPI_I2S_FLAG_TXE) || ((FLAG) == SPI_I2S_FLAG_RXNE)) /** * @} */ /** @defgroup SPI_CRC_polynomial * @{ */ #define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) ((POLYNOMIAL) >= 0x1) /** * @} */ /** * @} */ /** @defgroup SPI_Exported_Macros * @{ */ /** * @} */ /** @defgroup SPI_Exported_Functions * @{ */ void SPI_I2S_DeInit(SPI_TypeDef* SPIx); void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct); void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct); void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct); void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct); void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState); void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState); void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState); void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState); void SPI_I2S_SendData(SPI_TypeDef* SPIx, uint16_t Data); uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx); void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft); void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState); void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize); void SPI_TransmitCRC(SPI_TypeDef* SPIx); void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState); uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC); uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx); void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction); FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG); void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG); ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); #endif /*__STM32F10x_SPI_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_spi.h
C
oos
15,174
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_lib.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file includes the peripherals header files in the * user application. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_LIB_H #define __STM32F10x_LIB_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" #ifdef _ADC #include "stm32f10x_adc.h" #endif /*_ADC */ #ifdef _BKP #include "stm32f10x_bkp.h" #endif /*_BKP */ #ifdef _CAN #include "stm32f10x_can.h" #endif /*_CAN */ #ifdef _DMA #include "stm32f10x_dma.h" #endif /*_DMA */ #ifdef _EXTI #include "stm32f10x_exti.h" #endif /*_EXTI */ #ifdef _FLASH #include "stm32f10x_flash.h" #endif /*_FLASH */ #ifdef _GPIO #include "stm32f10x_gpio.h" #endif /*_GPIO */ #ifdef _I2C #include "stm32f10x_i2c.h" #endif /*_I2C */ #ifdef _IWDG #include "stm32f10x_iwdg.h" #endif /*_IWDG */ #ifdef _NVIC #include "stm32f10x_nvic.h" #endif /*_NVIC */ #ifdef _PWR #include "stm32f10x_pwr.h" #endif /*_PWR */ #ifdef _RCC #include "stm32f10x_rcc.h" #endif /*_RCC */ #ifdef _RTC #include "stm32f10x_rtc.h" #endif /*_RTC */ #ifdef _SPI #include "stm32f10x_spi.h" #endif /*_SPI */ #ifdef _SysTick #include "stm32f10x_systick.h" #endif /*_SysTick */ #ifdef _TIM1 #include "stm32f10x_tim1.h" #endif /*_TIM1 */ #ifdef _TIM #include "stm32f10x_tim.h" #endif /*_TIM */ #ifdef _USART #include "stm32f10x_usart.h" #endif /*_USART */ #ifdef _WWDG #include "stm32f10x_wwdg.h" #endif /*_WWDG */ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void debug(void); #endif /* __STM32F10x_LIB_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_lib.h
C
oos
3,060
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_usart.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * USART firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_USART_H #define __STM32F10x_USART_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* UART Init Structure definition */ typedef struct { u32 USART_BaudRate; u16 USART_WordLength; u16 USART_StopBits; u16 USART_Parity; u16 USART_HardwareFlowControl; u16 USART_Mode; u16 USART_Clock; u16 USART_CPOL; u16 USART_CPHA; u16 USART_LastBit; } USART_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* USART Word Length ---------------------------------------------------------*/ #define USART_WordLength_8b ((u16)0x0000) #define USART_WordLength_9b ((u16)0x1000) #define IS_USART_WORD_LENGTH(LENGTH) ((LENGTH == USART_WordLength_8b) || \ (LENGTH == USART_WordLength_9b)) /* USART Stop Bits -----------------------------------------------------------*/ #define USART_StopBits_1 ((u16)0x0000) #define USART_StopBits_0_5 ((u16)0x1000) #define USART_StopBits_2 ((u16)0x2000) #define USART_StopBits_1_5 ((u16)0x3000) #define IS_USART_STOPBITS(STOPBITS) ((STOPBITS == USART_StopBits_1) || \ (STOPBITS == USART_StopBits_0_5) || \ (STOPBITS == USART_StopBits_2) || \ (STOPBITS == USART_StopBits_1_5)) /* USART Parity --------------------------------------------------------------*/ #define USART_Parity_No ((u16)0x0000) #define USART_Parity_Even ((u16)0x0400) #define USART_Parity_Odd ((u16)0x0600) #define IS_USART_PARITY(PARITY) ((PARITY == USART_Parity_No) || \ (PARITY == USART_Parity_Even) || \ (PARITY == USART_Parity_Odd)) /* USART Hardware Flow Control -----------------------------------------------*/ #define USART_HardwareFlowControl_None ((u16)0x0000) #define USART_HardwareFlowControl_RTS ((u16)0x0100) #define USART_HardwareFlowControl_CTS ((u16)0x0200) #define USART_HardwareFlowControl_RTS_CTS ((u16)0x0300) #define IS_USART_HARDWARE_FLOW_CONTROL(CONTROL)\ ((CONTROL == USART_HardwareFlowControl_None) || \ (CONTROL == USART_HardwareFlowControl_RTS) || \ (CONTROL == USART_HardwareFlowControl_CTS) || \ (CONTROL == USART_HardwareFlowControl_RTS_CTS)) /* USART Mode ----------------------------------------------------------------*/ #define USART_Mode_Rx ((u16)0x0004) #define USART_Mode_Tx ((u16)0x0008) #define IS_USART_MODE(MODE) (((MODE & (u16)0xFFF3) == 0x00) && (MODE != (u16)0x00)) /* USART Clock ---------------------------------------------------------------*/ #define USART_Clock_Disable ((u16)0x0000) #define USART_Clock_Enable ((u16)0x0800) #define IS_USART_CLOCK(CLOCK) ((CLOCK == USART_Clock_Disable) || \ (CLOCK == USART_Clock_Enable)) /* USART Clock Polarity ------------------------------------------------------*/ #define USART_CPOL_Low ((u16)0x0000) #define USART_CPOL_High ((u16)0x0400) #define IS_USART_CPOL(CPOL) ((CPOL == USART_CPOL_Low) || (CPOL == USART_CPOL_High)) /* USART Clock Phase ---------------------------------------------------------*/ #define USART_CPHA_1Edge ((u16)0x0000) #define USART_CPHA_2Edge ((u16)0x0200) #define IS_USART_CPHA(CPHA) ((CPHA == USART_CPHA_1Edge) || (CPHA == USART_CPHA_2Edge)) /* USART Last Bit ------------------------------------------------------------*/ #define USART_LastBit_Disable ((u16)0x0000) #define USART_LastBit_Enable ((u16)0x0100) #define IS_USART_LASTBIT(LASTBIT) ((LASTBIT == USART_LastBit_Disable) || \ (LASTBIT == USART_LastBit_Enable)) /* USART Interrupt definition ------------------------------------------------*/ #define USART_IT_PE ((u16)0x0028) #define USART_IT_TXE ((u16)0x0727) #define USART_IT_TC ((u16)0x0626) #define USART_IT_RXNE ((u16)0x0525) #define USART_IT_IDLE ((u16)0x0424) #define USART_IT_LBD ((u16)0x0846) #define USART_IT_CTS ((u16)0x096A) #define USART_IT_ERR ((u16)0x0060) #define USART_IT_ORE ((u16)0x0360) #define USART_IT_NE ((u16)0x0260) #define USART_IT_FE ((u16)0x0160) #define IS_USART_CONFIG_IT(IT) ((IT == USART_IT_PE) || (IT == USART_IT_TXE) || \ (IT == USART_IT_TC) || (IT == USART_IT_RXNE) || \ (IT == USART_IT_IDLE) || (IT == USART_IT_LBD) || \ (IT == USART_IT_CTS) || (IT == USART_IT_ERR)) #define IS_USART_IT(IT) ((IT == USART_IT_PE) || (IT == USART_IT_TXE) || \ (IT == USART_IT_TC) || (IT == USART_IT_RXNE) || \ (IT == USART_IT_IDLE) || (IT == USART_IT_LBD) || \ (IT == USART_IT_CTS) || (IT == USART_IT_ORE) || \ (IT == USART_IT_NE) || (IT == USART_IT_FE)) /* USART DMA Requests --------------------------------------------------------*/ #define USART_DMAReq_Tx ((u16)0x0080) #define USART_DMAReq_Rx ((u16)0x0040) #define IS_USART_DMAREQ(DMAREQ) (((DMAREQ & (u16)0xFF3F) == 0x00) && (DMAREQ != (u16)0x00)) /* USART WakeUp methods ------------------------------------------------------*/ #define USART_WakeUp_IdleLine ((u16)0x0000) #define USART_WakeUp_AddressMark ((u16)0x0800) #define IS_USART_WAKEUP(WAKEUP) ((WAKEUP == USART_WakeUp_IdleLine) || \ (WAKEUP == USART_WakeUp_AddressMark)) /* USART LIN Break Detection Length ------------------------------------------*/ #define USART_LINBreakDetectLength_10b ((u16)0x0000) #define USART_LINBreakDetectLength_11b ((u16)0x0020) #define IS_USART_LIN_BREAK_DETECT_LENGTH(LENGTH) \ ((LENGTH == USART_LINBreakDetectLength_10b) || \ (LENGTH == USART_LINBreakDetectLength_11b)) /* USART IrDA Low Power ------------------------------------------------------*/ #define USART_IrDAMode_LowPower ((u16)0x0004) #define USART_IrDAMode_Normal ((u16)0x0000) #define IS_USART_IRDA_MODE(MODE) ((MODE == USART_IrDAMode_LowPower) || \ (MODE == USART_IrDAMode_Normal)) /* USART Flags ---------------------------------------------------------------*/ #define USART_FLAG_CTS ((u16)0x0200) #define USART_FLAG_LBD ((u16)0x0100) #define USART_FLAG_TXE ((u16)0x0080) #define USART_FLAG_TC ((u16)0x0040) #define USART_FLAG_RXNE ((u16)0x0020) #define USART_FLAG_IDLE ((u16)0x0010) #define USART_FLAG_ORE ((u16)0x0008) #define USART_FLAG_NE ((u16)0x0004) #define USART_FLAG_FE ((u16)0x0002) #define USART_FLAG_PE ((u16)0x0001) #define IS_USART_FLAG(FLAG) ((FLAG == USART_FLAG_PE) || (FLAG == USART_FLAG_TXE) || \ (FLAG == USART_FLAG_TC) || (FLAG == USART_FLAG_RXNE) || \ (FLAG == USART_FLAG_IDLE) || (FLAG == USART_FLAG_LBD) || \ (FLAG == USART_FLAG_CTS) || (FLAG == USART_FLAG_ORE) || \ (FLAG == USART_FLAG_NE) || (FLAG == USART_FLAG_FE)) #define IS_USART_CLEAR_FLAG(FLAG) (((FLAG & (u16)0xFC00) == 0x00) && (FLAG != (u16)0x00)) #define IS_USART_ADDRESS(ADDRESS) (ADDRESS <= 0xF) #define IS_USART_DATA(DATA) (DATA <= 0x1FF) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void USART_DeInit(USART_TypeDef* USARTx); void USART_Init(USART_TypeDef* USARTx, USART_InitTypeDef* USART_InitStruct); void USART_StructInit(USART_InitTypeDef* USART_InitStruct); void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_ITConfig(USART_TypeDef* USARTx, u16 USART_IT, FunctionalState NewState); void USART_DMACmd(USART_TypeDef* USARTx, u16 USART_DMAReq, FunctionalState NewState); void USART_SetAddress(USART_TypeDef* USARTx, u8 USART_Address); void USART_WakeUpConfig(USART_TypeDef* USARTx, u16 USART_WakeUp); void USART_ReceiverWakeUpCmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_LINBreakDetectLengthConfig(USART_TypeDef* USARTx, u16 USART_LINBreakDetectLength); void USART_LINCmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_SendData(USART_TypeDef* USARTx, u16 Data); u16 USART_ReceiveData(USART_TypeDef* USARTx); void USART_SendBreak(USART_TypeDef* USARTx); void USART_SetGuardTime(USART_TypeDef* USARTx, u8 USART_GuardTime); void USART_SetPrescaler(USART_TypeDef* USARTx, u8 USART_Prescaler); void USART_SmartCardCmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_SmartCardNACKCmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_HalfDuplexCmd(USART_TypeDef* USARTx, FunctionalState NewState); void USART_IrDAConfig(USART_TypeDef* USARTx, u16 USART_IrDAMode); void USART_IrDACmd(USART_TypeDef* USARTx, FunctionalState NewState); FlagStatus USART_GetFlagStatus(USART_TypeDef* USARTx, u16 USART_FLAG); void USART_ClearFlag(USART_TypeDef* USARTx, u16 USART_FLAG); ITStatus USART_GetITStatus(USART_TypeDef* USARTx, u16 USART_IT); void USART_ClearITPendingBit(USART_TypeDef* USARTx, u16 USART_IT); #endif /* __STM32F10x_USART_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_usart.h
C
oos
11,745
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_tim1.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * TIM1 firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * mm/dd/yyyy: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_TIM1_H #define __STM32F10x_TIM1_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* TIM1 Time Base Init structure definition */ typedef struct { u16 TIM1_Prescaler; u16 TIM1_CounterMode; u16 TIM1_Period; u16 TIM1_ClockDivision; u8 TIM1_RepetitionCounter; } TIM1_TimeBaseInitTypeDef; /* TIM1 Output Compare Init structure definition */ typedef struct { u16 TIM1_OCMode; u16 TIM1_OutputState; u16 TIM1_OutputNState; u16 TIM1_Pulse; u16 TIM1_OCPolarity; u16 TIM1_OCNPolarity; u16 TIM1_OCIdleState; u16 TIM1_OCNIdleState; } TIM1_OCInitTypeDef; /* TIM1 Input Capture Init structure definition */ typedef struct { u16 TIM1_Channel; u16 TIM1_ICPolarity; u16 TIM1_ICSelection; u16 TIM1_ICPrescaler; u8 TIM1_ICFilter; } TIM1_ICInitTypeDef; /* BDTR structure definition */ typedef struct { u16 TIM1_OSSRState; u16 TIM1_OSSIState; u16 TIM1_LOCKLevel; u16 TIM1_DeadTime; u16 TIM1_Break; u16 TIM1_BreakPolarity; u16 TIM1_AutomaticOutput; } TIM1_BDTRInitTypeDef; /* Exported constants --------------------------------------------------------*/ /* TIM1 Output Compare and PWM modes ----------------------------------------*/ #define TIM1_OCMode_Timing ((u16)0x0000) #define TIM1_OCMode_Active ((u16)0x0010) #define TIM1_OCMode_Inactive ((u16)0x0020) #define TIM1_OCMode_Toggle ((u16)0x0030) #define TIM1_OCMode_PWM1 ((u16)0x0060) #define TIM1_OCMode_PWM2 ((u16)0x0070) #define IS_TIM1_OC_MODE(MODE) ((MODE == TIM1_OCMode_Timing) || \ (MODE == TIM1_OCMode_Active) || \ (MODE == TIM1_OCMode_Inactive) || \ (MODE == TIM1_OCMode_Toggle)|| \ (MODE == TIM1_OCMode_PWM1) || \ (MODE == TIM1_OCMode_PWM2)) #define IS_TIM1_OCM(MODE)((MODE == TIM1_OCMode_Timing) || \ (MODE == TIM1_OCMode_Active) || \ (MODE == TIM1_OCMode_Inactive) || \ (MODE == TIM1_OCMode_Toggle)|| \ (MODE == TIM1_OCMode_PWM1) || \ (MODE == TIM1_OCMode_PWM2) || \ (MODE == TIM1_ForcedAction_Active) || \ (MODE == TIM1_ForcedAction_InActive)) /* TIM1 One Pulse Mode ------------------------------------------------------*/ #define TIM1_OPMode_Single ((u16)0x0001) #define TIM1_OPMode_Repetitive ((u16)0x0000) #define IS_TIM1_OPM_MODE(MODE) ((MODE == TIM1_OPMode_Single) || \ (MODE == TIM1_OPMode_Repetitive)) /* TIM1 Channel -------------------------------------------------------------*/ #define TIM1_Channel_1 ((u16)0x0000) #define TIM1_Channel_2 ((u16)0x0001) #define TIM1_Channel_3 ((u16)0x0002) #define TIM1_Channel_4 ((u16)0x0003) #define IS_TIM1_CHANNEL(CHANNEL) ((CHANNEL == TIM1_Channel_1) || \ (CHANNEL == TIM1_Channel_2) || \ (CHANNEL == TIM1_Channel_3) || \ (CHANNEL == TIM1_Channel_4)) #define IS_TIM1_PWMI_CHANNEL(CHANNEL) ((CHANNEL == TIM1_Channel_1) || \ (CHANNEL == TIM1_Channel_2)) #define IS_TIM1_COMPLEMENTARY_CHANNEL(CHANNEL) ((CHANNEL == TIM1_Channel_1) || \ (CHANNEL == TIM1_Channel_2) || \ (CHANNEL == TIM1_Channel_3)) /* TIM1 Clock Division CKD --------------------------------------------------*/ #define TIM1_CKD_DIV1 ((u16)0x0000) #define TIM1_CKD_DIV2 ((u16)0x0100) #define TIM1_CKD_DIV4 ((u16)0x0200) #define IS_TIM1_CKD_DIV(DIV) ((DIV == TIM1_CKD_DIV1) || \ (DIV == TIM1_CKD_DIV2) || \ (DIV == TIM1_CKD_DIV4)) /* TIM1 Counter Mode --------------------------------------------------------*/ #define TIM1_CounterMode_Up ((u16)0x0000) #define TIM1_CounterMode_Down ((u16)0x0010) #define TIM1_CounterMode_CenterAligned1 ((u16)0x0020) #define TIM1_CounterMode_CenterAligned2 ((u16)0x0040) #define TIM1_CounterMode_CenterAligned3 ((u16)0x0060) #define IS_TIM1_COUNTER_MODE(MODE) ((MODE == TIM1_CounterMode_Up) || \ (MODE == TIM1_CounterMode_Down) || \ (MODE == TIM1_CounterMode_CenterAligned1) || \ (MODE == TIM1_CounterMode_CenterAligned2) || \ (MODE == TIM1_CounterMode_CenterAligned3)) /* TIM1 Output Compare Polarity ---------------------------------------------*/ #define TIM1_OCPolarity_High ((u16)0x0000) #define TIM1_OCPolarity_Low ((u16)0x0001) #define IS_TIM1_OC_POLARITY(POLARITY) ((POLARITY == TIM1_OCPolarity_High) || \ (POLARITY == TIM1_OCPolarity_Low)) /* TIM1 Output Compare N Polarity -------------------------------------------*/ #define TIM1_OCNPolarity_High ((u16)0x0000) #define TIM1_OCNPolarity_Low ((u16)0x0001) #define IS_TIM1_OCN_POLARITY(POLARITY) ((POLARITY == TIM1_OCNPolarity_High) || \ (POLARITY == TIM1_OCNPolarity_Low)) /* TIM1 Output Compare states -----------------------------------------------*/ #define TIM1_OutputState_Disable ((u16)0x0000) #define TIM1_OutputState_Enable ((u16)0x0001) #define IS_TIM1_OUTPUT_STATE(STATE) ((STATE == TIM1_OutputState_Disable) || \ (STATE == TIM1_OutputState_Enable)) /* TIM1 Output Compare N States ---------------------------------------------*/ #define TIM1_OutputNState_Disable ((u16)0x0000) #define TIM1_OutputNState_Enable ((u16)0x0001) #define IS_TIM1_OUTPUTN_STATE(STATE) ((STATE == TIM1_OutputNState_Disable) || \ (STATE == TIM1_OutputNState_Enable)) /* Break Input enable/disable -----------------------------------------------*/ #define TIM1_Break_Enable ((u16)0x1000) #define TIM1_Break_Disable ((u16)0x0000) #define IS_TIM1_BREAK_STATE(STATE) ((STATE == TIM1_Break_Enable) || \ (STATE == TIM1_Break_Disable)) /* Break Polarity -----------------------------------------------------------*/ #define TIM1_BreakPolarity_Low ((u16)0x0000) #define TIM1_BreakPolarity_High ((u16)0x2000) #define IS_TIM1_BREAK_POLARITY(POLARITY) ((POLARITY == TIM1_BreakPolarity_Low) || \ (POLARITY == TIM1_BreakPolarity_High)) /* TIM1 AOE Bit Set/Reset ---------------------------------------------------*/ #define TIM1_AutomaticOutput_Enable ((u16)0x4000) #define TIM1_AutomaticOutput_Disable ((u16)0x0000) #define IS_TIM1_AUTOMATIC_OUTPUT_STATE(STATE) ((STATE == TIM1_AutomaticOutput_Enable) || \ (STATE == TIM1_AutomaticOutput_Disable)) /* Lock levels --------------------------------------------------------------*/ #define TIM1_LOCKLevel_OFF ((u16)0x0000) #define TIM1_LOCKLevel_1 ((u16)0x0100) #define TIM1_LOCKLevel_2 ((u16)0x0200) #define TIM1_LOCKLevel_3 ((u16)0x0300) #define IS_TIM1_LOCK_LEVEL(LEVEL) ((LEVEL == TIM1_LOCKLevel_OFF) || \ (LEVEL == TIM1_LOCKLevel_1) || \ (LEVEL == TIM1_LOCKLevel_2) || \ (LEVEL == TIM1_LOCKLevel_3)) /* OSSI: Off-State Selection for Idle mode states ---------------------------*/ #define TIM1_OSSIState_Enable ((u16)0x0400) #define TIM1_OSSIState_Disable ((u16)0x0000) #define IS_TIM1_OSSI_STATE(STATE) ((STATE == TIM1_OSSIState_Enable) || \ (STATE == TIM1_OSSIState_Disable)) /* OSSR: Off-State Selection for Run mode states ----------------------------*/ #define TIM1_OSSRState_Enable ((u16)0x0800) #define TIM1_OSSRState_Disable ((u16)0x0000) #define IS_TIM1_OSSR_STATE(STATE) ((STATE == TIM1_OSSRState_Enable) || \ (STATE == TIM1_OSSRState_Disable)) /* TIM1 Output Compare Idle State -------------------------------------------*/ #define TIM1_OCIdleState_Set ((u16)0x0001) #define TIM1_OCIdleState_Reset ((u16)0x0000) #define IS_TIM1_OCIDLE_STATE(STATE) ((STATE == TIM1_OCIdleState_Set) || \ (STATE == TIM1_OCIdleState_Reset)) /* TIM1 Output Compare N Idle State -----------------------------------------*/ #define TIM1_OCNIdleState_Set ((u16)0x0001) #define TIM1_OCNIdleState_Reset ((u16)0x0000) #define IS_TIM1_OCNIDLE_STATE(STATE) ((STATE == TIM1_OCNIdleState_Set) || \ (STATE == TIM1_OCNIdleState_Reset)) /* TIM1 Input Capture Polarity ----------------------------------------------*/ #define TIM1_ICPolarity_Rising ((u16)0x0000) #define TIM1_ICPolarity_Falling ((u16)0x0001) #define IS_TIM1_IC_POLARITY(POLARITY) ((POLARITY == TIM1_ICPolarity_Rising) || \ (POLARITY == TIM1_ICPolarity_Falling)) /* TIM1 Input Capture Selection ---------------------------------------------*/ #define TIM1_ICSelection_DirectTI ((u16)0x0001) #define TIM1_ICSelection_IndirectTI ((u16)0x0002) #define TIM1_ICSelection_TRGI ((u16)0x0003) #define IS_TIM1_IC_SELECTION(SELECTION) ((SELECTION == TIM1_ICSelection_DirectTI) || \ (SELECTION == TIM1_ICSelection_IndirectTI) || \ (SELECTION == TIM1_ICSelection_TRGI)) /* TIM1 Input Capture Prescaler ---------------------------------------------*/ #define TIM1_ICPSC_DIV1 ((u16)0x0000) #define TIM1_ICPSC_DIV2 ((u16)0x0004) #define TIM1_ICPSC_DIV4 ((u16)0x0008) #define TIM1_ICPSC_DIV8 ((u16)0x000C) #define IS_TIM1_IC_PRESCALER(PRESCALER) ((PRESCALER == TIM1_ICPSC_DIV1) || \ (PRESCALER == TIM1_ICPSC_DIV2) || \ (PRESCALER == TIM1_ICPSC_DIV4) || \ (PRESCALER == TIM1_ICPSC_DIV8)) /* TIM1 Input Capture Filer Value ---------------------------------------------*/ #define IS_TIM1_IC_FILTER(ICFILTER) (ICFILTER <= 0xF) /* TIM1 interrupt sources ---------------------------------------------------*/ #define TIM1_IT_Update ((u16)0x0001) #define TIM1_IT_CC1 ((u16)0x0002) #define TIM1_IT_CC2 ((u16)0x0004) #define TIM1_IT_CC3 ((u16)0x0008) #define TIM1_IT_CC4 ((u16)0x0010) #define TIM1_IT_COM ((u16)0x0020) #define TIM1_IT_Trigger ((u16)0x0040) #define TIM1_IT_Break ((u16)0x0080) #define IS_TIM1_IT(IT) (((IT & (u16)0xFF00) == 0x0000) && (IT != 0x0000)) #define IS_TIM1_GET_IT(IT) ((IT == TIM1_IT_Update) || \ (IT == TIM1_IT_CC1) || \ (IT == TIM1_IT_CC2) || \ (IT == TIM1_IT_CC3) || \ (IT == TIM1_IT_CC4) || \ (IT == TIM1_IT_COM) || \ (IT == TIM1_IT_Trigger) || \ (IT == TIM1_IT_Break)) /* TIM1 DMA Base address ----------------------------------------------------*/ #define TIM1_DMABase_CR1 ((u16)0x0000) #define TIM1_DMABase_CR2 ((u16)0x0001) #define TIM1_DMABase_SMCR ((u16)0x0002) #define TIM1_DMABase_DIER ((u16)0x0003) #define TIM1_DMABase_SR ((u16)0x0004) #define TIM1_DMABase_EGR ((u16)0x0005) #define TIM1_DMABase_CCMR1 ((u16)0x0006) #define TIM1_DMABase_CCMR2 ((u16)0x0007) #define TIM1_DMABase_CCER ((u16)0x0008) #define TIM1_DMABase_CNT ((u16)0x0009) #define TIM1_DMABase_PSC ((u16)0x000A) #define TIM1_DMABase_ARR ((u16)0x000B) #define TIM1_DMABase_RCR ((u16)0x000C) #define TIM1_DMABase_CCR1 ((u16)0x000D) #define TIM1_DMABase_CCR2 ((u16)0x000E) #define TIM1_DMABase_CCR3 ((u16)0x000F) #define TIM1_DMABase_CCR4 ((u16)0x0010) #define TIM1_DMABase_BDTR ((u16)0x0011) #define TIM1_DMABase_DCR ((u16)0x0012) #define IS_TIM1_DMA_BASE(BASE) ((BASE == TIM1_DMABase_CR1) || \ (BASE == TIM1_DMABase_CR2) || \ (BASE == TIM1_DMABase_SMCR) || \ (BASE == TIM1_DMABase_DIER) || \ (BASE == TIM1_DMABase_SR) || \ (BASE == TIM1_DMABase_EGR) || \ (BASE == TIM1_DMABase_CCMR1) || \ (BASE == TIM1_DMABase_CCMR2) || \ (BASE == TIM1_DMABase_CCER) || \ (BASE == TIM1_DMABase_CNT) || \ (BASE == TIM1_DMABase_PSC) || \ (BASE == TIM1_DMABase_ARR) || \ (BASE == TIM1_DMABase_RCR) || \ (BASE == TIM1_DMABase_CCR1) || \ (BASE == TIM1_DMABase_CCR2) || \ (BASE == TIM1_DMABase_CCR3) || \ (BASE == TIM1_DMABase_CCR4) || \ (BASE == TIM1_DMABase_BDTR) || \ (BASE == TIM1_DMABase_DCR)) /* TIM1 DMA Burst Length ----------------------------------------------------*/ #define TIM1_DMABurstLength_1Byte ((u16)0x0000) #define TIM1_DMABurstLength_2Bytes ((u16)0x0100) #define TIM1_DMABurstLength_3Bytes ((u16)0x0200) #define TIM1_DMABurstLength_4Bytes ((u16)0x0300) #define TIM1_DMABurstLength_5Bytes ((u16)0x0400) #define TIM1_DMABurstLength_6Bytes ((u16)0x0500) #define TIM1_DMABurstLength_7Bytes ((u16)0x0600) #define TIM1_DMABurstLength_8Bytes ((u16)0x0700) #define TIM1_DMABurstLength_9Bytes ((u16)0x0800) #define TIM1_DMABurstLength_10Bytes ((u16)0x0900) #define TIM1_DMABurstLength_11Bytes ((u16)0x0A00) #define TIM1_DMABurstLength_12Bytes ((u16)0x0B00) #define TIM1_DMABurstLength_13Bytes ((u16)0x0C00) #define TIM1_DMABurstLength_14Bytes ((u16)0x0D00) #define TIM1_DMABurstLength_15Bytes ((u16)0x0E00) #define TIM1_DMABurstLength_16Bytes ((u16)0x0F00) #define TIM1_DMABurstLength_17Bytes ((u16)0x1000) #define TIM1_DMABurstLength_18Bytes ((u16)0x1100) #define IS_TIM1_DMA_LENGTH(LENGTH) ((LENGTH == TIM1_DMABurstLength_1Byte) || \ (LENGTH == TIM1_DMABurstLength_2Bytes) || \ (LENGTH == TIM1_DMABurstLength_3Bytes) || \ (LENGTH == TIM1_DMABurstLength_4Bytes) || \ (LENGTH == TIM1_DMABurstLength_5Bytes) || \ (LENGTH == TIM1_DMABurstLength_6Bytes) || \ (LENGTH == TIM1_DMABurstLength_7Bytes) || \ (LENGTH == TIM1_DMABurstLength_8Bytes) || \ (LENGTH == TIM1_DMABurstLength_9Bytes) || \ (LENGTH == TIM1_DMABurstLength_10Bytes) || \ (LENGTH == TIM1_DMABurstLength_11Bytes) || \ (LENGTH == TIM1_DMABurstLength_12Bytes) || \ (LENGTH == TIM1_DMABurstLength_13Bytes) || \ (LENGTH == TIM1_DMABurstLength_14Bytes) || \ (LENGTH == TIM1_DMABurstLength_15Bytes) || \ (LENGTH == TIM1_DMABurstLength_16Bytes) || \ (LENGTH == TIM1_DMABurstLength_17Bytes) || \ (LENGTH == TIM1_DMABurstLength_18Bytes)) /* TIM1 DMA sources ---------------------------------------------------------*/ #define TIM1_DMA_Update ((u16)0x0100) #define TIM1_DMA_CC1 ((u16)0x0200) #define TIM1_DMA_CC2 ((u16)0x0400) #define TIM1_DMA_CC3 ((u16)0x0800) #define TIM1_DMA_CC4 ((u16)0x1000) #define TIM1_DMA_COM ((u16)0x2000) #define TIM1_DMA_Trigger ((u16)0x4000) #define IS_TIM1_DMA_SOURCE(SOURCE) (((SOURCE & (u16)0x80FF) == 0x0000) && (SOURCE != 0x0000)) /* TIM1 External Trigger Prescaler ------------------------------------------*/ #define TIM1_ExtTRGPSC_OFF ((u16)0x0000) #define TIM1_ExtTRGPSC_DIV2 ((u16)0x1000) #define TIM1_ExtTRGPSC_DIV4 ((u16)0x2000) #define TIM1_ExtTRGPSC_DIV8 ((u16)0x3000) #define IS_TIM1_EXT_PRESCALER(PRESCALER) ((PRESCALER == TIM1_ExtTRGPSC_OFF) || \ (PRESCALER == TIM1_ExtTRGPSC_DIV2) || \ (PRESCALER == TIM1_ExtTRGPSC_DIV4) || \ (PRESCALER == TIM1_ExtTRGPSC_DIV8)) /* TIM1 Internal Trigger Selection ------------------------------------------*/ #define TIM1_TS_ITR0 ((u16)0x0000) #define TIM1_TS_ITR1 ((u16)0x0010) #define TIM1_TS_ITR2 ((u16)0x0020) #define TIM1_TS_ITR3 ((u16)0x0030) #define TIM1_TS_TI1F_ED ((u16)0x0040) #define TIM1_TS_TI1FP1 ((u16)0x0050) #define TIM1_TS_TI2FP2 ((u16)0x0060) #define TIM1_TS_ETRF ((u16)0x0070) #define IS_TIM1_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM1_TS_ITR0) || \ (SELECTION == TIM1_TS_ITR1) || \ (SELECTION == TIM1_TS_ITR2) || \ (SELECTION == TIM1_TS_ITR3) || \ (SELECTION == TIM1_TS_TI1F_ED) || \ (SELECTION == TIM1_TS_TI1FP1) || \ (SELECTION == TIM1_TS_TI2FP2) || \ (SELECTION == TIM1_TS_ETRF)) #define IS_TIM1_INTERNAL_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM1_TS_ITR0) || \ (SELECTION == TIM1_TS_ITR1) || \ (SELECTION == TIM1_TS_ITR2) || \ (SELECTION == TIM1_TS_ITR3)) #define IS_TIM1_TIX_TRIGGER_SELECTION(SELECTION) ((SELECTION == TIM1_TS_TI1F_ED) || \ (SELECTION == TIM1_TS_TI1FP1) || \ (SELECTION == TIM1_TS_TI2FP2)) /* TIM1 External Trigger Polarity -------------------------------------------*/ #define TIM1_ExtTRGPolarity_Inverted ((u16)0x8000) #define TIM1_ExtTRGPolarity_NonInverted ((u16)0x0000) #define IS_TIM1_EXT_POLARITY(POLARITY) ((POLARITY == TIM1_ExtTRGPolarity_Inverted) || \ (POLARITY == TIM1_ExtTRGPolarity_NonInverted)) /* TIM1 Prescaler Reload Mode -----------------------------------------------*/ #define TIM1_PSCReloadMode_Update ((u16)0x0000) #define TIM1_PSCReloadMode_Immediate ((u16)0x0001) #define IS_TIM1_PRESCALER_RELOAD(RELOAD) ((RELOAD == TIM1_PSCReloadMode_Update) || \ (RELOAD == TIM1_PSCReloadMode_Immediate)) /* TIM1 Forced Action -------------------------------------------------------*/ #define TIM1_ForcedAction_Active ((u16)0x0050) #define TIM1_ForcedAction_InActive ((u16)0x0040) #define IS_TIM1_FORCED_ACTION(ACTION) ((ACTION == TIM1_ForcedAction_Active) || \ (ACTION == TIM1_ForcedAction_InActive)) /* TIM1 Encoder Mode --------------------------------------------------------*/ #define TIM1_EncoderMode_TI1 ((u16)0x0001) #define TIM1_EncoderMode_TI2 ((u16)0x0002) #define TIM1_EncoderMode_TI12 ((u16)0x0003) #define IS_TIM1_ENCODER_MODE(MODE) ((MODE == TIM1_EncoderMode_TI1) || \ (MODE == TIM1_EncoderMode_TI2) || \ (MODE == TIM1_EncoderMode_TI12)) /* TIM1 Event Source --------------------------------------------------------*/ #define TIM1_EventSource_Update ((u16)0x0001) #define TIM1_EventSource_CC1 ((u16)0x0002) #define TIM1_EventSource_CC2 ((u16)0x0004) #define TIM1_EventSource_CC3 ((u16)0x0008) #define TIM1_EventSource_CC4 ((u16)0x0010) #define TIM1_EventSource_COM ((u16)0x0020) #define TIM1_EventSource_Trigger ((u16)0x0040) #define TIM1_EventSource_Break ((u16)0x0080) #define IS_TIM1_EVENT_SOURCE(SOURCE) (((SOURCE & (u16)0xFF00) == 0x0000) && (SOURCE != 0x0000)) /* TIM1 Update Source -------------------------------------------------------*/ #define TIM1_UpdateSource_Global ((u16)0x0000) #define TIM1_UpdateSource_Regular ((u16)0x0001) #define IS_TIM1_UPDATE_SOURCE(SOURCE) ((SOURCE == TIM1_UpdateSource_Global) || \ (SOURCE == TIM1_UpdateSource_Regular)) /* TIM1 Ouput Compare Preload State ------------------------------------------*/ #define TIM1_OCPreload_Enable ((u16)0x0001) #define TIM1_OCPreload_Disable ((u16)0x0000) #define IS_TIM1_OCPRELOAD_STATE(STATE) ((STATE == TIM1_OCPreload_Enable) || \ (STATE == TIM1_OCPreload_Disable)) /* TIM1 Ouput Compare Fast State ---------------------------------------------*/ #define TIM1_OCFast_Enable ((u16)0x0001) #define TIM1_OCFast_Disable ((u16)0x0000) #define IS_TIM1_OCFAST_STATE(STATE) ((STATE == TIM1_OCFast_Enable) || \ (STATE == TIM1_OCFast_Disable)) /* TIM1 Trigger Output Source -----------------------------------------------*/ #define TIM1_TRGOSource_Reset ((u16)0x0000) #define TIM1_TRGOSource_Enable ((u16)0x0010) #define TIM1_TRGOSource_Update ((u16)0x0020) #define TIM1_TRGOSource_OC1 ((u16)0x0030) #define TIM1_TRGOSource_OC1Ref ((u16)0x0040) #define TIM1_TRGOSource_OC2Ref ((u16)0x0050) #define TIM1_TRGOSource_OC3Ref ((u16)0x0060) #define TIM1_TRGOSource_OC4Ref ((u16)0x0070) #define IS_TIM1_TRGO_SOURCE(SOURCE) ((SOURCE == TIM1_TRGOSource_Reset) || \ (SOURCE == TIM1_TRGOSource_Enable) || \ (SOURCE == TIM1_TRGOSource_Update) || \ (SOURCE == TIM1_TRGOSource_OC1) || \ (SOURCE == TIM1_TRGOSource_OC1Ref) || \ (SOURCE == TIM1_TRGOSource_OC2Ref) || \ (SOURCE == TIM1_TRGOSource_OC3Ref) || \ (SOURCE == TIM1_TRGOSource_OC4Ref)) /* TIM1 Slave Mode ----------------------------------------------------------*/ #define TIM1_SlaveMode_Reset ((u16)0x0004) #define TIM1_SlaveMode_Gated ((u16)0x0005) #define TIM1_SlaveMode_Trigger ((u16)0x0006) #define TIM1_SlaveMode_External1 ((u16)0x0007) #define IS_TIM1_SLAVE_MODE(MODE) ((MODE == TIM1_SlaveMode_Reset) || \ (MODE == TIM1_SlaveMode_Gated) || \ (MODE == TIM1_SlaveMode_Trigger) || \ (MODE == TIM1_SlaveMode_External1)) /* TIM1 TIx External Clock Source -------------------------------------------*/ #define TIM1_TIxExternalCLK1Source_TI1 ((u16)0x0050) #define TIM1_TIxExternalCLK1Source_TI2 ((u16)0x0060) #define TIM1_TIxExternalCLK1Source_TI1ED ((u16)0x0040) #define IS_TIM1_TIXCLK_SOURCE(SOURCE) ((SOURCE == TIM1_TIxExternalCLK1Source_TI1) || \ (SOURCE == TIM1_TIxExternalCLK1Source_TI2) || \ (SOURCE == TIM1_TIxExternalCLK1Source_TI1ED)) /* TIM1 Master Slave Mode ---------------------------------------------------*/ #define TIM1_MasterSlaveMode_Enable ((u16)0x0001) #define TIM1_MasterSlaveMode_Disable ((u16)0x0000) #define IS_TIM1_MSM_STATE(STATE) ((STATE == TIM1_MasterSlaveMode_Enable) || \ (STATE == TIM1_MasterSlaveMode_Disable)) /* TIM1 Flags ---------------------------------------------------------------*/ #define TIM1_FLAG_Update ((u16)0x0001) #define TIM1_FLAG_CC1 ((u16)0x0002) #define TIM1_FLAG_CC2 ((u16)0x0004) #define TIM1_FLAG_CC3 ((u16)0x0008) #define TIM1_FLAG_CC4 ((u16)0x0010) #define TIM1_FLAG_COM ((u16)0x0020) #define TIM1_FLAG_Trigger ((u16)0x0040) #define TIM1_FLAG_Break ((u16)0x0080) #define TIM1_FLAG_CC1OF ((u16)0x0200) #define TIM1_FLAG_CC2OF ((u16)0x0400) #define TIM1_FLAG_CC3OF ((u16)0x0800) #define TIM1_FLAG_CC4OF ((u16)0x1000) #define IS_TIM1_GET_FLAG(FLAG) ((FLAG == TIM1_FLAG_Update) || \ (FLAG == TIM1_FLAG_CC1) || \ (FLAG == TIM1_FLAG_CC2) || \ (FLAG == TIM1_FLAG_CC3) || \ (FLAG == TIM1_FLAG_CC4) || \ (FLAG == TIM1_FLAG_COM) || \ (FLAG == TIM1_FLAG_Trigger) || \ (FLAG == TIM1_FLAG_Break) || \ (FLAG == TIM1_FLAG_CC1OF) || \ (FLAG == TIM1_FLAG_CC2OF) || \ (FLAG == TIM1_FLAG_CC3OF) || \ (FLAG == TIM1_FLAG_CC4OF)) #define IS_TIM1_CLEAR_FLAG(FLAG) (((FLAG & (u16)0xE100) == 0x0000) && (FLAG != 0x0000)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions --------------------------------------------------------*/ void TIM1_DeInit(void); void TIM1_TimeBaseInit(TIM1_TimeBaseInitTypeDef* TIM1_TimeBaseInitStruct); void TIM1_OC1Init(TIM1_OCInitTypeDef* TIM1_OCInitStruct); void TIM1_OC2Init(TIM1_OCInitTypeDef* TIM1_OCInitStruct); void TIM1_OC3Init(TIM1_OCInitTypeDef* TIM1_OCInitStruct); void TIM1_OC4Init(TIM1_OCInitTypeDef* TIM1_OCInitStruct); void TIM1_BDTRConfig(TIM1_BDTRInitTypeDef *TIM1_BDTRInitStruct); void TIM1_ICInit(TIM1_ICInitTypeDef* TIM1_ICInitStruct); void TIM1_PWMIConfig(TIM1_ICInitTypeDef* TIM1_ICInitStruct); void TIM1_TimeBaseStructInit(TIM1_TimeBaseInitTypeDef* TIM1_TimeBaseInitStruct); void TIM1_OCStructInit(TIM1_OCInitTypeDef* TIM1_OCInitStruct); void TIM1_ICStructInit(TIM1_ICInitTypeDef* TIM1_ICInitStruct); void TIM1_BDTRStructInit(TIM1_BDTRInitTypeDef* TIM1_BDTRInitStruct); void TIM1_Cmd(FunctionalState NewState); void TIM1_CtrlPWMOutputs(FunctionalState Newstate); void TIM1_ITConfig(u16 TIM1_IT, FunctionalState NewState); void TIM1_DMAConfig(u16 TIM1_DMABase, u16 TIM1_DMABurstLength); void TIM1_DMACmd(u16 TIM1_DMASource, FunctionalState Newstate); void TIM1_InternalClockConfig(void); void TIM1_ETRClockMode1Config(u16 TIM1_ExtTRGPrescaler, u16 TIM1_ExtTRGPolarity, u16 ExtTRGFilter); void TIM1_ETRClockMode2Config(u16 TIM1_ExtTRGPrescaler, u16 TIM1_ExtTRGPolarity, u16 ExtTRGFilter); void TIM1_ITRxExternalClockConfig(u16 TIM1_InputTriggerSource); void TIM1_TIxExternalClockConfig(u16 TIM1_TIxExternalCLKSource, u16 TIM1_ICPolarity, u8 ICFilter); void TIM1_SelectInputTrigger(u16 TIM1_InputTriggerSource); void TIM1_UpdateDisableConfig(FunctionalState Newstate); void TIM1_UpdateRequestConfig(u8 TIM1_UpdateSource); void TIM1_SelectHallSensor(FunctionalState Newstate); void TIM1_SelectOnePulseMode(u16 TIM1_OPMode); void TIM1_SelectOutputTrigger(u16 TIM1_TRGOSource); void TIM1_SelectSlaveMode(u16 TIM1_SlaveMode); void TIM1_SelectMasterSlaveMode(u16 TIM1_MasterSlaveMode); void TIM1_EncoderInterfaceConfig(u16 TIM1_EncoderMode, u16 TIM1_IC1Polarity, u16 TIM1_IC2Polarity); void TIM1_PrescalerConfig(u16 Prescaler, u16 TIM1_PSCReloadMode); void TIM1_CounterModeConfig(u16 TIM1_CounterMode); void TIM1_ForcedOC1Config(u16 TIM1_ForcedAction); void TIM1_ForcedOC2Config(u16 TIM1_ForcedAction); void TIM1_ForcedOC3Config(u16 TIM1_ForcedAction); void TIM1_ForcedOC4Config(u16 TIM1_ForcedAction); void TIM1_ARRPreloadConfig(FunctionalState Newstate); void TIM1_SelectCOM(FunctionalState Newstate); void TIM1_SelectCCDMA(FunctionalState Newstate); void TIM1_CCPreloadControl(FunctionalState Newstate); void TIM1_OC1PreloadConfig(u16 TIM1_OCPreload); void TIM1_OC2PreloadConfig(u16 TIM1_OCPreload); void TIM1_OC3PreloadConfig(u16 TIM1_OCPreload); void TIM1_OC4PreloadConfig(u16 TIM1_OCPreload); void TIM1_OC1FastConfig(u16 TIM1_OCFast); void TIM1_OC2FastConfig(u16 TIM1_OCFast); void TIM1_OC3FastConfig(u16 TIM1_OCFast); void TIM1_OC4FastConfig(u16 TIM1_OCFast); void TIM1_GenerateEvent(u16 TIM1_EventSource); void TIM1_OC1PolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC1NPolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC2PolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC2NPolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC3PolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC3NPolarityConfig(u16 TIM1_OCPolarity); void TIM1_OC4PolarityConfig(u16 TIM1_OCPolarity); void TIM1_CCxCmd(u16 TIM1_Channel, FunctionalState Newstate); void TIM1_CCxNCmd(u16 TIM1_Channel, FunctionalState Newstate); void TIM1_SelectOCxM(u16 TIM1_Channel, u16 TIM1_OCMode); void TIM1_SetAutoreload(u16 Autoreload); void TIM1_SetCompare1(u16 Compare1); void TIM1_SetCompare2(u16 Compare2); void TIM1_SetCompare3(u16 Compare3); void TIM1_SetCompare4(u16 Compare4); void TIM1_SetIC1Prescaler(u16 TIM1_IC1Prescaler); void TIM1_SetIC2Prescaler(u16 TIM1_IC2Prescaler); void TIM1_SetIC3Prescaler(u16 TIM1_IC3Prescaler); void TIM1_SetIC4Prescaler(u16 TIM1_IC4Prescaler); void TIM1_SetClockDivision(u16 TIM1_CKD); u16 TIM1_GetCapture1(void); u16 TIM1_GetCapture2(void); u16 TIM1_GetCapture3(void); u16 TIM1_GetCapture4(void); u16 TIM1_GetCounter(void); u16 TIM1_GetPrescaler(void); FlagStatus TIM1_GetFlagStatus(u16 TIM1_FLAG); void TIM1_ClearFlag(u16 TIM1_Flag); ITStatus TIM1_GetITStatus(u16 TIM1_IT); void TIM1_ClearITPendingBit(u16 TIM1_IT); #endif /*__STM32F10x_TIM1_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_tim1.h
C
oos
34,043
/** ****************************************************************************** * @file stm32f10x_fsmc.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the FSMC * firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_FSMC_H #define __STM32F10x_FSMC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup FSMC * @{ */ /** @defgroup FSMC_Exported_Types * @{ */ /** * @brief Timing parameters For NOR/SRAM Banks */ typedef struct { uint32_t FSMC_AddressSetupTime; uint32_t FSMC_AddressHoldTime; uint32_t FSMC_DataSetupTime; uint32_t FSMC_BusTurnAroundDuration; uint32_t FSMC_CLKDivision; uint32_t FSMC_DataLatency; uint32_t FSMC_AccessMode; }FSMC_NORSRAMTimingInitTypeDef; /** * @brief FSMC NOR/SRAM Init structure definition */ typedef struct { uint32_t FSMC_Bank; uint32_t FSMC_DataAddressMux; uint32_t FSMC_MemoryType; uint32_t FSMC_MemoryDataWidth; uint32_t FSMC_BurstAccessMode; uint32_t FSMC_WaitSignalPolarity; uint32_t FSMC_WrapMode; uint32_t FSMC_WaitSignalActive; uint32_t FSMC_WriteOperation; uint32_t FSMC_WaitSignal; uint32_t FSMC_ExtendedMode; uint32_t FSMC_WriteBurst; FSMC_NORSRAMTimingInitTypeDef* FSMC_ReadWriteTimingStruct;/* Timing Parameters for write and read access if the ExtendedMode is not used*/ FSMC_NORSRAMTimingInitTypeDef* FSMC_WriteTimingStruct;/* Timing Parameters for write access if the ExtendedMode is used*/ }FSMC_NORSRAMInitTypeDef; /** * @brief Timing parameters For FSMC NAND and PCCARD Banks */ typedef struct { uint32_t FSMC_SetupTime; uint32_t FSMC_WaitSetupTime; uint32_t FSMC_HoldSetupTime; uint32_t FSMC_HiZSetupTime; }FSMC_NAND_PCCARDTimingInitTypeDef; /** * @brief FSMC NAND Init structure definition */ typedef struct { uint32_t FSMC_Bank; uint32_t FSMC_Waitfeature; uint32_t FSMC_MemoryDataWidth; uint32_t FSMC_ECC; uint32_t FSMC_ECCPageSize; uint32_t FSMC_TCLRSetupTime; uint32_t FSMC_TARSetupTime; FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct;/* FSMC Common Space Timing */ FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct;/* FSMC Attribute Space Timing */ }FSMC_NANDInitTypeDef; /** * @brief FSMC PCCARD Init structure definition */ typedef struct { uint32_t FSMC_Waitfeature; uint32_t FSMC_TCLRSetupTime; uint32_t FSMC_TARSetupTime; FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_CommonSpaceTimingStruct;/* FSMC Common Space Timing */ FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_AttributeSpaceTimingStruct; /* FSMC Attribute Space Timing */ FSMC_NAND_PCCARDTimingInitTypeDef* FSMC_IOSpaceTimingStruct; /* FSMC IO Space Timing */ }FSMC_PCCARDInitTypeDef; /** * @} */ /** @defgroup FSMC_Exported_Constants * @{ */ /** @defgroup FSMC_Banks_definitions * @{ */ #define FSMC_Bank1_NORSRAM1 ((uint32_t)0x00000000) #define FSMC_Bank1_NORSRAM2 ((uint32_t)0x00000002) #define FSMC_Bank1_NORSRAM3 ((uint32_t)0x00000004) #define FSMC_Bank1_NORSRAM4 ((uint32_t)0x00000006) #define FSMC_Bank2_NAND ((uint32_t)0x00000010) #define FSMC_Bank3_NAND ((uint32_t)0x00000100) #define FSMC_Bank4_PCCARD ((uint32_t)0x00001000) #define IS_FSMC_NORSRAM_BANK(BANK) (((BANK) == FSMC_Bank1_NORSRAM1) || \ ((BANK) == FSMC_Bank1_NORSRAM2) || \ ((BANK) == FSMC_Bank1_NORSRAM3) || \ ((BANK) == FSMC_Bank1_NORSRAM4)) #define IS_FSMC_NAND_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \ ((BANK) == FSMC_Bank3_NAND)) #define IS_FSMC_GETFLAG_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \ ((BANK) == FSMC_Bank3_NAND) || \ ((BANK) == FSMC_Bank4_PCCARD)) #define IS_FSMC_IT_BANK(BANK) (((BANK) == FSMC_Bank2_NAND) || \ ((BANK) == FSMC_Bank3_NAND) || \ ((BANK) == FSMC_Bank4_PCCARD)) /** * @} */ /** @defgroup NOR_SRAM_Banks * @{ */ /** @defgroup FSMC_Data_Address_Bus_Multiplexing * @{ */ #define FSMC_DataAddressMux_Disable ((uint32_t)0x00000000) #define FSMC_DataAddressMux_Enable ((uint32_t)0x00000002) #define IS_FSMC_MUX(MUX) (((MUX) == FSMC_DataAddressMux_Disable) || \ ((MUX) == FSMC_DataAddressMux_Enable)) /** * @} */ /** @defgroup FSMC_Memory_Type * @{ */ #define FSMC_MemoryType_SRAM ((uint32_t)0x00000000) #define FSMC_MemoryType_PSRAM ((uint32_t)0x00000004) #define FSMC_MemoryType_NOR ((uint32_t)0x00000008) #define IS_FSMC_MEMORY(MEMORY) (((MEMORY) == FSMC_MemoryType_SRAM) || \ ((MEMORY) == FSMC_MemoryType_PSRAM)|| \ ((MEMORY) == FSMC_MemoryType_NOR)) /** * @} */ /** @defgroup FSMC_Data_Width * @{ */ #define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000) #define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010) #define IS_FSMC_MEMORY_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \ ((WIDTH) == FSMC_MemoryDataWidth_16b)) /** * @} */ /** @defgroup FSMC_Burst_Access_Mode * @{ */ #define FSMC_BurstAccessMode_Disable ((uint32_t)0x00000000) #define FSMC_BurstAccessMode_Enable ((uint32_t)0x00000100) #define IS_FSMC_BURSTMODE(STATE) (((STATE) == FSMC_BurstAccessMode_Disable) || \ ((STATE) == FSMC_BurstAccessMode_Enable)) /** * @} */ /** @defgroup FSMC_Wait_Signal_Polarity * @{ */ #define FSMC_WaitSignalPolarity_Low ((uint32_t)0x00000000) #define FSMC_WaitSignalPolarity_High ((uint32_t)0x00000200) #define IS_FSMC_WAIT_POLARITY(POLARITY) (((POLARITY) == FSMC_WaitSignalPolarity_Low) || \ ((POLARITY) == FSMC_WaitSignalPolarity_High)) /** * @} */ /** @defgroup FSMC_Wrap_Mode * @{ */ #define FSMC_WrapMode_Disable ((uint32_t)0x00000000) #define FSMC_WrapMode_Enable ((uint32_t)0x00000400) #define IS_FSMC_WRAP_MODE(MODE) (((MODE) == FSMC_WrapMode_Disable) || \ ((MODE) == FSMC_WrapMode_Enable)) /** * @} */ /** @defgroup FSMC_Wait_Timing * @{ */ #define FSMC_WaitSignalActive_BeforeWaitState ((uint32_t)0x00000000) #define FSMC_WaitSignalActive_DuringWaitState ((uint32_t)0x00000800) #define IS_FSMC_WAIT_SIGNAL_ACTIVE(ACTIVE) (((ACTIVE) == FSMC_WaitSignalActive_BeforeWaitState) || \ ((ACTIVE) == FSMC_WaitSignalActive_DuringWaitState)) /** * @} */ /** @defgroup FSMC_Write_Operation * @{ */ #define FSMC_WriteOperation_Disable ((uint32_t)0x00000000) #define FSMC_WriteOperation_Enable ((uint32_t)0x00001000) #define IS_FSMC_WRITE_OPERATION(OPERATION) (((OPERATION) == FSMC_WriteOperation_Disable) || \ ((OPERATION) == FSMC_WriteOperation_Enable)) /** * @} */ /** @defgroup FSMC_Wait_Signal * @{ */ #define FSMC_WaitSignal_Disable ((uint32_t)0x00000000) #define FSMC_WaitSignal_Enable ((uint32_t)0x00002000) #define IS_FSMC_WAITE_SIGNAL(SIGNAL) (((SIGNAL) == FSMC_WaitSignal_Disable) || \ ((SIGNAL) == FSMC_WaitSignal_Enable)) /** * @} */ /** @defgroup FSMC_Extended_Mode * @{ */ #define FSMC_ExtendedMode_Disable ((uint32_t)0x00000000) #define FSMC_ExtendedMode_Enable ((uint32_t)0x00004000) #define IS_FSMC_EXTENDED_MODE(MODE) (((MODE) == FSMC_ExtendedMode_Disable) || \ ((MODE) == FSMC_ExtendedMode_Enable)) /** * @} */ /** @defgroup FSMC_Write_Burst * @{ */ #define FSMC_WriteBurst_Disable ((uint32_t)0x00000000) #define FSMC_WriteBurst_Enable ((uint32_t)0x00080000) #define IS_FSMC_WRITE_BURST(BURST) (((BURST) == FSMC_WriteBurst_Disable) || \ ((BURST) == FSMC_WriteBurst_Enable)) /** * @} */ /** @defgroup FSMC_Address_Setup_Time * @{ */ #define IS_FSMC_ADDRESS_SETUP_TIME(TIME) ((TIME) <= 0xF) /** * @} */ /** @defgroup FSMC_Address_Hold_Time * @{ */ #define IS_FSMC_ADDRESS_HOLD_TIME(TIME) ((TIME) <= 0xF) /** * @} */ /** @defgroup FSMC_Data_Setup_Time * @{ */ #define IS_FSMC_DATASETUP_TIME(TIME) (((TIME) > 0) && ((TIME) <= 0xFF)) /** * @} */ /** @defgroup FSMC_Bus_Turn_around_Duration * @{ */ #define IS_FSMC_TURNAROUND_TIME(TIME) ((TIME) <= 0xF) /** * @} */ /** @defgroup FSMC_CLK_Division * @{ */ #define IS_FSMC_CLK_DIV(DIV) ((DIV) <= 0xF) /** * @} */ /** @defgroup FSMC_Data_Latency * @{ */ #define IS_FSMC_DATA_LATENCY(LATENCY) ((LATENCY) <= 0xF) /** * @} */ /** @defgroup FSMC_Access_Mode * @{ */ #define FSMC_AccessMode_A ((uint32_t)0x00000000) #define FSMC_AccessMode_B ((uint32_t)0x10000000) #define FSMC_AccessMode_C ((uint32_t)0x20000000) #define FSMC_AccessMode_D ((uint32_t)0x30000000) #define IS_FSMC_ACCESS_MODE(MODE) (((MODE) == FSMC_AccessMode_A) || \ ((MODE) == FSMC_AccessMode_B) || \ ((MODE) == FSMC_AccessMode_C) || \ ((MODE) == FSMC_AccessMode_D)) /** * @} */ /** * @} */ /** @defgroup NAND_and_PCCARD_Banks * @{ */ /** @defgroup FSMC_Wait_feature * @{ */ #define FSMC_Waitfeature_Disable ((uint32_t)0x00000000) #define FSMC_Waitfeature_Enable ((uint32_t)0x00000002) #define IS_FSMC_WAIT_FEATURE(FEATURE) (((FEATURE) == FSMC_Waitfeature_Disable) || \ ((FEATURE) == FSMC_Waitfeature_Enable)) /** * @} */ /** @defgroup FSMC_Memory_Data_Width * @{ */ #define FSMC_MemoryDataWidth_8b ((uint32_t)0x00000000) #define FSMC_MemoryDataWidth_16b ((uint32_t)0x00000010) #define IS_FSMC_DATA_WIDTH(WIDTH) (((WIDTH) == FSMC_MemoryDataWidth_8b) || \ ((WIDTH) == FSMC_MemoryDataWidth_16b)) /** * @} */ /** @defgroup FSMC_ECC * @{ */ #define FSMC_ECC_Disable ((uint32_t)0x00000000) #define FSMC_ECC_Enable ((uint32_t)0x00000040) #define IS_FSMC_ECC_STATE(STATE) (((STATE) == FSMC_ECC_Disable) || \ ((STATE) == FSMC_ECC_Enable)) /** * @} */ /** @defgroup FSMC_ECC_Page_Size * @{ */ #define FSMC_ECCPageSize_256Bytes ((uint32_t)0x00000000) #define FSMC_ECCPageSize_512Bytes ((uint32_t)0x00020000) #define FSMC_ECCPageSize_1024Bytes ((uint32_t)0x00040000) #define FSMC_ECCPageSize_2048Bytes ((uint32_t)0x00060000) #define FSMC_ECCPageSize_4096Bytes ((uint32_t)0x00080000) #define FSMC_ECCPageSize_8192Bytes ((uint32_t)0x000A0000) #define IS_FSMC_ECCPAGE_SIZE(SIZE) (((SIZE) == FSMC_ECCPageSize_256Bytes) || \ ((SIZE) == FSMC_ECCPageSize_512Bytes) || \ ((SIZE) == FSMC_ECCPageSize_1024Bytes) || \ ((SIZE) == FSMC_ECCPageSize_2048Bytes) || \ ((SIZE) == FSMC_ECCPageSize_4096Bytes) || \ ((SIZE) == FSMC_ECCPageSize_8192Bytes)) /** * @} */ /** @defgroup FSMC_TCLR_Setup_Time * @{ */ #define IS_FSMC_TCLR_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_TAR_Setup_Time * @{ */ #define IS_FSMC_TAR_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_Setup_Time * @{ */ #define IS_FSMC_SETUP_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_Wait_Setup_Time * @{ */ #define IS_FSMC_WAIT_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_Hold_Setup_Time * @{ */ #define IS_FSMC_HOLD_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_HiZ_Setup_Time * @{ */ #define IS_FSMC_HIZ_TIME(TIME) ((TIME) <= 0xFF) /** * @} */ /** @defgroup FSMC_Interrupt_sources * @{ */ #define FSMC_IT_RisingEdge ((uint32_t)0x00000008) #define FSMC_IT_Level ((uint32_t)0x00000010) #define FSMC_IT_FallingEdge ((uint32_t)0x00000020) #define IS_FSMC_IT(IT) ((((IT) & (uint32_t)0xFFFFFFC7) == 0x00000000) && ((IT) != 0x00000000)) #define IS_FSMC_GET_IT(IT) (((IT) == FSMC_IT_RisingEdge) || \ ((IT) == FSMC_IT_Level) || \ ((IT) == FSMC_IT_FallingEdge)) /** * @} */ /** @defgroup FSMC_Flags * @{ */ #define FSMC_FLAG_RisingEdge ((uint32_t)0x00000001) #define FSMC_FLAG_Level ((uint32_t)0x00000002) #define FSMC_FLAG_FallingEdge ((uint32_t)0x00000004) #define FSMC_FLAG_FEMPT ((uint32_t)0x00000040) #define IS_FSMC_GET_FLAG(FLAG) (((FLAG) == FSMC_FLAG_RisingEdge) || \ ((FLAG) == FSMC_FLAG_Level) || \ ((FLAG) == FSMC_FLAG_FallingEdge) || \ ((FLAG) == FSMC_FLAG_FEMPT)) #define IS_FSMC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFF8) == 0x00000000) && ((FLAG) != 0x00000000)) /** * @} */ /** * @} */ /** * @} */ /** @defgroup FSMC_Exported_Macros * @{ */ /** * @} */ /** @defgroup FSMC_Exported_Functions * @{ */ void FSMC_NORSRAMDeInit(uint32_t FSMC_Bank); void FSMC_NANDDeInit(uint32_t FSMC_Bank); void FSMC_PCCARDDeInit(void); void FSMC_NORSRAMInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct); void FSMC_NANDInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct); void FSMC_PCCARDInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct); void FSMC_NORSRAMStructInit(FSMC_NORSRAMInitTypeDef* FSMC_NORSRAMInitStruct); void FSMC_NANDStructInit(FSMC_NANDInitTypeDef* FSMC_NANDInitStruct); void FSMC_PCCARDStructInit(FSMC_PCCARDInitTypeDef* FSMC_PCCARDInitStruct); void FSMC_NORSRAMCmd(uint32_t FSMC_Bank, FunctionalState NewState); void FSMC_NANDCmd(uint32_t FSMC_Bank, FunctionalState NewState); void FSMC_PCCARDCmd(FunctionalState NewState); void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState); uint32_t FSMC_GetECC(uint32_t FSMC_Bank); void FSMC_ITConfig(uint32_t FSMC_Bank, uint32_t FSMC_IT, FunctionalState NewState); FlagStatus FSMC_GetFlagStatus(uint32_t FSMC_Bank, uint32_t FSMC_FLAG); void FSMC_ClearFlag(uint32_t FSMC_Bank, uint32_t FSMC_FLAG); ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT); void FSMC_ClearITPendingBit(uint32_t FSMC_Bank, uint32_t FSMC_IT); #endif /*__STM32F10x_FSMC_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_fsmc.h
C
oos
17,276
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_gpio.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * GPIO firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_GPIO_H #define __STM32F10x_GPIO_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Output Maximum frequency selection ----------------------------------------*/ typedef enum { GPIO_Speed_10MHz = 1, GPIO_Speed_2MHz, GPIO_Speed_50MHz }GPIOSpeed_TypeDef; #define IS_GPIO_SPEED(SPEED) ((SPEED == GPIO_Speed_10MHz) || (SPEED == GPIO_Speed_2MHz) || \ (SPEED == GPIO_Speed_50MHz)) /* Configuration Mode enumeration --------------------------------------------*/ typedef enum { GPIO_Mode_AIN = 0x0, GPIO_Mode_IN_FLOATING = 0x04, GPIO_Mode_IPD = 0x28, GPIO_Mode_IPU = 0x48, GPIO_Mode_Out_OD = 0x14, GPIO_Mode_Out_PP = 0x10, GPIO_Mode_AF_OD = 0x1C, GPIO_Mode_AF_PP = 0x18 }GPIOMode_TypeDef; #define IS_GPIO_MODE(MODE) ((MODE == GPIO_Mode_AIN) || (MODE == GPIO_Mode_IN_FLOATING) || \ (MODE == GPIO_Mode_IPD) || (MODE == GPIO_Mode_IPU) || \ (MODE == GPIO_Mode_Out_OD) || (MODE == GPIO_Mode_Out_PP) || \ (MODE == GPIO_Mode_AF_OD) || (MODE == GPIO_Mode_AF_PP)) /* GPIO Init structure definition */ typedef struct { u16 GPIO_Pin; GPIOSpeed_TypeDef GPIO_Speed; GPIOMode_TypeDef GPIO_Mode; }GPIO_InitTypeDef; /* Bit_SET and Bit_RESET enumeration -----------------------------------------*/ typedef enum { Bit_RESET = 0, Bit_SET }BitAction; #define IS_GPIO_BIT_ACTION(ACTION) ((ACTION == Bit_RESET) || (ACTION == Bit_SET)) /* Exported constants --------------------------------------------------------*/ /* GPIO pins define ----------------------------------------------------------*/ #define GPIO_Pin_0 ((u16)0x0001) /* Pin 0 selected */ #define GPIO_Pin_1 ((u16)0x0002) /* Pin 1 selected */ #define GPIO_Pin_2 ((u16)0x0004) /* Pin 2 selected */ #define GPIO_Pin_3 ((u16)0x0008) /* Pin 3 selected */ #define GPIO_Pin_4 ((u16)0x0010) /* Pin 4 selected */ #define GPIO_Pin_5 ((u16)0x0020) /* Pin 5 selected */ #define GPIO_Pin_6 ((u16)0x0040) /* Pin 6 selected */ #define GPIO_Pin_7 ((u16)0x0080) /* Pin 7 selected */ #define GPIO_Pin_8 ((u16)0x0100) /* Pin 8 selected */ #define GPIO_Pin_9 ((u16)0x0200) /* Pin 9 selected */ #define GPIO_Pin_10 ((u16)0x0400) /* Pin 10 selected */ #define GPIO_Pin_11 ((u16)0x0800) /* Pin 11 selected */ #define GPIO_Pin_12 ((u16)0x1000) /* Pin 12 selected */ #define GPIO_Pin_13 ((u16)0x2000) /* Pin 13 selected */ #define GPIO_Pin_14 ((u16)0x4000) /* Pin 14 selected */ #define GPIO_Pin_15 ((u16)0x8000) /* Pin 15 selected */ #define GPIO_Pin_All ((u16)0xFFFF) /* All pins selected */ #define IS_GPIO_PIN(PIN) (((PIN & (u16)0x00) == 0x00) && (PIN != (u16)0x00)) /* GPIO Remap define ---------------------------------------------------------*/ #define GPIO_Remap_SPI1 ((u32)0x00000001) /* SPI1 Alternate Function mapping */ #define GPIO_Remap_I2C1 ((u32)0x00000002) /* I2C1 Alternate Function mapping */ #define GPIO_Remap_USART1 ((u32)0x00000004) /* USART1 Alternate Function mapping */ #define GPIO_Remap_USART2 ((u32)0x00000008) /* USART2 Alternate Function mapping */ #define GPIO_PartialRemap_USART3 ((u32)0x00140010) /* USART3 Partial Alternate Function mapping */ #define GPIO_FullRemap_USART3 ((u32)0x00140030) /* USART3 Full Alternate Function mapping */ #define GPIO_PartialRemap_TIM1 ((u32)0x00160040) /* TIM1 Partial Alternate Function mapping */ #define GPIO_FullRemap_TIM1 ((u32)0x001600C0) /* TIM1 Full Alternate Function mapping */ #define GPIO_PartialRemap1_TIM2 ((u32)0x00180100) /* TIM2 Partial1 Alternate Function mapping */ #define GPIO_PartialRemap2_TIM2 ((u32)0x00180200) /* TIM2 Partial2 Alternate Function mapping */ #define GPIO_FullRemap_TIM2 ((u32)0x00180300) /* TIM2 Full Alternate Function mapping */ #define GPIO_PartialRemap_TIM3 ((u32)0x001A0800) /* TIM3 Partial Alternate Function mapping */ #define GPIO_FullRemap_TIM3 ((u32)0x001A0C00) /* TIM3 Full Alternate Function mapping */ #define GPIO_Remap_TIM4 ((u32)0x00001000) /* TIM4 Alternate Function mapping */ #define GPIO_Remap1_CAN ((u32)0x001D2000) /* CAN Alternate Function mapping */ #define GPIO_Remap2_CAN ((u32)0x001D6000) /* CAN Alternate Function mapping */ #define GPIO_Remap_PD01 ((u32)0x00008000) /* PD01 Alternate Function mapping */ #define GPIO_Remap_SWJ_NoJTRST ((u32)0x00300100) /* Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */ #define GPIO_Remap_SWJ_JTAGDisable ((u32)0x00300200) /* JTAG-DP Disabled and SW-DP Enabled */ #define GPIO_Remap_SWJ_Disable ((u32)0x00300400) /* Full SWJ Disabled (JTAG-DP + SW-DP) */ #define IS_GPIO_REMAP(REMAP) ((REMAP == GPIO_Remap_SPI1) || (REMAP == GPIO_Remap_I2C1) || \ (REMAP == GPIO_Remap_USART1) || (REMAP == GPIO_Remap_USART2) || \ (REMAP == GPIO_PartialRemap_USART3) || (REMAP == GPIO_FullRemap_USART3) || \ (REMAP == GPIO_PartialRemap_TIM1) || (REMAP == GPIO_FullRemap_TIM1) || \ (REMAP == GPIO_PartialRemap1_TIM2) || (REMAP == GPIO_PartialRemap2_TIM2) || \ (REMAP == GPIO_FullRemap_TIM2) || (REMAP == GPIO_PartialRemap_TIM3) || \ (REMAP == GPIO_FullRemap_TIM3) || (REMAP == GPIO_Remap_TIM4) || \ (REMAP == GPIO_Remap1_CAN) || (REMAP == GPIO_Remap2_CAN) || \ (REMAP == GPIO_Remap_PD01) || (REMAP == GPIO_Remap_SWJ_NoJTRST) || \ (REMAP == GPIO_Remap_SWJ_JTAGDisable) || (REMAP == GPIO_Remap_SWJ_Disable)) /* GPIO Port Sources ---------------------------------------------------------*/ #define GPIO_PortSourceGPIOA ((u8)0x00) #define GPIO_PortSourceGPIOB ((u8)0x01) #define GPIO_PortSourceGPIOC ((u8)0x02) #define GPIO_PortSourceGPIOD ((u8)0x03) #define GPIO_PortSourceGPIOE ((u8)0x04) #define IS_GPIO_PORT_SOURCE(PORTSOURCE) ((PORTSOURCE == GPIO_PortSourceGPIOA) || \ (PORTSOURCE == GPIO_PortSourceGPIOB) || \ (PORTSOURCE == GPIO_PortSourceGPIOC) || \ (PORTSOURCE == GPIO_PortSourceGPIOD) || \ (PORTSOURCE == GPIO_PortSourceGPIOE)) /* GPIO Pin sources ----------------------------------------------------------*/ #define GPIO_PinSource0 ((u8)0x00) #define GPIO_PinSource1 ((u8)0x01) #define GPIO_PinSource2 ((u8)0x02) #define GPIO_PinSource3 ((u8)0x03) #define GPIO_PinSource4 ((u8)0x04) #define GPIO_PinSource5 ((u8)0x05) #define GPIO_PinSource6 ((u8)0x06) #define GPIO_PinSource7 ((u8)0x07) #define GPIO_PinSource8 ((u8)0x08) #define GPIO_PinSource9 ((u8)0x09) #define GPIO_PinSource10 ((u8)0x0A) #define GPIO_PinSource11 ((u8)0x0B) #define GPIO_PinSource12 ((u8)0x0C) #define GPIO_PinSource13 ((u8)0x0D) #define GPIO_PinSource14 ((u8)0x0E) #define GPIO_PinSource15 ((u8)0x0F) #define IS_GPIO_PIN_SOURCE(PINSOURCE) ((PINSOURCE == GPIO_PinSource0) || \ (PINSOURCE == GPIO_PinSource1) || \ (PINSOURCE == GPIO_PinSource2) || \ (PINSOURCE == GPIO_PinSource3) || \ (PINSOURCE == GPIO_PinSource4) || \ (PINSOURCE == GPIO_PinSource5) || \ (PINSOURCE == GPIO_PinSource6) || \ (PINSOURCE == GPIO_PinSource7) || \ (PINSOURCE == GPIO_PinSource8) || \ (PINSOURCE == GPIO_PinSource9) || \ (PINSOURCE == GPIO_PinSource10) || \ (PINSOURCE == GPIO_PinSource11) || \ (PINSOURCE == GPIO_PinSource12) || \ (PINSOURCE == GPIO_PinSource13) || \ (PINSOURCE == GPIO_PinSource14) || \ (PINSOURCE == GPIO_PinSource15)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void GPIO_DeInit(GPIO_TypeDef* GPIOx); void GPIO_AFIODeInit(void); void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct); u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin); u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx); u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin); u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx); void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal); void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal); void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin); void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource); void GPIO_EventOutputCmd(FunctionalState NewState); void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState); void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource); #endif /* __STM32F10x_GPIO_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_gpio.h
C
oos
11,530
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32fxxx_eth_lib.h * Author : MCD Application Team * Version : V2.0.2 * Date : 07/11/2008 * Description : This file includes the peripherals header files in the * user application. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32FXXX_ETH_LIB_H #define __STM32FXXX_ETH_LIB_H /* Includes ------------------------------------------------------------------*/ #include "stm32fxxx_eth_map.h" #ifdef _ETH_MAC //RP_Modif #include "ipport.h" #include "netbuf.h" #include "stm32fxxx_eth.h" #endif /*_ETH_MAC */ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void eth_debug(void); #endif /* __STM32FXXX_ETH_LIB_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32fxxx_eth_lib.h
C
oos
1,850
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_it.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains the headers of the interrupt handlers. ******************************************************************************** * History: * mm/dd/yyyy: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_IT_H #define __STM32F10x_IT_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_lib.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMIException(void); void HardFaultException(void); void MemManageException(void); void BusFaultException(void); void UsageFaultException(void); void DebugMonitor(void); void SVCHandler(void); void PendSVC(void); void SysTickHandler(void); void WWDG_IRQHandler(void); void PVD_IRQHandler(void); void TAMPER_IRQHandler(void); void RTC_IRQHandler(void); void FLASH_IRQHandler(void); void RCC_IRQHandler(void); void EXTI0_IRQHandler(void); void EXTI1_IRQHandler(void); void EXTI2_IRQHandler(void); void EXTI3_IRQHandler(void); void EXTI4_IRQHandler(void); void DMAChannel1_IRQHandler(void); void DMAChannel2_IRQHandler(void); void DMAChannel3_IRQHandler(void); void DMAChannel4_IRQHandler(void); void DMAChannel5_IRQHandler(void); void DMAChannel6_IRQHandler(void); void DMAChannel7_IRQHandler(void); void ADC_IRQHandler(void); void USB_HP_CAN_TX_IRQHandler(void); void USB_LP_CAN_RX0_IRQHandler(void); void CAN_RX1_IRQHandler(void); void CAN_SCE_IRQHandler(void); void EXTI9_5_IRQHandler(void); void TIM1_BRK_IRQHandler(void); void TIM1_UP_IRQHandler(void); void TIM1_TRG_COM_IRQHandler(void); void TIM1_CC_IRQHandler(void); void TIM2_IRQHandler(void); void TIM3_IRQHandler(void); void TIM4_IRQHandler(void); void I2C1_EV_IRQHandler(void); void I2C1_ER_IRQHandler(void); void I2C2_EV_IRQHandler(void); void I2C2_ER_IRQHandler(void); void SPI1_IRQHandler(void); void SPI2_IRQHandler(void); void USART1_IRQHandler(void); void USART2_IRQHandler(void); void USART3_IRQHandler(void); void EXTI15_10_IRQHandler(void); void RTCAlarm_IRQHandler(void); void USBWakeUp_IRQHandler(void); #endif /* __STM32F10x_IT_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_it.h
C
oos
3,378
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_map.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the peripheral register's definitions * and memory mapping. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_MAP_H #define __STM32F10x_MAP_H #ifndef EXT #define EXT extern #endif /* EXT */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_conf.h" #include "stm32f10x_type.h" #include "cortexm3_macro.h" /* Exported types ------------------------------------------------------------*/ /******************************************************************************/ /* IP registers structures */ /******************************************************************************/ /*------------------------ Analog to Digital Converter -----------------------*/ typedef struct { vu32 SR; vu32 CR1; vu32 CR2; vu32 SMPR1; vu32 SMPR2; vu32 JOFR1; vu32 JOFR2; vu32 JOFR3; vu32 JOFR4; vu32 HTR; vu32 LTR; vu32 SQR1; vu32 SQR2; vu32 SQR3; vu32 JSQR; vu32 JDR1; vu32 JDR2; vu32 JDR3; vu32 JDR4; vu32 DR; } ADC_TypeDef; /*------------------------ Backup Registers ----------------------------------*/ typedef struct { u32 RESERVED0; vu16 DR1; u16 RESERVED1; vu16 DR2; u16 RESERVED2; vu16 DR3; u16 RESERVED3; vu16 DR4; u16 RESERVED4; vu16 DR5; u16 RESERVED5; vu16 DR6; u16 RESERVED6; vu16 DR7; u16 RESERVED7; vu16 DR8; u16 RESERVED8; vu16 DR9; u16 RESERVED9; vu16 DR10; u16 RESERVED10; vu16 RTCCR; u16 RESERVED11; vu16 CR; u16 RESERVED12; vu16 CSR; u16 RESERVED13; } BKP_TypeDef; /*------------------------ Controller Area Network ---------------------------*/ typedef struct { vu32 TIR; vu32 TDTR; vu32 TDLR; vu32 TDHR; } CAN_TxMailBox_TypeDef; typedef struct { vu32 RIR; vu32 RDTR; vu32 RDLR; vu32 RDHR; } CAN_FIFOMailBox_TypeDef; typedef struct { vu32 FR0; vu32 FR1; } CAN_FilterRegister_TypeDef; typedef struct { vu32 MCR; vu32 MSR; vu32 TSR; vu32 RF0R; vu32 RF1R; vu32 IER; vu32 ESR; vu32 BTR; u32 RESERVED0[88]; CAN_TxMailBox_TypeDef sTxMailBox[3]; CAN_FIFOMailBox_TypeDef sFIFOMailBox[2]; u32 RESERVED1[12]; vu32 FMR; vu32 FM0R; u32 RESERVED2[1]; vu32 FS0R; u32 RESERVED3[1]; vu32 FFA0R; u32 RESERVED4[1]; vu32 FA0R; u32 RESERVED5[8]; CAN_FilterRegister_TypeDef sFilterRegister[14]; } CAN_TypeDef; /*------------------------ DMA Controller ------------------------------------*/ typedef struct { vu32 CCR; vu32 CNDTR; vu32 CPAR; vu32 CMAR; } DMA_Channel_TypeDef; typedef struct { vu32 ISR; vu32 IFCR; } DMA_TypeDef; /*------------------------ External Interrupt/Event Controller ---------------*/ typedef struct { vu32 IMR; vu32 EMR; vu32 RTSR; vu32 FTSR; vu32 SWIER; vu32 PR; } EXTI_TypeDef; /*------------------------ FLASH and Option Bytes Registers ------------------*/ typedef struct { vu32 ACR; vu32 KEYR; vu32 OPTKEYR; vu32 SR; vu32 CR; vu32 AR; vu32 RESERVED; vu32 OBR; vu32 WRPR; } FLASH_TypeDef; typedef struct { vu16 RDP; vu16 USER; vu16 Data0; vu16 Data1; vu16 WRP0; vu16 WRP1; vu16 WRP2; vu16 WRP3; } OB_TypeDef; /*------------------------ General Purpose and Alternate Function IO ---------*/ typedef struct { vu32 CRL; vu32 CRH; vu32 IDR; vu32 ODR; vu32 BSRR; vu32 BRR; vu32 LCKR; } GPIO_TypeDef; typedef struct { vu32 EVCR; vu32 MAPR; vu32 EXTICR[4]; } AFIO_TypeDef; /*------------------------ Inter-integrated Circuit Interface ----------------*/ typedef struct { vu16 CR1; u16 RESERVED0; vu16 CR2; u16 RESERVED1; vu16 OAR1; u16 RESERVED2; vu16 OAR2; u16 RESERVED3; vu16 DR; u16 RESERVED4; vu16 SR1; u16 RESERVED5; vu16 SR2; u16 RESERVED6; vu16 CCR; u16 RESERVED7; vu16 TRISE; u16 RESERVED8; } I2C_TypeDef; /*------------------------ Independent WATCHDOG ------------------------------*/ typedef struct { vu32 KR; vu32 PR; vu32 RLR; vu32 SR; } IWDG_TypeDef; /*------------------------ Nested Vectored Interrupt Controller --------------*/ typedef struct { vu32 Enable[2]; u32 RESERVED0[30]; vu32 Disable[2]; u32 RSERVED1[30]; vu32 Set[2]; u32 RESERVED2[30]; vu32 Clear[2]; u32 RESERVED3[30]; vu32 Active[2]; u32 RESERVED4[62]; vu32 Priority[11]; } NVIC_TypeDef; typedef struct { vu32 CPUID; vu32 IRQControlState; vu32 ExceptionTableOffset; vu32 AIRC; vu32 SysCtrl; vu32 ConfigCtrl; vu32 SystemPriority[3]; vu32 SysHandlerCtrl; vu32 ConfigFaultStatus; vu32 HardFaultStatus; vu32 DebugFaultStatus; vu32 MemoryManageFaultAddr; vu32 BusFaultAddr; } SCB_TypeDef; /*------------------------ Power Controller ----------------------------------*/ typedef struct { vu32 CR; vu32 CSR; } PWR_TypeDef; /*------------------------ Reset and Clock Controller ------------------------*/ typedef struct { vu32 CR; vu32 CFGR; vu32 CIR; vu32 APB2RSTR; vu32 APB1RSTR; vu32 AHBENR; vu32 APB2ENR; vu32 APB1ENR; vu32 BDCR; vu32 CSR; } RCC_TypeDef; /*------------------------ Real-Time Clock -----------------------------------*/ typedef struct { vu16 CRH; u16 RESERVED0; vu16 CRL; u16 RESERVED1; vu16 PRLH; u16 RESERVED2; vu16 PRLL; u16 RESERVED3; vu16 DIVH; u16 RESERVED4; vu16 DIVL; u16 RESERVED5; vu16 CNTH; u16 RESERVED6; vu16 CNTL; u16 RESERVED7; vu16 ALRH; u16 RESERVED8; vu16 ALRL; u16 RESERVED9; } RTC_TypeDef; /*------------------------ Serial Peripheral Interface -----------------------*/ typedef struct { vu16 CR1; u16 RESERVED0; vu16 CR2; u16 RESERVED1; vu16 SR; u16 RESERVED2; vu16 DR; u16 RESERVED3; vu16 CRCPR; u16 RESERVED4; vu16 RXCRCR; u16 RESERVED5; vu16 TXCRCR; u16 RESERVED6; vu16 I2SCFGR; u16 RESERVED7; vu16 I2SPR; u16 RESERVED8; } SPI_TypeDef; /*------------------------ SystemTick ----------------------------------------*/ typedef struct { vu32 CTRL; vu32 LOAD; vu32 VAL; vuc32 CALIB; } SysTick_TypeDef; /*------------------------ Advanced Control Timer ----------------------------*/ typedef struct { vu16 CR1; u16 RESERVED0; vu16 CR2; u16 RESERVED1; vu16 SMCR; u16 RESERVED2; vu16 DIER; u16 RESERVED3; vu16 SR; u16 RESERVED4; vu16 EGR; u16 RESERVED5; vu16 CCMR1; u16 RESERVED6; vu16 CCMR2; u16 RESERVED7; vu16 CCER; u16 RESERVED8; vu16 CNT; u16 RESERVED9; vu16 PSC; u16 RESERVED10; vu16 ARR; u16 RESERVED11; vu16 RCR; u16 RESERVED12; vu16 CCR1; u16 RESERVED13; vu16 CCR2; u16 RESERVED14; vu16 CCR3; u16 RESERVED15; vu16 CCR4; u16 RESERVED16; vu16 BDTR; u16 RESERVED17; vu16 DCR; u16 RESERVED18; vu16 DMAR; u16 RESERVED19; } TIM1_TypeDef; /*------------------------ General Purpose Timer -----------------------------*/ typedef struct { vu16 CR1; u16 RESERVED0; vu16 CR2; u16 RESERVED1; vu16 SMCR; u16 RESERVED2; vu16 DIER; u16 RESERVED3; vu16 SR; u16 RESERVED4; vu16 EGR; u16 RESERVED5; vu16 CCMR1; u16 RESERVED6; vu16 CCMR2; u16 RESERVED7; vu16 CCER; u16 RESERVED8; vu16 CNT; u16 RESERVED9; vu16 PSC; u16 RESERVED10; vu16 ARR; u16 RESERVED11[3]; vu16 CCR1; u16 RESERVED12; vu16 CCR2; u16 RESERVED13; vu16 CCR3; u16 RESERVED14; vu16 CCR4; u16 RESERVED15[3]; vu16 DCR; u16 RESERVED16; vu16 DMAR; u16 RESERVED17; } TIM_TypeDef; /*----------------- Universal Synchronous Asynchronous Receiver Transmitter --*/ typedef struct { vu16 SR; u16 RESERVED0; vu16 DR; u16 RESERVED1; vu16 BRR; u16 RESERVED2; vu16 CR1; u16 RESERVED3; vu16 CR2; u16 RESERVED4; vu16 CR3; u16 RESERVED5; vu16 GTPR; u16 RESERVED6; } USART_TypeDef; /*------------------------ Window WATCHDOG -----------------------------------*/ typedef struct { vu32 CR; vu32 CFR; vu32 SR; } WWDG_TypeDef; /******************************************************************************/ /* Peripheral memory map */ /******************************************************************************/ /* Peripheral and SRAM base address in the alias region */ #define PERIPH_BB_BASE ((u32)0x42000000) #define SRAM_BB_BASE ((u32)0x22000000) /* Peripheral and SRAM base address in the bit-band region */ #define SRAM_BASE ((u32)0x20000000) #define PERIPH_BASE ((u32)0x40000000) /* Flash refisters base address */ #define FLASH_BASE ((u32)0x40022000) /* Flash Option Bytes base address */ #define OB_BASE ((u32)0x1FFFF800) /* Peripheral memory map */ #define APB1PERIPH_BASE PERIPH_BASE #define APB2PERIPH_BASE (PERIPH_BASE + 0x10000) #define AHBPERIPH_BASE (PERIPH_BASE + 0x20000) #define TIM2_BASE (APB1PERIPH_BASE + 0x0000) #define TIM3_BASE (APB1PERIPH_BASE + 0x0400) #define TIM4_BASE (APB1PERIPH_BASE + 0x0800) #define RTC_BASE (APB1PERIPH_BASE + 0x2800) #define WWDG_BASE (APB1PERIPH_BASE + 0x2C00) #define IWDG_BASE (APB1PERIPH_BASE + 0x3000) #define SPI2_BASE (APB1PERIPH_BASE + 0x3800) #define USART2_BASE (APB1PERIPH_BASE + 0x4400) #define USART3_BASE (APB1PERIPH_BASE + 0x4800) #define I2C1_BASE (APB1PERIPH_BASE + 0x5400) #define I2C2_BASE (APB1PERIPH_BASE + 0x5800) #define CAN_BASE (APB1PERIPH_BASE + 0x6400) #define BKP_BASE (APB1PERIPH_BASE + 0x6C00) #define PWR_BASE (APB1PERIPH_BASE + 0x7000) #define AFIO_BASE (APB2PERIPH_BASE + 0x0000) #define EXTI_BASE (APB2PERIPH_BASE + 0x0400) #define GPIOA_BASE (APB2PERIPH_BASE + 0x0800) #define GPIOB_BASE (APB2PERIPH_BASE + 0x0C00) #define GPIOC_BASE (APB2PERIPH_BASE + 0x1000) #define GPIOD_BASE (APB2PERIPH_BASE + 0x1400) #define GPIOE_BASE (APB2PERIPH_BASE + 0x1800) #define ADC1_BASE (APB2PERIPH_BASE + 0x2400) #define ADC2_BASE (APB2PERIPH_BASE + 0x2800) #define TIM1_BASE (APB2PERIPH_BASE + 0x2C00) #define SPI1_BASE (APB2PERIPH_BASE + 0x3000) #define USART1_BASE (APB2PERIPH_BASE + 0x3800) #define DMA_BASE (AHBPERIPH_BASE + 0x0000) #define DMA_Channel1_BASE (AHBPERIPH_BASE + 0x0008) #define DMA_Channel2_BASE (AHBPERIPH_BASE + 0x001C) #define DMA_Channel3_BASE (AHBPERIPH_BASE + 0x0030) #define DMA_Channel4_BASE (AHBPERIPH_BASE + 0x0044) #define DMA_Channel5_BASE (AHBPERIPH_BASE + 0x0058) #define DMA_Channel6_BASE (AHBPERIPH_BASE + 0x006C) #define DMA_Channel7_BASE (AHBPERIPH_BASE + 0x0080) #define RCC_BASE (AHBPERIPH_BASE + 0x1000) /* System Control Space memory map */ #define SCS_BASE ((u32)0xE000E000) #define SysTick_BASE (SCS_BASE + 0x0010) #define NVIC_BASE (SCS_BASE + 0x0100) #define SCB_BASE (SCS_BASE + 0x0D00) /******************************************************************************/ /* IPs' declaration */ /******************************************************************************/ /*------------------- Non Debug Mode -----------------------------------------*/ #ifndef DEBUG #ifdef _TIM2 #define TIM2 ((TIM_TypeDef *) TIM2_BASE) #endif /*_TIM2 */ #ifdef _TIM3 #define TIM3 ((TIM_TypeDef *) TIM3_BASE) #endif /*_TIM3 */ #ifdef _TIM4 #define TIM4 ((TIM_TypeDef *) TIM4_BASE) #endif /*_TIM4 */ #ifdef _RTC #define RTC ((RTC_TypeDef *) RTC_BASE) #endif /*_RTC */ #ifdef _WWDG #define WWDG ((WWDG_TypeDef *) WWDG_BASE) #endif /*_WWDG */ #ifdef _IWDG #define IWDG ((IWDG_TypeDef *) IWDG_BASE) #endif /*_IWDG */ #ifdef _SPI2 #define SPI2 ((SPI_TypeDef *) SPI2_BASE) #endif /*_SPI2 */ #ifdef _USART2 #define USART2 ((USART_TypeDef *) USART2_BASE) #endif /*_USART2 */ #ifdef _USART3 #define USART3 ((USART_TypeDef *) USART3_BASE) #endif /*_USART3 */ #ifdef _I2C1 #define I2C1 ((I2C_TypeDef *) I2C1_BASE) #endif /*_I2C1 */ #ifdef _I2C2 #define I2C2 ((I2C_TypeDef *) I2C2_BASE) #endif /*_I2C2 */ #ifdef _CAN #define CAN ((CAN_TypeDef *) CAN_BASE) #endif /*_CAN */ #ifdef _BKP #define BKP ((BKP_TypeDef *) BKP_BASE) #endif /*_BKP */ #ifdef _PWR #define PWR ((PWR_TypeDef *) PWR_BASE) #endif /*_PWR */ #ifdef _AFIO #define AFIO ((AFIO_TypeDef *) AFIO_BASE) #endif /*_AFIO */ #ifdef _EXTI #define EXTI ((EXTI_TypeDef *) EXTI_BASE) #endif /*_EXTI */ #ifdef _GPIOA #define GPIOA ((GPIO_TypeDef *) GPIOA_BASE) #endif /*_GPIOA */ #ifdef _GPIOB #define GPIOB ((GPIO_TypeDef *) GPIOB_BASE) #endif /*_GPIOB */ #ifdef _GPIOC #define GPIOC ((GPIO_TypeDef *) GPIOC_BASE) #endif /*_GPIOC */ #ifdef _GPIOD #define GPIOD ((GPIO_TypeDef *) GPIOD_BASE) #endif /*_GPIOD */ #ifdef _GPIOE #define GPIOE ((GPIO_TypeDef *) GPIOE_BASE) #endif /*_GPIOE */ #ifdef _ADC1 #define ADC1 ((ADC_TypeDef *) ADC1_BASE) #endif /*_ADC1 */ #ifdef _ADC2 #define ADC2 ((ADC_TypeDef *) ADC2_BASE) #endif /*_ADC2 */ #ifdef _TIM1 #define TIM1 ((TIM1_TypeDef *) TIM1_BASE) #endif /*_TIM1 */ #ifdef _SPI1 #define SPI1 ((SPI_TypeDef *) SPI1_BASE) #endif /*_SPI1 */ #ifdef _USART1 #define USART1 ((USART_TypeDef *) USART1_BASE) #endif /*_USART1 */ #ifdef _DMA #define DMA ((DMA_TypeDef *) DMA_BASE) #endif /*_DMA */ #ifdef _DMA_Channel1 #define DMA_Channel1 ((DMA_Channel_TypeDef *) DMA_Channel1_BASE) #endif /*_DMA_Channel1 */ #ifdef _DMA_Channel2 #define DMA_Channel2 ((DMA_Channel_TypeDef *) DMA_Channel2_BASE) #endif /*_DMA_Channel2 */ #ifdef _DMA_Channel3 #define DMA_Channel3 ((DMA_Channel_TypeDef *) DMA_Channel3_BASE) #endif /*_DMA_Channel3 */ #ifdef _DMA_Channel4 #define DMA_Channel4 ((DMA_Channel_TypeDef *) DMA_Channel4_BASE) #endif /*_DMA_Channel4 */ #ifdef _DMA_Channel5 #define DMA_Channel5 ((DMA_Channel_TypeDef *) DMA_Channel5_BASE) #endif /*_DMA_Channel5 */ #ifdef _DMA_Channel6 #define DMA_Channel6 ((DMA_Channel_TypeDef *) DMA_Channel6_BASE) #endif /*_DMA_Channel6 */ #ifdef _DMA_Channel7 #define DMA_Channel7 ((DMA_Channel_TypeDef *) DMA_Channel7_BASE) #endif /*_DMA_Channel7 */ #ifdef _FLASH #define FLASH ((FLASH_TypeDef *) FLASH_BASE) #define OB ((OB_TypeDef *) OB_BASE) #endif /*_FLASH */ #ifdef _RCC #define RCC ((RCC_TypeDef *) RCC_BASE) #endif /*_RCC */ #ifdef _SysTick #define SysTick ((SysTick_TypeDef *) SysTick_BASE) #endif /*_SysTick */ #ifdef _NVIC #define NVIC ((NVIC_TypeDef *) NVIC_BASE) #endif /*_NVIC */ #ifdef _SCB #define SCB ((SCB_TypeDef *) SCB_BASE) #endif /*_SCB */ /*---------------------- Debug Mode -----------------------------------------*/ #else /* DEBUG */ #ifdef _TIM2 EXT TIM_TypeDef *TIM2; #endif /*_TIM2 */ #ifdef _TIM3 EXT TIM_TypeDef *TIM3; #endif /*_TIM3 */ #ifdef _TIM4 EXT TIM_TypeDef *TIM4; #endif /*_TIM4 */ #ifdef _RTC EXT RTC_TypeDef *RTC; #endif /*_RTC */ #ifdef _WWDG EXT WWDG_TypeDef *WWDG; #endif /*_WWDG */ #ifdef _IWDG EXT IWDG_TypeDef *IWDG; #endif /*_IWDG */ #ifdef _SPI2 EXT SPI_TypeDef *SPI2; #endif /*_SPI2 */ #ifdef _USART2 EXT USART_TypeDef *USART2; #endif /*_USART2 */ #ifdef _USART3 EXT USART_TypeDef *USART3; #endif /*_USART3 */ #ifdef _I2C1 EXT I2C_TypeDef *I2C1; #endif /*_I2C1 */ #ifdef _I2C2 EXT I2C_TypeDef *I2C2; #endif /*_I2C2 */ #ifdef _CAN EXT CAN_TypeDef *CAN; #endif /*_CAN */ #ifdef _BKP EXT BKP_TypeDef *BKP; #endif /*_BKP */ #ifdef _PWR EXT PWR_TypeDef *PWR; #endif /*_PWR */ #ifdef _AFIO EXT AFIO_TypeDef *AFIO; #endif /*_AFIO */ #ifdef _EXTI EXT EXTI_TypeDef *EXTI; #endif /*_EXTI */ #ifdef _GPIOA EXT GPIO_TypeDef *GPIOA; #endif /*_GPIOA */ #ifdef _GPIOB EXT GPIO_TypeDef *GPIOB; #endif /*_GPIOB */ #ifdef _GPIOC EXT GPIO_TypeDef *GPIOC; #endif /*_GPIOC */ #ifdef _GPIOD EXT GPIO_TypeDef *GPIOD; #endif /*_GPIOD */ #ifdef _GPIOE EXT GPIO_TypeDef *GPIOE; #endif /*_GPIOE */ #ifdef _ADC1 EXT ADC_TypeDef *ADC1; #endif /*_ADC1 */ #ifdef _ADC2 EXT ADC_TypeDef *ADC2; #endif /*_ADC2 */ #ifdef _TIM1 EXT TIM1_TypeDef *TIM1; #endif /*_TIM1 */ #ifdef _SPI1 EXT SPI_TypeDef *SPI1; #endif /*_SPI1 */ #ifdef _USART1 EXT USART_TypeDef *USART1; #endif /*_USART1 */ #ifdef _DMA EXT DMA_TypeDef *DMA; #endif /*_DMA */ #ifdef _DMA_Channel1 EXT DMA_Channel_TypeDef *DMA_Channel1; #endif /*_DMA_Channel1 */ #ifdef _DMA_Channel2 EXT DMA_Channel_TypeDef *DMA_Channel2; #endif /*_DMA_Channel2 */ #ifdef _DMA_Channel3 EXT DMA_Channel_TypeDef *DMA_Channel3; #endif /*_DMA_Channel3 */ #ifdef _DMA_Channel4 EXT DMA_Channel_TypeDef *DMA_Channel4; #endif /*_DMA_Channel4 */ #ifdef _DMA_Channel5 EXT DMA_Channel_TypeDef *DMA_Channel5; #endif /*_DMA_Channel5 */ #ifdef _DMA_Channel6 EXT DMA_Channel_TypeDef *DMA_Channel6; #endif /*_DMA_Channel6 */ #ifdef _DMA_Channel7 EXT DMA_Channel_TypeDef *DMA_Channel7; #endif /*_DMA_Channel7 */ #ifdef _FLASH EXT FLASH_TypeDef *FLASH; EXT OB_TypeDef *OB; #endif /*_FLASH */ #ifdef _RCC EXT RCC_TypeDef *RCC; #endif /*_RCC */ #ifdef _SysTick EXT SysTick_TypeDef *SysTick; #endif /*_SysTick */ #ifdef _NVIC EXT NVIC_TypeDef *NVIC; #endif /*_NVIC */ #ifdef _SCB EXT SCB_TypeDef *SCB; #endif /*_SCB */ #endif /* DEBUG */ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #endif /* __STM32F10x_MAP_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_map.h
C
oos
20,592
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32fxxx_eth.h * Author : MCD Application Team * Version : V0.0.1 * Date : 12/17/2008 * Desciption : This file contains all the functions prototypes for the * ETHERNET firmware library. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32FXXX_ETH_H #define __STM32FXXX_ETH_H /* Includes ------------------------------------------------------------------*/ #include "stm32fxxx_eth_map.h" /* Exported types ------------------------------------------------------------*/ /* ETHERNET MAC Init structure definition */ typedef struct { /* MAC ----------------------------------*/ u32 ETH_AutoNegotiation; /* Selects or not the AutoNegotiation with the external PHY */ u32 ETH_Watchdog; /* Enable/disable Watchdog timer */ u32 ETH_Jabber; /* Enable/disable Jabber timer */ u32 ETH_JumboFrame; /* Enable/disable Jumbo frame */ u32 ETH_InterFrameGap; /* Selects minimum IFG between frames during transmission */ u32 ETH_CarrierSense; /* Enable/disable Carrier Sense */ u32 ETH_Speed; /* Indicates the Ethernet speed: 10/100 Mbps */ u32 ETH_ReceiveOwn; /* Enable/disable the reception of frames when the TX_EN signal is asserted in Half-Duplex mode */ u32 ETH_LoopbackMode; /* Enable/disable internal MAC MII Loopback mode */ u32 ETH_Mode; /* Selects the MAC duplex mode: Half-Duplex or Full-Duplex mode */ u32 ETH_ChecksumOffload; /* Enable/disable the calculation of complement sum of all received Ethernet frame payloads */ u32 ETH_RetryTransmission; /* Enable/disable the MAC attempt retries transmission, based on the settings of BL, when a colision occurs (Half-Duplex mode) */ u32 ETH_AutomaticPadCRCStrip; /* Enable/disable Automatic MAC Pad/CRC Stripping */ u32 ETH_BackOffLimit; /* Selects the BackOff limit value */ u32 ETH_DeferralCheck; /* Enable/disable deferral check function (Half-Duplex mode) */ u32 ETH_ReceiveAll; /* Enable/disable all frames reception by the MAC (No fitering)*/ u32 ETH_SourceAddrFilter; /* Selects EnableNormal/EnableInverse/disable Source Address Filter comparison */ u32 ETH_PassControlFrames; /* Selects None/All/FilterPass of all control frames (including unicast and multicast PAUSE frames) */ u32 ETH_BroadcastFramesReception; /* Enable/disable reception of Broadcast Frames */ u32 ETH_DestinationAddrFilter; /* Selects EnableNormal/EnableInverse destination filter for both unicast and multicast frames */ u32 ETH_PromiscuousMode; /* Enable/disable Promiscuous Mode */ u32 ETH_MulticastFramesFilter; /* Selects the Multicast Frames filter: None/HashTableFilter/PerfectFilter/PerfectHashTableFilter */ u32 ETH_UnicastFramesFilter; /* Selects the Unicast Frames filter: HashTableFilter/PerfectFilter/PerfectHashTableFilter */ u32 ETH_HashTableHigh; /* This field contains the higher 32 bits of Hash table. */ u32 ETH_HashTableLow; /* This field contains the lower 32 bits of Hash table. */ u32 ETH_PauseTime; /* This field holds the value to be used in the Pause Time field in the transmit control frame */ u32 ETH_ZeroQuantaPause; /* Enable/disable the automatic generation of Zero-Quanta Pause Control frames */ u32 ETH_PauseLowThreshold; /* This field configures the threshold of the PAUSE to be checked for automatic retransmission of PAUSE Frame */ u32 ETH_UnicastPauseFrameDetect; /* Enable/disable MAC to detect the Pause frames (with MAC Address0 unicast address and unique multicast address) */ u32 ETH_ReceiveFlowControl; /* Enable/disable the MAC to decode the received Pause frame and disable its transmitter for a specified (Pause Time) time */ u32 ETH_TransmitFlowControl; /* Enable/disable the MAC to transmit Pause frames (Full-Duplex mode) or the MAC back-pressure operation (Half-Duplex mode) */ u32 ETH_VLANTagComparison; /* Selects the 12-bit VLAN identifier or the complete 16-bit VLAN tag for comparison and filtering */ u32 ETH_VLANTagIdentifier; /* VLAN tag identifier for receive frames */ /* DMA --------------------------*/ u32 ETH_DropTCPIPChecksumErrorFrame; /* Enable/disable Dropping of TCP/IP Checksum Error Frames */ u32 ETH_ReceiveStoreForward; /* Enable/disable Receive store and forward */ u32 ETH_FlushReceivedFrame; /* Enable/disable flushing of received frames */ u32 ETH_TransmitStoreForward; /* Enable/disable Transmit store and forward */ u32 ETH_TransmitThresholdControl; /* Selects the Transmit Threshold Control */ u32 ETH_ForwardErrorFrames; /* Enable/disable forward to DMA of all frames except runt error frames */ u32 ETH_ForwardUndersizedGoodFrames; /* Enable/disable Rx FIFO to forward Undersized frames (frames with no Error and length less than 64 bytes) including pad-bytes and CRC) */ u32 ETH_ReceiveThresholdControl; /* Selects the threshold level of the Receive FIFO */ u32 ETH_SecondFrameOperate; /* Enable/disable the DMA process of a second frame of Transmit data even before status for first frame is obtained */ u32 ETH_AddressAlignedBeats; /* Enable/disable Address Aligned Beats */ u32 ETH_FixedBurst; /* Enable/disable the AHB Master interface fixed burst transfers */ u32 ETH_RxDMABurstLength; /* Indicate the maximum number of beats to be transferred in one Rx DMA transaction */ u32 ETH_TxDMABurstLength; /* Indicate the maximum number of beats to be transferred in one Tx DMA transaction */ u32 ETH_DescriptorSkipLength; /* Specifies the number of word to skip between two unchained descriptors (Ring mode) */ u32 ETH_DMAArbitration; /* Selects DMA Tx/Rx arbitration */ }ETH_InitTypeDef; /*----------------------------------------------------------------------------*/ /* DMA descriptors types */ /*----------------------------------------------------------------------------*/ /* ETHERNET DMA Desciptors data structure definition */ typedef struct { volatile u32 Status; /* Status */ volatile u32 ControlBufferSize; /* Control and Buffer1, Buffer2 lengths */ volatile u32 Buffer1Addr; /* Buffer1 address pointer */ volatile u32 Buffer2NextDescAddr; /* Buffer2 or next descriptor address pointer */ } ETH_DMADESCTypeDef; /* Exported constants --------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* ETHERNET Frames defines */ /*----------------------------------------------------------------------------*/ /* ENET Buffers setting */ #define ETH_MAX_PACKET_SIZE 1520 /* ETH_HEADER + ETH_EXTRA + MAX_ETH_PAYLOAD + ETH_CRC */ #define ETH_HEADER 14 /* 6 byte Dest addr, 6 byte Src addr, 2 byte length/type */ #define ETH_CRC 4 /* Ethernet CRC */ #define ETH_EXTRA 2 /* Extra bytes in some cases */ #define VLAN_TAG 4 /* optional 802.1q VLAN Tag */ #define MIN_ETH_PAYLOAD 46 /* Minimum Ethernet payload size */ #define MAX_ETH_PAYLOAD 1500 /* Maximum Ethernet payload size */ #define JUMBO_FRAME_PAYLOAD 9000 /* Jumbo frame payload size */ /*--------------------------------------------------------*/ /* Ethernet DMA descriptors registers bits definition */ /*--------------------------------------------------------*/ /* DMA Tx Desciptor ---------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------- TDES0 | OWN(31) | CTRL[30:26] | Reserved[25:24] | CTRL[23:20] | Reserved[19:17] | Status[16:0] | | ----------------------------------------------------------------------------------------------- TDES1 | Reserved[31:29] | Buffer2 ByteCount[28:16] | Reserved[15:13] | Buffer1 ByteCount[12:0] | ----------------------------------------------------------------------------------------------- TDES2 | Buffer1 Address [31:0] | ----------------------------------------------------------------------------------------------- TDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] | ----------------------------------------------------------------------------------------------*/ /* Bit definition of TDES0 register: DMA Tx descriptor status register */ #define ETH_DMATxDesc_OWN (0x80000000UL) /* OWN bit: descriptor is owned by DMA engine */ #define ETH_DMATxDesc_IC ((u32)0x40000000) /* Interrupt on Completion */ #define ETH_DMATxDesc_LS ((u32)0x20000000) /* Last Segment */ #define ETH_DMATxDesc_FS ((u32)0x10000000) /* First Segment */ #define ETH_DMATxDesc_DC ((u32)0x08000000) /* Disable CRC */ #define ETH_DMATxDesc_DP ((u32)0x04000000) /* Disable Padding */ #define ETH_DMATxDesc_TTSE ((u32)0x02000000) /* Transmit Time Stamp Enable */ #define ETH_DMATxDesc_CIC ((u32)0x00C00000) /* Checksum Insertion Control: 4 cases */ #define ETH_DMATxDesc_CIC_ByPass ((u32)0x00000000) /* Do Nothing: Checksum Engine is bypassed */ #define ETH_DMATxDesc_CIC_IPV4Header ((u32)0x00400000) /* IPV4 header Checksum Insertion */ #define ETH_DMATxDesc_CIC_TCPUDPICMP_Segment ((u32)0x00800000) /* TCP/UDP/ICMP Checksum Insertion calculated over segment only */ #define ETH_DMATxDesc_CIC_TCPUDPICMP_Full ((u32)0x00C00000) /* TCP/UDP/ICMP Checksum Insertion fully calculated */ #define ETH_DMATxDesc_TER ((u32)0x00200000) /* Transmit End of Ring */ #define ETH_DMATxDesc_TCH ((u32)0x00100000) /* Second Address Chained */ #define ETH_DMATxDesc_TTSS ((u32)0x00020000) /* Tx Time Stamp Status */ #define ETH_DMATxDesc_IHE ((u32)0x00010000) /* IP Header Error */ #define ETH_DMATxDesc_ES ((u32)0x00008000) /* Error summary: OR of the following bits: UE || ED || EC || LCO || NC || LCA || FF || JT */ #define ETH_DMATxDesc_JT ((u32)0x00004000) /* Jabber Timeout */ #define ETH_DMATxDesc_FF ((u32)0x00002000) /* Frame Flushed: DMA/MTL flushed the frame due to SW flush */ #define ETH_DMATxDesc_PCE ((u32)0x00001000) /* Payload Checksum Error */ #define ETH_DMATxDesc_LCA ((u32)0x00000800) /* Loss of Carrier: carrier lost during tramsmission */ #define ETH_DMATxDesc_NC ((u32)0x00000400) /* No Carrier: no carrier signal from the tranceiver */ #define ETH_DMATxDesc_LCO ((u32)0x00000200) /* Late Collision: transmission aborted due to collision */ #define ETH_DMATxDesc_EC ((u32)0x00000100) /* Excessive Collision: transmission aborted after 16 collisions */ #define ETH_DMATxDesc_VF ((u32)0x00000080) /* VLAN Frame */ #define ETH_DMATxDesc_CC ((u32)0x00000078) /* Collision Count */ #define ETH_DMATxDesc_ED ((u32)0x00000004) /* Excessive Deferral */ #define ETH_DMATxDesc_UF ((u32)0x00000002) /* Underflow Error: late data arrival from the memory */ #define ETH_DMATxDesc_DB ((u32)0x00000001) /* Deferred Bit */ /* Bit definition of TDES1 register */ #define ETH_DMATxDesc_TBS2 ((u32)0x1FFF0000) /* Transmit Buffer2 Size */ #define ETH_DMATxDesc_TBS1 ((u32)0x00001FFF) /* Transmit Buffer1 Size */ /* Bit definition of TDES2 register */ #define ETH_DMATxDesc_B1AP ((u32)0xFFFFFFFF) /* Buffer1 Address Pointer */ /* Bit definition of TDES3 register */ #define ETH_DMATxDesc_B2AP ((u32)0xFFFFFFFF) /* Buffer2 Address Pointer */ /* DMA Rx descriptor ---------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------- RDES0 | OWN(31) | Status [30:0] | --------------------------------------------------------------------------------------------------------------------- RDES1 | CTRL(31) | Reserved[30:29] | Buffer2 ByteCount[28:16] | CTRL[15:14] | Reserved(13) | Buffer1 ByteCount[12:0] | --------------------------------------------------------------------------------------------------------------------- RDES2 | Buffer1 Address [31:0] | --------------------------------------------------------------------------------------------------------------------- RDES3 | Buffer2 Address [31:0] / Next Desciptor Address [31:0] | --------------------------------------------------------------------------------------------------------------------*/ /* Bit definition of RDES0 register: DMA Rx descriptor status register */ #define ETH_DMARxDesc_OWN ((u32)0x80000000) /* OWN bit: descriptor is owned by DMA engine */ #define ETH_DMARxDesc_AFM ((u32)0x40000000) /* DA Filter Fail for the rx frame */ #define ETH_DMARxDesc_FL ((u32)0x3FFF0000) /* Receive descriptor frame length */ #define ETH_DMARxDesc_ES ((u32)0x00008000) /* Error summary: OR of the following bits: DE || OE || IPC || LC || RWT || RE || CE */ #define ETH_DMARxDesc_DE ((u32)0x00004000) /* Desciptor error: no more descriptors for receive frame */ #define ETH_DMARxDesc_SAF ((u32)0x00002000) /* SA Filter Fail for the received frame */ #define ETH_DMARxDesc_LE ((u32)0x00001000) /* Frame size not matching with length field */ #define ETH_DMARxDesc_OE ((u32)0x00000800) /* Overflow Error: Frame was damaged due to buffer overflow */ #define ETH_DMARxDesc_VLAN ((u32)0x00000400) /* VLAN Tag: received frame is a VLAN frame */ #define ETH_DMARxDesc_FS ((u32)0x00000200) /* First descriptor of the frame */ #define ETH_DMARxDesc_LS ((u32)0x00000100) /* Last descriptor of the frame */ #define ETH_DMARxDesc_IPV4HCE ((u32)0x00000080) /* IPC Checksum Error/Giant Frame: Rx Ipv4 header checksum error */ #define ETH_DMARxDesc_RxLongFrame ((u32)0x00000080) /* (Giant Frame)Rx - frame is longer than 1518/1522 */ #define ETH_DMARxDesc_LC ((u32)0x00000040) /* Late collision occurred during reception */ #define ETH_DMARxDesc_FT ((u32)0x00000020) /* Frame type - Ethernet, otherwise 802.3 */ #define ETH_DMARxDesc_RWT ((u32)0x00000010) /* Receive Watchdog Timeout: watchdog timer expired during reception */ #define ETH_DMARxDesc_RE ((u32)0x00000008) /* Receive error: error reported by MII interface */ #define ETH_DMARxDesc_DBE ((u32)0x00000004) /* Dribble bit error: frame contains non int multiple of 8 bits */ #define ETH_DMARxDesc_CE ((u32)0x00000002) /* CRC error */ #define ETH_DMARxDesc_MAMPCE ((u32)0x00000001) /* Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error */ /* Bit definition of RDES1 register */ #define ETH_DMARxDesc_DIC ((u32)0x80000000) /* Disable Interrupt on Completion */ #define ETH_DMARxDesc_RBS2 ((u32)0x1FFF0000) /* Receive Buffer2 Size */ #define ETH_DMARxDesc_RER ((u32)0x00008000) /* Receive End of Ring */ #define ETH_DMARxDesc_RCH ((u32)0x00004000) /* Second Address Chained */ #define ETH_DMARxDesc_RBS1 ((u32)0x00001FFF) /* Receive Buffer1 Size */ /* Bit definition of RDES2 register */ #define ETH_DMARxDesc_B1AP ((u32)0xFFFFFFFF) /* Buffer1 Address Pointer */ /* Bit definition of RDES3 register */ #define ETH_DMARxDesc_B2AP ((u32)0xFFFFFFFF) /* Buffer2 Address Pointer */ /*----------------------------------------------------------------------------*/ /* Desciption of common PHY registers */ /*----------------------------------------------------------------------------*/ /* PHY Read/write Timeouts */ #define PHY_READ_TO ((u32)0x0004FFFF) #define PHY_WRITE_TO ((u32)0x0004FFFF) /* PHY Reset Delay */ #define PHY_ResetDelay ((u32)0x000FFFFF) /* PHY Config Delay */ #define PHY_ConfigDelay ((u32)0x00FFFFFF) /* PHY Register address */ #define PHY_BCR 0 /* Tranceiver Basic Control Register */ #define PHY_BSR 1 /* Tranceiver Basic Status Register */ /* PHY basic Control register */ #define PHY_Reset ((u16)0x8000) /* PHY Reset */ #define PHY_Loopback ((u16)0x4000) /* Select loop-back mode */ #define PHY_FULLDUPLEX_100M ((u16)0x2100) /* Set the full-duplex mode at 100 Mb/s */ #define PHY_HALFDUPLEX_100M ((u16)0x2000) /* Set the half-duplex mode at 100 Mb/s */ #define PHY_FULLDUPLEX_10M ((u16)0x0100) /* Set the full-duplex mode at 10 Mb/s */ #define PHY_HALFDUPLEX_10M ((u16)0x0000) /* Set the half-duplex mode at 10 Mb/s */ #define PHY_AutoNegotiation ((u16)0x1000) /* Enable auto-negotiation function */ #define PHY_Restart_AutoNegotiation ((u16)0x0200) /* Restart auto-negotiation function */ #define PHY_Powerdown ((u16)0x0800) /* Select the power down mode */ #define PHY_Isolate ((u16)0x0400) /* Isolate PHY from MII */ /* PHY basic status register */ #define PHY_AutoNego_Complete ((u16)0x0020) /* Auto-Negotioation process completed */ #define PHY_Linked_Status ((u16)0x0004) /* Valid link established */ #define PHY_Jabber_detection ((u16)0x0002) /* Jabber condition detected */ /* The PHY status register value change from a PHY to another so the user have to update this value depending on the used external PHY */ /* For LAN8700 */ //#define PHY_SR 31 /* Tranceiver Status Register */ /* For DP83848 */ #define PHY_SR 16 /* Tranceiver Status Register */ /* PHY status register */ /* The Speed and Duplex mask values change from a PHY to another so the user have to update this value depending on the used external PHY */ /* For LAN8700 */ //#define PHY_Speed_Status ((u16)0x0004) /* Configured information of Speed: 10Mbps */ //#define PHY_Duplex_Status ((u16)0x0010) /* Configured information of Duplex: Full-duplex */ /* For DP83848 */ #define PHY_Speed_Status ((u16)0x0002) /* Configured information of Speed: 10Mbps */ #define PHY_Duplex_Status ((u16)0x0004) /* Configured information of Duplex: Full-duplex */ #define IS_ETH_PHY_ADDRESS(ADDRESS) ((ADDRESS) <= 0x20) #define IS_ETH_PHY_REG(REG) (((REG) == PHY_BCR) || \ ((REG) == PHY_BSR) || \ ((REG) == PHY_SR)) /*----------------------------------------------------------------------------*/ /* MAC defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET AutoNegotiation --------------------------------------------------*/ #define ETH_AutoNegotiation_Enable ((u32)0x00000001) #define ETH_AutoNegotiation_Disable ((u32)0x00000000) #define IS_ETH_AUTONEGOTIATION(CMD) (((CMD) == ETH_AutoNegotiation_Enable) || \ ((CMD) == ETH_AutoNegotiation_Disable)) /* ETHERNET watchdog ---------------------------------------------------------*/ #define ETH_Watchdog_Enable ((u32)0x00000000) #define ETH_Watchdog_Disable ((u32)0x00800000) #define IS_ETH_WATCHDOG(CMD) (((CMD) == ETH_Watchdog_Enable) || \ ((CMD) == ETH_Watchdog_Disable)) /* ETHERNET Jabber -----------------------------------------------------------*/ #define ETH_Jabber_Enable ((u32)0x00000000) #define ETH_Jabber_Disable ((u32)0x00400000) #define IS_ETH_JABBER(CMD) (((CMD) == ETH_Jabber_Enable) || \ ((CMD) == ETH_Jabber_Disable)) /* ETHERNET Jumbo Frame ------------------------------------------------------*/ #define ETH_JumboFrame_Enable ((u32)0x00100000) #define ETH_JumboFrame_Disable ((u32)0x00000000) #define IS_ETH_JUMBO_FRAME(CMD) (((CMD) == ETH_JumboFrame_Enable) || \ ((CMD) == ETH_JumboFrame_Disable)) /* ETHERNET Inter Frame Gap --------------------------------------------------*/ #define ETH_InterFrameGap_96Bit ((u32)0x00000000) /* minimum IFG between frames during transmission is 96Bit */ #define ETH_InterFrameGap_88Bit ((u32)0x00020000) /* minimum IFG between frames during transmission is 88Bit */ #define ETH_InterFrameGap_80Bit ((u32)0x00040000) /* minimum IFG between frames during transmission is 80Bit */ #define ETH_InterFrameGap_72Bit ((u32)0x00060000) /* minimum IFG between frames during transmission is 72Bit */ #define ETH_InterFrameGap_64Bit ((u32)0x00080000) /* minimum IFG between frames during transmission is 64Bit */ #define ETH_InterFrameGap_56Bit ((u32)0x000A0000) /* minimum IFG between frames during transmission is 56Bit */ #define ETH_InterFrameGap_48Bit ((u32)0x000C0000) /* minimum IFG between frames during transmission is 48Bit */ #define ETH_InterFrameGap_40Bit ((u32)0x000E0000) /* minimum IFG between frames during transmission is 40Bit */ #define IS_ETH_INTER_FRAME_GAP(GAP) (((GAP) == ETH_InterFrameGap_96Bit) || \ ((GAP) == ETH_InterFrameGap_88Bit) || \ ((GAP) == ETH_InterFrameGap_80Bit) || \ ((GAP) == ETH_InterFrameGap_72Bit) || \ ((GAP) == ETH_InterFrameGap_64Bit) || \ ((GAP) == ETH_InterFrameGap_56Bit) || \ ((GAP) == ETH_InterFrameGap_48Bit) || \ ((GAP) == ETH_InterFrameGap_40Bit)) /* ETHERNET Carrier Sense ----------------------------------------------------*/ #define ETH_CarrierSense_Enable ((u32)0x00000000) #define ETH_CarrierSense_Disable ((u32)0x00010000) #define IS_ETH_CARRIER_SENSE(CMD) (((CMD) == ETH_CarrierSense_Enable) || \ ((CMD) == ETH_CarrierSense_Disable)) /* ETHERNET Speed ------------------------------------------------------------*/ #define ETH_Speed_10M ((u32)0x00000000) #define ETH_Speed_100M ((u32)0x00004000) #define IS_ETH_SPEED(SPEED) (((SPEED) == ETH_Speed_10M) || \ ((SPEED) == ETH_Speed_100M)) /* ETHERNET Receive Own ------------------------------------------------------*/ #define ETH_ReceiveOwn_Enable ((u32)0x00000000) #define ETH_ReceiveOwn_Disable ((u32)0x00002000) #define IS_ETH_RECEIVE_OWN(CMD) (((CMD) == ETH_ReceiveOwn_Enable) || \ ((CMD) == ETH_ReceiveOwn_Disable)) /* ETHERNET Loop back Mode ---------------------------------------------------*/ #define ETH_LoopbackMode_Enable ((u32)0x00001000) #define ETH_LoopbackMode_Disable ((u32)0x00000000) #define IS_ETH_LOOPBACK_MODE(CMD) (((CMD) == ETH_LoopbackMode_Enable) || \ ((CMD) == ETH_LoopbackMode_Disable)) /* ETHERNET Duplex mode ------------------------------------------------------*/ #define ETH_Mode_FullDuplex ((u32)0x00000800) #define ETH_Mode_HalfDuplex ((u32)0x00000000) #define IS_ETH_DUPLEX_MODE(MODE) (((MODE) == ETH_Mode_FullDuplex) || \ ((MODE) == ETH_Mode_HalfDuplex)) /* ETHERNET Checksum Offload -------------------------------------------------*/ #define ETH_ChecksumOffload_Enable ((u32)0x00000400) #define ETH_ChecksumOffload_Disable ((u32)0x00000000) #define IS_ETH_CHECKSUM_OFFLOAD(CMD) (((CMD) == ETH_ChecksumOffload_Enable) || \ ((CMD) == ETH_ChecksumOffload_Disable)) /* ETHERNET Retry Transmission -----------------------------------------------*/ #define ETH_RetryTransmission_Enable ((u32)0x00000000) #define ETH_RetryTransmission_Disable ((u32)0x00000200) #define IS_ETH_RETRY_TRANSMISSION(CMD) (((CMD) == ETH_RetryTransmission_Enable) || \ ((CMD) == ETH_RetryTransmission_Disable)) /* ETHERNET Automatic Pad/CRC Strip ------------------------------------------*/ #define ETH_AutomaticPadCRCStrip_Enable ((u32)0x00000080) #define ETH_AutomaticPadCRCStrip_Disable ((u32)0x00000000) #define IS_ETH_AUTOMATIC_PADCRC_STRIP(CMD) (((CMD) == ETH_AutomaticPadCRCStrip_Enable) || \ ((CMD) == ETH_AutomaticPadCRCStrip_Disable)) /* ETHERNET Back-Off limit ---------------------------------------------------*/ #define ETH_BackOffLimit_10 ((u32)0x00000000) #define ETH_BackOffLimit_8 ((u32)0x00000020) #define ETH_BackOffLimit_4 ((u32)0x00000040) #define ETH_BackOffLimit_1 ((u32)0x00000060) #define IS_ETH_BACKOFF_LIMIT(LIMIT) (((LIMIT) == ETH_BackOffLimit_10) || \ ((LIMIT) == ETH_BackOffLimit_8) || \ ((LIMIT) == ETH_BackOffLimit_4) || \ ((LIMIT) == ETH_BackOffLimit_1)) /* ETHERNET Deferral Check ---------------------------------------------------*/ #define ETH_DeferralCheck_Enable ((u32)0x00000010) #define ETH_DeferralCheck_Disable ((u32)0x00000000) #define IS_ETH_DEFERRAL_CHECK(CMD) (((CMD) == ETH_DeferralCheck_Enable) || \ ((CMD) == ETH_DeferralCheck_Disable)) /* ETHERNET Receive All ------------------------------------------------------*/ #define ETH_ReceiveAll_Enable ((u32)0x80000000) #define ETH_ReceiveAll_Disable ((u32)0x00000000) #define IS_ETH_RECEIVE_ALL(CMD) (((CMD) == ETH_ReceiveAll_Enable) || \ ((CMD) == ETH_ReceiveAll_Disable)) /* ETHERNET Source Addr Filter ------------------------------------------------*/ #define ETH_SourceAddrFilter_Normal_Enable ((u32)0x00000200) #define ETH_SourceAddrFilter_Inverse_Enable ((u32)0x00000300) #define ETH_SourceAddrFilter_Disable ((u32)0x00000000) #define IS_ETH_SOURCE_ADDR_FILTER(CMD) (((CMD) == ETH_SourceAddrFilter_Normal_Enable) || \ ((CMD) == ETH_SourceAddrFilter_Inverse_Enable) || \ ((CMD) == ETH_SourceAddrFilter_Disable)) /* ETHERNET Pass Control Frames ----------------------------------------------*/ #define ETH_PassControlFrames_BlockAll ((u32)0x00000040) /* MAC filters all control frames from reaching the application */ #define ETH_PassControlFrames_ForwardAll ((u32)0x00000080) /* MAC forwards all control frames to application even if they fail the Address Filter */ #define ETH_PassControlFrames_ForwardPassedAddrFilter ((u32)0x000000C0) /* MAC forwards control frames that pass the Address Filter. */ #define IS_ETH_CONTROL_FRAMES(PASS) (((PASS) == ETH_PassControlFrames_BlockAll) || \ ((PASS) == ETH_PassControlFrames_ForwardAll) || \ ((PASS) == ETH_PassControlFrames_ForwardPassedAddrFilter)) /* ETHERNET Broadcast Frames Reception ---------------------------------------*/ #define ETH_BroadcastFramesReception_Enable ((u32)0x00000000) #define ETH_BroadcastFramesReception_Disable ((u32)0x00000020) #define IS_ETH_BROADCAST_FRAMES_RECEPTION(CMD) (((CMD) == ETH_BroadcastFramesReception_Enable) || \ ((CMD) == ETH_BroadcastFramesReception_Disable)) /* ETHERNET Destination Addr Filter ------------------------------------------*/ #define ETH_DestinationAddrFilter_Normal ((u32)0x00000000) #define ETH_DestinationAddrFilter_Inverse ((u32)0x00000008) #define IS_ETH_DESTINATION_ADDR_FILTER(FILTER) (((FILTER) == ETH_DestinationAddrFilter_Normal) || \ ((FILTER) == ETH_DestinationAddrFilter_Inverse)) /* ETHERNET Promiscuous Mode -------------------------------------------------*/ #define ETH_PromiscuousMode_Enable ((u32)0x00000001) #define ETH_PromiscuousMode_Disable ((u32)0x00000000) #define IS_ETH_PROMISCUOUS_MODE(CMD) (((CMD) == ETH_PromiscuousMode_Enable) || \ ((CMD) == ETH_PromiscuousMode_Disable)) /* ETHERNET multicast frames filter --------------------------------------------*/ #define ETH_MulticastFramesFilter_PerfectHashTable ((u32)0x00000404) #define ETH_MulticastFramesFilter_HashTable ((u32)0x00000004) #define ETH_MulticastFramesFilter_Perfect ((u32)0x00000000) #define ETH_MulticastFramesFilter_None ((u32)0x00000010) #define IS_ETH_MULTICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_MulticastFramesFilter_PerfectHashTable) || \ ((FILTER) == ETH_MulticastFramesFilter_HashTable) || \ ((FILTER) == ETH_MulticastFramesFilter_Perfect) || \ ((FILTER) == ETH_MulticastFramesFilter_None)) /* ETHERNET unicast frames filter --------------------------------------------*/ #define ETH_UnicastFramesFilter_PerfectHashTable ((u32)0x00000402) #define ETH_UnicastFramesFilter_HashTable ((u32)0x00000002) #define ETH_UnicastFramesFilter_Perfect ((u32)0x00000000) #define IS_ETH_UNICAST_FRAMES_FILTER(FILTER) (((FILTER) == ETH_UnicastFramesFilter_PerfectHashTable) || \ ((FILTER) == ETH_UnicastFramesFilter_HashTable) || \ ((FILTER) == ETH_UnicastFramesFilter_Perfect)) /* ETHERNET Pause Time ------------------------------------------------*/ #define IS_ETH_PAUSE_TIME(TIME) ((TIME) <= 0xFFFF) /* ETHERNET Zero Quanta Pause ------------------------------------------------*/ #define ETH_ZeroQuantaPause_Enable ((u32)0x00000000) #define ETH_ZeroQuantaPause_Disable ((u32)0x00000080) #define IS_ETH_ZEROQUANTA_PAUSE(CMD) (((CMD) == ETH_ZeroQuantaPause_Enable) || \ ((CMD) == ETH_ZeroQuantaPause_Disable)) /* ETHERNET Pause Low Threshold ----------------------------------------------*/ #define ETH_PauseLowThreshold_Minus4 ((u32)0x00000000) /* Pause time minus 4 slot times */ #define ETH_PauseLowThreshold_Minus28 ((u32)0x00000010) /* Pause time minus 28 slot times */ #define ETH_PauseLowThreshold_Minus144 ((u32)0x00000020) /* Pause time minus 144 slot times */ #define ETH_PauseLowThreshold_Minus256 ((u32)0x00000030) /* Pause time minus 256 slot times */ #define IS_ETH_PAUSE_LOW_THRESHOLD(THRESHOLD) (((THRESHOLD) == ETH_PauseLowThreshold_Minus4) || \ ((THRESHOLD) == ETH_PauseLowThreshold_Minus28) || \ ((THRESHOLD) == ETH_PauseLowThreshold_Minus144) || \ ((THRESHOLD) == ETH_PauseLowThreshold_Minus256)) /* ETHERNET Unicast Pause Frame Detect ---------------------------------------*/ #define ETH_UnicastPauseFrameDetect_Enable ((u32)0x00000008) #define ETH_UnicastPauseFrameDetect_Disable ((u32)0x00000000) #define IS_ETH_UNICAST_PAUSE_FRAME_DETECT(CMD) (((CMD) == ETH_UnicastPauseFrameDetect_Enable) || \ ((CMD) == ETH_UnicastPauseFrameDetect_Disable)) /* ETHERNET Receive Flow Control ---------------------------------------------*/ #define ETH_ReceiveFlowControl_Enable ((u32)0x00000004) #define ETH_ReceiveFlowControl_Disable ((u32)0x00000000) #define IS_ETH_RECEIVE_FLOWCONTROL(CMD) (((CMD) == ETH_ReceiveFlowControl_Enable) || \ ((CMD) == ETH_ReceiveFlowControl_Disable)) /* ETHERNET Transmit Flow Control --------------------------------------------*/ #define ETH_TransmitFlowControl_Enable ((u32)0x00000002) #define ETH_TransmitFlowControl_Disable ((u32)0x00000000) #define IS_ETH_TRANSMIT_FLOWCONTROL(CMD) (((CMD) == ETH_TransmitFlowControl_Enable) || \ ((CMD) == ETH_TransmitFlowControl_Disable)) /* ETHERNET VLAN Tag Comparison ----------------------------------------------*/ #define ETH_VLANTagComparison_12Bit ((u32)0x00010000) #define ETH_VLANTagComparison_16Bit ((u32)0x00000000) #define IS_ETH_VLAN_TAG_COMPARISON(COMPARISON) (((COMPARISON) == ETH_VLANTagComparison_12Bit) || \ ((COMPARISON) == ETH_VLANTagComparison_16Bit)) #define IS_ETH_VLAN_TAG_IDENTIFIER(IDENTIFIER) ((IDENTIFIER) <= 0xFFFF) /* ETHERNET MAC Flags ---------------------------------------------------*/ #define ETH_MAC_FLAG_TST ((u32)0x00000200) /* Time stamp trigger flag (on MAC) */ #define ETH_MAC_FLAG_MMCT ((u32)0x00000040) /* MMC transmit flag */ #define ETH_MAC_FLAG_MMCR ((u32)0x00000020) /* MMC receive flag */ #define ETH_MAC_FLAG_MMC ((u32)0x00000010) /* MMC flag (on MAC) */ #define ETH_MAC_FLAG_PMT ((u32)0x00000008) /* PMT flag (on MAC) */ #define IS_ETH_MAC_GET_FLAG(FLAG) (((FLAG) == ETH_MAC_FLAG_TST) || ((FLAG) == ETH_MAC_FLAG_MMCT) || \ ((FLAG) == ETH_MAC_FLAG_MMCR) || ((FLAG) == ETH_MAC_FLAG_MMC) || \ ((FLAG) == ETH_MAC_FLAG_PMT)) /* ETHERNET MAC Interrupts ---------------------------------------------------*/ #define ETH_MAC_IT_TST ((u32)0x00000200) /* Time stamp trigger interrupt (on MAC) */ #define ETH_MAC_IT_MMCT ((u32)0x00000040) /* MMC transmit interrupt */ #define ETH_MAC_IT_MMCR ((u32)0x00000020) /* MMC receive interrupt */ #define ETH_MAC_IT_MMC ((u32)0x00000010) /* MMC interrupt (on MAC) */ #define ETH_MAC_IT_PMT ((u32)0x00000008) /* PMT interrupt (on MAC) */ #define IS_ETH_MAC_IT(IT) ((((IT) & (u32)0xFFFFFDF7) == 0x00) && ((IT) != 0x00)) #define IS_ETH_MAC_GET_IT(IT) (((IT) == ETH_MAC_IT_TST) || ((IT) == ETH_MAC_IT_MMCT) || \ ((IT) == ETH_MAC_IT_MMCR) || ((IT) == ETH_MAC_IT_MMC) || \ ((IT) == ETH_MAC_IT_PMT)) /* ETHERNET MAC addresses ----------------------------------------------------*/ #define ETH_MAC_Address0 ((u32)0x00000000) #define ETH_MAC_Address1 ((u32)0x00000008) #define ETH_MAC_Address2 ((u32)0x00000010) #define ETH_MAC_Address3 ((u32)0x00000018) #define IS_ETH_MAC_ADDRESS0123(ADDRESS) (((ADDRESS) == ETH_MAC_Address0) || \ ((ADDRESS) == ETH_MAC_Address1) || \ ((ADDRESS) == ETH_MAC_Address2) || \ ((ADDRESS) == ETH_MAC_Address3)) #define IS_ETH_MAC_ADDRESS123(ADDRESS) (((ADDRESS) == ETH_MAC_Address1) || \ ((ADDRESS) == ETH_MAC_Address2) || \ ((ADDRESS) == ETH_MAC_Address3)) /* ETHERNET MAC addresses filter: SA/DA filed of received frames ------------*/ #define ETH_MAC_AddressFilter_SA ((u32)0x00000000) #define ETH_MAC_AddressFilter_DA ((u32)0x00000008) #define IS_ETH_MAC_ADDRESS_FILTER(FILTER) (((FILTER) == ETH_MAC_AddressFilter_SA) || \ ((FILTER) == ETH_MAC_AddressFilter_DA)) /* ETHERNET MAC addresses filter: Mask bytes ---------------------------------*/ #define ETH_MAC_AddressMask_Byte6 ((u32)0x20000000) /* Mask MAC Address high reg bits [15:8] */ #define ETH_MAC_AddressMask_Byte5 ((u32)0x10000000) /* Mask MAC Address high reg bits [7:0] */ #define ETH_MAC_AddressMask_Byte4 ((u32)0x08000000) /* Mask MAC Address low reg bits [31:24] */ #define ETH_MAC_AddressMask_Byte3 ((u32)0x04000000) /* Mask MAC Address low reg bits [23:16] */ #define ETH_MAC_AddressMask_Byte2 ((u32)0x02000000) /* Mask MAC Address low reg bits [15:8] */ #define ETH_MAC_AddressMask_Byte1 ((u32)0x01000000) /* Mask MAC Address low reg bits [70] */ #define IS_ETH_MAC_ADDRESS_MASK(MASK) (((MASK) == ETH_MAC_AddressMask_Byte6) || \ ((MASK) == ETH_MAC_AddressMask_Byte5) || \ ((MASK) == ETH_MAC_AddressMask_Byte4) || \ ((MASK) == ETH_MAC_AddressMask_Byte3) || \ ((MASK) == ETH_MAC_AddressMask_Byte2) || \ ((MASK) == ETH_MAC_AddressMask_Byte1)) /*----------------------------------------------------------------------------*/ /* Ethernet DMA Desciptors defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET DMA Tx descriptor flags --------------------------------------------------------*/ #define IS_ETH_DMATxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMATxDesc_OWN) || \ ((FLAG) == ETH_DMATxDesc_IC) || \ ((FLAG) == ETH_DMATxDesc_LS) || \ ((FLAG) == ETH_DMATxDesc_FS) || \ ((FLAG) == ETH_DMATxDesc_DC) || \ ((FLAG) == ETH_DMATxDesc_DP) || \ ((FLAG) == ETH_DMATxDesc_TTSE) || \ ((FLAG) == ETH_DMATxDesc_TER) || \ ((FLAG) == ETH_DMATxDesc_TCH) || \ ((FLAG) == ETH_DMATxDesc_TTSS) || \ ((FLAG) == ETH_DMATxDesc_IHE) || \ ((FLAG) == ETH_DMATxDesc_ES) || \ ((FLAG) == ETH_DMATxDesc_JT) || \ ((FLAG) == ETH_DMATxDesc_FF) || \ ((FLAG) == ETH_DMATxDesc_PCE) || \ ((FLAG) == ETH_DMATxDesc_LCA) || \ ((FLAG) == ETH_DMATxDesc_NC) || \ ((FLAG) == ETH_DMATxDesc_LCO) || \ ((FLAG) == ETH_DMATxDesc_EC) || \ ((FLAG) == ETH_DMATxDesc_VF) || \ ((FLAG) == ETH_DMATxDesc_CC) || \ ((FLAG) == ETH_DMATxDesc_ED) || \ ((FLAG) == ETH_DMATxDesc_UF) || \ ((FLAG) == ETH_DMATxDesc_DB)) /* ETHERNET DMA Tx descriptor segment ----------------------------------------*/ #define ETH_DMATxDesc_LastSegment ((u32)0x40000000) /* Last Segment */ #define ETH_DMATxDesc_FirstSegment ((u32)0x20000000) /* First Segment */ #define IS_ETH_DMA_TXDESC_SEGMENT(SEGMENT) (((SEGMENT) == ETH_DMATxDesc_LastSegment) || \ ((SEGMENT) == ETH_DMATxDesc_FirstSegment)) /* ETHERNET DMA Tx descriptor Checksum Insertion Control --------------------*/ #define ETH_DMATxDesc_ChecksumByPass ((u32)0x00000000) /* Checksum engine bypass */ #define ETH_DMATxDesc_ChecksumIPV4Header ((u32)0x00400000) /* IPv4 header checksum insertion */ #define ETH_DMATxDesc_ChecksumTCPUDPICMPSegment ((u32)0x00800000) /* TCP/UDP/ICMP checksum insertion. Pseudo header checksum is assumed to be present */ #define ETH_DMATxDesc_ChecksumTCPUDPICMPFull ((u32)0x00C00000) /* TCP/UDP/ICMP checksum fully in hardware including pseudo header */ #define IS_ETH_DMA_TXDESC_CHECKSUM(CHECKSUM) (((CHECKSUM) == ETH_DMATxDesc_ChecksumByPass) || \ ((CHECKSUM) == ETH_DMATxDesc_ChecksumIPV4Header) || \ ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPSegment) || \ ((CHECKSUM) == ETH_DMATxDesc_ChecksumTCPUDPICMPFull)) /* ETHERNET DMA Tx Desciptor buffer size */ #define IS_ETH_DMATxDESC_BUFFER_SIZE(SIZE) ((SIZE) <= 0x1FFF) /* ETHERNET DMA Rx descriptor flags --------------------------------------------------------*/ #define IS_ETH_DMARxDESC_GET_FLAG(FLAG) (((FLAG) == ETH_DMARxDesc_OWN) || \ ((FLAG) == ETH_DMARxDesc_AFM) || \ ((FLAG) == ETH_DMARxDesc_ES) || \ ((FLAG) == ETH_DMARxDesc_DE) || \ ((FLAG) == ETH_DMARxDesc_SAF) || \ ((FLAG) == ETH_DMARxDesc_LE) || \ ((FLAG) == ETH_DMARxDesc_OE) || \ ((FLAG) == ETH_DMARxDesc_VLAN) || \ ((FLAG) == ETH_DMARxDesc_FS) || \ ((FLAG) == ETH_DMARxDesc_LS) || \ ((FLAG) == ETH_DMARxDesc_IPV4HCE) || \ ((FLAG) == ETH_DMARxDesc_RxLongFrame) || \ ((FLAG) == ETH_DMARxDesc_LC) || \ ((FLAG) == ETH_DMARxDesc_FT) || \ ((FLAG) == ETH_DMARxDesc_RWT) || \ ((FLAG) == ETH_DMARxDesc_RE) || \ ((FLAG) == ETH_DMARxDesc_DBE) || \ ((FLAG) == ETH_DMARxDesc_CE) || \ ((FLAG) == ETH_DMARxDesc_MAMPCE)) /* ETHERNET DMA Rx descriptor buffers ---------------------------------------*/ #define ETH_DMARxDesc_Buffer1 ((u32)0x00000000) /* DMA Rx Desc Buffer1 */ #define ETH_DMARxDesc_Buffer2 ((u32)0x00000001) /* DMA Rx Desc Buffer2 */ #define IS_ETH_DMA_RXDESC_BUFFER(BUFFER) (((BUFFER) == ETH_DMARxDesc_Buffer1) || \ ((BUFFER) == ETH_DMARxDesc_Buffer2)) /*----------------------------------------------------------------------------*/ /* Ethernet DMA defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET Drop TCP/IP Checksum Error Frame ---------------------------------*/ #define ETH_DropTCPIPChecksumErrorFrame_Enable ((u32)0x00000000) #define ETH_DropTCPIPChecksumErrorFrame_Disable ((u32)0x04000000) #define IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(CMD) (((CMD) == ETH_DropTCPIPChecksumErrorFrame_Enable) || \ ((CMD) == ETH_DropTCPIPChecksumErrorFrame_Disable)) /* ETHERNET Receive Store Forward --------------------------------------------*/ #define ETH_ReceiveStoreForward_Enable ((u32)0x02000000) #define ETH_ReceiveStoreForward_Disable ((u32)0x00000000) #define IS_ETH_RECEIVE_STORE_FORWARD(CMD) (((CMD) == ETH_ReceiveStoreForward_Enable) || \ ((CMD) == ETH_ReceiveStoreForward_Disable)) /* ETHERNET Flush Received Frame ---------------------------------------------*/ #define ETH_FlushReceivedFrame_Enable ((u32)0x00000000) #define ETH_FlushReceivedFrame_Disable ((u32)0x01000000) #define IS_ETH_FLUSH_RECEIVE_FRAME(CMD) (((CMD) == ETH_FlushReceivedFrame_Enable) || \ ((CMD) == ETH_FlushReceivedFrame_Disable)) /* ETHERNET Transmit Store Forward -------------------------------------------*/ #define ETH_TransmitStoreForward_Enable ((u32)0x00200000) #define ETH_TransmitStoreForward_Disable ((u32)0x00000000) #define IS_ETH_TRANSMIT_STORE_FORWARD(CMD) (((CMD) == ETH_TransmitStoreForward_Enable) || \ ((CMD) == ETH_TransmitStoreForward_Disable)) /* ETHERNET Transmit Threshold Control ---------------------------------------*/ #define ETH_TransmitThresholdControl_64Bytes ((u32)0x00000000) /* threshold level of the MTL Transmit FIFO is 64 Bytes */ #define ETH_TransmitThresholdControl_128Bytes ((u32)0x00004000) /* threshold level of the MTL Transmit FIFO is 128 Bytes */ #define ETH_TransmitThresholdControl_192Bytes ((u32)0x00008000) /* threshold level of the MTL Transmit FIFO is 192 Bytes */ #define ETH_TransmitThresholdControl_256Bytes ((u32)0x0000C000) /* threshold level of the MTL Transmit FIFO is 256 Bytes */ #define ETH_TransmitThresholdControl_40Bytes ((u32)0x00010000) /* threshold level of the MTL Transmit FIFO is 40 Bytes */ #define ETH_TransmitThresholdControl_32Bytes ((u32)0x00014000) /* threshold level of the MTL Transmit FIFO is 32 Bytes */ #define ETH_TransmitThresholdControl_24Bytes ((u32)0x00018000) /* threshold level of the MTL Transmit FIFO is 24 Bytes */ #define ETH_TransmitThresholdControl_16Bytes ((u32)0x0001C000) /* threshold level of the MTL Transmit FIFO is 16 Bytes */ #define IS_ETH_TRANSMIT_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_TransmitThresholdControl_64Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_128Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_192Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_256Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_40Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_32Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_24Bytes) || \ ((THRESHOLD) == ETH_TransmitThresholdControl_16Bytes)) /* ETHERNET Forward Error Frames ---------------------------------------------*/ #define ETH_ForwardErrorFrames_Enable ((u32)0x00000080) #define ETH_ForwardErrorFrames_Disable ((u32)0x00000000) #define IS_ETH_FORWARD_ERROR_FRAMES(CMD) (((CMD) == ETH_ForwardErrorFrames_Enable) || \ ((CMD) == ETH_ForwardErrorFrames_Disable)) /* ETHERNET Forward Undersized Good Frames -----------------------------------*/ #define ETH_ForwardUndersizedGoodFrames_Enable ((u32)0x00000040) #define ETH_ForwardUndersizedGoodFrames_Disable ((u32)0x00000000) #define IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(CMD) (((CMD) == ETH_ForwardUndersizedGoodFrames_Enable) || \ ((CMD) == ETH_ForwardUndersizedGoodFrames_Disable)) /* ETHERNET Receive Threshold Control ----------------------------------------*/ #define ETH_ReceiveThresholdControl_64Bytes ((u32)0x00000000) /* threshold level of the MTL Receive FIFO is 64 Bytes */ #define ETH_ReceiveThresholdControl_32Bytes ((u32)0x00000008) /* threshold level of the MTL Receive FIFO is 32 Bytes */ #define ETH_ReceiveThresholdControl_96Bytes ((u32)0x00000010) /* threshold level of the MTL Receive FIFO is 96 Bytes */ #define ETH_ReceiveThresholdControl_128Bytes ((u32)0x00000018) /* threshold level of the MTL Receive FIFO is 128 Bytes */ #define IS_ETH_RECEIVE_THRESHOLD_CONTROL(THRESHOLD) (((THRESHOLD) == ETH_ReceiveThresholdControl_64Bytes) || \ ((THRESHOLD) == ETH_ReceiveThresholdControl_32Bytes) || \ ((THRESHOLD) == ETH_ReceiveThresholdControl_96Bytes) || \ ((THRESHOLD) == ETH_ReceiveThresholdControl_128Bytes)) /* ETHERNET Second Frame Operate ---------------------------------------------*/ #define ETH_SecondFrameOperate_Enable ((u32)0x00000004) #define ETH_SecondFrameOperate_Disable ((u32)0x00000000) #define IS_ETH_SECOND_FRAME_OPERATE(CMD) (((CMD) == ETH_SecondFrameOperate_Enable) || \ ((CMD) == ETH_SecondFrameOperate_Disable)) /* ETHERNET Address Aligned Beats --------------------------------------------*/ #define ETH_AddressAlignedBeats_Enable ((u32)0x02000000) #define ETH_AddressAlignedBeats_Disable ((u32)0x00000000) #define IS_ETH_ADDRESS_ALIGNED_BEATS(CMD) (((CMD) == ETH_AddressAlignedBeats_Enable) || \ ((CMD) == ETH_AddressAlignedBeats_Disable)) /* ETHERNET Fixed Burst ------------------------------------------------------*/ #define ETH_FixedBurst_Enable ((u32)0x00010000) #define ETH_FixedBurst_Disable ((u32)0x00000000) #define IS_ETH_FIXED_BURST(CMD) (((CMD) == ETH_FixedBurst_Enable) || \ ((CMD) == ETH_FixedBurst_Disable)) /* ETHERNET Rx DMA Burst Length ----------------------------------------------*/ #define ETH_RxDMABurstLength_1Beat ((u32)0x00020000) /* maximum number of beats to be transferred in one RxDMA transaction is 1 */ #define ETH_RxDMABurstLength_2Beat ((u32)0x00040000) /* maximum number of beats to be transferred in one RxDMA transaction is 2 */ #define ETH_RxDMABurstLength_4Beat ((u32)0x00080000) /* maximum number of beats to be transferred in one RxDMA transaction is 4 */ #define ETH_RxDMABurstLength_8Beat ((u32)0x00100000) /* maximum number of beats to be transferred in one RxDMA transaction is 8 */ #define ETH_RxDMABurstLength_16Beat ((u32)0x00200000) /* maximum number of beats to be transferred in one RxDMA transaction is 16 */ #define ETH_RxDMABurstLength_32Beat ((u32)0x00400000) /* maximum number of beats to be transferred in one RxDMA transaction is 32 */ #define ETH_RxDMABurstLength_4xPBL_4Beat ((u32)0x01020000) /* maximum number of beats to be transferred in one RxDMA transaction is 4 */ #define ETH_RxDMABurstLength_4xPBL_8Beat ((u32)0x01040000) /* maximum number of beats to be transferred in one RxDMA transaction is 8 */ #define ETH_RxDMABurstLength_4xPBL_16Beat ((u32)0x01080000) /* maximum number of beats to be transferred in one RxDMA transaction is 16 */ #define ETH_RxDMABurstLength_4xPBL_32Beat ((u32)0x01100000) /* maximum number of beats to be transferred in one RxDMA transaction is 32 */ #define ETH_RxDMABurstLength_4xPBL_64Beat ((u32)0x01200000) /* maximum number of beats to be transferred in one RxDMA transaction is 64 */ #define ETH_RxDMABurstLength_4xPBL_128Beat ((u32)0x01400000) /* maximum number of beats to be transferred in one RxDMA transaction is 128 */ #define IS_ETH_RXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_RxDMABurstLength_1Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_2Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_8Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_16Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_32Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_4Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_8Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_16Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_32Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_64Beat) || \ ((LENGTH) == ETH_RxDMABurstLength_4xPBL_128Beat)) /* ETHERNET Tx DMA Burst Length ----------------------------------------------*/ #define ETH_TxDMABurstLength_1Beat ((u32)0x00000100) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */ #define ETH_TxDMABurstLength_2Beat ((u32)0x00000200) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */ #define ETH_TxDMABurstLength_4Beat ((u32)0x00000400) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */ #define ETH_TxDMABurstLength_8Beat ((u32)0x00000800) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */ #define ETH_TxDMABurstLength_16Beat ((u32)0x00001000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */ #define ETH_TxDMABurstLength_32Beat ((u32)0x00002000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */ #define ETH_TxDMABurstLength_4xPBL_4Beat ((u32)0x01000100) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */ #define ETH_TxDMABurstLength_4xPBL_8Beat ((u32)0x01000200) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */ #define ETH_TxDMABurstLength_4xPBL_16Beat ((u32)0x01000400) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */ #define ETH_TxDMABurstLength_4xPBL_32Beat ((u32)0x01000800) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */ #define ETH_TxDMABurstLength_4xPBL_64Beat ((u32)0x01001000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */ #define ETH_TxDMABurstLength_4xPBL_128Beat ((u32)0x01002000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */ #define IS_ETH_TXDMA_BURST_LENGTH(LENGTH) (((LENGTH) == ETH_TxDMABurstLength_1Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_2Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_8Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_16Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_32Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_4Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_8Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_16Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_32Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_64Beat) || \ ((LENGTH) == ETH_TxDMABurstLength_4xPBL_128Beat)) /* ETHERNET DMA Desciptor SkipLength */ #define IS_ETH_DMA_DESC_SKIP_LENGTH(LENGTH) ((LENGTH) <= 0x1F) /* ETHERNET DMA Arbitration --------------------------------------------------*/ #define ETH_DMAArbitration_RoundRobin_RxTx_1_1 ((u32)0x00000000) #define ETH_DMAArbitration_RoundRobin_RxTx_2_1 ((u32)0x00004000) #define ETH_DMAArbitration_RoundRobin_RxTx_3_1 ((u32)0x00008000) #define ETH_DMAArbitration_RoundRobin_RxTx_4_1 ((u32)0x0000C000) #define ETH_DMAArbitration_RxPriorTx ((u32)0x00000002) #define IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(RATIO) (((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_1_1) || \ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_2_1) || \ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_3_1) || \ ((RATIO) == ETH_DMAArbitration_RoundRobin_RxTx_4_1) || \ ((RATIO) == ETH_DMAArbitration_RxPriorTx)) /* ETHERNET DMA Flags ---------------------------------------------------*/ #define ETH_DMA_FLAG_TST ((u32)0x20000000) /* Time-stamp trigger interrupt (on DMA) */ #define ETH_DMA_FLAG_PMT ((u32)0x10000000) /* PMT interrupt (on DMA) */ #define ETH_DMA_FLAG_MMC ((u32)0x08000000) /* MMC interrupt (on DMA) */ #define ETH_DMA_FLAG_DataTransferError ((u32)0x00800000) /* Error bits 0-Rx DMA, 1-Tx DMA */ #define ETH_DMA_FLAG_ReadWriteError ((u32)0x01000000) /* Error bits 0-write trnsf, 1-read transfr */ #define ETH_DMA_FLAG_AccessError ((u32)0x02000000) /* Error bits 0-data buffer, 1-desc. access */ #define ETH_DMA_FLAG_NIS ((u32)0x00010000) /* Normal interrupt summary flag */ #define ETH_DMA_FLAG_AIS ((u32)0x00008000) /* Abnormal interrupt summary flag */ #define ETH_DMA_FLAG_ER ((u32)0x00004000) /* Early receive flag */ #define ETH_DMA_FLAG_FBE ((u32)0x00002000) /* Fatal bus error flag */ #define ETH_DMA_FLAG_ET ((u32)0x00000400) /* Early transmit flag */ #define ETH_DMA_FLAG_RWT ((u32)0x00000200) /* Receive watchdog timeout flag */ #define ETH_DMA_FLAG_RPS ((u32)0x00000100) /* Receive process stopped flag */ #define ETH_DMA_FLAG_RBU ((u32)0x00000080) /* Receive buffer unavailable flag */ #define ETH_DMA_FLAG_R ((u32)0x00000040) /* Receive flag */ #define ETH_DMA_FLAG_TU ((u32)0x00000020) /* Underflow flag */ #define ETH_DMA_FLAG_RO ((u32)0x00000010) /* Overflow flag */ #define ETH_DMA_FLAG_TJT ((u32)0x00000008) /* Transmit jabber timeout flag */ #define ETH_DMA_FLAG_TBU ((u32)0x00000004) /* Transmit buffer unavailable flag */ #define ETH_DMA_FLAG_TPS ((u32)0x00000002) /* Transmit process stopped flag */ #define ETH_DMA_FLAG_T ((u32)0x00000001) /* Transmit flag */ #define IS_ETH_DMA_FLAG(FLAG) ((((FLAG) & (u32)0xFFFE1800) == 0x00) && ((FLAG) != 0x00)) #define IS_ETH_DMA_GET_FLAG(FLAG) (((FLAG) == ETH_DMA_FLAG_TST) || ((FLAG) == ETH_DMA_FLAG_PMT) || \ ((FLAG) == ETH_DMA_FLAG_MMC) || ((FLAG) == ETH_DMA_FLAG_DataTransferError) || \ ((FLAG) == ETH_DMA_FLAG_ReadWriteError) || ((FLAG) == ETH_DMA_FLAG_AccessError) || \ ((FLAG) == ETH_DMA_FLAG_NIS) || ((FLAG) == ETH_DMA_FLAG_AIS) || \ ((FLAG) == ETH_DMA_FLAG_ER) || ((FLAG) == ETH_DMA_FLAG_FBE) || \ ((FLAG) == ETH_DMA_FLAG_ET) || ((FLAG) == ETH_DMA_FLAG_RWT) || \ ((FLAG) == ETH_DMA_FLAG_RPS) || ((FLAG) == ETH_DMA_FLAG_RBU) || \ ((FLAG) == ETH_DMA_FLAG_R) || ((FLAG) == ETH_DMA_FLAG_TU) || \ ((FLAG) == ETH_DMA_FLAG_RO) || ((FLAG) == ETH_DMA_FLAG_TJT) || \ ((FLAG) == ETH_DMA_FLAG_TBU) || ((FLAG) == ETH_DMA_FLAG_TPS) || \ ((FLAG) == ETH_DMA_FLAG_T)) /* ETHERNET DMA Interrupts ---------------------------------------------------*/ #define ETH_DMA_IT_TST ((u32)0x20000000) /* Time-stamp trigger interrupt (on DMA) */ #define ETH_DMA_IT_PMT ((u32)0x10000000) /* PMT interrupt (on DMA) */ #define ETH_DMA_IT_MMC ((u32)0x08000000) /* MMC interrupt (on DMA) */ #define ETH_DMA_IT_NIS ((u32)0x00010000) /* Normal interrupt summary */ #define ETH_DMA_IT_AIS ((u32)0x00008000) /* Abnormal interrupt summary */ #define ETH_DMA_IT_ER ((u32)0x00004000) /* Early receive interrupt */ #define ETH_DMA_IT_FBE ((u32)0x00002000) /* Fatal bus error interrupt */ #define ETH_DMA_IT_ET ((u32)0x00000400) /* Early transmit interrupt */ #define ETH_DMA_IT_RWT ((u32)0x00000200) /* Receive watchdog timeout interrupt */ #define ETH_DMA_IT_RPS ((u32)0x00000100) /* Receive process stopped interrupt */ #define ETH_DMA_IT_RBU ((u32)0x00000080) /* Receive buffer unavailable interrupt */ #define ETH_DMA_IT_R ((u32)0x00000040) /* Receive interrupt */ #define ETH_DMA_IT_TU ((u32)0x00000020) /* Underflow interrupt */ #define ETH_DMA_IT_RO ((u32)0x00000010) /* Overflow interrupt */ #define ETH_DMA_IT_TJT ((u32)0x00000008) /* Transmit jabber timeout interrupt */ #define ETH_DMA_IT_TBU ((u32)0x00000004) /* Transmit buffer unavailable interrupt */ #define ETH_DMA_IT_TPS ((u32)0x00000002) /* Transmit process stopped interrupt */ #define ETH_DMA_IT_T ((u32)0x00000001) /* Transmit interrupt */ #define IS_ETH_DMA_IT(IT) ((((IT) & (u32)0xFFFE1800) == 0x00) && ((IT) != 0x00)) #define IS_ETH_DMA_GET_IT(IT) (((IT) == ETH_DMA_IT_TST) || ((IT) == ETH_DMA_IT_PMT) || \ ((IT) == ETH_DMA_IT_MMC) || ((IT) == ETH_DMA_IT_NIS) || \ ((IT) == ETH_DMA_IT_AIS) || ((IT) == ETH_DMA_IT_ER) || \ ((IT) == ETH_DMA_IT_FBE) || ((IT) == ETH_DMA_IT_ET) || \ ((IT) == ETH_DMA_IT_RWT) || ((IT) == ETH_DMA_IT_RPS) || \ ((IT) == ETH_DMA_IT_RBU) || ((IT) == ETH_DMA_IT_R) || \ ((IT) == ETH_DMA_IT_TU) || ((IT) == ETH_DMA_IT_RO) || \ ((IT) == ETH_DMA_IT_TJT) || ((IT) == ETH_DMA_IT_TBU) || \ ((IT) == ETH_DMA_IT_TPS) || ((IT) == ETH_DMA_IT_T)) /* ETHERNET DMA transmit process state --------------------------------------------------------*/ #define ETH_DMA_TransmitProcess_Stopped ((u32)0x00000000) /* Stopped - Reset or Stop Tx Command issued */ #define ETH_DMA_TransmitProcess_Fetching ((u32)0x00100000) /* Running - fetching the Tx descriptor */ #define ETH_DMA_TransmitProcess_Waiting ((u32)0x00200000) /* Running - waiting for status */ #define ETH_DMA_TransmitProcess_Reading ((u32)0x00300000) /* Running - reading the data from host memory */ #define ETH_DMA_TransmitProcess_Suspended ((u32)0x00600000) /* Suspended - Tx Desciptor unavailabe */ #define ETH_DMA_TransmitProcess_Closing ((u32)0x00700000) /* Running - closing Rx descriptor */ /* ETHERNET DMA receive process state --------------------------------------------------------*/ #define ETH_DMA_ReceiveProcess_Stopped ((u32)0x00000000) /* Stopped - Reset or Stop Rx Command issued */ #define ETH_DMA_ReceiveProcess_Fetching ((u32)0x00020000) /* Running - fetching the Rx descriptor */ #define ETH_DMA_ReceiveProcess_Waiting ((u32)0x00060000) /* Running - waiting for packet */ #define ETH_DMA_ReceiveProcess_Suspended ((u32)0x00080000) /* Suspended - Rx Desciptor unavailable */ #define ETH_DMA_ReceiveProcess_Closing ((u32)0x000A0000) /* Running - closing descriptor */ #define ETH_DMA_ReceiveProcess_Queuing ((u32)0x000E0000) /* Running - queuing the recieve frame into host memory */ /* ETHERNET DMA overflow --------------------------------------------------------*/ #define ETH_DMA_Overflow_RxFIFOCounter ((u32)0x10000000) /* Overflow bit for FIFO overflow counter */ #define ETH_DMA_Overflow_MissedFrameCounter ((u32)0x00010000) /* Overflow bit for missed frame counter */ #define IS_ETH_DMA_GET_OVERFLOW(OVERFLOW) (((OVERFLOW) == ETH_DMA_Overflow_RxFIFOCounter) || \ ((OVERFLOW) == ETH_DMA_Overflow_MissedFrameCounter)) /*----------------------------------------------------------------------------*/ /* Ethernet PMT defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET PMT Flags --------------------------------------------------------*/ #define ETH_PMT_FLAG_WUFFRPR ((u32)0x80000000) /* Wake-Up Frame Filter Register Poniter Reset */ #define ETH_PMT_FLAG_WUFR ((u32)0x00000040) /* Wake-Up Frame Received */ #define ETH_PMT_FLAG_MPR ((u32)0x00000020) /* Magic Packet Received */ #define IS_ETH_PMT_GET_FLAG(FLAG) (((FLAG) == ETH_PMT_FLAG_WUFR) || \ ((FLAG) == ETH_PMT_FLAG_MPR)) /*----------------------------------------------------------------------------*/ /* Ethernet MMC defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET MMC Tx Interrupts */ #define ETH_MMC_IT_TGF ((u32)0x00200000) /* When Tx good frame counter reaches half the maximum value */ #define ETH_MMC_IT_TGFMSC ((u32)0x00008000) /* When Tx good multi col counter reaches half the maximum value */ #define ETH_MMC_IT_TGFSC ((u32)0x00004000) /* When Tx good single col counter reaches half the maximum value */ /* ETHERNET MMC Rx Interrupts */ #define ETH_MMC_IT_RGUF ((u32)0x10020000) /* When Rx good unicast frames counter reaches half the maximum value */ #define ETH_MMC_IT_RFAE ((u32)0x10000040) /* When Rx alignment error counter reaches half the maximum value */ #define ETH_MMC_IT_RFCE ((u32)0x10000020) /* When Rx crc error counter reaches half the maximum value */ #define IS_ETH_MMC_IT(IT) (((((IT) & (u32)0xFFDF3FFF) == 0x00) || (((IT) & (u32)0xEFFDFF9F) == 0x00)) && \ ((IT) != 0x00)) #define IS_ETH_MMC_GET_IT(IT) (((IT) == ETH_MMC_IT_TGF) || ((IT) == ETH_MMC_IT_TGFMSC) || \ ((IT) == ETH_MMC_IT_TGFSC) || ((IT) == ETH_MMC_IT_RGUF) || \ ((IT) == ETH_MMC_IT_RFAE) || ((IT) == ETH_MMC_IT_RFCE)) /* ETHERNET MMC Registers */ #define ETH_MMCCR ((u32)0x00000100) /* MMC CR register */ #define ETH_MMCRIR ((u32)0x00000104) /* MMC RIR register */ #define ETH_MMCTIR ((u32)0x00000108) /* MMC TIR register */ #define ETH_MMCRIMR ((u32)0x0000010C) /* MMC RIMR register */ #define ETH_MMCTIMR ((u32)0x00000110) /* MMC TIMR register */ #define ETH_MMCTGFSCCR ((u32)0x0000014C) /* MMC TGFSCCR register */ #define ETH_MMCTGFMSCCR ((u32)0x00000150) /* MMC TGFMSCCR register */ #define ETH_MMCTGFCR ((u32)0x00000168) /* MMC TGFCR register */ #define ETH_MMCRFCECR ((u32)0x00000194) /* MMC RFCECR register */ #define ETH_MMCRFAECR ((u32)0x00000198) /* MMC RFAECR register */ #define ETH_MMCRGUFCR ((u32)0x000001C4) /* MMC RGUFCR register */ /* ETHERNET MMC registers */ #define IS_ETH_MMC_REGISTER(REG) (((REG) == ETH_MMCCR) || ((REG) == ETH_MMCRIR) || \ ((REG) == ETH_MMCTIR) || ((REG) == ETH_MMCRIMR) || \ ((REG) == ETH_MMCTIMR) || ((REG) == ETH_MMCTGFSCCR) || \ ((REG) == ETH_MMCTGFMSCCR) || ((REG) == ETH_MMCTGFCR) || \ ((REG) == ETH_MMCRFCECR) || ((REG) == ETH_MMCRFAECR) || \ ((REG) == ETH_MMCRGUFCR)) /*----------------------------------------------------------------------------*/ /* Ethernet PTP defines */ /*----------------------------------------------------------------------------*/ /* ETHERNET PTP time update method -------------------------------------------*/ #define ETH_PTP_FineUpdate ((u32)0x00000001) /* Fine Update method */ #define ETH_PTP_CoarseUpdate ((u32)0x00000000) /* Coarse Update method */ #define IS_ETH_PTP_UPDATE(UPDATE) (((UPDATE) == ETH_PTP_FineUpdate) || \ ((UPDATE) == ETH_PTP_CoarseUpdate)) /* ETHERNET PTP Flags --------------------------------------------------------*/ #define ETH_PTP_FLAG_TSARU ((u32)0x00000020) /* Addend Register Update */ #define ETH_PTP_FLAG_TSITE ((u32)0x00000010) /* Time Stamp Interrupt Trigger */ #define ETH_PTP_FLAG_TSSTU ((u32)0x00000008) /* Time Stamp Update */ #define ETH_PTP_FLAG_TSSTI ((u32)0x00000004) /* Time Stamp Initialize */ #define IS_ETH_PTP_GET_FLAG(FLAG) (((FLAG) == ETH_PTP_FLAG_TSARU) || \ ((FLAG) == ETH_PTP_FLAG_TSITE) || \ ((FLAG) == ETH_PTP_FLAG_TSSTU) || \ ((FLAG) == ETH_PTP_FLAG_TSSTI)) /* ETHERNET PTP subsecond increment */ #define IS_ETH_PTP_SUBSECOND_INCREMENT(SUBSECOND) ((SUBSECOND) <= 0xFF) /* ETHERNET PTP time sign ----------------------------------------------------*/ #define ETH_PTP_PositiveTime ((u32)0x00000000) /* Positive time value */ #define ETH_PTP_NegativeTime ((u32)0x80000000) /* Negative time value */ #define IS_ETH_PTP_TIME_SIGN(SIGN) (((SIGN) == ETH_PTP_PositiveTime) || \ ((SIGN) == ETH_PTP_NegativeTime)) /* ETHERNET PTP time stamp low update */ #define IS_ETH_PTP_TIME_STAMP_UPDATE_SUBSECOND(SUBSECOND) ((SUBSECOND) <= 0x7FFFFFFF) /* ETHERNET PTP registers */ #define ETH_PTPTSCR ((u32)0x00000700) /* PTP TSCR register */ #define ETH_PTPSSIR ((u32)0x00000704) /* PTP SSIR register */ #define ETH_PTPTSHR ((u32)0x00000708) /* PTP TSHR register */ #define ETH_PTPTSLR ((u32)0x0000070C) /* PTP TSLR register */ #define ETH_PTPTSHUR ((u32)0x00000710) /* PTP TSHUR register */ #define ETH_PTPTSLUR ((u32)0x00000714) /* PTP TSLUR register */ #define ETH_PTPTSAR ((u32)0x00000718) /* PTP TSAR register */ #define ETH_PTPTTHR ((u32)0x0000071C) /* PTP TTHR register */ #define ETH_PTPTTLR ((u32)0x00000720) /* PTP TTLR register */ #define IS_ETH_PTP_REGISTER(REG) (((REG) == ETH_PTPTSCR) || ((REG) == ETH_PTPSSIR) || \ ((REG) == ETH_PTPTSHR) || ((REG) == ETH_PTPTSLR) || \ ((REG) == ETH_PTPTSHUR) || ((REG) == ETH_PTPTSLUR) || \ ((REG) == ETH_PTPTSAR) || ((REG) == ETH_PTPTTHR) || \ ((REG) == ETH_PTPTTLR)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void ETH_DeInit(void); u32 ETH_Init(ETH_InitTypeDef* ETH_InitStruct, u16 PHYAddress); void ETH_StructInit(ETH_InitTypeDef* ETH_InitStruct); void ETH_SoftwareReset(void); FlagStatus ETH_GetSoftwareResetStatus(void); void ETH_Start(void); u32 ETH_HandleTxPkt(u32 addr, u16 FrameLength); u32 ETH_HandleRxPkt(u32 addr); u32 ETH_GetRxPktSize(void); void ETH_DropRxPkt(void); /*--------------------------------- PHY ------------------------------------*/ u16 ETH_ReadPHYRegister(u16 PHYAddress, u16 PHYReg); u32 ETH_WritePHYRegister(u16 PHYAddress, u16 PHYReg, u16 PHYValue); u32 ETH_PHYLoopBackCmd(u16 PHYAddress, FunctionalState NewState); /*--------------------------------- MAC ------------------------------------*/ void ETH_MACTransmissionCmd(FunctionalState NewState); void ETH_MACReceptionCmd(FunctionalState NewState); FlagStatus ETH_GetFlowControlBusyStatus(void); void ETH_InitiatePauseControlFrame(void); void ETH_BackPressureActivationCmd(FunctionalState NewState); FlagStatus ETH_GetMACFlagStatus(u32 ETH_MAC_FLAG); ITStatus ETH_GetMACITStatus(u32 ETH_MAC_IT); void ETH_MACITConfig(u32 ETH_MAC_IT, FunctionalState NewState); void ETH_MACAddressConfig(u32 MacAddr, u8 *Addr); void ETH_GetMACAddress(u32 MacAddr, u8 *Addr); void ETH_MACAddressPerfectFilterCmd(u32 MacAddr, FunctionalState NewState); void ETH_MACAddressFilterConfig(u32 MacAddr, u32 Filter); void ETH_MACAddressMaskBytesFilterConfig(u32 MacAddr, u32 MaskByte); /*----------------------- DMA Tx/Rx descriptors ----------------------------*/ void ETH_DMATxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, u8 *TxBuff, u32 TxBuffCount); void ETH_DMATxDescRingInit(ETH_DMADESCTypeDef *DMATxDescTab, u8 *TxBuff1, u8 *TxBuff2, u32 TxBuffCount); FlagStatus ETH_GetDMATxDescFlagStatus(ETH_DMADESCTypeDef *DMATxDesc, u32 ETH_DMATxDescFlag); u32 ETH_GetDMATxDescCollisionCount(ETH_DMADESCTypeDef *DMATxDesc); void ETH_SetDMATxDescOwnBit(ETH_DMADESCTypeDef *DMATxDesc); void ETH_DMATxDescTransmitITConfig(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescFrameSegmentConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 DMATxDesc_FrameSegment); void ETH_DMATxDescChecksumInsertionConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 DMATxDesc_Checksum); void ETH_DMATxDescCRCCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescShortFramePaddingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescTimeStampCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState); void ETH_DMATxDescBufferSizeConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 BufferSize1, u32 BufferSize2); void ETH_DMARxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff, u32 RxBuffCount); void ETH_DMARxDescRingInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff1, u8 *RxBuff2, u32 RxBuffCount); FlagStatus ETH_GetDMARxDescFlagStatus(ETH_DMADESCTypeDef *DMARxDesc, u32 ETH_DMARxDescFlag); void ETH_SetDMARxDescOwnBit(ETH_DMADESCTypeDef *DMARxDesc); u32 ETH_GetDMARxDescFrameLength(ETH_DMADESCTypeDef *DMARxDesc); void ETH_DMARxDescReceiveITConfig(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState); void ETH_DMARxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState); void ETH_DMARxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState); u32 ETH_GetDMARxDescBufferSize(ETH_DMADESCTypeDef *DMARxDesc, u32 DMARxDesc_Buffer); /*--------------------------------- DMA ------------------------------------*/ FlagStatus ETH_GetDMAFlagStatus(u32 ETH_DMA_FLAG); void ETH_DMAClearFlag(u32 ETH_DMA_FLAG); ITStatus ETH_GetDMAITStatus(u32 ETH_DMA_IT); void ETH_DMAClearITPendingBit(u32 ETH_DMA_IT); u32 ETH_GetTransmitProcessState(void); u32 ETH_GetReceiveProcessState(void); void ETH_FlushTransmitFIFO(void); FlagStatus ETH_GetFlushTransmitFIFOStatus(void); void ETH_DMATransmissionCmd(FunctionalState NewState); void ETH_DMAReceptionCmd(FunctionalState NewState); void ETH_DMAITConfig(u32 ETH_DMA_IT, FunctionalState NewState); FlagStatus ETH_GetDMAOverflowStatus(u32 ETH_DMA_Overflow); u32 ETH_GetRxOverflowMissedFrameCounter(void); u32 ETH_GetBufferUnavailableMissedFrameCounter(void); u32 ETH_GetCurrentTxDescStartAddress(void); u32 ETH_GetCurrentRxDescStartAddress(void); u32 ETH_GetCurrentTxBufferAddress(void); u32 ETH_GetCurrentRxBufferAddress(void); void ETH_ResumeDMATransmission(void); void ETH_ResumeDMAReception(void); /*--------------------------------- PMT ------------------------------------*/ void ETH_ResetWakeUpFrameFilterRegisterPointer(void); void ETH_SetWakeUpFrameFilterRegister(u32 *Buffer); void ETH_GlobalUnicastWakeUpCmd(FunctionalState NewState); FlagStatus ETH_GetPMTFlagStatus(u32 ETH_PMT_FLAG); void ETH_WakeUpFrameDetectionCmd(FunctionalState NewState); void ETH_MagicPacketDetectionCmd(FunctionalState NewState); void ETH_PowerDownCmd(FunctionalState NewState); /*--------------------------------- MMC ------------------------------------*/ void ETH_MMCCounterFreezeCmd(FunctionalState NewState); void ETH_MMCResetOnReadCmd(FunctionalState NewState); void ETH_MMCCounterRolloverCmd(FunctionalState NewState); void ETH_MMCCountersReset(void); void ETH_MMCITConfig(u32 ETH_MMC_IT, FunctionalState NewState); ITStatus ETH_GetMMCITStatus(u32 ETH_MMC_IT); u32 ETH_GetMMCRegister(u32 ETH_MMCReg); /*--------------------------------- PTP ------------------------------------*/ u32 ETH_HandlePTPTxPkt(u8 *ppkt, u16 FrameLength, u32 *PTPTxTab); u32 ETH_HandlePTPRxPkt(u8 *ppkt, u32 *PTPRxTab); void ETH_DMAPTPTxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, ETH_DMADESCTypeDef *DMAPTPTxDescTab, u8* TxBuff, u32 TxBuffCount); void ETH_DMAPTPRxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, ETH_DMADESCTypeDef *DMAPTPRxDescTab, u8 *RxBuff, u32 RxBuffCount); void ETH_EnablePTPTimeStampAddend(void); void ETH_EnablePTPTimeStampInterruptTrigger(void); void ETH_EnablePTPTimeStampUpdate(void); void ETH_InitializePTPTimeStamp(void); void ETH_PTPUpdateMethodConfig(u32 UpdateMethod); void ETH_PTPTimeStampCmd(FunctionalState NewState); FlagStatus ETH_GetPTPFlagStatus(u32 ETH_PTP_FLAG); void ETH_SetPTPSubSecondIncrement(u32 SubSecondValue); void ETH_SetPTPTimeStampUpdate(u32 Sign, u32 SecondValue, u32 SubSecondValue); void ETH_SetPTPTimeStampAddend(u32 Value); void ETH_SetPTPTargetTime(u32 HighValue, u32 LowValue); u32 ETH_GetPTPRegister(u32 ETH_PTPReg); #endif /* __STM32FXXX_ETH_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32fxxx_eth.h
C
oos
79,357
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_rtc.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * RTC firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_RTC_H #define __STM32F10x_RTC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* RTC interrupts define -----------------------------------------------------*/ #define RTC_IT_OW ((u16)0x0004) /* Overflow interrupt */ #define RTC_IT_ALR ((u16)0x0002) /* Alarm interrupt */ #define RTC_IT_SEC ((u16)0x0001) /* Second interrupt */ #define IS_RTC_IT(IT) (((IT & (u16)0xFFF8) == 0x00) && (IT != 0x00)) #define IS_RTC_GET_IT(IT) ((IT == RTC_IT_OW) || (IT == RTC_IT_ALR) || \ (IT == RTC_IT_SEC)) /* RTC interrupts flags ------------------------------------------------------*/ #define RTC_FLAG_RTOFF ((u16)0x0020) /* RTC Operation OFF flag */ #define RTC_FLAG_RSF ((u16)0x0008) /* Registers Synchronized flag */ #define RTC_FLAG_OW ((u16)0x0004) /* Overflow flag */ #define RTC_FLAG_ALR ((u16)0x0002) /* Alarm flag */ #define RTC_FLAG_SEC ((u16)0x0001) /* Second flag */ #define IS_RTC_CLEAR_FLAG(FLAG) (((FLAG & (u16)0xFFF0) == 0x00) && (FLAG != 0x00)) #define IS_RTC_GET_FLAG(FLAG) ((FLAG == RTC_FLAG_RTOFF) || (FLAG == RTC_FLAG_RSF) || \ (FLAG == RTC_FLAG_OW) || (FLAG == RTC_FLAG_ALR) || \ (FLAG == RTC_FLAG_SEC)) #define IS_RTC_PRESCALER(PRESCALER) (PRESCALER <= 0xFFFFF) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void RTC_ITConfig(u16 RTC_IT, FunctionalState NewState); void RTC_EnterConfigMode(void); void RTC_ExitConfigMode(void); u32 RTC_GetCounter(void); void RTC_SetCounter(u32 CounterValue); u32 RTC_GetPrescaler(void); void RTC_SetPrescaler(u32 PrescalerValue); void RTC_SetAlarm(u32 AlarmValue); u32 RTC_GetDivider(void); void RTC_WaitForLastTask(void); void RTC_WaitForSynchro(void); FlagStatus RTC_GetFlagStatus(u16 RTC_FLAG); void RTC_ClearFlag(u16 RTC_FLAG); ITStatus RTC_GetITStatus(u16 RTC_IT); void RTC_ClearITPendingBit(u16 RTC_IT); #endif /* __STM32F10x_RTC_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_rtc.h
C
oos
3,747
/** ****************************************************************************** * @file stm32f10x_dac.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the DAC firmware * library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_DAC_H #define __STM32F10x_DAC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup DAC * @{ */ /** @defgroup DAC_Exported_Types * @{ */ /** * @brief DAC Init structure definition */ typedef struct { uint32_t DAC_Trigger; uint32_t DAC_WaveGeneration; uint32_t DAC_LFSRUnmask_TriangleAmplitude; uint32_t DAC_OutputBuffer; }DAC_InitTypeDef; /** * @} */ /** @defgroup DAC_Exported_Constants * @{ */ /** @defgroup DAC_trigger_selection * @{ */ #define DAC_Trigger_None ((uint32_t)0x00000000) #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) #define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C) #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) #define DAC_Trigger_T5_TRGO ((uint32_t)0x0000001C) #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) #define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C) #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) #define DAC_Trigger_Software ((uint32_t)0x0000003C) #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \ ((TRIGGER) == DAC_Trigger_T6_TRGO) || \ ((TRIGGER) == DAC_Trigger_T8_TRGO) || \ ((TRIGGER) == DAC_Trigger_T7_TRGO) || \ ((TRIGGER) == DAC_Trigger_T5_TRGO) || \ ((TRIGGER) == DAC_Trigger_T2_TRGO) || \ ((TRIGGER) == DAC_Trigger_T4_TRGO) || \ ((TRIGGER) == DAC_Trigger_Ext_IT9) || \ ((TRIGGER) == DAC_Trigger_Software)) /** * @} */ /** @defgroup DAC_wave_generation * @{ */ #define DAC_WaveGeneration_None ((uint32_t)0x00000000) #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040) #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080) #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \ ((WAVE) == DAC_WaveGeneration_Noise) || \ ((WAVE) == DAC_WaveGeneration_Triangle)) /** * @} */ /** @defgroup DAC_noise_wave_generation_mask_triangle_wave_generation_max_amplitude * @{ */ #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \ ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \ ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \ ((VALUE) == DAC_TriangleAmplitude_1) || \ ((VALUE) == DAC_TriangleAmplitude_3) || \ ((VALUE) == DAC_TriangleAmplitude_7) || \ ((VALUE) == DAC_TriangleAmplitude_15) || \ ((VALUE) == DAC_TriangleAmplitude_31) || \ ((VALUE) == DAC_TriangleAmplitude_63) || \ ((VALUE) == DAC_TriangleAmplitude_127) || \ ((VALUE) == DAC_TriangleAmplitude_255) || \ ((VALUE) == DAC_TriangleAmplitude_511) || \ ((VALUE) == DAC_TriangleAmplitude_1023) || \ ((VALUE) == DAC_TriangleAmplitude_2047) || \ ((VALUE) == DAC_TriangleAmplitude_4095)) /** * @} */ /** @defgroup DAC_output_buffer * @{ */ #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000) #define DAC_OutputBuffer_Disable ((uint32_t)0x00000002) #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \ ((STATE) == DAC_OutputBuffer_Disable)) /** * @} */ /** @defgroup DAC_Channel_selection * @{ */ #define DAC_Channel_1 ((uint32_t)0x00000000) #define DAC_Channel_2 ((uint32_t)0x00000010) #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \ ((CHANNEL) == DAC_Channel_2)) /** * @} */ /** @defgroup DAC_data_alignement * @{ */ #define DAC_Align_12b_R ((uint32_t)0x00000000) #define DAC_Align_12b_L ((uint32_t)0x00000004) #define DAC_Align_8b_R ((uint32_t)0x00000008) #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \ ((ALIGN) == DAC_Align_12b_L) || \ ((ALIGN) == DAC_Align_8b_R)) /** * @} */ /** @defgroup DAC_wave_generation * @{ */ #define DAC_Wave_Noise ((uint32_t)0x00000040) #define DAC_Wave_Triangle ((uint32_t)0x00000080) #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \ ((WAVE) == DAC_Wave_Triangle)) /** * @} */ /** @defgroup DAC_data * @{ */ #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) /** * @} */ /** * @} */ /** @defgroup DAC_Exported_Macros * @{ */ /** * @} */ /** @defgroup DAC_Exported_Functions * @{ */ void DAC_DeInit(void); void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct); void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct); void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState); void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState); void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState); void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data); void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel); #endif /*__STM32F10x_DAC_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_dac.h
C
oos
10,271
/** ****************************************************************************** * @file stm32f10x_flash.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the FLASH * firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_FLASH_H #define __STM32F10x_FLASH_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup FLASH * @{ */ /** @defgroup FLASH_Exported_Types * @{ */ /** * @brief FLASH Status */ typedef enum { FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE, FLASH_TIMEOUT }FLASH_Status; /** * @} */ /** @defgroup FLASH_Exported_Constants * @{ */ /** @defgroup Flash_Latency * @{ */ #define FLASH_Latency_0 ((uint32_t)0x00000000) /* FLASH Zero Latency cycle */ #define FLASH_Latency_1 ((uint32_t)0x00000001) /* FLASH One Latency cycle */ #define FLASH_Latency_2 ((uint32_t)0x00000002) /* FLASH Two Latency cycles */ #define IS_FLASH_LATENCY(LATENCY) (((LATENCY) == FLASH_Latency_0) || \ ((LATENCY) == FLASH_Latency_1) || \ ((LATENCY) == FLASH_Latency_2)) /** * @} */ /** @defgroup Half_Cycle_Enable_Disable * @{ */ #define FLASH_HalfCycleAccess_Enable ((uint32_t)0x00000008) /* FLASH Half Cycle Enable */ #define FLASH_HalfCycleAccess_Disable ((uint32_t)0x00000000) /* FLASH Half Cycle Disable */ #define IS_FLASH_HALFCYCLEACCESS_STATE(STATE) (((STATE) == FLASH_HalfCycleAccess_Enable) || \ ((STATE) == FLASH_HalfCycleAccess_Disable)) /** * @} */ /** @defgroup Prefetch_Buffer_Enable_Disable * @{ */ #define FLASH_PrefetchBuffer_Enable ((uint32_t)0x00000010) /* FLASH Prefetch Buffer Enable */ #define FLASH_PrefetchBuffer_Disable ((uint32_t)0x00000000) /* FLASH Prefetch Buffer Disable */ #define IS_FLASH_PREFETCHBUFFER_STATE(STATE) (((STATE) == FLASH_PrefetchBuffer_Enable) || \ ((STATE) == FLASH_PrefetchBuffer_Disable)) /** * @} */ /** @defgroup Option_Bytes_Write_Protection * @{ */ /* Values to be used with STM32F10Xxx Medium-density devices: FLASH memory density ranges between 32 and 128 Kbytes with page size equal to 1 Kbytes */ #define FLASH_WRProt_Pages0to3 ((uint32_t)0x00000001) /* Write protection of page 0 to 3 */ #define FLASH_WRProt_Pages4to7 ((uint32_t)0x00000002) /* Write protection of page 4 to 7 */ #define FLASH_WRProt_Pages8to11 ((uint32_t)0x00000004) /* Write protection of page 8 to 11 */ #define FLASH_WRProt_Pages12to15 ((uint32_t)0x00000008) /* Write protection of page 12 to 15 */ #define FLASH_WRProt_Pages16to19 ((uint32_t)0x00000010) /* Write protection of page 16 to 19 */ #define FLASH_WRProt_Pages20to23 ((uint32_t)0x00000020) /* Write protection of page 20 to 23 */ #define FLASH_WRProt_Pages24to27 ((uint32_t)0x00000040) /* Write protection of page 24 to 27 */ #define FLASH_WRProt_Pages28to31 ((uint32_t)0x00000080) /* Write protection of page 28 to 31 */ #define FLASH_WRProt_Pages32to35 ((uint32_t)0x00000100) /* Write protection of page 32 to 35 */ #define FLASH_WRProt_Pages36to39 ((uint32_t)0x00000200) /* Write protection of page 36 to 39 */ #define FLASH_WRProt_Pages40to43 ((uint32_t)0x00000400) /* Write protection of page 40 to 43 */ #define FLASH_WRProt_Pages44to47 ((uint32_t)0x00000800) /* Write protection of page 44 to 47 */ #define FLASH_WRProt_Pages48to51 ((uint32_t)0x00001000) /* Write protection of page 48 to 51 */ #define FLASH_WRProt_Pages52to55 ((uint32_t)0x00002000) /* Write protection of page 52 to 55 */ #define FLASH_WRProt_Pages56to59 ((uint32_t)0x00004000) /* Write protection of page 56 to 59 */ #define FLASH_WRProt_Pages60to63 ((uint32_t)0x00008000) /* Write protection of page 60 to 63 */ #define FLASH_WRProt_Pages64to67 ((uint32_t)0x00010000) /* Write protection of page 64 to 67 */ #define FLASH_WRProt_Pages68to71 ((uint32_t)0x00020000) /* Write protection of page 68 to 71 */ #define FLASH_WRProt_Pages72to75 ((uint32_t)0x00040000) /* Write protection of page 72 to 75 */ #define FLASH_WRProt_Pages76to79 ((uint32_t)0x00080000) /* Write protection of page 76 to 79 */ #define FLASH_WRProt_Pages80to83 ((uint32_t)0x00100000) /* Write protection of page 80 to 83 */ #define FLASH_WRProt_Pages84to87 ((uint32_t)0x00200000) /* Write protection of page 84 to 87 */ #define FLASH_WRProt_Pages88to91 ((uint32_t)0x00400000) /* Write protection of page 88 to 91 */ #define FLASH_WRProt_Pages92to95 ((uint32_t)0x00800000) /* Write protection of page 92 to 95 */ #define FLASH_WRProt_Pages96to99 ((uint32_t)0x01000000) /* Write protection of page 96 to 99 */ #define FLASH_WRProt_Pages100to103 ((uint32_t)0x02000000) /* Write protection of page 100 to 103 */ #define FLASH_WRProt_Pages104to107 ((uint32_t)0x04000000) /* Write protection of page 104 to 107 */ #define FLASH_WRProt_Pages108to111 ((uint32_t)0x08000000) /* Write protection of page 108 to 111 */ #define FLASH_WRProt_Pages112to115 ((uint32_t)0x10000000) /* Write protection of page 112 to 115 */ #define FLASH_WRProt_Pages116to119 ((uint32_t)0x20000000) /* Write protection of page 115 to 119 */ #define FLASH_WRProt_Pages120to123 ((uint32_t)0x40000000) /* Write protection of page 120 to 123 */ #define FLASH_WRProt_Pages124to127 ((uint32_t)0x80000000) /* Write protection of page 124 to 127 */ /* Values to be used with STM32F10Xxx High-density devices: FLASH memory density ranges between 256 and 512 Kbytes with page size equal to 2 Kbytes */ #define FLASH_WRProt_Pages0to1 ((uint32_t)0x00000001) /* Write protection of page 0 to 1 */ #define FLASH_WRProt_Pages2to3 ((uint32_t)0x00000002) /* Write protection of page 2 to 3 */ #define FLASH_WRProt_Pages4to5 ((uint32_t)0x00000004) /* Write protection of page 4 to 5 */ #define FLASH_WRProt_Pages6to7 ((uint32_t)0x00000008) /* Write protection of page 6 to 7 */ #define FLASH_WRProt_Pages8to9 ((uint32_t)0x00000010) /* Write protection of page 8 to 9 */ #define FLASH_WRProt_Pages10to11 ((uint32_t)0x00000020) /* Write protection of page 10 to 11 */ #define FLASH_WRProt_Pages12to13 ((uint32_t)0x00000040) /* Write protection of page 12 to 13 */ #define FLASH_WRProt_Pages14to15 ((uint32_t)0x00000080) /* Write protection of page 14 to 15 */ #define FLASH_WRProt_Pages16to17 ((uint32_t)0x00000100) /* Write protection of page 16 to 17 */ #define FLASH_WRProt_Pages18to19 ((uint32_t)0x00000200) /* Write protection of page 18 to 19 */ #define FLASH_WRProt_Pages20to21 ((uint32_t)0x00000400) /* Write protection of page 20 to 21 */ #define FLASH_WRProt_Pages22to23 ((uint32_t)0x00000800) /* Write protection of page 22 to 23 */ #define FLASH_WRProt_Pages24to25 ((uint32_t)0x00001000) /* Write protection of page 24 to 25 */ #define FLASH_WRProt_Pages26to27 ((uint32_t)0x00002000) /* Write protection of page 26 to 27 */ #define FLASH_WRProt_Pages28to29 ((uint32_t)0x00004000) /* Write protection of page 28 to 29 */ #define FLASH_WRProt_Pages30to31 ((uint32_t)0x00008000) /* Write protection of page 30 to 31 */ #define FLASH_WRProt_Pages32to33 ((uint32_t)0x00010000) /* Write protection of page 32 to 33 */ #define FLASH_WRProt_Pages34to35 ((uint32_t)0x00020000) /* Write protection of page 34 to 35 */ #define FLASH_WRProt_Pages36to37 ((uint32_t)0x00040000) /* Write protection of page 36 to 37 */ #define FLASH_WRProt_Pages38to39 ((uint32_t)0x00080000) /* Write protection of page 38 to 39 */ #define FLASH_WRProt_Pages40to41 ((uint32_t)0x00100000) /* Write protection of page 40 to 41 */ #define FLASH_WRProt_Pages42to43 ((uint32_t)0x00200000) /* Write protection of page 42 to 43 */ #define FLASH_WRProt_Pages44to45 ((uint32_t)0x00400000) /* Write protection of page 44 to 45 */ #define FLASH_WRProt_Pages46to47 ((uint32_t)0x00800000) /* Write protection of page 46 to 47 */ #define FLASH_WRProt_Pages48to49 ((uint32_t)0x01000000) /* Write protection of page 48 to 49 */ #define FLASH_WRProt_Pages50to51 ((uint32_t)0x02000000) /* Write protection of page 50 to 51 */ #define FLASH_WRProt_Pages52to53 ((uint32_t)0x04000000) /* Write protection of page 52 to 53 */ #define FLASH_WRProt_Pages54to55 ((uint32_t)0x08000000) /* Write protection of page 54 to 55 */ #define FLASH_WRProt_Pages56to57 ((uint32_t)0x10000000) /* Write protection of page 56 to 57 */ #define FLASH_WRProt_Pages58to59 ((uint32_t)0x20000000) /* Write protection of page 58 to 59 */ #define FLASH_WRProt_Pages60to61 ((uint32_t)0x40000000) /* Write protection of page 60 to 61 */ #define FLASH_WRProt_Pages62to255 ((uint32_t)0x80000000) /* Write protection of page 62 to 255 */ #define FLASH_WRProt_AllPages ((uint32_t)0xFFFFFFFF) /* Write protection of all Pages */ #define IS_FLASH_WRPROT_PAGE(PAGE) (((PAGE) != 0x00000000)) #define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x0807FFFF)) #define IS_OB_DATA_ADDRESS(ADDRESS) (((ADDRESS) == 0x1FFFF804) || ((ADDRESS) == 0x1FFFF806)) /** * @} */ /** @defgroup Option_Bytes_IWatchdog * @{ */ #define OB_IWDG_SW ((uint16_t)0x0001) /* Software IWDG selected */ #define OB_IWDG_HW ((uint16_t)0x0000) /* Hardware IWDG selected */ #define IS_OB_IWDG_SOURCE(SOURCE) (((SOURCE) == OB_IWDG_SW) || ((SOURCE) == OB_IWDG_HW)) /** * @} */ /** @defgroup Option_Bytes_nRST_STOP * @{ */ #define OB_STOP_NoRST ((uint16_t)0x0002) /* No reset generated when entering in STOP */ #define OB_STOP_RST ((uint16_t)0x0000) /* Reset generated when entering in STOP */ #define IS_OB_STOP_SOURCE(SOURCE) (((SOURCE) == OB_STOP_NoRST) || ((SOURCE) == OB_STOP_RST)) /** * @} */ /** @defgroup Option_Bytes_nRST_STDBY * @{ */ #define OB_STDBY_NoRST ((uint16_t)0x0004) /* No reset generated when entering in STANDBY */ #define OB_STDBY_RST ((uint16_t)0x0000) /* Reset generated when entering in STANDBY */ #define IS_OB_STDBY_SOURCE(SOURCE) (((SOURCE) == OB_STDBY_NoRST) || ((SOURCE) == OB_STDBY_RST)) /** * @} */ /** @defgroup FLASH_Interrupts * @{ */ #define FLASH_IT_ERROR ((uint32_t)0x00000400) /* FPEC error interrupt source */ #define FLASH_IT_EOP ((uint32_t)0x00001000) /* End of FLASH Operation Interrupt source */ #define IS_FLASH_IT(IT) ((((IT) & (uint32_t)0xFFFFEBFF) == 0x00000000) && (((IT) != 0x00000000))) /** * @} */ /** @defgroup FLASH_Flags * @{ */ #define FLASH_FLAG_BSY ((uint32_t)0x00000001) /* FLASH Busy flag */ #define FLASH_FLAG_EOP ((uint32_t)0x00000020) /* FLASH End of Operation flag */ #define FLASH_FLAG_PGERR ((uint32_t)0x00000004) /* FLASH Program error flag */ #define FLASH_FLAG_WRPRTERR ((uint32_t)0x00000010) /* FLASH Write protected error flag */ #define FLASH_FLAG_OPTERR ((uint32_t)0x00000001) /* FLASH Option Byte error flag */ #define IS_FLASH_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFFCA) == 0x00000000) && ((FLAG) != 0x00000000)) #define IS_FLASH_GET_FLAG(FLAG) (((FLAG) == FLASH_FLAG_BSY) || ((FLAG) == FLASH_FLAG_EOP) || \ ((FLAG) == FLASH_FLAG_PGERR) || ((FLAG) == FLASH_FLAG_WRPRTERR) || \ ((FLAG) == FLASH_FLAG_OPTERR)) /** * @} */ /** * @} */ /** @defgroup FLASH_Exported_Macros * @{ */ /** * @} */ /** @defgroup FLASH_Exported_Functions * @{ */ void FLASH_SetLatency(uint32_t FLASH_Latency); void FLASH_HalfCycleAccessCmd(uint32_t FLASH_HalfCycleAccess); void FLASH_PrefetchBufferCmd(uint32_t FLASH_PrefetchBuffer); void FLASH_Unlock(void); void FLASH_Lock(void); FLASH_Status FLASH_ErasePage(uint32_t Page_Address); FLASH_Status FLASH_EraseAllPages(void); FLASH_Status FLASH_EraseOptionBytes(void); FLASH_Status FLASH_ProgramWord(uint32_t Address, uint32_t Data); FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data); FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data); FLASH_Status FLASH_EnableWriteProtection(uint32_t FLASH_Pages); FLASH_Status FLASH_ReadOutProtection(FunctionalState NewState); FLASH_Status FLASH_UserOptionByteConfig(uint16_t OB_IWDG, uint16_t OB_STOP, uint16_t OB_STDBY); uint32_t FLASH_GetUserOptionByte(void); uint32_t FLASH_GetWriteProtectionOptionByte(void); FlagStatus FLASH_GetReadOutProtectionStatus(void); FlagStatus FLASH_GetPrefetchBufferStatus(void); void FLASH_ITConfig(uint16_t FLASH_IT, FunctionalState NewState); FlagStatus FLASH_GetFlagStatus(uint16_t FLASH_FLAG); void FLASH_ClearFlag(uint16_t FLASH_FLAG); FLASH_Status FLASH_GetStatus(void); FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout); #endif /* __STM32F10x_FLASH_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_flash.h
C
oos
14,446
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32f_eth_conf.h * Author : MCD Application Team * Version : VX.Y.Z * Date : mm/dd/2008 * Description : ETHERNET firmware library configuration file. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F_ETH_CONF_H #define __STM32F_ETH_CONF_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_type.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Uncomment the line below to compile the ETHERNET firmware library in DEBUG mode, this will expanse the "assert_param" macro in the firmware library code (see "Exported macro" section below) */ /*#define ETH_DEBUG 1*/ /* Comment the line below to disable the specific peripheral inclusion */ /************************************* ETHERNET *******************************/ #define _ETH_MAC //#define _ETH_PTP //#define _ETH_MMC #define _ETH_DMA /* Exported macro ------------------------------------------------------------*/ #ifdef ETH_DEBUG /******************************************************************************* * Macro Name : eth_assert_param * Description : The eth_assert_param macro is used for ethernet function's parameters * check. * It is used only if the ethernet library is compiled in DEBUG mode. * Input : - expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source * line number of the call that failed. * If expr is true, it returns no value. * Return : None *******************************************************************************/ #define eth_assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(u8* file, u32 line); #else #define eth_assert_param(expr) ((void)0) #endif /* ETH_DEBUG */ #endif /* __STM32F_ETH_CONF_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32fxxx_eth_conf.h
C
oos
3,046
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : lcd.h * Author : MCD Application Team * Date First Issued : mm/dd/yyyy * Description : This file contains all the functions prototypes for the * lcd software driver. ******************************************************************************** * History: * mm/dd/yyyy ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __LCD_H #define __LCD_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_lib.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* LCD Registers */ #define R0 0x00 #define R1 0x01 #define R2 0x02 #define R3 0x03 #define R5 0x05 #define R6 0x06 #define R13 0x0D #define R14 0x0E #define R15 0x0F #define R16 0x10 #define R17 0x11 #define R18 0x12 #define R19 0x13 #define R20 0x14 #define R21 0x15 #define R22 0x16 #define R23 0x17 #define R24 0x18 #define R25 0x19 #define R26 0x1A #define R27 0x1B #define R28 0x1C #define R29 0x1D #define R30 0x1E #define R31 0x1F #define R32 0x20 #define R36 0x24 #define R37 0x25 #define R40 0x28 #define R43 0x2B #define R45 0x2D #define R49 0x31 #define R50 0x32 #define R51 0x33 #define R52 0x34 #define R53 0x35 #define R55 0x37 #define R59 0x3B #define R60 0x3C #define R61 0x3D #define R62 0x3E #define R63 0x3F #define R64 0x40 #define R65 0x41 #define R66 0x42 #define R67 0x43 #define R68 0x44 #define R69 0x45 #define R70 0x46 #define R71 0x47 #define R72 0x48 #define R73 0x49 #define R74 0x4A #define R75 0x4B #define R76 0x4C #define R77 0x4D #define R78 0x4E #define R79 0x4F #define R80 0x50 #define R118 0x76 #define R134 0x86 #define R135 0x87 #define R136 0x88 #define R137 0x89 #define R139 0x8B #define R140 0x8C #define R141 0x8D #define R143 0x8F #define R144 0x90 #define R145 0x91 #define R146 0x92 #define R147 0x93 #define R148 0x94 #define R149 0x95 #define R150 0x96 #define R151 0x97 #define R152 0x98 #define R153 0x99 #define R154 0x9A #define R157 0x9D #define R192 0xC0 #define R193 0xC1 /* LCD Control pins */ #define CtrlPin_NCS GPIO_Pin_2 /* PB.02 */ #define CtrlPin_RS GPIO_Pin_7 /* PD.07 */ #define CtrlPin_NWR GPIO_Pin_15 /* PD.15 */ /* LCD color */ #define White 0xFFFF #define Black 0x0000 #define Blue 0x001F #define Orange 0x051F #define Red 0xF800 #define Magenta 0xF81F #define Green 0x07E0 #define Cyan 0x7FFF #define Yellow 0xFFE0 #define Line0 0 #define Line1 24 #define Line2 48 #define Line3 72 #define Line4 96 #define Line5 120 #define Line6 144 #define Line7 168 #define Line8 192 #define Line9 216 #define Horizontal 0x00 #define Vertical 0x01 /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ /*----- High layer function -----*/ void LCD_Init(void); void LCD_SetTextColor(vu16 Color); void LCD_SetBackColor(vu16 Color); void LCD_ClearLine(u8 Line); void LCD_Clear(void); void LCD_SetCursor(u8 Xpos, u16 Ypos); void LCD_DrawChar(u8 Xpos, u16 Ypos, uc16 *c); void LCD_DisplayChar(u8 Line, u16 Column, u8 Ascii); void LCD_DisplayStringLine(u8 Line, u8 *ptr); void LCD_DisplayString(u8 Line, u8 *ptr); void LCD_ScrollText(u8 Line, u8 *ptr); void LCD_SetDisplayWindow(u8 Xpos, u16 Ypos, u8 Height, u16 Width); void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction); void LCD_DrawRect(u8 Xpos, u16 Ypos, u8 Height, u16 Width); void LCD_DrawCircle(u8 Xpos, u16 Ypos, u16 Radius); void LCD_DrawMonoPict(uc32 *Pict); void LCD_DrawBMP(u32 BmpAddress); /*----- Medium layer function -----*/ void LCD_WriteReg(u8 LCD_Reg, u8 LCD_RegValue); u8 LCD_ReadReg(u8 LCD_Reg); void LCD_WriteRAM(u16 RGB_Code); u16 LCD_ReadRAM(void); void LCD_PowerOn(void); void LCD_DisplayOn(void); void LCD_DisplayOff(void); /*----- Low layer function -----*/ void LCD_CtrlLinesConfig(void); void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u16 CtrlPins, BitAction BitVal); void LCD_SPIConfig(void); #endif /* __LCD_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/lcd.h
C
oos
6,137
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_iwdg.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * IWDG firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_IWDG_H #define __STM32F10x_IWDG_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Write access to IWDG_PR and IWDG_RLR registers */ #define IWDG_WriteAccess_Enable ((u16)0x5555) #define IWDG_WriteAccess_Disable ((u16)0x0000) #define IS_IWDG_WRITE_ACCESS(ACCESS) ((ACCESS == IWDG_WriteAccess_Enable) || \ (ACCESS == IWDG_WriteAccess_Disable)) /* IWDG prescaler */ #define IWDG_Prescaler_4 ((u8)0x00) #define IWDG_Prescaler_8 ((u8)0x01) #define IWDG_Prescaler_16 ((u8)0x02) #define IWDG_Prescaler_32 ((u8)0x03) #define IWDG_Prescaler_64 ((u8)0x04) #define IWDG_Prescaler_128 ((u8)0x05) #define IWDG_Prescaler_256 ((u8)0x06) #define IS_IWDG_PRESCALER(PRESCALER) ((PRESCALER == IWDG_Prescaler_4) || \ (PRESCALER == IWDG_Prescaler_8) || \ (PRESCALER == IWDG_Prescaler_16) || \ (PRESCALER == IWDG_Prescaler_32) || \ (PRESCALER == IWDG_Prescaler_64) || \ (PRESCALER == IWDG_Prescaler_128)|| \ (PRESCALER == IWDG_Prescaler_256)) /* IWDG Flag */ #define IWDG_FLAG_PVU ((u16)0x0001) #define IWDG_FLAG_RVU ((u16)0x0002) #define IS_IWDG_FLAG(FLAG) ((FLAG == IWDG_FLAG_PVU) || (FLAG == IWDG_FLAG_RVU)) #define IS_IWDG_RELOAD(RELOAD) (RELOAD <= 0xFFF) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess); void IWDG_SetPrescaler(u8 IWDG_Prescaler); void IWDG_SetReload(u16 Reload); void IWDG_ReloadCounter(void); void IWDG_Enable(void); FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG); #endif /* __STM32F10x_IWDG_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_iwdg.h
C
oos
3,514
/** ****************************************************************************** * @file stm32f10x_dbgmcu.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the DBGMCU * firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_DBGMCU_H #define __STM32F10x_DBGMCU_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup DBGMCU * @{ */ /** @defgroup DBGMCU_Exported_Types * @{ */ /** * @} */ /** @defgroup DBGMCU_Exported_Constants * @{ */ #define DBGMCU_SLEEP ((uint32_t)0x00000001) #define DBGMCU_STOP ((uint32_t)0x00000002) #define DBGMCU_STANDBY ((uint32_t)0x00000004) #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFE000F8) == 0x00) && ((PERIPH) != 0x00)) /** * @} */ /** @defgroup DBGMCU_Exported_Macros * @{ */ /** * @} */ /** @defgroup DBGMCU_Exported_Functions * @{ */ uint32_t DBGMCU_GetREVID(void); uint32_t DBGMCU_GetDEVID(void); void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); #endif /* __STM32F10x_DBGMCU_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_dbgmcu.h
C
oos
2,980
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32fxxx_eth_map.h * Author : MCD Application Team * Version : VX.Y.Z * Date : mm/dd/2008 * Description : This file contains all ETHERNET peripheral register's * definitions and memory mapping. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32FXXX_ETH_MAP_H #define __STM32FXXX_ETH_MAP_H #ifndef EXT #define EXT extern #endif /* EXT */ /* Includes ------------------------------------------------------------------*/ #include "stm32fxxx_eth_conf.h" #include "stm32f10x_type.h" /* Exported types ------------------------------------------------------------*/ /******************************************************************************/ /* Ethernet Peripheral registers structures */ /******************************************************************************/ typedef struct { vu32 MACCR; vu32 MACFFR; vu32 MACHTHR; vu32 MACHTLR; vu32 MACMIIAR; vu32 MACMIIDR; vu32 MACFCR; vu32 MACVLANTR; vu32 RESERVED0[2]; vu32 MACRWUFFR; vu32 MACPMTCSR; vu32 RESERVED1[2]; vu32 MACSR; vu32 MACIMR; vu32 MACA0HR; vu32 MACA0LR; vu32 MACA1HR; vu32 MACA1LR; vu32 MACA2HR; vu32 MACA2LR; vu32 MACA3HR; vu32 MACA3LR; } ETH_MAC_TypeDef; typedef struct { vu32 MMCCR; vu32 MMCRIR; vu32 MMCTIR; vu32 MMCRIMR; vu32 MMCTIMR; vu32 RESERVED0[14]; vu32 MMCTGFSCCR; vu32 MMCTGFMSCCR; vu32 RESERVED1[5]; vu32 MMCTGFCR; vu32 RESERVED2[10]; vu32 MMCRFCECR; vu32 MMCRFAER; vu32 RESERVED3[10]; vu32 MMCRGUFCR; } ETH_MMC_TypeDef; typedef struct { vu32 PTPTSCR; vu32 PTPSSIR; vu32 PTPTSHR; vu32 PTPTSLR; vu32 PTPTSHUR; vu32 PTPTSLUR; vu32 PTPTSAR; vu32 PTPTTHR; vu32 PTPTTLR; } ETH_PTP_TypeDef; typedef struct { vu32 DMABMR; vu32 DMATPDR; vu32 DMARPDR; vu32 DMARDLAR; vu32 DMATDLAR; vu32 DMASR; vu32 DMAOMR; vu32 DMAIER; vu32 DMAMFBOCR; vu32 RESERVED0[9]; vu32 DMACHTDR; vu32 DMACHRDR; vu32 DMACHTBAR; vu32 DMACHRBAR; } ETH_DMA_TypeDef; /******************************************************************************/ /* Ethernet MAC Registers bits definitions */ /******************************************************************************/ //#define IPNAME_REGNAME_BITNAME /* BIT MASK */ /* Bit definition for Ethernet MAC Control Register register */ #define ETH_MACCR_WD ((u32)0x00800000) /* Watchdog disable */ #define ETH_MACCR_JD ((u32)0x00400000) /* Jabber disable */ #define ETH_MACCR_JFE ((u32)0x00100000) /* Jumbo frame enable */ #define ETH_MACCR_IFG ((u32)0x000E0000) /* Inter-frame gap */ #define ETH_MACCR_IFG_96Bit ((u32)0x00000000) /* Minimum IFG between frames during transmission is 96Bit */ #define ETH_MACCR_IFG_88Bit ((u32)0x00020000) /* Minimum IFG between frames during transmission is 88Bit */ #define ETH_MACCR_IFG_80Bit ((u32)0x00040000) /* Minimum IFG between frames during transmission is 80Bit */ #define ETH_MACCR_IFG_72Bit ((u32)0x00060000) /* Minimum IFG between frames during transmission is 72Bit */ #define ETH_MACCR_IFG_64Bit ((u32)0x00080000) /* Minimum IFG between frames during transmission is 64Bit */ #define ETH_MACCR_IFG_56Bit ((u32)0x000A0000) /* Minimum IFG between frames during transmission is 56Bit */ #define ETH_MACCR_IFG_48Bit ((u32)0x000C0000) /* Minimum IFG between frames during transmission is 48Bit */ #define ETH_MACCR_IFG_40Bit ((u32)0x000E0000) /* Minimum IFG between frames during transmission is 40Bit */ #define ETH_MACCR_CSD ((u32)0x00010000) /* Carrier sense disable (during transmission) */ #define ETH_MACCR_FES ((u32)0x00004000) /* Fast ethernet speed */ #define ETH_MACCR_ROD ((u32)0x00002000) /* Receive own disable */ #define ETH_MACCR_LM ((u32)0x00001000) /* loopback mode */ #define ETH_MACCR_DM ((u32)0x00000800) /* Duplex mode */ #define ETH_MACCR_IPCO ((u32)0x00000400) /* IP Checksum offload */ #define ETH_MACCR_RD ((u32)0x00000200) /* Retry disable */ #define ETH_MACCR_APCS ((u32)0x00000080) /* Automatic Pad/CRC stripping */ #define ETH_MACCR_BL ((u32)0x00000060) /* Back-off limit: random integer number (r) of slot time delays before rescheduling a transmission attempt during retries after a collision: 0 =< r <2^k */ #define ETH_MACCR_BL_10 ((u32)0x00000000) /* k = min (n, 10) */ #define ETH_MACCR_BL_8 ((u32)0x00000020) /* k = min (n, 8) */ #define ETH_MACCR_BL_4 ((u32)0x00000040) /* k = min (n, 4) */ #define ETH_MACCR_BL_1 ((u32)0x00000060) /* k = min (n, 1) */ #define ETH_MACCR_DC ((u32)0x00000010) /* Defferal check */ #define ETH_MACCR_TE ((u32)0x00000008) /* Transmitter enable */ #define ETH_MACCR_RE ((u32)0x00000004) /* Receiver enable */ /* Bit definition for Ethernet MAC Frame Filter Register */ #define ETH_MACFFR_RA ((u32)0x80000000) /* Receive all */ #define ETH_MACFFR_HPF ((u32)0x00000400) /* Hash or perfect filter */ #define ETH_MACFFR_SAF ((u32)0x00000200) /* Source address filter enable */ #define ETH_MACFFR_SAIF ((u32)0x00000100) /* SA inverse filtering */ #define ETH_MACFFR_PCF ((u32)0x000000C0) /* Pass control frames: 3 cases */ #define ETH_MACFFR_PCF_BlockAll ((u32)0x00000040) /* MAC filters all control frames from reaching the application */ #define ETH_MACFFR_PCF_ForwardAll ((u32)0x00000080) /* MAC forwards all control frames to application even if they fail the Address Filter */ #define ETH_MACFFR_PCF_ForwardPassedAddrFilter ((u32)0x000000C0) /* MAC forwards control frames that pass the Address Filter. */ #define ETH_MACFFR_BFD ((u32)0x00000020) /* Broadcast frame disable */ #define ETH_MACFFR_PAM ((u32)0x00000010) /* Pass all mutlicast */ #define ETH_MACFFR_DAIF ((u32)0x00000008) /* DA Inverse filtering */ #define ETH_MACFFR_HM ((u32)0x00000004) /* Hash multicast */ #define ETH_MACFFR_HU ((u32)0x00000002) /* Hash unicast */ #define ETH_MACFFR_PM ((u32)0x00000001) /* Promiscuous mode */ /* Bit definition for Ethernet MAC Hash Table High Register */ #define ETH_MACHTHR_HTH ((u32)0xFFFFFFFF) /* Hash table high */ /* Bit definition for Ethernet MAC Hash Table Low Register */ #define ETH_MACHTLR_HTL ((u32)0xFFFFFFFF) /* Hash table low */ /* Bit definition for Ethernet MAC MII Address Register */ #define ETH_MACMIIAR_PA ((u32)0x0000F800) /* Physical layer address */ #define ETH_MACMIIAR_MR ((u32)0x000007C0) /* MII register in the selected PHY */ #define ETH_MACMIIAR_CR ((u32)0x0000001C) /* CR clock range: 6 cases */ #define ETH_MACMIIAR_CR_Div42 ((u32)0x00000000) /* HCLK:60-72 MHz; MDC clock= HCLK/42 */ #define ETH_MACMIIAR_CR_Div16 ((u32)0x00000008) /* HCLK:20-35 MHz; MDC clock= HCLK/16 */ #define ETH_MACMIIAR_CR_Div26 ((u32)0x0000000C) /* HCLK:35-60 MHz; MDC clock= HCLK/26 */ #define ETH_MACMIIAR_MW ((u32)0x00000002) /* MII write */ #define ETH_MACMIIAR_MB ((u32)0x00000001) /* MII busy */ /* Bit definition for Ethernet MAC MII Data Register */ #define ETH_MACMIIDR_MD ((u32)0x0000FFFF) /* MII data: read/write data from/to PHY */ /* Bit definition for Ethernet MAC Flow Control Register */ #define ETH_MACFCR_PT ((u32)0xFFFF0000) /* Pause time */ #define ETH_MACFCR_ZQPD ((u32)0x00000080) /* Zero-quanta pause disable */ #define ETH_MACFCR_PLT ((u32)0x00000030) /* Pause low threshold: 4 cases */ #define ETH_MACFCR_PLT_Minus4 ((u32)0x00000000) /* Pause time minus 4 slot times */ #define ETH_MACFCR_PLT_Minus28 ((u32)0x00000010) /* Pause time minus 28 slot times */ #define ETH_MACFCR_PLT_Minus144 ((u32)0x00000020) /* Pause time minus 144 slot times */ #define ETH_MACFCR_PLT_Minus256 ((u32)0x00000030) /* Pause time minus 256 slot times */ #define ETH_MACFCR_UPFD ((u32)0x00000008) /* Unicast pause frame detect */ #define ETH_MACFCR_RFCE ((u32)0x00000004) /* Receive flow control enable */ #define ETH_MACFCR_TFCE ((u32)0x00000002) /* Transmit flow control enable */ #define ETH_MACFCR_FCBBPA ((u32)0x00000001) /* Flow control busy/backpressure activate */ /* Bit definition for Ethernet MAC VLAN Tag Register */ #define ETH_MACVLANTR_VLANTC ((u32)0x00010000) /* 12-bit VLAN tag comparison */ #define ETH_MACVLANTR_VLANTI ((u32)0x0000FFFF) /* VLAN tag identifier (for receive frames) */ /* Bit definition for Ethernet MAC Remote Wake-UpFrame Filter Register */ #define ETH_MACRWUFFR_D ((u32)0xFFFFFFFF) /* Wake-up frame filter register data */ /* Eight sequential Writes to this address (offset 0x28) will write all Wake-UpFrame Filter Registers. Eight sequential Reads from this address (offset 0x28) will read all Wake-UpFrame Filter Registers. */ /* Wake-UpFrame Filter Reg0 : Filter 0 Byte Mask Wake-UpFrame Filter Reg1 : Filter 1 Byte Mask Wake-UpFrame Filter Reg2 : Filter 2 Byte Mask Wake-UpFrame Filter Reg3 : Filter 3 Byte Mask Wake-UpFrame Filter Reg4 : RSVD - Filter3 Command - RSVD - Filter2 Command - RSVD - Filter1 Command - RSVD - Filter0 Command Wake-UpFrame Filter Re5 : Filter3 Offset - Filter2 Offset - Filter1 Offset - Filter0 Offset Wake-UpFrame Filter Re6 : Filter1 CRC16 - Filter0 CRC16 Wake-UpFrame Filter Re7 : Filter3 CRC16 - Filter2 CRC16 */ /* Bit definition for Ethernet MAC PMT Control and Status Register */ #define ETH_MACPMTCSR_WFFRPR ((u32)0x80000000) /* Wake-Up Frame Filter Register Pointer Reset */ #define ETH_MACPMTCSR_GU ((u32)0x00000200) /* Global Unicast */ #define ETH_MACPMTCSR_WFR ((u32)0x00000040) /* Wake-Up Frame Received */ #define ETH_MACPMTCSR_MPR ((u32)0x00000020) /* Magic Packet Received */ #define ETH_MACPMTCSR_WFE ((u32)0x00000004) /* Wake-Up Frame Enable */ #define ETH_MACPMTCSR_MPE ((u32)0x00000002) /* Magic Packet Enable */ #define ETH_MACPMTCSR_PD ((u32)0x00000001) /* Power Down */ /* Bit definition for Ethernet MAC Status Register */ #define ETH_MACSR_TSTS ((u32)0x00000200) /* Time stamp trigger status */ #define ETH_MACSR_MMCTS ((u32)0x00000040) /* MMC transmit status */ #define ETH_MACSR_MMMCRS ((u32)0x00000020) /* MMC receive status */ #define ETH_MACSR_MMCS ((u32)0x00000010) /* MMC status */ #define ETH_MACSR_PMTS ((u32)0x00000008) /* PMT status */ /* Bit definition for Ethernet MAC Interrupt Mask Register */ #define ETH_MACIMR_TSTIM ((u32)0x00000200) /* Time stamp trigger interrupt mask */ #define ETH_MACIMR_PMTIM ((u32)0x00000008) /* PMT interrupt mask */ /* Bit definition for Ethernet MAC Address0 High Register */ #define ETH_MACA0HR_MACA0H ((u32)0x0000FFFF) /* MAC address0 high */ /* Bit definition for Ethernet MAC Address0 Low Register */ #define ETH_MACA0LR_MACA0L ((u32)0xFFFFFFFF) /* MAC address0 low */ /* Bit definition for Ethernet MAC Address1 High Register */ #define ETH_MACA1HR_AE ((u32)0x80000000) /* Address enable */ #define ETH_MACA1HR_SA ((u32)0x40000000) /* Source address */ #define ETH_MACA1HR_MBC ((u32)0x3F000000) /* Mask byte control: bits to mask for comparison of the MAC Address bytes */ #define ETH_MACA1HR_MBC_HBits15_8 ((u32)0x20000000) /* Mask MAC Address high reg bits [15:8] */ #define ETH_MACA1HR_MBC_HBits7_0 ((u32)0x10000000) /* Mask MAC Address high reg bits [7:0] */ #define ETH_MACA1HR_MBC_LBits31_24 ((u32)0x08000000) /* Mask MAC Address low reg bits [31:24] */ #define ETH_MACA1HR_MBC_LBits23_16 ((u32)0x04000000) /* Mask MAC Address low reg bits [23:16] */ #define ETH_MACA1HR_MBC_LBits15_8 ((u32)0x02000000) /* Mask MAC Address low reg bits [15:8] */ #define ETH_MACA1HR_MBC_LBits7_0 ((u32)0x01000000) /* Mask MAC Address low reg bits [7:0] */ #define ETH_MACA1HR_MACA1H ((u32)0x0000FFFF) /* MAC address1 high */ /* Bit definition for Ethernet MAC Address1 Low Register */ #define ETH_MACA1LR_MACA1L ((u32)0xFFFFFFFF) /* MAC address1 low */ /* Bit definition for Ethernet MAC Address2 High Register */ #define ETH_MACA2HR_AE ((u32)0x80000000) /* Address enable */ #define ETH_MACA2HR_SA ((u32)0x40000000) /* Source address */ #define ETH_MACA2HR_MBC ((u32)0x3F000000) /* Mask byte control */ #define ETH_MACA2HR_MBC_HBits15_8 ((u32)0x20000000) /* Mask MAC Address high reg bits [15:8] */ #define ETH_MACA2HR_MBC_HBits7_0 ((u32)0x10000000) /* Mask MAC Address high reg bits [7:0] */ #define ETH_MACA2HR_MBC_LBits31_24 ((u32)0x08000000) /* Mask MAC Address low reg bits [31:24] */ #define ETH_MACA2HR_MBC_LBits23_16 ((u32)0x04000000) /* Mask MAC Address low reg bits [23:16] */ #define ETH_MACA2HR_MBC_LBits15_8 ((u32)0x02000000) /* Mask MAC Address low reg bits [15:8] */ #define ETH_MACA2HR_MBC_LBits7_0 ((u32)0x01000000) /* Mask MAC Address low reg bits [70] */ #define ETH_MACA2HR_MACA2H ((u32)0x0000FFFF) /* MAC address1 high */ /* Bit definition for Ethernet MAC Address2 Low Register */ #define ETH_MACA2LR_MACA2L ((u32)0xFFFFFFFF) /* MAC address2 low */ /* Bit definition for Ethernet MAC Address3 High Register */ #define ETH_MACA3HR_AE ((u32)0x80000000) /* Address enable */ #define ETH_MACA3HR_SA ((u32)0x40000000) /* Source address */ #define ETH_MACA3HR_MBC ((u32)0x3F000000) /* Mask byte control */ #define ETH_MACA2HR_MBC_HBits15_8 ((u32)0x20000000) /* Mask MAC Address high reg bits [15:8] */ #define ETH_MACA2HR_MBC_HBits7_0 ((u32)0x10000000) /* Mask MAC Address high reg bits [7:0] */ #define ETH_MACA2HR_MBC_LBits31_24 ((u32)0x08000000) /* Mask MAC Address low reg bits [31:24] */ #define ETH_MACA2HR_MBC_LBits23_16 ((u32)0x04000000) /* Mask MAC Address low reg bits [23:16] */ #define ETH_MACA2HR_MBC_LBits15_8 ((u32)0x02000000) /* Mask MAC Address low reg bits [15:8] */ #define ETH_MACA2HR_MBC_LBits7_0 ((u32)0x01000000) /* Mask MAC Address low reg bits [70] */ #define ETH_MACA3HR_MACA3H ((u32)0x0000FFFF) /* MAC address3 high */ /* Bit definition for Ethernet MAC Address3 Low Register */ #define ETH_MACA3LR_MACA3L ((u32)0xFFFFFFFF) /* MAC address3 low */ /******************************************************************************/ /* Ethernet MMC Registers bits definition */ /******************************************************************************/ /* Bit definition for Ethernet MMC Contol Register */ #define ETH_MMCCR_MCF ((u32)0x00000008) /* MMC Counter Freeze */ #define ETH_MMCCR_ROR ((u32)0x00000004) /* Reset on Read */ #define ETH_MMCCR_CSR ((u32)0x00000002) /* Counter Stop Rollover */ #define ETH_MMCCR_CR ((u32)0x00000001) /* Counters Reset */ /* Bit definition for Ethernet MMC Receive Interrupt Register */ #define ETH_MMCRIR_RGUFS ((u32)0x00020000) /* Set when Rx good unicast frames counter reaches half the maximum value */ #define ETH_MMCRIR_RFAES ((u32)0x00000040) /* Set when Rx alignment error counter reaches half the maximum value */ #define ETH_MMCRIR_RFCES ((u32)0x00000020) /* Set when Rx crc error counter reaches half the maximum value */ /* Bit definition for Ethernet MMC Transmit Interrupt Register */ #define ETH_MMCTIR_TGFS ((u32)0x00200000) /* Set when Tx good frame count counter reaches half the maximum value */ #define ETH_MMCTIR_TGFMSCS ((u32)0x00008000) /* Set when Tx good multi col counter reaches half the maximum value */ #define ETH_MMCTIR_TGFSCS ((u32)0x00004000) /* Set when Tx good single col counter reaches half the maximum value */ /* Bit definition for Ethernet MMC Receive Interrupt Mask Register */ #define ETH_MMCRIMR_RGUFM ((u32)0x00020000) /* Mask the interrupt when Rx good unicast frames counter reaches half the maximum value */ #define ETH_MMCRIMR_RFAEM ((u32)0x00000040) /* Mask the interrupt when when Rx alignment error counter reaches half the maximum value */ #define ETH_MMCRIMR_RFCEM ((u32)0x00000020) /* Mask the interrupt when Rx crc error counter reaches half the maximum value */ /* Bit definition for Ethernet MMC Transmit Interrupt Mask Register */ #define ETH_MMCTIMR_TGFM ((u32)0x00200000) /* Mask the interrupt when Tx good frame count counter reaches half the maximum value */ #define ETH_MMCTIMR_TGFMSCM ((u32)0x00008000) /* Mask the interrupt when Tx good multi col counter reaches half the maximum value */ #define ETH_MMCTIMR_TGFSCM ((u32)0x00004000) /* Mask the interrupt when Tx good single col counter reaches half the maximum value */ /* Bit definition for Ethernet MMC Transmitted Good Frames after Single Collision Counter Register */ #define ETH_MMCTGFSCCR_TGFSCC ((u32)0xFFFFFFFF) /* Number of successfully transmitted frames after a single collision in Half-duplex mode. */ /* Bit definition for Ethernet MMC Transmitted Good Frames after More than a Single Collision Counter Register */ #define ETH_MMCTGFMSCCR_TGFMSCC ((u32)0xFFFFFFFF) /* Number of successfully transmitted frames after more than a single collision in Half-duplex mode. */ /* Bit definition for Ethernet MMC Transmitted Good Frames Counter Register */ #define ETH_MMCTGFCR_TGFC ((u32)0xFFFFFFFF) /* Number of good frames transmitted. */ /* Bit definition for Ethernet MMC Received Frames with CRC Error Counter Register */ #define ETH_MMCRFCECR_RFCEC ((u32)0xFFFFFFFF) /* Number of frames received with CRC error. */ /* Bit definition for Ethernet MMC Received Frames with Alignement Error Counter Register */ #define ETH_MMCRFAECR_RFAEC ((u32)0xFFFFFFFF) /* Number of frames received with alignment (dribble) error */ /* Bit definition for Ethernet MMC Received Good Unicast Frames Counter Register */ #define ETH_MMCRGUFCR_RGUFC ((u32)0xFFFFFFFF) /* Number of good unicast frames received. */ /******************************************************************************/ /* Ethernet PTP Registers bits definition */ /******************************************************************************/ /* Bit definition for Ethernet PTP Time Stamp Contol Register */ #define ETH_PTPTSCR_TSARU ((u32)0x00000020) /* Addend register update */ #define ETH_PTPTSCR_TSITE ((u32)0x00000010) /* Time stamp interrupt trigger enable */ #define ETH_PTPTSCR_TSSTU ((u32)0x00000008) /* Time stamp update */ #define ETH_PTPTSCR_TSSTI ((u32)0x00000004) /* Time stamp initialize */ #define ETH_PTPTSCR_TSFCU ((u32)0x00000002) /* Time stamp fine or coarse update */ #define ETH_PTPTSCR_TSE ((u32)0x00000001) /* Time stamp enable */ /* Bit definition for Ethernet PTP Sub-Second Increment Register */ #define ETH_PTPSSIR_STSSI ((u32)0x000000FF) /* System time Sub-second increment value */ /* Bit definition for Ethernet PTP Time Stamp High Register */ #define ETH_PTPTSHR_STS ((u32)0xFFFFFFFF) /* System Time second */ /* Bit definition for Ethernet PTP Time Stamp Low Register */ #define ETH_PTPTSLR_STPNS ((u32)0x80000000) /* System Time Positive or negative time */ #define ETH_PTPTSLR_STSS ((u32)0x7FFFFFFF) /* System Time sub-seconds */ /* Bit definition for Ethernet PTP Time Stamp High Update Register */ #define ETH_PTPTSHUR_TSUS ((u32)0xFFFFFFFF) /* Time stamp update seconds */ /* Bit definition for Ethernet PTP Time Stamp Low Update Register */ #define ETH_PTPTSLUR_TSUPNS ((u32)0x80000000) /* Time stamp update Positive or negative time */ #define ETH_PTPTSLUR_TSUSS ((u32)0x7FFFFFFF) /* Time stamp update sub-seconds */ /* Bit definition for Ethernet PTP Time Stamp Addend Register */ #define ETH_PTPTSAR_TSA ((u32)0xFFFFFFFF) /* Time stamp addend */ /* Bit definition for Ethernet PTP Target Time High Register */ #define ETH_PTPTTHR_TTSH ((u32)0xFFFFFFFF) /* Target time stamp high */ /* Bit definition for Ethernet PTP Target Time Low Register */ #define ETH_PTPTTLR_TTSL ((u32)0xFFFFFFFF) /* Target time stamp low */ /******************************************************************************/ /* Ethernet DMA Registers bits definition */ /******************************************************************************/ /* Bit definition for Ethernet DMA Bus Mode Register */ #define ETH_DMABMR_AAB ((u32)0x02000000) /* Address-Aligned beats */ #define ETH_DMABMR_FPM ((u32)0x01000000) /* 4xPBL mode */ #define ETH_DMABMR_USP ((u32)0x00800000) /* Use separate PBL */ #define ETH_DMABMR_RDP ((u32)0x007E0000) /* RxDMA PBL */ /* Values to be confirmed: maybe they are inversed */ #define ETH_DMABMR_RDP_1Beat ((u32)0x00020000) /* maximum number of beats to be transferred in one RxDMA transaction is 1 */ #define ETH_DMABMR_RDP_2Beat ((u32)0x00040000) /* maximum number of beats to be transferred in one RxDMA transaction is 2 */ #define ETH_DMABMR_RDP_4Beat ((u32)0x00080000) /* maximum number of beats to be transferred in one RxDMA transaction is 4 */ #define ETH_DMABMR_RDP_8Beat ((u32)0x00100000) /* maximum number of beats to be transferred in one RxDMA transaction is 8 */ #define ETH_DMABMR_RDP_16Beat ((u32)0x00200000) /* maximum number of beats to be transferred in one RxDMA transaction is 16 */ #define ETH_DMABMR_RDP_32Beat ((u32)0x00400000) /* maximum number of beats to be transferred in one RxDMA transaction is 32 */ #define ETH_DMABMR_RDP_4xPBL_4Beat ((u32)0x01020000) /* maximum number of beats to be transferred in one RxDMA transaction is 4 */ #define ETH_DMABMR_RDP_4xPBL_8Beat ((u32)0x01040000) /* maximum number of beats to be transferred in one RxDMA transaction is 8 */ #define ETH_DMABMR_RDP_4xPBL_16Beat ((u32)0x01080000) /* maximum number of beats to be transferred in one RxDMA transaction is 16 */ #define ETH_DMABMR_RDP_4xPBL_32Beat ((u32)0x01100000) /* maximum number of beats to be transferred in one RxDMA transaction is 32 */ #define ETH_DMABMR_RDP_4xPBL_64Beat ((u32)0x01200000) /* maximum number of beats to be transferred in one RxDMA transaction is 64 */ #define ETH_DMABMR_RDP_4xPBL_128Beat ((u32)0x01400000) /* maximum number of beats to be transferred in one RxDMA transaction is 128 */ #define ETH_DMABMR_FB ((u32)0x00010000) /* Fixed Burst */ #define ETH_DMABMR_RTPR ((u32)0x0000C000) /* Rx Tx priority ratio */ #define ETH_DMABMR_RTPR_1_1 ((u32)0x00000000) /* Rx Tx priority ratio */ #define ETH_DMABMR_RTPR_2_1 ((u32)0x00004000) /* Rx Tx priority ratio */ #define ETH_DMABMR_RTPR_3_1 ((u32)0x00008000) /* Rx Tx priority ratio */ #define ETH_DMABMR_RTPR_4_1 ((u32)0x0000C000) /* Rx Tx priority ratio */ #define ETH_DMABMR_PBL ((u32)0x00003F00) /* Programmable burst length */ /* Values to be confirmed: maybe they are inversed */ #define ETH_DMABMR_PBL_1Beat ((u32)0x00000100) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 1 */ #define ETH_DMABMR_PBL_2Beat ((u32)0x00000200) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 2 */ #define ETH_DMABMR_PBL_4Beat ((u32)0x00000400) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */ #define ETH_DMABMR_PBL_8Beat ((u32)0x00000800) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */ #define ETH_DMABMR_PBL_16Beat ((u32)0x00001000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */ #define ETH_DMABMR_PBL_32Beat ((u32)0x00002000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */ #define ETH_DMABMR_PBL_4xPBL_4Beat ((u32)0x01000100) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 4 */ #define ETH_DMABMR_PBL_4xPBL_8Beat ((u32)0x01000200) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 8 */ #define ETH_DMABMR_PBL_4xPBL_16Beat ((u32)0x01000400) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 16 */ #define ETH_DMABMR_PBL_4xPBL_32Beat ((u32)0x01000800) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 32 */ #define ETH_DMABMR_PBL_4xPBL_64Beat ((u32)0x01001000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 64 */ #define ETH_DMABMR_PBL_4xPBL_128Beat ((u32)0x01002000) /* maximum number of beats to be transferred in one TxDMA (or both) transaction is 128 */ #define ETH_DMABMR_DSL ((u32)0x0000007C) /* Descriptor Skip Length */ #define ETH_DMABMR_DA ((u32)0x00000002) /* DMA arbitration scheme */ #define ETH_DMABMR_SR ((u32)0x00000001) /* Software reset */ /* Bit definition for Ethernet DMA Transmit Poll Demand Register */ #define ETH_DMATPDR_TPD ((u32)0xFFFFFFFF) /* Transmit poll demand */ /* Bit definition for Ethernet DMA Receive Poll Demand Register */ #define ETH_DMARPDR_RPD ((u32)0xFFFFFFFF) /* Receive poll demand */ /* Bit definition for Ethernet DMA Receive Descriptor List Address Register */ #define ETH_DMARDLAR_SRL ((u32)0xFFFFFFFF) /* Start of receive list */ /* Bit definition for Ethernet DMA Transmit Descriptor List Address Register */ #define ETH_DMATDLAR_STL ((u32)0xFFFFFFFF) /* Start of transmit list */ /* Bit definition for Ethernet DMA Status Register */ #define ETH_DMASR_TSTS ((u32)0x20000000) /* Time-stamp trigger status */ #define ETH_DMASR_PMTS ((u32)0x10000000) /* PMT status */ #define ETH_DMASR_MMCS ((u32)0x08000000) /* MMC status */ #define ETH_DMASR_EBS ((u32)0x03800000) /* Error bits status */ /* combination with EBS[2:0] for GetFlagStatus function */ #define ETH_DMASR_EBS_DescAccess ((u32)0x02000000) /* Error bits 0-data buffer, 1-desc. access */ #define ETH_DMASR_EBS_ReadTransf ((u32)0x01000000) /* Error bits 0-write trnsf, 1-read transfr */ #define ETH_DMASR_EBS_DataTransfTx ((u32)0x00800000) /* Error bits 0-Rx DMA, 1-Tx DMA */ #define ETH_DMASR_TPS ((u32)0x00700000) /* Transmit process state */ #define ETH_DMASR_TPS_Stopped ((u32)0x00000000) /* Stopped - Reset or Stop Tx Command issued */ #define ETH_DMASR_TPS_Fetching ((u32)0x00100000) /* Running - fetching the Tx descriptor */ #define ETH_DMASR_TPS_Waiting ((u32)0x00200000) /* Running - waiting for status */ #define ETH_DMASR_TPS_Reading ((u32)0x00300000) /* Running - reading the data from host memory */ #define ETH_DMASR_TPS_Suspended ((u32)0x00600000) /* Suspended - Tx Descriptor unavailabe */ #define ETH_DMASR_TPS_Closing ((u32)0x00700000) /* Running - closing Rx descriptor */ #define ETH_DMASR_RPS ((u32)0x000E0000) /* Receive process state */ #define ETH_DMASR_RPS_Stopped ((u32)0x00000000) /* Stopped - Reset or Stop Rx Command issued */ #define ETH_DMASR_RPS_Fetching ((u32)0x00020000) /* Running - fetching the Rx descriptor */ #define ETH_DMASR_RPS_Waiting ((u32)0x00060000) /* Running - waiting for packet */ #define ETH_DMASR_RPS_Suspended ((u32)0x00080000) /* Suspended - Rx Descriptor unavailable */ #define ETH_DMASR_RPS_Closing ((u32)0x000A0000) /* Running - closing descriptor */ #define ETH_DMASR_RPS_Queuing ((u32)0x000E0000) /* Running - queuing the recieve frame into host memory */ #define ETH_DMASR_NIS ((u32)0x00010000) /* Normal interrupt summary */ #define ETH_DMASR_AIS ((u32)0x00008000) /* Abnormal interrupt summary */ #define ETH_DMASR_ERS ((u32)0x00004000) /* Early receive status */ #define ETH_DMASR_FBES ((u32)0x00002000) /* Fatal bus error status */ #define ETH_DMASR_ETS ((u32)0x00000400) /* Early transmit status */ #define ETH_DMASR_RWTS ((u32)0x00000200) /* Receive watchdog timeout status */ #define ETH_DMASR_RPSS ((u32)0x00000100) /* Receive process stopped status */ #define ETH_DMASR_RBUS ((u32)0x00000080) /* Receive buffer unavailable status */ #define ETH_DMASR_RS ((u32)0x00000040) /* Receive status */ #define ETH_DMASR_TUS ((u32)0x00000020) /* Transmit underflow status */ #define ETH_DMASR_ROS ((u32)0x00000010) /* Receive overflow status */ #define ETH_DMASR_TJTS ((u32)0x00000008) /* Transmit jabber timeout status */ #define ETH_DMASR_TBUS ((u32)0x00000004) /* Transmit buffer unavailable status */ #define ETH_DMASR_TPSS ((u32)0x00000002) /* Transmit process stopped status */ #define ETH_DMASR_TS ((u32)0x00000001) /* Transmit status */ /* Bit definition for Ethernet DMA Operation Mode Register */ #define ETH_DMAOMR_DTCEFD ((u32)0x04000000) /* Disable Dropping of TCP/IP checksum error frames */ #define ETH_DMAOMR_RSF ((u32)0x02000000) /* Receive store and forward */ #define ETH_DMAOMR_DFRF ((u32)0x01000000) /* Disable flushing of received frames */ #define ETH_DMAOMR_TSF ((u32)0x00200000) /* Transmit store and forward */ #define ETH_DMAOMR_FTF ((u32)0x00100000) /* Flush transmit FIFO */ #define ETH_DMAOMR_TTC ((u32)0x0001C000) /* Transmit threshold control */ #define ETH_DMAOMR_TTC_64Bytes ((u32)0x00000000) /* threshold level of the MTL Transmit FIFO is 64 Bytes */ #define ETH_DMAOMR_TTC_128Bytes ((u32)0x00004000) /* threshold level of the MTL Transmit FIFO is 128 Bytes */ #define ETH_DMAOMR_TTC_192Bytes ((u32)0x00008000) /* threshold level of the MTL Transmit FIFO is 192 Bytes */ #define ETH_DMAOMR_TTC_256Bytes ((u32)0x0000C000) /* threshold level of the MTL Transmit FIFO is 256 Bytes */ #define ETH_DMAOMR_TTC_40Bytes ((u32)0x00010000) /* threshold level of the MTL Transmit FIFO is 40 Bytes */ #define ETH_DMAOMR_TTC_32Bytes ((u32)0x00014000) /* threshold level of the MTL Transmit FIFO is 32 Bytes */ #define ETH_DMAOMR_TTC_24Bytes ((u32)0x00018000) /* threshold level of the MTL Transmit FIFO is 24 Bytes */ #define ETH_DMAOMR_TTC_16Bytes ((u32)0x0001C000) /* threshold level of the MTL Transmit FIFO is 16 Bytes */ #define ETH_DMAOMR_ST ((u32)0x00002000) /* Start/stop transmission command */ #define ETH_DMAOMR_FEF ((u32)0x00000080) /* Forward error frames */ #define ETH_DMAOMR_FUGF ((u32)0x00000040) /* Forward undersized good frames */ #define ETH_DMAOMR_RTC ((u32)0x00000018) /* receive threshold control */ #define ETH_DMAOMR_RTC_64Bytes ((u32)0x00000000) /* threshold level of the MTL Receive FIFO is 64 Bytes */ #define ETH_DMAOMR_RTC_32Bytes ((u32)0x00000008) /* threshold level of the MTL Receive FIFO is 32 Bytes */ #define ETH_DMAOMR_RTC_96Bytes ((u32)0x00000010) /* threshold level of the MTL Receive FIFO is 96 Bytes */ #define ETH_DMAOMR_RTC_128Bytes ((u32)0x00000018) /* threshold level of the MTL Receive FIFO is 128 Bytes */ #define ETH_DMAOMR_OSF ((u32)0x00000004) /* operate on second frame */ #define ETH_DMAOMR_SR ((u32)0x00000002) /* Start/stop receive */ /* Bit definition for Ethernet DMA Interrupt Enable Register */ #define ETH_DMAIER_NISE ((u32)0x00010000) /* Normal interrupt summary enable */ #define ETH_DMAIER_AISE ((u32)0x00008000) /* Abnormal interrupt summary enable */ #define ETH_DMAIER_ERIE ((u32)0x00004000) /* Early receive interrupt enable */ #define ETH_DMAIER_FBEIE ((u32)0x00002000) /* Fatal bus error interrupt enable */ #define ETH_DMAIER_ETIE ((u32)0x00000400) /* Early transmit interrupt enable */ #define ETH_DMAIER_RWTIE ((u32)0x00000200) /* Receive watchdog timeout interrupt enable */ #define ETH_DMAIER_RPSIE ((u32)0x00000100) /* Receive process stopped interrupt enable */ #define ETH_DMAIER_RBUIE ((u32)0x00000080) /* Receive buffer unavailable interrupt enable */ #define ETH_DMAIER_RIE ((u32)0x00000040) /* Receive interrupt enable */ #define ETH_DMAIER_TUIE ((u32)0x00000020) /* Transmit Underflow interrupt enable */ #define ETH_DMAIER_ROIE ((u32)0x00000010) /* Receive Overflow interrupt enable */ #define ETH_DMAIER_TJTIE ((u32)0x00000008) /* Transmit jabber timeout interrupt enable */ #define ETH_DMAIER_TBUIE ((u32)0x00000004) /* Transmit buffer unavailable interrupt enable */ #define ETH_DMAIER_TPSIE ((u32)0x00000002) /* Transmit process stopped interrupt enable */ #define ETH_DMAIER_TIE ((u32)0x00000001) /* Transmit interrupt enable */ /* Bit definition for Ethernet DMA Missed Frame and Buffer Overflow Counter Register */ #define ETH_DMAMFBOCR_OFOC ((u32)0x10000000) /* Overflow bit for FIFO overflow counter */ #define ETH_DMAMFBOCR_MFA ((u32)0x0FFE0000) /* Number of frames missed by the application */ #define ETH_DMAMFBOCR_OMFC ((u32)0x00010000) /* Overflow bit for missed frame counter */ #define ETH_DMAMFBOCR_MFC ((u32)0x0000FFFF) /* Number of frames missed by the controller */ /* Bit definition for Ethernet DMA Current Host Transmit Descriptor Register */ #define ETH_DMACHTDR_HTDAP ((u32)0xFFFFFFFF) /* Host transmit descriptor address pointer */ /* Bit definition for Ethernet DMA Current Host Receive Descriptor Register */ #define ETH_DMACHRDR_HRDAP ((u32)0xFFFFFFFF) /* Host receive descriptor address pointer */ /* Bit definition for Ethernet DMA Current Host Transmit Buffer Address Register */ #define ETH_DMACHTBAR_HTBAP ((u32)0xFFFFFFFF) /* Host transmit buffer address pointer */ /* Bit definition for Ethernet DMA Current Host Receive Buffer Address Register */ #define ETH_DMACHRBAR_HRBAP ((u32)0xFFFFFFFF) /* Host receive buffer address pointer */ /******************************************************************************/ /* Macros */ /******************************************************************************/ #define SET_BIT(REG, BIT) ((REG) |= (BIT)) #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) #define READ_BIT(REG, BIT) ((REG) & (BIT)) /******************************************************************************/ /* Peripheral memory map */ /******************************************************************************/ /* ETHERNET registers base address */ #define ETH_BASE ((u32)0x40028000) #define ETH_MAC_BASE (ETH_BASE) #define ETH_MMC_BASE (ETH_BASE + 0x0100) #define ETH_PTP_BASE (ETH_BASE + 0x0700) #define ETH_DMA_BASE (ETH_BASE + 0x1000) /******************************************************************************/ /* Peripheral declaration */ /******************************************************************************/ /*------------------------ Non Debug Mode ------------------------------------*/ #ifndef ETH_DEBUG #ifdef _ETH_MAC #define ETH_MAC ((ETH_MAC_TypeDef *) ETH_MAC_BASE) #endif /*_ETH_MAC */ #ifdef _ETH_MMC #define ETH_MMC ((ETH_MMC_TypeDef *) ETH_MMC_BASE) #endif /*_ETH_MMC */ #ifdef _ETH_PTP #define ETH_PTP ((ETH_PTP_TypeDef *) ETH_PTP_BASE) #endif /*_ETH_PTP */ #ifdef _ETH_DMA #define ETH_DMA ((ETH_DMA_TypeDef *) ETH_DMA_BASE) #endif /*_ETH_DMA */ /*------------------------ Debug Mode ----------------------------------------*/ #else /* ETH_DEBUG */ #ifdef _ETH_MAC EXT ETH_MAC_TypeDef *ETH_MAC; #endif /*_ETH_MAC */ #ifdef _ETH_MMC EXT ETH_MMC_TypeDef *ETH_MMC; #endif /*_ETH_MMC */ #ifdef _ETH_PTP EXT ETH_PTP_TypeDef *ETH_PTP; #endif /*_ETH_PTP */ #ifdef _ETH_DMA EXT ETH_DMA_TypeDef *ETH_DMA; #endif /*_ETH_DMA */ #endif /* ETH_DEBUG */ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #endif /* __STM32FXXX_ETH_MAP_H */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32fxxx_eth_map.h
C
oos
37,554
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_type.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the common data types used for the * STM32F10x firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_TYPE_H #define __STM32F10x_TYPE_H /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ typedef signed long s32; typedef signed short s16; typedef signed char s8; typedef volatile signed long vs32; typedef volatile signed short vs16; typedef volatile signed char vs8; typedef unsigned long u32; typedef unsigned short u16; typedef unsigned char u8; typedef unsigned long const uc32; /* Read Only */ typedef unsigned short const uc16; /* Read Only */ typedef unsigned char const uc8; /* Read Only */ typedef volatile unsigned long vu32; typedef volatile unsigned short vu16; typedef volatile unsigned char vu8; typedef volatile unsigned long const vuc32; /* Read Only */ typedef volatile unsigned short const vuc16; /* Read Only */ typedef volatile unsigned char const vuc8; /* Read Only */ typedef enum {FALSE = 0, TRUE = !FALSE} bool; typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus; typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState; #define IS_FUNCTIONAL_STATE(STATE) ((STATE == DISABLE) || (STATE == ENABLE)) typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus; #define U8_MAX ((u8)255) #define S8_MAX ((s8)127) #define S8_MIN ((s8)-128) #define U16_MAX ((u16)65535u) #define S16_MAX ((s16)32767) #define S16_MIN ((s16)-32768) #define U32_MAX ((u32)4294967295uL) #define S32_MAX ((s32)2147483647) #define S32_MIN ((s32)2147483648uL) /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ #endif /* __STM32F10x_TYPE_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_type.h
C
oos
3,169
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_bkp.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * BKP firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_BKP_H #define __STM32F10x_BKP_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Tamper Pin active level*/ #define BKP_TamperPinLevel_High ((u16)0x0000) #define BKP_TamperPinLevel_Low ((u16)0x0001) #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) ((LEVEL == BKP_TamperPinLevel_High) || \ (LEVEL == BKP_TamperPinLevel_Low)) /* Data Backup Register */ #define BKP_DR1 ((u16)0x0004) #define BKP_DR2 ((u16)0x0008) #define BKP_DR3 ((u16)0x000C) #define BKP_DR4 ((u16)0x0010) #define BKP_DR5 ((u16)0x0014) #define BKP_DR6 ((u16)0x0018) #define BKP_DR7 ((u16)0x001C) #define BKP_DR8 ((u16)0x0020) #define BKP_DR9 ((u16)0x0024) #define BKP_DR10 ((u16)0x0028) #define IS_BKP_DR(DR) ((DR == BKP_DR1) || (DR == BKP_DR2) || (DR == BKP_DR3) || \ (DR == BKP_DR4) || (DR == BKP_DR5) || (DR == BKP_DR6) || \ (DR == BKP_DR7) || (DR == BKP_DR8) || (DR == BKP_DR9) || \ (DR == BKP_DR10)) #define IS_BKP_CALIBRATION_VALUE(VALUE) (VALUE <= 0x7F) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void BKP_DeInit(void); void BKP_TamperPinLevelConfig(u16 BKP_TamperPinLevel); void BKP_TamperPinCmd(FunctionalState NewState); void BKP_ITConfig(FunctionalState NewState); void BKP_RTCCalibrationClockOutputCmd(FunctionalState NewState); void BKP_SetRTCCalibrationValue(u8 CalibrationValue); void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data); u16 BKP_ReadBackupRegister(u16 BKP_DR); FlagStatus BKP_GetFlagStatus(void); void BKP_ClearFlag(void); ITStatus BKP_GetITStatus(void); void BKP_ClearITPendingBit(void); #endif /* __STM32F10x_BKP_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_bkp.h
C
oos
3,506
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_dma.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * DMA firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_DMA_H #define __STM32F10x_DMA_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* DMA Init structure definition */ typedef struct { u32 DMA_PeripheralBaseAddr; u32 DMA_MemoryBaseAddr; u32 DMA_DIR; u32 DMA_BufferSize; u32 DMA_PeripheralInc; u32 DMA_MemoryInc; u32 DMA_PeripheralDataSize; u32 DMA_MemoryDataSize; u32 DMA_Mode; u32 DMA_Priority; u32 DMA_M2M; }DMA_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* DMA data transfer direction -----------------------------------------------*/ #define DMA_DIR_PeripheralDST ((u32)0x00000010) #define DMA_DIR_PeripheralSRC ((u32)0x00000000) #define IS_DMA_DIR(DIR) ((DIR == DMA_DIR_PeripheralDST) || \ (DIR == DMA_DIR_PeripheralSRC)) /* DMA peripheral incremented mode -------------------------------------------*/ #define DMA_PeripheralInc_Enable ((u32)0x00000040) #define DMA_PeripheralInc_Disable ((u32)0x00000000) #define IS_DMA_PERIPHERAL_INC_STATE(STATE) ((STATE == DMA_PeripheralInc_Enable) || \ (STATE == DMA_PeripheralInc_Disable)) /* DMA memory incremented mode -----------------------------------------------*/ #define DMA_MemoryInc_Enable ((u32)0x00000080) #define DMA_MemoryInc_Disable ((u32)0x00000000) #define IS_DMA_MEMORY_INC_STATE(STATE) ((STATE == DMA_MemoryInc_Enable) || \ (STATE == DMA_MemoryInc_Disable)) /* DMA peripheral data size --------------------------------------------------*/ #define DMA_PeripheralDataSize_Byte ((u32)0x00000000) #define DMA_PeripheralDataSize_HalfWord ((u32)0x00000100) #define DMA_PeripheralDataSize_Word ((u32)0x00000200) #define IS_DMA_PERIPHERAL_DATA_SIZE(SIZE) ((SIZE == DMA_PeripheralDataSize_Byte) || \ (SIZE == DMA_PeripheralDataSize_HalfWord) || \ (SIZE == DMA_PeripheralDataSize_Word)) /* DMA memory data size ------------------------------------------------------*/ #define DMA_MemoryDataSize_Byte ((u32)0x00000000) #define DMA_MemoryDataSize_HalfWord ((u32)0x00000400) #define DMA_MemoryDataSize_Word ((u32)0x00000800) #define IS_DMA_MEMORY_DATA_SIZE(SIZE) ((SIZE == DMA_MemoryDataSize_Byte) || \ (SIZE == DMA_MemoryDataSize_HalfWord) || \ (SIZE == DMA_MemoryDataSize_Word)) /* DMA circular/normal mode --------------------------------------------------*/ #define DMA_Mode_Circular ((u32)0x00000020) #define DMA_Mode_Normal ((u32)0x00000000) #define IS_DMA_MODE(MODE) ((MODE == DMA_Mode_Circular) || (MODE == DMA_Mode_Normal)) /* DMA priority level --------------------------------------------------------*/ #define DMA_Priority_VeryHigh ((u32)0x00003000) #define DMA_Priority_High ((u32)0x00002000) #define DMA_Priority_Medium ((u32)0x00001000) #define DMA_Priority_Low ((u32)0x00000000) #define IS_DMA_PRIORITY(PRIORITY) ((PRIORITY == DMA_Priority_VeryHigh) || \ (PRIORITY == DMA_Priority_High) || \ (PRIORITY == DMA_Priority_Medium) || \ (PRIORITY == DMA_Priority_Low)) /* DMA memory to memory ------------------------------------------------------*/ #define DMA_M2M_Enable ((u32)0x00004000) #define DMA_M2M_Disable ((u32)0x00000000) #define IS_DMA_M2M_STATE(STATE) ((STATE == DMA_M2M_Enable) || (STATE == DMA_M2M_Disable)) /* DMA interrupts definition -------------------------------------------------*/ #define DMA_IT_TC ((u32)0x00000002) #define DMA_IT_HT ((u32)0x00000004) #define DMA_IT_TE ((u32)0x00000008) #define IS_DMA_CONFIG_IT(IT) (((IT & 0xFFFFFFF1) == 0x00) && (IT != 0x00)) #define DMA_IT_GL1 ((u32)0x00000001) #define DMA_IT_TC1 ((u32)0x00000002) #define DMA_IT_HT1 ((u32)0x00000004) #define DMA_IT_TE1 ((u32)0x00000008) #define DMA_IT_GL2 ((u32)0x00000010) #define DMA_IT_TC2 ((u32)0x00000020) #define DMA_IT_HT2 ((u32)0x00000040) #define DMA_IT_TE2 ((u32)0x00000080) #define DMA_IT_GL3 ((u32)0x00000100) #define DMA_IT_TC3 ((u32)0x00000200) #define DMA_IT_HT3 ((u32)0x00000400) #define DMA_IT_TE3 ((u32)0x00000800) #define DMA_IT_GL4 ((u32)0x00001000) #define DMA_IT_TC4 ((u32)0x00002000) #define DMA_IT_HT4 ((u32)0x00004000) #define DMA_IT_TE4 ((u32)0x00008000) #define DMA_IT_GL5 ((u32)0x00010000) #define DMA_IT_TC5 ((u32)0x00020000) #define DMA_IT_HT5 ((u32)0x00040000) #define DMA_IT_TE5 ((u32)0x00080000) #define DMA_IT_GL6 ((u32)0x00100000) #define DMA_IT_TC6 ((u32)0x00200000) #define DMA_IT_HT6 ((u32)0x00400000) #define DMA_IT_TE6 ((u32)0x00800000) #define DMA_IT_GL7 ((u32)0x01000000) #define DMA_IT_TC7 ((u32)0x02000000) #define DMA_IT_HT7 ((u32)0x04000000) #define DMA_IT_TE7 ((u32)0x08000000) #define IS_DMA_CLEAR_IT(IT) (((IT & 0xF0000000) == 0x00) && (IT != 0x00)) #define IS_DMA_GET_IT(IT) ((IT == DMA_IT_GL1) || (IT == DMA_IT_TC1) || \ (IT == DMA_IT_HT1) || (IT == DMA_IT_TE1) || \ (IT == DMA_IT_GL2) || (IT == DMA_IT_TC2) || \ (IT == DMA_IT_HT2) || (IT == DMA_IT_TE2) || \ (IT == DMA_IT_GL3) || (IT == DMA_IT_TC3) || \ (IT == DMA_IT_HT3) || (IT == DMA_IT_TE3) || \ (IT == DMA_IT_GL4) || (IT == DMA_IT_TC4) || \ (IT == DMA_IT_HT4) || (IT == DMA_IT_TE4) || \ (IT == DMA_IT_GL5) || (IT == DMA_IT_TC5) || \ (IT == DMA_IT_HT5) || (IT == DMA_IT_TE5) || \ (IT == DMA_IT_GL6) || (IT == DMA_IT_TC6) || \ (IT == DMA_IT_HT6) || (IT == DMA_IT_TE6) || \ (IT == DMA_IT_GL7) || (IT == DMA_IT_TC7) || \ (IT == DMA_IT_HT7) || (IT == DMA_IT_TE7)) /* DMA flags definition ------------------------------------------------------*/ #define DMA_FLAG_GL1 ((u32)0x00000001) #define DMA_FLAG_TC1 ((u32)0x00000002) #define DMA_FLAG_HT1 ((u32)0x00000004) #define DMA_FLAG_TE1 ((u32)0x00000008) #define DMA_FLAG_GL2 ((u32)0x00000010) #define DMA_FLAG_TC2 ((u32)0x00000020) #define DMA_FLAG_HT2 ((u32)0x00000040) #define DMA_FLAG_TE2 ((u32)0x00000080) #define DMA_FLAG_GL3 ((u32)0x00000100) #define DMA_FLAG_TC3 ((u32)0x00000200) #define DMA_FLAG_HT3 ((u32)0x00000400) #define DMA_FLAG_TE3 ((u32)0x00000800) #define DMA_FLAG_GL4 ((u32)0x00001000) #define DMA_FLAG_TC4 ((u32)0x00002000) #define DMA_FLAG_HT4 ((u32)0x00004000) #define DMA_FLAG_TE4 ((u32)0x00008000) #define DMA_FLAG_GL5 ((u32)0x00010000) #define DMA_FLAG_TC5 ((u32)0x00020000) #define DMA_FLAG_HT5 ((u32)0x00040000) #define DMA_FLAG_TE5 ((u32)0x00080000) #define DMA_FLAG_GL6 ((u32)0x00100000) #define DMA_FLAG_TC6 ((u32)0x00200000) #define DMA_FLAG_HT6 ((u32)0x00400000) #define DMA_FLAG_TE6 ((u32)0x00800000) #define DMA_FLAG_GL7 ((u32)0x01000000) #define DMA_FLAG_TC7 ((u32)0x02000000) #define DMA_FLAG_HT7 ((u32)0x04000000) #define DMA_FLAG_TE7 ((u32)0x08000000) #define IS_DMA_CLEAR_FLAG(FLAG) (((FLAG & 0xF0000000) == 0x00) && (FLAG != 0x00)) #define IS_DMA_GET_FLAG(FLAG) ((FLAG == DMA_FLAG_GL1) || (FLAG == DMA_FLAG_TC1) || \ (FLAG == DMA_FLAG_HT1) || (FLAG == DMA_FLAG_TE1) || \ (FLAG == DMA_FLAG_GL2) || (FLAG == DMA_FLAG_TC2) || \ (FLAG == DMA_FLAG_HT2) || (FLAG == DMA_FLAG_TE2) || \ (FLAG == DMA_FLAG_GL3) || (FLAG == DMA_FLAG_TC3) || \ (FLAG == DMA_FLAG_HT3) || (FLAG == DMA_FLAG_TE3) || \ (FLAG == DMA_FLAG_GL4) || (FLAG == DMA_FLAG_TC4) || \ (FLAG == DMA_FLAG_HT4) || (FLAG == DMA_FLAG_TE4) || \ (FLAG == DMA_FLAG_GL5) || (FLAG == DMA_FLAG_TC5) || \ (FLAG == DMA_FLAG_HT5) || (FLAG == DMA_FLAG_TE5) || \ (FLAG == DMA_FLAG_GL6) || (FLAG == DMA_FLAG_TC6) || \ (FLAG == DMA_FLAG_HT6) || (FLAG == DMA_FLAG_TE6) || \ (FLAG == DMA_FLAG_GL7) || (FLAG == DMA_FLAG_TC7) || \ (FLAG == DMA_FLAG_HT7) || (FLAG == DMA_FLAG_TE7)) /* DMA Buffer Size -----------------------------------------------------------*/ #define IS_DMA_BUFFER_SIZE(SIZE) ((SIZE >= 0x1) && (SIZE < 0x10000)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void DMA_DeInit(DMA_Channel_TypeDef* DMA_Channelx); void DMA_Init(DMA_Channel_TypeDef* DMA_Channelx, DMA_InitTypeDef* DMA_InitStruct); void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct); void DMA_Cmd(DMA_Channel_TypeDef* DMA_Channelx, FunctionalState NewState); void DMA_ITConfig(DMA_Channel_TypeDef* DMA_Channelx, u32 DMA_IT, FunctionalState NewState); u16 DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMA_Channelx); FlagStatus DMA_GetFlagStatus(u32 DMA_FLAG); void DMA_ClearFlag(u32 DMA_FLAG); ITStatus DMA_GetITStatus(u32 DMA_IT); void DMA_ClearITPendingBit(u32 DMA_IT); #endif /*__STM32F10x_DMA_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_dma.h
C
oos
12,531
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_i2c.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * I2C firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_I2C_H #define __STM32F10x_I2C_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* I2C Init structure definition */ typedef struct { u16 I2C_Mode; u16 I2C_DutyCycle; u16 I2C_OwnAddress1; u16 I2C_Ack; u16 I2C_AcknowledgedAddress; u32 I2C_ClockSpeed; }I2C_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* I2C modes */ #define I2C_Mode_I2C ((u16)0x0000) #define I2C_Mode_SMBusDevice ((u16)0x0002) #define I2C_Mode_SMBusHost ((u16)0x000A) #define IS_I2C_MODE(MODE) ((MODE == I2C_Mode_I2C) || \ (MODE == I2C_Mode_SMBusDevice) || \ (MODE == I2C_Mode_SMBusHost)) /* I2C duty cycle in fast mode */ #define I2C_DutyCycle_16_9 ((u16)0x4000) #define I2C_DutyCycle_2 ((u16)0xBFFF) #define IS_I2C_DUTY_CYCLE(CYCLE) ((CYCLE == I2C_DutyCycle_16_9) || \ (CYCLE == I2C_DutyCycle_2)) /* I2C cknowledgementy */ #define I2C_Ack_Enable ((u16)0x0400) #define I2C_Ack_Disable ((u16)0x0000) #define IS_I2C_ACK_STATE(STATE) ((STATE == I2C_Ack_Enable) || \ (STATE == I2C_Ack_Disable)) /* I2C transfer direction */ #define I2C_Direction_Transmitter ((u8)0x00) #define I2C_Direction_Receiver ((u8)0x01) #define IS_I2C_DIRECTION(DIRECTION) ((DIRECTION == I2C_Direction_Transmitter) || \ (DIRECTION == I2C_Direction_Receiver)) /* I2C acknowledged address defines */ #define I2C_AcknowledgedAddress_7bit ((u16)0x4000) #define I2C_AcknowledgedAddress_10bit ((u16)0xC000) #define IS_I2C_ACKNOWLEDGE_ADDRESS(ADDRESS) ((ADDRESS == I2C_AcknowledgedAddress_7bit) || \ (ADDRESS == I2C_AcknowledgedAddress_10bit)) /* I2C registers */ #define I2C_Register_CR1 ((u8)0x00) #define I2C_Register_CR2 ((u8)0x04) #define I2C_Register_OAR1 ((u8)0x08) #define I2C_Register_OAR2 ((u8)0x0C) #define I2C_Register_DR ((u8)0x10) #define I2C_Register_SR1 ((u8)0x14) #define I2C_Register_SR2 ((u8)0x18) #define I2C_Register_CCR ((u8)0x1C) #define I2C_Register_TRISE ((u8)0x20) #define IS_I2C_REGISTER(REGISTER) ((REGISTER == I2C_Register_CR1) || \ (REGISTER == I2C_Register_CR2) || \ (REGISTER == I2C_Register_OAR1) || \ (REGISTER == I2C_Register_OAR2) || \ (REGISTER == I2C_Register_DR) || \ (REGISTER == I2C_Register_SR1) || \ (REGISTER == I2C_Register_SR2) || \ (REGISTER == I2C_Register_CCR) || \ (REGISTER == I2C_Register_TRISE)) /* I2C SMBus alert pin level */ #define I2C_SMBusAlert_Low ((u16)0x2000) #define I2C_SMBusAlert_High ((u16)0xCFFF) #define IS_I2C_SMBUS_ALERT(ALERT) ((ALERT == I2C_SMBusAlert_Low) || \ (ALERT == I2C_SMBusAlert_High)) /* I2C PEC position */ #define I2C_PECPosition_Next ((u16)0x0800) #define I2C_PECPosition_Current ((u16)0xF7FF) #define IS_I2C_PEC_POSITION(POSITION) ((POSITION == I2C_PECPosition_Next) || \ (POSITION == I2C_PECPosition_Current)) /* I2C interrupts definition */ #define I2C_IT_BUF ((u16)0x0400) #define I2C_IT_EVT ((u16)0x0200) #define I2C_IT_ERR ((u16)0x0100) #define IS_I2C_CONFIG_IT(IT) (((IT & (u16)0xF8FF) == 0x00) && (IT != 0x00)) /* I2C interrupts definition */ #define I2C_IT_SMBALERT ((u32)0x10008000) #define I2C_IT_TIMEOUT ((u32)0x10004000) #define I2C_IT_PECERR ((u32)0x10001000) #define I2C_IT_OVR ((u32)0x10000800) #define I2C_IT_AF ((u32)0x10000400) #define I2C_IT_ARLO ((u32)0x10000200) #define I2C_IT_BERR ((u32)0x10000100) #define I2C_IT_TXE ((u32)0x00000080) #define I2C_IT_RXNE ((u32)0x00000040) #define I2C_IT_STOPF ((u32)0x60000010) #define I2C_IT_ADD10 ((u32)0x20000008) #define I2C_IT_BTF ((u32)0x60000004) #define I2C_IT_ADDR ((u32)0xA0000002) #define I2C_IT_SB ((u32)0x20000001) #define IS_I2C_CLEAR_IT(IT) ((IT == I2C_IT_SMBALERT) || (IT == I2C_IT_TIMEOUT) || \ (IT == I2C_IT_PECERR) || (IT == I2C_IT_OVR) || \ (IT == I2C_IT_AF) || (IT == I2C_IT_ARLO) || \ (IT == I2C_IT_BERR) || (IT == I2C_IT_STOPF) || \ (IT == I2C_IT_ADD10) || (IT == I2C_IT_BTF) || \ (IT == I2C_IT_ADDR) || (IT == I2C_IT_SB)) #define IS_I2C_GET_IT(IT) ((IT == I2C_IT_SMBALERT) || (IT == I2C_IT_TIMEOUT) || \ (IT == I2C_IT_PECERR) || (IT == I2C_IT_OVR) || \ (IT == I2C_IT_AF) || (IT == I2C_IT_ARLO) || \ (IT == I2C_IT_BERR) || (IT == I2C_IT_TXE) || \ (IT == I2C_IT_RXNE) || (IT == I2C_IT_STOPF) || \ (IT == I2C_IT_ADD10) || (IT == I2C_IT_BTF) || \ (IT == I2C_IT_ADDR) || (IT == I2C_IT_SB)) /* I2C flags definition */ #define I2C_FLAG_DUALF ((u32)0x00800000) #define I2C_FLAG_SMBHOST ((u32)0x00400000) #define I2C_FLAG_SMBDEFAULT ((u32)0x00200000) #define I2C_FLAG_GENCALL ((u32)0x00100000) #define I2C_FLAG_TRA ((u32)0x00040000) #define I2C_FLAG_BUSY ((u32)0x00020000) #define I2C_FLAG_MSL ((u32)0x00010000) #define I2C_FLAG_SMBALERT ((u32)0x10008000) #define I2C_FLAG_TIMEOUT ((u32)0x10004000) #define I2C_FLAG_PECERR ((u32)0x10001000) #define I2C_FLAG_OVR ((u32)0x10000800) #define I2C_FLAG_AF ((u32)0x10000400) #define I2C_FLAG_ARLO ((u32)0x10000200) #define I2C_FLAG_BERR ((u32)0x10000100) #define I2C_FLAG_TXE ((u32)0x00000080) #define I2C_FLAG_RXNE ((u32)0x00000040) #define I2C_FLAG_STOPF ((u32)0x60000010) #define I2C_FLAG_ADD10 ((u32)0x20000008) #define I2C_FLAG_BTF ((u32)0x60000004) #define I2C_FLAG_ADDR ((u32)0xA0000002) #define I2C_FLAG_SB ((u32)0x20000001) #define IS_I2C_CLEAR_FLAG(FLAG) ((FLAG == I2C_FLAG_SMBALERT) || (FLAG == I2C_FLAG_TIMEOUT) || \ (FLAG == I2C_FLAG_PECERR) || (FLAG == I2C_FLAG_OVR) || \ (FLAG == I2C_FLAG_AF) || (FLAG == I2C_FLAG_ARLO) || \ (FLAG == I2C_FLAG_BERR) || (FLAG == I2C_FLAG_STOPF) || \ (FLAG == I2C_FLAG_ADD10) || (FLAG == I2C_FLAG_BTF) || \ (FLAG == I2C_FLAG_ADDR) || (FLAG == I2C_FLAG_SB)) #define IS_I2C_GET_FLAG(FLAG) ((FLAG == I2C_FLAG_DUALF) || (FLAG == I2C_FLAG_SMBHOST) || \ (FLAG == I2C_FLAG_SMBDEFAULT) || (FLAG == I2C_FLAG_GENCALL) || \ (FLAG == I2C_FLAG_TRA) || (FLAG == I2C_FLAG_BUSY) || \ (FLAG == I2C_FLAG_MSL) || (FLAG == I2C_FLAG_SMBALERT) || \ (FLAG == I2C_FLAG_TIMEOUT) || (FLAG == I2C_FLAG_PECERR) || \ (FLAG == I2C_FLAG_OVR) || (FLAG == I2C_FLAG_AF) || \ (FLAG == I2C_FLAG_ARLO) || (FLAG == I2C_FLAG_BERR) || \ (FLAG == I2C_FLAG_TXE) || (FLAG == I2C_FLAG_RXNE) || \ (FLAG == I2C_FLAG_STOPF) || (FLAG == I2C_FLAG_ADD10) || \ (FLAG == I2C_FLAG_BTF) || (FLAG == I2C_FLAG_ADDR) || \ (FLAG == I2C_FLAG_SB)) /* I2C Events */ /* EV1 */ #define I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED ((u32)0x00060082) /* TRA, BUSY, TXE and ADDR flags */ #define I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED ((u32)0x00020002) /* BUSY and ADDR flags */ #define I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED ((u32)0x00860080) /* DUALF, TRA, BUSY and TXE flags */ #define I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED ((u32)0x00820000) /* DUALF and BUSY flags */ #define I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED ((u32)0x00120000) /* GENCALL and BUSY flags */ /* EV2 */ #define I2C_EVENT_SLAVE_BYTE_RECEIVED ((u32)0x00020040) /* BUSY and RXNE flags */ /* EV3 */ #define I2C_EVENT_SLAVE_BYTE_TRANSMITTED ((u32)0x00060084) /* TRA, BUSY, TXE and BTF flags */ /* EV4 */ #define I2C_EVENT_SLAVE_STOP_DETECTED ((u32)0x00000010) /* STOPF flag */ /* EV5 */ #define I2C_EVENT_MASTER_MODE_SELECT ((u32)0x00030001) /* BUSY, MSL and SB flag */ /* EV6 */ #define I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED ((u32)0x00070082) /* BUSY, MSL, ADDR, TXE and TRA flags */ #define I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED ((u32)0x00030002) /* BUSY, MSL and ADDR flags */ /* EV7 */ #define I2C_EVENT_MASTER_BYTE_RECEIVED ((u32)0x00030040) /* BUSY, MSL and RXNE flags */ /* EV8 */ #define I2C_EVENT_MASTER_BYTE_TRANSMITTED ((u32)0x00070084) /* TRA, BUSY, MSL, TXE and BTF flags */ /* EV9 */ #define I2C_EVENT_MASTER_MODE_ADDRESS10 ((u32)0x00030008) /* BUSY, MSL and ADD10 flags */ /* EV3_1 */ #define I2C_EVENT_SLAVE_ACK_FAILURE ((u32)0x00000400) /* AF flag */ #define IS_I2C_EVENT(EVENT) ((EVENT == I2C_EVENT_SLAVE_TRANSMITTER_ADDRESS_MATCHED) || \ (EVENT == I2C_EVENT_SLAVE_RECEIVER_ADDRESS_MATCHED) || \ (EVENT == I2C_EVENT_SLAVE_TRANSMITTER_SECONDADDRESS_MATCHED) || \ (EVENT == I2C_EVENT_SLAVE_RECEIVER_SECONDADDRESS_MATCHED) || \ (EVENT == I2C_EVENT_SLAVE_GENERALCALLADDRESS_MATCHED) || \ (EVENT == I2C_EVENT_SLAVE_BYTE_RECEIVED) || \ (EVENT == I2C_EVENT_SLAVE_BYTE_TRANSMITTED) || \ (EVENT == I2C_EVENT_SLAVE_STOP_DETECTED) || \ (EVENT == I2C_EVENT_MASTER_MODE_SELECT) || \ (EVENT == I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED) || \ (EVENT == I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED) || \ (EVENT == I2C_EVENT_MASTER_BYTE_RECEIVED) || \ (EVENT == I2C_EVENT_MASTER_BYTE_TRANSMITTED) || \ (EVENT == I2C_EVENT_MASTER_MODE_ADDRESS10) || \ (EVENT == I2C_EVENT_SLAVE_ACK_FAILURE)) /* I2C own address1 -----------------------------------------------------------*/ #define IS_I2C_OWN_ADDRESS1(ADDRESS1) (ADDRESS1 <= 0x3FF) /* I2C clock speed ------------------------------------------------------------*/ #define IS_I2C_CLOCK_SPEED(SPEED) ((SPEED >= 0x1) && (SPEED <= 400000)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void I2C_DeInit(I2C_TypeDef* I2Cx); void I2C_Init(I2C_TypeDef* I2Cx, I2C_InitTypeDef* I2C_InitStruct); void I2C_StructInit(I2C_InitTypeDef* I2C_InitStruct); void I2C_Cmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_DMACmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_DMALastTransferCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_GenerateSTART(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_GenerateSTOP(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_AcknowledgeConfig(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_OwnAddress2Config(I2C_TypeDef* I2Cx, u8 Address); void I2C_DualAddressCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_GeneralCallCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_ITConfig(I2C_TypeDef* I2Cx, u16 I2C_IT, FunctionalState NewState); void I2C_SendData(I2C_TypeDef* I2Cx, u8 Data); u8 I2C_ReceiveData(I2C_TypeDef* I2Cx); void I2C_Send7bitAddress(I2C_TypeDef* I2Cx, u8 Address, u8 I2C_Direction); u16 I2C_ReadRegister(I2C_TypeDef* I2Cx, u8 I2C_Register); void I2C_SoftwareResetCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_SMBusAlertConfig(I2C_TypeDef* I2Cx, u16 I2C_SMBusAlert); void I2C_TransmitPEC(I2C_TypeDef* I2Cx); void I2C_PECPositionConfig(I2C_TypeDef* I2Cx, u16 I2C_PECPosition); void I2C_CalculatePEC(I2C_TypeDef* I2Cx, FunctionalState NewState); u8 I2C_GetPEC(I2C_TypeDef* I2Cx); void I2C_ARPCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_StretchClockCmd(I2C_TypeDef* I2Cx, FunctionalState NewState); void I2C_FastModeDutyCycleConfig(I2C_TypeDef* I2Cx, u16 I2C_DutyCycle); u32 I2C_GetLastEvent(I2C_TypeDef* I2Cx); ErrorStatus I2C_CheckEvent(I2C_TypeDef* I2Cx, u32 I2C_EVENT); FlagStatus I2C_GetFlagStatus(I2C_TypeDef* I2Cx, u32 I2C_FLAG); void I2C_ClearFlag(I2C_TypeDef* I2Cx, u32 I2C_FLAG); ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, u32 I2C_IT); void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, u32 I2C_IT); #endif /*__STM32F10x_I2C_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_i2c.h
C
oos
15,245
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_wwdg.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * WWDG firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_WWDG_H #define __STM32F10x_WWDG_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* WWDG Prescaler */ #define WWDG_Prescaler_1 ((u32)0x00000000) #define WWDG_Prescaler_2 ((u32)0x00000080) #define WWDG_Prescaler_4 ((u32)0x00000100) #define WWDG_Prescaler_8 ((u32)0x00000180) #define IS_WWDG_PRESCALER(PRESCALER) ((PRESCALER == WWDG_Prescaler_1) || \ (PRESCALER == WWDG_Prescaler_2) || \ (PRESCALER == WWDG_Prescaler_4) || \ (PRESCALER == WWDG_Prescaler_8)) #define IS_WWDG_WINDOW_VALUE(VALUE) (VALUE <= 0x7F) #define IS_WWDG_COUNTER(COUNTER) ((COUNTER >= 0x40) && (COUNTER <= 0x7F)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void WWDG_DeInit(void); void WWDG_SetPrescaler(u32 WWDG_Prescaler); void WWDG_SetWindowValue(u8 WindowValue); void WWDG_EnableIT(void); void WWDG_SetCounter(u8 Counter); void WWDG_Enable(u8 Counter); FlagStatus WWDG_GetFlagStatus(void); void WWDG_ClearFlag(void); #endif /* __STM32F10x_WWDG_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_wwdg.h
C
oos
2,730
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : spi_flash.h * Author : MCD Application Team * Date First Issued : 02/05/2007 * Description : Header for spi_flash.c file. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __SPI_FLASH_H #define __SPI_FLASH_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_lib.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ #define Low 0x00 /* Chip Select line low */ #define High 0x01 /* Chip Select line high */ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ /*----- High layer function -----*/ void SPI_FLASH_Init(void); void SPI_FLASH_SectorErase(u32 SectorAddr); void SPI_FLASH_BulkErase(void); void SPI_FLASH_PageWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite); void SPI_FLASH_BufferWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite); void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead); u32 SPI_FLASH_ReadID(void); void SPI_FLASH_StartReadSequence(u32 ReadAddr); /*----- Low layer function -----*/ u8 SPI_FLASH_ReadByte(void); void SPI_FLASH_ChipSelect(u8 State); u8 SPI_FLASH_SendByte(u8 byte); u16 SPI_FLASH_SendHalfWord(u16 HalfWord); void SPI_FLASH_WriteEnable(void); void SPI_FLASH_WaitForWriteEnd(void); #endif /* __SPI_FLASH_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/spi_flash.h
C
oos
2,503
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_exti.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * EXTI firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_EXTI_H #define __STM32F10x_EXTI_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* EXTI mode enumeration -----------------------------------------------------*/ typedef enum { EXTI_Mode_Interrupt = 0x00, EXTI_Mode_Event = 0x04 }EXTIMode_TypeDef; #define IS_EXTI_MODE(MODE) ((MODE == EXTI_Mode_Interrupt) || (MODE == EXTI_Mode_Event)) /* EXTI Trigger enumeration --------------------------------------------------*/ typedef enum { EXTI_Trigger_Rising = 0x08, EXTI_Trigger_Falling = 0x0C, EXTI_Trigger_Rising_Falling = 0x10 }EXTITrigger_TypeDef; #define IS_EXTI_TRIGGER(TRIGGER) ((TRIGGER == EXTI_Trigger_Rising) || \ (TRIGGER == EXTI_Trigger_Falling) || \ (TRIGGER == EXTI_Trigger_Rising_Falling)) /* EXTI Init Structure definition --------------------------------------------*/ typedef struct { u32 EXTI_Line; EXTIMode_TypeDef EXTI_Mode; EXTITrigger_TypeDef EXTI_Trigger; FunctionalState EXTI_LineCmd; }EXTI_InitTypeDef; /* Exported constants --------------------------------------------------------*/ /* EXTI Lines ----------------------------------------------------------------*/ #define EXTI_Line0 ((u32)0x00001) /* External interrupt line 0 */ #define EXTI_Line1 ((u32)0x00002) /* External interrupt line 1 */ #define EXTI_Line2 ((u32)0x00004) /* External interrupt line 2 */ #define EXTI_Line3 ((u32)0x00008) /* External interrupt line 3 */ #define EXTI_Line4 ((u32)0x00010) /* External interrupt line 4 */ #define EXTI_Line5 ((u32)0x00020) /* External interrupt line 5 */ #define EXTI_Line6 ((u32)0x00040) /* External interrupt line 6 */ #define EXTI_Line7 ((u32)0x00080) /* External interrupt line 7 */ #define EXTI_Line8 ((u32)0x00100) /* External interrupt line 8 */ #define EXTI_Line9 ((u32)0x00200) /* External interrupt line 9 */ #define EXTI_Line10 ((u32)0x00400) /* External interrupt line 10 */ #define EXTI_Line11 ((u32)0x00800) /* External interrupt line 11 */ #define EXTI_Line12 ((u32)0x01000) /* External interrupt line 12 */ #define EXTI_Line13 ((u32)0x02000) /* External interrupt line 13 */ #define EXTI_Line14 ((u32)0x04000) /* External interrupt line 14 */ #define EXTI_Line15 ((u32)0x08000) /* External interrupt line 15 */ #define EXTI_Line16 ((u32)0x10000) /* External interrupt line 16 Connected to the PVD Output */ #define EXTI_Line17 ((u32)0x20000) /* External interrupt line 17 Connected to the RTC Alarm event */ #define EXTI_Line18 ((u32)0x40000) /* External interrupt line 18 Connected to the USB Wakeup from suspend event */ #define IS_EXTI_LINE(LINE) (((LINE & (u32)0xFFF80000) == 0x00) && (LINE != (u16)0x00)) #define IS_GET_EXTI_LINE(LINE) ((LINE == EXTI_Line0) || (LINE == EXTI_Line1) || \ (LINE == EXTI_Line2) || (LINE == EXTI_Line3) || \ (LINE == EXTI_Line4) || (LINE == EXTI_Line5) || \ (LINE == EXTI_Line6) || (LINE == EXTI_Line7) || \ (LINE == EXTI_Line8) || (LINE == EXTI_Line9) || \ (LINE == EXTI_Line10) || (LINE == EXTI_Line11) || \ (LINE == EXTI_Line12) || (LINE == EXTI_Line13) || \ (LINE == EXTI_Line14) || (LINE == EXTI_Line15) || \ (LINE == EXTI_Line16) || (LINE == EXTI_Line17) || \ (LINE == EXTI_Line18)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void EXTI_DeInit(void); void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct); void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); void EXTI_GenerateSWInterrupt(u32 EXTI_Line); FlagStatus EXTI_GetFlagStatus(u32 EXTI_Line); void EXTI_ClearFlag(u32 EXTI_Line); ITStatus EXTI_GetITStatus(u32 EXTI_Line); void EXTI_ClearITPendingBit(u32 EXTI_Line); #endif /* __STM32F10x_EXTI_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_exti.h
C
oos
5,848
/** ****************************************************************************** * @file misc.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the * miscellaneous firmware library functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __MISC_H #define __MISC_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup MISC * @{ */ /** @defgroup MISC_Exported_Types * @{ */ /** * @brief NVIC Init Structure definition */ typedef struct { uint8_t NVIC_IRQChannel; uint8_t NVIC_IRQChannelPreemptionPriority; uint8_t NVIC_IRQChannelSubPriority; FunctionalState NVIC_IRQChannelCmd; } NVIC_InitTypeDef; /** * @} */ /** @defgroup MISC_Exported_Constants * @{ */ /** @defgroup Vector_Table_Base * @{ */ #define NVIC_VectTab_RAM ((uint32_t)0x20000000) #define NVIC_VectTab_FLASH ((uint32_t)0x08000000) #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \ ((VECTTAB) == NVIC_VectTab_FLASH)) /** * @} */ /** @defgroup System_Low_Power * @{ */ #define NVIC_LP_SEVONPEND ((uint8_t)0x10) #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04) #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02) #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \ ((LP) == NVIC_LP_SLEEPDEEP) || \ ((LP) == NVIC_LP_SLEEPONEXIT)) /** * @} */ /** @defgroup Preemption_Priority_Group * @{ */ #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /* 0 bits for pre-emption priority 4 bits for subpriority */ #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /* 1 bits for pre-emption priority 3 bits for subpriority */ #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /* 2 bits for pre-emption priority 2 bits for subpriority */ #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /* 3 bits for pre-emption priority 1 bits for subpriority */ #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /* 4 bits for pre-emption priority 0 bits for subpriority */ #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \ ((GROUP) == NVIC_PriorityGroup_1) || \ ((GROUP) == NVIC_PriorityGroup_2) || \ ((GROUP) == NVIC_PriorityGroup_3) || \ ((GROUP) == NVIC_PriorityGroup_4)) #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x0007FFFF) /** * @} */ /** @defgroup SysTick_clock_source * @{ */ #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB) #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004) #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \ ((SOURCE) == SysTick_CLKSource_HCLK_Div8)) /** * @} */ /** * @} */ /** @defgroup MISC_Exported_Macros * @{ */ /** * @} */ /** @defgroup MISC_Exported_Functions * @{ */ void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup); void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset); void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState); void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource); #endif /* __MISC_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/misc.h
C
oos
4,951
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_pwr.h * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file contains all the functions prototypes for the * PWR firmware library. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_PWR_H #define __STM32F10x_PWR_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_map.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* PVD detection level */ #define PWR_PVDLevel_2V2 ((u32)0x00000000) #define PWR_PVDLevel_2V3 ((u32)0x00000020) #define PWR_PVDLevel_2V4 ((u32)0x00000040) #define PWR_PVDLevel_2V5 ((u32)0x00000060) #define PWR_PVDLevel_2V6 ((u32)0x00000080) #define PWR_PVDLevel_2V7 ((u32)0x000000A0) #define PWR_PVDLevel_2V8 ((u32)0x000000C0) #define PWR_PVDLevel_2V9 ((u32)0x000000E0) #define IS_PWR_PVD_LEVEL(LEVEL) ((LEVEL == PWR_PVDLevel_2V2) || (LEVEL == PWR_PVDLevel_2V3)|| \ (LEVEL == PWR_PVDLevel_2V4) || (LEVEL == PWR_PVDLevel_2V5)|| \ (LEVEL == PWR_PVDLevel_2V6) || (LEVEL == PWR_PVDLevel_2V7)|| \ (LEVEL == PWR_PVDLevel_2V8) || (LEVEL == PWR_PVDLevel_2V9)) /* Regulator state is STOP mode */ #define PWR_Regulator_ON ((u32)0x00000000) #define PWR_Regulator_LowPower ((u32)0x00000001) #define IS_PWR_REGULATOR(REGULATOR) ((REGULATOR == PWR_Regulator_ON) || \ (REGULATOR == PWR_Regulator_LowPower)) /* STOP mode entry */ #define PWR_STOPEntry_WFI ((u8)0x01) #define PWR_STOPEntry_WFE ((u8)0x02) #define IS_PWR_STOP_ENTRY(ENTRY) ((ENTRY == PWR_STOPEntry_WFI) || (ENTRY == PWR_STOPEntry_WFE)) /* PWR Flag */ #define PWR_FLAG_WU ((u32)0x00000001) #define PWR_FLAG_SB ((u32)0x00000002) #define PWR_FLAG_PVDO ((u32)0x00000004) #define IS_PWR_GET_FLAG(FLAG) ((FLAG == PWR_FLAG_WU) || (FLAG == PWR_FLAG_SB) || \ (FLAG == PWR_FLAG_PVDO)) #define IS_PWR_CLEAR_FLAG(FLAG) ((FLAG == PWR_FLAG_WU) || (FLAG == PWR_FLAG_SB)) /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void PWR_DeInit(void); void PWR_BackupAccessCmd(FunctionalState NewState); void PWR_PVDCmd(FunctionalState NewState); void PWR_PVDLevelConfig(u32 PWR_PVDLevel); void PWR_WakeUpPinCmd(FunctionalState NewState); void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry); void PWR_EnterSTANDBYMode(void); FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG); void PWR_ClearFlag(u32 PWR_FLAG); #endif /* __STM32F10x_PWR_H */ /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_pwr.h
C
oos
3,955
/** ****************************************************************************** * @file stm32f10x_sdio.h * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file contains all the functions prototypes for the SDIO * firmware library. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F10x_SDIO_H #define __STM32F10x_SDIO_H /* Includes ------------------------------------------------------------------*/ #include "stm32f10x.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @addtogroup SDIO * @{ */ /** @defgroup SDIO_Exported_Types * @{ */ typedef struct { uint8_t SDIO_ClockDiv; uint32_t SDIO_ClockEdge; uint32_t SDIO_ClockBypass; uint32_t SDIO_ClockPowerSave; uint32_t SDIO_BusWide; uint32_t SDIO_HardwareFlowControl; } SDIO_InitTypeDef; typedef struct { uint32_t SDIO_Argument; uint32_t SDIO_CmdIndex; uint32_t SDIO_Response; uint32_t SDIO_Wait; uint32_t SDIO_CPSM; } SDIO_CmdInitTypeDef; typedef struct { uint32_t SDIO_DataTimeOut; uint32_t SDIO_DataLength; uint32_t SDIO_DataBlockSize; uint32_t SDIO_TransferDir; uint32_t SDIO_TransferMode; uint32_t SDIO_DPSM; } SDIO_DataInitTypeDef; /** * @} */ /** @defgroup SDIO_Exported_Constants * @{ */ /** @defgroup SDIO_Clock_Edge * @{ */ #define SDIO_ClockEdge_Rising ((uint32_t)0x00000000) #define SDIO_ClockEdge_Falling ((uint32_t)0x00002000) #define IS_SDIO_CLOCK_EDGE(EDGE) (((EDGE) == SDIO_ClockEdge_Rising) || \ ((EDGE) == SDIO_ClockEdge_Falling)) /** * @} */ /** @defgroup SDIO_Clock_Bypass * @{ */ #define SDIO_ClockBypass_Disable ((uint32_t)0x00000000) #define SDIO_ClockBypass_Enable ((uint32_t)0x00000400) #define IS_SDIO_CLOCK_BYPASS(BYPASS) (((BYPASS) == SDIO_ClockBypass_Disable) || \ ((BYPASS) == SDIO_ClockBypass_Enable)) /** * @} */ /** @defgroup SDIO_Clock_Power_Save_ * @{ */ #define SDIO_ClockPowerSave_Disable ((uint32_t)0x00000000) #define SDIO_ClockPowerSave_Enable ((uint32_t)0x00000200) #define IS_SDIO_CLOCK_POWER_SAVE(SAVE) (((SAVE) == SDIO_ClockPowerSave_Disable) || \ ((SAVE) == SDIO_ClockPowerSave_Enable)) /** * @} */ /** @defgroup SDIO_Bus_Wide * @{ */ #define SDIO_BusWide_1b ((uint32_t)0x00000000) #define SDIO_BusWide_4b ((uint32_t)0x00000800) #define SDIO_BusWide_8b ((uint32_t)0x00001000) #define IS_SDIO_BUS_WIDE(WIDE) (((WIDE) == SDIO_BusWide_1b) || ((WIDE) == SDIO_BusWide_4b) || \ ((WIDE) == SDIO_BusWide_8b)) /** * @} */ /** @defgroup SDIO_Hardware_Flow_Control_ * @{ */ #define SDIO_HardwareFlowControl_Disable ((uint32_t)0x00000000) #define SDIO_HardwareFlowControl_Enable ((uint32_t)0x00004000) #define IS_SDIO_HARDWARE_FLOW_CONTROL(CONTROL) (((CONTROL) == SDIO_HardwareFlowControl_Disable) || \ ((CONTROL) == SDIO_HardwareFlowControl_Enable)) /** * @} */ /** @defgroup SDIO_Power_State * @{ */ #define SDIO_PowerState_OFF ((uint32_t)0x00000000) #define SDIO_PowerState_ON ((uint32_t)0x00000003) #define IS_SDIO_POWER_STATE(STATE) (((STATE) == SDIO_PowerState_OFF) || ((STATE) == SDIO_PowerState_ON)) /** * @} */ /** @defgroup SDIO_Interrupt_soucres * @{ */ #define SDIO_IT_CCRCFAIL ((uint32_t)0x00000001) #define SDIO_IT_DCRCFAIL ((uint32_t)0x00000002) #define SDIO_IT_CTIMEOUT ((uint32_t)0x00000004) #define SDIO_IT_DTIMEOUT ((uint32_t)0x00000008) #define SDIO_IT_TXUNDERR ((uint32_t)0x00000010) #define SDIO_IT_RXOVERR ((uint32_t)0x00000020) #define SDIO_IT_CMDREND ((uint32_t)0x00000040) #define SDIO_IT_CMDSENT ((uint32_t)0x00000080) #define SDIO_IT_DATAEND ((uint32_t)0x00000100) #define SDIO_IT_STBITERR ((uint32_t)0x00000200) #define SDIO_IT_DBCKEND ((uint32_t)0x00000400) #define SDIO_IT_CMDACT ((uint32_t)0x00000800) #define SDIO_IT_TXACT ((uint32_t)0x00001000) #define SDIO_IT_RXACT ((uint32_t)0x00002000) #define SDIO_IT_TXFIFOHE ((uint32_t)0x00004000) #define SDIO_IT_RXFIFOHF ((uint32_t)0x00008000) #define SDIO_IT_TXFIFOF ((uint32_t)0x00010000) #define SDIO_IT_RXFIFOF ((uint32_t)0x00020000) #define SDIO_IT_TXFIFOE ((uint32_t)0x00040000) #define SDIO_IT_RXFIFOE ((uint32_t)0x00080000) #define SDIO_IT_TXDAVL ((uint32_t)0x00100000) #define SDIO_IT_RXDAVL ((uint32_t)0x00200000) #define SDIO_IT_SDIOIT ((uint32_t)0x00400000) #define SDIO_IT_CEATAEND ((uint32_t)0x00800000) #define IS_SDIO_IT(IT) ((((IT) & (uint32_t)0xFF000000) == 0x00) && ((IT) != (uint32_t)0x00)) /** * @} */ /** @defgroup SDIO_Command_Index_ * @{ */ #define IS_SDIO_CMD_INDEX(INDEX) ((INDEX) < 0x40) /** * @} */ /** @defgroup SDIO_Response_Type * @{ */ #define SDIO_Response_No ((uint32_t)0x00000000) #define SDIO_Response_Short ((uint32_t)0x00000040) #define SDIO_Response_Long ((uint32_t)0x000000C0) #define IS_SDIO_RESPONSE(RESPONSE) (((RESPONSE) == SDIO_Response_No) || \ ((RESPONSE) == SDIO_Response_Short) || \ ((RESPONSE) == SDIO_Response_Long)) /** * @} */ /** @defgroup SDIO_Wait_Interrupt_State * @{ */ #define SDIO_Wait_No ((uint32_t)0x00000000) /* SDIO No Wait, TimeOut is enabled */ #define SDIO_Wait_IT ((uint32_t)0x00000100) /* SDIO Wait Interrupt Request */ #define SDIO_Wait_Pend ((uint32_t)0x00000200) /* SDIO Wait End of transfer */ #define IS_SDIO_WAIT(WAIT) (((WAIT) == SDIO_Wait_No) || ((WAIT) == SDIO_Wait_IT) || \ ((WAIT) == SDIO_Wait_Pend)) /** * @} */ /** @defgroup SDIO_CPSM_State * @{ */ #define SDIO_CPSM_Disable ((uint32_t)0x00000000) #define SDIO_CPSM_Enable ((uint32_t)0x00000400) #define IS_SDIO_CPSM(CPSM) (((CPSM) == SDIO_CPSM_Enable) || ((CPSM) == SDIO_CPSM_Disable)) /** * @} */ /** @defgroup SDIO_Response_Registers * @{ */ #define SDIO_RESP1 ((uint32_t)0x00000000) #define SDIO_RESP2 ((uint32_t)0x00000004) #define SDIO_RESP3 ((uint32_t)0x00000008) #define SDIO_RESP4 ((uint32_t)0x0000000C) #define IS_SDIO_RESP(RESP) (((RESP) == SDIO_RESP1) || ((RESP) == SDIO_RESP2) || \ ((RESP) == SDIO_RESP3) || ((RESP) == SDIO_RESP4)) /** * @} */ /** @defgroup SDIO_Data_Length * @{ */ #define IS_SDIO_DATA_LENGTH(LENGTH) ((LENGTH) <= 0x01FFFFFF) /** * @} */ /** @defgroup SDIO_Data_Block_Size * @{ */ #define SDIO_DataBlockSize_1b ((uint32_t)0x00000000) #define SDIO_DataBlockSize_2b ((uint32_t)0x00000010) #define SDIO_DataBlockSize_4b ((uint32_t)0x00000020) #define SDIO_DataBlockSize_8b ((uint32_t)0x00000030) #define SDIO_DataBlockSize_16b ((uint32_t)0x00000040) #define SDIO_DataBlockSize_32b ((uint32_t)0x00000050) #define SDIO_DataBlockSize_64b ((uint32_t)0x00000060) #define SDIO_DataBlockSize_128b ((uint32_t)0x00000070) #define SDIO_DataBlockSize_256b ((uint32_t)0x00000080) #define SDIO_DataBlockSize_512b ((uint32_t)0x00000090) #define SDIO_DataBlockSize_1024b ((uint32_t)0x000000A0) #define SDIO_DataBlockSize_2048b ((uint32_t)0x000000B0) #define SDIO_DataBlockSize_4096b ((uint32_t)0x000000C0) #define SDIO_DataBlockSize_8192b ((uint32_t)0x000000D0) #define SDIO_DataBlockSize_16384b ((uint32_t)0x000000E0) #define IS_SDIO_BLOCK_SIZE(SIZE) (((SIZE) == SDIO_DataBlockSize_1b) || \ ((SIZE) == SDIO_DataBlockSize_2b) || \ ((SIZE) == SDIO_DataBlockSize_4b) || \ ((SIZE) == SDIO_DataBlockSize_8b) || \ ((SIZE) == SDIO_DataBlockSize_16b) || \ ((SIZE) == SDIO_DataBlockSize_32b) || \ ((SIZE) == SDIO_DataBlockSize_64b) || \ ((SIZE) == SDIO_DataBlockSize_128b) || \ ((SIZE) == SDIO_DataBlockSize_256b) || \ ((SIZE) == SDIO_DataBlockSize_512b) || \ ((SIZE) == SDIO_DataBlockSize_1024b) || \ ((SIZE) == SDIO_DataBlockSize_2048b) || \ ((SIZE) == SDIO_DataBlockSize_4096b) || \ ((SIZE) == SDIO_DataBlockSize_8192b) || \ ((SIZE) == SDIO_DataBlockSize_16384b)) /** * @} */ /** @defgroup SDIO_Transfer_Direction * @{ */ #define SDIO_TransferDir_ToCard ((uint32_t)0x00000000) #define SDIO_TransferDir_ToSDIO ((uint32_t)0x00000002) #define IS_SDIO_TRANSFER_DIR(DIR) (((DIR) == SDIO_TransferDir_ToCard) || \ ((DIR) == SDIO_TransferDir_ToSDIO)) /** * @} */ /** @defgroup SDIO_Transfer_Type * @{ */ #define SDIO_TransferMode_Block ((uint32_t)0x00000000) #define SDIO_TransferMode_Stream ((uint32_t)0x00000004) #define IS_SDIO_TRANSFER_MODE(MODE) (((MODE) == SDIO_TransferMode_Stream) || \ ((MODE) == SDIO_TransferMode_Block)) /** * @} */ /** @defgroup SDIO_DPSM_State * @{ */ #define SDIO_DPSM_Disable ((uint32_t)0x00000000) #define SDIO_DPSM_Enable ((uint32_t)0x00000001) #define IS_SDIO_DPSM(DPSM) (((DPSM) == SDIO_DPSM_Enable) || ((DPSM) == SDIO_DPSM_Disable)) /** * @} */ /** @defgroup SDIO_Flags * @{ */ #define SDIO_FLAG_CCRCFAIL ((uint32_t)0x00000001) #define SDIO_FLAG_DCRCFAIL ((uint32_t)0x00000002) #define SDIO_FLAG_CTIMEOUT ((uint32_t)0x00000004) #define SDIO_FLAG_DTIMEOUT ((uint32_t)0x00000008) #define SDIO_FLAG_TXUNDERR ((uint32_t)0x00000010) #define SDIO_FLAG_RXOVERR ((uint32_t)0x00000020) #define SDIO_FLAG_CMDREND ((uint32_t)0x00000040) #define SDIO_FLAG_CMDSENT ((uint32_t)0x00000080) #define SDIO_FLAG_DATAEND ((uint32_t)0x00000100) #define SDIO_FLAG_STBITERR ((uint32_t)0x00000200) #define SDIO_FLAG_DBCKEND ((uint32_t)0x00000400) #define SDIO_FLAG_CMDACT ((uint32_t)0x00000800) #define SDIO_FLAG_TXACT ((uint32_t)0x00001000) #define SDIO_FLAG_RXACT ((uint32_t)0x00002000) #define SDIO_FLAG_TXFIFOHE ((uint32_t)0x00004000) #define SDIO_FLAG_RXFIFOHF ((uint32_t)0x00008000) #define SDIO_FLAG_TXFIFOF ((uint32_t)0x00010000) #define SDIO_FLAG_RXFIFOF ((uint32_t)0x00020000) #define SDIO_FLAG_TXFIFOE ((uint32_t)0x00040000) #define SDIO_FLAG_RXFIFOE ((uint32_t)0x00080000) #define SDIO_FLAG_TXDAVL ((uint32_t)0x00100000) #define SDIO_FLAG_RXDAVL ((uint32_t)0x00200000) #define SDIO_FLAG_SDIOIT ((uint32_t)0x00400000) #define SDIO_FLAG_CEATAEND ((uint32_t)0x00800000) #define IS_SDIO_FLAG(FLAG) (((FLAG) == SDIO_FLAG_CCRCFAIL) || \ ((FLAG) == SDIO_FLAG_DCRCFAIL) || \ ((FLAG) == SDIO_FLAG_CTIMEOUT) || \ ((FLAG) == SDIO_FLAG_DTIMEOUT) || \ ((FLAG) == SDIO_FLAG_TXUNDERR) || \ ((FLAG) == SDIO_FLAG_RXOVERR) || \ ((FLAG) == SDIO_FLAG_CMDREND) || \ ((FLAG) == SDIO_FLAG_CMDSENT) || \ ((FLAG) == SDIO_FLAG_DATAEND) || \ ((FLAG) == SDIO_FLAG_STBITERR) || \ ((FLAG) == SDIO_FLAG_DBCKEND) || \ ((FLAG) == SDIO_FLAG_CMDACT) || \ ((FLAG) == SDIO_FLAG_TXACT) || \ ((FLAG) == SDIO_FLAG_RXACT) || \ ((FLAG) == SDIO_FLAG_TXFIFOHE) || \ ((FLAG) == SDIO_FLAG_RXFIFOHF) || \ ((FLAG) == SDIO_FLAG_TXFIFOF) || \ ((FLAG) == SDIO_FLAG_RXFIFOF) || \ ((FLAG) == SDIO_FLAG_TXFIFOE) || \ ((FLAG) == SDIO_FLAG_RXFIFOE) || \ ((FLAG) == SDIO_FLAG_TXDAVL) || \ ((FLAG) == SDIO_FLAG_RXDAVL) || \ ((FLAG) == SDIO_FLAG_SDIOIT) || \ ((FLAG) == SDIO_FLAG_CEATAEND)) #define IS_SDIO_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFF3FF800) == 0x00) && ((FLAG) != (uint32_t)0x00)) #define IS_SDIO_GET_IT(IT) (((IT) == SDIO_IT_CCRCFAIL) || \ ((IT) == SDIO_IT_DCRCFAIL) || \ ((IT) == SDIO_IT_CTIMEOUT) || \ ((IT) == SDIO_IT_DTIMEOUT) || \ ((IT) == SDIO_IT_TXUNDERR) || \ ((IT) == SDIO_IT_RXOVERR) || \ ((IT) == SDIO_IT_CMDREND) || \ ((IT) == SDIO_IT_CMDSENT) || \ ((IT) == SDIO_IT_DATAEND) || \ ((IT) == SDIO_IT_STBITERR) || \ ((IT) == SDIO_IT_DBCKEND) || \ ((IT) == SDIO_IT_CMDACT) || \ ((IT) == SDIO_IT_TXACT) || \ ((IT) == SDIO_IT_RXACT) || \ ((IT) == SDIO_IT_TXFIFOHE) || \ ((IT) == SDIO_IT_RXFIFOHF) || \ ((IT) == SDIO_IT_TXFIFOF) || \ ((IT) == SDIO_IT_RXFIFOF) || \ ((IT) == SDIO_IT_TXFIFOE) || \ ((IT) == SDIO_IT_RXFIFOE) || \ ((IT) == SDIO_IT_TXDAVL) || \ ((IT) == SDIO_IT_RXDAVL) || \ ((IT) == SDIO_IT_SDIOIT) || \ ((IT) == SDIO_IT_CEATAEND)) #define IS_SDIO_CLEAR_IT(IT) ((((IT) & (uint32_t)0xFF3FF800) == 0x00) && ((IT) != (uint32_t)0x00)) /** * @} */ /** @defgroup SDIO_Read_Wait_Mode * @{ */ #define SDIO_ReadWaitMode_CLK ((uint32_t)0x00000000) #define SDIO_ReadWaitMode_DATA2 ((uint32_t)0x00000001) #define IS_SDIO_READWAIT_MODE(MODE) (((MODE) == SDIO_ReadWaitMode_CLK) || \ ((MODE) == SDIO_ReadWaitMode_DATA2)) /** * @} */ /** * @} */ /** @defgroup SDIO_Exported_Macros * @{ */ /** * @} */ /** @defgroup SDIO_Exported_Functions * @{ */ void SDIO_DeInit(void); void SDIO_Init(SDIO_InitTypeDef* SDIO_InitStruct); void SDIO_StructInit(SDIO_InitTypeDef* SDIO_InitStruct); void SDIO_ClockCmd(FunctionalState NewState); void SDIO_SetPowerState(uint32_t SDIO_PowerState); uint32_t SDIO_GetPowerState(void); void SDIO_ITConfig(uint32_t SDIO_IT, FunctionalState NewState); void SDIO_DMACmd(FunctionalState NewState); void SDIO_SendCommand(SDIO_CmdInitTypeDef *SDIO_CmdInitStruct); void SDIO_CmdStructInit(SDIO_CmdInitTypeDef* SDIO_CmdInitStruct); uint8_t SDIO_GetCommandResponse(void); uint32_t SDIO_GetResponse(uint32_t SDIO_RESP); void SDIO_DataConfig(SDIO_DataInitTypeDef* SDIO_DataInitStruct); void SDIO_DataStructInit(SDIO_DataInitTypeDef* SDIO_DataInitStruct); uint32_t SDIO_GetDataCounter(void); uint32_t SDIO_ReadData(void); void SDIO_WriteData(uint32_t Data); uint32_t SDIO_GetFIFOCount(void); void SDIO_StartSDIOReadWait(FunctionalState NewState); void SDIO_StopSDIOReadWait(FunctionalState NewState); void SDIO_SetSDIOReadWaitMode(uint32_t SDIO_ReadWaitMode); void SDIO_SetSDIOOperation(FunctionalState NewState); void SDIO_SendSDIOSuspendCmd(FunctionalState NewState); void SDIO_CommandCompletionCmd(FunctionalState NewState); void SDIO_CEATAITCmd(FunctionalState NewState); void SDIO_SendCEATACmd(FunctionalState NewState); FlagStatus SDIO_GetFlagStatus(uint32_t SDIO_FLAG); void SDIO_ClearFlag(uint32_t SDIO_FLAG); ITStatus SDIO_GetITStatus(uint32_t SDIO_IT); void SDIO_ClearITPendingBit(uint32_t SDIO_IT); #endif /* __STM32F10x_SDIO_H */ /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/inc/stm32f10x_sdio.h
C
oos
18,598
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_bkp.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the BKP firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_bkp.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ------------ BKP registers bit address in the alias region ----------- */ #define BKP_OFFSET (BKP_BASE - PERIPH_BASE) /* --- RTCCR Register ---*/ /* Alias word address of CCO bit */ #define RTCCR_OFFSET (BKP_OFFSET + 0x2C) #define CCO_BitNumber 0x07 #define RTCCR_CCO_BB (PERIPH_BB_BASE + (RTCCR_OFFSET * 32) + (CCO_BitNumber * 4)) /* --- CR Register ---*/ /* Alias word address of TPAL bit */ #define CR_OFFSET (BKP_OFFSET + 0x30) #define TPAL_BitNumber 0x01 #define CR_TPAL_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPAL_BitNumber * 4)) /* Alias word address of TPE bit */ #define TPE_BitNumber 0x00 #define CR_TPE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPE_BitNumber * 4)) /* --- CSR Register ---*/ /* Alias word address of TPIE bit */ #define CSR_OFFSET (BKP_OFFSET + 0x34) #define TPIE_BitNumber 0x02 #define CSR_TPIE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TPIE_BitNumber * 4)) /* Alias word address of TIF bit */ #define TIF_BitNumber 0x09 #define CSR_TIF_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TIF_BitNumber * 4)) /* Alias word address of TEF bit */ #define TEF_BitNumber 0x08 #define CSR_TEF_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TEF_BitNumber * 4)) /* ---------------------- BKP registers bit mask ------------------------ */ /* RTCCR register bit mask */ #define RTCCR_CAL_Mask ((u16)0xFF80) /* CSR register bit mask */ #define CSR_CTE_Set ((u16)0x0001) #define CSR_CTI_Set ((u16)0x0002) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : BKP_DeInit * Description : Deinitializes the BKP peripheral registers to their default * reset values. * Input : None * Output : None * Return : None *******************************************************************************/ void BKP_DeInit(void) { RCC_BackupResetCmd(ENABLE); RCC_BackupResetCmd(DISABLE); } /******************************************************************************* * Function Name : BKP_TamperPinLevelConfig * Description : Configures the Tamper Pin active level. * Input : - BKP_TamperPinLevel: specifies the Tamper Pin active level. * This parameter can be one of the following values: * - BKP_TamperPinLevel_High: Tamper pin active on high level * - BKP_TamperPinLevel_Low: Tamper pin active on low level * Output : None * Return : None *******************************************************************************/ void BKP_TamperPinLevelConfig(u16 BKP_TamperPinLevel) { /* Check the parameters */ assert(IS_BKP_TAMPER_PIN_LEVEL(BKP_TamperPinLevel)); *(vu32 *) CR_TPAL_BB = BKP_TamperPinLevel; } /******************************************************************************* * Function Name : BKP_TamperPinCmd * Description : Enables or disables the Tamper Pin activation. * Input : - NewState: new state of the Tamper Pin activation. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void BKP_TamperPinCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) CR_TPE_BB = (u32)NewState; } /******************************************************************************* * Function Name : BKP_ITConfig * Description : Enables or disables the Tamper Pin Interrupt. * Input : - NewState: new state of the Tamper Pin Interrupt. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void BKP_ITConfig(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) CSR_TPIE_BB = (u32)NewState; } /******************************************************************************* * Function Name : BKP_RTCCalibrationClockOutputCmd * Description : Enables or disables the output of the Calibration Clock. * Input : - NewState: new state of the Calibration Clock output. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void BKP_RTCCalibrationClockOutputCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) RTCCR_CCO_BB = (u32)NewState; } /******************************************************************************* * Function Name : BKP_SetRTCCalibrationValue * Description : Sets RTC Clock Calibration value. * Input : - CalibrationValue: specifies the RTC Clock Calibration value. * This parameter must be a number between 0 and 0x7F. * Output : None * Return : None *******************************************************************************/ void BKP_SetRTCCalibrationValue(u8 CalibrationValue) { u16 tmpreg = 0; /* Check the parameters */ assert(IS_BKP_CALIBRATION_VALUE(CalibrationValue)); tmpreg = BKP->RTCCR; /* Clear CAL[6:0] bits */ tmpreg &= RTCCR_CAL_Mask; /* Set CAL[6:0] bits according to CalibrationValue value */ tmpreg |= CalibrationValue; /* Store the new value */ BKP->RTCCR = tmpreg; } /******************************************************************************* * Function Name : BKP_WriteBackupRegister * Description : Writes user data to the specified Data Backup Register. * Input : - BKP_DR: specifies the Data Backup Register. * This parameter can be BKP_DRx where x:[1, 10] * - Data: data to write * Output : None * Return : None *******************************************************************************/ void BKP_WriteBackupRegister(u16 BKP_DR, u16 Data) { /* Check the parameters */ assert(IS_BKP_DR(BKP_DR)); *(vu16 *) (BKP_BASE + BKP_DR) = Data; } /******************************************************************************* * Function Name : BKP_ReadBackupRegister * Description : Reads data from the specified Data Backup Register. * Input : - BKP_DR: specifies the Data Backup Register. * This parameter can be BKP_DRx where x:[1, 10] * Output : None * Return : The content of the specified Data Backup Register *******************************************************************************/ u16 BKP_ReadBackupRegister(u16 BKP_DR) { /* Check the parameters */ assert(IS_BKP_DR(BKP_DR)); return (*(vu16 *) (BKP_BASE + BKP_DR)); } /******************************************************************************* * Function Name : BKP_GetFlagStatus * Description : Checks whether the Tamper Pin Event flag is set or not. * Input : None * Output : None * Return : The new state of the Tamper Pin Event flag (SET or RESET). *******************************************************************************/ FlagStatus BKP_GetFlagStatus(void) { return (FlagStatus)(*(vu32 *) CSR_TEF_BB); } /******************************************************************************* * Function Name : BKP_ClearFlag * Description : Clears Tamper Pin Event pending flag. * Input : None * Output : None * Return : None *******************************************************************************/ void BKP_ClearFlag(void) { /* Set CTE bit to clear Tamper Pin Event flag */ BKP->CSR |= CSR_CTE_Set; } /******************************************************************************* * Function Name : BKP_GetITStatus * Description : Checks whether the Tamper Pin Interrupt has occurred or not. * Input : None * Output : None * Return : The new state of the Tamper Pin Interrupt (SET or RESET). *******************************************************************************/ ITStatus BKP_GetITStatus(void) { return (ITStatus)(*(vu32 *) CSR_TIF_BB); } /******************************************************************************* * Function Name : BKP_ClearITPendingBit * Description : Clears Tamper Pin Interrupt pending bit. * Input : None * Output : None * Return : None *******************************************************************************/ void BKP_ClearITPendingBit(void) { /* Set CTI bit to clear Tamper Pin Interrupt pending bit */ BKP->CSR |= CSR_CTI_Set; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_bkp.c
C
oos
10,694
/** ****************************************************************************** * @file stm32f10x_crc.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the CRC firmware functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_crc.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup CRC * @brief CRC driver modules * @{ */ /** @defgroup CRC_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup CRC_Private_Defines * @{ */ /* CR register bit mask */ #define CR_RESET_Set ((uint32_t)0x00000001) /** * @} */ /** @defgroup CRC_Private_Macros * @{ */ /** * @} */ /** @defgroup CRC_Private_Variables * @{ */ /** * @} */ /** @defgroup CRC_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup CRC_Private_Functions * @{ */ /** * @brief Resets the CRC Data register (DR). * @param None * @retval : None */ void CRC_ResetDR(void) { /* Reset CRC generator */ CRC->CR = CR_RESET_Set; } /** * @brief Computes the 32-bit CRC of a given data word(32-bit). * @param Data: data word(32-bit) to compute its CRC * @retval : 32-bit CRC */ uint32_t CRC_CalcCRC(uint32_t Data) { CRC->DR = Data; return (CRC->DR); } /** * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). * @param pBuffer: pointer to the buffer containing the data to be * computed * @param BufferLength: length of the buffer to be computed * @retval : 32-bit CRC */ uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) { uint32_t index = 0; for(index = 0; index < BufferLength; index++) { CRC->DR = pBuffer[index]; } return (CRC->DR); } /** * @brief Returns the current CRC value. * @param None * @retval : 32-bit CRC */ uint32_t CRC_GetCRC(void) { return (CRC->DR); } /** * @brief Stores a 8-bit data in the Independent Data(ID) register. * @param IDValue: 8-bit value to be stored in the ID register * @retval : None */ void CRC_SetIDRegister(uint8_t IDValue) { CRC->IDR = IDValue; } /** * @brief Returns the 8-bit data stored in the Independent Data(ID) register * @param None * @retval : 8-bit value of the ID register */ uint8_t CRC_GetIDRegister(void) { return (CRC->IDR); } /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_crc.c
C
oos
3,340
/** ****************************************************************************** * @file misc.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the miscellaneous firmware functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "misc.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup MISC * @brief MISC driver modules * @{ */ /** @defgroup MISC_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup MISC_Private_Defines * @{ */ #define AIRCR_VECTKEY_MASK ((uint32_t)0x05FA0000) /** * @} */ /** @defgroup MISC_Private_Macros * @{ */ /** * @} */ /** @defgroup MISC_Private_Variables * @{ */ /** * @} */ /** @defgroup MISC_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup MISC_Private_Functions * @{ */ /** * @brief Configures the priority grouping: pre-emption priority and * subpriority. * @param NVIC_PriorityGroup: specifies the priority grouping bits length. * This parameter can be one of the following values: * @arg NVIC_PriorityGroup_0: 0 bits for pre-emption priority * 4 bits for subpriority * @arg NVIC_PriorityGroup_1: 1 bits for pre-emption priority * 3 bits for subpriority * @arg NVIC_PriorityGroup_2: 2 bits for pre-emption priority * 2 bits for subpriority * @arg NVIC_PriorityGroup_3: 3 bits for pre-emption priority * 1 bits for subpriority * @arg NVIC_PriorityGroup_4: 4 bits for pre-emption priority * 0 bits for subpriority * @retval : None */ void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup) { /* Check the parameters */ assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup)); /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */ SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup; } /** * @brief Initializes the NVIC peripheral according to the specified * parameters in the NVIC_InitStruct. * @param NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure * that contains the configuration information for the * specified NVIC peripheral. * @retval : None */ void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct) { uint32_t tmppriority = 0x00, tmppre = 0x00, tmpsub = 0x0F; /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd)); assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority)); assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority)); if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE) { /* Compute the Corresponding IRQ Priority --------------------------------*/ tmppriority = (0x700 - ((SCB->AIRCR) & (uint32_t)0x700))>> 0x08; tmppre = (0x4 - tmppriority); tmpsub = tmpsub >> tmppriority; tmppriority = (uint32_t)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre; tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub; tmppriority = tmppriority << 0x04; NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority; /* Enable the Selected IRQ Channels --------------------------------------*/ NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); } else { /* Disable the Selected IRQ Channels -------------------------------------*/ NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); } } /** * @brief Sets the vector table location and Offset. * @param NVIC_VectTab: specifies if the vector table is in RAM or * FLASH memory. * This parameter can be one of the following values: * @arg NVIC_VectTab_RAM * @arg NVIC_VectTab_FLASH * @param Offset: Vector Table base offset field. * This value must be a multiple of 0x100. * @retval : None */ void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset) { /* Check the parameters */ assert_param(IS_NVIC_VECTTAB(NVIC_VectTab)); assert_param(IS_NVIC_OFFSET(Offset)); SCB->VTOR = NVIC_VectTab | (Offset & (uint32_t)0x1FFFFF80); } /** * @brief Selects the condition for the system to enter low power mode. * @param LowPowerMode: Specifies the new mode for the system to enter * low power mode. * This parameter can be one of the following values: * @arg NVIC_LP_SEVONPEND * @arg NVIC_LP_SLEEPDEEP * @arg NVIC_LP_SLEEPONEXIT * @param NewState: new state of LP condition. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_NVIC_LP(LowPowerMode)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SCB->SCR |= LowPowerMode; } else { SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode); } } /** * @brief Configures the SysTick clock source. * @param SysTick_CLKSource: specifies the SysTick clock source. * This parameter can be one of the following values: * @arg SysTick_CLKSource_HCLK_Div8: AHB clock divided by 8 * selected as SysTick clock source. * @arg SysTick_CLKSource_HCLK: AHB clock selected as * SysTick clock source. * @retval : None */ void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource) { /* Check the parameters */ assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource)); if (SysTick_CLKSource == SysTick_CLKSource_HCLK) { SysTick->CTRL |= SysTick_CLKSource_HCLK; } else { SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8; } } /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/misc.c
C
oos
6,874
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32fxxx_eth_lib.c * Author : MCD Application Team * Version : V2.0.2 * Date : 07/11/2008 * Description : This file provides all peripherals pointers initialization. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ #define EXT #include "stm32f10x_lib.h" /* Includes ------------------------------------------------------------------*/ #include "stm32fxxx_eth_lib.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ #ifdef ETH_DEBUG /******************************************************************************* * Function Name : ethernet_debug * Description : This function initialize peripherals pointers. * Input : None * Output : None * Return : None *******************************************************************************/ void eth_debug(void) { /********************************** ETHERNET **********************************/ #ifdef _ETH_MAC ETH_MAC = ((ETH_MAC_TypeDef *) ETH_MAC_BASE); #endif /*_ETH_MAC */ #ifdef _ETH_MMC ETH_MMC = ((ETH_MMC_TypeDef *) ETH_MMC_BASE); #endif /*_ETH_MMC */ #ifdef _ETH_PTP ETH_PTP = ((ETH_PTP_TypeDef *) ETH_PTP_BASE); #endif /*_ETH_PTP */ #ifdef _ETH_DMA ETH_DMA = ((ETH_DMA_TypeDef *) ETH_DMA_BASE); #endif /*_ETH_DMA */ } #endif /* ETH_DEBUG*/ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32fxxx_eth_lib.c
C
oos
2,537
;******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** ;* File Name : cortexm3_macro.s ;* Author : MCD Application Team ;* Date First Issued : 09/29/2006 ;* Description : Instruction wrappers for special Cortex-M3 instructions. ;******************************************************************************* ; History: ; 05/21/2007: V0.3 ; 04/02/2007: V0.2 ; 02/05/2007: V0.1 ; 09/29/2006: V0.01 ;******************************************************************************* ; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ;******************************************************************************* THUMB REQUIRE8 PRESERVE8 AREA |.text|, CODE, READONLY, ALIGN=2 ; Exported functions EXPORT __WFI EXPORT __WFE EXPORT __SEV EXPORT __ISB EXPORT __DSB EXPORT __DMB EXPORT __SVC EXPORT __MRS_CONTROL EXPORT __MSR_CONTROL EXPORT __MRS_PSP EXPORT __MSR_PSP EXPORT __MRS_MSP EXPORT __MSR_MSP EXPORT __SETPRIMASK EXPORT __RESETPRIMASK EXPORT __SETFAULTMASK EXPORT __RESETFAULTMASK EXPORT __BASEPRICONFIG EXPORT __GetBASEPRI EXPORT __REV_HalfWord EXPORT __REV_Word ;******************************************************************************* ; Function Name : __WFI ; Description : Assembler function for the WFI instruction. ; Input : None ; Return : None ;******************************************************************************* __WFI WFI BX r14 ;******************************************************************************* ; Function Name : __WFE ; Description : Assembler function for the WFE instruction. ; Input : None ; Return : None ;******************************************************************************* __WFE WFE BX r14 ;******************************************************************************* ; Function Name : __SEV ; Description : Assembler function for the SEV instruction. ; Input : None ; Return : None ;******************************************************************************* __SEV SEV BX r14 ;******************************************************************************* ; Function Name : __ISB ; Description : Assembler function for the ISB instruction. ; Input : None ; Return : None ;******************************************************************************* __ISB ISB BX r14 ;******************************************************************************* ; Function Name : __DSB ; Description : Assembler function for the DSB instruction. ; Input : None ; Return : None ;******************************************************************************* __DSB DSB BX r14 ;******************************************************************************* ; Function Name : __DMB ; Description : Assembler function for the DMB instruction. ; Input : None ; Return : None ;******************************************************************************* __DMB DMB BX r14 ;******************************************************************************* ; Function Name : __SVC ; Description : Assembler function for the SVC instruction. ; Input : None ; Return : None ;******************************************************************************* __SVC SVC 0x01 BX r14 ;******************************************************************************* ; Function Name : __MRS_CONTROL ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Cortex-M3 CONTROL register value. ;******************************************************************************* __MRS_CONTROL MRS r0, CONTROL BX r14 ;******************************************************************************* ; Function Name : __MSR_CONTROL ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Cortex-M3 CONTROL register new value. ; Return : None ;******************************************************************************* __MSR_CONTROL MSR CONTROL, r0 ISB BX r14 ;******************************************************************************* ; Function Name : __MRS_PSP ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Process Stack value. ;******************************************************************************* __MRS_PSP MRS r0, PSP BX r14 ;******************************************************************************* ; Function Name : __MSR_PSP ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Process Stack new value. ; Return : None ;******************************************************************************* __MSR_PSP MSR PSP, r0 ; set Process Stack value BX r14 ;******************************************************************************* ; Function Name : __MRS_MSP ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Main Stack value. ;******************************************************************************* __MRS_MSP MRS r0, MSP BX r14 ;******************************************************************************* ; Function Name : __MSR_MSP ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Main Stack new value. ; Return : None ;******************************************************************************* __MSR_MSP MSR MSP, r0 ; set Main Stack value BX r14 ;******************************************************************************* ; Function Name : __SETPRIMASK ; Description : Assembler function to set the PRIMASK. ; Input : None ; Return : None ;******************************************************************************* __SETPRIMASK CPSID i BX r14 ;******************************************************************************* ; Function Name : __RESETPRIMASK ; Description : Assembler function to reset the PRIMASK. ; Input : None ; Return : None ;******************************************************************************* __RESETPRIMASK CPSIE i BX r14 ;******************************************************************************* ; Function Name : __SETFAULTMASK ; Description : Assembler function to set the FAULTMASK. ; Input : None ; Return : None ;******************************************************************************* __SETFAULTMASK CPSID f BX r14 ;******************************************************************************* ; Function Name : __RESETFAULTMASK ; Description : Assembler function to reset the FAULTMASK. ; Input : None ; Return : None ;******************************************************************************* __RESETFAULTMASK CPSIE f BX r14 ;******************************************************************************* ; Function Name : __BASEPRICONFIG ; Description : Assembler function to set the Base Priority. ; Input : - r0 : Base Priority new value ; Return : None ;******************************************************************************* __BASEPRICONFIG MSR BASEPRI, r0 BX r14 ;******************************************************************************* ; Function Name : __GetBASEPRI ; Description : Assembler function to get the Base Priority value. ; Input : None ; Return : - r0 : Base Priority value ;******************************************************************************* __GetBASEPRI MRS r0, BASEPRI_MAX BX r14 ;******************************************************************************* ; Function Name : __REV_HalfWord ; Description : Reverses the byte order in HalfWord(16-bit) input variable. ; Input : - r0 : specifies the input variable ; Return : - r0 : holds tve variable value after byte reversing. ;******************************************************************************* __REV_HalfWord REV16 r0, r0 BX r14 ;******************************************************************************* ; Function Name : __REV_Word ; Description : Reverses the byte order in Word(32-bit) input variable. ; Input : - r0 : specifies the input variable ; Return : - r0 : holds tve variable value after byte reversing. ;******************************************************************************* __REV_Word REV r0, r0 BX r14 END ;******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE*****
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/cortexm3_macro_rvds.s
Unix Assembly
oos
9,548
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : lcd.c * Author : MCD Application Team * Date First Issued : mm/dd/yyyy * Description : This file includes the LCD driver for AM-240320LTNQW00H * liquid Crystal Display Module of STM32F10x-EVAL. ******************************************************************************** * History: * mm/dd/yyyy ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_type.h" #include "lcd.h" #include "spi_flash.h" #include "FreeRTOS.h" #include "task.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ASCII Table: each character is 16 column (16dots large) and 24 raw (24 dots high) */ const uc16 ASCII_Table[] = { /* Space ' ' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '!' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '"' */ 0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '#' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60, 0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318, 0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000, /* '$' */ 0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C, 0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C, 0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000, /* '%' */ 0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611, 0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460, 0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000, /* '&' */ 0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0, 0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06, 0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ''' */ 0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '(' */ 0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000, /* ')' */ 0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000, /* '*' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '+' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ',' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, /* '-' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '.' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '/' */ 0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300, 0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '0' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '1' */ 0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '2' */ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '3' */ 0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600, 0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18, 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '4' */ 0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60, 0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00, 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '5' */ 0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC, 0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18, 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '6' */ 0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC, 0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '7' */ 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380, 0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '8' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638, 0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38, 0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '9' */ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C, 0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C, 0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ':' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ';' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000, /* '<' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0, 0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '=' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '>' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0, 0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '?' */ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '@' */ 0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411, 0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004, 0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'A' */ 0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60, 0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C, 0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'B' */ 0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C, 0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, 0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'C' */ 0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C, 0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'D' */ 0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06, 0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'E' */ 0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'F' */ 0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'G' */ 0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003, 0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C, 0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'H' */ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'I' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'J' */ 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738, 0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'K' */ 0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6, 0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806, 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'L' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'M' */ 0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836, 0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6, 0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'N' */ 0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC, 0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C, 0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'O' */ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C, 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'P' */ 0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'Q' */ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C, 0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'R' */ 0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806, 0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006, 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'S' */ 0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C, 0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C, 0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'T' */ 0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'U' */ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818, 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'V' */ 0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'W' */ 0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366, 0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C, 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'X' */ 0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0, 0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C, 0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'Y' */ 0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660, 0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'Z' */ 0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006, 0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '[' */ 0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000, /* '\' */ 0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ']' */ 0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000, /* '^' */ 0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630, 0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '_' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* ''' */ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'a' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8, 0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C, 0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'b' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8, 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'c' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0, 0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30, 0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'd' */ 0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0, 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'e' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30, 0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'f' */ 0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'g' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18, 0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000, /* 'h' */ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8, 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'i' */ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'j' */ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000, /* 'k' */ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C, 0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C, 0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'l' */ 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'm' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF, 0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'n' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8, 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'o' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0, 0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30, 0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'p' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8, 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38, 0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000, /* 'q' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0, 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30, 0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000, /* 'r' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0, 0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 's' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0, 0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38, 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 't' */ 0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'u' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38, 0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'v' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18, 0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360, 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'w' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1, 0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C, 0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'x' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38, 0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30, 0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 'y' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830, 0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380, 0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000, /* 'z' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* '{' */ 0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000, /* '|' */ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, /* '}' */ 0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000, /* '~' */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Global variables to set the written text color */ static vu16 TextColor = 0x0000, BackColor = 0xFFFF; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ static u32 StrLength(u8 *Str); /******************************************************************************* * Function Name : LCD_Init * Description : Initializes LCD. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_Init(void) { /* Configure the LCD Control pins --------------------------------------------*/ LCD_CtrlLinesConfig(); /* Configure the SPI2 interface ----------------------------------------------*/ LCD_SPIConfig(); /* Enable the LCD Oscillator -------------------------------------------------*/ LCD_WriteReg(R1, 0x10); LCD_WriteReg(R0, 0xA0); LCD_WriteReg(R3, 0x01); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ LCD_WriteReg(R3, 0x00); LCD_WriteReg(R43, 0x04); LCD_WriteReg(R40, 0x18); LCD_WriteReg(R26, 0x05); LCD_WriteReg(R37, 0x05); LCD_WriteReg(R25, 0x00); /* LCD Power On --------------------------------------------------------------*/ LCD_WriteReg(R28, 0x73); LCD_WriteReg(R36, 0x74); LCD_WriteReg(R30, 0x01); LCD_WriteReg(R24, 0xC1); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ LCD_WriteReg(R24, 0xE1); LCD_WriteReg(R24, 0xF1); vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */ LCD_WriteReg(R24, 0xF5); vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */ LCD_WriteReg(R27, 0x09); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ LCD_WriteReg(R31, 0x11); LCD_WriteReg(R32, 0x0E); LCD_WriteReg(R30, 0x81); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ /* Chip Set ------------------------------------------------------------------*/ LCD_WriteReg(R157, 0x00); LCD_WriteReg(R192, 0x00); LCD_WriteReg(R14, 0x00); LCD_WriteReg(R15, 0x00); LCD_WriteReg(R16, 0x00); LCD_WriteReg(R17, 0x00); LCD_WriteReg(R18, 0x00); LCD_WriteReg(R19, 0x00); LCD_WriteReg(R20, 0x00); LCD_WriteReg(R21, 0x00); LCD_WriteReg(R22, 0x00); LCD_WriteReg(R23, 0x00); LCD_WriteReg(R52, 0x01); LCD_WriteReg(R53, 0x00); LCD_WriteReg(R75, 0x00); LCD_WriteReg(R76, 0x00); LCD_WriteReg(R78, 0x00); LCD_WriteReg(R79, 0x00); LCD_WriteReg(R80, 0x00); LCD_WriteReg(R60, 0x00); LCD_WriteReg(R61, 0x00); LCD_WriteReg(R62, 0x01); LCD_WriteReg(R63, 0x3F); LCD_WriteReg(R64, 0x02); LCD_WriteReg(R65, 0x02); LCD_WriteReg(R66, 0x00); LCD_WriteReg(R67, 0x00); LCD_WriteReg(R68, 0x00); LCD_WriteReg(R69, 0x00); LCD_WriteReg(R70, 0xEF); LCD_WriteReg(R71, 0x00); LCD_WriteReg(R72, 0x00); LCD_WriteReg(R73, 0x01); LCD_WriteReg(R74, 0x3F); LCD_WriteReg(R29, 0x08); /* R29:Gate scan direction setting */ LCD_WriteReg(R134, 0x00); LCD_WriteReg(R135, 0x30); LCD_WriteReg(R136, 0x02); LCD_WriteReg(R137, 0x05); LCD_WriteReg(R141, 0x01); /* R141:Register set-up mode for one line clock */ LCD_WriteReg(R139, 0x20); /* R139:One line SYSCLK number in one-line */ LCD_WriteReg(R51, 0x01); /* R51:N line inversion setting */ LCD_WriteReg(R55, 0x01); /* R55:Scanning method setting */ LCD_WriteReg(R118, 0x00); /* Gamma Set -----------------------------------------------------------------*/ LCD_WriteReg(R143, 0x10); LCD_WriteReg(R144, 0x67); LCD_WriteReg(R145, 0x07); LCD_WriteReg(R146, 0x65); LCD_WriteReg(R147, 0x07); LCD_WriteReg(R148, 0x01); LCD_WriteReg(R149, 0x76); LCD_WriteReg(R150, 0x56); LCD_WriteReg(R151, 0x00); LCD_WriteReg(R152, 0x06); LCD_WriteReg(R153, 0x03); LCD_WriteReg(R154, 0x00); /* Display On ----------------------------------------------------------------*/ LCD_WriteReg(R1, 0x50); LCD_WriteReg(R5, 0x04); LCD_WriteReg(R0, 0x80); LCD_WriteReg(R59, 0x01); vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */ LCD_WriteReg(R0, 0x20); } /******************************************************************************* * Function Name : LCD_SetTextColor * Description : Sets the Text color. * Input : - Color: specifies the Text color code RGB(5-6-5). * Output : - TextColor: Text color global variable used by LCD_DrawChar * and LCD_DrawPicture functions. * Return : None *******************************************************************************/ void LCD_SetTextColor(vu16 Color) { TextColor = Color; } /******************************************************************************* * Function Name : LCD_SetBackColor * Description : Sets the Background color. * Input : - Color: specifies the Background color code RGB(5-6-5). * Output : - BackColor: Background color global variable used by * LCD_DrawChar and LCD_DrawPicture functions. * Return : None *******************************************************************************/ void LCD_SetBackColor(vu16 Color) { BackColor = Color; } /******************************************************************************* * Function Name : LCD_ClearLine * Description : Clears the selected line. * Input : - Line: the Line to be cleared. * This parameter can be one of the following values: * - Linex: where x can be 0..9 * Output : None * Return : None *******************************************************************************/ void LCD_ClearLine(u8 Line) { LCD_DisplayStringLine(Line, " "); } /******************************************************************************* * Function Name : LCD_Clear * Description : Clears the hole LCD. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_Clear(void) { u32 index = 0; LCD_SetCursor(0x00, 0x013F); for(index = 0; index < 0x12C00; index++) { LCD_WriteRAM(White); } } /******************************************************************************* * Function Name : LCD_SetCursor * Description : Sets the cursor position. * Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * Output : None * Return : None *******************************************************************************/ void LCD_SetCursor(u8 Xpos, u16 Ypos) { LCD_WriteReg(R66, Xpos); LCD_WriteReg(R67, ((Ypos & 0x100)>> 8)); LCD_WriteReg(R68, (Ypos & 0xFF)); } /******************************************************************************* * Function Name : LCD_DrawChar * Description : Draws a character on LCD. * Input : - Xpos: the Line where to display the character shape. * This parameter can be one of the following values: * - Linex: where x can be 0..9 * - Ypos: start column address. * - c: pointer to the character data. * Output : None * Return : None *******************************************************************************/ void LCD_DrawChar(u8 Xpos, u16 Ypos, uc16 *c) { u32 index = 0, i = 0; u8 Xaddress = 0; Xaddress = Xpos; LCD_SetCursor(Xaddress, Ypos); for(index = 0; index < 24; index++) { for(i = 0; i < 16; i++) { if((c[index] & (1 << i)) == 0x00) { LCD_WriteRAM(BackColor); } else { LCD_WriteRAM(TextColor); } } Xaddress++; LCD_SetCursor(Xaddress, Ypos); } } /******************************************************************************* * Function Name : LCD_DisplayChar * Description : Displays one character (16dots width, 24dots height). * Input : - Line: the Line where to display the character shape . * This parameter can be one of the following values: * - Linex: where x can be 0..9 * - Column: start column address. * - Ascii: character ascii code, must be between 0x20 and 0x7E. * Output : None * Return : None *******************************************************************************/ void LCD_DisplayChar(u8 Line, u16 Column, u8 Ascii) { Ascii -= 32; LCD_DrawChar(Line, Column, &ASCII_Table[Ascii * 24]); } /******************************************************************************* * Function Name : LCD_DisplayStringLine * Description : Displays a maximum of 20 char on the LCD. * Input : - Line: the Line where to display the character shape . * This parameter can be one of the following values: * - Linex: where x can be 0..9 * - *ptr: pointer to string to display on LCD. * Output : None * Return : None *******************************************************************************/ void LCD_DisplayStringLine(u8 Line, u8 *ptr) { u32 i = 0; u16 refcolumn = 319; /* Send the string character by character on lCD */ while ((*ptr != 0) & (i < 20)) { /* Display one character on LCD */ LCD_DisplayChar(Line, refcolumn, *ptr); /* Decrement the column position by 16 */ refcolumn -= 16; /* Point on the next character */ ptr++; /* Increment the character counter */ i++; } } /******************************************************************************* * Function Name : LCD_DisplayString * Description : Displays a maximum of 200 char on the LCD. * Input : - Line: the starting Line where to display the character shape. * This parameter can be one of the following values: * - Linex: where x can be 0..9 * - *ptr: pointer to string to display on LCD. * Output : None * Return : None *******************************************************************************/ void LCD_DisplayString(u8 Line, u8 *ptr) { u32 i = 0, column = 0, index = 0, spaceindex = 0; u16 refcolumn = 319; u32 length = 0; /* Get the string length */ length = StrLength(ptr); if(length > 200) { /* Set the Cursor position */ LCD_SetCursor(Line, 0x013F); /* Clear the Selected Line */ LCD_ClearLine(Line); LCD_DisplayStringLine(Line, " String too long "); } else { /* Set the Cursor position */ LCD_SetCursor(Line, 0x013F); /* Clear the Selected Line */ LCD_ClearLine(Line); while(length--) { if(index == 20) { if(*ptr == 0x20) { ptr++; } else { for(i = 0; i < spaceindex; i++) { LCD_DisplayChar(Line, column, ' '); column -= 16; } ptr -= (spaceindex - 1); length += (spaceindex - 1); } Line += 24; /* Clear the Selected Line */ LCD_ClearLine(Line); refcolumn = 319; index = 0; } /* Display one character on LCD */ LCD_DisplayChar(Line, refcolumn, *ptr); /* Increment character number in one line */ index++; /* Decrement the column position by 16 */ refcolumn -= 16; /* Point on the next character */ ptr++; /* Increment the number of character after the last space */ spaceindex++; if(*ptr == 0x20) { spaceindex = 0; column = refcolumn - 16; } } } } /******************************************************************************* * Function Name : LCD_ScrollText * Description : * Input : * Output : None * Return : None *******************************************************************************/ void LCD_ScrollText(u8 Line, u8 *ptr) { u32 i = 0, length = 0, x = 0; u16 refcolumn = 319; /* Get the string length */ length = StrLength(ptr); while(1) { /* Send the string character by character on lCD */ while ((*ptr != 0) & (i < 20)) { /* Display one character on LCD */ LCD_DisplayChar(Line, refcolumn, *ptr); /* Decrement the column position by 16 */ refcolumn -= 16; /* Point on the next character */ ptr++; /* Increment the character counter */ i++; } vTaskDelay( 100 / portTICK_RATE_MS ); i = 0; //LCD_ClearLine(Line); ptr -= length; x++; if(refcolumn < 16) { x = 0; } refcolumn = 319 - (x * 16); } } /******************************************************************************* * Function Name : LCD_SetDisplayWindow * Description : Sets a display window * Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Height: display window height. * - Width: display window width. * Output : None * Return : None *******************************************************************************/ void LCD_SetDisplayWindow(u8 Xpos, u16 Ypos, u8 Height, u16 Width) { LCD_WriteReg(R1, 0xD0); LCD_WriteReg(R5, 0x14); LCD_WriteReg(R69, Xpos); LCD_WriteReg(R70, (Xpos + Height + 1)); LCD_WriteReg(R71, ((Ypos & 0x100)>> 8)); LCD_WriteReg(R72, (Ypos & 0xFF)); LCD_WriteReg(R73, (((Ypos + Width + 1) & 0x100)>> 8)); LCD_WriteReg(R74, ((Ypos + Width + 1) & 0xFF)); LCD_SetCursor(Xpos, Ypos); } /******************************************************************************* * Function Name : LCD_DrawLine * Description : Displays a line. * Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Length: line length. * - Direction: line direction. * This parameter can be one of the following values: Vertical * or Horizontal. * Output : None * Return : None *******************************************************************************/ void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction) { u32 i = 0; LCD_SetCursor(Xpos, Ypos); if(Direction == Horizontal) { for(i = 0; i < Length; i++) { LCD_WriteRAM(TextColor); } } else { for(i = 0; i < Length; i++) { LCD_WriteRAM(TextColor); Xpos++; LCD_SetCursor(Xpos, Ypos); } } } /******************************************************************************* * Function Name : LCD_DrawRect * Description : Displays a rectangle. * Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Height: display rectangle height. * - Width: display rectangle width. * Output : None * Return : None *******************************************************************************/ void LCD_DrawRect(u8 Xpos, u16 Ypos, u8 Height, u16 Width) { LCD_DrawLine(Xpos, Ypos, Width, Horizontal); LCD_DrawLine((Xpos + Height), Ypos, Width, Horizontal); LCD_DrawLine(Xpos, Ypos, Height, Vertical); LCD_DrawLine(Xpos, (Ypos - Width + 1), Height, Vertical); } /******************************************************************************* * Function Name : LCD_DrawCircle * Description : Displays a circle. * Input : - Xpos: specifies the X position. * - Ypos: specifies the Y position. * - Height: display rectangle height. * - Width: display rectangle width. * Output : None * Return : None *******************************************************************************/ void LCD_DrawCircle(u8 Xpos, u16 Ypos, u16 Radius) { s32 D; /* Decision Variable */ u32 CurX; /* Current X Value */ u32 CurY; /* Current Y Value */ D = 3 - (Radius << 1); CurX = 0; CurY = Radius; while (CurX <= CurY) { LCD_SetCursor(Xpos + CurX, Ypos + CurY); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos + CurX, Ypos - CurY); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos - CurX, Ypos + CurY); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos - CurX, Ypos - CurY); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos + CurY, Ypos + CurX); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos + CurY, Ypos - CurX); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos - CurY, Ypos + CurX); LCD_WriteRAM(TextColor); LCD_SetCursor(Xpos - CurY, Ypos - CurX); LCD_WriteRAM(TextColor); if (D < 0) { D += (CurX << 2) + 6; } else { D += ((CurX - CurY) << 2) + 10; CurY--; } CurX++; } } /******************************************************************************* * Function Name : LCD_DrawMonoPict * Description : Displays a monocolor picture. * Input : - Pict: pointer to the picture array. * Output : None * Return : None *******************************************************************************/ void LCD_DrawMonoPict(uc32 *Pict) { u32 index = 0, i = 0; LCD_SetCursor(0, 319); for(index = 0; index < 2400; index++) { for(i = 0; i < 32; i++) { if((Pict[index] & (1 << i)) == 0x00) { LCD_WriteRAM(BackColor); } else { LCD_WriteRAM(TextColor); } } } } /******************************************************************************* * Function Name : LCD_DrawBMP * Description : Displays a bitmap picture loaded in the SPI Flash. * Input : - BmpAddress: Bmp picture address in the SPI Flash. * Output : None * Return : None *******************************************************************************/ void LCD_DrawBMP(u32 BmpAddress) { u32 i = 0; LCD_WriteReg(R1, 0xD0); LCD_WriteReg(R5, 0x04); LCD_SetCursor(239, 0x013F); SPI_FLASH_StartReadSequence(BmpAddress); /* Disable SPI1 */ SPI_Cmd(SPI1, DISABLE); /* SPI in 16-bit mode */ SPI_DataSizeConfig(SPI1, SPI_DataSize_16b); /* Enable SPI1 */ SPI_Cmd(SPI1, ENABLE); for(i = 0; i < 76800; i++) { LCD_WriteRAM(__REV_HalfWord(SPI_FLASH_SendHalfWord(0xA5A5))); } /* Deselect the FLASH: Chip Select high */ SPI_FLASH_ChipSelect(1); /* Disable SPI1 */ SPI_Cmd(SPI1, DISABLE); /* SPI in 8-bit mode */ SPI_DataSizeConfig(SPI1, SPI_DataSize_8b); /* Enable SPI1 */ SPI_Cmd(SPI1, ENABLE); } /******************************************************************************* * Function Name : LCD_WriteReg * Description : Writes to the selected LCD register. * Input : - LCD_Reg: address of the selected register. * - LCD_RegValue: value to write to the selected register. * Output : None * Return : None *******************************************************************************/ void LCD_WriteReg(u8 LCD_Reg, u8 LCD_RegValue) { u16 tmp = 0; LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET); LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_RESET); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET); tmp = LCD_Reg << 8; tmp |= LCD_RegValue; SPI_SendData(SPI2, tmp); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) { } LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET); } /******************************************************************************* * Function Name : LCD_ReadReg * Description : Reads the selected LCD Register. * Input : None * Output : None * Return : LCD Register Value. *******************************************************************************/ u8 LCD_ReadReg(u8 LCD_Reg) { u16 tmp = 0; LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET); LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_RESET); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) { } SPI_SendData(SPI2, LCD_Reg); LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_SET); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) { } SPI_SendData(SPI2, 0xFF); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_RXNE)== RESET) { } tmp = SPI_ReceiveData(SPI2); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET); return tmp; } /******************************************************************************* * Function Name : LCD_WriteRAM * Description : Writes to the LCD RAM. * Input : - RGB_Code: the pixel color in RGB mode (5-6-5). * Output : None * Return : None *******************************************************************************/ void LCD_WriteRAM(u16 RGB_Code) { LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET); LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_SET); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET); SPI_SendData(SPI2, RGB_Code); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) { } LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET); } /******************************************************************************* * Function Name : LCD_ReadRAM * Description : Reads the LCD RAM. * Input : None * Output : None * Return : LCD RAM Value. *******************************************************************************/ u16 LCD_ReadRAM(void) { u16 tmp = 0; LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_SET); LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_SET); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET) { } SPI_SendData(SPI2, 0xFF); while(SPI_GetFlagStatus(SPI2, SPI_FLAG_RXNE)==RESET) { } tmp = SPI_ReceiveData(SPI2); LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET); return tmp; } /******************************************************************************* * Function Name : LCD_PowerOn * Description : * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_PowerOn(void) { /* Power On Set */ LCD_WriteReg(R28, 0x73); LCD_WriteReg(R36, 0x74); LCD_WriteReg(R30, 0x01); LCD_WriteReg(R24, 0xC1); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ LCD_WriteReg(R24, 0xE1); LCD_WriteReg(R24, 0xF1); vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */ LCD_WriteReg(R24, 0xF5); vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */ LCD_WriteReg(R27, 0x09); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ LCD_WriteReg(R31, 0x11); LCD_WriteReg(R32, 0x0E); LCD_WriteReg(R30, 0x81); vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */ } /******************************************************************************* * Function Name : LCD_DisplayOn * Description : Enables the Display. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_DisplayOn(void) { LCD_WriteReg(R1, 0x50); LCD_WriteReg(R5, 0x04); /* Display On */ LCD_WriteReg(R0, 0x80); LCD_WriteReg(R59, 0x01); vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */ LCD_WriteReg(R0, 0x20); } /******************************************************************************* * Function Name : LCD_DisplayOff * Description : Disables the Display. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_DisplayOff(void) { /* Display Off */ LCD_WriteReg(R0, 0xA0); vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */ LCD_WriteReg(R59, 0x00); } /******************************************************************************* * Function Name : LCD_CtrlLinesConfig * Description : Configures LCD control lines in Output Push-Pull mode. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_CtrlLinesConfig(void) { GPIO_InitTypeDef GPIO_InitStructure; /* Configure NCS (PB.02) in Output Push-Pull mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); /* Configure NWR(RNW), RS (PD.15, PD.07) in Output Push-Pull mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_15; GPIO_Init(GPIOD, &GPIO_InitStructure); } /******************************************************************************* * Function Name : LCD_CtrlLinesWrite * Description : Sets or reset LCD control lines. * Input : - GPIOx: where x can be B or D to select the GPIO peripheral. * - CtrlPins: the Control line. This parameter can be: * - CtrlPin_NCS: Chip Select pin (PB.02) * - CtrlPin_NWR: Read/Write Selection pin (PD.15) * - CtrlPin_RS: Register/RAM Selection pin (PD.07) * - BitVal: specifies the value to be written to the selected bit. * This parameter can be: * - Bit_RESET: to clear the port pin * - Bit_SET: to set the port pin * Output : None * Return : None *******************************************************************************/ void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u16 CtrlPins, BitAction BitVal) { /* Set or Reset the control line */ GPIO_WriteBit(GPIOx, CtrlPins, BitVal); } /******************************************************************************* * Function Name : LCD_SPIConfig * Description : Configures the SPI2 interface. * Input : None * Output : None * Return : None *******************************************************************************/ void LCD_SPIConfig(void) { SPI_InitTypeDef SPI_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; /* Enable GPIOA clock */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); /* Enable SPI2 clock */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE); /* Configure SPI2 pins: NSS, SCK, MISO and MOSI */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); /* SPI2 Config */ SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b; SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_Init(SPI2, &SPI_InitStructure); /* SPI2 enable */ SPI_Cmd(SPI2, ENABLE); } /******************************************************************************* * Function Name : StrLength * Description : Returns length of string. * Input : - Str: Character Pointer. * Output : None * Return : String length. *******************************************************************************/ static u32 StrLength(u8 *Str) { u32 Index = 0; /* Increment the Index unless the end of string */ for(Index = 0; *Str != '\0'; Str++, Index++) { } return Index; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/lcd.c
C
oos
53,242
/** ****************************************************************************** * @file stm32f10x_spi.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the SPI firmware functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_spi.h" #include "stm32f10x_rcc.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup SPI * @brief SPI driver modules * @{ */ /** @defgroup SPI_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup SPI_Private_Defines * @{ */ /* SPI SPE mask */ #define CR1_SPE_Set ((uint16_t)0x0040) #define CR1_SPE_Reset ((uint16_t)0xFFBF) /* I2S I2SE mask */ #define I2SCFGR_I2SE_Set ((uint16_t)0x0400) #define I2SCFGR_I2SE_Reset ((uint16_t)0xFBFF) /* SPI CRCNext mask */ #define CR1_CRCNext_Set ((uint16_t)0x1000) /* SPI CRCEN mask */ #define CR1_CRCEN_Set ((uint16_t)0x2000) #define CR1_CRCEN_Reset ((uint16_t)0xDFFF) /* SPI SSOE mask */ #define CR2_SSOE_Set ((uint16_t)0x0004) #define CR2_SSOE_Reset ((uint16_t)0xFFFB) /* SPI registers Masks */ #define CR1_CLEAR_Mask ((uint16_t)0x3040) #define I2SCFGR_CLEAR_Mask ((uint16_t)0xF040) /* SPI or I2S mode selection masks */ #define SPI_Mode_Select ((uint16_t)0xF7FF) #define I2S_Mode_Select ((uint16_t)0x0800) /** * @} */ /** @defgroup SPI_Private_Macros * @{ */ /** * @} */ /** @defgroup SPI_Private_Variables * @{ */ /** * @} */ /** @defgroup SPI_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup SPI_Private_Functions * @{ */ /** * @brief Deinitializes the SPIx peripheral registers to their default * reset values (Affects also the I2Ss). * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @retval : None */ void SPI_I2S_DeInit(SPI_TypeDef* SPIx) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); switch (*(uint32_t*)&SPIx) { case SPI1_BASE: /* Enable SPI1 reset state */ RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE); /* Release SPI1 from reset state */ RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE); break; case SPI2_BASE: /* Enable SPI2 reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE); /* Release SPI2 from reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE); break; case SPI3_BASE: /* Enable SPI3 reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE); /* Release SPI3 from reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE); break; default: break; } } /** * @brief Initializes the SPIx peripheral according to the specified * parameters in the SPI_InitStruct. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param SPI_InitStruct: pointer to a SPI_InitTypeDef structure that * contains the configuration information for the specified * SPI peripheral. * @retval : None */ void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct) { uint16_t tmpreg = 0; /* check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); /* Check the SPI parameters */ assert_param(IS_SPI_DIRECTION_MODE(SPI_InitStruct->SPI_Direction)); assert_param(IS_SPI_MODE(SPI_InitStruct->SPI_Mode)); assert_param(IS_SPI_DATASIZE(SPI_InitStruct->SPI_DataSize)); assert_param(IS_SPI_CPOL(SPI_InitStruct->SPI_CPOL)); assert_param(IS_SPI_CPHA(SPI_InitStruct->SPI_CPHA)); assert_param(IS_SPI_NSS(SPI_InitStruct->SPI_NSS)); assert_param(IS_SPI_BAUDRATE_PRESCALER(SPI_InitStruct->SPI_BaudRatePrescaler)); assert_param(IS_SPI_FIRST_BIT(SPI_InitStruct->SPI_FirstBit)); assert_param(IS_SPI_CRC_POLYNOMIAL(SPI_InitStruct->SPI_CRCPolynomial)); /*---------------------------- SPIx CR1 Configuration ------------------------*/ /* Get the SPIx CR1 value */ tmpreg = SPIx->CR1; /* Clear BIDIMode, BIDIOE, RxONLY, SSM, SSI, LSBFirst, BR, MSTR, CPOL and CPHA bits */ tmpreg &= CR1_CLEAR_Mask; /* Configure SPIx: direction, NSS management, first transmitted bit, BaudRate prescaler master/salve mode, CPOL and CPHA */ /* Set BIDImode, BIDIOE and RxONLY bits according to SPI_Direction value */ /* Set SSM, SSI and MSTR bits according to SPI_Mode and SPI_NSS values */ /* Set LSBFirst bit according to SPI_FirstBit value */ /* Set BR bits according to SPI_BaudRatePrescaler value */ /* Set CPOL bit according to SPI_CPOL value */ /* Set CPHA bit according to SPI_CPHA value */ tmpreg |= (uint16_t)((uint32_t)SPI_InitStruct->SPI_Direction | SPI_InitStruct->SPI_Mode | SPI_InitStruct->SPI_DataSize | SPI_InitStruct->SPI_CPOL | SPI_InitStruct->SPI_CPHA | SPI_InitStruct->SPI_NSS | SPI_InitStruct->SPI_BaudRatePrescaler | SPI_InitStruct->SPI_FirstBit); /* Write to SPIx CR1 */ SPIx->CR1 = tmpreg; /* Activate the SPI mode (Reset I2SMOD bit in I2SCFGR register) */ SPIx->I2SCFGR &= SPI_Mode_Select; /*---------------------------- SPIx CRCPOLY Configuration --------------------*/ /* Write to SPIx CRCPOLY */ SPIx->CRCPR = SPI_InitStruct->SPI_CRCPolynomial; } /** * @brief Initializes the SPIx peripheral according to the specified * parameters in the I2S_InitStruct. * @param SPIx: where x can be 2 or 3 to select the SPI peripheral * (configured in I2S mode). * @param I2S_InitStruct: pointer to an I2S_InitTypeDef structure that * contains the configuration information for the specified * SPI peripheral configured in I2S mode. * @retval : None */ void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct) { uint16_t tmpreg = 0, i2sdiv = 2, i2sodd = 0, packetlength = 1; uint32_t tmp = 0; RCC_ClocksTypeDef RCC_Clocks; /* Check the I2S parameters */ assert_param(IS_SPI_23_PERIPH(SPIx)); assert_param(IS_I2S_MODE(I2S_InitStruct->I2S_Mode)); assert_param(IS_I2S_STANDARD(I2S_InitStruct->I2S_Standard)); assert_param(IS_I2S_DATA_FORMAT(I2S_InitStruct->I2S_DataFormat)); assert_param(IS_I2S_MCLK_OUTPUT(I2S_InitStruct->I2S_MCLKOutput)); assert_param(IS_I2S_AUDIO_FREQ(I2S_InitStruct->I2S_AudioFreq)); assert_param(IS_I2S_CPOL(I2S_InitStruct->I2S_CPOL)); /*----------------------- SPIx I2SCFGR & I2SPR Configuration -----------------*/ /* Clear I2SMOD, I2SE, I2SCFG, PCMSYNC, I2SSTD, CKPOL, DATLEN and CHLEN bits */ SPIx->I2SCFGR &= I2SCFGR_CLEAR_Mask; SPIx->I2SPR = 0x0002; /* Get the I2SCFGR register value */ tmpreg = SPIx->I2SCFGR; /* If the default value has to be written, reinitialize i2sdiv and i2sodd*/ if(I2S_InitStruct->I2S_AudioFreq == I2S_AudioFreq_Default) { i2sodd = (uint16_t)0; i2sdiv = (uint16_t)2; } /* If the requested audio frequency is not the default, compute the prescaler */ else { /* Check the frame length (For the Prescaler computing) */ if(I2S_InitStruct->I2S_DataFormat == I2S_DataFormat_16b) { /* Packet length is 16 bits */ packetlength = 1; } else { /* Packet length is 32 bits */ packetlength = 2; } /* Get System Clock frequency */ RCC_GetClocksFreq(&RCC_Clocks); /* Compute the Real divider depending on the MCLK output state with a flaoting point */ if(I2S_InitStruct->I2S_MCLKOutput == I2S_MCLKOutput_Enable) { /* MCLK output is enabled */ tmp = (uint16_t)(((10 * RCC_Clocks.SYSCLK_Frequency) / (256 * I2S_InitStruct->I2S_AudioFreq)) + 5); } else { /* MCLK output is disabled */ tmp = (uint16_t)(((10 * RCC_Clocks.SYSCLK_Frequency) / (32 * packetlength * I2S_InitStruct->I2S_AudioFreq)) + 5); } /* Remove the flaoting point */ tmp = tmp/10; /* Check the parity of the divider */ i2sodd = (uint16_t)(tmp & (uint16_t)0x0001); /* Compute the i2sdiv prescaler */ i2sdiv = (uint16_t)((tmp - i2sodd) / 2); /* Get the Mask for the Odd bit (SPI_I2SPR[8]) register */ i2sodd = (uint16_t) (i2sodd << 8); } /* Test if the divider is 1 or 0 */ if ((i2sdiv < 2) || (i2sdiv > 0xFF)) { /* Set the default values */ i2sdiv = 2; i2sodd = 0; } /* Write to SPIx I2SPR register the computed value */ SPIx->I2SPR = (uint16_t)(i2sdiv | i2sodd | I2S_InitStruct->I2S_MCLKOutput); /* Configure the I2S with the SPI_InitStruct values */ tmpreg |= (uint16_t)(I2S_Mode_Select | I2S_InitStruct->I2S_Mode | \ I2S_InitStruct->I2S_Standard | I2S_InitStruct->I2S_DataFormat | \ I2S_InitStruct->I2S_CPOL); /* Write to SPIx I2SCFGR */ SPIx->I2SCFGR = tmpreg; } /** * @brief Fills each SPI_InitStruct member with its default value. * @param SPI_InitStruct : pointer to a SPI_InitTypeDef structure * which will be initialized. * @retval : None */ void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct) { /*--------------- Reset SPI init structure parameters values -----------------*/ /* Initialize the SPI_Direction member */ SPI_InitStruct->SPI_Direction = SPI_Direction_2Lines_FullDuplex; /* initialize the SPI_Mode member */ SPI_InitStruct->SPI_Mode = SPI_Mode_Slave; /* initialize the SPI_DataSize member */ SPI_InitStruct->SPI_DataSize = SPI_DataSize_8b; /* Initialize the SPI_CPOL member */ SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low; /* Initialize the SPI_CPHA member */ SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge; /* Initialize the SPI_NSS member */ SPI_InitStruct->SPI_NSS = SPI_NSS_Hard; /* Initialize the SPI_BaudRatePrescaler member */ SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; /* Initialize the SPI_FirstBit member */ SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB; /* Initialize the SPI_CRCPolynomial member */ SPI_InitStruct->SPI_CRCPolynomial = 7; } /** * @brief Fills each I2S_InitStruct member with its default value. * @param I2S_InitStruct : pointer to a I2S_InitTypeDef structure * which will be initialized. * @retval : None */ void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct) { /*--------------- Reset I2S init structure parameters values -----------------*/ /* Initialize the I2S_Mode member */ I2S_InitStruct->I2S_Mode = I2S_Mode_SlaveTx; /* Initialize the I2S_Standard member */ I2S_InitStruct->I2S_Standard = I2S_Standard_Phillips; /* Initialize the I2S_DataFormat member */ I2S_InitStruct->I2S_DataFormat = I2S_DataFormat_16b; /* Initialize the I2S_MCLKOutput member */ I2S_InitStruct->I2S_MCLKOutput = I2S_MCLKOutput_Disable; /* Initialize the I2S_AudioFreq member */ I2S_InitStruct->I2S_AudioFreq = I2S_AudioFreq_Default; /* Initialize the I2S_CPOL member */ I2S_InitStruct->I2S_CPOL = I2S_CPOL_Low; } /** * @brief Enables or disables the specified SPI peripheral. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param NewState: new state of the SPIx peripheral. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected SPI peripheral */ SPIx->CR1 |= CR1_SPE_Set; } else { /* Disable the selected SPI peripheral */ SPIx->CR1 &= CR1_SPE_Reset; } } /** * @brief Enables or disables the specified SPI peripheral (in I2S mode). * @param SPIx: where x can be 2 or 3 to select the SPI peripheral. * @param NewState: new state of the SPIx peripheral. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_SPI_23_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected SPI peripheral (in I2S mode) */ SPIx->I2SCFGR |= I2SCFGR_I2SE_Set; } else { /* Disable the selected SPI peripheral (in I2S mode) */ SPIx->I2SCFGR &= I2SCFGR_I2SE_Reset; } } /** * @brief Enables or disables the specified SPI/I2S interrupts. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @param SPI_I2S_IT: specifies the SPI/I2S interrupt source to be * enabled or disabled. * This parameter can be one of the following values: * @arg SPI_I2S_IT_TXE: Tx buffer empty interrupt mask * @arg SPI_I2S_IT_RXNE: Rx buffer not empty interrupt mask * @arg SPI_I2S_IT_ERR: Error interrupt mask * @param NewState: new state of the specified SPI/I2S interrupt. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState) { uint16_t itpos = 0, itmask = 0 ; /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_SPI_I2S_CONFIG_IT(SPI_I2S_IT)); /* Get the SPI/I2S IT index */ itpos = SPI_I2S_IT >> 4; /* Set the IT mask */ itmask = (uint16_t)((uint16_t)1 << itpos); if (NewState != DISABLE) { /* Enable the selected SPI/I2S interrupt */ SPIx->CR2 |= itmask; } else { /* Disable the selected SPI/I2S interrupt */ SPIx->CR2 &= (uint16_t)~itmask; } } /** * @brief Enables or disables the SPIx/I2Sx DMA interface. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @param SPI_I2S_DMAReq: specifies the SPI/I2S DMA transfer request * to be enabled or disabled. * This parameter can be any combination of the following values: * @arg SPI_I2S_DMAReq_Tx: Tx buffer DMA transfer request * @arg SPI_I2S_DMAReq_Rx: Rx buffer DMA transfer request * @param NewState: new state of the selected SPI/I2S DMA transfer * request. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_SPI_I2S_DMAREQ(SPI_I2S_DMAReq)); if (NewState != DISABLE) { /* Enable the selected SPI/I2S DMA requests */ SPIx->CR2 |= SPI_I2S_DMAReq; } else { /* Disable the selected SPI/I2S DMA requests */ SPIx->CR2 &= (uint16_t)~SPI_I2S_DMAReq; } } /** * @brief Transmits a Data through the SPIx/I2Sx peripheral. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @param Data : Data to be transmitted.. * @retval : None */ void SPI_I2S_SendData(SPI_TypeDef* SPIx, uint16_t Data) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); /* Write in the DR register the data to be sent */ SPIx->DR = Data; } /** * @brief Returns the most recent received data by the SPIx/I2Sx peripheral. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @retval : The value of the received data. */ uint16_t SPI_I2S_ReceiveData(SPI_TypeDef* SPIx) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); /* Return the data in the DR register */ return SPIx->DR; } /** * @brief Configures internally by software the NSS pin for the selected * SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param SPI_NSSInternalSoft: specifies the SPI NSS internal state. * This parameter can be one of the following values: * @arg SPI_NSSInternalSoft_Set: Set NSS pin internally * @arg SPI_NSSInternalSoft_Reset: Reset NSS pin internally * @retval : None */ void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_NSS_INTERNAL(SPI_NSSInternalSoft)); if (SPI_NSSInternalSoft != SPI_NSSInternalSoft_Reset) { /* Set NSS pin internally by software */ SPIx->CR1 |= SPI_NSSInternalSoft_Set; } else { /* Reset NSS pin internally by software */ SPIx->CR1 &= SPI_NSSInternalSoft_Reset; } } /** * @brief Enables or disables the SS output for the selected SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param NewState: new state of the SPIx SS output. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected SPI SS output */ SPIx->CR2 |= CR2_SSOE_Set; } else { /* Disable the selected SPI SS output */ SPIx->CR2 &= CR2_SSOE_Reset; } } /** * @brief Configures the data size for the selected SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param SPI_DataSize: specifies the SPI data size. * This parameter can be one of the following values: * @arg SPI_DataSize_16b: Set data frame format to 16bit * @arg SPI_DataSize_8b: Set data frame format to 8bit * @retval : None */ void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_DATASIZE(SPI_DataSize)); /* Clear DFF bit */ SPIx->CR1 &= (uint16_t)~SPI_DataSize_16b; /* Set new DFF bit value */ SPIx->CR1 |= SPI_DataSize; } /** * @brief Transmit the SPIx CRC value. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @retval : None */ void SPI_TransmitCRC(SPI_TypeDef* SPIx) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); /* Enable the selected SPI CRC transmission */ SPIx->CR1 |= CR1_CRCNext_Set; } /** * @brief Enables or disables the CRC value calculation of the * transfered bytes. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param NewState: new state of the SPIx CRC value calculation. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected SPI CRC calculation */ SPIx->CR1 |= CR1_CRCEN_Set; } else { /* Disable the selected SPI CRC calculation */ SPIx->CR1 &= CR1_CRCEN_Reset; } } /** * @brief Returns the transmit or the receive CRC register value for * the specified SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param SPI_CRC: specifies the CRC register to be read. * This parameter can be one of the following values: * @arg SPI_CRC_Tx: Selects Tx CRC register * @arg SPI_CRC_Rx: Selects Rx CRC register * @retval : The selected CRC register value.. */ uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC) { uint16_t crcreg = 0; /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_CRC(SPI_CRC)); if (SPI_CRC != SPI_CRC_Rx) { /* Get the Tx CRC register */ crcreg = SPIx->TXCRCR; } else { /* Get the Rx CRC register */ crcreg = SPIx->RXCRCR; } /* Return the selected CRC register */ return crcreg; } /** * @brief Returns the CRC Polynomial register value for the specified SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @retval : The CRC Polynomial register value. */ uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); /* Return the CRC polynomial register */ return SPIx->CRCPR; } /** * @brief Selects the data transfer direction in bi-directional mode * for the specified SPI. * @param SPIx: where x can be 1, 2 or 3 to select the SPI peripheral. * @param SPI_Direction: specifies the data transfer direction in * bi-directional mode. * This parameter can be one of the following values: * @arg SPI_Direction_Tx: Selects Tx transmission direction * @arg SPI_Direction_Rx: Selects Rx receive direction * @retval : None */ void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_DIRECTION(SPI_Direction)); if (SPI_Direction == SPI_Direction_Tx) { /* Set the Tx only mode */ SPIx->CR1 |= SPI_Direction_Tx; } else { /* Set the Rx only mode */ SPIx->CR1 &= SPI_Direction_Rx; } } /** * @brief Checks whether the specified SPI/I2S flag is set or not. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @param SPI_I2S_FLAG: specifies the SPI/I2S flag to check. * This parameter can be one of the following values: * @arg SPI_I2S_FLAG_TXE: Transmit buffer empty flag. * @arg SPI_I2S_FLAG_RXNE: Receive buffer not empty flag. * @arg SPI_I2S_FLAG_BSY: Busy flag. * @arg SPI_I2S_FLAG_OVR: Overrun flag. * @arg SPI_FLAG_MODF: Mode Fault flag. * @arg SPI_FLAG_CRCERR: CRC Error flag. * @arg I2S_FLAG_UDR: Underrun Error flag. * @arg I2S_FLAG_CHSIDE: Channel Side flag. * @retval : The new state of SPI_I2S_FLAG (SET or RESET). */ FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG)); /* Check the status of the specified SPI/I2S flag */ if ((SPIx->SR & SPI_I2S_FLAG) != (uint16_t)RESET) { /* SPI_I2S_FLAG is set */ bitstatus = SET; } else { /* SPI_I2S_FLAG is reset */ bitstatus = RESET; } /* Return the SPI_I2S_FLAG status */ return bitstatus; } /** * @brief Clears the SPIx CRC Error (CRCERR) flag. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * @param SPI_I2S_FLAG: specifies the SPI flag to clear. * This function clears only CRCERR flag. * @note * - OVR (OverRun error) flag is cleared by software sequence: a read * operation to SPI_DR register (SPI_I2S_ReceiveData()) followed by a read * operation to SPI_SR register (SPI_I2S_GetFlagStatus()). * - UDR (UnderRun error) flag is cleared by a read operation to * SPI_SR register (SPI_I2S_GetFlagStatus()). * - MODF (Mode Fault) flag is cleared by software sequence: a read/write * operation to SPI_SR register (SPI_I2S_GetFlagStatus()) followed by a * write operation to SPI_CR1 register (SPI_Cmd() to enable the SPI). * @retval : None */ void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG) { /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_CLEAR_FLAG(SPI_I2S_FLAG)); /* Clear the selected SPI CRC Error (CRCERR) flag */ SPIx->SR = (uint16_t)~SPI_I2S_FLAG; } /** * @brief Checks whether the specified SPI/I2S interrupt has occurred or not. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * 2 or 3 in I2S mode * @param SPI_I2S_IT: specifies the SPI/I2S interrupt source to check. * This parameter can be one of the following values: * @arg SPI_I2S_IT_TXE: Transmit buffer empty interrupt. * @arg SPI_I2S_IT_RXNE: Receive buffer not empty interrupt. * @arg SPI_I2S_IT_OVR: Overrun interrupt. * @arg SPI_IT_MODF: Mode Fault interrupt. * @arg SPI_IT_CRCERR: CRC Error interrupt. * @arg I2S_IT_UDR: Underrun Error interrupt. * @retval : The new state of SPI_I2S_IT (SET or RESET). */ ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT) { ITStatus bitstatus = RESET; uint16_t itpos = 0, itmask = 0, enablestatus = 0; /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_GET_IT(SPI_I2S_IT)); /* Get the SPI/I2S IT index */ itpos = (uint16_t)((uint16_t)0x01 << (SPI_I2S_IT & (uint8_t)0x0F)); /* Get the SPI/I2S IT mask */ itmask = SPI_I2S_IT >> 4; /* Set the IT mask */ itmask = (uint16_t)((uint16_t)0x01 << itmask); /* Get the SPI_I2S_IT enable bit status */ enablestatus = (SPIx->CR2 & itmask) ; /* Check the status of the specified SPI/I2S interrupt */ if (((SPIx->SR & itpos) != (uint16_t)RESET) && enablestatus) { /* SPI_I2S_IT is set */ bitstatus = SET; } else { /* SPI_I2S_IT is reset */ bitstatus = RESET; } /* Return the SPI_I2S_IT status */ return bitstatus; } /** * @brief Clears the SPIx CRC Error (CRCERR) interrupt pending bit. * @param SPIx: where x can be : * 1, 2 or 3 in SPI mode * @param SPI_I2S_IT: specifies the SPI interrupt pending bit to clear. * This function clears only CRCERR intetrrupt pending bit. * @note * - OVR (OverRun Error) interrupt pending bit is cleared by software * sequence: a read operation to SPI_DR register (SPI_I2S_ReceiveData()) * followed by a read operation to SPI_SR register (SPI_I2S_GetITStatus()). * - UDR (UnderRun Error) interrupt pending bit is cleared by a read * operation to SPI_SR register (SPI_I2S_GetITStatus()). * - MODF (Mode Fault) interrupt pending bit is cleared by software sequence: * a read/write operation to SPI_SR register (SPI_I2S_GetITStatus()) * followed by a write operation to SPI_CR1 register (SPI_Cmd() to enable * the SPI). * @retval : None */ void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT) { uint16_t itpos = 0; /* Check the parameters */ assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_I2S_CLEAR_IT(SPI_I2S_IT)); /* Get the SPI IT index */ itpos = (uint16_t)((uint16_t)0x01 << (SPI_I2S_IT & (uint8_t)0x0F)); /* Clear the selected SPI CRC Error (CRCERR) interrupt pending bit */ SPIx->SR = (uint16_t)~itpos; } /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_spi.c
C
oos
27,737
;******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** ;* File Name : cortexm3_macro.s ;* Author : MCD Application Team ;* Date First Issued : 02/19/2007 ;* Description : Instruction wrappers for special Cortex-M3 instructions. ;******************************************************************************* ; History: ; 04/02/2007: V0.2 ; 02/19/2007: V0.1 ;******************************************************************************* ; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS ; WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, ; INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE ; CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING ; INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. ;******************************************************************************* SECTION .text:CODE(2) ; Exported functions EXPORT __WFI EXPORT __WFE EXPORT __SEV EXPORT __ISB EXPORT __DSB EXPORT __DMB EXPORT __SVC EXPORT __MRS_CONTROL EXPORT __MSR_CONTROL EXPORT __MRS_PSP EXPORT __MSR_PSP EXPORT __MRS_MSP EXPORT __MSR_MSP EXPORT __SETPRIMASK EXPORT __RESETPRIMASK EXPORT __SETFAULTMASK EXPORT __RESETFAULTMASK EXPORT __BASEPRICONFIG EXPORT __GetBASEPRI EXPORT __REV_HalfWord EXPORT __REV_Word ;******************************************************************************* ; Function Name : __WFI ; Description : Assembler function for the WFI instruction. ; Input : None ; Return : None ;******************************************************************************* __WFI WFI BX r14 ;******************************************************************************* ; Function Name : __WFE ; Description : Assembler function for the WFE instruction. ; Input : None ; Return : None ;******************************************************************************* __WFE WFE BX r14 ;******************************************************************************* ; Function Name : __SEV ; Description : Assembler function for the SEV instruction. ; Input : None ; Return : None ;******************************************************************************* __SEV SEV BX r14 ;******************************************************************************* ; Function Name : __ISB ; Description : Assembler function for the ISB instruction. ; Input : None ; Return : None ;******************************************************************************* __ISB ISB BX r14 ;******************************************************************************* ; Function Name : __DSB ; Description : Assembler function for the DSB instruction. ; Input : None ; Return : None ;******************************************************************************* __DSB DSB BX r14 ;******************************************************************************* ; Function Name : __DMB ; Description : Assembler function for the DMB instruction. ; Input : None ; Return : None ;******************************************************************************* __DMB DMB BX r14 ;******************************************************************************* ; Function Name : __SVC ; Description : Assembler function for the SVC instruction. ; Input : None ; Return : None ;******************************************************************************* __SVC SVC 0x01 BX r14 ;******************************************************************************* ; Function Name : __MRS_CONTROL ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Cortex-M3 CONTROL register value. ;******************************************************************************* __MRS_CONTROL MRS r0, CONTROL BX r14 ;******************************************************************************* ; Function Name : __MSR_CONTROL ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Cortex-M3 CONTROL register new value. ; Return : None ;******************************************************************************* __MSR_CONTROL MSR CONTROL, r0 ISB BX r14 ;******************************************************************************* ; Function Name : __MRS_PSP ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Process Stack value. ;******************************************************************************* __MRS_PSP MRS r0, PSP BX r14 ;******************************************************************************* ; Function Name : __MSR_PSP ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Process Stack new value. ; Return : None ;******************************************************************************* __MSR_PSP MSR PSP, r0 ; set Process Stack value BX r14 ;******************************************************************************* ; Function Name : __MRS_MSP ; Description : Assembler function for the MRS instruction. ; Input : None ; Return : - r0 : Main Stack value. ;******************************************************************************* __MRS_MSP MRS r0, MSP BX r14 ;******************************************************************************* ; Function Name : __MSR_MSP ; Description : Assembler function for the MSR instruction. ; Input : - r0 : Main Stack new value. ; Return : None ;******************************************************************************* __MSR_MSP MSR MSP, r0 ; set Main Stack value BX r14 ;******************************************************************************* ; Function Name : __SETPRIMASK ; Description : Assembler function to set the PRIMASK. ; Input : None ; Return : None ;******************************************************************************* __SETPRIMASK CPSID i BX r14 ;******************************************************************************* ; Function Name : __RESETPRIMASK ; Description : Assembler function to reset the PRIMASK. ; Input : None ; Return : None ;******************************************************************************* __RESETPRIMASK CPSIE i BX r14 ;******************************************************************************* ; Function Name : __SETFAULTMASK ; Description : Assembler function to set the FAULTMASK. ; Input : None ; Return : None ;******************************************************************************* __SETFAULTMASK CPSID f BX r14 ;******************************************************************************* ; Function Name : __RESETFAULTMASK ; Description : Assembler function to reset the FAULTMASK. ; Input : None ; Return : None ;******************************************************************************* __RESETFAULTMASK CPSIE f BX r14 ;******************************************************************************* ; Function Name : __BASEPRICONFIG ; Description : Assembler function to set the Base Priority. ; Input : - r0 : Base Priority new value ; Return : None ;******************************************************************************* __BASEPRICONFIG MSR BASEPRI, r0 BX r14 ;******************************************************************************* ; Function Name : __GetBASEPRI ; Description : Assembler function to get the Base Priority value. ; Input : None ; Return : - r0 : Base Priority value ;******************************************************************************* __GetBASEPRI MRS r0, BASEPRI_MAX BX r14 ;******************************************************************************* ; Function Name : __REV_HalfWord ; Description : Reverses the byte order in HalfWord(16-bit) input variable. ; Input : - r0 : specifies the input variable ; Return : - r0 : holds tve variable value after byte reversing. ;******************************************************************************* __REV_HalfWord REV16 r0, r0 BX r14 ;******************************************************************************* ; Function Name : __REV_Word ; Description : Reverses the byte order in Word(32-bit) input variable. ; Input : - r0 : specifies the input variable ; Return : - r0 : holds tve variable value after byte reversing. ;******************************************************************************* __REV_Word REV r0, r0 BX r14 END ;******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE*****
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/cortexm3_macro_iar.s
Unix Assembly
oos
9,440
/** ****************************************************************************** * @file stm32f10x_dac.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the DAC firmware functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_dac.h" #include "stm32f10x_rcc.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup DAC * @brief DAC driver modules * @{ */ /** @defgroup DAC_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup DAC_Private_Defines * @{ */ /* DAC EN mask */ #define CR_EN_Set ((uint32_t)0x00000001) /* DAC DMAEN mask */ #define CR_DMAEN_Set ((uint32_t)0x00001000) /* CR register Mask */ #define CR_CLEAR_Mask ((uint32_t)0x00000FFE) /* DAC SWTRIG mask */ #define SWTRIGR_SWTRIG_Set ((uint32_t)0x00000001) /* DAC Dual Channels SWTRIG masks */ #define DUAL_SWTRIG_Set ((uint32_t)0x00000003) #define DUAL_SWTRIG_Reset ((uint32_t)0xFFFFFFFC) /* DHR registers offsets */ #define DHR12R1_Offset ((uint32_t)0x00000008) #define DHR12R2_Offset ((uint32_t)0x00000014) #define DHR12RD_Offset ((uint32_t)0x00000020) /* DOR register offset */ #define DOR_Offset ((uint32_t)0x0000002C) /** * @} */ /** @defgroup DAC_Private_Macros * @{ */ /** * @} */ /** @defgroup DAC_Private_Variables * @{ */ /** * @} */ /** @defgroup DAC_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup DAC_Private_Functions * @{ */ /** * @brief Deinitializes the DAC peripheral registers to their default * reset values. * @param None * @retval : None */ void DAC_DeInit(void) { /* Enable DAC reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, ENABLE); /* Release DAC from reset state */ RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, DISABLE); } /** * @brief Initializes the DAC peripheral according to the specified * parameters in the DAC_InitStruct. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure that * contains the configuration information for the specified * DAC channel. * @retval : None */ void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct) { uint32_t tmpreg1 = 0, tmpreg2 = 0; /* Check the DAC parameters */ assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude)); assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->DAC_OutputBuffer)); /*---------------------------- DAC CR Configuration --------------------------*/ /* Get the DAC CR value */ tmpreg1 = DAC->CR; /* Clear BOFFx, TENx, TSELx, WAVEx and MAMPx bits */ tmpreg1 &= ~(CR_CLEAR_Mask << DAC_Channel); /* Configure for the selected DAC channel: buffer output, trigger, wave genration, mask/amplitude for wave genration */ /* Set TSELx and TENx bits according to DAC_Trigger value */ /* Set WAVEx bits according to DAC_WaveGeneration value */ /* Set MAMPx bits according to DAC_LFSRUnmask_TriangleAmplitude value */ /* Set BOFFx bit according to DAC_OutputBuffer value */ tmpreg2 = (DAC_InitStruct->DAC_Trigger | DAC_InitStruct->DAC_WaveGeneration | DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude | DAC_InitStruct->DAC_OutputBuffer); /* Calculate CR register value depending on DAC_Channel */ tmpreg1 |= tmpreg2 << DAC_Channel; /* Write to DAC CR */ DAC->CR = tmpreg1; } /** * @brief Fills each DAC_InitStruct member with its default value. * @param DAC_InitStruct : pointer to a DAC_InitTypeDef structure * which will be initialized. * @retval : None */ void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct) { /*--------------- Reset DAC init structure parameters values -----------------*/ /* Initialize the DAC_Trigger member */ DAC_InitStruct->DAC_Trigger = DAC_Trigger_None; /* Initialize the DAC_WaveGeneration member */ DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None; /* Initialize the DAC_LFSRUnmask_TriangleAmplitude member */ DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0; /* Initialize the DAC_OutputBuffer member */ DAC_InitStruct->DAC_OutputBuffer = DAC_OutputBuffer_Enable; } /** * @brief Enables or disables the specified DAC channel. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @param NewState: new state of the DAC channel. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DAC channel */ DAC->CR |= CR_EN_Set << DAC_Channel; } else { /* Disable the selected DAC channel */ DAC->CR &= ~(CR_EN_Set << DAC_Channel); } } /** * @brief Enables or disables the specified DAC channel DMA request. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @param NewState: new state of the selected DAC channel DMA request. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DAC channel DMA request */ DAC->CR |= CR_DMAEN_Set << DAC_Channel; } else { /* Disable the selected DAC channel DMA request */ DAC->CR &= ~(CR_DMAEN_Set << DAC_Channel); } } /** * @brief Enables or disables the selected DAC channel software trigger. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @param NewState: new state of the selected DAC channel software trigger. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable software trigger for the selected DAC channel */ DAC->SWTRIGR |= SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4); } else { /* Disable software trigger for the selected DAC channel */ DAC->SWTRIGR &= ~(SWTRIGR_SWTRIG_Set << (DAC_Channel >> 4)); } } /** * @brief Enables or disables simultaneously the two DAC channels software * triggers. * @param NewState: new state of the DAC channels software triggers. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DAC_DualSoftwareTriggerCmd(FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable software trigger for both DAC channels */ DAC->SWTRIGR |= DUAL_SWTRIG_Set ; } else { /* Disable software trigger for both DAC channels */ DAC->SWTRIGR &= DUAL_SWTRIG_Reset; } } /** * @brief Enables or disables the selected DAC channel wave generation. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @param DAC_Wave: Specifies the wave type to enable or disable. * This parameter can be one of the following values: * @arg DAC_Wave_Noise: noise wave generation * @arg DAC_Wave_Triangle: triangle wave generation * @param NewState: new state of the selected DAC channel wave generation. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_DAC_WAVE(DAC_Wave)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected wave generation for the selected DAC channel */ DAC->CR |= DAC_Wave << DAC_Channel; } else { /* Disable the selected wave generation for the selected DAC channel */ DAC->CR &= ~(DAC_Wave << DAC_Channel); } } /** * @brief Set the specified data holding register value for DAC channel1. * @param DAC_Align: Specifies the data alignement for DAC channel1. * This parameter can be one of the following values: * @arg DAC_Align_8b_R: 8bit right data alignement selected * @arg DAC_Align_12b_L: 12bit left data alignement selected * @arg DAC_Align_12b_R: 12bit right data alignement selected * @param Data : Data to be loaded in the selected data holding * register. * @retval : None */ void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data) { /* Check the parameters */ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); /* Set the DAC channel1 selected data holding register */ *((__IO uint32_t *)(DAC_BASE + DHR12R1_Offset + DAC_Align)) = (uint32_t)Data; } /** * @brief Set the specified data holding register value for DAC channel2. * @param DAC_Align: Specifies the data alignement for DAC channel2. * This parameter can be one of the following values: * @arg DAC_Align_8b_R: 8bit right data alignement selected * @arg DAC_Align_12b_L: 12bit left data alignement selected * @arg DAC_Align_12b_R: 12bit right data alignement selected * @param Data : Data to be loaded in the selected data holding * register. * @retval : None */ void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data) { /* Check the parameters */ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); /* Set the DAC channel2 selected data holding register */ *((__IO uint32_t *)(DAC_BASE + DHR12R2_Offset + DAC_Align)) = (uint32_t)Data; } /** * @brief Set the specified data holding register value for dual channel * DAC. * @param DAC_Align: Specifies the data alignement for dual channel DAC. * This parameter can be one of the following values: * @arg DAC_Align_8b_R: 8bit right data alignement selected * @arg DAC_Align_12b_L: 12bit left data alignement selected * @arg DAC_Align_12b_R: 12bit right data alignement selected * @param Data2: Data for DAC Channel2 to be loaded in the selected data * holding register. * @param Data1: Data for DAC Channel1 to be loaded in the selected data * holding register. * @retval : None */ void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1) { uint32_t data = 0; /* Check the parameters */ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data1)); assert_param(IS_DAC_DATA(Data2)); /* Calculate and set dual DAC data holding register value */ if (DAC_Align == DAC_Align_8b_R) { data = ((uint32_t)Data2 << 8) | Data1; } else { data = ((uint32_t)Data2 << 16) | Data1; } /* Set the dual DAC selected data holding register */ *((__IO uint32_t *)(DAC_BASE + DHR12RD_Offset + DAC_Align)) = data; } /** * @brief Returns the last data output value of the selected DAC cahnnel. * @param DAC_Channel: the selected DAC channel. * This parameter can be one of the following values: * @arg DAC_Channel_1: DAC Channel1 selected * @arg DAC_Channel_2: DAC Channel2 selected * @retval : The selected DAC channel data output value. */ uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel) { /* Check the parameters */ assert_param(IS_DAC_CHANNEL(DAC_Channel)); /* Returns the DAC channel data output register value */ return (uint16_t) (*(__IO uint32_t*)(DAC_BASE + DOR_Offset + ((uint32_t)DAC_Channel >> 2))); } /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_dac.c
C
oos
13,723
/******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** * File Name : stm32fxxx_eth.c * Author : MCD Application Team * Version : V1.0.0 * Date : 12/17/2008 * Updates : 05/2009 Driver optimization. * - No copy. DMA directly uses Stack packets. * Desciption : This file provides all the ETHERNET firmware functions. ******************************************************************************** * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* For the delays. */ #include "FreeRTOS.h" #include "task.h" /* Includes ------------------------------------------------------------------*/ #include "stm32fxxx_eth.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Global pointers on Tx and Rx descriptor used to track transmit and receive descriptors */ ETH_DMADESCTypeDef *DMATxDescToSet; ETH_DMADESCTypeDef *DMARxDescToGet; ETH_DMADESCTypeDef *DMAPTPTxDescToSet; ETH_DMADESCTypeDef *DMAPTPRxDescToGet; /* ETHERNET MAC address offsets */ #define ETH_MAC_AddrHighBase (ETH_MAC_BASE + 0x40) /* ETHERNET MAC address high offset */ #define ETH_MAC_AddrLowBase (ETH_MAC_BASE + 0x44) /* ETHERNET MAC address low offset */ /* ETHERNET MACMIIAR register Mask */ #define MACMIIAR_CR_Mask ((u32)0xFFFFFFE3) /* ETHERNET MACCR register Mask */ #define MACCR_CLEAR_Mask ((u32)0xFF20810F) /* ETHERNET MACFCR register Mask */ #define MACFCR_CLEAR_Mask ((u32)0x0000FF41) /* ETHERNET DMAOMR register Mask */ #define DMAOMR_CLEAR_Mask ((u32)0xF8DE3F23) /* ETHERNET Remote Wake-up frame register length */ #define ETH_WakeupRegisterLength 8 /* ETHERNET Missed frames counter Shift */ #define ETH_DMA_RxOverflowMissedFramesCounterShift 17 /* ETHERNET DMA Tx descriptors Collision Count Shift */ #define ETH_DMATxDesc_CollisionCountShift 3 /* ETHERNET DMA Tx descriptors Buffer2 Size Shift */ #define ETH_DMATxDesc_BufferSize2Shift 16 /* ETHERNET DMA Rx descriptors Frame Length Shift */ #define ETH_DMARxDesc_FrameLengthShift 16 /* ETHERNET DMA Rx descriptors Buffer2 Size Shift */ #define ETH_DMARxDesc_Buffer2SizeShift 16 /* ETHERNET errors */ #define ETH_ERROR ((u32)0) #define ETH_SUCCESS ((u32)1) #define ethFIVE_SECONDS ( 5000 / portTICK_RATE_MS ) #define ethHUNDRED_MS ( 100 / portTICK_RATE_MS ) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : ETH_DeInit * Desciption : Deinitializes the ETHERNET peripheral registers to their * default reset values. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_DeInit(void) { // RCC_AHBPeriphResetCmd(RCC_AHBPeriph_ETH_MAC, ENABLE); // RCC_AHBPeriphResetCmd(RCC_AHBPeriph_ETH_MAC, DISABLE); } /******************************************************************************* * Function Name : ETH_Init * Desciption : Initializes the ETHERNET peripheral according to the specified * parameters in the ETH_InitStruct . * Input : - ETH_InitStruct: pointer to a ETH_InitTypeDef structure * that contains the configuration information for the * specified ETHERNET peripheral. * Output : None * Return : None *******************************************************************************/ u32 ETH_Init(ETH_InitTypeDef* ETH_InitStruct, u16 PHYAddress) { u32 RegValue = 0, tmpreg = 0; RCC_ClocksTypeDef rcc_clocks; u32 hclk = 60000000; u32 timeout = 0; /* Check the parameters */ /* MAC --------------------------*/ eth_assert_param(IS_ETH_AUTONEGOTIATION(ETH_InitStruct->ETH_AutoNegotiation)); eth_assert_param(IS_ETH_WATCHDOG(ETH_InitStruct->ETH_Watchdog)); eth_assert_param(IS_ETH_JABBER(ETH_InitStruct->ETH_Jabber)); eth_assert_param(IS_ETH_JUMBO_FRAME(ETH_InitStruct->ETH_JumboFrame)); eth_assert_param(IS_ETH_INTER_FRAME_GAP(ETH_InitStruct->ETH_InterFrameGap)); eth_assert_param(IS_ETH_CARRIER_SENSE(ETH_InitStruct->ETH_CarrierSense)); eth_assert_param(IS_ETH_SPEED(ETH_InitStruct->ETH_Speed)); eth_assert_param(IS_ETH_RECEIVE_OWN(ETH_InitStruct->ETH_ReceiveOwn)); eth_assert_param(IS_ETH_LOOPBACK_MODE(ETH_InitStruct->ETH_LoopbackMode)); eth_assert_param(IS_ETH_DUPLEX_MODE(ETH_InitStruct->ETH_Mode)); eth_assert_param(IS_ETH_CHECKSUM_OFFLOAD(ETH_InitStruct->ETH_ChecksumOffload)); eth_assert_param(IS_ETH_RETRY_TRANSMISSION(ETH_InitStruct->ETH_RetryTransmission)); eth_assert_param(IS_ETH_AUTOMATIC_PADCRC_STRIP(ETH_InitStruct->ETH_AutomaticPadCRCStrip)); eth_assert_param(IS_ETH_BACKOFF_LIMIT(ETH_InitStruct->ETH_BackOffLimit)); eth_assert_param(IS_ETH_DEFERRAL_CHECK(ETH_InitStruct->ETH_DeferralCheck)); eth_assert_param(IS_ETH_RECEIVE_ALL(ETH_InitStruct->ETH_ReceiveAll)); eth_assert_param(IS_ETH_SOURCE_ADDR_FILTER(ETH_InitStruct->ETH_SourceAddrFilter)); eth_assert_param(IS_ETH_CONTROL_FRAMES(ETH_InitStruct->ETH_PassControlFrames)); eth_assert_param(IS_ETH_BROADCAST_FRAMES_RECEPTION(ETH_InitStruct->ETH_BroadcastFramesReception)); eth_assert_param(IS_ETH_DESTINATION_ADDR_FILTER(ETH_InitStruct->ETH_DestinationAddrFilter)); eth_assert_param(IS_ETH_PROMISCUOUS_MODE(ETH_InitStruct->ETH_PromiscuousMode)); eth_assert_param(IS_ETH_MULTICAST_FRAMES_FILTER(ETH_InitStruct->ETH_MulticastFramesFilter)); eth_assert_param(IS_ETH_UNICAST_FRAMES_FILTER(ETH_InitStruct->ETH_UnicastFramesFilter)); eth_assert_param(IS_ETH_PAUSE_TIME(ETH_InitStruct->ETH_PauseTime)); eth_assert_param(IS_ETH_ZEROQUANTA_PAUSE(ETH_InitStruct->ETH_ZeroQuantaPause)); eth_assert_param(IS_ETH_PAUSE_LOW_THRESHOLD(ETH_InitStruct->ETH_PauseLowThreshold)); eth_assert_param(IS_ETH_UNICAST_PAUSE_FRAME_DETECT(ETH_InitStruct->ETH_UnicastPauseFrameDetect)); eth_assert_param(IS_ETH_RECEIVE_FLOWCONTROL(ETH_InitStruct->ETH_ReceiveFlowControl)); eth_assert_param(IS_ETH_TRANSMIT_FLOWCONTROL(ETH_InitStruct->ETH_TransmitFlowControl)); eth_assert_param(IS_ETH_VLAN_TAG_COMPARISON(ETH_InitStruct->ETH_VLANTagComparison)); eth_assert_param(IS_ETH_VLAN_TAG_IDENTIFIER(ETH_InitStruct->ETH_VLANTagIdentifier)); /* DMA --------------------------*/ eth_assert_param(IS_ETH_DROP_TCPIP_CHECKSUM_FRAME(ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame)); eth_assert_param(IS_ETH_RECEIVE_STORE_FORWARD(ETH_InitStruct->ETH_ReceiveStoreForward)); eth_assert_param(IS_ETH_FLUSH_RECEIVE_FRAME(ETH_InitStruct->ETH_FlushReceivedFrame)); eth_assert_param(IS_ETH_TRANSMIT_STORE_FORWARD(ETH_InitStruct->ETH_TransmitStoreForward)); eth_assert_param(IS_ETH_TRANSMIT_THRESHOLD_CONTROL(ETH_InitStruct->ETH_TransmitThresholdControl)); eth_assert_param(IS_ETH_FORWARD_ERROR_FRAMES(ETH_InitStruct->ETH_ForwardErrorFrames)); eth_assert_param(IS_ETH_FORWARD_UNDERSIZED_GOOD_FRAMES(ETH_InitStruct->ETH_ForwardUndersizedGoodFrames)); eth_assert_param(IS_ETH_RECEIVE_THRESHOLD_CONTROL(ETH_InitStruct->ETH_ReceiveThresholdControl)); eth_assert_param(IS_ETH_SECOND_FRAME_OPERATE(ETH_InitStruct->ETH_SecondFrameOperate)); eth_assert_param(IS_ETH_ADDRESS_ALIGNED_BEATS(ETH_InitStruct->ETH_AddressAlignedBeats)); eth_assert_param(IS_ETH_FIXED_BURST(ETH_InitStruct->ETH_FixedBurst)); eth_assert_param(IS_ETH_RXDMA_BURST_LENGTH(ETH_InitStruct->ETH_RxDMABurstLength)); eth_assert_param(IS_ETH_TXDMA_BURST_LENGTH(ETH_InitStruct->ETH_TxDMABurstLength)); eth_assert_param(IS_ETH_DMA_DESC_SKIP_LENGTH(ETH_InitStruct->ETH_DescriptorSkipLength)); eth_assert_param(IS_ETH_DMA_ARBITRATION_ROUNDROBIN_RXTX(ETH_InitStruct->ETH_DMAArbitration)); /*--------------------------------- MAC Config -------------------------------*/ /*----------------------- ETHERNET MACMIIAR Configuration --------------------*/ /* Get the ETHERNET MACMIIAR value */ tmpreg = ETH_MAC->MACMIIAR; /* Clear CSR Clock Range CR[2:0] bits */ tmpreg &= MACMIIAR_CR_Mask; /* Get hclk frequency value */ RCC_GetClocksFreq(&rcc_clocks); hclk = rcc_clocks.HCLK_Frequency; /* Set CR bits depending on hclk value */ if((hclk >= 20000000)&&(hclk < 35000000)) { /* CSR Clock Range between 20-35 MHz */ tmpreg |= (u32)ETH_MACMIIAR_CR_Div16; } else if((hclk >= 35000000)&&(hclk < 60000000)) { /* CSR Clock Range between 35-60 MHz */ tmpreg |= (u32)ETH_MACMIIAR_CR_Div26; } else /* ((hclk >= 60000000)&&(hclk <= 72000000)) */ { /* CSR Clock Range between 60-72 MHz */ tmpreg |= (u32)ETH_MACMIIAR_CR_Div42; } /* Write to ETHERNET MAC MIIAR: Configure the ETHERNET CSR Clock Range */ ETH_MAC->MACMIIAR = (u32)tmpreg; /*--------------------- PHY initialization and configuration -----------------*/ /* Put the PHY in reset mode */ if(!(ETH_WritePHYRegister(PHYAddress, PHY_BCR, PHY_Reset))) { /* Return ERROR in case of write timeout */ return ETH_ERROR; } /* Delay to assure PHY reset */ vTaskDelay( 250 / portTICK_RATE_MS ); if(ETH_InitStruct->ETH_AutoNegotiation != ETH_AutoNegotiation_Disable) { /* We wait for linked satus... */ timeout = 0; do { /* Wait 100ms before checking for a link again. */ vTaskDelay( ethHUNDRED_MS ); timeout++; /* Don't wait any longer than 5 seconds. */ } while (!(ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_Linked_Status) && (timeout < ( ethFIVE_SECONDS / ethHUNDRED_MS ) ) ); /* Return ERROR in case of timeout */ if(timeout == ( ethFIVE_SECONDS / ethHUNDRED_MS )) { return ETH_ERROR; } /* Enable Auto-Negotiation */ if(!(ETH_WritePHYRegister(PHYAddress, PHY_BCR, PHY_AutoNegotiation))) { /* Return ERROR in case of write timeout */ return ETH_ERROR; } /* Reset Timeout counter */ timeout = 0; /* Wait until the autonegotiation will be completed */ do { /* Wait 100ms before checking for negotiation to complete. */ vTaskDelay( ethHUNDRED_MS ); timeout++; /* Don't wait longer than 5 seconds. */ } while (!(ETH_ReadPHYRegister(PHYAddress, PHY_BSR) & PHY_AutoNego_Complete) && (timeout < ( ethFIVE_SECONDS / ethHUNDRED_MS ) ) ); /* Return ERROR in case of timeout */ if(timeout == ( ethFIVE_SECONDS / ethHUNDRED_MS )) { return ETH_ERROR; } /* Reset Timeout counter */ timeout = 0; /* Read the result of the autonegotiation */ RegValue = ETH_ReadPHYRegister(PHYAddress, PHY_SR); /* Configure the MAC with the Duplex Mode fixed by the autonegotiation process */ if((RegValue & PHY_Duplex_Status) != (u32)RESET) { /* Set Ethernet duplex mode to FullDuplex following the autonegotiation */ ETH_InitStruct->ETH_Mode = ETH_Mode_FullDuplex; } else { /* Set Ethernet duplex mode to HalfDuplex following the autonegotiation */ ETH_InitStruct->ETH_Mode = ETH_Mode_HalfDuplex; } /* Configure the MAC with the speed fixed by the autonegotiation process */ if(RegValue & PHY_Speed_Status) { /* Set Ethernet speed to 100M following the autonegotiation */ ETH_InitStruct->ETH_Speed = ETH_Speed_10M; } else { /* Set Ethernet speed to 10M following the autonegotiation */ ETH_InitStruct->ETH_Speed = ETH_Speed_100M; } } // else { if(!ETH_WritePHYRegister(PHYAddress, PHY_BCR, ((u16)(ETH_InitStruct->ETH_Mode >> 3) | (u16)(ETH_InitStruct->ETH_Speed >> 1)))) { /* Return ERROR in case of write timeout */ return ETH_ERROR; } vTaskDelay( 250 / portTICK_RATE_MS ); } /*------------------------- ETHERNET MACCR Configuration ---------------------*/ /* Get the ETHERNET MACCR value */ tmpreg = ETH_MAC->MACCR; /* Clear WD, PCE, PS, TE and RE bits */ tmpreg &= MACCR_CLEAR_Mask; /* Set the WD bit according to ETH_Watchdog value */ /* Set the JD: bit according to ETH_Jabber value */ /* Set the JE bit according to ETH_JumboFrame value */ /* Set the IFG bit according to ETH_InterFrameGap value */ /* Set the DCRS bit according to ETH_CarrierSense value */ /* Set the FES bit according to ETH_Speed value */ /* Set the DO bit according to ETH_ReceiveOwn value */ /* Set the LM bit according to ETH_LoopbackMode value */ /* Set the DM bit according to ETH_Mode value */ /* Set the IPC bit according to ETH_ChecksumOffload value */ /* Set the DR bit according to ETH_RetryTransmission value */ /* Set the ACS bit according to ETH_AutomaticPadCRCStrip value */ /* Set the BL bit according to ETH_BackOffLimit value */ /* Set the DC bit according to ETH_DeferralCheck value */ tmpreg |= (u32)(ETH_InitStruct->ETH_Watchdog | ETH_InitStruct->ETH_Jabber | ETH_InitStruct->ETH_JumboFrame | ETH_InitStruct->ETH_InterFrameGap | ETH_InitStruct->ETH_CarrierSense | ETH_InitStruct->ETH_Speed | ETH_InitStruct->ETH_ReceiveOwn | ETH_InitStruct->ETH_LoopbackMode | ETH_InitStruct->ETH_Mode | ETH_InitStruct->ETH_ChecksumOffload | ETH_InitStruct->ETH_RetryTransmission | ETH_InitStruct->ETH_AutomaticPadCRCStrip | ETH_InitStruct->ETH_BackOffLimit | ETH_InitStruct->ETH_DeferralCheck); /* Write to ETHERNET MACCR */ ETH_MAC->MACCR = (u32)tmpreg; /*------------------------ ETHERNET MACFFR Configuration ---------------------*/ /* Set the RA bit according to ETH_ReceiveAll value */ /* Set the SAF and SAIF bits according to ETH_SourceAddrFilter value */ /* Set the PCF bit according to ETH_PassControlFrames value */ /* Set the DBF bit according to ETH_BroadcastFramesReception value */ /* Set the DAIF bit according to ETH_DestinationAddrFilter value */ /* Set the PR bit according to ETH_PromiscuousMode value */ /* Set the PM, HMC and HPF bits according to ETH_MulticastFramesFilter value */ /* Set the HUC and HPF bits according to ETH_UnicastFramesFilter value */ /* Write to ETHERNET MACFFR */ ETH_MAC->MACFFR = (u32)(ETH_InitStruct->ETH_ReceiveAll | ETH_InitStruct->ETH_SourceAddrFilter | ETH_InitStruct->ETH_PassControlFrames | ETH_InitStruct->ETH_BroadcastFramesReception | ETH_InitStruct->ETH_DestinationAddrFilter | ETH_InitStruct->ETH_PromiscuousMode | ETH_InitStruct->ETH_MulticastFramesFilter | ETH_InitStruct->ETH_UnicastFramesFilter); /*---------------- ETHERNET MACHTHR and MACHTLR Configuration ----------------*/ /* Write to ETHERNET MACHTHR */ ETH_MAC->MACHTHR = (u32)ETH_InitStruct->ETH_HashTableHigh; /* Write to ETHERNET MACHTLR */ ETH_MAC->MACHTLR = (u32)ETH_InitStruct->ETH_HashTableLow; /*------------------------ ETHERNET MACFCR Configuration ---------------------*/ /* Get the ETHERNET MACFCR value */ tmpreg = ETH_MAC->MACFCR; /* Clear xx bits */ tmpreg &= MACFCR_CLEAR_Mask; /* Set the PT bit according to ETH_PauseTime value */ /* Set the DZPQ bit according to ETH_ZeroQuantaPause value */ /* Set the PLT bit according to ETH_PauseLowThreshold value */ /* Set the UP bit according to ETH_UnicastPauseFrameDetect value */ /* Set the RFE bit according to ETH_ReceiveFlowControl value */ /* Set the TFE bit according to ETH_TransmitFlowControl value */ tmpreg |= (u32)((ETH_InitStruct->ETH_PauseTime << 16) | ETH_InitStruct->ETH_ZeroQuantaPause | ETH_InitStruct->ETH_PauseLowThreshold | ETH_InitStruct->ETH_UnicastPauseFrameDetect | ETH_InitStruct->ETH_ReceiveFlowControl | ETH_InitStruct->ETH_TransmitFlowControl); /* Write to ETHERNET MACFCR */ ETH_MAC->MACFCR = (u32)tmpreg; /*------------------------ ETHERNET MACVLANTR Configuration ------------------*/ /* Set the ETV bit according to ETH_VLANTagComparison value */ /* Set the VL bit according to ETH_VLANTagIdentifier value */ ETH_MAC->MACVLANTR = (u32)(ETH_InitStruct->ETH_VLANTagComparison | ETH_InitStruct->ETH_VLANTagIdentifier); #ifdef _ETH_DMA /*--------------------------------- DMA Config -------------------------------*/ /*------------------------ ETHERNET DMAOMR Configuration ---------------------*/ /* Get the ETHERNET DMAOMR value */ tmpreg = ETH_DMA->DMAOMR; /* Clear xx bits */ tmpreg &= DMAOMR_CLEAR_Mask; /* Set the DT bit according to ETH_DropTCPIPChecksumErrorFrame value */ /* Set the RSF bit according to ETH_ReceiveStoreForward value */ /* Set the DFF bit according to ETH_FlushReceivedFrame value */ /* Set the TSF bit according to ETH_TransmitStoreForward value */ /* Set the TTC bit according to ETH_TransmitThresholdControl value */ /* Set the FEF bit according to ETH_ForwardErrorFrames value */ /* Set the FUF bit according to ETH_ForwardUndersizedGoodFrames value */ /* Set the RTC bit according to ETH_ReceiveThresholdControl value */ /* Set the OSF bit according to ETH_SecondFrameOperate value */ tmpreg |= (u32)(ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame | ETH_InitStruct->ETH_ReceiveStoreForward | ETH_InitStruct->ETH_FlushReceivedFrame | ETH_InitStruct->ETH_TransmitStoreForward | ETH_InitStruct->ETH_TransmitThresholdControl | ETH_InitStruct->ETH_ForwardErrorFrames | ETH_InitStruct->ETH_ForwardUndersizedGoodFrames | ETH_InitStruct->ETH_ReceiveThresholdControl | ETH_InitStruct->ETH_SecondFrameOperate); /* Write to ETHERNET DMAOMR */ ETH_DMA->DMAOMR = (u32)tmpreg; /*------------------------ ETHERNET DMABMR Configuration ---------------------*/ /* Set the AAL bit according to ETH_AddressAlignedBeats value */ /* Set the FB bit according to ETH_FixedBurst value */ /* Set the RPBL and 4*PBL bits according to ETH_RxDMABurstLength value */ /* Set the PBL and 4*PBL bits according to ETH_TxDMABurstLength value */ /* Set the DSL bit according to ETH_DesciptorSkipLength value */ /* Set the PR and DA bits according to ETH_DMAArbitration value */ ETH_DMA->DMABMR = (u32)(ETH_InitStruct->ETH_AddressAlignedBeats | ETH_InitStruct->ETH_FixedBurst | ETH_InitStruct->ETH_RxDMABurstLength | /* !! if 4xPBL is selected for Tx or Rx it is applied for the other */ ETH_InitStruct->ETH_TxDMABurstLength | (ETH_InitStruct->ETH_DescriptorSkipLength << 2) | ETH_InitStruct->ETH_DMAArbitration | ETH_DMABMR_USP); /* Enable use of separate PBL for Rx and Tx */ #endif /* _ETH_DMA */ /* Return Ethernet configuration success */ return ETH_SUCCESS; } /******************************************************************************* * Function Name : ETH_StructInit * Desciption : Fills each ETH_InitStruct member with its default value. * Input : - ETH_InitStruct: pointer to a ETH_InitTypeDef structure * which will be initialized. * Output : None * Return : None *******************************************************************************/ void ETH_StructInit(ETH_InitTypeDef* ETH_InitStruct) { /* ETH_InitStruct members default value */ /*------------------------ MAC -----------------------------------*/ ETH_InitStruct->ETH_AutoNegotiation = ETH_AutoNegotiation_Disable; ETH_InitStruct->ETH_Watchdog = ETH_Watchdog_Enable; ETH_InitStruct->ETH_Jabber = ETH_Jabber_Enable; ETH_InitStruct->ETH_JumboFrame = ETH_JumboFrame_Disable; ETH_InitStruct->ETH_InterFrameGap = ETH_InterFrameGap_96Bit; ETH_InitStruct->ETH_CarrierSense = ETH_CarrierSense_Enable; ETH_InitStruct->ETH_Speed = ETH_Speed_10M; ETH_InitStruct->ETH_ReceiveOwn = ETH_ReceiveOwn_Enable; ETH_InitStruct->ETH_LoopbackMode = ETH_LoopbackMode_Disable; ETH_InitStruct->ETH_Mode = ETH_Mode_HalfDuplex; ETH_InitStruct->ETH_ChecksumOffload = ETH_ChecksumOffload_Disable; ETH_InitStruct->ETH_RetryTransmission = ETH_RetryTransmission_Enable; ETH_InitStruct->ETH_AutomaticPadCRCStrip = ETH_AutomaticPadCRCStrip_Disable; ETH_InitStruct->ETH_BackOffLimit = ETH_BackOffLimit_10; ETH_InitStruct->ETH_DeferralCheck = ETH_DeferralCheck_Disable; ETH_InitStruct->ETH_ReceiveAll = ETH_ReceiveAll_Disable; ETH_InitStruct->ETH_SourceAddrFilter = ETH_SourceAddrFilter_Disable; ETH_InitStruct->ETH_PassControlFrames = ETH_PassControlFrames_BlockAll; ETH_InitStruct->ETH_BroadcastFramesReception = ETH_BroadcastFramesReception_Disable; ETH_InitStruct->ETH_DestinationAddrFilter = ETH_DestinationAddrFilter_Normal; ETH_InitStruct->ETH_PromiscuousMode = ETH_PromiscuousMode_Disable; ETH_InitStruct->ETH_MulticastFramesFilter = ETH_MulticastFramesFilter_Perfect; ETH_InitStruct->ETH_UnicastFramesFilter = ETH_UnicastFramesFilter_Perfect; ETH_InitStruct->ETH_HashTableHigh = 0x0; ETH_InitStruct->ETH_HashTableLow = 0x0; ETH_InitStruct->ETH_PauseTime = 0x0; ETH_InitStruct->ETH_ZeroQuantaPause = ETH_ZeroQuantaPause_Disable; ETH_InitStruct->ETH_PauseLowThreshold = ETH_PauseLowThreshold_Minus4; ETH_InitStruct->ETH_UnicastPauseFrameDetect = ETH_UnicastPauseFrameDetect_Disable; ETH_InitStruct->ETH_ReceiveFlowControl = ETH_ReceiveFlowControl_Disable; ETH_InitStruct->ETH_TransmitFlowControl = ETH_TransmitFlowControl_Disable; ETH_InitStruct->ETH_VLANTagComparison = ETH_VLANTagComparison_16Bit; ETH_InitStruct->ETH_VLANTagIdentifier = 0x0; #ifdef _ETH_DMA /*------------------------ DMA -----------------------------------*/ ETH_InitStruct->ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Disable; ETH_InitStruct->ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable; ETH_InitStruct->ETH_FlushReceivedFrame = ETH_FlushReceivedFrame_Disable; ETH_InitStruct->ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable; ETH_InitStruct->ETH_TransmitThresholdControl = ETH_TransmitThresholdControl_64Bytes; ETH_InitStruct->ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable; ETH_InitStruct->ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable; ETH_InitStruct->ETH_ReceiveThresholdControl = ETH_ReceiveThresholdControl_64Bytes; ETH_InitStruct->ETH_SecondFrameOperate = ETH_SecondFrameOperate_Disable; ETH_InitStruct->ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable; ETH_InitStruct->ETH_FixedBurst = ETH_FixedBurst_Disable; ETH_InitStruct->ETH_RxDMABurstLength = ETH_RxDMABurstLength_1Beat; ETH_InitStruct->ETH_TxDMABurstLength = ETH_TxDMABurstLength_1Beat; ETH_InitStruct->ETH_DescriptorSkipLength = 0x0; ETH_InitStruct->ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_1_1; #endif /* _ETH_DMA */ } /******************************************************************************* * Function Name : ETH_Start * Desciption : Enables ENET MAC and DMA reception/transmission * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_Start(void) { /* Enable transmit state machine of the MAC for transmission on the MII */ ETH_MACTransmissionCmd(ENABLE); /* Flush Transmit FIFO */ ETH_FlushTransmitFIFO(); /* Enable receive state machine of the MAC for reception from the MII */ ETH_MACReceptionCmd(ENABLE); #ifdef _ETH_DMA /* Start DMA transmission */ ETH_DMATransmissionCmd(ENABLE); /* Start DMA reception */ ETH_DMAReceptionCmd(ENABLE); #endif /* _ETH_DMA */ } #ifdef _ETH_DMA /******************************************************************************* * Function Name : ETH_HandleTxPkt * Desciption : Transmits a packet, from application buffer, pointed by ppkt. * Input : - ppkt: pointer to application packet Buffer. * - FrameLength: Tx Packet size. * Output : None * Return : ETH_ERROR: in case of Tx desc owned by DMA * ETH_SUCCESS: for correct transmission *******************************************************************************/ u32 ETH_HandleTxPkt(u32 addr, u16 FrameLength) { // Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) if((DMATxDescToSet->Status & ETH_DMATxDesc_OWN) != (u32)RESET) { // Return ERROR: OWN bit set return ETH_ERROR; } //Set the DMA buffer address to send to the Packet we received from stack DMATxDescToSet->Buffer1Addr = (u32)addr; // Setting the Frame Length: bits[12:0] DMATxDescToSet->ControlBufferSize = (FrameLength & ETH_DMATxDesc_TBS1); // Setting the last segment and first segment bits (in this case a frame is transmitted in one descriptor) DMATxDescToSet->Status |= ETH_DMATxDesc_LS | ETH_DMATxDesc_FS; // Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA DMATxDescToSet->Status |= ETH_DMATxDesc_OWN; // When Tx Buffer unavailable flag is set: clear it and resume transmission if ((ETH_DMA->DMASR & ETH_DMASR_TBUS) != (u32)RESET) { // Clear TBUS ETHERNET DMA flag ETH_DMA->DMASR = ETH_DMASR_TBUS; // Resume DMA transmission ETH_DMA->DMATPDR = 0; } // Update the ETHERNET DMA global Tx descriptor with next Tx decriptor // Chained Mode if((DMATxDescToSet->Status & ETH_DMATxDesc_TCH) != (u32)RESET) { // Selects the next DMA Tx descriptor list for next buffer to send DMATxDescToSet = (ETH_DMADESCTypeDef*) (DMATxDescToSet->Buffer2NextDescAddr); } else // Ring Mode { if((DMATxDescToSet->Status & ETH_DMATxDesc_TER) != (u32)RESET) { // Selects the first DMA Tx descriptor for next buffer to send: last Tx descriptor was used DMATxDescToSet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMATDLAR); } else { // Selects the next DMA Tx descriptor list for next buffer to send DMATxDescToSet = (ETH_DMADESCTypeDef*) ((u32)DMATxDescToSet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); } } // Return SUCCESS return ETH_SUCCESS; } /******************************************************************************* * Function Name : ETH_HandleRxPkt * Desciption : Receives a packet and copies it to memory pointed by ppkt. * Input : None * Output : ppkt: pointer on application receive buffer. * Return : ETH_ERROR: if there is error in reception * Received packet size: if packet reception is correct *******************************************************************************/ u32 ETH_HandleRxPkt(u32 addr) { // Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) if((DMARxDescToGet->Status & ETH_DMARxDesc_OWN) != (u32)RESET) { // Return error: OWN bit set return ETH_ERROR; } //Set the buffer address to rcv frame for the same descriptor (reserved packet) DMARxDescToGet->Buffer1Addr = addr; if(addr) { // Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA DMARxDescToGet->Status = ETH_DMARxDesc_OWN; } // Update the ETHERNET DMA global Rx descriptor with next Rx decriptor // Chained Mode if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (u32)RESET) { // Selects the next DMA Rx descriptor list for next buffer to read DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMARxDescToGet->Buffer2NextDescAddr); } else // Ring Mode { if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (u32)RESET) { // Selects the first DMA Rx descriptor for next buffer to read: last Rx descriptor was used DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMARDLAR); } else { // Selects the next DMA Rx descriptor list for next buffer to read DMARxDescToGet = (ETH_DMADESCTypeDef*) ((u32)DMARxDescToGet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); } } return(1); } /******************************************************************************* * Function Name : ETH_GetRxPktSize * Desciption : Get the size of received the received packet. * Input : None * Output : None * Return : Rx packet size *******************************************************************************/ u32 ETH_GetRxPktSize(void) { u32 FrameLength = 0; //Test DMARxDescToGet is not NULL if(DMARxDescToGet) { /* Get the size of the packet: including 4 bytes of the CRC */ FrameLength = ETH_GetDMARxDescFrameLength(DMARxDescToGet); } /* Return Frame Length */ return FrameLength; } /******************************************************************************* * Function Name : ETH_DropRxPkt * Desciption : Drop a Received packet (too small packet, etc...) * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_DropRxPkt(void) { // Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA DMARxDescToGet->Status = ETH_DMARxDesc_OWN; // Chained Mode if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (u32)RESET) { // Selects the next DMA Rx descriptor list for next buffer read DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMARxDescToGet->Buffer2NextDescAddr); } else // Ring Mode { if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (u32)RESET) { // Selects the next DMA Rx descriptor list for next buffer read: this will // be the first Rx descriptor in this case DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMARDLAR); } else { // Selects the next DMA Rx descriptor list for next buffer read DMARxDescToGet = (ETH_DMADESCTypeDef*) ((u32)DMARxDescToGet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); } } } #endif /* _ETH_DMA */ /*--------------------------------- PHY ------------------------------------*/ /******************************************************************************* * Function Name : ETH_ReadPHYRegister * Desciption : Read a PHY register * Input : - PHYAddress: PHY device address, is the index of one of supported * 32 PHY devices. * This parameter can be one of the following values: 0,..,31 * - PHYReg: PHY register address, is the index of one of the 32 * PHY register. * This parameter can be one of the following values: * - PHY_BCR : Tranceiver Basic Control Register * - PHY_BSR : Tranceiver Basic Status Register * - PHY_SR : Tranceiver Status Register * - More PHY register could be read depending on the used PHY * Output : None * Return : ETH_ERROR: in case of timeout * Data read from the selected PHY register: for correct read *******************************************************************************/ u16 ETH_ReadPHYRegister(u16 PHYAddress, u16 PHYReg) { u32 tmpreg = 0; u32 timeout = 0; /* Check the parameters */ eth_assert_param(IS_ETH_PHY_ADDRESS(PHYAddress)); eth_assert_param(IS_ETH_PHY_REG(PHYReg)); /* Get the ETHERNET MACMIIAR value */ tmpreg = ETH_MAC->MACMIIAR; /* Keep only the CSR Clock Range CR[2:0] bits value */ tmpreg &= ~MACMIIAR_CR_Mask; /* Prepare the MII address register value */ tmpreg |=(((u32)PHYAddress<<11) & ETH_MACMIIAR_PA); /* Set the PHY device address */ tmpreg |=(((u32)PHYReg<<6) & ETH_MACMIIAR_MR); /* Set the PHY register address */ tmpreg &= ~ETH_MACMIIAR_MW; /* Set the read mode */ tmpreg |= ETH_MACMIIAR_MB; /* Set the MII Busy bit */ /* Write the result value into the MII Address register */ ETH_MAC->MACMIIAR = tmpreg; /* Check for the Busy flag */ do { timeout++; tmpreg = ETH_MAC->MACMIIAR; } while ((tmpreg & ETH_MACMIIAR_MB) && (timeout < (u32)PHY_READ_TO)); /* Return ERROR in case of timeout */ if(timeout == PHY_READ_TO) { return (u16)ETH_ERROR; } /* Return data register value */ return (u16)(ETH_MAC->MACMIIDR); } /******************************************************************************* * Function Name : ETH_WritePHYRegister * Desciption : Write to a PHY register * Input : - PHYAddress: PHY device address, is the index of one of supported * 32 PHY devices. * This parameter can be one of the following values: 0,..,31 * - PHYReg: PHY register address, is the index of one of the 32 * PHY register. * This parameter can be one of the following values: * - PHY_BCR : Tranceiver Control Register * - More PHY register could be written depending on the used PHY * - PHYValue: the value to write * Output : None * Return : ETH_ERROR: in case of timeout * ETH_SUCCESS: for correct read *******************************************************************************/ u32 ETH_WritePHYRegister(u16 PHYAddress, u16 PHYReg, u16 PHYValue) { u32 tmpreg = 0; u32 timeout = 0; /* Check the parameters */ eth_assert_param(IS_ETH_PHY_ADDRESS(PHYAddress)); eth_assert_param(IS_ETH_PHY_REG(PHYReg)); /* Get the ETHERNET MACMIIAR value */ tmpreg = ETH_MAC->MACMIIAR; /* Keep only the CSR Clock Range CR[2:0] bits value */ tmpreg &= ~MACMIIAR_CR_Mask; /* Prepare the MII register address value */ tmpreg |=(((u32)PHYAddress<<11) & ETH_MACMIIAR_PA); /* Set the PHY device address */ tmpreg |=(((u32)PHYReg<<6) & ETH_MACMIIAR_MR); /* Set the PHY register address */ tmpreg |= ETH_MACMIIAR_MW; /* Set the write mode */ tmpreg |= ETH_MACMIIAR_MB; /* Set the MII Busy bit */ /* Give the value to the MII data register */ ETH_MAC->MACMIIDR = PHYValue; /* Write the result value into the MII Address register */ ETH_MAC->MACMIIAR = tmpreg; /* Check for the Busy flag */ do { timeout++; tmpreg = ETH_MAC->MACMIIAR; } while ((tmpreg & ETH_MACMIIAR_MB) && (timeout < (u32)PHY_WRITE_TO)); /* Return ERROR in case of timeout */ if(timeout == PHY_WRITE_TO) { return ETH_ERROR; } /* Return SUCCESS */ return ETH_SUCCESS; } /******************************************************************************* * Function Name : ETH_PHYLoopBackCmd * Desciption : Enables or disables the PHY loopBack mode. * Input : - PHYAddress: PHY device address, is the index of one of supported * 32 PHY devices. * This parameter can be one of the following values: * - NewState: new state of the PHY loopBack mode. * This parameter can be: ENABLE or DISABLE. * Note: Don't be confused with ETH_MACLoopBackCmd function * which enables internal loopback at MII level * Output : None * Return : None *******************************************************************************/ u32 ETH_PHYLoopBackCmd(u16 PHYAddress, FunctionalState NewState) { u16 tmpreg = 0; /* Check the parameters */ eth_assert_param(IS_ETH_PHY_ADDRESS(PHYAddress)); eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); /* Get the PHY configuration to update it */ tmpreg = ETH_ReadPHYRegister(PHYAddress, PHY_BCR); if (NewState != DISABLE) { /* Enable the PHY loopback mode */ tmpreg |= PHY_Loopback; } else { /* Disable the PHY loopback mode: normal mode */ tmpreg &= (u16)(~(u16)PHY_Loopback); } /* Update the PHY control register with the new configuration */ if(ETH_WritePHYRegister(PHYAddress, PHY_BCR, tmpreg) != (u32)RESET) { return ETH_SUCCESS; } else { /* Return SUCCESS */ return ETH_ERROR; } } /*--------------------------------- MAC ------------------------------------*/ /******************************************************************************* * Function Name : ETH_MACTransmissionCmd * Desciption : Enables or disables the MAC transmission. * Input : - NewState: new state of the MAC transmission. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MACTransmissionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC transmission */ ETH_MAC->MACCR |= ETH_MACCR_TE; } else { /* Disable the MAC transmission */ ETH_MAC->MACCR &= ~ETH_MACCR_TE; } } /******************************************************************************* * Function Name : ETH_MACReceptionCmd * Desciption : Enables or disables the MAC reception. * Input : - NewState: new state of the MAC reception. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MACReceptionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC reception */ ETH_MAC->MACCR |= ETH_MACCR_RE; } else { /* Disable the MAC reception */ ETH_MAC->MACCR &= ~ETH_MACCR_RE; } } /******************************************************************************* * Function Name : ETH_GetFlowControlBusyStatus * Desciption : Checks whether the ETHERNET flow control busy bit is set or not. * Input : None * Output : None * Return : The new state of flow control busy status bit (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetFlowControlBusyStatus(void) { FlagStatus bitstatus = RESET; /* The Flow Control register should not be written to until this bit is cleared */ if ((ETH_MAC->MACFCR & ETH_MACFCR_FCBBPA) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_InitiatePauseControlFrame * Desciption : Initiate a Pause Control Frame (Full-duplex only). * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_InitiatePauseControlFrame(void) { /* When Set In full duplex MAC initiates pause control frame */ ETH_MAC->MACFCR |= ETH_MACFCR_FCBBPA; } /******************************************************************************* * Function Name : ETH_BackPressureActivationCmd * Desciption : Enables or disables the MAC BackPressure operation activation (Half-duplex only). * Input : - NewState: new state of the MAC BackPressure operation activation. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_BackPressureActivationCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Activate the MAC BackPressure operation */ /* In Half duplex: during backpressure, when the MAC receives a new frame, the transmitter starts sending a JAM pattern resulting in a collision */ ETH_MAC->MACFCR |= ETH_MACFCR_FCBBPA; } else { /* Desactivate the MAC BackPressure operation */ ETH_MAC->MACFCR &= ~ETH_MACFCR_FCBBPA; } } /******************************************************************************* * Function Name : ETH_GetMACFlagStatus * Desciption : Checks whether the specified ETHERNET MAC flag is set or not. * Input : - ETH_MAC_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - ETH_MAC_FLAG_TST : Time stamp trigger flag * - ETH_MAC_FLAG_MMCT : MMC transmit flag * - ETH_MAC_FLAG_MMCR : MMC receive flag * - ETH_MAC_FLAG_MMC : MMC flag * - ETH_MAC_FLAG_PMT : PMT flag * Output : None * Return : The new state of ETHERNET MAC flag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetMACFlagStatus(u32 ETH_MAC_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_MAC_GET_FLAG(ETH_MAC_FLAG)); if ((ETH_MAC->MACSR & ETH_MAC_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_GetMACITStatus * Desciption : Checks whether the specified ETHERNET MAC interrupt has occurred or not. * Input : - ETH_MAC_IT: specifies the interrupt source to check. * This parameter can be one of the following values: * - ETH_MAC_IT_TST : Time stamp trigger interrupt * - ETH_MAC_IT_MMCT : MMC transmit interrupt * - ETH_MAC_IT_MMCR : MMC receive interrupt * - ETH_MAC_IT_MMC : MMC interrupt * - ETH_MAC_IT_PMT : PMT interrupt * Output : None * Return : The new state of ETHERNET MAC interrupt (SET or RESET). *******************************************************************************/ ITStatus ETH_GetMACITStatus(u32 ETH_MAC_IT) { ITStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_MAC_GET_IT(ETH_MAC_IT)); if ((ETH_MAC->MACSR & ETH_MAC_IT) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_MACITConfig * Desciption : Enables or disables the specified ETHERNET MAC interrupts. * Input : - ETH_MAC_IT: specifies the ETHERNET MAC interrupt sources to be * enabled or disabled. * This parameter can be any combination of the following values: * - ETH_MAC_IT_TST : Time stamp trigger interrupt * - ETH_MAC_IT_PMT : PMT interrupt * - NewState: new state of the specified ETHERNET MAC interrupts. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MACITConfig(u32 ETH_MAC_IT, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_ETH_MAC_IT(ETH_MAC_IT)); eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected ETHERNET MAC interrupts */ ETH_MAC->MACIMR &= (~(u32)ETH_MAC_IT); } else { /* Disable the selected ETHERNET MAC interrupts */ ETH_MAC->MACIMR |= ETH_MAC_IT; } } /******************************************************************************* * Function Name : ETH_MACAddressConfig * Desciption : Configures the selected MAC address. * Input : - MacAddr: The MAC addres to configure. * This parameter can be one of the following values: * - ETH_MAC_Address0 : MAC Address0 * - ETH_MAC_Address1 : MAC Address1 * - ETH_MAC_Address2 : MAC Address2 * - ETH_MAC_Address3 : MAC Address3 * - Addr: Pointer on MAC address buffer data (6 bytes). * Output : None * Return : None *******************************************************************************/ void ETH_MACAddressConfig(u32 MacAddr, u8 *Addr) { u32 tmpreg; /* Check the parameters */ eth_assert_param(IS_ETH_MAC_ADDRESS0123(MacAddr)); /* Calculate the selectecd MAC address high register */ tmpreg = ((u32)Addr[5] << 8) | (u32)Addr[4]; /* Load the selectecd MAC address high register */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) = tmpreg; /* Calculate the selectecd MAC address low register */ tmpreg = ((u32)Addr[3] << 24) | ((u32)Addr[2] << 16) | ((u32)Addr[1] << 8) | Addr[0]; /* Load the selectecd MAC address low register */ (*(vu32 *) (ETH_MAC_AddrLowBase + MacAddr)) = tmpreg; } /******************************************************************************* * Function Name : ETH_GetMACAddress * Desciption : Get the selected MAC address. * Input : - MacAddr: The MAC addres to return. * This parameter can be one of the following values: * - ETH_MAC_Address0 : MAC Address0 * - ETH_MAC_Address1 : MAC Address1 * - ETH_MAC_Address2 : MAC Address2 * - ETH_MAC_Address3 : MAC Address3 * - Addr: Pointer on MAC address buffer data (6 bytes). * Output : None * Return : None *******************************************************************************/ void ETH_GetMACAddress(u32 MacAddr, u8 *Addr) { u32 tmpreg; /* Check the parameters */ eth_assert_param(IS_ETH_MAC_ADDRESS0123(MacAddr)); /* Get the selectecd MAC address high register */ tmpreg =(*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)); /* Calculate the selectecd MAC address buffer */ Addr[5] = ((tmpreg >> 8) & (u8)0xFF); Addr[4] = (tmpreg & (u8)0xFF); /* Load the selectecd MAC address low register */ tmpreg =(*(vu32 *) (ETH_MAC_AddrLowBase + MacAddr)); /* Calculate the selectecd MAC address buffer */ Addr[3] = ((tmpreg >> 24) & (u8)0xFF); Addr[2] = ((tmpreg >> 16) & (u8)0xFF); Addr[1] = ((tmpreg >> 8 ) & (u8)0xFF); Addr[0] = (tmpreg & (u8)0xFF); } /******************************************************************************* * Function Name : ETH_MACAddressPerfectFilterCmd * Desciption : Enables or disables the Address filter module uses the specified * ETHERNET MAC address for perfect filtering * Input : - MacAddr: specifies the ETHERNET MAC address to be used for prfect filtering. * This parameter can be one of the following values: * - ETH_MAC_Address1 : MAC Address1 * - ETH_MAC_Address2 : MAC Address2 * - ETH_MAC_Address3 : MAC Address3 * - NewState: new state of the specified ETHERNET MAC address use. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MACAddressPerfectFilterCmd(u32 MacAddr, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_ETH_MAC_ADDRESS123(MacAddr)); eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected ETHERNET MAC address for perfect filtering */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) |= ETH_MACA1HR_AE; } else { /* Disable the selected ETHERNET MAC address for perfect filtering */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) &=(~(u32)ETH_MACA1HR_AE); } } /******************************************************************************* * Function Name : ETH_MACAddressFilterConfig * Desciption : Set the filter type for the specified ETHERNET MAC address * Input : - MacAddr: specifies the ETHERNET MAC address * This parameter can be one of the following values: * - ETH_MAC_Address1 : MAC Address1 * - ETH_MAC_Address2 : MAC Address2 * - ETH_MAC_Address3 : MAC Address3 * - Filter: specifies the used frame received field for comparaison * This parameter can be one of the following values: * - ETH_MAC_AddressFilter_SA : MAC Address is used to compare * with the SA fields of the received frame. * - ETH_MAC_AddressFilter_DA : MAC Address is used to compare * with the DA fields of the received frame. * Output : None * Return : None *******************************************************************************/ void ETH_MACAddressFilterConfig(u32 MacAddr, u32 Filter) { /* Check the parameters */ eth_assert_param(IS_ETH_MAC_ADDRESS123(MacAddr)); eth_assert_param(IS_ETH_MAC_ADDRESS_FILTER(Filter)); if (Filter != ETH_MAC_AddressFilter_DA) { /* The selected ETHERNET MAC address is used to compare with the SA fields of the received frame. */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) |= ETH_MACA1HR_SA; } else { /* The selected ETHERNET MAC address is used to compare with the DA fields of the received frame. */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) &=(~(u32)ETH_MACA1HR_SA); } } /******************************************************************************* * Function Name : ETH_MACAddressMaskBytesFilterConfig * Desciption : Set the filter type for the specified ETHERNET MAC address * Input : - MacAddr: specifies the ETHERNET MAC address * This parameter can be one of the following values: * - ETH_MAC_Address1 : MAC Address1 * - ETH_MAC_Address2 : MAC Address2 * - ETH_MAC_Address3 : MAC Address3 * - MaskByte: specifies the used address bytes for comparaison * This parameter can be any combination of the following values: * - ETH_MAC_AddressMask_Byte6 : Mask MAC Address high reg bits [15:8]. * - ETH_MAC_AddressMask_Byte5 : Mask MAC Address high reg bits [7:0]. * - ETH_MAC_AddressMask_Byte4 : Mask MAC Address low reg bits [31:24]. * - ETH_MAC_AddressMask_Byte3 : Mask MAC Address low reg bits [23:16]. * - ETH_MAC_AddressMask_Byte2 : Mask MAC Address low reg bits [15:8]. * - ETH_MAC_AddressMask_Byte1 : Mask MAC Address low reg bits [7:0]. * Output : None * Return : None *******************************************************************************/ void ETH_MACAddressMaskBytesFilterConfig(u32 MacAddr, u32 MaskByte) { /* Check the parameters */ eth_assert_param(IS_ETH_MAC_ADDRESS123(MacAddr)); eth_assert_param(IS_ETH_MAC_ADDRESS_MASK(MaskByte)); /* Clear MBC bits in the selected MAC address high register */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) &=(~(u32)ETH_MACA1HR_MBC); /* Set the selected Filetr mask bytes */ (*(vu32 *) (ETH_MAC_AddrHighBase + MacAddr)) |= MaskByte; } /*------------------------ DMA Tx/Rx Desciptors ----------------------------*/ #ifdef _ETH_DMA /******************************************************************************* * Function Name : ETH_DMATxDescChainInit * Desciption : Initializes the DMA Tx descriptors in chain mode. * Input : - DMATxDescTab: Pointer on the first Tx desc list * - TxBuff: Pointer on the first TxBuffer list * - TxBuffCount: Number of the used Tx desc in the list * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, u8* TxBuff, u32 TxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMATxDesc; /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */ DMATxDescToSet = DMATxDescTab; /* Fill each DMATxDesc descriptor with the right values */ for(i=0; i < TxBuffCount; i++) { /* Get the pointer on the ith member of the Tx Desc list */ DMATxDesc = DMATxDescTab + i; /* Set Second Address Chained bit */ DMATxDesc->Status = ETH_DMATxDesc_TCH; /* Set Buffer1 address pointer */ DMATxDesc->Buffer1Addr = (u32)*((u32*)TxBuff + i); /* Initialize the next descriptor with the Next Desciptor Polling Enable */ if(i < (TxBuffCount-1)) { /* Set next descriptor address register with next descriptor base address */ DMATxDesc->Buffer2NextDescAddr = (u32)(DMATxDescTab+i+1); } else { /* For last descriptor, set next descriptor address register equal to the first descriptor base address */ DMATxDesc->Buffer2NextDescAddr = (u32) DMATxDescTab; } } /* Set Transmit Desciptor List Address Register */ ETH_DMA->DMATDLAR = (u32) DMATxDescTab; } /******************************************************************************* * Function Name : ETH_DMATxDescRingInit * Desciption : Initializes the DMA Tx descriptors in ring mode. * Input : - DMATxDescTab: Pointer on the first Tx desc list * - TxBuff1: Pointer on the first TxBuffer1 list * - TxBuff2: Pointer on the first TxBuffer2 list * - TxBuffCount: Number of the used Tx desc in the list * Note: see decriptor skip length defined in ETH_DMA_InitStruct for the number of Words to skip between two unchained descriptors. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescRingInit(ETH_DMADESCTypeDef *DMATxDescTab, u8 *TxBuff1, u8 *TxBuff2, u32 TxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMATxDesc; /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */ DMATxDescToSet = DMATxDescTab; /* Fill each DMATxDesc descriptor with the right values */ for(i=0; i < TxBuffCount; i++) { /* Get the pointer on the ith member of the Tx Desc list */ DMATxDesc = DMATxDescTab + i; /* Set Buffer1 address pointer */ DMATxDesc->Buffer1Addr = (u32)(&TxBuff1[i*ETH_MAX_PACKET_SIZE]); /* Set Buffer2 address pointer */ DMATxDesc->Buffer2NextDescAddr = (u32)(&TxBuff2[i*ETH_MAX_PACKET_SIZE]); /* Set Transmit End of Ring bit for last descriptor: The DMA returns to the base address of the list, creating a Desciptor Ring */ if(i == (TxBuffCount-1)) { /* Set Transmit End of Ring bit */ DMATxDesc->Status = ETH_DMATxDesc_TER; } } /* Set Transmit Desciptor List Address Register */ ETH_DMA->DMATDLAR = (u32) DMATxDescTab; } /******************************************************************************* * Function Name : ETH_GetDMATxDescFlagStatus * Desciption : Checks whether the specified ETHERNET DMA Tx Desc flag is set or not. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - ETH_DMATxDescFlag: specifies the flag to check. * This parameter can be one of the following values: * - ETH_DMATxDesc_OWN : OWN bit: descriptor is owned by DMA engine * - ETH_DMATxDesc_IC : Interrupt on completetion * - ETH_DMATxDesc_LS : Last Segment * - ETH_DMATxDesc_FS : First Segment * - ETH_DMATxDesc_DC : Disable CRC * - ETH_DMATxDesc_DP : Disable Pad * - ETH_DMATxDesc_TTSE: Transmit Time Stamp Enable * - ETH_DMATxDesc_TER : Transmit End of Ring * - ETH_DMATxDesc_TCH : Second Address Chained * - ETH_DMATxDesc_TTSS: Tx Time Stamp Status * - ETH_DMATxDesc_IHE : IP Header Error * - ETH_DMATxDesc_ES : Error summary * - ETH_DMATxDesc_JT : Jabber Timeout * - ETH_DMATxDesc_FF : Frame Flushed: DMA/MTL flushed the frame due to SW flush * - ETH_DMATxDesc_PCE : Payload Checksum Error * - ETH_DMATxDesc_LCA : Loss of Carrier: carrier lost during tramsmission * - ETH_DMATxDesc_NC : No Carrier: no carrier signal from the tranceiver * - ETH_DMATxDesc_LCO : Late Collision: transmission aborted due to collision * - ETH_DMATxDesc_EC : Excessive Collision: transmission aborted after 16 collisions * - ETH_DMATxDesc_VF : VLAN Frame * - ETH_DMATxDesc_CC : Collision Count * - ETH_DMATxDesc_ED : Excessive Deferral * - ETH_DMATxDesc_UF : Underflow Error: late data arrival from the memory * - ETH_DMATxDesc_DB : Deferred Bit * Output : None * Return : The new state of ETH_DMATxDescFlag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetDMATxDescFlagStatus(ETH_DMADESCTypeDef *DMATxDesc, u32 ETH_DMATxDescFlag) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_DMATxDESC_GET_FLAG(ETH_DMATxDescFlag)); if ((DMATxDesc->Status & ETH_DMATxDescFlag) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_GetDMATxDescCollisionCount * Desciption : Returns the specified ETHERNET DMA Tx Desc collision count. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * Output : None * Return : The Transmit descriptor collision counter value. *******************************************************************************/ u32 ETH_GetDMATxDescCollisionCount(ETH_DMADESCTypeDef *DMATxDesc) { /* Return the Receive descriptor frame length */ return ((DMATxDesc->Status & ETH_DMATxDesc_CC) >> ETH_DMATxDesc_CollisionCountShift); } /******************************************************************************* * Function Name : ETH_SetDMATxDescOwnBit * Desciption : Set the specified DMA Tx Desc Own bit. * Input : - DMATxDesc: Pointer on a Tx desc * Output : None * Return : None *******************************************************************************/ void ETH_SetDMATxDescOwnBit(ETH_DMADESCTypeDef *DMATxDesc) { /* Set the DMA Tx Desc Own bit */ DMATxDesc->Status |= ETH_DMATxDesc_OWN; } /******************************************************************************* * Function Name : ETH_DMATxDescTransmitITConfig * Desciption : Enables or disables the specified DMA Tx Desc Transmit interrupt. * Input : - DMATxDesc: Pointer on a Tx desc * - NewState: new state of the DMA Tx Desc transmit interrupt. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescTransmitITConfig(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the DMA Tx Desc Transmit interrupt */ DMATxDesc->Status |= ETH_DMATxDesc_IC; } else { /* Disable the DMA Tx Desc Transmit interrupt */ DMATxDesc->Status &=(~(u32)ETH_DMATxDesc_IC); } } /******************************************************************************* * Function Name : ETH_DMATxDescFrameSegmentConfig * Desciption : Enables or disables the specified DMA Tx Desc Transmit interrupt. * Input : - DMATxDesc: Pointer on a Tx desc * - FrameSegment: specifies is the actual Tx desc contain last or first segment. * This parameter can be one of the following values: * - ETH_DMATxDesc_LastSegment : actual Tx desc contain last segment * - ETH_DMATxDesc_FirstSegment : actual Tx desc contain first segment * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescFrameSegmentConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 DMATxDesc_FrameSegment) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_TXDESC_SEGMENT(DMATxDesc_FrameSegment)); /* Selects the DMA Tx Desc Frame segment */ DMATxDesc->Status |= DMATxDesc_FrameSegment; } /******************************************************************************* * Function Name : ETH_DMATxDescChecksumInsertionConfig * Desciption : Selects the specified ETHERNET DMA Tx Desc Checksum Insertion. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - Checksum: specifies is the DMA Tx desc checksum insertion. * This parameter can be one of the following values: * - ETH_DMATxDesc_ChecksumByPass : Checksum bypass * - ETH_DMATxDesc_ChecksumIPV4Header : IPv4 header checksum * - ETH_DMATxDesc_ChecksumTCPUDPICMPSegment : TCP/UDP/ICMP checksum. Pseudo header checksum is assumed to be present * - ETH_DMATxDesc_ChecksumTCPUDPICMPFull : TCP/UDP/ICMP checksum fully in hardware including pseudo header * Output : None * Return : The Transmit descriptor collision. *******************************************************************************/ void ETH_DMATxDescChecksumInsertionConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 DMATxDesc_Checksum) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_TXDESC_CHECKSUM(DMATxDesc_Checksum)); /* Set the selected DMA Tx desc checksum insertion control */ DMATxDesc->Status |= DMATxDesc_Checksum; } /******************************************************************************* * Function Name : ETH_DMATxDescCRCCmd * Desciption : Enables or disables the DMA Tx Desc CRC. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - NewState: new state of the specified DMA Tx Desc CRC. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescCRCCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Tx Desc CRC */ DMATxDesc->Status &= (~(u32)ETH_DMATxDesc_DC); } else { /* Disable the selected DMA Tx Desc CRC */ DMATxDesc->Status |= ETH_DMATxDesc_DC; } } /******************************************************************************* * Function Name : ETH_DMATxDescEndOfRingCmd * Desciption : Enables or disables the DMA Tx Desc end of ring. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - NewState: new state of the specified DMA Tx Desc end of ring. * This parameter can be: ENABLE or DISABLE. * Output : NoneH * Return : None *******************************************************************************/ void ETH_DMATxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Tx Desc end of ring */ DMATxDesc->Status |= ETH_DMATxDesc_TER; } else { /* Disable the selected DMA Tx Desc end of ring */ DMATxDesc->Status &= (~(u32)ETH_DMATxDesc_TER); } } /******************************************************************************* * Function Name : ETH_DMATxDescSecondAddressChainedCmd * Desciption : Enables or disables the DMA Tx Desc second address chained. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - NewState: new state of the specified DMA Tx Desc second address chained. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Tx Desc second address chained */ DMATxDesc->Status |= ETH_DMATxDesc_TCH; } else { /* Disable the selected DMA Tx Desc second address chained */ DMATxDesc->Status &=(~(u32)ETH_DMATxDesc_TCH); } } /******************************************************************************* * Function Name : ETH_DMATxDescShortFramePaddingCmd * Desciption : Enables or disables the DMA Tx Desc padding for frame shorter than 64 bytes. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - NewState: new state of the specified DMA Tx Desc padding for * frame shorter than 64 bytes. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescShortFramePaddingCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Tx Desc padding for frame shorter than 64 bytes */ DMATxDesc->Status &= (~(u32)ETH_DMATxDesc_DP); } else { /* Disable the selected DMA Tx Desc padding for frame shorter than 64 bytes*/ DMATxDesc->Status |= ETH_DMATxDesc_DP; } } /******************************************************************************* * Function Name : ETH_DMATxDescTimeStampCmd * Desciption : Enables or disables the DMA Tx Desc time stamp. * Input : - DMATxDesc: pointer on a DMA Tx descriptor * - NewState: new state of the specified DMA Tx Desc time stamp. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescTimeStampCmd(ETH_DMADESCTypeDef *DMATxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Tx Desc time stamp */ DMATxDesc->Status |= ETH_DMATxDesc_TTSE; } else { /* Disable the selected DMA Tx Desc time stamp */ DMATxDesc->Status &=(~(u32)ETH_DMATxDesc_TTSE); } } /******************************************************************************* * Function Name : ETH_DMATxDescBufferSizeConfig * Desciption : Configures the specified DMA Tx Desc buffer1 and buffer2 sizes. * Input : - DMATxDesc: Pointer on a Tx desc * - BufferSize1: specifies the Tx desc buffer1 size. * - BufferSize2: specifies the Tx desc buffer2 size (put "0" if not used). * Output : None * Return : None *******************************************************************************/ void ETH_DMATxDescBufferSizeConfig(ETH_DMADESCTypeDef *DMATxDesc, u32 BufferSize1, u32 BufferSize2) { /* Check the parameters */ eth_assert_param(IS_ETH_DMATxDESC_BUFFER_SIZE(BufferSize1)); eth_assert_param(IS_ETH_DMATxDESC_BUFFER_SIZE(BufferSize2)); /* Set the DMA Tx Desc buffer1 and buffer2 sizes values */ DMATxDesc->ControlBufferSize |= (BufferSize1 | (BufferSize2 << ETH_DMATxDesc_BufferSize2Shift)); } /******************************************************************************* * Function Name : ETH_DMARxDescChainInit * Desciption : Initializes the DMA Rx descriptors in chain mode. * Input : - DMARxDescTab: Pointer on the first Rx desc list * - RxBuff: Pointer on the first RxBuffer list * - RxBuffCount: Number of the used Rx desc in the list * Output : None * Return : None *******************************************************************************/ void ETH_DMARxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff, u32 RxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMARxDesc; /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */ DMARxDescToGet = DMARxDescTab; /* Fill each DMARxDesc descriptor with the right values */ for(i=0; i < RxBuffCount; i++) { /* Get the pointer on the ith member of the Rx Desc list */ DMARxDesc = DMARxDescTab+i; /* Set Own bit of the Rx descriptor Status */ DMARxDesc->Status = ETH_DMARxDesc_OWN; // DMARxDesc->Status = 0; /* Set Buffer1 size and Second Address Chained bit */ DMARxDesc->ControlBufferSize = ETH_DMARxDesc_RCH | (u32)ETH_MAX_PACKET_SIZE; /* Set Buffer1 address pointer */ DMARxDesc->Buffer1Addr = (u32)*((u32*)RxBuff + i); /* Initialize the next descriptor with the Next Desciptor Polling Enable */ if(i < (RxBuffCount-1)) { /* Set next descriptor address register with next descriptor base address */ DMARxDesc->Buffer2NextDescAddr = (u32)(DMARxDescTab+i+1); } else { /* For last descriptor, set next descriptor address register equal to the first descriptor base address */ DMARxDesc->Buffer2NextDescAddr = (u32)(DMARxDescTab); } } /* Set Receive Desciptor List Address Register */ ETH_DMA->DMARDLAR = (u32) DMARxDescTab; } /******************************************************************************* * Function Name : ETH_DMARxDescRingInit * Desciption : Initializes the DMA Rx descriptors in ring mode. * Input : - DMARxDescTab: Pointer on the first Rx desc list * - RxBuff1: Pointer on the first RxBuffer1 list * - RxBuff2: Pointer on the first RxBuffer2 list * - RxBuffCount: Number of the used Rx desc in the list * Note: see decriptor skip length defined in ETH_DMA_InitStruct for the number of Words to skip between two unchained descriptors. * Output : None * Return : None *******************************************************************************/ void ETH_DMARxDescRingInit(ETH_DMADESCTypeDef *DMARxDescTab, u8 *RxBuff1, u8 *RxBuff2, u32 RxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMARxDesc; /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */ DMARxDescToGet = DMARxDescTab; /* Fill each DMARxDesc descriptor with the right values */ for(i=0; i < RxBuffCount; i++) { /* Get the pointer on the ith member of the Rx Desc list */ DMARxDesc = DMARxDescTab+i; /* Set Own bit of the Rx descriptor Status */ DMARxDesc->Status = ETH_DMARxDesc_OWN; /* Set Buffer1 size */ DMARxDesc->ControlBufferSize = ETH_MAX_PACKET_SIZE; /* Set Buffer1 address pointer */ DMARxDesc->Buffer1Addr = (u32)(&RxBuff1[i*ETH_MAX_PACKET_SIZE]); /* Set Buffer2 address pointer */ DMARxDesc->Buffer2NextDescAddr = (u32)(&RxBuff2[i*ETH_MAX_PACKET_SIZE]); /* Set Receive End of Ring bit for last descriptor: The DMA returns to the base address of the list, creating a Desciptor Ring */ if(i == (RxBuffCount-1)) { /* Set Receive End of Ring bit */ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RER; } } /* Set Receive Desciptor List Address Register */ ETH_DMA->DMARDLAR = (u32) DMARxDescTab; } /******************************************************************************* * Function Name : ETH_GetDMARxDescFlagStatus * Desciption : Checks whether the specified ETHERNET Rx Desc flag is set or not. * Input : - DMARxDesc: pointer on a DMA Rx descriptor * - ETH_DMARxDescFlag: specifies the flag to check. * This parameter can be one of the following values: * - ETH_DMARxDesc_OWN: OWN bit: descriptor is owned by DMA engine * - ETH_DMARxDesc_AFM: DA Filter Fail for the rx frame * - ETH_DMARxDesc_ES: Error summary * - ETH_DMARxDesc_DE: Desciptor error: no more descriptors for receive frame * - ETH_DMARxDesc_SAF: SA Filter Fail for the received frame * - ETH_DMARxDesc_LE: Frame size not matching with length field * - ETH_DMARxDesc_OE: Overflow Error: Frame was damaged due to buffer overflow * - ETH_DMARxDesc_VLAN: VLAN Tag: received frame is a VLAN frame * - ETH_DMARxDesc_FS: First descriptor of the frame * - ETH_DMARxDesc_LS: Last descriptor of the frame * - ETH_DMARxDesc_IPV4HCE: IPC Checksum Error/Giant Frame: Rx Ipv4 header checksum error * - ETH_DMARxDesc_RxLongFrame: (Giant Frame)Rx - frame is longer than 1518/1522 * - ETH_DMARxDesc_LC: Late collision occurred during reception * - ETH_DMARxDesc_FT: Frame type - Ethernet, otherwise 802.3 * - ETH_DMARxDesc_RWT: Receive Watchdog Timeout: watchdog timer expired during reception * - ETH_DMARxDesc_RE: Receive error: error reported by MII interface * - ETH_DMARxDesc_DE: Dribble bit error: frame contains non int multiple of 8 bits * - ETH_DMARxDesc_CE: CRC error * - ETH_DMARxDesc_MAMPCE: Rx MAC Address/Payload Checksum Error: Rx MAC address matched/ Rx Payload Checksum Error * Output : None * Return : The new state of ETH_DMARxDescFlag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetDMARxDescFlagStatus(ETH_DMADESCTypeDef *DMARxDesc, u32 ETH_DMARxDescFlag) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_DMARxDESC_GET_FLAG(ETH_DMARxDescFlag)); if ((DMARxDesc->Status & ETH_DMARxDescFlag) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_SetDMARxDescOwnBit * Desciption : Set the specified DMA Rx Desc Own bit. * Input : - DMARxDesc: Pointer on a Rx desc * Output : None * Return : None *******************************************************************************/ void ETH_SetDMARxDescOwnBit(ETH_DMADESCTypeDef *DMARxDesc) { /* Set the DMA Rx Desc Own bit */ DMARxDesc->Status |= ETH_DMARxDesc_OWN; } /******************************************************************************* * Function Name : ETH_GetDMARxDescFrameLength * Desciption : Returns the specified DMA Rx Desc frame length. * Input : - DMARxDesc: pointer on a DMA Rx descriptor * Output : None * Return : The Rx descriptor received frame length. *******************************************************************************/ u32 ETH_GetDMARxDescFrameLength(ETH_DMADESCTypeDef *DMARxDesc) { /* Return the Receive descriptor frame length */ return ((DMARxDesc->Status & ETH_DMARxDesc_FL) >> ETH_DMARxDesc_FrameLengthShift); } /******************************************************************************* * Function Name : ETH_DMARxDescReceiveITConfig * Desciption : Enables or disables the specified DMA Rx Desc receive interrupt. * Input : - DMARxDesc: Pointer on a Rx desc * - NewState: new state of the specified DMA Rx Desc interrupt. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMARxDescReceiveITConfig(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the DMA Rx Desc receive interrupt */ DMARxDesc->ControlBufferSize &=(~(u32)ETH_DMARxDesc_DIC); } else { /* Disable the DMA Rx Desc receive interrupt */ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_DIC; } } /******************************************************************************* * Function Name : ETH_DMARxDescEndOfRingCmd * Desciption : Enables or disables the DMA Rx Desc end of ring. * Input : - DMARxDesc: pointer on a DMA Rx descriptor * - NewState: new state of the specified DMA Rx Desc end of ring. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMARxDescEndOfRingCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Rx Desc end of ring */ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RER; } else { /* Disable the selected DMA Rx Desc end of ring */ DMARxDesc->ControlBufferSize &=(~(u32)ETH_DMARxDesc_RER); } } /******************************************************************************* * Function Name : ETH_DMARxDescSecondAddressChainedCmd * Desciption : Enables or disables the DMA Rx Desc second address chained. * Input : - DMARxDesc: pointer on a DMA Rx descriptor * - NewState: new state of the specified DMA Rx Desc second address chained. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMARxDescSecondAddressChainedCmd(ETH_DMADESCTypeDef *DMARxDesc, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected DMA Rx Desc second address chained */ DMARxDesc->ControlBufferSize |= ETH_DMARxDesc_RCH; } else { /* Disable the selected DMA Rx Desc second address chained */ DMARxDesc->ControlBufferSize &=(~(u32)ETH_DMARxDesc_RCH); } } /******************************************************************************* * Function Name : ETH_GetDMARxDescBufferSize * Desciption : Returns the specified ETHERNET DMA Rx Desc buffer size. * Input : - DMARxDesc: pointer on a DMA Rx descriptor * - DMARxDesc_Buffer: specifies the DMA Rx Desc buffer. * This parameter can be any one of the following values: * - ETH_DMARxDesc_Buffer1 : DMA Rx Desc Buffer1 * - ETH_DMARxDesc_Buffer2 : DMA Rx Desc Buffer2 * Output : None * Return : The Receive descriptor frame length. *******************************************************************************/ u32 ETH_GetDMARxDescBufferSize(ETH_DMADESCTypeDef *DMARxDesc, u32 DMARxDesc_Buffer) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_RXDESC_BUFFER(DMARxDesc_Buffer)); if(DMARxDesc_Buffer != ETH_DMARxDesc_Buffer1) { /* Return the DMA Rx Desc buffer2 size */ return ((DMARxDesc->ControlBufferSize & ETH_DMARxDesc_RBS2) >> ETH_DMARxDesc_Buffer2SizeShift); } else { /* Return the DMA Rx Desc buffer1 size */ return (DMARxDesc->ControlBufferSize & ETH_DMARxDesc_RBS1); } } /*--------------------------------- DMA ------------------------------------*/ /******************************************************************************* * Function Name : ETH_SoftwareReset * Desciption : Resets all MAC subsystem internal registers and logic. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_SoftwareReset(void) { /* Set the SWR bit: resets all MAC subsystem internal registers and logic */ /* After reset all the registers holds their respective reset values */ ETH_DMA->DMABMR |= ETH_DMABMR_SR; } /******************************************************************************* * Function Name : ETH_GetSoftwareResetStatus * Desciption : Checks whether the ETHERNET software reset bit is set or not. * Input : None * Output : None * Return : The new state of DMA Bus Mode register SR bit (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetSoftwareResetStatus(void) { FlagStatus bitstatus = RESET; if((ETH_DMA->DMABMR & ETH_DMABMR_SR) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_GetDMAFlagStatus * Desciption : Checks whether the specified ETHERNET DMA flag is set or not. * Input : - ETH_DMA_IT: specifies the flag to check. * This parameter can be one of the following values: * - ETH_DMA_FLAG_TST : Time-stamp trigger flag * - ETH_DMA_FLAG_PMT : PMT flag * - ETH_DMA_FLAG_MMC : MMC flag * - ETH_DMA_FLAG_DataTransferError : Error bits 0-data buffer, 1-desc. access * - ETH_DMA_FLAG_ReadWriteError : Error bits 0-write trnsf, 1-read transfr * - ETH_DMA_FLAG_AccessError : Error bits 0-Rx DMA, 1-Tx DMA * - ETH_DMA_FLAG_NIS : Normal interrupt summary flag * - ETH_DMA_FLAG_AIS : Abnormal interrupt summary flag * - ETH_DMA_FLAG_ER : Early receive flag * - ETH_DMA_FLAG_FBE : Fatal bus error flag * - ETH_DMA_FLAG_ET : Early transmit flag * - ETH_DMA_FLAG_RWT : Receive watchdog timeout flag * - ETH_DMA_FLAG_RPS : Receive process stopped flag * - ETH_DMA_FLAG_RBU : Receive buffer unavailable flag * - ETH_DMA_FLAG_R : Receive flag * - ETH_DMA_FLAG_TU : Underflow flag * - ETH_DMA_FLAG_RO : Overflow flag * - ETH_DMA_FLAG_TJT : Transmit jabber timeout flag * - ETH_DMA_FLAG_TBU : Transmit buffer unavailable flag * - ETH_DMA_FLAG_TPS : Transmit process stopped flag * - ETH_DMA_FLAG_T : Transmit flag * Output : None * Return : The new state of ETH_DMA_FLAG (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetDMAFlagStatus(u32 ETH_DMA_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_DMA_GET_IT(ETH_DMA_FLAG)); if ((ETH_DMA->DMASR & ETH_DMA_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_DMAClearFlag * Desciption : Clears the ETHERNET?s DMA pending flag. * Input : - ETH_DMA_FLAG: specifies the flag to clear. * This parameter can be any combination of the following values: * - ETH_DMA_FLAG_NIS : Normal interrupt summary flag * - ETH_DMA_FLAG_AIS : Abnormal interrupt summary flag * - ETH_DMA_FLAG_ER : Early receive flag * - ETH_DMA_FLAG_FBE : Fatal bus error flag * - ETH_DMA_FLAG_ETI : Early transmit flag * - ETH_DMA_FLAG_RWT : Receive watchdog timeout flag * - ETH_DMA_FLAG_RPS : Receive process stopped flag * - ETH_DMA_FLAG_RBU : Receive buffer unavailable flag * - ETH_DMA_FLAG_R : Receive flag * - ETH_DMA_FLAG_TU : Transmit Underflow flag * - ETH_DMA_FLAG_RO : Receive Overflow flag * - ETH_DMA_FLAG_TJT : Transmit jabber timeout flag * - ETH_DMA_FLAG_TBU : Transmit buffer unavailable flag * - ETH_DMA_FLAG_TPS : Transmit process stopped flag * - ETH_DMA_FLAG_T : Transmit flag * Output : None * Return : None *******************************************************************************/ void ETH_DMAClearFlag(u32 ETH_DMA_FLAG) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_FLAG(ETH_DMA_FLAG)); /* Clear the selected ETHERNET DMA FLAG */ ETH_DMA->DMASR = (u32) ETH_DMA_FLAG; } /******************************************************************************* * Function Name : ETH_GetDMAITStatus * Desciption : Checks whether the specified ETHERNET DMA interrupt has occured or not. * Input : - ETH_DMA_IT: specifies the interrupt source to check. * This parameter can be one of the following values: * - ETH_DMA_IT_TST : Time-stamp trigger interrupt * - ETH_DMA_IT_PMT : PMT interrupt * - ETH_DMA_IT_MMC : MMC interrupt * - ETH_DMA_IT_NIS : Normal interrupt summary * - ETH_DMA_IT_AIS : Abnormal interrupt summary * - ETH_DMA_IT_ER : Early receive interrupt * - ETH_DMA_IT_FBE : Fatal bus error interrupt * - ETH_DMA_IT_ET : Early transmit interrupt * - ETH_DMA_IT_RWT : Receive watchdog timeout interrupt * - ETH_DMA_IT_RPS : Receive process stopped interrupt * - ETH_DMA_IT_RBU : Receive buffer unavailable interrupt * - ETH_DMA_IT_R : Receive interrupt * - ETH_DMA_IT_TU : Underflow interrupt * - ETH_DMA_IT_RO : Overflow interrupt * - ETH_DMA_IT_TJT : Transmit jabber timeout interrupt * - ETH_DMA_IT_TBU : Transmit buffer unavailable interrupt * - ETH_DMA_IT_TPS : Transmit process stopped interrupt * - ETH_DMA_IT_T : Transmit interrupt * Output : None * Return : The new state of ETH_DMA_IT (SET or RESET). *******************************************************************************/ ITStatus ETH_GetDMAITStatus(u32 ETH_DMA_IT) { ITStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_DMA_GET_IT(ETH_DMA_IT)); if ((ETH_DMA->DMASR & ETH_DMA_IT) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_DMAClearITPendingBit * Desciption : Clears the ETHERNET?s DMA IT pending bit. * Input : - ETH_DMA_IT: specifies the interrupt pending bit to clear. * This parameter can be any combination of the following values: * - ETH_DMA_IT_NIS : Normal interrupt summary * - ETH_DMA_IT_AIS : Abnormal interrupt summary * - ETH_DMA_IT_ER : Early receive interrupt * - ETH_DMA_IT_FBE : Fatal bus error interrupt * - ETH_DMA_IT_ETI : Early transmit interrupt * - ETH_DMA_IT_RWT : Receive watchdog timeout interrupt * - ETH_DMA_IT_RPS : Receive process stopped interrupt * - ETH_DMA_IT_RBU : Receive buffer unavailable interrupt * - ETH_DMA_IT_R : Receive interrupt * - ETH_DMA_IT_TU : Transmit Underflow interrupt * - ETH_DMA_IT_RO : Receive Overflow interrupt * - ETH_DMA_IT_TJT : Transmit jabber timeout interrupt * - ETH_DMA_IT_TBU : Transmit buffer unavailable interrupt * - ETH_DMA_IT_TPS : Transmit process stopped interrupt * - ETH_DMA_IT_T : Transmit interrupt * Output : None * Return : None *******************************************************************************/ void ETH_DMAClearITPendingBit(u32 ETH_DMA_IT) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_IT(ETH_DMA_IT)); /* Clear the selected ETHERNET DMA IT */ ETH_DMA->DMASR = (u32) ETH_DMA_IT; } /******************************************************************************* * Function Name : ETH_GetDMATransmitProcessState * Desciption : Returns the ETHERNET DMA Transmit Process State. * Input : None * Output : None * Return : The new ETHERNET DMA Transmit Process State: * This can be one of the following values: * - ETH_DMA_TransmitProcess_Stopped : Stopped - Reset or Stop Tx Command issued * - ETH_DMA_TransmitProcess_Fetching : Running - fetching the Tx descriptor * - ETH_DMA_TransmitProcess_Waiting : Running - waiting for status * - ETH_DMA_TransmitProcess_Reading : unning - reading the data from host memory * - ETH_DMA_TransmitProcess_Suspended : Suspended - Tx Desciptor unavailabe * - ETH_DMA_TransmitProcess_Closing : Running - closing Rx descriptor *******************************************************************************/ u32 ETH_GetTransmitProcessState(void) { return ((u32)(ETH_DMA->DMASR & ETH_DMASR_TS)); } /******************************************************************************* * Function Name : ETH_GetDMAReceiveProcessState * Desciption : Returns the ETHERNET DMA Receive Process State. * Input : None * Output : None * Return : The new ETHERNET DMA Receive Process State: * This can be one of the following values: * - ETH_DMA_ReceiveProcess_Stopped : Stopped - Reset or Stop Rx Command issued * - ETH_DMA_ReceiveProcess_Fetching : Running - fetching the Rx descriptor * - ETH_DMA_ReceiveProcess_Waiting : Running - waiting for packet * - ETH_DMA_ReceiveProcess_Suspended : Suspended - Rx Desciptor unavailable * - ETH_DMA_ReceiveProcess_Closing : Running - closing descriptor * - ETH_DMA_ReceiveProcess_Queuing : Running - queuing the recieve frame into host memory *******************************************************************************/ u32 ETH_GetReceiveProcessState(void) { return ((u32)(ETH_DMA->DMASR & ETH_DMASR_RS)); } /******************************************************************************* * Function Name : ETH_FlushTransmitFIFO * Desciption : Clears the ETHERNET transmit FIFO. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_FlushTransmitFIFO(void) { /* Set the Flush Transmit FIFO bit */ ETH_DMA->DMAOMR |= ETH_DMAOMR_FTF; } /******************************************************************************* * Function Name : ETH_GetFlushTransmitFIFOStatus * Desciption : Checks whether the ETHERNET transmit FIFO bit is cleared or not. * Input : None * Output : None * Return : The new state of ETHERNET flush transmit FIFO bit (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetFlushTransmitFIFOStatus(void) { FlagStatus bitstatus = RESET; if ((ETH_DMA->DMAOMR & ETH_DMAOMR_FTF) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_DMATransmissionCmd * Desciption : Enables or disables the DMA transmission. * Input : - NewState: new state of the DMA transmission. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMATransmissionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the DMA transmission */ ETH_DMA->DMAOMR |= ETH_DMAOMR_ST; } else { /* Disable the DMA transmission */ ETH_DMA->DMAOMR &= ~ETH_DMAOMR_ST; } } /******************************************************************************* * Function Name : ETH_DMAReceptionCmd * Desciption : Enables or disables the DMA reception. * Input : - NewState: new state of the DMA reception. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMAReceptionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the DMA reception */ ETH_DMA->DMAOMR |= ETH_DMAOMR_SR; } else { /* Disable the DMA reception */ ETH_DMA->DMAOMR &= ~ETH_DMAOMR_SR; } } /******************************************************************************* * Function Name : ETH_DMAITConfig * Desciption : Enables or disables the specified ETHERNET DMA interrupts. * Input : - ETH_DMA_IT: specifies the ETHERNET DMA interrupt sources to be * enabled or disabled. * This parameter can be any combination of the following values: * - ETH_DMA_IT_NIS : Normal interrupt summary * - ETH_DMA_IT_AIS : Abnormal interrupt summary * - ETH_DMA_IT_ER : Early receive interrupt * - ETH_DMA_IT_FBE : Fatal bus error interrupt * - ETH_DMA_IT_ET : Early transmit interrupt * - ETH_DMA_IT_RWT : Receive watchdog timeout interrupt * - ETH_DMA_IT_RPS : Receive process stopped interrupt * - ETH_DMA_IT_RBU : Receive buffer unavailable interrupt * - ETH_DMA_IT_R : Receive interrupt * - ETH_DMA_IT_TU : Underflow interrupt * - ETH_DMA_IT_RO : Overflow interrupt * - ETH_DMA_IT_TJT : Transmit jabber timeout interrupt * - ETH_DMA_IT_TBU : Transmit buffer unavailable interrupt * - ETH_DMA_IT_TPS : Transmit process stopped interrupt * - ETH_DMA_IT_T : Transmit interrupt * - NewState: new state of the specified ETHERNET DMA interrupts. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_DMAITConfig(u32 ETH_DMA_IT, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_ETH_DMA_IT(ETH_DMA_IT)); eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the selected ETHERNET DMA interrupts */ ETH_DMA->DMAIER |= ETH_DMA_IT; } else { /* Disable the selected ETHERNET DMA interrupts */ ETH_DMA->DMAIER &=(~(u32)ETH_DMA_IT); } } /******************************************************************************* * Function Name : ETH_GetDMAOverflowStatus * Desciption : Checks whether the specified ETHERNET DMA overflow flag is set or not. * Input : - ETH_DMA_Overflow: specifies the DMA overflow flag to check. * This parameter can be one of the following values: * - ETH_DMA_Overflow_RxFIFOCounter : Overflow for FIFO Overflow Counter * - ETH_DMA_Overflow_MissedFrameCounter : Overflow for Missed Frame Counter * Output : None * Return : The new state of ETHERNET DMA overflow Flag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetDMAOverflowStatus(u32 ETH_DMA_Overflow) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_DMA_GET_OVERFLOW(ETH_DMA_Overflow)); if ((ETH_DMA->DMAMFBOCR & ETH_DMA_Overflow) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_GetRxOverflowMissedFrameCounter * Desciption : Get the ETHERNET DMA Rx Overflow Missed Frame Counter value. * Input : None * Output : None * Return : The value of Rx overflow Missed Frame Counter. *******************************************************************************/ u32 ETH_GetRxOverflowMissedFrameCounter(void) { return ((u32)((ETH_DMA->DMAMFBOCR & ETH_DMAMFBOCR_MFA)>>ETH_DMA_RxOverflowMissedFramesCounterShift)); } /******************************************************************************* * Function Name : ETH_GetBufferUnavailableMissedFrameCounter * Desciption : Get the ETHERNET DMA Buffer Unavailable Missed Frame Counter value. * Input : None * Output : None * Return : The value of Buffer unavailable Missed Frame Counter. *******************************************************************************/ u32 ETH_GetBufferUnavailableMissedFrameCounter(void) { return ((u32)(ETH_DMA->DMAMFBOCR) & ETH_DMAMFBOCR_MFC); } /******************************************************************************* * Function Name : ETH_GetCurrentTxDescStartAddress * Desciption : Get the ETHERNET DMA DMACHTDR register value. * Input : None * Output : None * Return : The value of the current Tx desc start address. *******************************************************************************/ u32 ETH_GetCurrentTxDescStartAddress(void) { return ((u32)(ETH_DMA->DMACHTDR)); } /******************************************************************************* * Function Name : ETH_GetCurrentRxDescStartAddress * Desciption : Get the ETHERNET DMA DMACHRDR register value. * Input : None * Output : None * Return : The value of the current Rx desc start address. *******************************************************************************/ u32 ETH_GetCurrentRxDescStartAddress(void) { return ((u32)(ETH_DMA->DMACHRDR)); } /******************************************************************************* * Function Name : ETH_GetCurrentTxBufferAddress * Desciption : Get the ETHERNET DMA DMACHTBAR register value. * Input : None * Output : None * Return : The value of the current Tx desc buffer address. *******************************************************************************/ u32 ETH_GetCurrentTxBufferAddress(void) { return ((u32)(ETH_DMA->DMACHTBAR)); } /******************************************************************************* * Function Name : ETH_GetCurrentRxBufferAddress * Desciption : Get the ETHERNET DMA DMACHRBAR register value. * Input : None * Output : None * Return : The value of the current Rx desc buffer address. *******************************************************************************/ u32 ETH_GetCurrentRxBufferAddress(void) { return ((u32)(ETH_DMA->DMACHRBAR)); } /******************************************************************************* * Function Name : ETH_ResumeDMATransmission * Desciption : Resumes the DMA Transmission by writing to the DmaTxPollDemand * register: (the data written could be anything). This forces * the DMA to resume transmission. * Input : None * Output : None * Return : None. *******************************************************************************/ void ETH_ResumeDMATransmission(void) { ETH_DMA->DMATPDR = 0; } /******************************************************************************* * Function Name : ETH_ResumeDMAReception * Desciption : Resumes the DMA Transmission by writing to the DmaRxPollDemand * register: (the data written could be anything). This forces * the DMA to resume reception. * Input : None * Output : None * Return : None. *******************************************************************************/ void ETH_ResumeDMAReception(void) { ETH_DMA->DMARPDR = 0; } #endif /* _ETH_DMA */ /*--------------------------------- PMT ------------------------------------*/ /******************************************************************************* * Function Name : ETH_ResetWakeUpFrameFilterRegisterPointer * Desciption : Reset Wakeup frame filter register pointer. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_ResetWakeUpFrameFilterRegisterPointer(void) { /* Resets the Remote Wake-up Frame Filter register pointer to 0x0000 */ ETH_MAC->MACPMTCSR |= ETH_MACPMTCSR_WFFRPR; } /******************************************************************************* * Function Name : ETH_SetWakeUpFrameFilterRegister * Desciption : Populates the remote wakeup frame registers. * Input : - Buffer: Pointer on remote WakeUp Frame Filter Register buffer * data (8 words). * Output : None * Return : None *******************************************************************************/ void ETH_SetWakeUpFrameFilterRegister(u32 *Buffer) { u32 i = 0; /* Fill Remote Wake-up Frame Filter register with Buffer data */ for(i =0; i<ETH_WakeupRegisterLength; i++) { /* Write each time to the same register */ ETH_MAC->MACRWUFFR = Buffer[i]; } } /******************************************************************************* * Function Name : ETH_GlobalUnicastWakeUpCmd * Desciption : Enables or disables any unicast packet filtered by the MAC * (DAF) address recognition to be a wake-up frame. * Input : - NewState: new state of the MAC Global Unicast Wake-Up. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_GlobalUnicastWakeUpCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC Global Unicast Wake-Up */ ETH_MAC->MACPMTCSR |= ETH_MACPMTCSR_GU; } else { /* Disable the MAC Global Unicast Wake-Up */ ETH_MAC->MACPMTCSR &= ~ETH_MACPMTCSR_GU; } } /******************************************************************************* * Function Name : ETH_GetPMTFlagStatus * Desciption : Checks whether the specified ETHERNET PMT flag is set or not. * Input : - ETH_PMT_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - ETH_PMT_FLAG_WUFFRPR : Wake-Up Frame Filter Register Poniter Reset * - ETH_PMT_FLAG_WUFR : Wake-Up Frame Received * - ETH_PMT_FLAG_MPR : Magic Packet Received * Output : None * Return : The new state of ETHERNET PMT Flag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetPMTFlagStatus(u32 ETH_PMT_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_PMT_GET_FLAG(ETH_PMT_FLAG)); if ((ETH_MAC->MACPMTCSR & ETH_PMT_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_WakeUpFrameDetectionCmd * Desciption : Enables or disables the MAC Wake-Up Frame Detection. * Input : - NewState: new state of the MAC Wake-Up Frame Detection. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_WakeUpFrameDetectionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC Wake-Up Frame Detection */ ETH_MAC->MACPMTCSR |= ETH_MACPMTCSR_WFE; } else { /* Disable the MAC Wake-Up Frame Detection */ ETH_MAC->MACPMTCSR &= ~ETH_MACPMTCSR_WFE; } } /******************************************************************************* * Function Name : ETH_MagicPacketDetectionCmd * Desciption : Enables or disables the MAC Magic Packet Detection. * Input : - NewState: new state of the MAC Magic Packet Detection. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MagicPacketDetectionCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC Magic Packet Detection */ ETH_MAC->MACPMTCSR |= ETH_MACPMTCSR_MPE; } else { /* Disable the MAC Magic Packet Detection */ ETH_MAC->MACPMTCSR &= ~ETH_MACPMTCSR_MPE; } } /******************************************************************************* * Function Name : ETH_PowerDownCmd * Desciption : Enables or disables the MAC Power Down. * Input : - NewState: new state of the MAC Power Down. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_PowerDownCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MAC Power Down */ /* This puts the MAC in power down mode */ ETH_MAC->MACPMTCSR |= ETH_MACPMTCSR_PD; } else { /* Disable the MAC Power Down */ ETH_MAC->MACPMTCSR &= ~ETH_MACPMTCSR_PD; } } /*--------------------------------- MMC ------------------------------------*/ #ifdef _ETH_MMC /******************************************************************************* * Function Name : ETH_MMCCounterFreezeCmd * Desciption : Enables or disables the MMC Counter Freeze. * Input : - NewState: new state of the MMC Counter Freeze. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MMCCounterFreezeCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MMC Counter Freeze */ ETH_MMC->MMCCR |= ETH_MMCCR_MCF; } else { /* Disable the MMC Counter Freeze */ ETH_MMC->MMCCR &= ~ETH_MMCCR_MCF; } } /******************************************************************************* * Function Name : ETH_MMCResetOnReadCmd * Desciption : Enables or disables the MMC Reset On Read. * Input : - NewState: new state of the MMC Reset On Read. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MMCResetOnReadCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the MMC Counter reset on read */ ETH_MMC->MMCCR |= ETH_MMCCR_ROR; } else { /* Disable the MMC Counter reset on read */ ETH_MMC->MMCCR &= ~ETH_MMCCR_ROR; } } /******************************************************************************* * Function Name : ETH_MMCCounterRolloverCmd * Desciption : Enables or disables the MMC Counter Stop Rollover. * Input : - NewState: new state of the MMC Counter Stop Rollover. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MMCCounterRolloverCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Disable the MMC Counter Stop Rollover */ ETH_MMC->MMCCR &= ~ETH_MMCCR_CSR; } else { /* Enable the MMC Counter Stop Rollover */ ETH_MMC->MMCCR |= ETH_MMCCR_CSR; } } /******************************************************************************* * Function Name : ETH_MMCCountersReset * Desciption : Resets the MMC Counters. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_MMCCountersReset(void) { /* Resets the MMC Counters */ ETH_MMC->MMCCR |= ETH_MMCCR_CR; } /******************************************************************************* * Function Name : ETH_MMCITConfig * Desciption : Enables or disables the specified ETHERNET MMC interrupts. * Input : - ETH_MMC_IT: specifies the ETHERNET MMC interrupt * sources to be enabled or disabled. * This parameter can be any combination of Tx interrupt or * any combination of Rx interrupt (but not both)of the following values: * - ETH_MMC_IT_TGF : When Tx good frame counter reaches half the maximum value * - ETH_MMC_IT_TGFMSC: When Tx good multi col counter reaches half the maximum value * - ETH_MMC_IT_TGFSC : When Tx good single col counter reaches half the maximum value * - ETH_MMC_IT_RGUF : When Rx good unicast frames counter reaches half the maximum value * - ETH_MMC_IT_RFAE : When Rx alignment error counter reaches half the maximum value * - ETH_MMC_IT_RFCE : When Rx crc error counter reaches half the maximum value * - NewState: new state of the specified ETHERNET MMC interrupts. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_MMCITConfig(u32 ETH_MMC_IT, FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_ETH_MMC_IT(ETH_MMC_IT)); eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if ((ETH_MMC_IT & (u32)0x10000000) != (u32)RESET) { /* Remove egister mak from IT */ ETH_MMC_IT &= 0xEFFFFFFF; /* ETHERNET MMC Rx interrupts selected */ if (NewState != DISABLE) { /* Enable the selected ETHERNET MMC interrupts */ ETH_MMC->MMCRIMR &=(~(u32)ETH_MMC_IT); } else { /* Disable the selected ETHERNET MMC interrupts */ ETH_MMC->MMCRIMR |= ETH_MMC_IT; } } else { /* ETHERNET MMC Tx interrupts selected */ if (NewState != DISABLE) { /* Enable the selected ETHERNET MMC interrupts */ ETH_MMC->MMCTIMR &=(~(u32)ETH_MMC_IT); } else { /* Disable the selected ETHERNET MMC interrupts */ ETH_MMC->MMCTIMR |= ETH_MMC_IT; } } } /******************************************************************************* * Function Name : ETH_GetMMCITStatus * Desciption : Checks whether the specified ETHERNET MMC IT is set or not. * Input : - ETH_MMC_IT: specifies the ETHERNET MMC interrupt. * This parameter can be one of the following values: * - ETH_MMC_IT_TxFCGC: When Tx good frame counter reaches half the maximum value * - ETH_MMC_IT_TxMCGC: When Tx good multi col counter reaches half the maximum value * - ETH_MMC_IT_TxSCGC: When Tx good single col counter reaches half the maximum value * - ETH_MMC_IT_RxUGFC: When Rx good unicast frames counter reaches half the maximum value * - ETH_MMC_IT_RxAEC : When Rx alignment error counter reaches half the maximum value * - ETH_MMC_IT_RxCEC : When Rx crc error counter reaches half the maximum value * Output : None * Return : The value of ETHERNET MMC IT (SET or RESET). *******************************************************************************/ ITStatus ETH_GetMMCITStatus(u32 ETH_MMC_IT) { ITStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_MMC_GET_IT(ETH_MMC_IT)); if ((ETH_MMC_IT & (u32)0x10000000) != (u32)RESET) { /* ETHERNET MMC Rx interrupts selected */ /* Check if the ETHERNET MMC Rx selected interrupt is enabled and occured */ if ((((ETH_MMC->MMCRIR & ETH_MMC_IT) != (u32)RESET)) && ((ETH_MMC->MMCRIMR & ETH_MMC_IT) != (u32)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } } else { /* ETHERNET MMC Tx interrupts selected */ /* Check if the ETHERNET MMC Tx selected interrupt is enabled and occured */ if ((((ETH_MMC->MMCTIR & ETH_MMC_IT) != (u32)RESET)) && ((ETH_MMC->MMCRIMR & ETH_MMC_IT) != (u32)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } } return bitstatus; } /******************************************************************************* * Function Name : ETH_GetMMCRegister * Desciption : Get the specified ETHERNET MMC register value. * Input : - ETH_MMCReg: specifies the ETHERNET MMC register. * This parameter can be one of the following values: * - ETH_MMCCR : MMC CR register * - ETH_MMCRIR : MMC RIR register * - ETH_MMCTIR : MMC TIR register * - ETH_MMCRIMR : MMC RIMR register * - ETH_MMCTIMR : MMC TIMR register * - ETH_MMCTGFSCCR : MMC TGFSCCR register * - ETH_MMCTGFMSCCR: MMC TGFMSCCR register * - ETH_MMCTGFCR : MMC TGFCR register * - ETH_MMCRFCECR : MMC RFCECR register * - ETH_MMCRFAECR : MMC RFAECR register * - ETH_MMCRGUFCR : MMC RGUFCRregister * Output : None * Return : The value of ETHERNET MMC Register value. *******************************************************************************/ u32 ETH_GetMMCRegister(u32 ETH_MMCReg) { /* Check the parameters */ eth_assert_param(IS_ETH_MMC_REGISTER(ETH_MMCReg)); /* Return the selected register value */ return (*(vu32 *)(ETH_MAC_BASE + ETH_MMCReg)); } #endif /* _ETH_MMC */ /*--------------------------------- PTP ------------------------------------*/ #ifdef _ETH_PTP /******************************************************************************* * Function Name : ETH_EnablePTPTimeStampAddend * Desciption : Updated the PTP block for fine correction with the Time Stamp * Addend register value. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_EnablePTPTimeStampAddend(void) { /* Enable the PTP block update with the Time Stamp Addend register value */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSARU; } /******************************************************************************* * Function Name : ETH_EnablePTPTimeStampInterruptTrigger * Desciption : Enable the PTP Time Stamp interrupt trigger * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_EnablePTPTimeStampInterruptTrigger(void) { /* Enable the PTP target time interrupt */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSITE; } /******************************************************************************* * Function Name : ETH_EnablePTPTimeStampUpdate * Desciption : Updated the PTP system time with the Time Stamp Update register * value. * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_EnablePTPTimeStampUpdate(void) { /* Enable the PTP system time update with the Time Stamp Update register value */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSSTU; } /******************************************************************************* * Function Name : ETH_InitializePTPTimeStamp * Desciption : Initialize the PTP Time Stamp * Input : None * Output : None * Return : None *******************************************************************************/ void ETH_InitializePTPTimeStamp(void) { /* Initialize the PTP Time Stamp */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSSTI; } /******************************************************************************* * Function Name : ETH_PTPUpdateMethodConfig * Desciption : Selects the PTP Update method * Input : - UpdateMethod: the PTP Update method * This parameter can be one of the following values: * - ETH_PTP_FineUpdate : Fine Update method * - ETH_PTP_CoarseUpdate : Coarse Update method * Output : None * Return : None *******************************************************************************/ void ETH_PTPUpdateMethodConfig(u32 UpdateMethod) { /* Check the parameters */ eth_assert_param(IS_ETH_PTP_UPDATE(UpdateMethod)); if (UpdateMethod != ETH_PTP_CoarseUpdate) { /* Enable the PTP Fine Update method */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSFCU; } else { /* Disable the PTP Coarse Update method */ ETH_PTP->PTPTSCR &= (~(u32)ETH_PTPTSCR_TSFCU); } } /******************************************************************************* * Function Name : ETH_PTPTimeStampCmd * Desciption : Enables or disables the PTP time stamp for transmit and receive frames. * Input : - NewState: new state of the PTP time stamp for transmit and receive frames * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void ETH_PTPTimeStampCmd(FunctionalState NewState) { /* Check the parameters */ eth_assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the PTP time stamp for transmit and receive frames */ ETH_PTP->PTPTSCR |= ETH_PTPTSCR_TSE; } else { /* Disable the PTP time stamp for transmit and receive frames */ ETH_PTP->PTPTSCR &= (~(u32)ETH_PTPTSCR_TSE); } } /******************************************************************************* * Function Name : ETH_GetPTPFlagStatus * Desciption : Checks whether the specified ETHERNET PTP flag is set or not. * Input : - ETH_PTP_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - ETH_PTP_FLAG_TSARU : Addend Register Update * - ETH_PTP_FLAG_TSITE : Time Stamp Interrupt Trigger Enable * - ETH_PTP_FLAG_TSSTU : Time Stamp Update * - ETH_PTP_FLAG_TSSTI : Time Stamp Initialize * Output : None * Return : The new state of ETHERNET PTP Flag (SET or RESET). *******************************************************************************/ FlagStatus ETH_GetPTPFlagStatus(u32 ETH_PTP_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ eth_assert_param(IS_ETH_PTP_GET_FLAG(ETH_PTP_FLAG)); if ((ETH_PTP->PTPTSCR & ETH_PTP_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************************************************************************* * Function Name : ETH_SetPTPSubSecondIncrement * Desciption : Sets the system time Sub-Second Increment value. * Input : - SubSecondValue: specifies the PTP Sub-Second Increment Register value. * Output : None * Return : None *******************************************************************************/ void ETH_SetPTPSubSecondIncrement(u32 SubSecondValue) { /* Check the parameters */ eth_assert_param(IS_ETH_PTP_SUBSECOND_INCREMENT(SubSecondValue)); /* Set the PTP Sub-Second Increment Register */ ETH_PTP->PTPSSIR = SubSecondValue; } /******************************************************************************* * Function Name : ETH_SetPTPTimeStampUpdate * Desciption : Sets the Time Stamp update sign and values. * Input : - Sign: specifies the PTP Time update value sign. * This parameter can be one of the following values: * - ETH_PTP_PositiveTime : positive time value. * - ETH_PTP_NegativeTime : negative time value. * - SecondValue: specifies the PTP Time update second value. * - SubSecondValue: specifies the PTP Time update sub-second value. * this is a 31 bit value. bit32 correspond to the sign. * Output : None * Return : None *******************************************************************************/ void ETH_SetPTPTimeStampUpdate(u32 Sign, u32 SecondValue, u32 SubSecondValue) { /* Check the parameters */ eth_assert_param(IS_ETH_PTP_TIME_SIGN(Sign)); eth_assert_param(IS_ETH_PTP_TIME_STAMP_UPDATE_SUBSECOND(SubSecondValue)); /* Set the PTP Time Update High Register */ ETH_PTP->PTPTSHUR = SecondValue; /* Set the PTP Time Update Low Register with sign */ ETH_PTP->PTPTSLUR = Sign | SubSecondValue; } /******************************************************************************* * Function Name : ETH_SetPTPTimeStampAddend * Desciption : Sets the Time Stamp Addend value. * Input : - Value: specifies the PTP Time Stamp Addend Register value. * Output : None * Return : None *******************************************************************************/ void ETH_SetPTPTimeStampAddend(u32 Value) { /* Set the PTP Time Stamp Addend Register */ ETH_PTP->PTPTSAR = Value; } /******************************************************************************* * Function Name : ETH_SetPTPTargetTime * Desciption : Sets the Target Time registers values. * Input : - HighValue: specifies the PTP Target Time High Register value. * - LowValue: specifies the PTP Target Time Low Register value. * Output : None * Return : None *******************************************************************************/ void ETH_SetPTPTargetTime(u32 HighValue, u32 LowValue) { /* Set the PTP Target Time High Register */ ETH_PTP->PTPTTHR = HighValue; /* Set the PTP Target Time Low Register */ ETH_PTP->PTPTTLR = LowValue; } /******************************************************************************* * Function Name : ETH_GetPTPRegister * Desciption : Get the specified ETHERNET PTP register value. * Input : - ETH_PTPReg: specifies the ETHERNET PTP register. * This parameter can be one of the following values: * - ETH_PTPTSCR : Sub-Second Increment Register * - ETH_PTPSSIR : Sub-Second Increment Register * - ETH_PTPTSHR : Time Stamp High Register * - ETH_PTPTSLR : Time Stamp Low Register * - ETH_PTPTSHUR : Time Stamp High Update Register * - ETH_PTPTSLUR : Time Stamp Low Update Register * - ETH_PTPTSAR : Time Stamp Addend Register * - ETH_PTPTTHR : Target Time High Register * - ETH_PTPTTLR : Target Time Low Register * Output : None * Return : The value of ETHERNET PTP Register value. *******************************************************************************/ u32 ETH_GetPTPRegister(u32 ETH_PTPReg) { /* Check the parameters */ eth_assert_param(IS_ETH_PTP_REGISTER(ETH_PTPReg)); /* Return the selected register value */ return (*(vu32 *)(ETH_MAC_BASE + ETH_PTPReg)); } /******************************************************************************* * Function Name : ETH_DMAPTPTxDescChainInit * Desciption : Initializes the DMA Tx descriptors in chain mode with PTP. * Input : - DMATxDescTab: Pointer on the first Tx desc list * - DMAPTPTxDescTab: Pointer on the first PTP Tx desc list * - TxBuff: Pointer on the first TxBuffer list * - TxBuffCount: Number of the used Tx desc in the list * Output : None * Return : None *******************************************************************************/ void ETH_DMAPTPTxDescChainInit(ETH_DMADESCTypeDef *DMATxDescTab, ETH_DMADESCTypeDef *DMAPTPTxDescTab, u8* TxBuff, u32 TxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMATxDesc; /* Set the DMATxDescToSet pointer with the first one of the DMATxDescTab list */ DMATxDescToSet = DMATxDescTab; DMAPTPTxDescToSet = DMAPTPTxDescTab; /* Fill each DMATxDesc descriptor with the right values */ for(i=0; i < TxBuffCount; i++) { /* Get the pointer on the ith member of the Tx Desc list */ DMATxDesc = DMATxDescTab+i; /* Set Second Address Chained bit and enable PTP */ DMATxDesc->Status = ETH_DMATxDesc_TCH | ETH_DMATxDesc_TTSE; /* Set Buffer1 address pointer */ DMATxDesc->Buffer1Addr =(u32)(&TxBuff[i*ETH_MAX_PACKET_SIZE]); /* Initialize the next descriptor with the Next Desciptor Polling Enable */ if(i < (TxBuffCount-1)) { /* Set next descriptor address register with next descriptor base address */ DMATxDesc->Buffer2NextDescAddr = (u32)(DMATxDescTab+i+1); } else { /* For last descriptor, set next descriptor address register equal to the first descriptor base address */ DMATxDesc->Buffer2NextDescAddr = (u32) DMATxDescTab; } /* make DMAPTPTxDescTab points to the same addresses as DMATxDescTab */ (&DMAPTPTxDescTab[i])->Buffer1Addr = DMATxDesc->Buffer1Addr; (&DMAPTPTxDescTab[i])->Buffer2NextDescAddr = DMATxDesc->Buffer2NextDescAddr; } /* Store on the last DMAPTPTxDescTab desc status record the first list address */ (&DMAPTPTxDescTab[i-1])->Status = (u32) DMAPTPTxDescTab; /* Set Transmit Desciptor List Address Register */ ETH_DMA->DMATDLAR = (u32) DMATxDescTab; } /******************************************************************************* * Function Name : ETH_DMAPTPRxDescChainInit * Desciption : Initializes the DMA Rx descriptors in chain mode. * Input : - DMARxDescTab: Pointer on the first Rx desc list * - DMAPTPRxDescTab: Pointer on the first PTP Rx desc list * - RxBuff: Pointer on the first RxBuffer list * - RxBuffCount: Number of the used Rx desc in the list * Output : None * Return : None *******************************************************************************/ void ETH_DMAPTPRxDescChainInit(ETH_DMADESCTypeDef *DMARxDescTab, ETH_DMADESCTypeDef *DMAPTPRxDescTab, u8 *RxBuff, u32 RxBuffCount) { u32 i = 0; ETH_DMADESCTypeDef *DMARxDesc; /* Set the DMARxDescToGet pointer with the first one of the DMARxDescTab list */ DMARxDescToGet = DMARxDescTab; DMAPTPRxDescToGet = DMAPTPRxDescTab; /* Fill each DMARxDesc descriptor with the right values */ for(i=0; i < RxBuffCount; i++) { /* Get the pointer on the ith member of the Rx Desc list */ DMARxDesc = DMARxDescTab+i; /* Set Own bit of the Rx descriptor Status */ DMARxDesc->Status = ETH_DMARxDesc_OWN; /* Set Buffer1 size and Second Address Chained bit */ DMARxDesc->ControlBufferSize = ETH_DMARxDesc_RCH | (u32)ETH_MAX_PACKET_SIZE; /* Set Buffer1 address pointer */ DMARxDesc->Buffer1Addr = (u32)(&RxBuff[i*ETH_MAX_PACKET_SIZE]); /* Initialize the next descriptor with the Next Desciptor Polling Enable */ if(i < (RxBuffCount-1)) { /* Set next descriptor address register with next descriptor base address */ DMARxDesc->Buffer2NextDescAddr = (u32)(DMARxDescTab+i+1); } else { /* For last descriptor, set next descriptor address register equal to the first descriptor base address */ DMARxDesc->Buffer2NextDescAddr = (u32)(DMARxDescTab); } /* Make DMAPTPRxDescTab points to the same addresses as DMARxDescTab */ (&DMAPTPRxDescTab[i])->Buffer1Addr = DMARxDesc->Buffer1Addr; (&DMAPTPRxDescTab[i])->Buffer2NextDescAddr = DMARxDesc->Buffer2NextDescAddr; } /* Store on the last DMAPTPRxDescTab desc status record the first list address */ (&DMAPTPRxDescTab[i-1])->Status = (u32) DMAPTPRxDescTab; /* Set Receive Desciptor List Address Register */ ETH_DMA->DMARDLAR = (u32) DMARxDescTab; } /******************************************************************************* * Function Name : ETH_HandlePTPTxPkt * Desciption : Transmits a packet, from application buffer, pointed by ppkt with * Time Stamp values. * Input : - ppkt: pointer to application packet Buffer. * - FrameLength: Tx Packet size. * - PTPTxTab: Pointer on the first PTP Tx table to store Time stamp values. * Output : None * Return : ETH_ERROR: in case of Tx desc owned by DMA * ETH_SUCCESS: for correct transmission *******************************************************************************/ u32 ETH_HandlePTPTxPkt(u8 *ppkt, u16 FrameLength, u32 *PTPTxTab) { u32 offset = 0, timeout = 0; /* Check if the descriptor is owned by the ETHERNET DMA (when set) or CPU (when reset) */ if((DMATxDescToSet->Status & ETH_DMATxDesc_OWN) != (u32)RESET) { /* Return ERROR: OWN bit set */ return ETH_ERROR; } /* Copy the frame to be sent into memory pointed by the current ETHERNET DMA Tx descriptor */ for(offset=0; offset<FrameLength; offset++) { (*(vu8 *)((DMAPTPTxDescToSet->Buffer1Addr) + offset)) = (*(ppkt + offset)); } /* Setting the Frame Length: bits[12:0] */ DMATxDescToSet->ControlBufferSize = (FrameLength & (u32)0x1FFF); /* Setting the last segment and first segment bits (in this case a frame is transmitted in one descriptor) */ DMATxDescToSet->Status |= ETH_DMATxDesc_LS | ETH_DMATxDesc_FS; /* Set Own bit of the Tx descriptor Status: gives the buffer back to ETHERNET DMA */ DMATxDescToSet->Status |= ETH_DMATxDesc_OWN; /* When Tx Buffer unavailable flag is set: clear it and resume transmission */ if ((ETH_DMA->DMASR & ETH_DMASR_TBUS) != (u32)RESET) { /* Clear TBUS ETHERNET DMA flag */ ETH_DMA->DMASR = ETH_DMASR_TBUS; /* Resume DMA transmission*/ ETH_DMA->DMATPDR = 0; } /* Wait for ETH_DMATxDesc_TTSS flag to be set */ do { timeout++; } while (!(DMATxDescToSet->Status & ETH_DMATxDesc_TTSS) && (timeout < 0xFFFF)); /* Return ERROR in case of timeout */ if(timeout == PHY_READ_TO) { return ETH_ERROR; } *PTPTxTab++ = DMATxDescToSet->Buffer1Addr; *PTPTxTab = DMATxDescToSet->Buffer2NextDescAddr; /* Update the ENET DMA current descriptor */ /* Chained Mode */ if((DMATxDescToSet->Status & ETH_DMATxDesc_TCH) != (u32)RESET) { /* Selects the next DMA Tx descriptor list for next buffer read */ DMATxDescToSet = (ETH_DMADESCTypeDef*) (DMAPTPTxDescToSet->Buffer2NextDescAddr); if(DMAPTPTxDescToSet->Status != 0) { DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) (DMAPTPTxDescToSet->Status); } else { DMAPTPTxDescToSet++; } } else /* Ring Mode */ { if((DMATxDescToSet->Status & ETH_DMATxDesc_TER) != (u32)RESET) { /* Selects the next DMA Tx descriptor list for next buffer read: this will be the first Tx descriptor in this case */ DMATxDescToSet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMATDLAR); DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMATDLAR); } else { /* Selects the next DMA Tx descriptor list for next buffer read */ DMATxDescToSet = (ETH_DMADESCTypeDef*) ((u32)DMATxDescToSet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); DMAPTPTxDescToSet = (ETH_DMADESCTypeDef*) ((u32)DMAPTPTxDescToSet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); } } /* Return SUCCESS */ return ETH_SUCCESS; } /******************************************************************************* * Function Name : ETH_HandlePTPRxPkt * Desciption : Receives a packet and copies it to memory pointed by ppkt with * Time Stamp values. * Input : - PTPRxTab: Pointer on the first PTP Rx table to store Time stamp values. * Output : ppkt: pointer on application receive buffer. * Return : ETH_ERROR: if there is error in reception * Received packet size: if packet reception is correct *******************************************************************************/ u32 ETH_HandlePTPRxPkt(u8 *ppkt, u32 *PTPRxTab) { u32 offset = 0, FrameLength = 0; /* Check if the descriptor is owned by the ENET or CPU */ if((DMARxDescToGet->Status & ETH_DMARxDesc_OWN) != (u32)RESET) { /* Return error: OWN bit set */ return ETH_ERROR; } if(((DMARxDescToGet->Status & ETH_DMARxDesc_ES) == (u32)RESET) && ((DMARxDescToGet->Status & ETH_DMARxDesc_LS) != (u32)RESET) && ((DMARxDescToGet->Status & ETH_DMARxDesc_FS) != (u32)RESET)) { /* Get the Frame Length of the received packet: substruct 4 bytes of the CRC */ FrameLength = ((DMARxDescToGet->Status & ETH_DMARxDesc_FL) >> ETH_DMARxDesc_FrameLengthShift) - 4; /* Copy the received frame into buffer from memory pointed by the current ETHERNET DMA Rx descriptor */ for(offset=0; offset<FrameLength; offset++) { (*(ppkt + offset)) = (*(vu8 *)((DMAPTPRxDescToGet->Buffer1Addr) + offset)); } } else { /* Return ERROR */ FrameLength = ETH_ERROR; } /* When Rx Buffer unavailable flag is set: clear it and resume reception */ if ((ETH_DMA->DMASR & ETH_DMASR_RBUS) != (u32)RESET) { /* Clear RBUS ETHERNET DMA flag */ ETH_DMA->DMASR = ETH_DMASR_RBUS; /* Resume DMA reception */ ETH_DMA->DMARPDR = 0; } *PTPRxTab++ = DMARxDescToGet->Buffer1Addr; *PTPRxTab = DMARxDescToGet->Buffer2NextDescAddr; /* Set Own bit of the Rx descriptor Status: gives the buffer back to ETHERNET DMA */ DMARxDescToGet->Status |= ETH_DMARxDesc_OWN; /* Update the ETHERNET DMA global Rx descriptor with next Rx decriptor */ /* Chained Mode */ if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RCH) != (u32)RESET) { /* Selects the next DMA Rx descriptor list for next buffer read */ DMARxDescToGet = (ETH_DMADESCTypeDef*) (DMAPTPRxDescToGet->Buffer2NextDescAddr); if(DMAPTPRxDescToGet->Status != 0) { DMAPTPRxDescToGet = (ETH_DMADESCTypeDef*) (DMAPTPRxDescToGet->Status); } else { DMAPTPRxDescToGet++; } } else /* Ring Mode */ { if((DMARxDescToGet->ControlBufferSize & ETH_DMARxDesc_RER) != (u32)RESET) { /* Selects the first DMA Rx descriptor for next buffer to read: last Rx descriptor was used */ DMARxDescToGet = (ETH_DMADESCTypeDef*) (ETH_DMA->DMARDLAR); } else { /* Selects the next DMA Rx descriptor list for next buffer to read */ DMARxDescToGet = (ETH_DMADESCTypeDef*) ((u32)DMARxDescToGet + 0x10 + ((ETH_DMA->DMABMR & ETH_DMABMR_DSL) >> 2)); } } /* Return Frame Length/ERROR */ return (FrameLength); } #endif /* _ETH_PTP */ /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32fxxx_eth.c
C
oos
141,788
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_pwr.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the PWR firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_pwr.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* --------- PWR registers bit address in the alias region ---------- */ #define PWR_OFFSET (PWR_BASE - PERIPH_BASE) /* --- CR Register ---*/ /* Alias word address of DBP bit */ #define CR_OFFSET (PWR_OFFSET + 0x00) #define DBP_BitNumber 0x08 #define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BitNumber * 4)) /* Alias word address of PVDE bit */ #define PVDE_BitNumber 0x04 #define CR_PVDE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PVDE_BitNumber * 4)) /* --- CSR Register ---*/ /* Alias word address of EWUP bit */ #define CSR_OFFSET (PWR_OFFSET + 0x04) #define EWUP_BitNumber 0x08 #define CSR_EWUP_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP_BitNumber * 4)) /* ------------------ PWR registers bit mask ------------------------ */ /* CR register bit mask */ #define CR_PDDS_Set ((u32)0x00000002) #define CR_DS_Mask ((u32)0xFFFFFFFC) #define CR_CWUF_Set ((u32)0x00000004) #define CR_PLS_Mask ((u32)0xFFFFFF1F) /* --------- Cortex System Control register bit mask ---------------- */ /* Cortex System Control register address */ #define SCB_SysCtrl ((u32)0xE000ED10) /* SLEEPDEEP bit mask */ #define SysCtrl_SLEEPDEEP_Set ((u32)0x00000004) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : PWR_DeInit * Description : Deinitializes the PWR peripheral registers to their default * reset values. * Input : None * Output : None * Return : None *******************************************************************************/ void PWR_DeInit(void) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, DISABLE); } /******************************************************************************* * Function Name : PWR_BackupAccessCmd * Description : Enables or disables access to the RTC and backup registers. * Input : - NewState: new state of the access to the RTC and backup * registers. This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void PWR_BackupAccessCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) CR_DBP_BB = (u32)NewState; } /******************************************************************************* * Function Name : PWR_PVDCmd * Description : Enables or disables the Power Voltage Detector(PVD). * Input : - NewState: new state of the PVD. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void PWR_PVDCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) CR_PVDE_BB = (u32)NewState; } /******************************************************************************* * Function Name : PWR_PVDLevelConfig * Description : Configures the value detected by the Power Voltage Detector(PVD). * Input : - PWR_PVDLevel: specifies the PVD detection level * This parameter can be one of the following values: * - PWR_PVDLevel_2V2: PVD detection level set to 2.2V * - PWR_PVDLevel_2V3: PVD detection level set to 2.3V * - PWR_PVDLevel_2V4: PVD detection level set to 2.4V * - PWR_PVDLevel_2V5: PVD detection level set to 2.5V * - PWR_PVDLevel_2V6: PVD detection level set to 2.6V * - PWR_PVDLevel_2V7: PVD detection level set to 2.7V * - PWR_PVDLevel_2V8: PVD detection level set to 2.8V * - PWR_PVDLevel_2V9: PVD detection level set to 2.9V * Output : None * Return : None *******************************************************************************/ void PWR_PVDLevelConfig(u32 PWR_PVDLevel) { u32 tmpreg = 0; /* Check the parameters */ assert(IS_PWR_PVD_LEVEL(PWR_PVDLevel)); tmpreg = PWR->CR; /* Clear PLS[7:5] bits */ tmpreg &= CR_PLS_Mask; /* Set PLS[7:5] bits according to PWR_PVDLevel value */ tmpreg |= PWR_PVDLevel; /* Store the new value */ PWR->CR = tmpreg; } /******************************************************************************* * Function Name : PWR_WakeUpPinCmd * Description : Enables or disables the WakeUp Pin functionality. * Input : - NewState: new state of the WakeUp Pin functionality. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void PWR_WakeUpPinCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) CSR_EWUP_BB = (u32)NewState; } /******************************************************************************* * Function Name : PWR_EnterSTOPMode * Description : Enters STOP mode. * Input : - PWR_Regulator: specifies the regulator state in STOP mode. * This parameter can be one of the following values: * - PWR_Regulator_ON: STOP mode with regulator ON * - PWR_Regulator_LowPower: STOP mode with * regulator in low power mode * - PWR_STOPEntry: specifies if STOP mode in entered with WFI or * WFE instruction. * This parameter can be one of the following values: * - PWR_STOPEntry_WFI: enter STOP mode with WFI instruction * - PWR_STOPEntry_WFE: enter STOP mode with WFE instruction * Output : None * Return : None *******************************************************************************/ void PWR_EnterSTOPMode(u32 PWR_Regulator, u8 PWR_STOPEntry) { u32 tmpreg = 0; /* Check the parameters */ assert(IS_PWR_REGULATOR(PWR_Regulator)); assert(IS_PWR_STOP_ENTRY(PWR_STOPEntry)); /* Select the regulator state in STOP mode ---------------------------------*/ tmpreg = PWR->CR; /* Clear PDDS and LPDS bits */ tmpreg &= CR_DS_Mask; /* Set LPDS bit according to PWR_Regulator value */ tmpreg |= PWR_Regulator; /* Store the new value */ PWR->CR = tmpreg; /* Set SLEEPDEEP bit of Cortex System Control Register */ *(vu32 *) SCB_SysCtrl |= SysCtrl_SLEEPDEEP_Set; /* Select STOP mode entry --------------------------------------------------*/ if(PWR_STOPEntry == PWR_STOPEntry_WFI) { /* Request Wait For Interrupt */ __WFI(); } else { /* Request Wait For Event */ __WFE(); } } /******************************************************************************* * Function Name : PWR_EnterSTANDBYMode * Description : Enters STANDBY mode. * Input : None * Output : None * Return : None *******************************************************************************/ void PWR_EnterSTANDBYMode(void) { /* Clear Wake-up flag */ PWR->CR |= CR_CWUF_Set; /* Select STANDBY mode */ PWR->CR |= CR_PDDS_Set; /* Set SLEEPDEEP bit of Cortex System Control Register */ *(vu32 *) SCB_SysCtrl |= SysCtrl_SLEEPDEEP_Set; /* Request Wait For Interrupt */ __WFI(); } /******************************************************************************* * Function Name : PWR_GetFlagStatus * Description : Checks whether the specified PWR flag is set or not. * Input : - PWR_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - PWR_FLAG_WU: Wake Up flag * - PWR_FLAG_SB: StandBy flag * - PWR_FLAG_PVDO: PVD Output * Output : None * Return : The new state of PWR_FLAG (SET or RESET). *******************************************************************************/ FlagStatus PWR_GetFlagStatus(u32 PWR_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ assert(IS_PWR_GET_FLAG(PWR_FLAG)); if ((PWR->CSR & PWR_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } /* Return the flag status */ return bitstatus; } /******************************************************************************* * Function Name : PWR_ClearFlag * Description : Clears the PWR's pending flags. * Input : - PWR_FLAG: specifies the flag to clear. * This parameter can be one of the following values: * - PWR_FLAG_WU: Wake Up flag * - PWR_FLAG_SB: StandBy flag * Output : None * Return : None *******************************************************************************/ void PWR_ClearFlag(u32 PWR_FLAG) { /* Check the parameters */ assert(IS_PWR_CLEAR_FLAG(PWR_FLAG)); PWR->CR |= PWR_FLAG << 2; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_pwr.c
C
oos
11,242
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_systick.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the SysTick firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_systick.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ---------------------- SysTick registers bit mask -------------------- */ /* CTRL TICKINT Mask */ #define CTRL_TICKINT_Set ((u32)0x00000002) #define CTRL_TICKINT_Reset ((u32)0xFFFFFFFD) /* SysTick Flag Mask */ #define FLAG_Mask ((u8)0x1F) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : SysTick_CLKSourceConfig * Description : Configures the SysTick clock source. * Input : - SysTick_CLKSource: specifies the SysTick clock source. * This parameter can be one of the following values: * - SysTick_CLKSource_HCLK_Div8: AHB clock divided by 8 * selected as SysTick clock source. * - SysTick_CLKSource_HCLK: AHB clock selected as * SysTick clock source. * Output : None * Return : None *******************************************************************************/ void SysTick_CLKSourceConfig(u32 SysTick_CLKSource) { /* Check the parameters */ assert(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource)); if (SysTick_CLKSource == SysTick_CLKSource_HCLK) { SysTick->CTRL |= SysTick_CLKSource_HCLK; } else { SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8; } } /******************************************************************************* * Function Name : SysTick_SetReload * Description : Sets SysTick Reload value. * Input : - Reload: SysTick Reload new value. * This parameter must be a number between 1 and 0xFFFFFF. * Output : None * Return : None *******************************************************************************/ void SysTick_SetReload(u32 Reload) { /* Check the parameters */ assert(IS_SYSTICK_RELOAD(Reload)); SysTick->LOAD = Reload; } /******************************************************************************* * Function Name : SysTick_CounterCmd * Description : Enables or disables the SysTick counter. * Input : - SysTick_Counter: new state of the SysTick counter. * This parameter can be one of the following values: * - SysTick_Counter_Disable: Disable counter * - SysTick_Counter_Enable: Enable counter * - SysTick_Counter_Clear: Clear counter value to 0 * Output : None * Return : None *******************************************************************************/ void SysTick_CounterCmd(u32 SysTick_Counter) { /* Check the parameters */ assert(IS_SYSTICK_COUNTER(SysTick_Counter)); if (SysTick_Counter == SysTick_Counter_Clear) { SysTick->VAL = SysTick_Counter_Clear; } else { if (SysTick_Counter == SysTick_Counter_Enable) { SysTick->CTRL |= SysTick_Counter_Enable; } else { SysTick->CTRL &= SysTick_Counter_Disable; } } } /******************************************************************************* * Function Name : SysTick_ITConfig * Description : Enables or disables the SysTick Interrupt. * Input : - NewState: new state of the SysTick Interrupt. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void SysTick_ITConfig(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { SysTick->CTRL |= CTRL_TICKINT_Set; } else { SysTick->CTRL &= CTRL_TICKINT_Reset; } } /******************************************************************************* * Function Name : SysTick_GetCounter * Description : Gets SysTick counter value. * Input : None * Output : None * Return : SysTick current value *******************************************************************************/ u32 SysTick_GetCounter(void) { return(SysTick->VAL); } /******************************************************************************* * Function Name : SysTick_GetFlagStatus * Description : Checks whether the specified SysTick flag is set or not. * Input : - SysTick_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - SysTick_FLAG_COUNT * - SysTick_FLAG_SKEW * - SysTick_FLAG_NOREF * Output : None * Return : None *******************************************************************************/ FlagStatus SysTick_GetFlagStatus(u8 SysTick_FLAG) { u32 tmp = 0; u32 statusreg = 0; FlagStatus bitstatus = RESET; /* Check the parameters */ assert(IS_SYSTICK_FLAG(SysTick_FLAG)); /* Get the SysTick register index */ tmp = SysTick_FLAG >> 5; if (tmp == 1) /* The flag to check is in CTRL register */ { statusreg = SysTick->CTRL; } else /* The flag to check is in CALIB register */ { statusreg = SysTick->CALIB; } /* Get the flag position */ tmp = SysTick_FLAG & FLAG_Mask; if ((statusreg & ((u32)1 << tmp)) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_systick.c
C
oos
7,196
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_gpio.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the GPIO firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_gpio.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ------------ RCC registers bit address in the alias region ----------- */ #define AFIO_OFFSET (AFIO_BASE - PERIPH_BASE) /* --- EVENTCR Register ---*/ /* Alias word address of EVOE bit */ #define EVCR_OFFSET (AFIO_OFFSET + 0x00) #define EVOE_BitNumber ((u8)0x07) #define EVCR_EVOE_BB (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4)) #define EVCR_PORTPINCONFIG_MASK ((u16)0xFF80) #define LSB_MASK ((u16)0xFFFF) #define DBGAFR_POSITION_MASK ((u32)0x000F0000) #define DBGAFR_SWJCFG_MASK ((u32)0xF8FFFFFF) #define DBGAFR_LOCATION_MASK ((u32)0x00200000) #define DBGAFR_NUMBITS_MASK ((u32)0x00100000) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : GPIO_DeInit * Description : Deinitializes the GPIOx peripheral registers to their default * reset values. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * Output : None * Return : None *******************************************************************************/ void GPIO_DeInit(GPIO_TypeDef* GPIOx) { switch (*(u32*)&GPIOx) { case GPIOA_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, DISABLE); break; case GPIOB_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, DISABLE); break; case GPIOC_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, DISABLE); break; case GPIOD_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, DISABLE); break; case GPIOE_BASE: RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, DISABLE); break; default: break; } } /******************************************************************************* * Function Name : GPIO_AFIODeInit * Description : Deinitializes the Alternate Functions (remap, event control * and EXTI configuration) registers to their default reset * values. * Input : None * Output : None * Return : None *******************************************************************************/ void GPIO_AFIODeInit(void) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE); } /******************************************************************************* * Function Name : GPIO_Init * Description : Initializes the GPIOx peripheral according to the specified * parameters in the GPIO_InitStruct. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that * contains the configuration information for the specified GPIO * peripheral. * Output : None * Return : None *******************************************************************************/ void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00; u32 tmpreg = 0x00, pinmask = 0x00; /* Check the parameters */ assert(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode)); assert(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin)); /*---------------------------- GPIO Mode Configuration -----------------------*/ currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F); if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00) { /* Check the parameters */ assert(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed)); /* Output mode */ currentmode |= (u32)GPIO_InitStruct->GPIO_Speed; } /*---------------------------- GPIO CRL Configuration ------------------------*/ /* Configure the eight low port pins */ if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00) { tmpreg = GPIOx->CRL; for (pinpos = 0x00; pinpos < 0x08; pinpos++) { pos = ((u32)0x01) << pinpos; /* Get the port pins position */ currentpin = (GPIO_InitStruct->GPIO_Pin) & pos; if (currentpin == pos) { pos = pinpos << 2; /* Clear the corresponding low control register bits */ pinmask = ((u32)0x0F) << pos; tmpreg &= ~pinmask; /* Write the mode configuration in the corresponding bits */ tmpreg |= (currentmode << pos); /* Reset the corresponding ODR bit */ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD) { GPIOx->BRR = (((u32)0x01) << pinpos); } /* Set the corresponding ODR bit */ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU) { GPIOx->BSRR = (((u32)0x01) << pinpos); } } } GPIOx->CRL = tmpreg; tmpreg = 0; } /*---------------------------- GPIO CRH Configuration ------------------------*/ /* Configure the eight high port pins */ if (GPIO_InitStruct->GPIO_Pin > 0x00FF) { tmpreg = GPIOx->CRH; for (pinpos = 0x00; pinpos < 0x08; pinpos++) { pos = (((u32)0x01) << (pinpos + 0x08)); /* Get the port pins position */ currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos); if (currentpin == pos) { pos = pinpos << 2; /* Clear the corresponding high control register bits */ pinmask = ((u32)0x0F) << pos; tmpreg &= ~pinmask; /* Write the mode configuration in the corresponding bits */ tmpreg |= (currentmode << pos); /* Reset the corresponding ODR bit */ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD) { GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08)); } /* Set the corresponding ODR bit */ if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU) { GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08)); } } } GPIOx->CRH = tmpreg; } } /******************************************************************************* * Function Name : GPIO_StructInit * Description : Fills each GPIO_InitStruct member with its default value. * Input : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure * which will be initialized. * Output : None * Return : None *******************************************************************************/ void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct) { /* Reset GPIO init structure parameters values */ GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All; GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING; } /******************************************************************************* * Function Name : GPIO_ReadInputDataBit * Description : Reads the specified input port pin. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * : - GPIO_Pin: specifies the port bit to read. * This parameter can be GPIO_Pin_x where x can be (0..15). * Output : None * Return : The input port pin value. *******************************************************************************/ u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin) { u8 bitstatus = 0x00; /* Check the parameters */ assert(IS_GPIO_PIN(GPIO_Pin)); if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET) { bitstatus = (u8)Bit_SET; } else { bitstatus = (u8)Bit_RESET; } return bitstatus; } /******************************************************************************* * Function Name : GPIO_ReadInputData * Description : Reads the specified GPIO input data port. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * Output : None * Return : GPIO input data port value. *******************************************************************************/ u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx) { return ((u16)GPIOx->IDR); } /******************************************************************************* * Function Name : GPIO_ReadOutputDataBit * Description : Reads the specified output data port bit. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * : - GPIO_Pin: specifies the port bit to read. * This parameter can be GPIO_Pin_x where x can be (0..15). * Output : None * Return : The output port pin value. *******************************************************************************/ u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin) { u8 bitstatus = 0x00; /* Check the parameters */ assert(IS_GPIO_PIN(GPIO_Pin)); if ((GPIOx->ODR & GPIO_Pin) != (u32)Bit_RESET) { bitstatus = (u8)Bit_SET; } else { bitstatus = (u8)Bit_RESET; } return bitstatus; } /******************************************************************************* * Function Name : GPIO_ReadOutputData * Description : Reads the specified GPIO output data port. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * Output : None * Return : GPIO output data port value. *******************************************************************************/ u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx) { return ((u16)GPIOx->ODR); } /******************************************************************************* * Function Name : GPIO_WriteBit * Description : Sets or clears the selected data port bit. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * - GPIO_Pin: specifies the port bit to be written. * This parameter can be GPIO_Pin_x where x can be (0..15). * - BitVal: specifies the value to be written to the selected bit. * This parameter can be one of the BitAction enum values: * - Bit_RESET: to clear the port pin * - Bit_SET: to set the port pin * Output : None * Return : None *******************************************************************************/ void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal) { /* Check the parameters */ assert(IS_GPIO_PIN(GPIO_Pin)); assert(IS_GPIO_BIT_ACTION(BitVal)); if (BitVal != Bit_RESET) { GPIOx->BSRR = GPIO_Pin; } else { GPIOx->BRR = GPIO_Pin; } } /******************************************************************************* * Function Name : GPIO_Write * Description : Writes data to the specified GPIO data port. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * - PortVal: specifies the value to be written to the port output * data register. * Output : None * Return : None *******************************************************************************/ void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal) { GPIOx->ODR = PortVal; } /******************************************************************************* * Function Name : GPIO_PinLockConfig * Description : Locks GPIO Pins configuration registers. * Input : - GPIOx: where x can be (A..E) to select the GPIO peripheral. * - GPIO_Pin: specifies the port bit to be written. * This parameter can be GPIO_Pin_x where x can be (0..15). * Output : None * Return : None *******************************************************************************/ void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin) { u32 tmp = 0x00010000; /* Check the parameters */ assert(IS_GPIO_PIN(GPIO_Pin)); tmp |= GPIO_Pin; /* Set LCKK bit */ GPIOx->LCKR = tmp; /* Reset LCKK bit */ GPIOx->LCKR = GPIO_Pin; /* Set LCKK bit */ GPIOx->LCKR = tmp; /* Read LCKK bit*/ tmp = GPIOx->LCKR; /* Read LCKK bit*/ tmp = GPIOx->LCKR; } /******************************************************************************* * Function Name : GPIO_EventOutputConfig * Description : Selects the GPIO pin used as Event output. * Input : - GPIO_PortSource: selects the GPIO port to be used as source * for Event output. * This parameter can be GPIO_PortSourceGPIOx where x can be * (A..E). * - GPIO_PinSource: specifies the pin for the Event output. * This parameter can be GPIO_PinSourcex where x can be (0..15). * Output : None * Return : None *******************************************************************************/ void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource) { u32 tmpreg = 0x00; /* Check the parameters */ assert(IS_GPIO_PORT_SOURCE(GPIO_PortSource)); assert(IS_GPIO_PIN_SOURCE(GPIO_PinSource)); tmpreg = AFIO->EVCR; /* Clear the PORT[6:4] and PIN[3:0] bits */ tmpreg &= EVCR_PORTPINCONFIG_MASK; tmpreg |= (u32)GPIO_PortSource << 0x04; tmpreg |= GPIO_PinSource; AFIO->EVCR = tmpreg; } /******************************************************************************* * Function Name : GPIO_EventOutputCmd * Description : Enables or disables the Event Output. * Input : - NewState: new state of the Event output. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void GPIO_EventOutputCmd(FunctionalState NewState) { /* Check the parameters */ assert(IS_FUNCTIONAL_STATE(NewState)); *(vu32 *) EVCR_EVOE_BB = (u32)NewState; } /******************************************************************************* * Function Name : GPIO_PinRemapConfig * Description : Changes the mapping of the specified pin. * Input : - GPIO_Remap: selects the pin to remap. * This parameter can be one of the following values: * - GPIO_Remap_SPI1 * - GPIO_Remap_I2C1 * - GPIO_Remap_USART1 * - GPIO_Remap_USART2 * - GPIO_PartialRemap_USART3 * - GPIO_FullRemap_USART3 * - GPIO_PartialRemap_TIM1 * - GPIO_FullRemap_TIM1 * - GPIO_PartialRemap1_TIM2 * - GPIO_PartialRemap2_TIM2 * - GPIO_FullRemap_TIM2 * - GPIO_PartialRemap_TIM3 * - GPIO_FullRemap_TIM3 * - GPIO_Remap_TIM4 * - GPIO_Remap1_CAN * - GPIO_Remap2_CAN * - GPIO_Remap_PD01 * - GPIO_Remap_SWJ_NoJTRST * - GPIO_Remap_SWJ_JTAGDisable * - GPIO_Remap_SWJ_Disable * - NewState: new state of the port pin remapping. * This parameter can be: ENABLE or DISABLE. * Output : None * Return : None *******************************************************************************/ void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState) { u32 tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00; /* Check the parameters */ assert(IS_GPIO_REMAP(GPIO_Remap)); assert(IS_FUNCTIONAL_STATE(NewState)); tmpreg = AFIO->MAPR; tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10; tmp = GPIO_Remap & LSB_MASK; if ((GPIO_Remap & DBGAFR_LOCATION_MASK) == DBGAFR_LOCATION_MASK) { tmpreg &= DBGAFR_SWJCFG_MASK; } else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK) { tmp1 = ((u32)0x03) << tmpmask; tmpreg &= ~tmp1; } else { tmpreg &= ~tmp; } if (NewState != DISABLE) { if ((GPIO_Remap & DBGAFR_LOCATION_MASK) == DBGAFR_LOCATION_MASK) { tmpreg |= (tmp << 0x10); } else { tmpreg |= tmp; } } AFIO->MAPR = tmpreg; } /******************************************************************************* * Function Name : GPIO_EXTILineConfig * Description : Selects the GPIO pin used as EXTI Line. * Input : - GPIO_PortSource: selects the GPIO port to be used as * source for EXTI lines. * - GPIO_PinSource: specifies the EXTI line to be configured. * This parameter can be GPIO_PinSourcex where x can be (0..15). * Output : None * Return : None *******************************************************************************/ void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource) { u32 tmp = 0x00; /* Check the parameters */ assert(IS_GPIO_PORT_SOURCE(GPIO_PortSource)); assert(IS_GPIO_PIN_SOURCE(GPIO_PinSource)); tmp = ((u32)0x0F) << (0x04 * (GPIO_PinSource & (u8)0x03)); AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp; AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((u32)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (u8)0x03))); } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_gpio.c
C
oos
19,602
/** ****************************************************************************** * @file stm32f10x_dbgmcu.c * @author MCD Application Team * @version V3.0.0 * @date 04/06/2009 * @brief This file provides all the DBGMCU firmware functions. ****************************************************************************** * @copy * * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. * * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2> */ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_dbgmcu.h" /** @addtogroup StdPeriph_Driver * @{ */ /** @defgroup DBGMCU * @brief DBGMCU driver modules * @{ */ /** @defgroup DBGMCU_Private_TypesDefinitions * @{ */ /** * @} */ /** @defgroup DBGMCU_Private_Defines * @{ */ #define IDCODE_DEVID_Mask ((uint32_t)0x00000FFF) /** * @} */ /** @defgroup DBGMCU_Private_Macros * @{ */ /** * @} */ /** @defgroup DBGMCU_Private_Variables * @{ */ /** * @} */ /** @defgroup DBGMCU_Private_FunctionPrototypes * @{ */ /** * @} */ /** @defgroup DBGMCU_Private_Functions * @{ */ /** * @brief Returns the device revision identifier. * @param None * @retval : Device revision identifier */ uint32_t DBGMCU_GetREVID(void) { return(DBGMCU->IDCODE >> 16); } /** * @brief Returns the device identifier. * @param None * @retval : Device identifier */ uint32_t DBGMCU_GetDEVID(void) { return(DBGMCU->IDCODE & IDCODE_DEVID_Mask); } /** * @brief Configures the specified peripheral and low power mode behavior * when the MCU under Debug mode. * @param DBGMCU_Periph: specifies the peripheral and low power mode. * This parameter can be any combination of the following values: * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode * @arg DBGMCU_STOP: Keep debugger connection during STOP mode * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted * @arg DBGMCU_CAN1_STOP: Debug CAN 1 stopped when Core is halted * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is * halted * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is * halted * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted * @param NewState: new state of the specified peripheral in Debug mode. * This parameter can be: ENABLE or DISABLE. * @retval : None */ void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DBGMCU->CR |= DBGMCU_Periph; } else { DBGMCU->CR &= ~DBGMCU_Periph; } } /** * @} */ /** * @} */ /** * @} */ /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_dbgmcu.c
C
oos
4,310
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_wwdg.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the WWDG firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_wwdg.h" #include "stm32f10x_rcc.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ----------- WWDG registers bit address in the alias region ----------- */ #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE) /* Alias word address of EWI bit */ #define CFR_OFFSET (WWDG_OFFSET + 0x04) #define EWI_BitNumber 0x09 #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4)) /* Alias word address of EWIF bit */ #define SR_OFFSET (WWDG_OFFSET + 0x08) #define EWIF_BitNumber 0x00 #define SR_EWIF_BB (PERIPH_BB_BASE + (SR_OFFSET * 32) + (EWIF_BitNumber * 4)) /* --------------------- WWDG registers bit mask ------------------------ */ /* CR register bit mask */ #define CR_WDGA_Set ((u32)0x00000080) /* CFR register bit mask */ #define CFR_WDGTB_Mask ((u32)0xFFFFFE7F) #define CFR_W_Mask ((u32)0xFFFFFF80) #define BIT_Mask ((u8)0x7F) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : WWDG_DeInit * Description : Deinitializes the WWDG peripheral registers to their default * reset values. * Input : None * Output : None * Return : None *******************************************************************************/ void WWDG_DeInit(void) { RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE); RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE); } /******************************************************************************* * Function Name : WWDG_SetPrescaler * Description : Sets the WWDG Prescaler. * Input : - WWDG_Prescaler: specifies the WWDG Prescaler. * This parameter can be one of the following values: * - WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1 * - WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2 * - WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4 * - WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8 * Output : None * Return : None *******************************************************************************/ void WWDG_SetPrescaler(u32 WWDG_Prescaler) { u32 tmpreg = 0; /* Check the parameters */ assert(IS_WWDG_PRESCALER(WWDG_Prescaler)); /* Clear WDGTB[8:7] bits */ tmpreg = WWDG->CFR & CFR_WDGTB_Mask; /* Set WDGTB[8:7] bits according to WWDG_Prescaler value */ tmpreg |= WWDG_Prescaler; /* Store the new value */ WWDG->CFR = tmpreg; } /******************************************************************************* * Function Name : WWDG_SetWindowValue * Description : Sets the WWDG window value. * Input : - WindowValue: specifies the window value to be compared to * the downcounter. * This parameter value must be lower than 0x80. * Output : None * Return : None *******************************************************************************/ void WWDG_SetWindowValue(u8 WindowValue) { u32 tmpreg = 0; /* Check the parameters */ assert(IS_WWDG_WINDOW_VALUE(WindowValue)); /* Clear W[6:0] bits */ tmpreg = WWDG->CFR & CFR_W_Mask; /* Set W[6:0] bits according to WindowValue value */ tmpreg |= WindowValue & BIT_Mask; /* Store the new value */ WWDG->CFR = tmpreg; } /******************************************************************************* * Function Name : WWDG_EnableIT * Description : Enables the WWDG Early Wakeup interrupt(EWI). * Input : None * Output : None * Return : None *******************************************************************************/ void WWDG_EnableIT(void) { *(vu32 *) CFR_EWI_BB = (u32)ENABLE; } /******************************************************************************* * Function Name : WWDG_SetCounter * Description : Sets the WWDG counter value. * Input : - Counter: specifies the watchdog counter value. * This parameter must be a number between 0x40 and 0x7F. * Output : None * Return : None *******************************************************************************/ void WWDG_SetCounter(u8 Counter) { /* Check the parameters */ assert(IS_WWDG_COUNTER(Counter)); /* Write to T[6:0] bits to configure the counter value, no need to do a read-modify-write; writing a 0 to WDGA bit does nothing */ WWDG->CR = Counter & BIT_Mask; } /******************************************************************************* * Function Name : WWDG_Enable * Description : Enables WWDG and load the counter value. * - Counter: specifies the watchdog counter value. * This parameter must be a number between 0x40 and 0x7F. * Input : None * Output : None * Return : None *******************************************************************************/ void WWDG_Enable(u8 Counter) { /* Check the parameters */ assert(IS_WWDG_COUNTER(Counter)); WWDG->CR = CR_WDGA_Set | Counter; } /******************************************************************************* * Function Name : WWDG_GetFlagStatus * Description : Checks whether the Early Wakeup interrupt flag is set or not. * Input : None * Output : None * Return : The new state of the Early Wakeup interrupt flag (SET or RESET) *******************************************************************************/ FlagStatus WWDG_GetFlagStatus(void) { return (FlagStatus)(*(vu32 *) SR_EWIF_BB); } /******************************************************************************* * Function Name : WWDG_ClearFlag * Description : Clears Early Wakeup interrupt flag. * Input : None * Output : None * Return : None *******************************************************************************/ void WWDG_ClearFlag(void) { WWDG->SR = (u32)RESET; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_wwdg.c
C
oos
7,816
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_iwdg.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all the IWDG firmware functions. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_iwdg.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* ---------------------- IWDG registers bit mask ------------------------ */ /* KR register bit mask */ #define KR_Reload ((u16)0xAAAA) #define KR_Enable ((u16)0xCCCC) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************* * Function Name : IWDG_WriteAccessCmd * Description : Enables or disables write access to IWDG_PR and IWDG_RLR * registers. * Input : - IWDG_WriteAccess: new state of write access to IWDG_PR and * IWDG_RLR registers. * This parameter can be one of the following values: * - IWDG_WriteAccess_Enable: Enable write access to * IWDG_PR and IWDG_RLR registers * - IWDG_WriteAccess_Disable: Disable write access to * IWDG_PR and IWDG_RLR registers * Output : None * Return : None *******************************************************************************/ void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess) { /* Check the parameters */ assert(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); IWDG->KR = IWDG_WriteAccess; } /******************************************************************************* * Function Name : IWDG_SetPrescaler * Description : Sets IWDG Prescaler value. * Input : - IWDG_Prescaler: specifies the IWDG Prescaler value. * This parameter can be one of the following values: * - IWDG_Prescaler_4: IWDG prescaler set to 4 * - IWDG_Prescaler_8: IWDG prescaler set to 8 * - IWDG_Prescaler_16: IWDG prescaler set to 16 * - IWDG_Prescaler_32: IWDG prescaler set to 32 * - IWDG_Prescaler_64: IWDG prescaler set to 64 * - IWDG_Prescaler_128: IWDG prescaler set to 128 * - IWDG_Prescaler_256: IWDG prescaler set to 256 * Output : None * Return : None *******************************************************************************/ void IWDG_SetPrescaler(u8 IWDG_Prescaler) { /* Check the parameters */ assert(IS_IWDG_PRESCALER(IWDG_Prescaler)); IWDG->PR = IWDG_Prescaler; } /******************************************************************************* * Function Name : IWDG_SetReload * Description : Sets IWDG Reload value. * Input : - Reload: specifies the IWDG Reload value. * This parameter must be a number between 0 and 0x0FFF. * Output : None * Return : None *******************************************************************************/ void IWDG_SetReload(u16 Reload) { /* Check the parameters */ assert(IS_IWDG_RELOAD(Reload)); IWDG->RLR = Reload; } /******************************************************************************* * Function Name : IWDG_ReloadCounter * Description : Reloads IWDG counter with value defined in the reload register * (write access to IWDG_PR and IWDG_RLR registers disabled). * Input : None * Output : None * Return : None *******************************************************************************/ void IWDG_ReloadCounter(void) { IWDG->KR = KR_Reload; } /******************************************************************************* * Function Name : IWDG_Enable * Description : Enables IWDG (write access to IWDG_PR and IWDG_RLR registers * disabled). * Input : None * Output : None * Return : None *******************************************************************************/ void IWDG_Enable(void) { IWDG->KR = KR_Enable; } /******************************************************************************* * Function Name : IWDG_GetFlagStatus * Description : Checks whether the specified IWDG flag is set or not. * Input : - IWDG_FLAG: specifies the flag to check. * This parameter can be one of the following values: * - IWDG_FLAG_PVU: Prescaler Value Update on going * - IWDG_FLAG_RVU: Reload Value Update on going * Output : None * Return : The new state of IWDG_FLAG (SET or RESET). *******************************************************************************/ FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG) { FlagStatus bitstatus = RESET; /* Check the parameters */ assert(IS_IWDG_FLAG(IWDG_FLAG)); if ((IWDG->SR & IWDG_FLAG) != (u32)RESET) { bitstatus = SET; } else { bitstatus = RESET; } /* Return the flag status */ return bitstatus; } /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_iwdg.c
C
oos
6,515
/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : stm32f10x_lib.c * Author : MCD Application Team * Date First Issued : 09/29/2006 * Description : This file provides all peripherals pointers initialization. ******************************************************************************** * History: * 04/02/2007: V0.2 * 02/05/2007: V0.1 * 09/29/2006: V0.01 ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ #define EXT /* Includes ------------------------------------------------------------------*/ #include "stm32f10x_lib.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ #ifdef DEBUG /******************************************************************************* * Function Name : debug * Description : This function initialize peripherals pointers. * Input : None * Output : None * Return : None *******************************************************************************/ void debug(void) { /************************************* ADC ************************************/ #ifdef _ADC1 ADC1 = (ADC_TypeDef *) ADC1_BASE; #endif /*_ADC1 */ #ifdef _ADC2 ADC2 = (ADC_TypeDef *) ADC2_BASE; #endif /*_ADC2 */ /************************************* BKP ************************************/ #ifdef _BKP BKP = (BKP_TypeDef *) BKP_BASE; #endif /*_BKP */ /************************************* CAN ************************************/ #ifdef _CAN CAN = (CAN_TypeDef *) CAN_BASE; #endif /*_CAN */ /************************************* DMA ************************************/ #ifdef _DMA DMA = (DMA_TypeDef *) DMA_BASE; #endif /*_DMA */ #ifdef _DMA_Channel1 DMA_Channel1 = (DMA_Channel_TypeDef *) DMA_Channel1_BASE; #endif /*_DMA_Channel1 */ #ifdef _DMA_Channel2 DMA_Channel2 = (DMA_Channel_TypeDef *) DMA_Channel2_BASE; #endif /*_DMA_Channel2 */ #ifdef _DMA_Channel3 DMA_Channel3 = (DMA_Channel_TypeDef *) DMA_Channel3_BASE; #endif /*_DMA_Channel3 */ #ifdef _DMA_Channel4 DMA_Channel4 = (DMA_Channel_TypeDef *) DMA_Channel4_BASE; #endif /*_DMA_Channel4 */ #ifdef _DMA_Channel5 DMA_Channel5 = (DMA_Channel_TypeDef *) DMA_Channel5_BASE; #endif /*_DMA_Channel5 */ #ifdef _DMA_Channel6 DMA_Channel6 = (DMA_Channel_TypeDef *) DMA_Channel6_BASE; #endif /*_DMA_Channel6 */ #ifdef _DMA_Channel7 DMA_Channel7 = (DMA_Channel_TypeDef *) DMA_Channel7_BASE; #endif /*_DMA_Channel7 */ /************************************* EXTI ***********************************/ #ifdef _EXTI EXTI = (EXTI_TypeDef *) EXTI_BASE; #endif /*_EXTI */ /************************************* FLASH and Option Bytes *****************/ #ifdef _FLASH FLASH = (FLASH_TypeDef *) FLASH_BASE; OB = (OB_TypeDef *) OB_BASE; #endif /*_FLASH */ /************************************* GPIO ***********************************/ #ifdef _GPIOA GPIOA = (GPIO_TypeDef *) GPIOA_BASE; #endif /*_GPIOA */ #ifdef _GPIOB GPIOB = (GPIO_TypeDef *) GPIOB_BASE; #endif /*_GPIOB */ #ifdef _GPIOC GPIOC = (GPIO_TypeDef *) GPIOC_BASE; #endif /*_GPIOC */ #ifdef _GPIOD GPIOD = (GPIO_TypeDef *) GPIOD_BASE; #endif /*_GPIOD */ #ifdef _GPIOE GPIOE = (GPIO_TypeDef *) GPIOE_BASE; #endif /*_GPIOE */ #ifdef _AFIO AFIO = (AFIO_TypeDef *) AFIO_BASE; #endif /*_AFIO */ /************************************* I2C ************************************/ #ifdef _I2C1 I2C1 = (I2C_TypeDef *) I2C1_BASE; #endif /*_I2C1 */ #ifdef _I2C2 I2C2 = (I2C_TypeDef *) I2C2_BASE; #endif /*_I2C2 */ /************************************* IWDG ***********************************/ #ifdef _IWDG IWDG = (IWDG_TypeDef *) IWDG_BASE; #endif /*_IWDG */ /************************************* NVIC ***********************************/ #ifdef _NVIC NVIC = (NVIC_TypeDef *) NVIC_BASE; #endif /*_NVIC */ #ifdef _SCB SCB = (SCB_TypeDef *) SCB_BASE; #endif /*_SCB */ /************************************* PWR ************************************/ #ifdef _PWR PWR = (PWR_TypeDef *) PWR_BASE; #endif /*_PWR */ /************************************* RCC ************************************/ #ifdef _RCC RCC = (RCC_TypeDef *) RCC_BASE; #endif /*_RCC */ /************************************* RTC ************************************/ #ifdef _RTC RTC = (RTC_TypeDef *) RTC_BASE; #endif /*_RTC */ /************************************* SPI ************************************/ #ifdef _SPI1 SPI1 = (SPI_TypeDef *) SPI1_BASE; #endif /*_SPI1 */ #ifdef _SPI2 SPI2 = (SPI_TypeDef *) SPI2_BASE; #endif /*_SPI2 */ /************************************* SysTick ********************************/ #ifdef _SysTick SysTick = (SysTick_TypeDef *) SysTick_BASE; #endif /*_SysTick */ /************************************* TIM1 ***********************************/ #ifdef _TIM1 TIM1 = (TIM1_TypeDef *) TIM1_BASE; #endif /*_TIM1 */ /************************************* TIM ************************************/ #ifdef _TIM2 TIM2 = (TIM_TypeDef *) TIM2_BASE; #endif /*_TIM2 */ #ifdef _TIM3 TIM3 = (TIM_TypeDef *) TIM3_BASE; #endif /*_TIM3 */ #ifdef _TIM4 TIM4 = (TIM_TypeDef *) TIM4_BASE; #endif /*_TIM4 */ /************************************* USART **********************************/ #ifdef _USART1 USART1 = (USART_TypeDef *) USART1_BASE; #endif /*_USART1 */ #ifdef _USART2 USART2 = (USART_TypeDef *) USART2_BASE; #endif /*_USART2 */ #ifdef _USART3 USART3 = (USART_TypeDef *) USART3_BASE; #endif /*_USART3 */ /************************************* WWDG ***********************************/ #ifdef _WWDG WWDG = (WWDG_TypeDef *) WWDG_BASE; #endif /*_WWDG */ } #endif /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/ST/STM32F10xFWLib/src/stm32f10x_lib.c
C
oos
6,921
//***************************************************************************** // // i2c.h - Prototypes for the I2C Driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __I2C_H__ #define __I2C_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // Interrupt defines. // //***************************************************************************** #define I2C_INT_MASTER 0x00000001 #define I2C_INT_SLAVE 0x00000002 //***************************************************************************** // // I2C Master commands. // //***************************************************************************** #define I2C_MASTER_CMD_SINGLE_SEND 0x00000007 #define I2C_MASTER_CMD_SINGLE_RECEIVE 0x00000007 #define I2C_MASTER_CMD_BURST_SEND_START 0x00000003 #define I2C_MASTER_CMD_BURST_SEND_CONT 0x00000001 #define I2C_MASTER_CMD_BURST_SEND_FINISH 0x00000005 #define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP 0x00000004 #define I2C_MASTER_CMD_BURST_RECEIVE_START 0x0000000b #define I2C_MASTER_CMD_BURST_RECEIVE_CONT 0x00000009 #define I2C_MASTER_CMD_BURST_RECEIVE_FINISH 0x00000005 #define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP 0x00000005 //***************************************************************************** // // I2C Master error status. // //***************************************************************************** #define I2C_MASTER_ERR_NONE 0 #define I2C_MASTER_ERR_ADDR_ACK 0x00000004 #define I2C_MASTER_ERR_DATA_ACK 0x00000008 #define I2C_MASTER_ERR_ARB_LOST 0x00000010 //***************************************************************************** // // I2C Slave action requests // //***************************************************************************** #define I2C_SLAVE_ACT_NONE 0 #define I2C_SLAVE_ACT_RREQ 0x00000001 // Master has sent data #define I2C_SLAVE_ACT_TREQ 0x00000002 // Master has requested data #define I2C_SLAVE_ACT_RREQ_FBR 0x00000005 // Master has sent first byte //***************************************************************************** // // Miscellaneous I2C driver definitions. // //***************************************************************************** #define I2C_MASTER_MAX_RETRIES 1000 // Number of retries //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void I2CIntRegister(unsigned long ulBase, void(fnHandler)(void)); extern void I2CIntUnregister(unsigned long ulBase); extern tBoolean I2CMasterBusBusy(unsigned long ulBase); extern tBoolean I2CMasterBusy(unsigned long ulBase); extern void I2CMasterControl(unsigned long ulBase, unsigned long ulCmd); extern unsigned long I2CMasterDataGet(unsigned long ulBase); extern void I2CMasterDataPut(unsigned long ulBase, unsigned char ucData); extern void I2CMasterDisable(unsigned long ulBase); extern void I2CMasterEnable(unsigned long ulBase); extern unsigned long I2CMasterErr(unsigned long ulBase); extern void I2CMasterInitExpClk(unsigned long ulBase, unsigned long ulI2CClk, tBoolean bFast); extern void I2CMasterIntClear(unsigned long ulBase); extern void I2CMasterIntDisable(unsigned long ulBase); extern void I2CMasterIntEnable(unsigned long ulBase); extern tBoolean I2CMasterIntStatus(unsigned long ulBase, tBoolean bMasked); extern void I2CMasterSlaveAddrSet(unsigned long ulBase, unsigned char ucSlaveAddr, tBoolean bReceive); extern unsigned long I2CSlaveDataGet(unsigned long ulBase); extern void I2CSlaveDataPut(unsigned long ulBase, unsigned char ucData); extern void I2CSlaveDisable(unsigned long ulBase); extern void I2CSlaveEnable(unsigned long ulBase); extern void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr); extern void I2CSlaveIntClear(unsigned long ulBase); extern void I2CSlaveIntDisable(unsigned long ulBase); extern void I2CSlaveIntEnable(unsigned long ulBase); extern tBoolean I2CSlaveIntStatus(unsigned long ulBase, tBoolean bMasked); extern unsigned long I2CSlaveStatus(unsigned long ulBase); //***************************************************************************** // // Several I2C APIs have been renamed, with the original function name being // deprecated. These defines provide backward compatibility. // //***************************************************************************** #ifndef DEPRECATED #include "sysctl.h" #define I2CMasterInit(a, b) \ I2CMasterInitExpClk(a, SysCtlClockGet(), b) #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __I2C_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/i2c.h
C
oos
6,843
//***************************************************************************** // // rit128x96x4.h - Prototypes for the driver for the RITEK 128x96x4 graphical // OLED display. // // Copyright (c) 2007 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. Any use in violation // of the foregoing restrictions may subject the user to criminal sanctions // under applicable laws, as well as to civil liability for the breach of the // terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 1582 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __RIT128X96X4_H__ #define __RIT128X96X4_H__ //***************************************************************************** // // Prototypes for the driver APIs. // //***************************************************************************** extern void RIT128x96x4Clear(void); extern void RIT128x96x4StringDraw(const char *pcStr, unsigned long ulX, unsigned long ulY, unsigned char ucLevel); extern void RIT128x96x4ImageDraw(const unsigned char *pucImage, unsigned long ulX, unsigned long ulY, unsigned long ulWidth, unsigned long ulHeight); extern void RIT128x96x4Init(unsigned long ulFrequency); extern void RIT128x96x4Enable(unsigned long ulFrequency); extern void RIT128x96x4Disable(void); extern void RIT128x96x4DisplayOn(void); extern void RIT128x96x4DisplayOff(void); #endif // __RIT128X96X4_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/rit128x96x4.h
C
oos
2,429
//***************************************************************************** // // rom.h - Macros to facilitate calling functions in the ROM. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __ROM_H__ #define __ROM_H__ //***************************************************************************** // // Pointers to the main API tables. // //***************************************************************************** #define ROM_APITABLE ((unsigned long *)0x01000010) #define ROM_VERSION (ROM_APITABLE[0]) #define ROM_UARTTABLE ((unsigned long *)(ROM_APITABLE[1])) #define ROM_SSITABLE ((unsigned long *)(ROM_APITABLE[2])) #define ROM_I2CTABLE ((unsigned long *)(ROM_APITABLE[3])) #define ROM_GPIOTABLE ((unsigned long *)(ROM_APITABLE[4])) #define ROM_ADCTABLE ((unsigned long *)(ROM_APITABLE[5])) #define ROM_COMPARATORTABLE ((unsigned long *)(ROM_APITABLE[6])) #define ROM_FLASHTABLE ((unsigned long *)(ROM_APITABLE[7])) #define ROM_PWMTABLE ((unsigned long *)(ROM_APITABLE[8])) #define ROM_QEITABLE ((unsigned long *)(ROM_APITABLE[9])) #define ROM_SYSTICKTABLE ((unsigned long *)(ROM_APITABLE[10])) #define ROM_TIMERTABLE ((unsigned long *)(ROM_APITABLE[11])) #define ROM_WATCHDOGTABLE ((unsigned long *)(ROM_APITABLE[12])) #define ROM_SYSCTLTABLE ((unsigned long *)(ROM_APITABLE[13])) #define ROM_INTERRUPTTABLE ((unsigned long *)(ROM_APITABLE[14])) //***************************************************************************** // // Macros for calling ROM functions in the ADC API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceDataGet \ ((long (*)(unsigned long ulBase, \ unsigned long ulSequenceNum, \ unsigned long *pulBuffer))ROM_ADCTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulSequenceNum, \ tBoolean bMasked))ROM_ADCTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum, \ unsigned long ulTrigger, \ unsigned long ulPriority))ROM_ADCTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceStepConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum, \ unsigned long ulStep, \ unsigned long ulConfig))ROM_ADCTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceOverflow \ ((long (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceOverflowClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceUnderflow \ ((long (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCSequenceUnderflowClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCProcessorTrigger \ ((void (*)(unsigned long ulBase, \ unsigned long ulSequenceNum))ROM_ADCTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ADCHardwareOversampleConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulFactor))ROM_ADCTABLE[14]) #endif //***************************************************************************** // // Macros for calling ROM functions in the Comparator API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulComp))ROM_COMPARATORTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulComp, \ unsigned long ulConfig))ROM_COMPARATORTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorRefSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulRef))ROM_COMPARATORTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorValueGet \ ((tBoolean (*)(unsigned long ulBase, \ unsigned long ulComp))ROM_COMPARATORTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulComp))ROM_COMPARATORTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulComp))ROM_COMPARATORTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_ComparatorIntStatus \ ((tBoolean (*)(unsigned long ulBase, \ unsigned long ulComp, \ tBoolean bMasked))ROM_COMPARATORTABLE[6]) #endif //***************************************************************************** // // Macros for calling ROM functions in the Flash API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashProgram \ ((long (*)(unsigned long *pulData, \ unsigned long ulAddress, \ unsigned long ulCount))ROM_FLASHTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashUsecGet \ ((unsigned long (*)(void))ROM_FLASHTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashUsecSet \ ((void (*)(unsigned long ulClocks))ROM_FLASHTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashErase \ ((long (*)(unsigned long ulAddress))ROM_FLASHTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashProtectGet \ ((tFlashProtection (*)(unsigned long ulAddress))ROM_FLASHTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashProtectSet \ ((long (*)(unsigned long ulAddress, \ tFlashProtection eProtect))ROM_FLASHTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashProtectSave \ ((long (*)(void))ROM_FLASHTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashUserGet \ ((long (*)(unsigned long *pulUser0, \ unsigned long *pulUser1))ROM_FLASHTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashUserSet \ ((long (*)(unsigned long ulUser0, \ unsigned long ulUser1))ROM_FLASHTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashUserSave \ ((long (*)(void))ROM_FLASHTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashIntEnable \ ((void (*)(unsigned long ulIntFlags))ROM_FLASHTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashIntDisable \ ((void (*)(unsigned long ulIntFlags))ROM_FLASHTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashIntGetStatus \ ((unsigned long (*)(tBoolean bMasked))ROM_FLASHTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_FlashIntClear \ ((void (*)(unsigned long ulIntFlags))ROM_FLASHTABLE[13]) #endif //***************************************************************************** // // Macros for calling ROM functions in the GPIO API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinWrite \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins, \ unsigned char ucVal))ROM_GPIOTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIODirModeSet \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins, \ unsigned long ulPinIO))ROM_GPIOTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIODirModeGet \ ((unsigned long (*)(unsigned long ulPort, \ unsigned char ucPin))ROM_GPIOTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOIntTypeSet \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins, \ unsigned long ulIntType))ROM_GPIOTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOIntTypeGet \ ((unsigned long (*)(unsigned long ulPort, \ unsigned char ucPin))ROM_GPIOTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPadConfigSet \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins, \ unsigned long ulStrength, \ unsigned long ulPadType))ROM_GPIOTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPadConfigGet \ ((void (*)(unsigned long ulPort, \ unsigned char ucPin, \ unsigned long *pulStrength, \ unsigned long *pulPadType))ROM_GPIOTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinIntEnable \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinIntDisable \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinIntStatus \ ((long (*)(unsigned long ulPort, \ tBoolean bMasked))ROM_GPIOTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinIntClear \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinRead \ ((long (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeCAN \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeComparator \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeGPIOInput \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeGPIOOutput \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeI2C \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypePWM \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeQEI \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeSSI \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeTimer \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeUART \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[21]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_GPIOPinTypeGPIOOutputOD \ ((void (*)(unsigned long ulPort, \ unsigned char ucPins))ROM_GPIOTABLE[22]) #endif //***************************************************************************** // // Macros for calling ROM functions in the I2C API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterDataPut \ ((void (*)(unsigned long ulBase, \ unsigned char ucData))ROM_I2CTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterInitExpClk \ ((void (*)(unsigned long ulBase, \ unsigned long ulI2CClk, \ tBoolean bFast))ROM_I2CTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveInit \ ((void (*)(unsigned long ulBase, \ unsigned char ucSlaveAddr))ROM_I2CTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterEnable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveEnable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterDisable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveDisable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterIntEnable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveIntEnable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterIntDisable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveIntDisable \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterIntStatus \ ((tBoolean (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_I2CTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveIntStatus \ ((tBoolean (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_I2CTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterIntClear \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveIntClear \ ((void (*)(unsigned long ulBase))ROM_I2CTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterSlaveAddrSet \ ((void (*)(unsigned long ulBase, \ unsigned char ucSlaveAddr, \ tBoolean bReceive))ROM_I2CTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterBusy \ ((tBoolean (*)(unsigned long ulBase))ROM_I2CTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterBusBusy \ ((tBoolean (*)(unsigned long ulBase))ROM_I2CTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterControl \ ((void (*)(unsigned long ulBase, \ unsigned long ulCmd))ROM_I2CTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterErr \ ((unsigned long (*)(unsigned long ulBase))ROM_I2CTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CMasterDataGet \ ((unsigned long (*)(unsigned long ulBase))ROM_I2CTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveStatus \ ((unsigned long (*)(unsigned long ulBase))ROM_I2CTABLE[21]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveDataPut \ ((void (*)(unsigned long ulBase, \ unsigned char ucData))ROM_I2CTABLE[22]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_I2CSlaveDataGet \ ((unsigned long (*)(unsigned long ulBase))ROM_I2CTABLE[23]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UpdateI2C \ ((void (*)(void))ROM_I2CTABLE[24]) #endif //***************************************************************************** // // Macros for calling ROM functions in the Interrupt API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntEnable \ ((void (*)(unsigned long ulInterrupt))ROM_INTERRUPTTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntDisable \ ((void (*)(unsigned long ulInterrupt))ROM_INTERRUPTTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntPriorityGroupingSet \ ((void (*)(unsigned long ulBits))ROM_INTERRUPTTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntPriorityGroupingGet \ ((unsigned long (*)(void))ROM_INTERRUPTTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntPrioritySet \ ((void (*)(unsigned long ulInterrupt, \ unsigned char ucPriority))ROM_INTERRUPTTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_IntPriorityGet \ ((long (*)(unsigned long ulInterrupt))ROM_INTERRUPTTABLE[7]) #endif //***************************************************************************** // // Macros for calling ROM functions in the PWM API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMPulseWidthSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulPWMOut, \ unsigned long ulWidth))ROM_PWMTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned long ulConfig))ROM_PWMTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenPeriodSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned long ulPeriod))ROM_PWMTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenPeriodGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulGen))ROM_PWMTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen))ROM_PWMTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen))ROM_PWMTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMPulseWidthGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulPWMOut))ROM_PWMTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMDeadBandEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned short usRise, \ unsigned short usFall))ROM_PWMTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMDeadBandDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen))ROM_PWMTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMSyncUpdate \ ((void (*)(unsigned long ulBase, \ unsigned long ulGenBits))ROM_PWMTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMSyncTimeBase \ ((void (*)(unsigned long ulBase, \ unsigned long ulGenBits))ROM_PWMTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMOutputState \ ((void (*)(unsigned long ulBase, \ unsigned long ulPWMOutBits, \ tBoolean bEnable))ROM_PWMTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMOutputInvert \ ((void (*)(unsigned long ulBase, \ unsigned long ulPWMOutBits, \ tBoolean bInvert))ROM_PWMTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMOutputFault \ ((void (*)(unsigned long ulBase, \ unsigned long ulPWMOutBits, \ tBoolean bFaultSuppress))ROM_PWMTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenIntTrigEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned long ulIntTrig))ROM_PWMTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenIntTrigDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned long ulIntTrig))ROM_PWMTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulGen, \ tBoolean bMasked))ROM_PWMTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMGenIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulGen, \ unsigned long ulInts))ROM_PWMTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGenFault))ROM_PWMTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulGenFault))ROM_PWMTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMFaultIntClear \ ((void (*)(unsigned long ulBase))ROM_PWMTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_PWMIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_PWMTABLE[21]) #endif //***************************************************************************** // // Macros for calling ROM functions in the QEI API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIPositionGet \ ((unsigned long (*)(unsigned long ulBase))ROM_QEITABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIEnable \ ((void (*)(unsigned long ulBase))ROM_QEITABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIDisable \ ((void (*)(unsigned long ulBase))ROM_QEITABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulConfig, \ unsigned long ulMaxPosition))ROM_QEITABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIPositionSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulPosition))ROM_QEITABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIDirectionGet \ ((long (*)(unsigned long ulBase))ROM_QEITABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIErrorGet \ ((tBoolean (*)(unsigned long ulBase))ROM_QEITABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIVelocityEnable \ ((void (*)(unsigned long ulBase))ROM_QEITABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIVelocityDisable \ ((void (*)(unsigned long ulBase))ROM_QEITABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIVelocityConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulPreDiv, \ unsigned long ulPeriod))ROM_QEITABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIVelocityGet \ ((unsigned long (*)(unsigned long ulBase))ROM_QEITABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_QEITABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_QEITABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_QEITABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_QEIIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_QEITABLE[14]) #endif //***************************************************************************** // // Macros for calling ROM functions in the SSI API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIDataPut \ ((void (*)(unsigned long ulBase, \ unsigned long ulData))ROM_SSITABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIConfigSetExpClk \ ((void (*)(unsigned long ulBase, \ unsigned long ulSSIClk, \ unsigned long ulProtocol, \ unsigned long ulMode, \ unsigned long ulBitRate, \ unsigned long ulDataWidth))ROM_SSITABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIEnable \ ((void (*)(unsigned long ulBase))ROM_SSITABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIDisable \ ((void (*)(unsigned long ulBase))ROM_SSITABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_SSITABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_SSITABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_SSITABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_SSITABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIDataPutNonBlocking \ ((long (*)(unsigned long ulBase, \ unsigned long ulData))ROM_SSITABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIDataGet \ ((void (*)(unsigned long ulBase, \ unsigned long *pulData))ROM_SSITABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SSIDataGetNonBlocking \ ((long (*)(unsigned long ulBase, \ unsigned long *pulData))ROM_SSITABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UpdateSSI \ ((void (*)(void))ROM_SSITABLE[11]) #endif //***************************************************************************** // // Macros for calling ROM functions in the SysCtl API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlSleep \ ((void (*)(void))ROM_SYSCTLTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlSRAMSizeGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlFlashSizeGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPinPresent \ ((tBoolean (*)(unsigned long ulPin))ROM_SYSCTLTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralPresent \ ((tBoolean (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralReset \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralEnable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralDisable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralSleepEnable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralSleepDisable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralDeepSleepEnable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralDeepSleepDisable \ ((void (*)(unsigned long ulPeripheral))ROM_SYSCTLTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPeripheralClockGating \ ((void (*)(tBoolean bEnable))ROM_SYSCTLTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlIntEnable \ ((void (*)(unsigned long ulInts))ROM_SYSCTLTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlIntDisable \ ((void (*)(unsigned long ulInts))ROM_SYSCTLTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlIntClear \ ((void (*)(unsigned long ulInts))ROM_SYSCTLTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlIntStatus \ ((unsigned long (*)(tBoolean bMasked))ROM_SYSCTLTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlLDOSet \ ((void (*)(unsigned long ulVoltage))ROM_SYSCTLTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlLDOGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlReset \ ((void (*)(void))ROM_SYSCTLTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlDeepSleep \ ((void (*)(void))ROM_SYSCTLTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlResetCauseGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[21]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlResetCauseClear \ ((void (*)(unsigned long ulCauses))ROM_SYSCTLTABLE[22]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlClockSet \ ((void (*)(unsigned long ulConfig))ROM_SYSCTLTABLE[23]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlClockGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[24]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPWMClockSet \ ((void (*)(unsigned long ulConfig))ROM_SYSCTLTABLE[25]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlPWMClockGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[26]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlADCSpeedSet \ ((void (*)(unsigned long ulSpeed))ROM_SYSCTLTABLE[27]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlADCSpeedGet \ ((unsigned long (*)(void))ROM_SYSCTLTABLE[28]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlGPIOAHBEnable \ ((void (*)(unsigned long ulGPIOPeripheral))ROM_SYSCTLTABLE[29]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysCtlGPIOAHBDisable \ ((void (*)(unsigned long ulGPIOPeripheral))ROM_SYSCTLTABLE[30]) #endif //***************************************************************************** // // Macros for calling ROM functions in the SysTick API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickValueGet \ ((unsigned long (*)(void))ROM_SYSTICKTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickEnable \ ((void (*)(void))ROM_SYSTICKTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickDisable \ ((void (*)(void))ROM_SYSTICKTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickIntEnable \ ((void (*)(void))ROM_SYSTICKTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickIntDisable \ ((void (*)(void))ROM_SYSTICKTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickPeriodSet \ ((void (*)(unsigned long ulPeriod))ROM_SYSTICKTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_SysTickPeriodGet \ ((unsigned long (*)(void))ROM_SYSTICKTABLE[6]) #endif //***************************************************************************** // // Macros for calling ROM functions in the Timer API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_TIMERTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerConfigure \ ((void (*)(unsigned long ulBase, \ unsigned long ulConfig))ROM_TIMERTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerControlLevel \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ tBoolean bInvert))ROM_TIMERTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerControlTrigger \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ tBoolean bEnable))ROM_TIMERTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerControlEvent \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ unsigned long ulEvent))ROM_TIMERTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerControlStall \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ tBoolean bStall))ROM_TIMERTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerRTCEnable \ ((void (*)(unsigned long ulBase))ROM_TIMERTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerRTCDisable \ ((void (*)(unsigned long ulBase))ROM_TIMERTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerPrescaleSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ unsigned long ulValue))ROM_TIMERTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerPrescaleGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerLoadSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ unsigned long ulValue))ROM_TIMERTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerLoadGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerValueGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerMatchSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulTimer, \ unsigned long ulValue))ROM_TIMERTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerMatchGet \ ((unsigned long (*)(unsigned long ulBase, \ unsigned long ulTimer))ROM_TIMERTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_TIMERTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_TIMERTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_TimerIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_TIMERTABLE[21]) #endif //***************************************************************************** // // Macros for calling ROM functions in the UART API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTCharPut \ ((void (*)(unsigned long ulBase, \ unsigned char ucData))ROM_UARTTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTParityModeSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulParity))ROM_UARTTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTParityModeGet \ ((unsigned long (*)(unsigned long ulBase))ROM_UARTTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTFIFOLevelSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulTxLevel, \ unsigned long ulRxLevel))ROM_UARTTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTFIFOLevelGet \ ((void (*)(unsigned long ulBase, \ unsigned long *pulTxLevel, \ unsigned long *pulRxLevel))ROM_UARTTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTConfigSetExpClk \ ((void (*)(unsigned long ulBase, \ unsigned long ulUARTClk, \ unsigned long ulBaud, \ unsigned long ulConfig))ROM_UARTTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTConfigGetExpClk \ ((void (*)(unsigned long ulBase, \ unsigned long ulUARTClk, \ unsigned long *pulBaud, \ unsigned long *pulConfig))ROM_UARTTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTEnable \ ((void (*)(unsigned long ulBase))ROM_UARTTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTDisable \ ((void (*)(unsigned long ulBase))ROM_UARTTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTEnableSIR \ ((void (*)(unsigned long ulBase, \ tBoolean bLowPower))ROM_UARTTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTDisableSIR \ ((void (*)(unsigned long ulBase))ROM_UARTTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTCharsAvail \ ((tBoolean (*)(unsigned long ulBase))ROM_UARTTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTSpaceAvail \ ((tBoolean (*)(unsigned long ulBase))ROM_UARTTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTCharGetNonBlocking \ ((long (*)(unsigned long ulBase))ROM_UARTTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTCharGet \ ((long (*)(unsigned long ulBase))ROM_UARTTABLE[14]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTCharPutNonBlocking \ ((tBoolean (*)(unsigned long ulBase, \ unsigned char ucData))ROM_UARTTABLE[15]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTBreakCtl \ ((void (*)(unsigned long ulBase, \ tBoolean bBreakState))ROM_UARTTABLE[16]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTIntEnable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_UARTTABLE[17]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTIntDisable \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_UARTTABLE[18]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_UARTTABLE[19]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UARTIntClear \ ((void (*)(unsigned long ulBase, \ unsigned long ulIntFlags))ROM_UARTTABLE[20]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_UpdateUART \ ((void (*)(void))ROM_UARTTABLE[21]) #endif //***************************************************************************** // // Macros for calling ROM functions in the Watchdog API. // //***************************************************************************** #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogIntClear \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[0]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogRunning \ ((tBoolean (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[1]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogEnable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[2]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogResetEnable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[3]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogResetDisable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[4]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogLock \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[5]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogUnlock \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[6]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogLockState \ ((tBoolean (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[7]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogReloadSet \ ((void (*)(unsigned long ulBase, \ unsigned long ulLoadVal))ROM_WATCHDOGTABLE[8]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogReloadGet \ ((unsigned long (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[9]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogValueGet \ ((unsigned long (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[10]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogIntEnable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[11]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogIntStatus \ ((unsigned long (*)(unsigned long ulBase, \ tBoolean bMasked))ROM_WATCHDOGTABLE[12]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogStallEnable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[13]) #endif #if defined(TARGET_IS_DUSTDEVIL_RA0) #define ROM_WatchdogStallDisable \ ((void (*)(unsigned long ulBase))ROM_WATCHDOGTABLE[14]) #endif #endif // __ROM_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/rom.h
C
oos
64,611
//***************************************************************************** // // ethernet.h - Defines and Macros for the ethernet module. // // Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __ETHERNET_H__ #define __ETHERNET_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to EthernetConfigSet as the ulConfig value, and // returned from EthernetConfigGet. // //***************************************************************************** #define ETH_CFG_TS_TSEN 0x010000 // Enable Timestamp (CCP) #define ETH_CFG_RX_BADCRCDIS 0x000800 // Disable RX BAD CRC Packets #define ETH_CFG_RX_PRMSEN 0x000400 // Enable RX Promiscuous #define ETH_CFG_RX_AMULEN 0x000200 // Enable RX Multicast #define ETH_CFG_TX_DPLXEN 0x000010 // Enable TX Duplex Mode #define ETH_CFG_TX_CRCEN 0x000004 // Enable TX CRC Generation #define ETH_CFG_TX_PADEN 0x000002 // Enable TX Padding //***************************************************************************** // // Values that can be passed to EthernetIntEnable, EthernetIntDisable, and // EthernetIntClear as the ulIntFlags parameter, and returned from // EthernetIntStatus. // //***************************************************************************** #define ETH_INT_PHY 0x040 // PHY Event/Interrupt #define ETH_INT_MDIO 0x020 // Management Transaction #define ETH_INT_RXER 0x010 // RX Error #define ETH_INT_RXOF 0x008 // RX FIFO Overrun #define ETH_INT_TX 0x004 // TX Complete #define ETH_INT_TXER 0x002 // TX Error #define ETH_INT_RX 0x001 // RX Complete //***************************************************************************** // // Helper Macros for Ethernet Processing // //***************************************************************************** // // htonl/ntohl - big endian/little endian byte swapping macros for // 32-bit (long) values // //***************************************************************************** #ifndef htonl #define htonl(a) \ ((((a) >> 24) & 0x000000ff) | \ (((a) >> 8) & 0x0000ff00) | \ (((a) << 8) & 0x00ff0000) | \ (((a) << 24) & 0xff000000)) #endif #ifndef ntohl #define ntohl(a) htonl((a)) #endif //***************************************************************************** // // htons/ntohs - big endian/little endian byte swapping macros for // 16-bit (short) values // //***************************************************************************** #ifndef htons #define htons(a) \ ((((a) >> 8) & 0x00ff) | \ (((a) << 8) & 0xff00)) #endif #ifndef ntohs #define ntohs(a) htons((a)) #endif //***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void EthernetInitExpClk(unsigned long ulBase, unsigned long ulEthClk); extern void EthernetConfigSet(unsigned long ulBase, unsigned long ulConfig); extern unsigned long EthernetConfigGet(unsigned long ulBase); extern void EthernetMACAddrSet(unsigned long ulBase, unsigned char *pucMACAddr); extern void EthernetMACAddrGet(unsigned long ulBase, unsigned char *pucMACAddr); extern void EthernetEnable(unsigned long ulBase); extern void EthernetDisable(unsigned long ulBase); extern tBoolean EthernetPacketAvail(unsigned long ulBase); extern tBoolean EthernetSpaceAvail(unsigned long ulBase); extern long EthernetPacketGetNonBlocking(unsigned long ulBase, unsigned char *pucBuf, long lBufLen); extern long EthernetPacketGet(unsigned long ulBase, unsigned char *pucBuf, long lBufLen); extern long EthernetPacketPutNonBlocking(unsigned long ulBase, unsigned char *pucBuf, long lBufLen); extern long EthernetPacketPut(unsigned long ulBase, unsigned char *pucBuf, long lBufLen); extern void EthernetIntRegister(unsigned long ulBase, void (*pfnHandler)(void)); extern void EthernetIntUnregister(unsigned long ulBase); extern void EthernetIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void EthernetIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long EthernetIntStatus(unsigned long ulBase, tBoolean bMasked); extern void EthernetIntClear(unsigned long ulBase, unsigned long ulIntFlags); extern void EthernetPHYWrite(unsigned long ulBase, unsigned char ucRegAddr, unsigned long ulData); extern unsigned long EthernetPHYRead(unsigned long ulBase, unsigned char ucRegAddr); //***************************************************************************** // // Several Ethernet APIs have been renamed, with the original function name // being deprecated. These defines provide backward compatibility. // //***************************************************************************** #ifndef DEPRECATED #include "sysctl.h" #define EthernetInit(a) \ EthernetInitExpClk(a, SysCtlClockGet()) #define EthernetPacketNonBlockingGet(a, b, c) \ EthernetPacketGetNonBlocking(a, b, c) #define EthernetPacketNonBlockingPut(a, b, c) \ EthernetPacketPutNonBlocking(a, b, c) #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __ETHERNET_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/ethernet.h
C
oos
7,657
//***************************************************************************** // // hw_udma.h - Macros for use in accessing the UDMA registers. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_UDMA_H__ #define __HW_UDMA_H__ //***************************************************************************** // // The following are defines for the Micro Direct Memory Access (uDMA) offsets. // //***************************************************************************** #define UDMA_STAT 0x400FF000 // DMA Status #define UDMA_CFG 0x400FF004 // DMA Configuration #define UDMA_CTLBASE 0x400FF008 // DMA Channel Control Base Pointer #define UDMA_ALTBASE 0x400FF00C // DMA Alternate Channel Control // Base Pointer #define UDMA_WAITSTAT 0x400FF010 // DMA Channel Wait on Request // Status #define UDMA_SWREQ 0x400FF014 // DMA Channel Software Request #define UDMA_USEBURSTSET 0x400FF018 // DMA Channel Useburst Set #define UDMA_USEBURSTCLR 0x400FF01C // DMA Channel Useburst Clear #define UDMA_REQMASKSET 0x400FF020 // DMA Channel Request Mask Set #define UDMA_REQMASKCLR 0x400FF024 // DMA Channel Request Mask Clear #define UDMA_ENASET 0x400FF028 // DMA Channel Enable Set #define UDMA_ENACLR 0x400FF02C // DMA Channel Enable Clear #define UDMA_ALTSET 0x400FF030 // DMA Channel Primary Alternate // Set #define UDMA_ALTCLR 0x400FF034 // DMA Channel Primary Alternate // Clear #define UDMA_PRIOSET 0x400FF038 // DMA Channel Priority Set #define UDMA_PRIOCLR 0x400FF03C // DMA Channel Priority Clear #define UDMA_ERRCLR 0x400FF04C // DMA Bus Error Clear //***************************************************************************** // // Micro Direct Memory Access (uDMA) offsets. // //***************************************************************************** #define UDMA_O_SRCENDP 0x00000000 // DMA Channel Source Address End // Pointer #define UDMA_O_DSTENDP 0x00000004 // DMA Channel Destination Address // End Pointer #define UDMA_O_CHCTL 0x00000008 // DMA Channel Control Word //***************************************************************************** // // The following are defines for the bit fields in the UDMA_O_SRCENDP register. // //***************************************************************************** #define UDMA_SRCENDP_ADDR_M 0xFFFFFFFF // Source Address End Pointer. #define UDMA_SRCENDP_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_STAT register. // //***************************************************************************** #define UDMA_STAT_DMACHANS_M 0x001F0000 // Available DMA Channels Minus 1. #define UDMA_STAT_STATE_M 0x000000F0 // Control State Machine State. #define UDMA_STAT_STATE_IDLE 0x00000000 // Idle #define UDMA_STAT_STATE_RD_CTRL 0x00000010 // Reading channel controller data #define UDMA_STAT_STATE_RD_SRCENDP \ 0x00000020 // Reading source end pointer #define UDMA_STAT_STATE_RD_DSTENDP \ 0x00000030 // Reading destination end pointer #define UDMA_STAT_STATE_RD_SRCDAT \ 0x00000040 // Reading source data #define UDMA_STAT_STATE_WR_DSTDAT \ 0x00000050 // Writing destination data #define UDMA_STAT_STATE_WAIT 0x00000060 // Waiting for DMA request to clear #define UDMA_STAT_STATE_WR_CTRL 0x00000070 // Writing channel controller data #define UDMA_STAT_STATE_STALL 0x00000080 // Stalled #define UDMA_STAT_STATE_DONE 0x00000090 // Done #define UDMA_STAT_STATE_UNDEF 0x000000A0 // Undefined #define UDMA_STAT_MASTEN 0x00000001 // Master Enable. #define UDMA_STAT_DMACHANS_S 16 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_O_DSTENDP register. // //***************************************************************************** #define UDMA_DSTENDP_ADDR_M 0xFFFFFFFF // Destination Address End Pointer. #define UDMA_DSTENDP_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_CFG register. // //***************************************************************************** #define UDMA_CFG_MASTEN 0x00000001 // Controller Master Enable. //***************************************************************************** // // The following are defines for the bit fields in the UDMA_CTLBASE register. // //***************************************************************************** #define UDMA_CTLBASE_ADDR_M 0xFFFFFC00 // Channel Control Base Address. #define UDMA_CTLBASE_ADDR_S 10 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_O_CHCTL register. // //***************************************************************************** #define UDMA_CHCTL_DSTINC_M 0xC0000000 // Destination Address Increment. #define UDMA_CHCTL_DSTINC_8 0x00000000 // Byte #define UDMA_CHCTL_DSTINC_16 0x40000000 // Half-word #define UDMA_CHCTL_DSTINC_32 0x80000000 // Word #define UDMA_CHCTL_DSTINC_NONE 0xC0000000 // No increment #define UDMA_CHCTL_DSTSIZE_M 0x30000000 // Destination Data Size. #define UDMA_CHCTL_DSTSIZE_8 0x00000000 // Byte #define UDMA_CHCTL_DSTSIZE_16 0x10000000 // Half-word #define UDMA_CHCTL_DSTSIZE_32 0x20000000 // Word #define UDMA_CHCTL_SRCINC_M 0x0C000000 // Source Address Increment. #define UDMA_CHCTL_SRCINC_8 0x00000000 // Byte #define UDMA_CHCTL_SRCINC_16 0x04000000 // Half-word #define UDMA_CHCTL_SRCINC_32 0x08000000 // Word #define UDMA_CHCTL_SRCINC_NONE 0x0C000000 // No increment #define UDMA_CHCTL_SRCSIZE_M 0x03000000 // Source Data Size. #define UDMA_CHCTL_SRCSIZE_8 0x00000000 // Byte #define UDMA_CHCTL_SRCSIZE_16 0x01000000 // Half-word #define UDMA_CHCTL_SRCSIZE_32 0x02000000 // Word #define UDMA_CHCTL_ARBSIZE_M 0x0003C000 // Arbitration Size. #define UDMA_CHCTL_ARBSIZE_1 0x00000000 // 1 Transfer #define UDMA_CHCTL_ARBSIZE_2 0x00004000 // 2 Transfers #define UDMA_CHCTL_ARBSIZE_4 0x00008000 // 4 Transfers #define UDMA_CHCTL_ARBSIZE_8 0x0000C000 // 8 Transfers #define UDMA_CHCTL_ARBSIZE_16 0x00010000 // 16 Transfers #define UDMA_CHCTL_ARBSIZE_32 0x00014000 // 32 Transfers #define UDMA_CHCTL_ARBSIZE_64 0x00018000 // 64 Transfers #define UDMA_CHCTL_ARBSIZE_128 0x0001C000 // 128 Transfers #define UDMA_CHCTL_ARBSIZE_256 0x00020000 // 256 Transfers #define UDMA_CHCTL_ARBSIZE_512 0x00024000 // 512 Transfers #define UDMA_CHCTL_ARBSIZE_1024 0x00028000 // 1024 Transfers #define UDMA_CHCTL_XFERSIZE_M 0x00003FF0 // Transfer Size (minus 1). #define UDMA_CHCTL_NXTUSEBURST 0x00000008 // Next Useburst. #define UDMA_CHCTL_XFERMODE_M 0x00000007 // DMA Transfer Mode. #define UDMA_CHCTL_XFERMODE_STOP \ 0x00000000 // Stop #define UDMA_CHCTL_XFERMODE_BASIC \ 0x00000001 // Basic #define UDMA_CHCTL_XFERMODE_AUTO \ 0x00000002 // Auto-Request #define UDMA_CHCTL_XFERMODE_PINGPONG \ 0x00000003 // Ping-Pong #define UDMA_CHCTL_XFERMODE_MEM_SG \ 0x00000004 // Memory Scatter-Gather #define UDMA_CHCTL_XFERMODE_MEM_SGA \ 0x00000005 // Alternate Memory Scatter-Gather #define UDMA_CHCTL_XFERMODE_PER_SG \ 0x00000006 // Peripheral Scatter-Gather #define UDMA_CHCTL_XFERMODE_PER_SGA \ 0x00000007 // Alternate Peripheral // Scatter-Gather #define UDMA_CHCTL_XFERSIZE_S 4 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ALTBASE register. // //***************************************************************************** #define UDMA_ALTBASE_ADDR_M 0xFFFFFFFF // Alternate Channel Address // Pointer. #define UDMA_ALTBASE_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_WAITSTAT register. // //***************************************************************************** #define UDMA_WAITSTAT_WAITREQ_M 0xFFFFFFFF // Channel [n] Wait Status. #define UDMA_WAITSTAT_WAITREQ_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_SWREQ register. // //***************************************************************************** #define UDMA_SWREQ_M 0xFFFFFFFF // Channel [n] Software Request. #define UDMA_SWREQ_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UDMA_USEBURSTSET // register. // //***************************************************************************** #define UDMA_USEBURSTSET_SET_M 0xFFFFFFFF // Channel [n] Useburst Set. #define UDMA_USEBURSTSET_SET__0 0x00000000 // No Effect #define UDMA_USEBURSTSET_SET__1 0x00000001 // Burst Only //***************************************************************************** // // The following are defines for the bit fields in the UDMA_USEBURSTCLR // register. // //***************************************************************************** #define UDMA_USEBURSTCLR_CLR_M 0xFFFFFFFF // Channel [n] Useburst Clear. #define UDMA_USEBURSTCLR_CLR__0 0x00000000 // No Effect #define UDMA_USEBURSTCLR_CLR__1 0x00000001 // Single and Burst //***************************************************************************** // // The following are defines for the bit fields in the UDMA_REQMASKSET // register. // //***************************************************************************** #define UDMA_REQMASKSET_SET_M 0xFFFFFFFF // Channel [n] Request Mask Set. #define UDMA_REQMASKSET_SET__0 0x00000000 // No Effect #define UDMA_REQMASKSET_SET__1 0x00000001 // Masked //***************************************************************************** // // The following are defines for the bit fields in the UDMA_REQMASKCLR // register. // //***************************************************************************** #define UDMA_REQMASKCLR_CLR_M 0xFFFFFFFF // Channel [n] Request Mask Clear. #define UDMA_REQMASKCLR_CLR__0 0x00000000 // No Effect #define UDMA_REQMASKCLR_CLR__1 0x00000001 // Clear Mask //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ENASET register. // //***************************************************************************** #define UDMA_ENASET_SET_M 0xFFFFFFFF // Channel [n] Enable Set. #define UDMA_ENASET_SET__0 0x00000000 // Disabled #define UDMA_ENASET_SET__1 0x00000001 // Enabled #define UDMA_ENASET_CHENSET_M 0xFFFFFFFF // Channel [n] Enable Set. #define UDMA_ENASET_CHENSET__0 0x00000000 // No Effect #define UDMA_ENASET_CHENSET__1 0x00000001 // Enable //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ENACLR register. // //***************************************************************************** #define UDMA_ENACLR_CLR_M 0xFFFFFFFF // Clear Channel [n] Enable. #define UDMA_ENACLR_CLR__0 0x00000000 // No Effect #define UDMA_ENACLR_CLR__1 0x00000001 // Disable //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ALTSET register. // //***************************************************************************** #define UDMA_ALTSET_SET_M 0xFFFFFFFF // Channel [n] Alternate Set. #define UDMA_ALTSET_SET__0 0x00000000 // No Effect #define UDMA_ALTSET_SET__1 0x00000001 // Alternate //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ALTCLR register. // //***************************************************************************** #define UDMA_ALTCLR_CLR_M 0xFFFFFFFF // Channel [n] Alternate Clear. #define UDMA_ALTCLR_CLR__0 0x00000000 // No Effect #define UDMA_ALTCLR_CLR__1 0x00000001 // Primary //***************************************************************************** // // The following are defines for the bit fields in the UDMA_PRIOSET register. // //***************************************************************************** #define UDMA_PRIOSET_SET_M 0xFFFFFFFF // Channel [n] Priority Set. #define UDMA_PRIOSET_SET__0 0x00000000 // No Effect #define UDMA_PRIOSET_SET__1 0x00000001 // High Priority //***************************************************************************** // // The following are defines for the bit fields in the UDMA_PRIOCLR register. // //***************************************************************************** #define UDMA_PRIOCLR_CLR_M 0xFFFFFFFF // Channel [n] Priority Clear. #define UDMA_PRIOCLR_CLR__0 0x00000000 // No Effect #define UDMA_PRIOCLR_CLR__1 0x00000001 // Default Priority //***************************************************************************** // // The following are defines for the bit fields in the UDMA_ERRCLR register. // //***************************************************************************** #define UDMA_ERRCLR_ERRCLR 0x00000001 // DMA Bus Error Status. #endif // __HW_UDMA_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_udma.h
C
oos
15,888
//***************************************************************************** // // hw_uart.h - Macros and defines used when accessing the UART hardware // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_UART_H__ #define __HW_UART_H__ //***************************************************************************** // // The following are defines for the UART Register offsets. // //***************************************************************************** #define UART_O_DR 0x00000000 // Data Register #define UART_O_RSR 0x00000004 // Receive Status Register (read) #define UART_O_ECR 0x00000004 // Error Clear Register (write) #define UART_O_FR 0x00000018 // Flag Register (read only) #define UART_O_ILPR 0x00000020 // UART IrDA Low-Power Register #define UART_O_IBRD 0x00000024 // Integer Baud Rate Divisor Reg #define UART_O_FBRD 0x00000028 // Fractional Baud Rate Divisor Reg #define UART_O_LCRH 0x0000002C // UART Line Control #define UART_O_CTL 0x00000030 // Control Register #define UART_O_IFLS 0x00000034 // Interrupt FIFO Level Select Reg #define UART_O_IM 0x00000038 // Interrupt Mask Set/Clear Reg #define UART_O_RIS 0x0000003C // Raw Interrupt Status Register #define UART_O_MIS 0x00000040 // Masked Interrupt Status Register #define UART_O_ICR 0x00000044 // Interrupt Clear Register #define UART_O_DMACTL 0x00000048 // UART DMA Control //***************************************************************************** // // The following are defines for the Data Register bits // //***************************************************************************** #define UART_DR_OE 0x00000800 // Overrun Error #define UART_DR_BE 0x00000400 // Break Error #define UART_DR_PE 0x00000200 // Parity Error #define UART_DR_FE 0x00000100 // Framing Error #define UART_DR_DATA_M 0x000000FF // Data Transmitted or Received. #define UART_DR_DATA_S 0 //***************************************************************************** // // The following are defines for the Receive Status Register bits // //***************************************************************************** #define UART_RSR_OE 0x00000008 // Overrun Error #define UART_RSR_BE 0x00000004 // Break Error #define UART_RSR_PE 0x00000002 // Parity Error #define UART_RSR_FE 0x00000001 // Framing Error //***************************************************************************** // // The following are defines for the Flag Register bits // //***************************************************************************** #define UART_FR_TXFE 0x00000080 // TX FIFO Empty #define UART_FR_RXFF 0x00000040 // RX FIFO Full #define UART_FR_TXFF 0x00000020 // TX FIFO Full #define UART_FR_RXFE 0x00000010 // RX FIFO Empty #define UART_FR_BUSY 0x00000008 // UART Busy //***************************************************************************** // // The following are defines for the Integer baud-rate divisor // //***************************************************************************** #define UART_IBRD_DIVINT_M 0x0000FFFF // Integer Baud-Rate Divisor. #define UART_IBRD_DIVINT_S 0 //***************************************************************************** // // The following are defines for the Fractional baud-rate divisor // //***************************************************************************** #define UART_FBRD_DIVFRAC_M 0x0000003F // Fractional Baud-Rate Divisor. #define UART_FBRD_DIVFRAC_S 0 //***************************************************************************** // // The following are defines for the Control Register bits // //***************************************************************************** #define UART_CTL_RXE 0x00000200 // Receive Enable #define UART_CTL_TXE 0x00000100 // Transmit Enable #define UART_CTL_LBE 0x00000080 // Loopback Enable #define UART_CTL_SIRLP 0x00000004 // SIR (IrDA) Low Power Enable #define UART_CTL_SIREN 0x00000002 // SIR (IrDA) Enable #define UART_CTL_UARTEN 0x00000001 // UART Enable //***************************************************************************** // // The following are defines for the Interrupt FIFO Level Select Register bits // //***************************************************************************** #define UART_IFLS_RX_M 0x00000038 // RX FIFO Level Interrupt Mask #define UART_IFLS_RX1_8 0x00000000 // 1/8 Full #define UART_IFLS_RX2_8 0x00000008 // 1/4 Full #define UART_IFLS_RX4_8 0x00000010 // 1/2 Full #define UART_IFLS_RX6_8 0x00000018 // 3/4 Full #define UART_IFLS_RX7_8 0x00000020 // 7/8 Full #define UART_IFLS_TX_M 0x00000007 // TX FIFO Level Interrupt Mask #define UART_IFLS_TX1_8 0x00000000 // 1/8 Full #define UART_IFLS_TX2_8 0x00000001 // 1/4 Full #define UART_IFLS_TX4_8 0x00000002 // 1/2 Full #define UART_IFLS_TX6_8 0x00000003 // 3/4 Full #define UART_IFLS_TX7_8 0x00000004 // 7/8 Full //***************************************************************************** // // The following are defines for the Interrupt Mask Set/Clear Register bits // //***************************************************************************** #define UART_IM_OEIM 0x00000400 // Overrun Error Interrupt Mask #define UART_IM_BEIM 0x00000200 // Break Error Interrupt Mask #define UART_IM_PEIM 0x00000100 // Parity Error Interrupt Mask #define UART_IM_FEIM 0x00000080 // Framing Error Interrupt Mask #define UART_IM_RTIM 0x00000040 // Receive Timeout Interrupt Mask #define UART_IM_TXIM 0x00000020 // Transmit Interrupt Mask #define UART_IM_RXIM 0x00000010 // Receive Interrupt Mask //***************************************************************************** // // The following are defines for the Raw Interrupt Status Register // //***************************************************************************** #define UART_RIS_OERIS 0x00000400 // Overrun Error Interrupt Status #define UART_RIS_BERIS 0x00000200 // Break Error Interrupt Status #define UART_RIS_PERIS 0x00000100 // Parity Error Interrupt Status #define UART_RIS_FERIS 0x00000080 // Framing Error Interrupt Status #define UART_RIS_RTRIS 0x00000040 // Receive Timeout Interrupt Status #define UART_RIS_TXRIS 0x00000020 // Transmit Interrupt Status #define UART_RIS_RXRIS 0x00000010 // Receive Interrupt Status //***************************************************************************** // // The following are defines for the Masked Interrupt Status Register // //***************************************************************************** #define UART_MIS_OEMIS 0x00000400 // Overrun Error Interrupt Status #define UART_MIS_BEMIS 0x00000200 // Break Error Interrupt Status #define UART_MIS_PEMIS 0x00000100 // Parity Error Interrupt Status #define UART_MIS_FEMIS 0x00000080 // Framing Error Interrupt Status #define UART_MIS_RTMIS 0x00000040 // Receive Timeout Interrupt Status #define UART_MIS_TXMIS 0x00000020 // Transmit Interrupt Status #define UART_MIS_RXMIS 0x00000010 // Receive Interrupt Status //***************************************************************************** // // The following are defines for the Interrupt Clear Register bits // //***************************************************************************** #define UART_ICR_OEIC 0x00000400 // Overrun Error Interrupt Clear #define UART_ICR_BEIC 0x00000200 // Break Error Interrupt Clear #define UART_ICR_PEIC 0x00000100 // Parity Error Interrupt Clear #define UART_ICR_FEIC 0x00000080 // Framing Error Interrupt Clear #define UART_ICR_RTIC 0x00000040 // Receive Timeout Interrupt Clear #define UART_ICR_TXIC 0x00000020 // Transmit Interrupt Clear #define UART_ICR_RXIC 0x00000010 // Receive Interrupt Clear //***************************************************************************** // // The following are defines for the bit fields in the UART_O_ECR register. // //***************************************************************************** #define UART_ECR_DATA_M 0x000000FF // Error Clear. #define UART_ECR_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UART_O_LCRH register. // //***************************************************************************** #define UART_LCRH_SPS 0x00000080 // UART Stick Parity Select. #define UART_LCRH_WLEN_M 0x00000060 // UART Word Length. #define UART_LCRH_WLEN_5 0x00000000 // 5 bits (default) #define UART_LCRH_WLEN_6 0x00000020 // 6 bits #define UART_LCRH_WLEN_7 0x00000040 // 7 bits #define UART_LCRH_WLEN_8 0x00000060 // 8 bits #define UART_LCRH_FEN 0x00000010 // UART Enable FIFOs. #define UART_LCRH_STP2 0x00000008 // UART Two Stop Bits Select. #define UART_LCRH_EPS 0x00000004 // UART Even Parity Select. #define UART_LCRH_PEN 0x00000002 // UART Parity Enable. #define UART_LCRH_BRK 0x00000001 // UART Send Break. //***************************************************************************** // // The following are defines for the bit fields in the UART_O_ILPR register. // //***************************************************************************** #define UART_ILPR_ILPDVSR_M 0x000000FF // IrDA Low-Power Divisor. #define UART_ILPR_ILPDVSR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the UART_O_DMACTL register. // //***************************************************************************** #define UART_DMACTL_DMAERR 0x00000004 // DMA on Error. #define UART_DMACTL_TXDMAE 0x00000002 // Transmit DMA Enable. #define UART_DMACTL_RXDMAE 0x00000001 // Receive DMA Enable. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the UART Register offsets. // //***************************************************************************** #define UART_O_LCR_H 0x0000002C // Line Control Register, HIGH byte #define UART_O_PeriphID4 0x00000FD0 #define UART_O_PeriphID5 0x00000FD4 #define UART_O_PeriphID6 0x00000FD8 #define UART_O_PeriphID7 0x00000FDC #define UART_O_PeriphID0 0x00000FE0 #define UART_O_PeriphID1 0x00000FE4 #define UART_O_PeriphID2 0x00000FE8 #define UART_O_PeriphID3 0x00000FEC #define UART_O_PCellID0 0x00000FF0 #define UART_O_PCellID1 0x00000FF4 #define UART_O_PCellID2 0x00000FF8 #define UART_O_PCellID3 0x00000FFC //***************************************************************************** // // The following are deprecated defines for the Data Register bits // //***************************************************************************** #define UART_DR_DATA_MASK 0x000000FF // UART data //***************************************************************************** // // The following are deprecated defines for the Integer baud-rate divisor // //***************************************************************************** #define UART_IBRD_DIVINT_MASK 0x0000FFFF // Integer baud-rate divisor //***************************************************************************** // // The following are deprecated defines for the Fractional baud-rate divisor // //***************************************************************************** #define UART_FBRD_DIVFRAC_MASK 0x0000003F // Fractional baud-rate divisor //***************************************************************************** // // The following are deprecated defines for the Line Control Register High bits // //***************************************************************************** #define UART_LCR_H_SPS 0x00000080 // Stick Parity Select #define UART_LCR_H_WLEN 0x00000060 // Word length #define UART_LCR_H_WLEN_5 0x00000000 // 5 bit data #define UART_LCR_H_WLEN_6 0x00000020 // 6 bit data #define UART_LCR_H_WLEN_7 0x00000040 // 7 bit data #define UART_LCR_H_WLEN_8 0x00000060 // 8 bit data #define UART_LCR_H_FEN 0x00000010 // Enable FIFO #define UART_LCR_H_STP2 0x00000008 // Two Stop Bits Select #define UART_LCR_H_EPS 0x00000004 // Even Parity Select #define UART_LCR_H_PEN 0x00000002 // Parity Enable #define UART_LCR_H_BRK 0x00000001 // Send Break //***************************************************************************** // // The following are deprecated defines for the Interrupt FIFO Level Select // Register bits // //***************************************************************************** #define UART_IFLS_RX_MASK 0x00000038 // RX FIFO level mask #define UART_IFLS_TX_MASK 0x00000007 // TX FIFO level mask //***************************************************************************** // // The following are deprecated defines for the Interrupt Clear Register bits // //***************************************************************************** #define UART_RSR_ANY (UART_RSR_OE | UART_RSR_BE | UART_RSR_PE | \ UART_RSR_FE) //***************************************************************************** // // The following are deprecated defines for the Reset Values for UART // Registers. // //***************************************************************************** #define UART_RV_CTL 0x00000300 #define UART_RV_PCellID1 0x000000F0 #define UART_RV_PCellID3 0x000000B1 #define UART_RV_FR 0x00000090 #define UART_RV_PeriphID2 0x00000018 #define UART_RV_IFLS 0x00000012 #define UART_RV_PeriphID0 0x00000011 #define UART_RV_PCellID0 0x0000000D #define UART_RV_PCellID2 0x00000005 #define UART_RV_PeriphID3 0x00000001 #define UART_RV_PeriphID4 0x00000000 #define UART_RV_LCR_H 0x00000000 #define UART_RV_PeriphID6 0x00000000 #define UART_RV_DR 0x00000000 #define UART_RV_RSR 0x00000000 #define UART_RV_ECR 0x00000000 #define UART_RV_PeriphID5 0x00000000 #define UART_RV_RIS 0x00000000 #define UART_RV_FBRD 0x00000000 #define UART_RV_IM 0x00000000 #define UART_RV_MIS 0x00000000 #define UART_RV_ICR 0x00000000 #define UART_RV_PeriphID1 0x00000000 #define UART_RV_PeriphID7 0x00000000 #define UART_RV_IBRD 0x00000000 #endif #endif // __HW_UART_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_uart.h
C
oos
17,084
//***************************************************************************** // // hibernate.h - API definition for the Hibernation module. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HIBERNATE_H__ #define __HIBERNATE_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Macros needed for selecting the clock source for HibernateClockSelect() // //***************************************************************************** #define HIBERNATE_CLOCK_SEL_RAW 0x04 #define HIBERNATE_CLOCK_SEL_DIV128 0x00 //***************************************************************************** // // Macros need to configure wake events for HibernateWakeSet() // //***************************************************************************** #define HIBERNATE_WAKE_PIN 0x10 #define HIBERNATE_WAKE_RTC 0x08 //***************************************************************************** // // Macros needed to configure low battery detect for HibernateLowBatSet() // //***************************************************************************** #define HIBERNATE_LOW_BAT_DETECT 0x20 #define HIBERNATE_LOW_BAT_ABORT 0xA0 //***************************************************************************** // // Macros defining interrupt source bits for the interrupt functions. // //***************************************************************************** #define HIBERNATE_INT_PIN_WAKE 0x08 #define HIBERNATE_INT_LOW_BAT 0x04 #define HIBERNATE_INT_RTC_MATCH_0 0x01 #define HIBERNATE_INT_RTC_MATCH_1 0x02 //***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void HibernateEnableExpClk(unsigned long ulHibClk); extern void HibernateDisable(void); extern void HibernateClockSelect(unsigned long ulClockInput); extern void HibernateRTCEnable(void); extern void HibernateRTCDisable(void); extern void HibernateWakeSet(unsigned long ulWakeFlags); extern unsigned long HibernateWakeGet(void); extern void HibernateLowBatSet(unsigned long ulLowBatFlags); extern unsigned long HibernateLowBatGet(void); extern void HibernateRTCSet(unsigned long ulRTCValue); extern unsigned long HibernateRTCGet(void); extern void HibernateRTCMatch0Set(unsigned long ulMatch); extern unsigned long HibernateRTCMatch0Get(void); extern void HibernateRTCMatch1Set(unsigned long ulMatch); extern unsigned long HibernateRTCMatch1Get(void); extern void HibernateRTCTrimSet(unsigned long ulTrim); extern unsigned long HibernateRTCTrimGet(void); extern void HibernateDataSet(unsigned long *pulData, unsigned long ulCount); extern void HibernateDataGet(unsigned long *pulData, unsigned long ulCount); extern void HibernateRequest(void); extern void HibernateIntEnable(unsigned long ulIntFlags); extern void HibernateIntDisable(unsigned long ulIntFlags); extern void HibernateIntRegister(void (*pfnHandler)(void)); extern void HibernateIntUnregister(void); extern unsigned long HibernateIntStatus(tBoolean bMasked); extern void HibernateIntClear(unsigned long ulIntFlags); extern unsigned int HibernateIsActive(void); //***************************************************************************** // // Several Hibernate module APIs have been renamed, with the original function // name being deprecated. These defines provide backward compatibility. // //***************************************************************************** #ifndef DEPRECATED #include "sysctl.h" #define HibernateEnable(a) \ HibernateEnableExpClk(a, SysCtlClockGet()) #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __HIBERNATE_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hibernate.h
C
oos
5,634
//***************************************************************************** // // watchdog.h - Prototypes for the Watchdog Timer API // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __WATCHDOG_H__ #define __WATCHDOG_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern tBoolean WatchdogRunning(unsigned long ulBase); extern void WatchdogEnable(unsigned long ulBase); extern void WatchdogResetEnable(unsigned long ulBase); extern void WatchdogResetDisable(unsigned long ulBase); extern void WatchdogLock(unsigned long ulBase); extern void WatchdogUnlock(unsigned long ulBase); extern tBoolean WatchdogLockState(unsigned long ulBase); extern void WatchdogReloadSet(unsigned long ulBase, unsigned long ulLoadVal); extern unsigned long WatchdogReloadGet(unsigned long ulBase); extern unsigned long WatchdogValueGet(unsigned long ulBase); extern void WatchdogIntRegister(unsigned long ulBase, void(*pfnHandler)(void)); extern void WatchdogIntUnregister(unsigned long ulBase); extern void WatchdogIntEnable(unsigned long ulBase); extern unsigned long WatchdogIntStatus(unsigned long ulBase, tBoolean bMasked); extern void WatchdogIntClear(unsigned long ulBase); extern void WatchdogStallEnable(unsigned long ulBase); extern void WatchdogStallDisable(unsigned long ulBase); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __WATCHDOG_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/watchdog.h
C
oos
3,273
//***************************************************************************** // // qei.h - Prototypes for the Quadrature Encoder Driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __QEI_H__ #define __QEI_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to QEIConfigure as the ulConfig paramater. // //***************************************************************************** #define QEI_CONFIG_CAPTURE_A 0x00000000 // Count on ChA edges only #define QEI_CONFIG_CAPTURE_A_B 0x00000008 // Count on ChA and ChB edges #define QEI_CONFIG_NO_RESET 0x00000000 // Do not reset on index pulse #define QEI_CONFIG_RESET_IDX 0x00000010 // Reset position on index pulse #define QEI_CONFIG_QUADRATURE 0x00000000 // ChA and ChB are quadrature #define QEI_CONFIG_CLOCK_DIR 0x00000004 // ChA and ChB are clock and dir #define QEI_CONFIG_NO_SWAP 0x00000000 // Do not swap ChA and ChB #define QEI_CONFIG_SWAP 0x00000002 // Swap ChA and ChB //***************************************************************************** // // Values that can be passed to QEIVelocityConfigure as the ulPreDiv parameter. // //***************************************************************************** #define QEI_VELDIV_1 0x00000000 // Predivide by 1 #define QEI_VELDIV_2 0x00000040 // Predivide by 2 #define QEI_VELDIV_4 0x00000080 // Predivide by 4 #define QEI_VELDIV_8 0x000000C0 // Predivide by 8 #define QEI_VELDIV_16 0x00000100 // Predivide by 16 #define QEI_VELDIV_32 0x00000140 // Predivide by 32 #define QEI_VELDIV_64 0x00000180 // Predivide by 64 #define QEI_VELDIV_128 0x000001C0 // Predivide by 128 //***************************************************************************** // // Values that can be passed to QEIEnableInts, QEIDisableInts, and QEIClearInts // as the ulIntFlags parameter, and returned by QEIGetIntStatus. // //***************************************************************************** #define QEI_INTERROR 0x00000008 // Phase error detected #define QEI_INTDIR 0x00000004 // Direction change #define QEI_INTTIMER 0x00000002 // Velocity timer expired #define QEI_INTINDEX 0x00000001 // Index pulse detected //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void QEIEnable(unsigned long ulBase); extern void QEIDisable(unsigned long ulBase); extern void QEIConfigure(unsigned long ulBase, unsigned long ulConfig, unsigned long ulMaxPosition); extern unsigned long QEIPositionGet(unsigned long ulBase); extern void QEIPositionSet(unsigned long ulBase, unsigned long ulPosition); extern long QEIDirectionGet(unsigned long ulBase); extern tBoolean QEIErrorGet(unsigned long ulBase); extern void QEIVelocityEnable(unsigned long ulBase); extern void QEIVelocityDisable(unsigned long ulBase); extern void QEIVelocityConfigure(unsigned long ulBase, unsigned long ulPreDiv, unsigned long ulPeriod); extern unsigned long QEIVelocityGet(unsigned long ulBase); extern void QEIIntRegister(unsigned long ulBase, void (*pfnHandler)(void)); extern void QEIIntUnregister(unsigned long ulBase); extern void QEIIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void QEIIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long QEIIntStatus(unsigned long ulBase, tBoolean bMasked); extern void QEIIntClear(unsigned long ulBase, unsigned long ulIntFlags); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __QEI_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/qei.h
C
oos
5,631
//***************************************************************************** // // hw_ssi.h - Macros used when accessing the SSI hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_SSI_H__ #define __HW_SSI_H__ //***************************************************************************** // // The following are defines for the SSI register offsets. // //***************************************************************************** #define SSI_O_CR0 0x00000000 // Control register 0 #define SSI_O_CR1 0x00000004 // Control register 1 #define SSI_O_DR 0x00000008 // Data register #define SSI_O_SR 0x0000000C // Status register #define SSI_O_CPSR 0x00000010 // Clock prescale register #define SSI_O_IM 0x00000014 // Int mask set and clear register #define SSI_O_RIS 0x00000018 // Raw interrupt register #define SSI_O_MIS 0x0000001C // Masked interrupt register #define SSI_O_ICR 0x00000020 // Interrupt clear register #define SSI_O_DMACTL 0x00000024 // SSI DMA Control //***************************************************************************** // // The following are defines for the bit fields in the SSI Control register 0. // //***************************************************************************** #define SSI_CR0_SCR_M 0x0000FF00 // SSI Serial Clock Rate. #define SSI_CR0_SPH 0x00000080 // SSPCLKOUT phase #define SSI_CR0_SPO 0x00000040 // SSPCLKOUT polarity #define SSI_CR0_FRF_M 0x00000030 // Frame format mask #define SSI_CR0_FRF_MOTO 0x00000000 // Motorola SPI frame format #define SSI_CR0_FRF_TI 0x00000010 // TI sync serial frame format #define SSI_CR0_FRF_NMW 0x00000020 // National Microwire frame format #define SSI_CR0_DSS_M 0x0000000F // SSI Data Size Select. #define SSI_CR0_DSS_4 0x00000003 // 4 bit data #define SSI_CR0_DSS_5 0x00000004 // 5 bit data #define SSI_CR0_DSS_6 0x00000005 // 6 bit data #define SSI_CR0_DSS_7 0x00000006 // 7 bit data #define SSI_CR0_DSS_8 0x00000007 // 8 bit data #define SSI_CR0_DSS_9 0x00000008 // 9 bit data #define SSI_CR0_DSS_10 0x00000009 // 10 bit data #define SSI_CR0_DSS_11 0x0000000A // 11 bit data #define SSI_CR0_DSS_12 0x0000000B // 12 bit data #define SSI_CR0_DSS_13 0x0000000C // 13 bit data #define SSI_CR0_DSS_14 0x0000000D // 14 bit data #define SSI_CR0_DSS_15 0x0000000E // 15 bit data #define SSI_CR0_DSS_16 0x0000000F // 16 bit data #define SSI_CR0_SCR_S 8 //***************************************************************************** // // The following are defines for the bit fields in the SSI Control register 1. // //***************************************************************************** #define SSI_CR1_SOD 0x00000008 // Slave mode output disable #define SSI_CR1_MS 0x00000004 // Master or slave mode select #define SSI_CR1_SSE 0x00000002 // Sync serial port enable #define SSI_CR1_LBM 0x00000001 // Loopback mode //***************************************************************************** // // The following are defines for the bit fields in the SSI Status register. // //***************************************************************************** #define SSI_SR_BSY 0x00000010 // SSI busy #define SSI_SR_RFF 0x00000008 // RX FIFO full #define SSI_SR_RNE 0x00000004 // RX FIFO not empty #define SSI_SR_TNF 0x00000002 // TX FIFO not full #define SSI_SR_TFE 0x00000001 // TX FIFO empty //***************************************************************************** // // The following are defines for the bit fields in the SSI clock prescale // register. // //***************************************************************************** #define SSI_CPSR_CPSDVSR_M 0x000000FF // SSI Clock Prescale Divisor. #define SSI_CPSR_CPSDVSR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_DR register. // //***************************************************************************** #define SSI_DR_DATA_M 0x0000FFFF // SSI Receive/Transmit Data. #define SSI_DR_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_IM register. // //***************************************************************************** #define SSI_IM_TXIM 0x00000008 // SSI Transmit FIFO Interrupt // Mask. #define SSI_IM_RXIM 0x00000004 // SSI Receive FIFO Interrupt Mask. #define SSI_IM_RTIM 0x00000002 // SSI Receive Time-Out Interrupt // Mask. #define SSI_IM_RORIM 0x00000001 // SSI Receive Overrun Interrupt // Mask. //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_RIS register. // //***************************************************************************** #define SSI_RIS_TXRIS 0x00000008 // SSI Transmit FIFO Raw Interrupt // Status. #define SSI_RIS_RXRIS 0x00000004 // SSI Receive FIFO Raw Interrupt // Status. #define SSI_RIS_RTRIS 0x00000002 // SSI Receive Time-Out Raw // Interrupt Status. #define SSI_RIS_RORRIS 0x00000001 // SSI Receive Overrun Raw // Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_MIS register. // //***************************************************************************** #define SSI_MIS_TXMIS 0x00000008 // SSI Transmit FIFO Masked // Interrupt Status. #define SSI_MIS_RXMIS 0x00000004 // SSI Receive FIFO Masked // Interrupt Status. #define SSI_MIS_RTMIS 0x00000002 // SSI Receive Time-Out Masked // Interrupt Status. #define SSI_MIS_RORMIS 0x00000001 // SSI Receive Overrun Masked // Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_ICR register. // //***************************************************************************** #define SSI_ICR_RTIC 0x00000002 // SSI Receive Time-Out Interrupt // Clear. #define SSI_ICR_RORIC 0x00000001 // SSI Receive Overrun Interrupt // Clear. //***************************************************************************** // // The following are defines for the bit fields in the SSI_O_DMACTL register. // //***************************************************************************** #define SSI_DMACTL_TXDMAE 0x00000002 // Transmit DMA Enable. #define SSI_DMACTL_RXDMAE 0x00000001 // Receive DMA Enable. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the bit fields in the SSI Control // register 0. // //***************************************************************************** #define SSI_CR0_SCR 0x0000FF00 // Serial clock rate #define SSI_CR0_FRF_MASK 0x00000030 // Frame format mask #define SSI_CR0_DSS 0x0000000F // Data size select //***************************************************************************** // // The following are deprecated defines for the bit fields in the SSI clock // prescale register. // //***************************************************************************** #define SSI_CPSR_CPSDVSR_MASK 0x000000FF // Clock prescale //***************************************************************************** // // The following are deprecated defines for the SSI controller's FIFO size. // //***************************************************************************** #define TX_FIFO_SIZE (8) // Number of entries in the TX FIFO #define RX_FIFO_SIZE (8) // Number of entries in the RX FIFO //***************************************************************************** // // The following are deprecated defines for the bit fields in the interrupt // mask set and clear, raw interrupt, masked interrupt, and interrupt clear // registers. // //***************************************************************************** #define SSI_INT_TXFF 0x00000008 // TX FIFO interrupt #define SSI_INT_RXFF 0x00000004 // RX FIFO interrupt #define SSI_INT_RXTO 0x00000002 // RX timeout interrupt #define SSI_INT_RXOR 0x00000001 // RX overrun interrupt #endif #endif // __HW_SSI_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_ssi.h
C
oos
11,146
//***************************************************************************** // // sysctl.h - Prototypes for the system control driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __SYSCTL_H__ #define __SYSCTL_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // The following are values that can be passed to the // SysCtlPeripheralPresent(), SysCtlPeripheralEnable(), // SysCtlPeripheralDisable(), and SysCtlPeripheralReset() APIs as the // ulPeripheral parameter. The peripherals in the fourth group (upper nibble // is 3) can only be used with the SysCtlPeripheralPresent() API. // //***************************************************************************** #define SYSCTL_PERIPH_WDOG 0x00000008 // Watchdog #define SYSCTL_PERIPH_HIBERNATE 0x00000040 // Hibernation module #define SYSCTL_PERIPH_ADC 0x00100001 // ADC #define SYSCTL_PERIPH_PWM 0x00100010 // PWM #define SYSCTL_PERIPH_CAN0 0x00100100 // CAN 0 #define SYSCTL_PERIPH_CAN1 0x00100200 // CAN 1 #define SYSCTL_PERIPH_CAN2 0x00100400 // CAN 2 #define SYSCTL_PERIPH_UART0 0x10000001 // UART 0 #define SYSCTL_PERIPH_UART1 0x10000002 // UART 1 #define SYSCTL_PERIPH_UART2 0x10000004 // UART 2 #ifndef DEPRECATED #define SYSCTL_PERIPH_SSI 0x10000010 // SSI #endif #define SYSCTL_PERIPH_SSI0 0x10000010 // SSI 0 #define SYSCTL_PERIPH_SSI1 0x10000020 // SSI 1 #ifndef DEPRECATED #define SYSCTL_PERIPH_QEI 0x10000100 // QEI #endif #define SYSCTL_PERIPH_QEI0 0x10000100 // QEI 0 #define SYSCTL_PERIPH_QEI1 0x10000200 // QEI 1 #ifndef DEPRECATED #define SYSCTL_PERIPH_I2C 0x10001000 // I2C #endif #define SYSCTL_PERIPH_I2C0 0x10001000 // I2C 0 #define SYSCTL_PERIPH_I2C1 0x10004000 // I2C 1 #define SYSCTL_PERIPH_TIMER0 0x10100001 // Timer 0 #define SYSCTL_PERIPH_TIMER1 0x10100002 // Timer 1 #define SYSCTL_PERIPH_TIMER2 0x10100004 // Timer 2 #define SYSCTL_PERIPH_TIMER3 0x10100008 // Timer 3 #define SYSCTL_PERIPH_COMP0 0x10100100 // Analog comparator 0 #define SYSCTL_PERIPH_COMP1 0x10100200 // Analog comparator 1 #define SYSCTL_PERIPH_COMP2 0x10100400 // Analog comparator 2 #define SYSCTL_PERIPH_GPIOA 0x20000001 // GPIO A #define SYSCTL_PERIPH_GPIOB 0x20000002 // GPIO B #define SYSCTL_PERIPH_GPIOC 0x20000004 // GPIO C #define SYSCTL_PERIPH_GPIOD 0x20000008 // GPIO D #define SYSCTL_PERIPH_GPIOE 0x20000010 // GPIO E #define SYSCTL_PERIPH_GPIOF 0x20000020 // GPIO F #define SYSCTL_PERIPH_GPIOG 0x20000040 // GPIO G #define SYSCTL_PERIPH_GPIOH 0x20000080 // GPIO H #define SYSCTL_PERIPH_UDMA 0x20002000 // uDMA #define SYSCTL_PERIPH_USB0 0x20100001 // USB0 #define SYSCTL_PERIPH_ETH 0x20105000 // ETH #define SYSCTL_PERIPH_IEEE1588 0x20100100 // IEEE1588 #define SYSCTL_PERIPH_PLL 0x30000010 // PLL #define SYSCTL_PERIPH_TEMP 0x30000020 // Temperature sensor #define SYSCTL_PERIPH_MPU 0x30000080 // Cortex-M3 MPU //***************************************************************************** // // The following are values that can be passed to the SysCtlPinPresent() API // as the ulPin parameter. // //***************************************************************************** #define SYSCTL_PIN_PWM0 0x00000001 // PWM0 pin #define SYSCTL_PIN_PWM1 0x00000002 // PWM1 pin #define SYSCTL_PIN_PWM2 0x00000004 // PWM2 pin #define SYSCTL_PIN_PWM3 0x00000008 // PWM3 pin #define SYSCTL_PIN_PWM4 0x00000010 // PWM4 pin #define SYSCTL_PIN_PWM5 0x00000020 // PWM5 pin #define SYSCTL_PIN_PWM6 0x00000040 // PWM6 pin #define SYSCTL_PIN_PWM7 0x00000080 // PWM7 pin #define SYSCTL_PIN_C0MINUS 0x00000040 // C0- pin #define SYSCTL_PIN_C0PLUS 0x00000080 // C0+ pin #define SYSCTL_PIN_C0O 0x00000100 // C0o pin #define SYSCTL_PIN_C1MINUS 0x00000200 // C1- pin #define SYSCTL_PIN_C1PLUS 0x00000400 // C1+ pin #define SYSCTL_PIN_C1O 0x00000800 // C1o pin #define SYSCTL_PIN_C2MINUS 0x00001000 // C2- pin #define SYSCTL_PIN_C2PLUS 0x00002000 // C2+ pin #define SYSCTL_PIN_C2O 0x00004000 // C2o pin #define SYSCTL_PIN_MC_FAULT0 0x00008000 // MC0 Fault pin #define SYSCTL_PIN_ADC0 0x00010000 // ADC0 pin #define SYSCTL_PIN_ADC1 0x00020000 // ADC1 pin #define SYSCTL_PIN_ADC2 0x00040000 // ADC2 pin #define SYSCTL_PIN_ADC3 0x00080000 // ADC3 pin #define SYSCTL_PIN_ADC4 0x00100000 // ADC4 pin #define SYSCTL_PIN_ADC5 0x00200000 // ADC5 pin #define SYSCTL_PIN_ADC6 0x00400000 // ADC6 pin #define SYSCTL_PIN_ADC7 0x00800000 // ADC7 pin #define SYSCTL_PIN_CCP0 0x01000000 // CCP0 pin #define SYSCTL_PIN_CCP1 0x02000000 // CCP1 pin #define SYSCTL_PIN_CCP2 0x04000000 // CCP2 pin #define SYSCTL_PIN_CCP3 0x08000000 // CCP3 pin #define SYSCTL_PIN_CCP4 0x10000000 // CCP4 pin #define SYSCTL_PIN_CCP5 0x20000000 // CCP5 pin #define SYSCTL_PIN_32KHZ 0x80000000 // 32kHz pin //***************************************************************************** // // The following are values that can be passed to the SysCtlLDOSet() API as // the ulVoltage value, or returned by the SysCtlLDOGet() API. // //***************************************************************************** #define SYSCTL_LDO_2_25V 0x00000005 // LDO output of 2.25V #define SYSCTL_LDO_2_30V 0x00000004 // LDO output of 2.30V #define SYSCTL_LDO_2_35V 0x00000003 // LDO output of 2.35V #define SYSCTL_LDO_2_40V 0x00000002 // LDO output of 2.40V #define SYSCTL_LDO_2_45V 0x00000001 // LDO output of 2.45V #define SYSCTL_LDO_2_50V 0x00000000 // LDO output of 2.50V #define SYSCTL_LDO_2_55V 0x0000001f // LDO output of 2.55V #define SYSCTL_LDO_2_60V 0x0000001e // LDO output of 2.60V #define SYSCTL_LDO_2_65V 0x0000001d // LDO output of 2.65V #define SYSCTL_LDO_2_70V 0x0000001c // LDO output of 2.70V #define SYSCTL_LDO_2_75V 0x0000001b // LDO output of 2.75V //***************************************************************************** // // The following are values that can be passed to the SysCtlLDOConfigSet() API. // //***************************************************************************** #define SYSCTL_LDOCFG_ARST 0x00000001 // Allow LDO failure to reset #define SYSCTL_LDOCFG_NORST 0x00000000 // Do not reset on LDO failure //***************************************************************************** // // The following are values that can be passed to the SysCtlIntEnable(), // SysCtlIntDisable(), and SysCtlIntClear() APIs, or returned in the bit mask // by the SysCtlIntStatus() API. // //***************************************************************************** #define SYSCTL_INT_PLL_LOCK 0x00000040 // PLL lock interrupt #define SYSCTL_INT_CUR_LIMIT 0x00000020 // Current limit interrupt #define SYSCTL_INT_IOSC_FAIL 0x00000010 // Internal oscillator failure int #define SYSCTL_INT_MOSC_FAIL 0x00000008 // Main oscillator failure int #define SYSCTL_INT_POR 0x00000004 // Power on reset interrupt #define SYSCTL_INT_BOR 0x00000002 // Brown out interrupt #define SYSCTL_INT_PLL_FAIL 0x00000001 // PLL failure interrupt //***************************************************************************** // // The following are values that can be passed to the SysCtlResetCauseClear() // API or returned by the SysCtlResetCauseGet() API. // //***************************************************************************** #define SYSCTL_CAUSE_LDO 0x00000020 // LDO power not OK reset #define SYSCTL_CAUSE_SW 0x00000010 // Software reset #define SYSCTL_CAUSE_WDOG 0x00000008 // Watchdog reset #define SYSCTL_CAUSE_BOR 0x00000004 // Brown-out reset #define SYSCTL_CAUSE_POR 0x00000002 // Power on reset #define SYSCTL_CAUSE_EXT 0x00000001 // External reset //***************************************************************************** // // The following are values that can be passed to the SysCtlBrownOutConfigSet() // API as the ulConfig parameter. // //***************************************************************************** #define SYSCTL_BOR_RESET 0x00000002 // Reset instead of interrupting #define SYSCTL_BOR_RESAMPLE 0x00000001 // Resample BOR before asserting //***************************************************************************** // // The following are values that can be passed to the SysCtlPWMClockSet() API // as the ulConfig parameter, and can be returned by the SysCtlPWMClockGet() // API. // //***************************************************************************** #define SYSCTL_PWMDIV_1 0x00000000 // PWM clock is processor clock /1 #define SYSCTL_PWMDIV_2 0x00100000 // PWM clock is processor clock /2 #define SYSCTL_PWMDIV_4 0x00120000 // PWM clock is processor clock /4 #define SYSCTL_PWMDIV_8 0x00140000 // PWM clock is processor clock /8 #define SYSCTL_PWMDIV_16 0x00160000 // PWM clock is processor clock /16 #define SYSCTL_PWMDIV_32 0x00180000 // PWM clock is processor clock /32 #define SYSCTL_PWMDIV_64 0x001A0000 // PWM clock is processor clock /64 //***************************************************************************** // // The following are values that can be passed to the SysCtlADCSpeedSet() API // as the ulSpeed parameter, and can be returned by the SyCtlADCSpeedGet() // API. // //***************************************************************************** #define SYSCTL_ADCSPEED_1MSPS 0x00000300 // 1,000,000 samples per second #define SYSCTL_ADCSPEED_500KSPS 0x00000200 // 500,000 samples per second #define SYSCTL_ADCSPEED_250KSPS 0x00000100 // 250,000 samples per second #define SYSCTL_ADCSPEED_125KSPS 0x00000000 // 125,000 samples per second //***************************************************************************** // // The following are values that can be passed to the SysCtlClockSet() API as // the ulConfig parameter. // //***************************************************************************** #define SYSCTL_SYSDIV_1 0x07800000 // Processor clock is osc/pll /1 #define SYSCTL_SYSDIV_2 0x00C00000 // Processor clock is osc/pll /2 #define SYSCTL_SYSDIV_3 0x01400000 // Processor clock is osc/pll /3 #define SYSCTL_SYSDIV_4 0x01C00000 // Processor clock is osc/pll /4 #define SYSCTL_SYSDIV_5 0x02400000 // Processor clock is osc/pll /5 #define SYSCTL_SYSDIV_6 0x02C00000 // Processor clock is osc/pll /6 #define SYSCTL_SYSDIV_7 0x03400000 // Processor clock is osc/pll /7 #define SYSCTL_SYSDIV_8 0x03C00000 // Processor clock is osc/pll /8 #define SYSCTL_SYSDIV_9 0x04400000 // Processor clock is osc/pll /9 #define SYSCTL_SYSDIV_10 0x04C00000 // Processor clock is osc/pll /10 #define SYSCTL_SYSDIV_11 0x05400000 // Processor clock is osc/pll /11 #define SYSCTL_SYSDIV_12 0x05C00000 // Processor clock is osc/pll /12 #define SYSCTL_SYSDIV_13 0x06400000 // Processor clock is osc/pll /13 #define SYSCTL_SYSDIV_14 0x06C00000 // Processor clock is osc/pll /14 #define SYSCTL_SYSDIV_15 0x07400000 // Processor clock is osc/pll /15 #define SYSCTL_SYSDIV_16 0x07C00000 // Processor clock is osc/pll /16 #define SYSCTL_SYSDIV_17 0x88400000 // Processor clock is osc/pll /17 #define SYSCTL_SYSDIV_18 0x88C00000 // Processor clock is osc/pll /18 #define SYSCTL_SYSDIV_19 0x89400000 // Processor clock is osc/pll /19 #define SYSCTL_SYSDIV_20 0x89C00000 // Processor clock is osc/pll /20 #define SYSCTL_SYSDIV_21 0x8A400000 // Processor clock is osc/pll /21 #define SYSCTL_SYSDIV_22 0x8AC00000 // Processor clock is osc/pll /22 #define SYSCTL_SYSDIV_23 0x8B400000 // Processor clock is osc/pll /23 #define SYSCTL_SYSDIV_24 0x8BC00000 // Processor clock is osc/pll /24 #define SYSCTL_SYSDIV_25 0x8C400000 // Processor clock is osc/pll /25 #define SYSCTL_SYSDIV_26 0x8CC00000 // Processor clock is osc/pll /26 #define SYSCTL_SYSDIV_27 0x8D400000 // Processor clock is osc/pll /27 #define SYSCTL_SYSDIV_28 0x8DC00000 // Processor clock is osc/pll /28 #define SYSCTL_SYSDIV_29 0x8E400000 // Processor clock is osc/pll /29 #define SYSCTL_SYSDIV_30 0x8EC00000 // Processor clock is osc/pll /30 #define SYSCTL_SYSDIV_31 0x8F400000 // Processor clock is osc/pll /31 #define SYSCTL_SYSDIV_32 0x8FC00000 // Processor clock is osc/pll /32 #define SYSCTL_SYSDIV_33 0x90400000 // Processor clock is osc/pll /33 #define SYSCTL_SYSDIV_34 0x90C00000 // Processor clock is osc/pll /34 #define SYSCTL_SYSDIV_35 0x91400000 // Processor clock is osc/pll /35 #define SYSCTL_SYSDIV_36 0x91C00000 // Processor clock is osc/pll /36 #define SYSCTL_SYSDIV_37 0x92400000 // Processor clock is osc/pll /37 #define SYSCTL_SYSDIV_38 0x92C00000 // Processor clock is osc/pll /38 #define SYSCTL_SYSDIV_39 0x93400000 // Processor clock is osc/pll /39 #define SYSCTL_SYSDIV_40 0x93C00000 // Processor clock is osc/pll /40 #define SYSCTL_SYSDIV_41 0x94400000 // Processor clock is osc/pll /41 #define SYSCTL_SYSDIV_42 0x94C00000 // Processor clock is osc/pll /42 #define SYSCTL_SYSDIV_43 0x95400000 // Processor clock is osc/pll /43 #define SYSCTL_SYSDIV_44 0x95C00000 // Processor clock is osc/pll /44 #define SYSCTL_SYSDIV_45 0x96400000 // Processor clock is osc/pll /45 #define SYSCTL_SYSDIV_46 0x96C00000 // Processor clock is osc/pll /46 #define SYSCTL_SYSDIV_47 0x97400000 // Processor clock is osc/pll /47 #define SYSCTL_SYSDIV_48 0x97C00000 // Processor clock is osc/pll /48 #define SYSCTL_SYSDIV_49 0x98400000 // Processor clock is osc/pll /49 #define SYSCTL_SYSDIV_50 0x98C00000 // Processor clock is osc/pll /50 #define SYSCTL_SYSDIV_51 0x99400000 // Processor clock is osc/pll /51 #define SYSCTL_SYSDIV_52 0x99C00000 // Processor clock is osc/pll /52 #define SYSCTL_SYSDIV_53 0x9A400000 // Processor clock is osc/pll /53 #define SYSCTL_SYSDIV_54 0x9AC00000 // Processor clock is osc/pll /54 #define SYSCTL_SYSDIV_55 0x9B400000 // Processor clock is osc/pll /55 #define SYSCTL_SYSDIV_56 0x9BC00000 // Processor clock is osc/pll /56 #define SYSCTL_SYSDIV_57 0x9C400000 // Processor clock is osc/pll /57 #define SYSCTL_SYSDIV_58 0x9CC00000 // Processor clock is osc/pll /58 #define SYSCTL_SYSDIV_59 0x9D400000 // Processor clock is osc/pll /59 #define SYSCTL_SYSDIV_60 0x9DC00000 // Processor clock is osc/pll /60 #define SYSCTL_SYSDIV_61 0x9E400000 // Processor clock is osc/pll /61 #define SYSCTL_SYSDIV_62 0x9EC00000 // Processor clock is osc/pll /62 #define SYSCTL_SYSDIV_63 0x9F400000 // Processor clock is osc/pll /63 #define SYSCTL_SYSDIV_64 0x9FC00000 // Processor clock is osc/pll /64 #define SYSCTL_USE_PLL 0x00000000 // System clock is the PLL clock #define SYSCTL_USE_OSC 0x00003800 // System clock is the osc clock #define SYSCTL_XTAL_1MHZ 0x00000000 // External crystal is 1MHz #define SYSCTL_XTAL_1_84MHZ 0x00000040 // External crystal is 1.8432MHz #define SYSCTL_XTAL_2MHZ 0x00000080 // External crystal is 2MHz #define SYSCTL_XTAL_2_45MHZ 0x000000C0 // External crystal is 2.4576MHz #define SYSCTL_XTAL_3_57MHZ 0x00000100 // External crystal is 3.579545MHz #define SYSCTL_XTAL_3_68MHZ 0x00000140 // External crystal is 3.6864MHz #define SYSCTL_XTAL_4MHZ 0x00000180 // External crystal is 4MHz #define SYSCTL_XTAL_4_09MHZ 0x000001C0 // External crystal is 4.096MHz #define SYSCTL_XTAL_4_91MHZ 0x00000200 // External crystal is 4.9152MHz #define SYSCTL_XTAL_5MHZ 0x00000240 // External crystal is 5MHz #define SYSCTL_XTAL_5_12MHZ 0x00000280 // External crystal is 5.12MHz #define SYSCTL_XTAL_6MHZ 0x000002C0 // External crystal is 6MHz #define SYSCTL_XTAL_6_14MHZ 0x00000300 // External crystal is 6.144MHz #define SYSCTL_XTAL_7_37MHZ 0x00000340 // External crystal is 7.3728MHz #define SYSCTL_XTAL_8MHZ 0x00000380 // External crystal is 8MHz #define SYSCTL_XTAL_8_19MHZ 0x000003C0 // External crystal is 8.192MHz #define SYSCTL_XTAL_10MHZ 0x00000400 // External crystal is 10 MHz #define SYSCTL_XTAL_12MHZ 0x00000440 // External crystal is 12 MHz #define SYSCTL_XTAL_12_2MHZ 0x00000480 // External crystal is 12.288 MHz #define SYSCTL_XTAL_13_5MHZ 0x000004C0 // External crystal is 13.56 MHz #define SYSCTL_XTAL_14_3MHZ 0x00000500 // External crystal is 14.31818 MHz #define SYSCTL_XTAL_16MHZ 0x00000540 // External crystal is 16 MHz #define SYSCTL_XTAL_16_3MHZ 0x00000580 // External crystal is 16.384 MHz #define SYSCTL_OSC_MAIN 0x00000000 // Oscillator source is main osc #define SYSCTL_OSC_INT 0x00000010 // Oscillator source is int. osc #define SYSCTL_OSC_INT4 0x00000020 // Oscillator source is int. osc /4 #define SYSCTL_OSC_INT30 0x80000030 // Oscillator source is int. 30 KHz #define SYSCTL_OSC_EXT32 0x80000038 // Oscillator source is ext. 32 KHz #define SYSCTL_INT_OSC_DIS 0x00000002 // Disable internal oscillator #define SYSCTL_MAIN_OSC_DIS 0x00000001 // Disable main oscillator //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern unsigned long SysCtlSRAMSizeGet(void); extern unsigned long SysCtlFlashSizeGet(void); extern tBoolean SysCtlPinPresent(unsigned long ulPin); extern tBoolean SysCtlPeripheralPresent(unsigned long ulPeripheral); extern void SysCtlPeripheralReset(unsigned long ulPeripheral); extern void SysCtlPeripheralEnable(unsigned long ulPeripheral); extern void SysCtlPeripheralDisable(unsigned long ulPeripheral); extern void SysCtlPeripheralSleepEnable(unsigned long ulPeripheral); extern void SysCtlPeripheralSleepDisable(unsigned long ulPeripheral); extern void SysCtlPeripheralDeepSleepEnable(unsigned long ulPeripheral); extern void SysCtlPeripheralDeepSleepDisable(unsigned long ulPeripheral); extern void SysCtlPeripheralClockGating(tBoolean bEnable); extern void SysCtlIntRegister(void (*pfnHandler)(void)); extern void SysCtlIntUnregister(void); extern void SysCtlIntEnable(unsigned long ulInts); extern void SysCtlIntDisable(unsigned long ulInts); extern void SysCtlIntClear(unsigned long ulInts); extern unsigned long SysCtlIntStatus(tBoolean bMasked); extern void SysCtlLDOSet(unsigned long ulVoltage); extern unsigned long SysCtlLDOGet(void); extern void SysCtlLDOConfigSet(unsigned long ulConfig); extern void SysCtlReset(void); extern void SysCtlSleep(void); extern void SysCtlDeepSleep(void); extern unsigned long SysCtlResetCauseGet(void); extern void SysCtlResetCauseClear(unsigned long ulCauses); extern void SysCtlBrownOutConfigSet(unsigned long ulConfig, unsigned long ulDelay); extern void SysCtlDelay(unsigned long ulCount); extern void SysCtlClockSet(unsigned long ulConfig); extern unsigned long SysCtlClockGet(void); extern void SysCtlPWMClockSet(unsigned long ulConfig); extern unsigned long SysCtlPWMClockGet(void); extern void SysCtlADCSpeedSet(unsigned long ulSpeed); extern unsigned long SysCtlADCSpeedGet(void); extern void SysCtlIOSCVerificationSet(tBoolean bEnable); extern void SysCtlMOSCVerificationSet(tBoolean bEnable); extern void SysCtlPLLVerificationSet(tBoolean bEnable); extern void SysCtlClkVerificationClear(void); extern void SysCtlGPIOAHBEnable(unsigned long ulGPIOPeripheral); extern void SysCtlGPIOAHBDisable(unsigned long ulGPIOPeripheral); extern void SysCtlUSBPLLEnable(void); extern void SysCtlUSBPLLDisable(void); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __SYSCTL_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/sysctl.h
C
oos
22,420
//***************************************************************************** // // timer.h - Prototypes for the timer module // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __TIMER_H__ #define __TIMER_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to TimerConfigure as the ulConfig parameter. // //***************************************************************************** #define TIMER_CFG_32_BIT_OS 0x00000001 // 32-bit one-shot timer #define TIMER_CFG_32_BIT_PER 0x00000002 // 32-bit periodic timer #define TIMER_CFG_32_RTC 0x01000000 // 32-bit RTC timer #define TIMER_CFG_16_BIT_PAIR 0x04000000 // Two 16-bit timers #define TIMER_CFG_A_ONE_SHOT 0x00000001 // Timer A one-shot timer #define TIMER_CFG_A_PERIODIC 0x00000002 // Timer A periodic timer #define TIMER_CFG_A_CAP_COUNT 0x00000003 // Timer A event counter #define TIMER_CFG_A_CAP_TIME 0x00000007 // Timer A event timer #define TIMER_CFG_A_PWM 0x0000000A // Timer A PWM output #define TIMER_CFG_B_ONE_SHOT 0x00000100 // Timer B one-shot timer #define TIMER_CFG_B_PERIODIC 0x00000200 // Timer B periodic timer #define TIMER_CFG_B_CAP_COUNT 0x00000300 // Timer B event counter #define TIMER_CFG_B_CAP_TIME 0x00000700 // Timer B event timer #define TIMER_CFG_B_PWM 0x00000A00 // Timer B PWM output //***************************************************************************** // // Values that can be passed to TimerIntEnable, TimerIntDisable, and // TimerIntClear as the ulIntFlags parameter, and returned from TimerIntStatus. // //***************************************************************************** #define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt #define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt #define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt #define TIMER_RTC_MATCH 0x00000008 // RTC interrupt mask #define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt //***************************************************************************** // // Values that can be passed to TimerControlEvent as the ulEvent parameter. // //***************************************************************************** #define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges #define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges #define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges //***************************************************************************** // // Values that can be passed to most of the timer APIs as the ulTimer // parameter. // //***************************************************************************** #define TIMER_A 0x000000ff // Timer A #define TIMER_B 0x0000ff00 // Timer B #define TIMER_BOTH 0x0000ffff // Timer Both //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void TimerEnable(unsigned long ulBase, unsigned long ulTimer); extern void TimerDisable(unsigned long ulBase, unsigned long ulTimer); extern void TimerConfigure(unsigned long ulBase, unsigned long ulConfig); extern void TimerControlLevel(unsigned long ulBase, unsigned long ulTimer, tBoolean bInvert); extern void TimerControlTrigger(unsigned long ulBase, unsigned long ulTimer, tBoolean bEnable); extern void TimerControlEvent(unsigned long ulBase, unsigned long ulTimer, unsigned long ulEvent); extern void TimerControlStall(unsigned long ulBase, unsigned long ulTimer, tBoolean bStall); extern void TimerRTCEnable(unsigned long ulBase); extern void TimerRTCDisable(unsigned long ulBase); extern void TimerPrescaleSet(unsigned long ulBase, unsigned long ulTimer, unsigned long ulValue); extern unsigned long TimerPrescaleGet(unsigned long ulBase, unsigned long ulTimer); extern void TimerLoadSet(unsigned long ulBase, unsigned long ulTimer, unsigned long ulValue); extern unsigned long TimerLoadGet(unsigned long ulBase, unsigned long ulTimer); extern unsigned long TimerValueGet(unsigned long ulBase, unsigned long ulTimer); extern void TimerMatchSet(unsigned long ulBase, unsigned long ulTimer, unsigned long ulValue); extern unsigned long TimerMatchGet(unsigned long ulBase, unsigned long ulTimer); extern void TimerIntRegister(unsigned long ulBase, unsigned long ulTimer, void (*pfnHandler)(void)); extern void TimerIntUnregister(unsigned long ulBase, unsigned long ulTimer); extern void TimerIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void TimerIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long TimerIntStatus(unsigned long ulBase, tBoolean bMasked); extern void TimerIntClear(unsigned long ulBase, unsigned long ulIntFlags); //***************************************************************************** // // TimerQuiesce() has been deprecated. SysCtlPeripheralReset() should be used // instead to return the timer to its reset state. // //***************************************************************************** #ifndef DEPRECATED extern void TimerQuiesce(unsigned long ulBase); #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __TIMER_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/timer.h
C
oos
7,703
//***************************************************************************** // // flash.h - Prototypes for the flash driver. // // Copyright (c) 2005-2007 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. Any use in violation // of the foregoing restrictions may subject the user to criminal sanctions // under applicable laws, as well as to civil liability for the breach of the // terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 1582 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __FLASH_H__ #define __FLASH_H__ #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to FlashProtectSet(), and returned by // FlashProtectGet(). // //***************************************************************************** typedef enum { FlashReadWrite, // Flash can be read and written FlashReadOnly, // Flash can only be read FlashExecuteOnly // Flash can only be executed } tFlashProtection; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern unsigned long FlashUsecGet(void); extern void FlashUsecSet(unsigned long ulClocks); extern long FlashErase(unsigned long ulAddress); extern long FlashProgram(unsigned long *pulData, unsigned long ulAddress, unsigned long ulCount); extern tFlashProtection FlashProtectGet(unsigned long ulAddress); extern long FlashProtectSet(unsigned long ulAddress, tFlashProtection eProtect); extern long FlashProtectSave(void); extern long FlashUserGet(unsigned long *pulUser0, unsigned long *pulUser1); extern long FlashUserSet(unsigned long ulUser0, unsigned long ulUser1); extern long FlashUserSave(void); extern void FlashIntRegister(void (*pfnHandler)(void)); extern void FlashIntUnregister(void); extern void FlashIntEnable(unsigned long ulIntFlags); extern void FlashIntDisable(unsigned long ulIntFlags); extern unsigned long FlashIntGetStatus(tBoolean bMasked); extern void FlashIntClear(unsigned long ulIntFlags); #ifdef __cplusplus } #endif #endif // __FLASH_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/lmi_flash.h
C
oos
3,135
//***************************************************************************** // // mpu.h - Defines and Macros for the memory protection unit. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __MPU_H__ #define __MPU_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Flags that can be passed to MPUEnable.. // //***************************************************************************** #define MPU_CONFIG_PRIV_DEFAULT 4 #define MPU_CONFIG_HARDFLT_NMI 2 #define MPU_CONFIG_NONE 0 //***************************************************************************** // // Flags for the region size to be passed to MPURegionSet. // //***************************************************************************** #define MPU_RGN_SIZE_32B (4 << 1) #define MPU_RGN_SIZE_64B (5 << 1) #define MPU_RGN_SIZE_128B (6 << 1) #define MPU_RGN_SIZE_256B (7 << 1) #define MPU_RGN_SIZE_512B (8 << 1) #define MPU_RGN_SIZE_1K (9 << 1) #define MPU_RGN_SIZE_2K (10 << 1) #define MPU_RGN_SIZE_4K (11 << 1) #define MPU_RGN_SIZE_8K (12 << 1) #define MPU_RGN_SIZE_16K (13 << 1) #define MPU_RGN_SIZE_32K (14 << 1) #define MPU_RGN_SIZE_64K (15 << 1) #define MPU_RGN_SIZE_128K (16 << 1) #define MPU_RGN_SIZE_256K (17 << 1) #define MPU_RGN_SIZE_512K (18 << 1) #define MPU_RGN_SIZE_1M (19 << 1) #define MPU_RGN_SIZE_2M (20 << 1) #define MPU_RGN_SIZE_4M (21 << 1) #define MPU_RGN_SIZE_8M (22 << 1) #define MPU_RGN_SIZE_16M (23 << 1) #define MPU_RGN_SIZE_32M (24 << 1) #define MPU_RGN_SIZE_64M (25 << 1) #define MPU_RGN_SIZE_128M (26 << 1) #define MPU_RGN_SIZE_256M (27 << 1) #define MPU_RGN_SIZE_512M (28 << 1) #define MPU_RGN_SIZE_1G (29 << 1) #define MPU_RGN_SIZE_2G (30 << 1) #define MPU_RGN_SIZE_4G (31 << 1) //***************************************************************************** // // Flags for the permissions to be passed to MPURegionSet. // //***************************************************************************** #define MPU_RGN_PERM_EXEC 0x00000000 #define MPU_RGN_PERM_NOEXEC 0x10000000 #define MPU_RGN_PERM_PRV_NO_USR_NO 0x00000000 #define MPU_RGN_PERM_PRV_RW_USR_NO 0x01000000 #define MPU_RGN_PERM_PRV_RW_USR_RO 0x02000000 #define MPU_RGN_PERM_PRV_RW_USR_RW 0x03000000 #define MPU_RGN_PERM_PRV_RO_USR_NO 0x05000000 #define MPU_RGN_PERM_PRV_RO_USR_RO 0x06000000 //***************************************************************************** // // Flags for the sub-region to be passed to MPURegionSet. // //***************************************************************************** #define MPU_SUB_RGN_DISABLE_0 0x00000100 #define MPU_SUB_RGN_DISABLE_1 0x00000200 #define MPU_SUB_RGN_DISABLE_2 0x00000400 #define MPU_SUB_RGN_DISABLE_3 0x00000800 #define MPU_SUB_RGN_DISABLE_4 0x00001000 #define MPU_SUB_RGN_DISABLE_5 0x00002000 #define MPU_SUB_RGN_DISABLE_6 0x00004000 #define MPU_SUB_RGN_DISABLE_7 0x00008000 //***************************************************************************** // // Flags to enable or disable a region, to be passed to MPURegionSet. // //***************************************************************************** #define MPU_RGN_ENABLE 1 #define MPU_RGN_DISABLE 0 //***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void MPUEnable(unsigned long ulMPUConfig); extern void MPUDisable(void); extern unsigned long MPURegionCountGet(void); extern void MPURegionEnable(unsigned long ulRegion); extern void MPURegionDisable(unsigned long ulRegion); extern void MPURegionSet(unsigned long ulRegion, unsigned long ulAddr, unsigned long ulFlags); extern void MPURegionGet(unsigned long ulRegion, unsigned long *pulAddr, unsigned long *pulFlags); extern void MPUIntRegister(void (*pfnHandler)(void)); extern void MPUIntUnregister(void); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __MPU_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/mpu.h
C
oos
6,255
//***************************************************************************** // // ustdlib.c - Simple standard library functions. // // Copyright (c) 2007 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. Any use in violation // of the foregoing restrictions may subject the user to criminal sanctions // under applicable laws, as well as to civil liability for the breach of the // terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // //***************************************************************************** #include <stdarg.h> #include <string.h> #include "debug.h" //***************************************************************************** // //! \addtogroup utilities_api //! @{ // //***************************************************************************** //***************************************************************************** // // A mapping from an integer between 0 and 15 to its ASCII character // equivalent. // //***************************************************************************** static const char * const g_pcHex = "0123456789abcdef"; //***************************************************************************** // //! A simple vsnprintf function supporting \%c, \%d, \%s, \%u, \%x, and \%X. //! //! \param pcBuf points to the buffer where the converted string is stored. //! \param ulSize is the size of the buffer. //! \param pcString is the format string. //! \param vaArgP is the list of optional arguments, which depend on the //! contents of the format string. //! //! This function is very similar to the C library <tt>vsnprintf()</tt> //! function. Only the following formatting characters are supported: //! //! - \%c to print a character //! - \%d to print a decimal value //! - \%s to print a string //! - \%u to print an unsigned decimal value //! - \%x to print a hexadecimal value using lower case letters //! - \%X to print a hexadecimal value using lower case letters (not upper case //! letters as would typically be used) //! - \%\% to print out a \% character //! //! For \%d, \%u, \%x, and \%X, an optional number may reside between the \% //! and the format character, which specifies the minimum number of characters //! to use for that value; if preceeded by a 0 then the extra characters will //! be filled with zeros instead of spaces. For example, ``\%8d'' will use //! eight characters to print the decimal value with spaces added to reach //! eight; ``\%08d'' will use eight characters as well but will add zeros //! instead of spaces. //! //! The type of the arguments after \b pcString must match the requirements of //! the format string. For example, if an integer was passed where a string //! was expected, an error of some kind will most likely occur. //! //! The \b ulSize parameter limits the number of characters that will be //! stored in the buffer pointed to by \b pcBuf to prevent the possibility //! of a buffer overflow. The buffer size should be large enough to hold //! the expected converted output string, including the null termination //! character. //! //! The function will return the number of characters that would be //! converted as if there were no limit on the buffer size. Therefore //! it is possible for the function to return a count that is greater than //! the specified buffer size. If this happens, it means that the output //! was truncated. //! //! \return the number of characters that were to be stored, not including //! the NULL termination character, regardless of space in the buffer. // //***************************************************************************** int uvsnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, va_list vaArgP) { unsigned long ulIdx, ulValue, ulCount, ulBase; char *pcStr, cFill; int iConvertCount = 0; // // Check the arguments. // ASSERT(pcString != 0); ASSERT(pcBuf != 0); ASSERT(ulSize != 0); // // Adjust buffer size limit to allow one space for null termination. // if(ulSize) { ulSize--; } // // Initialize the count of characters converted. // iConvertCount = 0; // // Loop while there are more characters in the format string. // while(*pcString) { // // Find the first non-% character, or the end of the string. // for(ulIdx = 0; (pcString[ulIdx] != '%') && (pcString[ulIdx] != '\0'); ulIdx++) { } // // Write this portion of the string to the output buffer. If // there are more characters to write than there is space in the // buffer, then only write as much as will fit in the buffer. // if(ulIdx > ulSize) { strncpy(pcBuf, pcString, ulSize); pcBuf += ulSize; ulSize = 0; } else { strncpy(pcBuf, pcString, ulIdx); pcBuf += ulIdx; ulSize -= ulIdx; } // // Update the conversion count. This will be the number of // characters that should have been written, even if there was // not room in the buffer. // iConvertCount += ulIdx; // // Skip the portion of the format string that was written. // pcString += ulIdx; // // See if the next character is a %. // if(*pcString == '%') { // // Skip the %. // pcString++; // // Set the digit count to zero, and the fill character to space // (i.e. to the defaults). // ulCount = 0; cFill = ' '; // // It may be necessary to get back here to process more characters. // Goto's aren't pretty, but effective. I feel extremely dirty for // using not one but two of the beasts. // again: // // Determine how to handle the next character. // switch(*pcString++) { // // Handle the digit characters. // case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { // // If this is a zero, and it is the first digit, then the // fill character is a zero instead of a space. // if((pcString[-1] == '0') && (ulCount == 0)) { cFill = '0'; } // // Update the digit count. // ulCount *= 10; ulCount += pcString[-1] - '0'; // // Get the next character. // goto again; } // // Handle the %c command. // case 'c': { // // Get the value from the varargs. // ulValue = va_arg(vaArgP, unsigned long); // // Copy the character to the output buffer, if // there is room. Update the buffer size remaining. // if(ulSize != 0) { *pcBuf++ = (char)ulValue; ulSize--; } // // Update the conversion count. // iConvertCount++; // // This command has been handled. // break; } // // Handle the %d command. // case 'd': { // // Get the value from the varargs. // ulValue = va_arg(vaArgP, unsigned long); // // If the value is negative, make it positive and stick a // minus sign in the beginning of the buffer. // if((long)ulValue < 0) { ulValue = -(long)ulValue; if(ulSize != 0) { *pcBuf++ = '-'; ulSize--; } // // Update the conversion count. // iConvertCount++; } // // Set the base to 10. // ulBase = 10; // // Convert the value to ASCII. // goto convert; } // // Handle the %s command. // case 's': { // // Get the string pointer from the varargs. // pcStr = va_arg(vaArgP, char *); // // Determine the length of the string. // for(ulIdx = 0; pcStr[ulIdx] != '\0'; ulIdx++) { } // // Copy the string to the output buffer. Only copy // as much as will fit in the buffer. Update the // output buffer pointer and the space remaining. // if(ulIdx > ulSize) { strncpy(pcBuf, pcStr, ulSize); pcBuf += ulSize; ulSize = 0; } else { strncpy(pcBuf, pcStr, ulIdx); pcBuf += ulIdx; ulSize -= ulIdx; } // // Update the conversion count. This will be the number of // characters that should have been written, even if there // was not room in the buffer. // iConvertCount += ulIdx; // // // This command has been handled. // break; } // // Handle the %u command. // case 'u': { // // Get the value from the varargs. // ulValue = va_arg(vaArgP, unsigned long); // // Set the base to 10. // ulBase = 10; // // Convert the value to ASCII. // goto convert; } // // Handle the %x and %X commands. Note that they are treated // identically; i.e. %X will use lower case letters for a-f // instead of the upper case letters is should use. // case 'x': case 'X': { // // Get the value from the varargs. // ulValue = va_arg(vaArgP, unsigned long); // // Set the base to 16. // ulBase = 16; // // Determine the number of digits in the string version of // the value. // convert: for(ulIdx = 1; (((ulIdx * ulBase) <= ulValue) && (((ulIdx * ulBase) / ulBase) == ulIdx)); ulIdx *= ulBase, ulCount--) { } // // Provide additional padding at the beginning of the // string conversion if needed. // if((ulCount > 1) && (ulCount < 16)) { for(ulCount--; ulCount; ulCount--) { // // Copy the character to the output buffer if // there is room. // if(ulSize != 0) { *pcBuf++ = cFill; ulSize--; } // // Update the conversion count. // iConvertCount++; } } // // Convert the value into a string. // for(; ulIdx; ulIdx /= ulBase) { // // Copy the character to the output buffer if // there is room. // if(ulSize != 0) { *pcBuf++ = g_pcHex[(ulValue / ulIdx) % ulBase]; ulSize--; } // // Update the conversion count. // iConvertCount++; } // // This command has been handled. // break; } // // Handle the %% command. // case '%': { // // Simply write a single %. // if(ulSize != 0) { *pcBuf++ = pcString[-1]; ulSize--; } // // Update the conversion count. // iConvertCount++; // // This command has been handled. // break; } // // Handle all other commands. // default: { // // Indicate an error. // if(ulSize >= 5) { strncpy(pcBuf, "ERROR", 5); pcBuf += 5; ulSize -= 5; } else { strncpy(pcBuf, "ERROR", ulSize); pcBuf += ulSize; ulSize = 0; } // // Update the conversion count. // iConvertCount += 5; // // This command has been handled. // break; } } } } // // Null terminate the string in the buffer. // *pcBuf = 0; return(iConvertCount); } //***************************************************************************** // //! A simple sprintf function supporting \%c, \%d, \%s, \%u, \%x, and \%X. //! //! \param pcBuf is the buffer where the converted string is stored. //! \param pcString is the format string. //! \param ... are the optional arguments, which depend on the contents of the //! format string. //! //! This function is very similar to the C library <tt>sprintf()</tt> function. //! Only the following formatting characters are supported: //! //! - \%c to print a character //! - \%d to print a decimal value //! - \%s to print a string //! - \%u to print an unsigned decimal value //! - \%x to print a hexadecimal value using lower case letters //! - \%X to print a hexadecimal value using lower case letters (not upper case //! letters as would typically be used) //! - \%\% to print out a \% character //! //! For \%d, \%u, \%x, and \%X, an optional number may reside between the \% //! and the format character, which specifies the minimum number of characters //! to use for that value; if preceeded by a 0 then the extra characters will //! be filled with zeros instead of spaces. For example, ``\%8d'' will use //! eight characters to print the decimal value with spaces added to reach //! eight; ``\%08d'' will use eight characters as well but will add zeros //! instead of spaces. //! //! The type of the arguments after \b pcString must match the requirements of //! the format string. For example, if an integer was passed where a string //! was expected, an error of some kind will most likely occur. //! //! The caller must ensure that the buffer pcBuf is large enough to hold the //! entire converted string, including the null termination character. //! //! \return The count of characters that were written to the output buffer, //! not including the NULL termination character. // //***************************************************************************** int usprintf(char *pcBuf, const char *pcString, ...) { va_list vaArgP; int iRet; // // Start the varargs processing. // va_start(vaArgP, pcString); // // Call vsnprintf to perform the conversion. Use a // large number for the buffer size. // iRet = uvsnprintf(pcBuf, 0xffff, pcString, vaArgP); // // End the varargs processing. // va_end(vaArgP); // // Return the conversion count. // return(iRet); } //***************************************************************************** // //! A simple snprintf function supporting \%c, \%d, \%s, \%u, \%x, and \%X. //! //! \param pcBuf is the buffer where the converted string is stored. //! \param ulSize is the size of the buffer. //! \param pcString is the format string. //! \param ... are the optional arguments, which depend on the contents of the //! format string. //! //! This function is very similar to the C library <tt>sprintf()</tt> function. //! Only the following formatting characters are supported: //! //! - \%c to print a character //! - \%d to print a decimal value //! - \%s to print a string //! - \%u to print an unsigned decimal value //! - \%x to print a hexadecimal value using lower case letters //! - \%X to print a hexadecimal value using lower case letters (not upper case //! letters as would typically be used) //! - \%\% to print out a \% character //! //! For \%d, \%u, \%x, and \%X, an optional number may reside between the \% //! and the format character, which specifies the minimum number of characters //! to use for that value; if preceeded by a 0 then the extra characters will //! be filled with zeros instead of spaces. For example, ``\%8d'' will use //! eight characters to print the decimal value with spaces added to reach //! eight; ``\%08d'' will use eight characters as well but will add zeros //! instead of spaces. //! //! The type of the arguments after \b pcString must match the requirements of //! the format string. For example, if an integer was passed where a string //! was expected, an error of some kind will most likely occur. //! //! The function will copy at most \b ulSize - 1 characters into the //! buffer \b pcBuf. One space is reserved in the buffer for the null //! termination character. //! //! The function will return the number of characters that would be //! converted as if there were no limit on the buffer size. Therefore //! it is possible for the function to return a count that is greater than //! the specified buffer size. If this happens, it means that the output //! was truncated. //! //! \return the number of characters that were to be stored, not including //! the NULL termination character, regardless of space in the buffer. // //***************************************************************************** int usnprintf(char *pcBuf, unsigned long ulSize, const char *pcString, ...) { int iRet; va_list vaArgP; // // Start the varargs processing. // va_start(vaArgP, pcString); // // Call vsnprintf to perform the conversion. // iRet = uvsnprintf(pcBuf, ulSize, pcString, vaArgP); // // End the varargs processing. // va_end(vaArgP); // // Return the conversion count. // return(iRet); } //***************************************************************************** // // Close the Doxygen group. //! @} // //*****************************************************************************
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/ustdlib.c
C
oos
22,782
//***************************************************************************** // // debug.h - Macros for assisting debug of the driver library. // // Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __DEBUG_H__ #define __DEBUG_H__ //***************************************************************************** // // Prototype for the function that is called when an invalid argument is passed // to an API. This is only used when doing a DEBUG build. // //***************************************************************************** extern void __error__(char *pcFilename, unsigned long ulLine); //***************************************************************************** // // The ASSERT macro, which does the actual assertion checking. Typically, this // will be for procedure arguments. // //***************************************************************************** #ifdef DEBUG #define ASSERT(expr) { \ if(!(expr)) \ { \ __error__(__FILE__, __LINE__); \ } \ } #else #define ASSERT(expr) #endif #endif // __DEBUG_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/debug.h
C
oos
2,525
//***************************************************************************** // // ssi.h - Prototypes for the Synchronous Serial Interface Driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __SSI_H__ #define __SSI_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to SSIIntEnable, SSIIntDisable, and SSIIntClear // as the ulIntFlags parameter, and returned by SSIIntStatus. // //***************************************************************************** #define SSI_TXFF 0x00000008 // TX FIFO half empty or less #define SSI_RXFF 0x00000004 // RX FIFO half full or less #define SSI_RXTO 0x00000002 // RX timeout #define SSI_RXOR 0x00000001 // RX overrun //***************************************************************************** // // Values that can be passed to SSIConfigSetExpClk. // //***************************************************************************** #define SSI_FRF_MOTO_MODE_0 0x00000000 // Moto fmt, polarity 0, phase 0 #define SSI_FRF_MOTO_MODE_1 0x00000002 // Moto fmt, polarity 0, phase 1 #define SSI_FRF_MOTO_MODE_2 0x00000001 // Moto fmt, polarity 1, phase 0 #define SSI_FRF_MOTO_MODE_3 0x00000003 // Moto fmt, polarity 1, phase 1 #define SSI_FRF_TI 0x00000010 // TI frame format #define SSI_FRF_NMW 0x00000020 // National MicroWire frame format #define SSI_MODE_MASTER 0x00000000 // SSI master #define SSI_MODE_SLAVE 0x00000001 // SSI slave #define SSI_MODE_SLAVE_OD 0x00000002 // SSI slave with output disabled //***************************************************************************** // // Values that can be passed to SSIDMAEnable() and SSIDMADisable(). // //***************************************************************************** #define SSI_DMA_TX 0x00000002 // Enable DMA for transmit #define SSI_DMA_RX 0x00000001 // Enable DMA for receive //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void SSIConfigSetExpClk(unsigned long ulBase, unsigned long ulSSIClk, unsigned long ulProtocol, unsigned long ulMode, unsigned long ulBitRate, unsigned long ulDataWidth); extern void SSIDataGet(unsigned long ulBase, unsigned long *pulData); extern long SSIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData); extern void SSIDataPut(unsigned long ulBase, unsigned long ulData); extern long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData); extern void SSIDisable(unsigned long ulBase); extern void SSIEnable(unsigned long ulBase); extern void SSIIntClear(unsigned long ulBase, unsigned long ulIntFlags); extern void SSIIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern void SSIIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void SSIIntRegister(unsigned long ulBase, void(*pfnHandler)(void)); extern unsigned long SSIIntStatus(unsigned long ulBase, tBoolean bMasked); extern void SSIIntUnregister(unsigned long ulBase); extern void SSIDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags); extern void SSIDMADisable(unsigned long ulBase, unsigned long ulDMAFlags); //***************************************************************************** // // Several SSI APIs have been renamed, with the original function name being // deprecated. These defines provide backward compatibility. // //***************************************************************************** #ifndef DEPRECATED #include "sysctl.h" #define SSIConfig(a, b, c, d, e) \ SSIConfigSetExpClk(a, SysCtlClockGet(), b, c, d, e) #define SSIDataNonBlockingGet(a, b) \ SSIDataGetNonBlocking(a, b) #define SSIDataNonBlockingPut(a, b) \ SSIDataPutNonBlocking(a, b) #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __SSI_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/ssi.h
C
oos
6,016
//***************************************************************************** // // hw_i2c.h - Macros used when accessing the I2C master and slave hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_I2C_H__ #define __HW_I2C_H__ //***************************************************************************** // // The following are defines for the offsets between the I2C master and slave // registers. // //***************************************************************************** #define I2C_O_MSA 0x00000000 // I2C Master Slave Address #define I2C_O_SOAR 0x00000000 // I2C Slave Own Address #define I2C_O_SCSR 0x00000004 // I2C Slave Control/Status #define I2C_O_MCS 0x00000004 // I2C Master Control/Status #define I2C_O_SDR 0x00000008 // I2C Slave Data #define I2C_O_MDR 0x00000008 // I2C Master Data #define I2C_O_MTPR 0x0000000C // I2C Master Timer Period #define I2C_O_SIMR 0x0000000C // I2C Slave Interrupt Mask #define I2C_O_SRIS 0x00000010 // I2C Slave Raw Interrupt Status #define I2C_O_MIMR 0x00000010 // I2C Master Interrupt Mask #define I2C_O_MRIS 0x00000014 // I2C Master Raw Interrupt Status #define I2C_O_SMIS 0x00000014 // I2C Slave Masked Interrupt // Status #define I2C_O_SICR 0x00000018 // I2C Slave Interrupt Clear #define I2C_O_MMIS 0x00000018 // I2C Master Masked Interrupt // Status #define I2C_O_MICR 0x0000001C // I2C Master Interrupt Clear #define I2C_O_MCR 0x00000020 // I2C Master Configuration //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MSA register. // //***************************************************************************** #define I2C_MSA_SA_M 0x000000FE // I2C Slave Address. #define I2C_MSA_RS 0x00000001 // Receive not Send #define I2C_MSA_SA_S 1 //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SOAR register. // //***************************************************************************** #define I2C_SOAR_OAR_M 0x0000007F // I2C Slave Own Address. #define I2C_SOAR_OAR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SCSR register. // //***************************************************************************** #define I2C_SCSR_FBR 0x00000004 // First Byte Received. #define I2C_SCSR_TREQ 0x00000002 // Transmit Request. #define I2C_SCSR_DA 0x00000001 // Device Active. #define I2C_SCSR_RREQ 0x00000001 // Receive Request. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MCS register. // //***************************************************************************** #define I2C_MCS_BUSBSY 0x00000040 // Bus Busy. #define I2C_MCS_IDLE 0x00000020 // I2C Idle. #define I2C_MCS_ARBLST 0x00000010 // Arbitration Lost. #define I2C_MCS_ACK 0x00000008 // Data Acknowledge Enable. #define I2C_MCS_DATACK 0x00000008 // Acknowledge Data. #define I2C_MCS_ADRACK 0x00000004 // Acknowledge Address. #define I2C_MCS_STOP 0x00000004 // Generate STOP. #define I2C_MCS_START 0x00000002 // Generate START. #define I2C_MCS_ERROR 0x00000002 // Error. #define I2C_MCS_RUN 0x00000001 // I2C Master Enable. #define I2C_MCS_BUSY 0x00000001 // I2C Busy. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SDR register. // //***************************************************************************** #define I2C_SDR_DATA_M 0x000000FF // Data for Transfer. #define I2C_SDR_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MDR register. // //***************************************************************************** #define I2C_MDR_DATA_M 0x000000FF // Data Transferred. #define I2C_MDR_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MTPR register. // //***************************************************************************** #define I2C_MTPR_TPR_M 0x000000FF // SCL Clock Period. #define I2C_MTPR_TPR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SIMR register. // //***************************************************************************** #define I2C_SIMR_STOPIM 0x00000004 // Stop Condition Interrupt Mask. #define I2C_SIMR_STARTIM 0x00000002 // Start Condition Interrupt Mask. #define I2C_SIMR_DATAIM 0x00000001 // Data Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SRIS register. // //***************************************************************************** #define I2C_SRIS_STOPRIS 0x00000004 // Stop Condition Raw Interrupt // Status. #define I2C_SRIS_STARTRIS 0x00000002 // Start Condition Raw Interrupt // Status. #define I2C_SRIS_DATARIS 0x00000001 // Data Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MIMR register. // //***************************************************************************** #define I2C_MIMR_IM 0x00000001 // Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MRIS register. // //***************************************************************************** #define I2C_MRIS_RIS 0x00000001 // Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SMIS register. // //***************************************************************************** #define I2C_SMIS_STOPMIS 0x00000004 // Stop Condition Masked Interrupt // Status. #define I2C_SMIS_STARTMIS 0x00000002 // Start Condition Masked Interrupt // Status. #define I2C_SMIS_DATAMIS 0x00000001 // Data Masked Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_SICR register. // //***************************************************************************** #define I2C_SICR_STOPIC 0x00000004 // Stop Condition Interrupt Clear. #define I2C_SICR_STARTIC 0x00000002 // Start Condition Interrupt Clear. #define I2C_SICR_DATAIC 0x00000001 // Data Clear Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MMIS register. // //***************************************************************************** #define I2C_MMIS_MIS 0x00000001 // Masked Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MICR register. // //***************************************************************************** #define I2C_MICR_IC 0x00000001 // Interrupt Clear. //***************************************************************************** // // The following are defines for the bit fields in the I2C_O_MCR register. // //***************************************************************************** #define I2C_MCR_SFE 0x00000020 // I2C Slave Function Enable. #define I2C_MCR_MFE 0x00000010 // I2C Master Function Enable. #define I2C_MCR_LPBK 0x00000001 // I2C Loopback. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the offsets between the I2C master // and slave registers. // //***************************************************************************** #define I2C_O_SLAVE 0x00000800 // Offset from master to slave //***************************************************************************** // // The following are deprecated defines for the I2C master register offsets. // //***************************************************************************** #define I2C_MASTER_O_SA 0x00000000 // Slave address register #define I2C_MASTER_O_CS 0x00000004 // Control and Status register #define I2C_MASTER_O_DR 0x00000008 // Data register #define I2C_MASTER_O_TPR 0x0000000C // Timer period register #define I2C_MASTER_O_IMR 0x00000010 // Interrupt mask register #define I2C_MASTER_O_RIS 0x00000014 // Raw interrupt status register #define I2C_MASTER_O_MIS 0x00000018 // Masked interrupt status reg #define I2C_MASTER_O_MICR 0x0000001C // Interrupt clear register #define I2C_MASTER_O_CR 0x00000020 // Configuration register //***************************************************************************** // // The following are deprecated defines for the I2C slave register offsets. // //***************************************************************************** #define I2C_SLAVE_O_SICR 0x00000018 // Interrupt clear register #define I2C_SLAVE_O_MIS 0x00000014 // Masked interrupt status reg #define I2C_SLAVE_O_RIS 0x00000010 // Raw interrupt status register #define I2C_SLAVE_O_IM 0x0000000C // Interrupt mask register #define I2C_SLAVE_O_DR 0x00000008 // Data register #define I2C_SLAVE_O_CSR 0x00000004 // Control/Status register #define I2C_SLAVE_O_OAR 0x00000000 // Own address register //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C master // slave address register. // //***************************************************************************** #define I2C_MASTER_SA_SA_MASK 0x000000FE // Slave address #define I2C_MASTER_SA_RS 0x00000001 // Receive/send #define I2C_MASTER_SA_SA_SHIFT 1 //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Control and Status register. // //***************************************************************************** #define I2C_MASTER_CS_BUS_BUSY 0x00000040 // Bus busy #define I2C_MASTER_CS_IDLE 0x00000020 // Idle #define I2C_MASTER_CS_ERR_MASK 0x0000001C #define I2C_MASTER_CS_BUSY 0x00000001 // Controller is TX/RX data #define I2C_MASTER_CS_ERROR 0x00000002 // Error occurred #define I2C_MASTER_CS_ADDR_ACK 0x00000004 // Address byte not acknowledged #define I2C_MASTER_CS_DATA_ACK 0x00000008 // Data byte not acknowledged #define I2C_MASTER_CS_ARB_LOST 0x00000010 // Lost arbitration #define I2C_MASTER_CS_ACK 0x00000008 // Acknowlegde #define I2C_MASTER_CS_STOP 0x00000004 // Stop #define I2C_MASTER_CS_START 0x00000002 // Start #define I2C_MASTER_CS_RUN 0x00000001 // Run //***************************************************************************** // // The following are deprecated defines for the values used in determining the // contents of the I2C Master Timer Period register. // //***************************************************************************** #define I2C_SCL_FAST 400000 // SCL fast frequency #define I2C_SCL_STANDARD 100000 // SCL standard frequency #define I2C_MASTER_TPR_SCL_LP 0x00000006 // SCL low period #define I2C_MASTER_TPR_SCL_HP 0x00000004 // SCL high period #define I2C_MASTER_TPR_SCL (I2C_MASTER_TPR_SCL_HP + I2C_MASTER_TPR_SCL_LP) //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Interrupt Mask register. // //***************************************************************************** #define I2C_MASTER_IMR_IM 0x00000001 // Master interrupt mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Raw Interrupt Status register. // //***************************************************************************** #define I2C_MASTER_RIS_RIS 0x00000001 // Master raw interrupt status //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Masked Interrupt Status register. // //***************************************************************************** #define I2C_MASTER_MIS_MIS 0x00000001 // Master masked interrupt status //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Interrupt Clear register. // //***************************************************************************** #define I2C_MASTER_MICR_IC 0x00000001 // Master interrupt clear //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Master // Configuration register. // //***************************************************************************** #define I2C_MASTER_CR_SFE 0x00000020 // Slave function enable #define I2C_MASTER_CR_MFE 0x00000010 // Master function enable #define I2C_MASTER_CR_LPBK 0x00000001 // Loopback enable //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave Own // Address register. // //***************************************************************************** #define I2C_SLAVE_SOAR_OAR_MASK 0x0000007F // Slave address //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave // Control/Status register. // //***************************************************************************** #define I2C_SLAVE_CSR_FBR 0x00000004 // First byte received from master #define I2C_SLAVE_CSR_TREQ 0x00000002 // Transmit request received #define I2C_SLAVE_CSR_DA 0x00000001 // Enable the device #define I2C_SLAVE_CSR_RREQ 0x00000001 // Receive data from I2C master //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave // Interrupt Mask register. // //***************************************************************************** #define I2C_SLAVE_IMR_IM 0x00000001 // Slave interrupt mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave Raw // Interrupt Status register. // //***************************************************************************** #define I2C_SLAVE_RIS_RIS 0x00000001 // Slave raw interrupt status //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave // Masked Interrupt Status register. // //***************************************************************************** #define I2C_SLAVE_MIS_MIS 0x00000001 // Slave masked interrupt status //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C Slave // Interrupt Clear register. // //***************************************************************************** #define I2C_SLAVE_SICR_IC 0x00000001 // Slave interrupt clear //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C_O_SIMR // register. // //***************************************************************************** #define I2C_SIMR_IM 0x00000001 // Interrupt Mask. //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C_O_SRIS // register. // //***************************************************************************** #define I2C_SRIS_RIS 0x00000001 // Raw Interrupt Status. //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C_O_SMIS // register. // //***************************************************************************** #define I2C_SMIS_MIS 0x00000001 // Masked Interrupt Status. //***************************************************************************** // // The following are deprecated defines for the bit fields in the I2C_O_SICR // register. // //***************************************************************************** #define I2C_SICR_IC 0x00000001 // Clear Interrupt. #endif #endif // __HW_I2C_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_i2c.h
C
oos
20,101
//***************************************************************************** // // hw_usb.h - Macros for use in accessing the USB registers. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_USB_H__ #define __HW_USB_H__ //***************************************************************************** // // The following are defines for the Univeral Serial Bus (USB) Controller // offsets. // //***************************************************************************** #define USB_O_FADDR 0x00000000 // USB Device Functional Address #define USB_O_POWER 0x00000001 // USB Power #define USB_O_TXIS 0x00000002 // USB Transmit Interrupt Status #define USB_O_RXIS 0x00000004 // USB Receive Interrupt Status #define USB_O_TXIE 0x00000006 // USB Transmit Interrupt Enable #define USB_O_RXIE 0x00000008 // USB Receive Interrupt Enable #define USB_O_IS 0x0000000A // USB General Interrupt Status #define USB_O_IE 0x0000000B // USB Interrupt Enable #define USB_O_FRAME 0x0000000C // USB Frame Value #define USB_O_EPIDX 0x0000000E // USB Endpoint Index #define USB_O_TEST 0x0000000F // USB Test Mode #define USB_O_FIFO0 0x00000020 // USB FIFO Endpoint 0 #define USB_O_FIFO1 0x00000024 // USB FIFO Endpoint 1 #define USB_O_FIFO2 0x00000028 // USB FIFO Endpoint 2 #define USB_O_FIFO3 0x0000002C // USB FIFO Endpoint 3 #define USB_O_DEVCTL 0x00000060 // USB Device Control #define USB_O_TXFIFOSZ 0x00000062 // USB Transmit Dynamic FIFO Sizing #define USB_O_RXFIFOSZ 0x00000063 // USB Receive Dynamic FIFO Sizing #define USB_O_TXFIFOADD 0x00000064 // USB Transmit FIFO Start Address #define USB_O_RXFIFOADD 0x00000066 // USB Receive FIFO Start Address #define USB_O_CONTIM 0x0000007A // USB Connect Timing #define USB_O_VPLEN 0x0000007B // USB OTG VBus Pulse Timing #define USB_O_FSEOF 0x0000007D // USB Full-Speed Last Transaction // to End of Frame Timing #define USB_O_LSEOF 0x0000007E // USB Low-Speed Last Transaction // to End of Frame Timing #define USB_O_TXFUNCADDR0 0x00000080 // USB Transmit Functional Address // Endpoint 0 #define USB_O_TXHUBADDR0 0x00000082 // USB Transmit Hub Address // Endpoint 0 #define USB_O_TXHUBPORT0 0x00000083 // USB Transmit Hub Port Endpoint 0 #define USB_O_TXFUNCADDR1 0x00000088 // USB Transmit Functional Address // Endpoint 1 #define USB_O_TXHUBADDR1 0x0000008A // USB Transmit Hub Address // Endpoint 1 #define USB_O_TXHUBPORT1 0x0000008B // USB Transmit Hub Port Endpoint 1 #define USB_O_RXFUNCADDR1 0x0000008C // USB Receive Functional Address // Endpoint 1 #define USB_O_RXHUBADDR1 0x0000008E // USB Receive Hub Address Endpoint // 1 #define USB_O_RXHUBPORT1 0x0000008F // USB Receive Hub Port Endpoint 1 #define USB_O_TXFUNCADDR2 0x00000090 // USB Transmit Functional Address // Endpoint 2 #define USB_O_TXHUBADDR2 0x00000092 // USB Transmit Hub Address // Endpoint 2 #define USB_O_TXHUBPORT2 0x00000093 // USB Transmit Hub Port Endpoint 2 #define USB_O_RXFUNCADDR2 0x00000094 // USB Receive Functional Address // Endpoint 2 #define USB_O_RXHUBADDR2 0x00000096 // USB Receive Hub Address Endpoint // 2 #define USB_O_RXHUBPORT2 0x00000097 // USB Receive Hub Port Endpoint 2 #define USB_O_TXFUNCADDR3 0x00000098 // USB Transmit Functional Address // Endpoint 3 #define USB_O_TXHUBADDR3 0x0000009A // USB Transmit Hub Address // Endpoint 3 #define USB_O_TXHUBPORT3 0x0000009B // USB Transmit Hub Port Endpoint 3 #define USB_O_RXFUNCADDR3 0x0000009C // USB Receive Functional Address // Endpoint 3 #define USB_O_RXHUBADDR3 0x0000009E // USB Receive Hub Address Endpoint // 3 #define USB_O_RXHUBPORT3 0x0000009F // USB Receive Hub Port Endpoint 3 #define USB_O_CSRL0 0x00000102 // USB Control and Status Endpoint // 0 Low #define USB_O_CSRH0 0x00000103 // USB Control and Status Endpoint // 0 High #define USB_O_COUNT0 0x00000108 // USB Receive Byte Count Endpoint // 0 #define USB_O_TYPE0 0x0000010A // USB Type Endpoint 0 #define USB_O_NAKLMT 0x0000010B // USB NAK Limit #define USB_O_TXMAXP1 0x00000110 // USB Maximum Transmit Data // Endpoint 1 #define USB_O_TXCSRL1 0x00000112 // USB Transmit Control and Status // Endpoint 1 Low #define USB_O_TXCSRH1 0x00000113 // USB Transmit Control and Status // Endpoint 1 High #define USB_O_RXMAXP1 0x00000114 // USB Maximum Receive Data // Endpoint 1 #define USB_O_RXCSRL1 0x00000116 // USB Receive Control and Status // Endpoint 1 Low #define USB_O_RXCSRH1 0x00000117 // USB Receive Control and Status // Endpoint 1 High #define USB_O_RXCOUNT1 0x00000118 // USB Receive Byte Count Endpoint // 1 #define USB_O_TXTYPE1 0x0000011A // USB Host Transmit Configure Type // Endpoint 1 #define USB_O_TXINTERVAL1 0x0000011B // USB Host Transmit Interval // Endpoint 1 #define USB_O_RXTYPE1 0x0000011C // USB Host Configure Receive Type // Endpoint 1 #define USB_O_RXINTERVAL1 0x0000011D // USB Host Receive Polling // Interval Endpoint 1 #define USB_O_TXMAXP2 0x00000120 // USB Maximum Transmit Data // Endpoint 2 #define USB_O_TXCSRL2 0x00000122 // USB Transmit Control and Status // Endpoint 2 Low #define USB_O_TXCSRH2 0x00000123 // USB Transmit Control and Status // Endpoint 2 High #define USB_O_RXMAXP2 0x00000124 // USB Maximum Receive Data // Endpoint 2 #define USB_O_RXCSRL2 0x00000126 // USB Receive Control and Status // Endpoint 2 Low #define USB_O_RXCSRH2 0x00000127 // USB Receive Control and Status // Endpoint 2 High #define USB_O_RXCOUNT2 0x00000128 // USB Receive Byte Count Endpoint // 2 #define USB_O_TXTYPE2 0x0000012A // USB Host Transmit Configure Type // Endpoint 2 #define USB_O_TXINTERVAL2 0x0000012B // USB Host Transmit Interval // Endpoint 2 #define USB_O_RXTYPE2 0x0000012C // USB Host Configure Receive Type // Endpoint 2 #define USB_O_RXINTERVAL2 0x0000012D // USB Host Receive Polling // Interval Endpoint 2 #define USB_O_TXMAXP3 0x00000130 // USB Maximum Transmit Data // Endpoint 3 #define USB_O_TXCSRL3 0x00000132 // USB Transmit Control and Status // Endpoint 3 Low #define USB_O_TXCSRH3 0x00000133 // USB Transmit Control and Status // Endpoint 3 High #define USB_O_RXMAXP3 0x00000134 // USB Maximum Receive Data // Endpoint 3 #define USB_O_RXCSRL3 0x00000136 // USB Receive Control and Status // Endpoint 3 Low #define USB_O_RXCSRH3 0x00000137 // USB Receive Control and Status // Endpoint 3 High #define USB_O_RXCOUNT3 0x00000138 // USB Receive Byte Count Endpoint // 3 #define USB_O_TXTYPE3 0x0000013A // USB Host Transmit Configure Type // Endpoint 3 #define USB_O_TXINTERVAL3 0x0000013B // USB Host Transmit Interval // Endpoint 3 #define USB_O_RXTYPE3 0x0000013C // USB Host Configure Receive Type // Endpoint 3 #define USB_O_RXINTERVAL3 0x0000013D // USB Host Receive Polling // Interval Endpoint 3 #define USB_O_RQPKTCOUNT1 0x00000304 // USB Request Packet Count in // Block Transfer Endpoint 1 #define USB_O_RQPKTCOUNT2 0x00000308 // USB Request Packet Count in // Block Transfer Endpoint 2 #define USB_O_RQPKTCOUNT3 0x0000030C // USB Request Packet Count in // Block Transfer Endpoint 3 #define USB_O_RXDPKTBUFDIS 0x00000340 // USB Receive Double Packet Buffer // Disable #define USB_O_TXDPKTBUFDIS 0x00000342 // USB Transmit Double Packet // Buffer Disable #define USB_O_EPC 0x00000400 // USB External Power Control #define USB_O_EPCRIS 0x00000404 // USB External Power Control Raw // Interrupt Status #define USB_O_EPCIM 0x00000408 // USB External Power Control // Interrupt Mask #define USB_O_EPCISC 0x0000040C // USB External Power Control // Interrupt Status and Clear #define USB_O_DRRIS 0x00000410 // USB Device Resume Raw Interrupt // Status #define USB_O_DRIM 0x00000414 // USB Device Resume Interrupt Mask #define USB_O_DRISC 0x00000418 // USB Device Resume Interrupt // Status and Clear #define USB_O_GPCS 0x0000041C // USB General-Purpose Control and // Status //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FADDR register. // //***************************************************************************** #define USB_FADDR_M 0x0000007F // Function Address. #define USB_FADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_POWER register. // //***************************************************************************** #define USB_POWER_ISOUP 0x00000080 // ISO Update. #define USB_POWER_SOFTCONN 0x00000040 // Soft Connect/Disconnect. #define USB_POWER_RESET 0x00000008 // Reset. #define USB_POWER_RESUME 0x00000004 // Resume Signaling. #define USB_POWER_SUSPEND 0x00000002 // Suspend Mode. #define USB_POWER_PWRDNPHY 0x00000001 // Power Down PHY. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXIS register. // //***************************************************************************** #define USB_TXIS_EP3 0x00000008 // TX Endpoint 3 Interrupt. #define USB_TXIS_EP2 0x00000004 // TX Endpoint 2 Interrupt. #define USB_TXIS_EP1 0x00000002 // TX Endpoint 1 Interrupt. #define USB_TXIS_EP0 0x00000001 // TX and RX Endpoint 0 Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXIS register. // //***************************************************************************** #define USB_RXIS_EP3 0x00000008 // RX Endpoint 3 Interrupt. #define USB_RXIS_EP2 0x00000004 // RX Endpoint 2 Interrupt. #define USB_RXIS_EP1 0x00000002 // RX Endpoint 1 Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXIE register. // //***************************************************************************** #define USB_TXIE_EP3 0x00000008 // TX Endpoint 3 Interrupt Enable. #define USB_TXIE_EP2 0x00000004 // TX Endpoint 2 Interrupt Enable. #define USB_TXIE_EP1 0x00000002 // TX Endpoint 1 Interrupt Enable. #define USB_TXIE_EP0 0x00000001 // TX and RX Endpoint 0 Interrupt // Enable. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXIE register. // //***************************************************************************** #define USB_RXIE_EP3 0x00000008 // RX Endpoint 3 Interrupt Enable. #define USB_RXIE_EP2 0x00000004 // RX Endpoint 2 Interrupt Enable. #define USB_RXIE_EP1 0x00000002 // RX Endpoint 1 Interrupt Enable. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_IS register. // //***************************************************************************** #define USB_IS_VBUSERR 0x00000080 // VBus Error. #define USB_IS_SESREQ 0x00000040 // Session Request. #define USB_IS_DISCON 0x00000020 // Session Disconnect. #define USB_IS_CONN 0x00000010 // Session Connect. #define USB_IS_SOF 0x00000008 // Start of Frame. #define USB_IS_BABBLE 0x00000004 // Babble Detected. #define USB_IS_RESET 0x00000004 // Reset Signal Detected. #define USB_IS_RESUME 0x00000002 // Resume Signal Detected. #define USB_IS_SUSPEND 0x00000001 // Suspend Signal Detected. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_IE register. // //***************************************************************************** #define USB_IE_VBUSERR 0x00000080 // Enable VBUS Error Interrupt. #define USB_IE_SESREQ 0x00000040 // Enable Session Request // Interrupt. #define USB_IE_DISCON 0x00000020 // Enable Disconnect Interrupt. #define USB_IE_CONN 0x00000010 // Enable Connect Interrupt. #define USB_IE_SOF 0x00000008 // Enable Start-of-Frame Interrupt. #define USB_IE_BABBLE 0x00000004 // Enable Babble Interrupt. #define USB_IE_RESET 0x00000004 // Enable Reset Interrupt. #define USB_IE_RESUME 0x00000002 // Enable Resume Interrupt. #define USB_IE_SUSPND 0x00000001 // Enable Suspend Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FRAME register. // //***************************************************************************** #define USB_FRAME_M 0x000007FF // Frame Number. #define USB_FRAME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_EPIDX register. // //***************************************************************************** #define USB_EPIDX_EPIDX_M 0x0000000F // Endpoint Index. #define USB_EPIDX_EPIDX_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TEST register. // //***************************************************************************** #define USB_TEST_FORCEH 0x00000080 // Force Host Mode. #define USB_TEST_FIFOACC 0x00000040 // FIFO Access. #define USB_TEST_FORCEFS 0x00000020 // Force Full Speed. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FIFO0 register. // //***************************************************************************** #define USB_FIFO0_EPDATA_M 0xFFFFFFFF // Endpoint Data. #define USB_FIFO0_EPDATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FIFO1 register. // //***************************************************************************** #define USB_FIFO1_EPDATA_M 0xFFFFFFFF // Endpoint Data. #define USB_FIFO1_EPDATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FIFO2 register. // //***************************************************************************** #define USB_FIFO2_EPDATA_M 0xFFFFFFFF // Endpoint Data. #define USB_FIFO2_EPDATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FIFO3 register. // //***************************************************************************** #define USB_FIFO3_EPDATA_M 0xFFFFFFFF // Endpoint Data. #define USB_FIFO3_EPDATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_DEVCTL register. // //***************************************************************************** #define USB_DEVCTL_DEV 0x00000080 // Device Mode. #define USB_DEVCTL_FSDEV 0x00000040 // Full-Speed Device Detected. #define USB_DEVCTL_LSDEV 0x00000020 // Low-Speed Device Detected. #define USB_DEVCTL_VBUS_M 0x00000018 // VBus Level. #define USB_DEVCTL_VBUS_NONE 0x00000000 // Below SessionEnd #define USB_DEVCTL_VBUS_SEND 0x00000008 // Above SessionEnd, below AValid #define USB_DEVCTL_VBUS_AVALID 0x00000010 // Above AValid, below VBusValid #define USB_DEVCTL_VBUS_VALID 0x00000018 // Above VBusValid #define USB_DEVCTL_HOST 0x00000004 // Host Mode. #define USB_DEVCTL_HOSTREQ 0x00000002 // Host Request. #define USB_DEVCTL_SESSION 0x00000001 // Session Start/End. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFIFOSZ register. // //***************************************************************************** #define USB_TXFIFOSZ_DPB 0x00000010 // Double Packet Buffer Support. #define USB_TXFIFOSZ_SIZE_M 0x0000000F // Max Packet Size. #define USB_TXFIFOSZ_SIZE_8 0x00000000 // 8 #define USB_TXFIFOSZ_SIZE_16 0x00000001 // 16 #define USB_TXFIFOSZ_SIZE_32 0x00000002 // 32 #define USB_TXFIFOSZ_SIZE_64 0x00000003 // 64 #define USB_TXFIFOSZ_SIZE_128 0x00000004 // 128 #define USB_TXFIFOSZ_SIZE_256 0x00000005 // 256 #define USB_TXFIFOSZ_SIZE_512 0x00000006 // 512 #define USB_TXFIFOSZ_SIZE_1024 0x00000007 // 1024 #define USB_TXFIFOSZ_SIZE_2048 0x00000008 // 2048 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXFIFOSZ register. // //***************************************************************************** #define USB_RXFIFOSZ_DPB 0x00000010 // Double Packet Buffer Support. #define USB_RXFIFOSZ_SIZE_M 0x0000000F // Max Packet Size. #define USB_RXFIFOSZ_SIZE_8 0x00000000 // 8 #define USB_RXFIFOSZ_SIZE_16 0x00000001 // 16 #define USB_RXFIFOSZ_SIZE_32 0x00000002 // 32 #define USB_RXFIFOSZ_SIZE_64 0x00000003 // 64 #define USB_RXFIFOSZ_SIZE_128 0x00000004 // 128 #define USB_RXFIFOSZ_SIZE_256 0x00000005 // 256 #define USB_RXFIFOSZ_SIZE_512 0x00000006 // 512 #define USB_RXFIFOSZ_SIZE_1024 0x00000007 // 1024 #define USB_RXFIFOSZ_SIZE_2048 0x00000008 // 2048 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFIFOADD // register. // //***************************************************************************** #define USB_TXFIFOADD_ADDR_M 0x00001FFF // Transmit/Receive Start Address. #define USB_TXFIFOADD_ADDR_0 0x00000000 // 0 #define USB_TXFIFOADD_ADDR_8 0x00000001 // 8 #define USB_TXFIFOADD_ADDR_16 0x00000002 // 16 #define USB_TXFIFOADD_ADDR_32 0x00000003 // 32 #define USB_TXFIFOADD_ADDR_64 0x00000004 // 64 #define USB_TXFIFOADD_ADDR_128 0x00000005 // 128 #define USB_TXFIFOADD_ADDR_256 0x00000006 // 256 #define USB_TXFIFOADD_ADDR_512 0x00000007 // 512 #define USB_TXFIFOADD_ADDR_1024 0x00000008 // 1024 #define USB_TXFIFOADD_ADDR_2048 0x00000009 // 2048 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXFIFOADD // register. // //***************************************************************************** #define USB_RXFIFOADD_ADDR_M 0x00001FFF // Transmit/Receive Start Address. #define USB_RXFIFOADD_ADDR_0 0x00000000 // 0 #define USB_RXFIFOADD_ADDR_8 0x00000001 // 8 #define USB_RXFIFOADD_ADDR_16 0x00000002 // 16 #define USB_RXFIFOADD_ADDR_32 0x00000003 // 32 #define USB_RXFIFOADD_ADDR_64 0x00000004 // 64 #define USB_RXFIFOADD_ADDR_128 0x00000005 // 128 #define USB_RXFIFOADD_ADDR_256 0x00000006 // 256 #define USB_RXFIFOADD_ADDR_512 0x00000007 // 512 #define USB_RXFIFOADD_ADDR_1024 0x00000008 // 1024 #define USB_RXFIFOADD_ADDR_2048 0x00000009 // 2048 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_CONTIM register. // //***************************************************************************** #define USB_CONTIM_WTCON_M 0x000000F0 // Connect Wait. #define USB_CONTIM_WTID_M 0x0000000F // Wait ID. #define USB_CONTIM_WTCON_S 4 #define USB_CONTIM_WTID_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_FSEOF register. // //***************************************************************************** #define USB_FSEOF_FSEOFG_M 0x000000FF // Full-Speed End-of-Frame Gap. #define USB_FSEOF_FSEOFG_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_LSEOF register. // //***************************************************************************** #define USB_LSEOF_LSEOFG_M 0x000000FF // Low-Speed End-of-Frame Gap. #define USB_LSEOF_LSEOFG_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFUNCADDR0 // register. // //***************************************************************************** #define USB_TXFUNCADDR0_ADDR_M 0x0000007F // Device Address. #define USB_TXFUNCADDR0_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBADDR0 // register. // //***************************************************************************** #define USB_TXHUBADDR0_MULTTRAN 0x00000080 // Multiple Translators. #define USB_TXHUBADDR0_ADDR_M 0x0000007F // Hub Address. #define USB_TXHUBADDR0_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBPORT0 // register. // //***************************************************************************** #define USB_TXHUBPORT0_PORT_M 0x0000007F // Hub Port. #define USB_TXHUBPORT0_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFUNCADDR1 // register. // //***************************************************************************** #define USB_TXFUNCADDR1_ADDR_M 0x0000007F // Device Address. #define USB_TXFUNCADDR1_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBADDR1 // register. // //***************************************************************************** #define USB_TXHUBADDR1_MULTTRAN 0x00000080 // Multiple Translators. #define USB_TXHUBADDR1_ADDR_M 0x0000007F // Hub Address. #define USB_TXHUBADDR1_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBPORT1 // register. // //***************************************************************************** #define USB_TXHUBPORT1_PORT_M 0x0000007F // Hub Port. #define USB_TXHUBPORT1_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXFUNCADDR1 // register. // //***************************************************************************** #define USB_RXFUNCADDR1_ADDR_M 0x0000007F // Device Address. #define USB_RXFUNCADDR1_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBADDR1 // register. // //***************************************************************************** #define USB_RXHUBADDR1_MULTTRAN 0x00000080 // Multiple Translators. #define USB_RXHUBADDR1_ADDR_M 0x0000007F // Hub Address. #define USB_RXHUBADDR1_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBPORT1 // register. // //***************************************************************************** #define USB_RXHUBPORT1_PORT_M 0x0000007F // Hub Port. #define USB_RXHUBPORT1_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFUNCADDR2 // register. // //***************************************************************************** #define USB_TXFUNCADDR2_ADDR_M 0x0000007F // Device Address. #define USB_TXFUNCADDR2_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBADDR2 // register. // //***************************************************************************** #define USB_TXHUBADDR2_MULTTRAN 0x00000080 // Multiple Translators. #define USB_TXHUBADDR2_ADDR_M 0x0000007F // Hub Address. #define USB_TXHUBADDR2_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBPORT2 // register. // //***************************************************************************** #define USB_TXHUBPORT2_PORT_M 0x0000007F // Hub Port. #define USB_TXHUBPORT2_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXFUNCADDR2 // register. // //***************************************************************************** #define USB_RXFUNCADDR2_ADDR_M 0x0000007F // Device Address. #define USB_RXFUNCADDR2_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBADDR2 // register. // //***************************************************************************** #define USB_RXHUBADDR2_MULTTRAN 0x00000080 // Multiple Translators. #define USB_RXHUBADDR2_ADDR_M 0x0000007F // Hub Address. #define USB_RXHUBADDR2_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBPORT2 // register. // //***************************************************************************** #define USB_RXHUBPORT2_PORT_M 0x0000007F // Hub Port. #define USB_RXHUBPORT2_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXFUNCADDR3 // register. // //***************************************************************************** #define USB_TXFUNCADDR3_ADDR_M 0x0000007F // Device Address. #define USB_TXFUNCADDR3_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBADDR3 // register. // //***************************************************************************** #define USB_TXHUBADDR3_MULTTRAN 0x00000080 // Multiple Translators. #define USB_TXHUBADDR3_ADDR_M 0x0000007F // Hub Address. #define USB_TXHUBADDR3_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXHUBPORT3 // register. // //***************************************************************************** #define USB_TXHUBPORT3_PORT_M 0x0000007F // Hub Port. #define USB_TXHUBPORT3_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXFUNCADDR3 // register. // //***************************************************************************** #define USB_RXFUNCADDR3_ADDR_M 0x0000007F // Device Address. #define USB_RXFUNCADDR3_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBADDR3 // register. // //***************************************************************************** #define USB_RXHUBADDR3_MULTTRAN 0x00000080 // Multiple Translators. #define USB_RXHUBADDR3_ADDR_M 0x0000007F // Hub Address. #define USB_RXHUBADDR3_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXHUBPORT3 // register. // //***************************************************************************** #define USB_RXHUBPORT3_PORT_M 0x0000007F // Hub Port. #define USB_RXHUBPORT3_PORT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_CSRL0 register. // //***************************************************************************** #define USB_CSRL0_NAKTO 0x00000080 // NAK Timeout. #define USB_CSRL0_SETENDC 0x00000080 // Setup End Clear. #define USB_CSRL0_STATUS 0x00000040 // Status Packet. #define USB_CSRL0_RXRDYC 0x00000040 // RXRDY Clear. #define USB_CSRL0_REQPKT 0x00000020 // Request Packet. #define USB_CSRL0_STALL 0x00000020 // Send Stall. #define USB_CSRL0_SETEND 0x00000010 // Setup End. #define USB_CSRL0_ERROR 0x00000010 // Error. #define USB_CSRL0_DATAEND 0x00000008 // Data End. #define USB_CSRL0_SETUP 0x00000008 // Setup Packet. #define USB_CSRL0_STALLED 0x00000004 // Endpoint Stalled. #define USB_CSRL0_TXRDY 0x00000002 // Transmit Packet Ready. #define USB_CSRL0_RXRDY 0x00000001 // Receive Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_CSRH0 register. // //***************************************************************************** #define USB_CSRH0_DTWE 0x00000004 // Data Toggle Write Enable. #define USB_CSRH0_DT 0x00000002 // Data Toggle. #define USB_CSRH0_FLUSH 0x00000001 // Flush FIFO. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_COUNT0 register. // //***************************************************************************** #define USB_COUNT0_COUNT_M 0x0000007F // Count. #define USB_COUNT0_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TYPE0 register. // //***************************************************************************** #define USB_TYPE0_SPEED_M 0x000000C0 // Operating Speed. #define USB_TYPE0_SPEED_FULL 0x00000080 // Full #define USB_TYPE0_SPEED_LOW 0x000000C0 // Low //***************************************************************************** // // The following are defines for the bit fields in the USB_O_NAKLMT register. // //***************************************************************************** #define USB_NAKLMT_NAKLMT_M 0x0000001F // EP0 NAK Limit. #define USB_NAKLMT_NAKLMT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXMAXP1 register. // //***************************************************************************** #define USB_TXMAXP1_MULT_M 0x0000F800 // Multiplier. #define USB_TXMAXP1_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_TXMAXP1_MULT_S 11 #define USB_TXMAXP1_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRL1 register. // //***************************************************************************** #define USB_TXCSRL1_NAKTO 0x00000080 // NAK Timeout #define USB_TXCSRL1_INCTX 0x00000080 // Incomplete Transmit. #define USB_TXCSRL1_CLRDT 0x00000040 // Clear Data Toggle. #define USB_TXCSRL1_STALLED 0x00000020 // Endpoint Stalled. #define USB_TXCSRL1_STALL 0x00000010 // Send Stall. #define USB_TXCSRL1_SETUP 0x00000010 // Setup Packet. #define USB_TXCSRL1_FLUSH 0x00000008 // Flush FIFO. #define USB_TXCSRL1_ERROR 0x00000004 // Error. #define USB_TXCSRL1_UNDRN 0x00000004 // Underrun. #define USB_TXCSRL1_FIFONE 0x00000002 // FIFO Not Empty. #define USB_TXCSRL1_TXRDY 0x00000001 // Transmit Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRH1 register. // //***************************************************************************** #define USB_TXCSRH1_AUTOSET 0x00000080 // Auto Set. #define USB_TXCSRH1_ISO 0x00000040 // ISO. #define USB_TXCSRH1_MODE 0x00000020 // Mode. #define USB_TXCSRH1_DMAEN 0x00000010 // DMA Request Enable. #define USB_TXCSRH1_FDT 0x00000008 // Force Data Toggle. #define USB_TXCSRH1_DMAMOD 0x00000004 // DMA Request Mode. #define USB_TXCSRH1_DTWE 0x00000002 // Data Toggle Write Enable. #define USB_TXCSRH1_DT 0x00000001 // Data Toggle. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXMAXP1 register. // //***************************************************************************** #define USB_RXMAXP1_MULT_M 0x0000F800 // Multiplier. #define USB_RXMAXP1_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_RXMAXP1_MULT_S 11 #define USB_RXMAXP1_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRL1 register. // //***************************************************************************** #define USB_RXCSRL1_CLRDT 0x00000080 // Clear Data Toggle. #define USB_RXCSRL1_STALLED 0x00000040 // Endpoint Stalled. #define USB_RXCSRL1_STALL 0x00000020 // Send Stall. #define USB_RXCSRL1_REQPKT 0x00000020 // Request Packet. #define USB_RXCSRL1_FLUSH 0x00000010 // Flush FIFO. #define USB_RXCSRL1_DATAERR 0x00000008 // Data Error. #define USB_RXCSRL1_NAKTO 0x00000008 // NAK Timeout. #define USB_RXCSRL1_OVER 0x00000004 // Overrun. #define USB_RXCSRL1_ERROR 0x00000004 // Error. #define USB_RXCSRL1_FULL 0x00000002 // FIFO Full. #define USB_RXCSRL1_RXRDY 0x00000001 // Receive Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRH1 register. // //***************************************************************************** #define USB_RXCSRH1_AUTOCL 0x00000080 // Auto Clear. #define USB_RXCSRH1_AUTORQ 0x00000040 // Auto Request. #define USB_RXCSRH1_ISO 0x00000040 // ISO. #define USB_RXCSRH1_DMAEN 0x00000020 // DMA Request Enable. #define USB_RXCSRH1_DISNYET 0x00000010 // Disable NYET #define USB_RXCSRH1_PIDERR 0x00000010 // PID Error. #define USB_RXCSRH1_DMAMOD 0x00000008 // DMA Request Mode. #define USB_RXCSRH1_DTWE 0x00000004 // Data Toggle Write Enable. #define USB_RXCSRH1_DT 0x00000002 // Data Toggle. #define USB_RXCSRH1_INCRX 0x00000001 // Incomplete Receive. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCOUNT1 register. // //***************************************************************************** #define USB_RXCOUNT1_COUNT_M 0x00001FFF // Receive Packet Count. #define USB_RXCOUNT1_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXTYPE1 register. // //***************************************************************************** #define USB_TXTYPE1_SPEED_M 0x000000C0 // Operating Speed. #define USB_TXTYPE1_SPEED_DFLT 0x00000000 // Default #define USB_TXTYPE1_SPEED_FULL 0x00000080 // Full #define USB_TXTYPE1_SPEED_LOW 0x000000C0 // Low #define USB_TXTYPE1_PROTO_M 0x00000030 // Protocol. #define USB_TXTYPE1_PROTO_CTRL 0x00000000 // Control #define USB_TXTYPE1_PROTO_ISOC 0x00000010 // Isochronous #define USB_TXTYPE1_PROTO_BULK 0x00000020 // Bulk #define USB_TXTYPE1_PROTO_INT 0x00000030 // Interrupt #define USB_TXTYPE1_TEP_M 0x0000000F // Target Endpoint Number. #define USB_TXTYPE1_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXINTERVAL1 // register. // //***************************************************************************** #define USB_TXINTERVAL1_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_TXINTERVAL1_TXPOLL_M \ 0x000000FF // TX Polling #define USB_TXINTERVAL1_TXPOLL_S \ 0 #define USB_TXINTERVAL1_NAKLMT_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXTYPE1 register. // //***************************************************************************** #define USB_RXTYPE1_SPEED_M 0x000000C0 // Operating Speed. #define USB_RXTYPE1_SPEED_DFLT 0x00000000 // Default #define USB_RXTYPE1_SPEED_FULL 0x00000080 // Full #define USB_RXTYPE1_SPEED_LOW 0x000000C0 // Low #define USB_RXTYPE1_PROTO_M 0x00000030 // Protocol. #define USB_RXTYPE1_PROTO_CTRL 0x00000000 // Control #define USB_RXTYPE1_PROTO_ISOC 0x00000010 // Isochronous #define USB_RXTYPE1_PROTO_BULK 0x00000020 // Bulk #define USB_RXTYPE1_PROTO_INT 0x00000030 // Interrupt #define USB_RXTYPE1_TEP_M 0x0000000F // Target Endpoint Number. #define USB_RXTYPE1_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXINTERVAL1 // register. // //***************************************************************************** #define USB_RXINTERVAL1_TXPOLL_M \ 0x000000FF // RX Polling #define USB_RXINTERVAL1_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_RXINTERVAL1_TXPOLL_S \ 0 #define USB_RXINTERVAL1_NAKLMT_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXMAXP2 register. // //***************************************************************************** #define USB_TXMAXP2_MULT_M 0x0000F800 // Multiplier. #define USB_TXMAXP2_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_TXMAXP2_MULT_S 11 #define USB_TXMAXP2_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRL2 register. // //***************************************************************************** #define USB_TXCSRL2_INCTX 0x00000080 // Incomplete Transmit. #define USB_TXCSRL2_NAKTO 0x00000080 // NAK Timeout #define USB_TXCSRL2_CLRDT 0x00000040 // Clear Data Toggle. #define USB_TXCSRL2_STALLED 0x00000020 // Endpoint Stalled. #define USB_TXCSRL2_SETUP 0x00000010 // Setup Packet. #define USB_TXCSRL2_STALL 0x00000010 // Send Stall. #define USB_TXCSRL2_FLUSH 0x00000008 // Flush FIFO. #define USB_TXCSRL2_ERROR 0x00000004 // Error. #define USB_TXCSRL2_UNDRN 0x00000004 // Underrun. #define USB_TXCSRL2_FIFONE 0x00000002 // FIFO Not Empty. #define USB_TXCSRL2_TXRDY 0x00000001 // Transmit Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRH2 register. // //***************************************************************************** #define USB_TXCSRH2_AUTOSET 0x00000080 // Auto Set. #define USB_TXCSRH2_ISO 0x00000040 // ISO. #define USB_TXCSRH2_MODE 0x00000020 // Mode. #define USB_TXCSRH2_DMAEN 0x00000010 // DMA Request Enable. #define USB_TXCSRH2_FDT 0x00000008 // Force Data Toggle. #define USB_TXCSRH2_DMAMOD 0x00000004 // DMA Request Mode. #define USB_TXCSRH2_DTWE 0x00000002 // Data Toggle Write Enable. #define USB_TXCSRH2_DT 0x00000001 // Data Toggle. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXMAXP2 register. // //***************************************************************************** #define USB_RXMAXP2_MULT_M 0x0000F800 // Multiplier. #define USB_RXMAXP2_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_RXMAXP2_MULT_S 11 #define USB_RXMAXP2_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRL2 register. // //***************************************************************************** #define USB_RXCSRL2_CLRDT 0x00000080 // Clear Data Toggle. #define USB_RXCSRL2_STALLED 0x00000040 // Endpoint Stalled. #define USB_RXCSRL2_REQPKT 0x00000020 // Request Packet. #define USB_RXCSRL2_STALL 0x00000020 // Send Stall. #define USB_RXCSRL2_FLUSH 0x00000010 // Flush FIFO. #define USB_RXCSRL2_DATAERR 0x00000008 // Data Error. #define USB_RXCSRL2_NAKTO 0x00000008 // NAK Timeout. #define USB_RXCSRL2_ERROR 0x00000004 // Error. #define USB_RXCSRL2_OVER 0x00000004 // Overrun. #define USB_RXCSRL2_FULL 0x00000002 // FIFO Full. #define USB_RXCSRL2_RXRDY 0x00000001 // Receive Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRH2 register. // //***************************************************************************** #define USB_RXCSRH2_AUTOCL 0x00000080 // Auto Clear. #define USB_RXCSRH2_AUTORQ 0x00000040 // Auto Request. #define USB_RXCSRH2_ISO 0x00000040 // ISO. #define USB_RXCSRH2_DMAEN 0x00000020 // DMA Request Enable. #define USB_RXCSRH2_DISNYET 0x00000010 // Disable NYET #define USB_RXCSRH2_PIDERR 0x00000010 // PID Error. #define USB_RXCSRH2_DMAMOD 0x00000008 // DMA Request Mode. #define USB_RXCSRH2_DTWE 0x00000004 // Data Toggle Write Enable. #define USB_RXCSRH2_DT 0x00000002 // Data Toggle. #define USB_RXCSRH2_INCRX 0x00000001 // Incomplete Receive. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCOUNT2 register. // //***************************************************************************** #define USB_RXCOUNT2_COUNT_M 0x00001FFF // Receive Packet Count. #define USB_RXCOUNT2_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXTYPE2 register. // //***************************************************************************** #define USB_TXTYPE2_SPEED_M 0x000000C0 // Operating Speed. #define USB_TXTYPE2_SPEED_DFLT 0x00000000 // Default #define USB_TXTYPE2_SPEED_FULL 0x00000080 // Full #define USB_TXTYPE2_SPEED_LOW 0x000000C0 // Low #define USB_TXTYPE2_PROTO_M 0x00000030 // Protocol. #define USB_TXTYPE2_PROTO_CTRL 0x00000000 // Control #define USB_TXTYPE2_PROTO_ISOC 0x00000010 // Isochronous #define USB_TXTYPE2_PROTO_BULK 0x00000020 // Bulk #define USB_TXTYPE2_PROTO_INT 0x00000030 // Interrupt #define USB_TXTYPE2_TEP_M 0x0000000F // Target Endpoint Number. #define USB_TXTYPE2_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXINTERVAL2 // register. // //***************************************************************************** #define USB_TXINTERVAL2_TXPOLL_M \ 0x000000FF // TX Polling #define USB_TXINTERVAL2_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_TXINTERVAL2_NAKLMT_S \ 0 #define USB_TXINTERVAL2_TXPOLL_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXTYPE2 register. // //***************************************************************************** #define USB_RXTYPE2_SPEED_M 0x000000C0 // Operating Speed. #define USB_RXTYPE2_SPEED_DFLT 0x00000000 // Default #define USB_RXTYPE2_SPEED_FULL 0x00000080 // Full #define USB_RXTYPE2_SPEED_LOW 0x000000C0 // Low #define USB_RXTYPE2_PROTO_M 0x00000030 // Protocol. #define USB_RXTYPE2_PROTO_CTRL 0x00000000 // Control #define USB_RXTYPE2_PROTO_ISOC 0x00000010 // Isochronous #define USB_RXTYPE2_PROTO_BULK 0x00000020 // Bulk #define USB_RXTYPE2_PROTO_INT 0x00000030 // Interrupt #define USB_RXTYPE2_TEP_M 0x0000000F // Target Endpoint Number. #define USB_RXTYPE2_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXINTERVAL2 // register. // //***************************************************************************** #define USB_RXINTERVAL2_TXPOLL_M \ 0x000000FF // RX Polling #define USB_RXINTERVAL2_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_RXINTERVAL2_TXPOLL_S \ 0 #define USB_RXINTERVAL2_NAKLMT_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXMAXP3 register. // //***************************************************************************** #define USB_TXMAXP3_MULT_M 0x0000F800 // Multiplier. #define USB_TXMAXP3_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_TXMAXP3_MULT_S 11 #define USB_TXMAXP3_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRL3 register. // //***************************************************************************** #define USB_TXCSRL3_INCTX 0x00000080 // Incomplete Transmit. #define USB_TXCSRL3_NAKTO 0x00000080 // NAK Timeout #define USB_TXCSRL3_CLRDT 0x00000040 // Clear Data Toggle. #define USB_TXCSRL3_STALLED 0x00000020 // Endpoint Stalled. #define USB_TXCSRL3_SETUP 0x00000010 // Setup Packet. #define USB_TXCSRL3_STALL 0x00000010 // Send Stall. #define USB_TXCSRL3_FLUSH 0x00000008 // Flush FIFO. #define USB_TXCSRL3_ERROR 0x00000004 // Error. #define USB_TXCSRL3_UNDRN 0x00000004 // Underrun. #define USB_TXCSRL3_FIFONE 0x00000002 // FIFO Not Empty. #define USB_TXCSRL3_TXRDY 0x00000001 // Transmit Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXCSRH3 register. // //***************************************************************************** #define USB_TXCSRH3_AUTOSET 0x00000080 // Auto Set. #define USB_TXCSRH3_ISO 0x00000040 // ISO. #define USB_TXCSRH3_MODE 0x00000020 // Mode. #define USB_TXCSRH3_DMAEN 0x00000010 // DMA Request Enable. #define USB_TXCSRH3_FDT 0x00000008 // Force Data Toggle. #define USB_TXCSRH3_DMAMOD 0x00000004 // DMA Request Mode. #define USB_TXCSRH3_DTWE 0x00000002 // Data Toggle Write Enable. #define USB_TXCSRH3_DT 0x00000001 // Data Toggle. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXMAXP3 register. // //***************************************************************************** #define USB_RXMAXP3_MULT_M 0x0000F800 // Multiplier. #define USB_RXMAXP3_MAXLOAD_M 0x000007FF // Maximum Payload. #define USB_RXMAXP3_MULT_S 11 #define USB_RXMAXP3_MAXLOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRL3 register. // //***************************************************************************** #define USB_RXCSRL3_CLRDT 0x00000080 // Clear Data Toggle. #define USB_RXCSRL3_STALLED 0x00000040 // Endpoint Stalled. #define USB_RXCSRL3_STALL 0x00000020 // Send Stall. #define USB_RXCSRL3_REQPKT 0x00000020 // Request Packet. #define USB_RXCSRL3_FLUSH 0x00000010 // Flush FIFO. #define USB_RXCSRL3_DATAERR 0x00000008 // Data Error. #define USB_RXCSRL3_NAKTO 0x00000008 // NAK Timeout. #define USB_RXCSRL3_ERROR 0x00000004 // Error. #define USB_RXCSRL3_OVER 0x00000004 // Overrun. #define USB_RXCSRL3_FULL 0x00000002 // FIFO Full. #define USB_RXCSRL3_RXRDY 0x00000001 // Receive Packet Ready. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCSRH3 register. // //***************************************************************************** #define USB_RXCSRH3_AUTOCL 0x00000080 // Auto Clear. #define USB_RXCSRH3_AUTORQ 0x00000040 // Auto Request. #define USB_RXCSRH3_ISO 0x00000040 // ISO. #define USB_RXCSRH3_DMAEN 0x00000020 // DMA Request Enable. #define USB_RXCSRH3_DISNYET 0x00000010 // Disable NYET #define USB_RXCSRH3_PIDERR 0x00000010 // PID Error. #define USB_RXCSRH3_DMAMOD 0x00000008 // DMA Request Mode. #define USB_RXCSRH3_DTWE 0x00000004 // Data Toggle Write Enable. #define USB_RXCSRH3_DT 0x00000002 // Data Toggle. #define USB_RXCSRH3_INCRX 0x00000001 // Incomplete Receive. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXCOUNT3 register. // //***************************************************************************** #define USB_RXCOUNT3_COUNT_M 0x00001FFF // Receive Packet Count. #define USB_RXCOUNT3_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXTYPE3 register. // //***************************************************************************** #define USB_TXTYPE3_SPEED_M 0x000000C0 // Operating Speed. #define USB_TXTYPE3_SPEED_DFLT 0x00000000 // Default #define USB_TXTYPE3_SPEED_FULL 0x00000080 // Full #define USB_TXTYPE3_SPEED_LOW 0x000000C0 // Low #define USB_TXTYPE3_PROTO_M 0x00000030 // Protocol. #define USB_TXTYPE3_PROTO_CTRL 0x00000000 // Control #define USB_TXTYPE3_PROTO_ISOC 0x00000010 // Isochronous #define USB_TXTYPE3_PROTO_BULK 0x00000020 // Bulk #define USB_TXTYPE3_PROTO_INT 0x00000030 // Interrupt #define USB_TXTYPE3_TEP_M 0x0000000F // Target Endpoint Number. #define USB_TXTYPE3_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXINTERVAL3 // register. // //***************************************************************************** #define USB_TXINTERVAL3_TXPOLL_M \ 0x000000FF // TX Polling #define USB_TXINTERVAL3_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_TXINTERVAL3_TXPOLL_S \ 0 #define USB_TXINTERVAL3_NAKLMT_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXTYPE3 register. // //***************************************************************************** #define USB_RXTYPE3_SPEED_M 0x000000C0 // Operating Speed. #define USB_RXTYPE3_SPEED_DFLT 0x00000000 // Default #define USB_RXTYPE3_SPEED_FULL 0x00000080 // Full #define USB_RXTYPE3_SPEED_LOW 0x000000C0 // Low #define USB_RXTYPE3_PROTO_M 0x00000030 // Protocol. #define USB_RXTYPE3_PROTO_CTRL 0x00000000 // Control #define USB_RXTYPE3_PROTO_ISOC 0x00000010 // Isochronous #define USB_RXTYPE3_PROTO_BULK 0x00000020 // Bulk #define USB_RXTYPE3_PROTO_INT 0x00000030 // Interrupt #define USB_RXTYPE3_TEP_M 0x0000000F // Target Endpoint Number. #define USB_RXTYPE3_TEP_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXINTERVAL3 // register. // //***************************************************************************** #define USB_RXINTERVAL3_TXPOLL_M \ 0x000000FF // RX Polling #define USB_RXINTERVAL3_NAKLMT_M \ 0x000000FF // NAK Limit. #define USB_RXINTERVAL3_TXPOLL_S \ 0 #define USB_RXINTERVAL3_NAKLMT_S \ 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RQPKTCOUNT1 // register. // //***************************************************************************** #define USB_RQPKTCOUNT1_M 0x0000FFFF // Block Transfer Packet Count. #define USB_RQPKTCOUNT1_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RQPKTCOUNT2 // register. // //***************************************************************************** #define USB_RQPKTCOUNT2_M 0x0000FFFF // Block Transfer Packet Count. #define USB_RQPKTCOUNT2_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RQPKTCOUNT3 // register. // //***************************************************************************** #define USB_RQPKTCOUNT3_M 0x0000FFFF // Block Transfer Packet Count. #define USB_RQPKTCOUNT3_S 0 //***************************************************************************** // // The following are defines for the bit fields in the USB_O_RXDPKTBUFDIS // register. // //***************************************************************************** #define USB_RXDPKTBUFDIS_EP3 0x00000008 // EP3 RX Double-Packet Buffer // Disable. #define USB_RXDPKTBUFDIS_EP2 0x00000004 // EP2 RX Double-Packet Buffer // Disable. #define USB_RXDPKTBUFDIS_EP1 0x00000002 // EP1 RX Double-Packet Buffer // Disable. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_TXDPKTBUFDIS // register. // //***************************************************************************** #define USB_TXDPKTBUFDIS_EP3 0x00000008 // EP3 TX Double-Packet Buffer // Disable. #define USB_TXDPKTBUFDIS_EP2 0x00000004 // EP2 TX Double-Packet Buffer // Disable. #define USB_TXDPKTBUFDIS_EP1 0x00000002 // EP1 TX Double-Packet Buffer // Disable. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_EPC register. // //***************************************************************************** #define USB_EPC_PFLTACT_M 0x00000300 // Power Fault Action. #define USB_EPC_PFLTACT_UNCHG 0x00000000 // Unchanged #define USB_EPC_PFLTACT_TRIS 0x00000100 // Tristate #define USB_EPC_PFLTACT_LOW 0x00000200 // Low #define USB_EPC_PFLTACT_HIGH 0x00000300 // High #define USB_EPC_PFLTAEN 0x00000040 // Power Fault Action Enable. #define USB_EPC_PFLTSEN_HIGH 0x00000020 // Power Fault Sense. #define USB_EPC_PFLTEN 0x00000010 // Power Fault Input Enable. #define USB_EPC_EPENDE 0x00000004 // EPEN Drive Enable. #define USB_EPC_EPEN_M 0x00000003 // External Power Supply Enable // Configuration. #define USB_EPC_EPEN_LOW 0x00000000 // Power Enable Active Low #define USB_EPC_EPEN_HIGH 0x00000001 // Power Enable Active High #define USB_EPC_EPEN_VBLOW 0x00000002 // Power Enable High if VBUS Low #define USB_EPC_EPEN_VBHIGH 0x00000003 // Power Enable High if VBUS High //***************************************************************************** // // The following are defines for the bit fields in the USB_O_EPCRIS register. // //***************************************************************************** #define USB_EPCRIS_PF 0x00000001 // USB Power Fault Interrupt // Status. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_EPCIM register. // //***************************************************************************** #define USB_EPCIM_PF 0x00000001 // USB Power Fault Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_EPCISC register. // //***************************************************************************** #define USB_EPCISC_PF 0x00000001 // USB Power Fault Interrupt Status // and Clear. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_DRRIS register. // //***************************************************************************** #define USB_DRRIS_RESUME 0x00000001 // Resume Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_DRIM register. // //***************************************************************************** #define USB_DRIM_RESUME 0x00000001 // Resume Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_DRISC register. // //***************************************************************************** #define USB_DRISC_RESUME 0x00000001 // Resume Interrupt Status and // Clear. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_GPCS register. // //***************************************************************************** #define USB_GPCS_DEVMOD 0x00000001 // Device Mode. //***************************************************************************** // // The following are defines for the bit fields in the USB_O_VPLEN register. // //***************************************************************************** #define USB_VPLEN_VPLEN_M 0x000000FF // VBus Pulse Length. #define USB_VPLEN_VPLEN_S 0 #endif // __HW_USB_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_usb.h
C
oos
66,068
//***************************************************************************** // // hw_types.h - Common types and macros. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_TYPES_H__ #define __HW_TYPES_H__ //***************************************************************************** // // Define a boolean type, and values for true and false. // //***************************************************************************** typedef unsigned char tBoolean; #ifndef true #define true 1 #endif #ifndef false #define false 0 #endif //***************************************************************************** // // Macros for hardware access, both direct and via the bit-band region. // //***************************************************************************** #define HWREG(x) \ (*((volatile unsigned long *)(x))) #define HWREGH(x) \ (*((volatile unsigned short *)(x))) #define HWREGB(x) \ (*((volatile unsigned char *)(x))) #define HWREGBITW(x, b) \ HWREG(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) #define HWREGBITH(x, b) \ HWREGH(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) #define HWREGBITB(x, b) \ HWREGB(((unsigned long)(x) & 0xF0000000) | 0x02000000 | \ (((unsigned long)(x) & 0x000FFFFF) << 5) | ((b) << 2)) //***************************************************************************** // // Helper Macros for determining silicon revisions, etc. // // These macros will be used by Driverlib at "run-time" to create necessary // conditional code blocks that will allow a single version of the Driverlib // "binary" code to support multiple(all) Stellaris silicon revisions. // // It is expected that these macros will be used inside of a standard 'C' // conditional block of code, e.g. // // if(CLASS_IS_SANDSTORM) // { // do some Sandstorm-class specific code here. // } // // By default, these macros will be defined as run-time checks of the // appropriate register(s) to allow creation of run-time conditional code // blocks for a common DriverLib across the entire Stellaris family. // // However, if code-space optimization is required, these macros can be "hard- // coded" for a specific version of Stellaris silicon. Many compilers will // then detect the "hard-coded" conditionals, and appropriately optimize the // code blocks, eliminating any "unreachable" code. This would result in // a smaller Driverlib, thus producing a smaller final application size, but // at the cost of limiting the Driverlib binary to a specific Stellaris // silicon revision. // //***************************************************************************** #ifndef CLASS_IS_SANDSTORM #define CLASS_IS_SANDSTORM \ (((HWREG(SYSCTL_DID0) & SYSCTL_DID0_VER_M) == SYSCTL_DID0_VER_0) || \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \ (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_SANDSTORM))) #endif #ifndef CLASS_IS_FURY #define CLASS_IS_FURY \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \ (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_FURY)) #endif #ifndef CLASS_IS_DUSTDEVIL #define CLASS_IS_DUSTDEVIL \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_VER_M | SYSCTL_DID0_CLASS_M)) == \ (SYSCTL_DID0_VER_1 | SYSCTL_DID0_CLASS_DUSTDEVIL)) #endif #ifndef REVISION_IS_A0 #define REVISION_IS_A0 \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \ (SYSCTL_DID0_MAJ_REVA | SYSCTL_DID0_MIN_0)) #endif #ifndef REVISION_IS_A2 #define REVISION_IS_A2 \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \ (SYSCTL_DID0_MAJ_REVA | SYSCTL_DID0_MIN_2)) #endif #ifndef REVISION_IS_C1 #define REVISION_IS_C1 \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \ (SYSCTL_DID0_MAJ_REVC | SYSCTL_DID0_MIN_1)) #endif #ifndef REVISION_IS_C2 #define REVISION_IS_C2 \ ((HWREG(SYSCTL_DID0) & (SYSCTL_DID0_MAJ_M | SYSCTL_DID0_MIN_M)) == \ (SYSCTL_DID0_MAJ_REVC | SYSCTL_DID0_MIN_2)) #endif //***************************************************************************** // // Deprecated silicon class and revision detection macros. // //***************************************************************************** #ifndef DEPRECATED #define DEVICE_IS_SANDSTORM CLASS_IS_SANDSTORM #define DEVICE_IS_FURY CLASS_IS_FURY #define DEVICE_IS_REVA2 REVISION_IS_A2 #define DEVICE_IS_REVC1 REVISION_IS_C1 #define DEVICE_IS_REVC2 REVISION_IS_C2 #endif #endif // __HW_TYPES_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_types.h
C
oos
6,842
//***************************************************************************** // // adc.h - ADC headers for using the ADC driver functions. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __ADC_H__ #define __ADC_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to ADCSequenceConfigure as the ulTrigger // parameter. // //***************************************************************************** #define ADC_TRIGGER_PROCESSOR 0x00000000 // Processor event #define ADC_TRIGGER_COMP0 0x00000001 // Analog comparator 0 event #define ADC_TRIGGER_COMP1 0x00000002 // Analog comparator 1 event #define ADC_TRIGGER_COMP2 0x00000003 // Analog comparator 2 event #define ADC_TRIGGER_EXTERNAL 0x00000004 // External event #define ADC_TRIGGER_TIMER 0x00000005 // Timer event #define ADC_TRIGGER_PWM0 0x00000006 // PWM0 event #define ADC_TRIGGER_PWM1 0x00000007 // PWM1 event #define ADC_TRIGGER_PWM2 0x00000008 // PWM2 event #define ADC_TRIGGER_ALWAYS 0x0000000F // Always event //***************************************************************************** // // Values that can be passed to ADCSequenceStepConfigure as the ulConfig // parameter. // //***************************************************************************** #define ADC_CTL_TS 0x00000080 // Temperature sensor select #define ADC_CTL_IE 0x00000040 // Interrupt enable #define ADC_CTL_END 0x00000020 // Sequence end select #define ADC_CTL_D 0x00000010 // Differential select #define ADC_CTL_CH0 0x00000000 // Input channel 0 #define ADC_CTL_CH1 0x00000001 // Input channel 1 #define ADC_CTL_CH2 0x00000002 // Input channel 2 #define ADC_CTL_CH3 0x00000003 // Input channel 3 #define ADC_CTL_CH4 0x00000004 // Input channel 4 #define ADC_CTL_CH5 0x00000005 // Input channel 5 #define ADC_CTL_CH6 0x00000006 // Input channel 6 #define ADC_CTL_CH7 0x00000007 // Input channel 7 //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum, void (*pfnHandler)(void)); extern void ADCIntUnregister(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum); extern unsigned long ADCIntStatus(unsigned long ulBase, unsigned long ulSequenceNum, tBoolean bMasked); extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSequenceEnable(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSequenceDisable(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSequenceConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulTrigger, unsigned long ulPriority); extern void ADCSequenceStepConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulStep, unsigned long ulConfig); extern long ADCSequenceOverflow(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSequenceOverflowClear(unsigned long ulBase, unsigned long ulSequenceNum); extern long ADCSequenceUnderflow(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSequenceUnderflowClear(unsigned long ulBase, unsigned long ulSequenceNum); extern long ADCSequenceDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer); extern void ADCProcessorTrigger(unsigned long ulBase, unsigned long ulSequenceNum); extern void ADCSoftwareOversampleConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulFactor); extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulStep, unsigned long ulConfig); extern void ADCSoftwareOversampleDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer, unsigned long ulCount); extern void ADCHardwareOversampleConfigure(unsigned long ulBase, unsigned long ulFactor); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __ADC_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/adc.h
C
oos
7,258
//***************************************************************************** // // comp.h - Prototypes for the analog comparator driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __COMP_H__ #define __COMP_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to ComparatorConfigure() as the ulConfig // parameter. For each group (i.e. COMP_TRIG_xxx, COMP_INT_xxx, etc.), one of // the values may be selected and combined together with values from the other // groups via a logical OR. // //***************************************************************************** #define COMP_TRIG_NONE 0x00000000 // No ADC trigger #define COMP_TRIG_HIGH 0x00000880 // Trigger when high #define COMP_TRIG_LOW 0x00000800 // Trigger when low #define COMP_TRIG_FALL 0x00000820 // Trigger on falling edge #define COMP_TRIG_RISE 0x00000840 // Trigger on rising edge #define COMP_TRIG_BOTH 0x00000860 // Trigger on both edges #define COMP_INT_HIGH 0x00000010 // Interrupt when high #define COMP_INT_LOW 0x00000000 // Interrupt when low #define COMP_INT_FALL 0x00000004 // Interrupt on falling edge #define COMP_INT_RISE 0x00000008 // Interrupt on rising edge #define COMP_INT_BOTH 0x0000000C // Interrupt on both edges #define COMP_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin #define COMP_ASRCP_PIN0 0x00000200 // Comp0+ pin #define COMP_ASRCP_REF 0x00000400 // Internal voltage reference #ifndef DEPRECATED #define COMP_OUTPUT_NONE 0x00000000 // No comparator output #endif #define COMP_OUTPUT_NORMAL 0x00000000 // Comparator output normal #define COMP_OUTPUT_INVERT 0x00000002 // Comparator output inverted //***************************************************************************** // // Values that can be passed to ComparatorSetRef() as the ulRef parameter. // //***************************************************************************** #define COMP_REF_OFF 0x00000000 // Turn off the internal reference #define COMP_REF_0V 0x00000300 // Internal reference of 0V #define COMP_REF_0_1375V 0x00000301 // Internal reference of 0.1375V #define COMP_REF_0_275V 0x00000302 // Internal reference of 0.275V #define COMP_REF_0_4125V 0x00000303 // Internal reference of 0.4125V #define COMP_REF_0_55V 0x00000304 // Internal reference of 0.55V #define COMP_REF_0_6875V 0x00000305 // Internal reference of 0.6875V #define COMP_REF_0_825V 0x00000306 // Internal reference of 0.825V #define COMP_REF_0_928125V 0x00000201 // Internal reference of 0.928125V #define COMP_REF_0_9625V 0x00000307 // Internal reference of 0.9625V #define COMP_REF_1_03125V 0x00000202 // Internal reference of 1.03125V #define COMP_REF_1_134375V 0x00000203 // Internal reference of 1.134375V #define COMP_REF_1_1V 0x00000308 // Internal reference of 1.1V #define COMP_REF_1_2375V 0x00000309 // Internal reference of 1.2375V #define COMP_REF_1_340625V 0x00000205 // Internal reference of 1.340625V #define COMP_REF_1_375V 0x0000030A // Internal reference of 1.375V #define COMP_REF_1_44375V 0x00000206 // Internal reference of 1.44375V #define COMP_REF_1_5125V 0x0000030B // Internal reference of 1.5125V #define COMP_REF_1_546875V 0x00000207 // Internal reference of 1.546875V #define COMP_REF_1_65V 0x0000030C // Internal reference of 1.65V #define COMP_REF_1_753125V 0x00000209 // Internal reference of 1.753125V #define COMP_REF_1_7875V 0x0000030D // Internal reference of 1.7875V #define COMP_REF_1_85625V 0x0000020A // Internal reference of 1.85625V #define COMP_REF_1_925V 0x0000030E // Internal reference of 1.925V #define COMP_REF_1_959375V 0x0000020B // Internal reference of 1.959375V #define COMP_REF_2_0625V 0x0000030F // Internal reference of 2.0625V #define COMP_REF_2_165625V 0x0000020D // Internal reference of 2.165625V #define COMP_REF_2_26875V 0x0000020E // Internal reference of 2.26875V #define COMP_REF_2_371875V 0x0000020F // Internal reference of 2.371875V //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void ComparatorConfigure(unsigned long ulBase, unsigned long ulComp, unsigned long ulConfig); extern void ComparatorRefSet(unsigned long ulBase, unsigned long ulRef); extern tBoolean ComparatorValueGet(unsigned long ulBase, unsigned long ulComp); extern void ComparatorIntRegister(unsigned long ulBase, unsigned long ulComp, void (*pfnHandler)(void)); extern void ComparatorIntUnregister(unsigned long ulBase, unsigned long ulComp); extern void ComparatorIntEnable(unsigned long ulBase, unsigned long ulComp); extern void ComparatorIntDisable(unsigned long ulBase, unsigned long ulComp); extern tBoolean ComparatorIntStatus(unsigned long ulBase, unsigned long ulComp, tBoolean bMasked); extern void ComparatorIntClear(unsigned long ulBase, unsigned long ulComp); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __COMP_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/comp.h
C
oos
7,319
//***************************************************************************** // // hw_flash.h - Macros used when accessing the flash controller. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_FLASH_H__ #define __HW_FLASH_H__ //***************************************************************************** // // The following are defines for the FLASH register offsets. // //***************************************************************************** #define FLASH_FMA 0x400FD000 // Memory address register #define FLASH_FMD 0x400FD004 // Memory data register #define FLASH_FMC 0x400FD008 // Memory control register #define FLASH_FCRIS 0x400FD00C // Raw interrupt status register #define FLASH_FCIM 0x400FD010 // Interrupt mask register #define FLASH_FCMISC 0x400FD014 // Interrupt status register #define FLASH_RMCTL 0x400FE0F0 // ROM Control #define FLASH_RMVER 0x400FE0F4 // ROM Version Register #define FLASH_FMPRE 0x400FE130 // FLASH read protect register #define FLASH_FMPPE 0x400FE134 // FLASH program protect register #define FLASH_USECRL 0x400FE140 // uSec reload register #define FLASH_USERDBG 0x400FE1D0 // User Debug #define FLASH_USERREG0 0x400FE1E0 // User Register 0 #define FLASH_USERREG1 0x400FE1E4 // User Register 1 #define FLASH_USERREG2 0x400FE1E8 // User Register 2 #define FLASH_USERREG3 0x400FE1EC // User Register 3 #define FLASH_FMPRE0 0x400FE200 // FLASH read protect register 0 #define FLASH_FMPRE1 0x400FE204 // FLASH read protect register 1 #define FLASH_FMPRE2 0x400FE208 // FLASH read protect register 2 #define FLASH_FMPRE3 0x400FE20C // FLASH read protect register 3 #define FLASH_FMPPE0 0x400FE400 // FLASH program protect register 0 #define FLASH_FMPPE1 0x400FE404 // FLASH program protect register 1 #define FLASH_FMPPE2 0x400FE408 // FLASH program protect register 2 #define FLASH_FMPPE3 0x400FE40C // FLASH program protect register 3 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FMC register. // //***************************************************************************** #define FLASH_FMC_WRKEY_M 0xFFFF0000 // FLASH write key mask #define FLASH_FMC_WRKEY 0xA4420000 // FLASH write key #define FLASH_FMC_COMT 0x00000008 // Commit user register #define FLASH_FMC_MERASE 0x00000004 // Mass erase FLASH #define FLASH_FMC_ERASE 0x00000002 // Erase FLASH page #define FLASH_FMC_WRITE 0x00000001 // Write FLASH word #define FLASH_FMC_WRKEY_S 16 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FCRIS register. // //***************************************************************************** #define FLASH_FCRIS_PRIS 0x00000002 // Programming Raw Interrupt // Status. #define FLASH_FCRIS_ARIS 0x00000001 // Access Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FCIM register. // //***************************************************************************** #define FLASH_FCIM_PMASK 0x00000002 // Programming Interrupt Mask. #define FLASH_FCIM_AMASK 0x00000001 // Access Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FMIS register. // //***************************************************************************** #define FLASH_FCMISC_PMISC 0x00000002 // Programming Masked Interrupt // Status and Clear. #define FLASH_FCMISC_AMISC 0x00000001 // Access Masked Interrupt Status // and Clear. //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FMPRE and // FLASH_FMPPE registers. // //***************************************************************************** #define FLASH_FMP_BLOCK_31 0x80000000 // Enable for block 31 #define FLASH_FMP_BLOCK_30 0x40000000 // Enable for block 30 #define FLASH_FMP_BLOCK_29 0x20000000 // Enable for block 29 #define FLASH_FMP_BLOCK_28 0x10000000 // Enable for block 28 #define FLASH_FMP_BLOCK_27 0x08000000 // Enable for block 27 #define FLASH_FMP_BLOCK_26 0x04000000 // Enable for block 26 #define FLASH_FMP_BLOCK_25 0x02000000 // Enable for block 25 #define FLASH_FMP_BLOCK_24 0x01000000 // Enable for block 24 #define FLASH_FMP_BLOCK_23 0x00800000 // Enable for block 23 #define FLASH_FMP_BLOCK_22 0x00400000 // Enable for block 22 #define FLASH_FMP_BLOCK_21 0x00200000 // Enable for block 21 #define FLASH_FMP_BLOCK_20 0x00100000 // Enable for block 20 #define FLASH_FMP_BLOCK_19 0x00080000 // Enable for block 19 #define FLASH_FMP_BLOCK_18 0x00040000 // Enable for block 18 #define FLASH_FMP_BLOCK_17 0x00020000 // Enable for block 17 #define FLASH_FMP_BLOCK_16 0x00010000 // Enable for block 16 #define FLASH_FMP_BLOCK_15 0x00008000 // Enable for block 15 #define FLASH_FMP_BLOCK_14 0x00004000 // Enable for block 14 #define FLASH_FMP_BLOCK_13 0x00002000 // Enable for block 13 #define FLASH_FMP_BLOCK_12 0x00001000 // Enable for block 12 #define FLASH_FMP_BLOCK_11 0x00000800 // Enable for block 11 #define FLASH_FMP_BLOCK_10 0x00000400 // Enable for block 10 #define FLASH_FMP_BLOCK_9 0x00000200 // Enable for block 9 #define FLASH_FMP_BLOCK_8 0x00000100 // Enable for block 8 #define FLASH_FMP_BLOCK_7 0x00000080 // Enable for block 7 #define FLASH_FMP_BLOCK_6 0x00000040 // Enable for block 6 #define FLASH_FMP_BLOCK_5 0x00000020 // Enable for block 5 #define FLASH_FMP_BLOCK_4 0x00000010 // Enable for block 4 #define FLASH_FMP_BLOCK_3 0x00000008 // Enable for block 3 #define FLASH_FMP_BLOCK_2 0x00000004 // Enable for block 2 #define FLASH_FMP_BLOCK_1 0x00000002 // Enable for block 1 #define FLASH_FMP_BLOCK_0 0x00000001 // Enable for block 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USECRL register. // //***************************************************************************** #define FLASH_USECRL_M 0x000000FF // Microsecond Reload Value. #define FLASH_USECRL_S 0 //***************************************************************************** // // The following are defines for the erase size of the FLASH block that is // erased by an erase operation, and the protect size is the size of the FLASH // block that is protected by each protection register. // //***************************************************************************** #define FLASH_PROTECT_SIZE 0x00000800 #define FLASH_ERASE_SIZE 0x00000400 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FMA register. // //***************************************************************************** #define FLASH_FMA_OFFSET_M 0x0003FFFF // Address Offset. #define FLASH_FMA_OFFSET_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_FMD register. // //***************************************************************************** #define FLASH_FMD_DATA_M 0xFFFFFFFF // Data Value. #define FLASH_FMD_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USERDBG register. // //***************************************************************************** #define FLASH_USERDBG_NW 0x80000000 // User Debug Not Written. #define FLASH_USERDBG_DATA_M 0x7FFFFFFC // User Data. #define FLASH_USERDBG_DBG1 0x00000002 // Debug Control 1. #define FLASH_USERDBG_DBG0 0x00000001 // Debug Control 0. #define FLASH_USERDBG_DATA_S 2 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USERREG0 register. // //***************************************************************************** #define FLASH_USERREG0_NW 0x80000000 // Not Written. #define FLASH_USERREG0_DATA_M 0x7FFFFFFF // User Data. #define FLASH_USERREG0_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USERREG1 register. // //***************************************************************************** #define FLASH_USERREG1_NW 0x80000000 // Not Written. #define FLASH_USERREG1_DATA_M 0x7FFFFFFF // User Data. #define FLASH_USERREG1_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_RMCTL register. // //***************************************************************************** #define FLASH_RMCTL_BA 0x00000001 // Boot Alias. //***************************************************************************** // // The following are defines for the bit fields in the FLASH_RMVER register. // //***************************************************************************** #define FLASH_RMVER_CONT_M 0xFF000000 // ROM Contents. #define FLASH_RMVER_CONT_LM 0x00000000 // Boot Loader & DriverLib #define FLASH_RMVER_SIZE_M 0x00FF0000 // ROM Size. #define FLASH_RMVER_SIZE_11K 0x00000000 // 11KB Size #define FLASH_RMVER_VER_M 0x0000FF00 // ROM Version. #define FLASH_RMVER_REV_M 0x000000FF // ROM Revision. #define FLASH_RMVER_VER_S 8 #define FLASH_RMVER_REV_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USERREG2 register. // //***************************************************************************** #define FLASH_USERREG2_NW 0x80000000 // Not Written. #define FLASH_USERREG2_DATA_M 0x7FFFFFFF // User Data. #define FLASH_USERREG2_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the FLASH_USERREG3 register. // //***************************************************************************** #define FLASH_USERREG3_NW 0x80000000 // Not Written. #define FLASH_USERREG3_DATA_M 0x7FFFFFFF // User Data. #define FLASH_USERREG3_DATA_S 0 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the bit fields in the FLASH_FMC // register. // //***************************************************************************** #define FLASH_FMC_WRKEY_MASK 0xFFFF0000 // FLASH write key mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the FLASH_FCRIS // register. // //***************************************************************************** #define FLASH_FCRIS_PROGRAM 0x00000002 // Programming status #define FLASH_FCRIS_ACCESS 0x00000001 // Invalid access status //***************************************************************************** // // The following are deprecated defines for the bit fields in the FLASH_FCIM // register. // //***************************************************************************** #define FLASH_FCIM_PROGRAM 0x00000002 // Programming mask #define FLASH_FCIM_ACCESS 0x00000001 // Invalid access mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the FLASH_FMIS // register. // //***************************************************************************** #define FLASH_FCMISC_PROGRAM 0x00000002 // Programming status #define FLASH_FCMISC_ACCESS 0x00000001 // Invalid access status //***************************************************************************** // // The following are deprecated defines for the bit fields in the FLASH_USECRL // register. // //***************************************************************************** #define FLASH_USECRL_MASK 0x000000FF // Clock per uSec #define FLASH_USECRL_SHIFT 0 #endif #endif // __HW_FLASH_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_flash.h
C
oos
14,805
//***************************************************************************** // // hw_comp.h - Macros used when accessing the comparator hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_COMP_H__ #define __HW_COMP_H__ //***************************************************************************** // // The following are defines for the comparator register offsets. // //***************************************************************************** #define COMP_O_ACMIS 0x00000000 // Analog Comparator Masked // Interrupt Status #define COMP_O_ACRIS 0x00000004 // Analog Comparator Raw Interrupt // Status #define COMP_O_ACINTEN 0x00000008 // Analog Comparator Interrupt // Enable #define COMP_O_ACREFCTL 0x00000010 // Analog Comparator Reference // Voltage Control #define COMP_O_ACSTAT0 0x00000020 // Comp0 status register #define COMP_O_ACCTL0 0x00000024 // Comp0 control register #define COMP_O_ACSTAT1 0x00000040 // Comp1 status register #define COMP_O_ACCTL1 0x00000044 // Comp1 control register #define COMP_O_ACSTAT2 0x00000060 // Comp2 status register #define COMP_O_ACCTL2 0x00000064 // Comp2 control register //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACMIS register. // //***************************************************************************** #define COMP_ACMIS_IN2 0x00000004 // Comparator 2 Masked Interrupt // Status. #define COMP_ACMIS_IN1 0x00000002 // Comparator 1 Masked Interrupt // Status. #define COMP_ACMIS_IN0 0x00000001 // Comparator 0 Masked Interrupt // Status. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACRIS register. // //***************************************************************************** #define COMP_ACRIS_IN2 0x00000004 // Comparator 2 Interrupt Status. #define COMP_ACRIS_IN1 0x00000002 // Comparator 1 Interrupt Status. #define COMP_ACRIS_IN0 0x00000001 // Comparator 0 Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACINTEN register. // //***************************************************************************** #define COMP_ACINTEN_IN2 0x00000004 // Comparator 2 Interrupt Enable. #define COMP_ACINTEN_IN1 0x00000002 // Comparator 1 Interrupt Enable. #define COMP_ACINTEN_IN0 0x00000001 // Comparator 0 Interrupt Enable. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACREFCTL // register. // //***************************************************************************** #define COMP_ACREFCTL_EN 0x00000200 // Resistor Ladder Enable. #define COMP_ACREFCTL_RNG 0x00000100 // Resistor Ladder Range. #define COMP_ACREFCTL_VREF_M 0x0000000F // Resistor Ladder Voltage Ref. #define COMP_ACREFCTL_VREF_S 0 //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACSTAT0 register. // //***************************************************************************** #define COMP_ACSTAT0_OVAL 0x00000002 // Comparator Output Value. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACCTL0 register. // //***************************************************************************** #define COMP_ACCTL0_TOEN 0x00000800 // Trigger Output Enable. #define COMP_ACCTL0_ASRCP_M 0x00000600 // Analog Source Positive. #define COMP_ACCTL0_ASRCP_PIN 0x00000000 // Pin value #define COMP_ACCTL0_ASRCP_PIN0 0x00000200 // Pin value of C0+ #define COMP_ACCTL0_ASRCP_REF 0x00000400 // Internal voltage reference #define COMP_ACCTL0_TSLVAL 0x00000080 // Trigger Sense Level Value. #define COMP_ACCTL0_TSEN_M 0x00000060 // Trigger Sense. #define COMP_ACCTL0_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL #define COMP_ACCTL0_TSEN_FALL 0x00000020 // Falling edge #define COMP_ACCTL0_TSEN_RISE 0x00000040 // Rising edge #define COMP_ACCTL0_TSEN_BOTH 0x00000060 // Either edge #define COMP_ACCTL0_ISLVAL 0x00000010 // Interrupt Sense Level Value. #define COMP_ACCTL0_ISEN_M 0x0000000C // Interrupt Sense. #define COMP_ACCTL0_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL #define COMP_ACCTL0_ISEN_FALL 0x00000004 // Falling edge #define COMP_ACCTL0_ISEN_RISE 0x00000008 // Rising edge #define COMP_ACCTL0_ISEN_BOTH 0x0000000C // Either edge #define COMP_ACCTL0_CINV 0x00000002 // Comparator Output Invert. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACSTAT1 register. // //***************************************************************************** #define COMP_ACSTAT1_OVAL 0x00000002 // Comparator Output Value. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACCTL1 register. // //***************************************************************************** #define COMP_ACCTL1_TOEN 0x00000800 // Trigger Output Enable. #define COMP_ACCTL1_ASRCP_M 0x00000600 // Analog Source Positive. #define COMP_ACCTL1_ASRCP_PIN 0x00000000 // Pin value #define COMP_ACCTL1_ASRCP_PIN0 0x00000200 // Pin value of C0+ #define COMP_ACCTL1_ASRCP_REF 0x00000400 // Internal voltage reference #define COMP_ACCTL1_TSLVAL 0x00000080 // Trigger Sense Level Value. #define COMP_ACCTL1_TSEN_M 0x00000060 // Trigger Sense. #define COMP_ACCTL1_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL #define COMP_ACCTL1_TSEN_FALL 0x00000020 // Falling edge #define COMP_ACCTL1_TSEN_RISE 0x00000040 // Rising edge #define COMP_ACCTL1_TSEN_BOTH 0x00000060 // Either edge #define COMP_ACCTL1_ISLVAL 0x00000010 // Interrupt Sense Level Value. #define COMP_ACCTL1_ISEN_M 0x0000000C // Interrupt Sense. #define COMP_ACCTL1_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL #define COMP_ACCTL1_ISEN_FALL 0x00000004 // Falling edge #define COMP_ACCTL1_ISEN_RISE 0x00000008 // Rising edge #define COMP_ACCTL1_ISEN_BOTH 0x0000000C // Either edge #define COMP_ACCTL1_CINV 0x00000002 // Comparator Output Invert. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACSTAT2 register. // //***************************************************************************** #define COMP_ACSTAT2_OVAL 0x00000002 // Comparator Output Value. //***************************************************************************** // // The following are defines for the bit fields in the COMP_O_ACCTL2 register. // //***************************************************************************** #define COMP_ACCTL2_TOEN 0x00000800 // Trigger Output Enable. #define COMP_ACCTL2_ASRCP_M 0x00000600 // Analog Source Positive. #define COMP_ACCTL2_ASRCP_PIN 0x00000000 // Pin value #define COMP_ACCTL2_ASRCP_PIN0 0x00000200 // Pin value of C0+ #define COMP_ACCTL2_ASRCP_REF 0x00000400 // Internal voltage reference #define COMP_ACCTL2_TSLVAL 0x00000080 // Trigger Sense Level Value. #define COMP_ACCTL2_TSEN_M 0x00000060 // Trigger Sense. #define COMP_ACCTL2_TSEN_LEVEL 0x00000000 // Level sense, see TSLVAL #define COMP_ACCTL2_TSEN_FALL 0x00000020 // Falling edge #define COMP_ACCTL2_TSEN_RISE 0x00000040 // Rising edge #define COMP_ACCTL2_TSEN_BOTH 0x00000060 // Either edge #define COMP_ACCTL2_ISLVAL 0x00000010 // Interrupt Sense Level Value. #define COMP_ACCTL2_ISEN_M 0x0000000C // Interrupt Sense. #define COMP_ACCTL2_ISEN_LEVEL 0x00000000 // Level sense, see ISLVAL #define COMP_ACCTL2_ISEN_FALL 0x00000004 // Falling edge #define COMP_ACCTL2_ISEN_RISE 0x00000008 // Rising edge #define COMP_ACCTL2_ISEN_BOTH 0x0000000C // Either edge #define COMP_ACCTL2_CINV 0x00000002 // Comparator Output Invert. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the comparator register offsets. // //***************************************************************************** #define COMP_O_MIS 0x00000000 // Interrupt status register #define COMP_O_RIS 0x00000004 // Raw interrupt status register #define COMP_O_INTEN 0x00000008 // Interrupt enable register #define COMP_O_REFCTL 0x00000010 // Reference voltage control reg. //***************************************************************************** // // The following are deprecated defines for the bit fields in the COMP_MIS, // COMP_RIS, and COMP_INTEN registers. // //***************************************************************************** #define COMP_INT_2 0x00000004 // Comp2 interrupt #define COMP_INT_1 0x00000002 // Comp1 interrupt #define COMP_INT_0 0x00000001 // Comp0 interrupt //***************************************************************************** // // The following are deprecated defines for the bit fields in the COMP_REFCTL // register. // //***************************************************************************** #define COMP_REFCTL_EN 0x00000200 // Reference voltage enable #define COMP_REFCTL_RNG 0x00000100 // Reference voltage range #define COMP_REFCTL_VREF_MASK 0x0000000F // Reference voltage select mask #define COMP_REFCTL_VREF_SHIFT 0 //***************************************************************************** // // The following are deprecated defines for the bit fields in the COMP_ACSTAT0, // COMP_ACSTAT1, and COMP_ACSTAT2 registers. // //***************************************************************************** #define COMP_ACSTAT_OVAL 0x00000002 // Comparator output value //***************************************************************************** // // The following are deprecated defines for the bit fields in the COMP_ACCTL0, // COMP_ACCTL1, and COMP_ACCTL2 registers. // //***************************************************************************** #define COMP_ACCTL_TMASK 0x00000800 // Trigger enable #define COMP_ACCTL_ASRCP_MASK 0x00000600 // Vin+ source select mask #define COMP_ACCTL_ASRCP_PIN 0x00000000 // Dedicated Comp+ pin #define COMP_ACCTL_ASRCP_PIN0 0x00000200 // Comp0+ pin #define COMP_ACCTL_ASRCP_REF 0x00000400 // Internal voltage reference #define COMP_ACCTL_ASRCP_RES 0x00000600 // Reserved #define COMP_ACCTL_OEN 0x00000100 // Comparator output enable #define COMP_ACCTL_TSVAL 0x00000080 // Trigger polarity select #define COMP_ACCTL_TSEN_MASK 0x00000060 // Trigger sense mask #define COMP_ACCTL_TSEN_LEVEL 0x00000000 // Trigger is level sense #define COMP_ACCTL_TSEN_FALL 0x00000020 // Trigger is falling edge #define COMP_ACCTL_TSEN_RISE 0x00000040 // Trigger is rising edge #define COMP_ACCTL_TSEN_BOTH 0x00000060 // Trigger is both edges #define COMP_ACCTL_ISLVAL 0x00000010 // Interrupt polarity select #define COMP_ACCTL_ISEN_MASK 0x0000000C // Interrupt sense mask #define COMP_ACCTL_ISEN_LEVEL 0x00000000 // Interrupt is level sense #define COMP_ACCTL_ISEN_FALL 0x00000004 // Interrupt is falling edge #define COMP_ACCTL_ISEN_RISE 0x00000008 // Interrupt is rising edge #define COMP_ACCTL_ISEN_BOTH 0x0000000C // Interrupt is both edges #define COMP_ACCTL_CINV 0x00000002 // Comparator output invert //***************************************************************************** // // The following are deprecated defines for the reset values for the comparator // registers. // //***************************************************************************** #define COMP_RV_ACCTL1 0x00000000 // Comp1 control register #define COMP_RV_ACSTAT2 0x00000000 // Comp2 status register #define COMP_RV_ACSTAT0 0x00000000 // Comp0 status register #define COMP_RV_RIS 0x00000000 // Raw interrupt status register #define COMP_RV_INTEN 0x00000000 // Interrupt enable register #define COMP_RV_ACCTL2 0x00000000 // Comp2 control register #define COMP_RV_MIS 0x00000000 // Interrupt status register #define COMP_RV_ACCTL0 0x00000000 // Comp0 control register #define COMP_RV_ACSTAT1 0x00000000 // Comp1 status register #define COMP_RV_REFCTL 0x00000000 // Reference voltage control reg. #endif #endif // __HW_COMP_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_comp.h
C
oos
15,033
//***************************************************************************** // // hw_ints.h - Macros that define the interrupt assignment on Stellaris. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_INTS_H__ #define __HW_INTS_H__ //***************************************************************************** // // The following are defines for the fault assignments. // //***************************************************************************** #define FAULT_NMI 2 // NMI fault #define FAULT_HARD 3 // Hard fault #define FAULT_MPU 4 // MPU fault #define FAULT_BUS 5 // Bus fault #define FAULT_USAGE 6 // Usage fault #define FAULT_SVCALL 11 // SVCall #define FAULT_DEBUG 12 // Debug monitor #define FAULT_PENDSV 14 // PendSV #define FAULT_SYSTICK 15 // System Tick //***************************************************************************** // // The following are defines for the interrupt assignments. // //***************************************************************************** #define INT_GPIOA 16 // GPIO Port A #define INT_GPIOB 17 // GPIO Port B #define INT_GPIOC 18 // GPIO Port C #define INT_GPIOD 19 // GPIO Port D #define INT_GPIOE 20 // GPIO Port E #define INT_UART0 21 // UART0 Rx and Tx #define INT_UART1 22 // UART1 Rx and Tx #define INT_SSI0 23 // SSI0 Rx and Tx #define INT_I2C0 24 // I2C0 Master and Slave #define INT_PWM_FAULT 25 // PWM Fault #define INT_PWM0 26 // PWM Generator 0 #define INT_PWM1 27 // PWM Generator 1 #define INT_PWM2 28 // PWM Generator 2 #define INT_QEI0 29 // Quadrature Encoder 0 #define INT_ADC0 30 // ADC Sequence 0 #define INT_ADC1 31 // ADC Sequence 1 #define INT_ADC2 32 // ADC Sequence 2 #define INT_ADC3 33 // ADC Sequence 3 #define INT_WATCHDOG 34 // Watchdog timer #define INT_TIMER0A 35 // Timer 0 subtimer A #define INT_TIMER0B 36 // Timer 0 subtimer B #define INT_TIMER1A 37 // Timer 1 subtimer A #define INT_TIMER1B 38 // Timer 1 subtimer B #define INT_TIMER2A 39 // Timer 2 subtimer A #define INT_TIMER2B 40 // Timer 2 subtimer B #define INT_COMP0 41 // Analog Comparator 0 #define INT_COMP1 42 // Analog Comparator 1 #define INT_COMP2 43 // Analog Comparator 2 #define INT_SYSCTL 44 // System Control (PLL, OSC, BO) #define INT_FLASH 45 // FLASH Control #define INT_GPIOF 46 // GPIO Port F #define INT_GPIOG 47 // GPIO Port G #define INT_GPIOH 48 // GPIO Port H #define INT_UART2 49 // UART2 Rx and Tx #define INT_SSI1 50 // SSI1 Rx and Tx #define INT_TIMER3A 51 // Timer 3 subtimer A #define INT_TIMER3B 52 // Timer 3 subtimer B #define INT_I2C1 53 // I2C1 Master and Slave #define INT_QEI1 54 // Quadrature Encoder 1 #define INT_CAN0 55 // CAN0 #define INT_CAN1 56 // CAN1 #define INT_CAN2 57 // CAN2 #define INT_ETH 58 // Ethernet #define INT_HIBERNATE 59 // Hibernation module #define INT_USB0 60 // USB 0 Controller #define INT_PWM3 61 // PWM Generator 3 #define INT_UDMA 62 // uDMA controller #define INT_UDMAERR 63 // uDMA Error //***************************************************************************** // // The following are defines for the total number of interrupts. // //***************************************************************************** #define NUM_INTERRUPTS 64 //***************************************************************************** // // The following are defines for the total number of priority levels. // //***************************************************************************** #define NUM_PRIORITY 8 #define NUM_PRIORITY_BITS 3 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the interrupt assignments. // //***************************************************************************** #define INT_SSI 23 // SSI Rx and Tx #define INT_I2C 24 // I2C Master and Slave #define INT_QEI 29 // Quadrature Encoder #endif #endif // __HW_INTS_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_ints.h
C
oos
6,804
//***************************************************************************** // // cpu.h - Prototypes for the CPU instruction wrapper functions. // // Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __CPU_H__ #define __CPU_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Prototypes. // //***************************************************************************** extern unsigned long CPUcpsid(void); extern unsigned long CPUcpsie(void); extern void CPUwfi(void); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __CPU_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/cpu.h
C
oos
2,337
//***************************************************************************** // // uart.h - Defines and Macros for the UART. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __UART_H__ #define __UART_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Values that can be passed to UARTIntEnable, UARTIntDisable, and UARTIntClear // as the ulIntFlags parameter, and returned from UARTIntStatus. // //***************************************************************************** #define UART_INT_OE 0x400 // Overrun Error Interrupt Mask #define UART_INT_BE 0x200 // Break Error Interrupt Mask #define UART_INT_PE 0x100 // Parity Error Interrupt Mask #define UART_INT_FE 0x080 // Framing Error Interrupt Mask #define UART_INT_RT 0x040 // Receive Timeout Interrupt Mask #define UART_INT_TX 0x020 // Transmit Interrupt Mask #define UART_INT_RX 0x010 // Receive Interrupt Mask //***************************************************************************** // // Values that can be passed to UARTConfigSetExpClk as the ulConfig parameter // and returned by UARTConfigGetExpClk in the pulConfig parameter. // Additionally, the UART_CONFIG_PAR_* subset can be passed to // UARTParityModeSet as the ulParity parameter, and are returned by // UARTParityModeGet. // //***************************************************************************** #define UART_CONFIG_WLEN_MASK 0x00000060 // Mask for extracting word length #define UART_CONFIG_WLEN_8 0x00000060 // 8 bit data #define UART_CONFIG_WLEN_7 0x00000040 // 7 bit data #define UART_CONFIG_WLEN_6 0x00000020 // 6 bit data #define UART_CONFIG_WLEN_5 0x00000000 // 5 bit data #define UART_CONFIG_STOP_MASK 0x00000008 // Mask for extracting stop bits #define UART_CONFIG_STOP_ONE 0x00000000 // One stop bit #define UART_CONFIG_STOP_TWO 0x00000008 // Two stop bits #define UART_CONFIG_PAR_MASK 0x00000086 // Mask for extracting parity #define UART_CONFIG_PAR_NONE 0x00000000 // No parity #define UART_CONFIG_PAR_EVEN 0x00000006 // Even parity #define UART_CONFIG_PAR_ODD 0x00000002 // Odd parity #define UART_CONFIG_PAR_ONE 0x00000086 // Parity bit is one #define UART_CONFIG_PAR_ZERO 0x00000082 // Parity bit is zero //***************************************************************************** // // Values that can be passed to UARTFIFOLevelSet as the ulTxLevel parameter and // returned by UARTFIFOLevelGet in the pulTxLevel. // //***************************************************************************** #define UART_FIFO_TX1_8 0x00000000 // Transmit interrupt at 1/8 Full #define UART_FIFO_TX2_8 0x00000001 // Transmit interrupt at 1/4 Full #define UART_FIFO_TX4_8 0x00000002 // Transmit interrupt at 1/2 Full #define UART_FIFO_TX6_8 0x00000003 // Transmit interrupt at 3/4 Full #define UART_FIFO_TX7_8 0x00000004 // Transmit interrupt at 7/8 Full //***************************************************************************** // // Values that can be passed to UARTFIFOLevelSet as the ulRxLevel parameter and // returned by UARTFIFOLevelGet in the pulRxLevel. // //***************************************************************************** #define UART_FIFO_RX1_8 0x00000000 // Receive interrupt at 1/8 Full #define UART_FIFO_RX2_8 0x00000008 // Receive interrupt at 1/4 Full #define UART_FIFO_RX4_8 0x00000010 // Receive interrupt at 1/2 Full #define UART_FIFO_RX6_8 0x00000018 // Receive interrupt at 3/4 Full #define UART_FIFO_RX7_8 0x00000020 // Receive interrupt at 7/8 Full //***************************************************************************** // // Values that can be passed to UARTDMAEnable() and UARTDMADisable(). // //***************************************************************************** #define UART_DMA_ERR_RXSTOP 0x00000004 // Stop DMA receive if UART error #define UART_DMA_TX 0x00000002 // Enable DMA for transmit #define UART_DMA_RX 0x00000001 // Enable DMA for receive //***************************************************************************** // // API Function prototypes // //***************************************************************************** extern void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity); extern unsigned long UARTParityModeGet(unsigned long ulBase); extern void UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel, unsigned long ulRxLevel); extern void UARTFIFOLevelGet(unsigned long ulBase, unsigned long *pulTxLevel, unsigned long *pulRxLevel); extern void UARTConfigSetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long ulBaud, unsigned long ulConfig); extern void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long *pulBaud, unsigned long *pulConfig); extern void UARTEnable(unsigned long ulBase); extern void UARTDisable(unsigned long ulBase); extern void UARTEnableSIR(unsigned long ulBase, tBoolean bLowPower); extern void UARTDisableSIR(unsigned long ulBase); extern tBoolean UARTCharsAvail(unsigned long ulBase); extern tBoolean UARTSpaceAvail(unsigned long ulBase); extern long UARTCharGetNonBlocking(unsigned long ulBase); extern long UARTCharGet(unsigned long ulBase); extern tBoolean UARTCharPutNonBlocking(unsigned long ulBase, unsigned char ucData); extern void UARTCharPut(unsigned long ulBase, unsigned char ucData); extern void UARTBreakCtl(unsigned long ulBase, tBoolean bBreakState); extern void UARTIntRegister(unsigned long ulBase, void(*pfnHandler)(void)); extern void UARTIntUnregister(unsigned long ulBase); extern void UARTIntEnable(unsigned long ulBase, unsigned long ulIntFlags); extern void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags); extern unsigned long UARTIntStatus(unsigned long ulBase, tBoolean bMasked); extern void UARTIntClear(unsigned long ulBase, unsigned long ulIntFlags); extern void UARTDMAEnable(unsigned long ulBase, unsigned long ulDMAFlags); extern void UARTDMADisable(unsigned long ulBase, unsigned long ulDMAFlags); //***************************************************************************** // // Several UART APIs have been renamed, with the original function name being // deprecated. These defines provide backward compatibility. // //***************************************************************************** #ifndef DEPRECATED #include "sysctl.h" #define UARTConfigSet(a, b, c) \ UARTConfigSetExpClk(a, SysCtlClockGet(), b, c) #define UARTConfigGet(a, b, c) \ UARTConfigGetExpClk(a, SysCtlClockGet(), b, c) #define UARTCharNonBlockingGet(a) \ UARTCharGetNonBlocking(a) #define UARTCharNonBlockingPut(a, b) \ UARTCharPutNonBlocking(a, b) #endif //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __UART_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/uart.h
C
oos
9,110
//***************************************************************************** // // gpio.h - Defines and Macros for GPIO API. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __GPIO_H__ #define __GPIO_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // The following values define the bit field for the ucPins argument to several // of the APIs. // //***************************************************************************** #define GPIO_PIN_0 0x00000001 // GPIO pin 0 #define GPIO_PIN_1 0x00000002 // GPIO pin 1 #define GPIO_PIN_2 0x00000004 // GPIO pin 2 #define GPIO_PIN_3 0x00000008 // GPIO pin 3 #define GPIO_PIN_4 0x00000010 // GPIO pin 4 #define GPIO_PIN_5 0x00000020 // GPIO pin 5 #define GPIO_PIN_6 0x00000040 // GPIO pin 6 #define GPIO_PIN_7 0x00000080 // GPIO pin 7 //***************************************************************************** // // Values that can be passed to GPIODirModeSet as the ulPinIO parameter, and // returned from GPIODirModeGet. // //***************************************************************************** #define GPIO_DIR_MODE_IN 0x00000000 // Pin is a GPIO input #define GPIO_DIR_MODE_OUT 0x00000001 // Pin is a GPIO output #define GPIO_DIR_MODE_HW 0x00000002 // Pin is a peripheral function //***************************************************************************** // // Values that can be passed to GPIOIntTypeSet as the ulIntType parameter, and // returned from GPIOIntTypeGet. // //***************************************************************************** #define GPIO_FALLING_EDGE 0x00000000 // Interrupt on falling edge #define GPIO_RISING_EDGE 0x00000004 // Interrupt on rising edge #define GPIO_BOTH_EDGES 0x00000001 // Interrupt on both edges #define GPIO_LOW_LEVEL 0x00000002 // Interrupt on low level #define GPIO_HIGH_LEVEL 0x00000007 // Interrupt on high level //***************************************************************************** // // Values that can be passed to GPIOPadConfigSet as the ulStrength parameter, // and returned by GPIOPadConfigGet in the *pulStrength parameter. // //***************************************************************************** #define GPIO_STRENGTH_2MA 0x00000001 // 2mA drive strength #define GPIO_STRENGTH_4MA 0x00000002 // 4mA drive strength #define GPIO_STRENGTH_8MA 0x00000004 // 8mA drive strength #define GPIO_STRENGTH_8MA_SC 0x0000000C // 8mA drive with slew rate control //***************************************************************************** // // Values that can be passed to GPIOPadConfigSet as the ulPadType parameter, // and returned by GPIOPadConfigGet in the *pulPadType parameter. // //***************************************************************************** #define GPIO_PIN_TYPE_STD 0x00000008 // Push-pull #define GPIO_PIN_TYPE_STD_WPU 0x0000000A // Push-pull with weak pull-up #define GPIO_PIN_TYPE_STD_WPD 0x0000000C // Push-pull with weak pull-down #define GPIO_PIN_TYPE_OD 0x00000009 // Open-drain #define GPIO_PIN_TYPE_OD_WPU 0x0000000B // Open-drain with weak pull-up #define GPIO_PIN_TYPE_OD_WPD 0x0000000D // Open-drain with weak pull-down #define GPIO_PIN_TYPE_ANALOG 0x00000000 // Analog comparator //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void GPIODirModeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulPinIO); extern unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin); extern void GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulIntType); extern unsigned long GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin); extern void GPIOPadConfigSet(unsigned long ulPort, unsigned char ucPins, unsigned long ulStrength, unsigned long ulPadType); extern void GPIOPadConfigGet(unsigned long ulPort, unsigned char ucPin, unsigned long *pulStrength, unsigned long *pulPadType); extern void GPIOPinIntEnable(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinIntDisable(unsigned long ulPort, unsigned char ucPins); extern long GPIOPinIntStatus(unsigned long ulPort, tBoolean bMasked); extern void GPIOPinIntClear(unsigned long ulPort, unsigned char ucPins); extern void GPIOPortIntRegister(unsigned long ulPort, void (*pfnIntHandler)(void)); extern void GPIOPortIntUnregister(unsigned long ulPort); extern long GPIOPinRead(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal); extern void GPIOPinTypeADC(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeCAN(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeComparator(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOInput(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOOutput(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeGPIOOutputOD(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeI2C(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypePWM(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeQEI(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeSSI(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeTimer(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins); extern void GPIOPinTypeUSBDigital(unsigned long ulPort, unsigned char ucPins); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __GPIO_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/gpio.h
C
oos
8,002
//***************************************************************************** // // hw_nvic.h - Macros used when accessing the NVIC hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_NVIC_H__ #define __HW_NVIC_H__ //***************************************************************************** // // The following are defines for the NVIC register addresses. // //***************************************************************************** #define NVIC_INT_TYPE 0xE000E004 // Interrupt Controller Type Reg. #define NVIC_ST_CTRL 0xE000E010 // SysTick Control and Status Reg. #define NVIC_ST_RELOAD 0xE000E014 // SysTick Reload Value Register #define NVIC_ST_CURRENT 0xE000E018 // SysTick Current Value Register #define NVIC_ST_CAL 0xE000E01C // SysTick Calibration Value Reg. #define NVIC_EN0 0xE000E100 // IRQ 0 to 31 Set Enable Register #define NVIC_EN1 0xE000E104 // IRQ 32 to 63 Set Enable Register #define NVIC_DIS0 0xE000E180 // IRQ 0 to 31 Clear Enable Reg. #define NVIC_DIS1 0xE000E184 // IRQ 32 to 63 Clear Enable Reg. #define NVIC_PEND0 0xE000E200 // IRQ 0 to 31 Set Pending Register #define NVIC_PEND1 0xE000E204 // IRQ 32 to 63 Set Pending Reg. #define NVIC_UNPEND0 0xE000E280 // IRQ 0 to 31 Clear Pending Reg. #define NVIC_UNPEND1 0xE000E284 // IRQ 32 to 63 Clear Pending Reg. #define NVIC_ACTIVE0 0xE000E300 // IRQ 0 to 31 Active Register #define NVIC_ACTIVE1 0xE000E304 // IRQ 32 to 63 Active Register #define NVIC_PRI0 0xE000E400 // IRQ 0 to 3 Priority Register #define NVIC_PRI1 0xE000E404 // IRQ 4 to 7 Priority Register #define NVIC_PRI2 0xE000E408 // IRQ 8 to 11 Priority Register #define NVIC_PRI3 0xE000E40C // IRQ 12 to 15 Priority Register #define NVIC_PRI4 0xE000E410 // IRQ 16 to 19 Priority Register #define NVIC_PRI5 0xE000E414 // IRQ 20 to 23 Priority Register #define NVIC_PRI6 0xE000E418 // IRQ 24 to 27 Priority Register #define NVIC_PRI7 0xE000E41C // IRQ 28 to 31 Priority Register #define NVIC_PRI8 0xE000E420 // IRQ 32 to 35 Priority Register #define NVIC_PRI9 0xE000E424 // IRQ 36 to 39 Priority Register #define NVIC_PRI10 0xE000E428 // IRQ 40 to 43 Priority Register #define NVIC_PRI11 0xE000E42C // IRQ 44 to 47 Priority Register #define NVIC_CPUID 0xE000ED00 // CPUID Base Register #define NVIC_INT_CTRL 0xE000ED04 // Interrupt Control State Register #define NVIC_VTABLE 0xE000ED08 // Vector Table Offset Register #define NVIC_APINT 0xE000ED0C // App. Int & Reset Control Reg. #define NVIC_SYS_CTRL 0xE000ED10 // System Control Register #define NVIC_CFG_CTRL 0xE000ED14 // Configuration Control Register #define NVIC_SYS_PRI1 0xE000ED18 // Sys. Handlers 4 to 7 Priority #define NVIC_SYS_PRI2 0xE000ED1C // Sys. Handlers 8 to 11 Priority #define NVIC_SYS_PRI3 0xE000ED20 // Sys. Handlers 12 to 15 Priority #define NVIC_SYS_HND_CTRL 0xE000ED24 // System Handler Control and State #define NVIC_FAULT_STAT 0xE000ED28 // Configurable Fault Status Reg. #define NVIC_HFAULT_STAT 0xE000ED2C // Hard Fault Status Register #define NVIC_DEBUG_STAT 0xE000ED30 // Debug Status Register #define NVIC_MM_ADDR 0xE000ED34 // Mem Manage Address Register #define NVIC_FAULT_ADDR 0xE000ED38 // Bus Fault Address Register #define NVIC_MPU_TYPE 0xE000ED90 // MPU Type Register #define NVIC_MPU_CTRL 0xE000ED94 // MPU Control Register #define NVIC_MPU_NUMBER 0xE000ED98 // MPU Region Number Register #define NVIC_MPU_BASE 0xE000ED9C // MPU Region Base Address Register #define NVIC_MPU_ATTR 0xE000EDA0 // MPU Region Attribute & Size Reg. #define NVIC_DBG_CTRL 0xE000EDF0 // Debug Control and Status Reg. #define NVIC_DBG_XFER 0xE000EDF4 // Debug Core Reg. Transfer Select #define NVIC_DBG_DATA 0xE000EDF8 // Debug Core Register Data #define NVIC_DBG_INT 0xE000EDFC // Debug Reset Interrupt Control #define NVIC_SW_TRIG 0xE000EF00 // Software Trigger Interrupt Reg. //***************************************************************************** // // The following are defines for the bit fields in the NVIC_INT_TYPE register. // //***************************************************************************** #define NVIC_INT_TYPE_LINES_M 0x0000001F // Number of interrupt lines (x32) #define NVIC_INT_TYPE_LINES_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ST_CTRL register. // //***************************************************************************** #define NVIC_ST_CTRL_COUNT 0x00010000 // Count flag #define NVIC_ST_CTRL_CLK_SRC 0x00000004 // Clock Source #define NVIC_ST_CTRL_INTEN 0x00000002 // Interrupt enable #define NVIC_ST_CTRL_ENABLE 0x00000001 // Counter mode //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ST_RELOAD register. // //***************************************************************************** #define NVIC_ST_RELOAD_M 0x00FFFFFF // Counter load value #define NVIC_ST_RELOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ST_CURRENT // register. // //***************************************************************************** #define NVIC_ST_CURRENT_M 0x00FFFFFF // Counter current value #define NVIC_ST_CURRENT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ST_CAL register. // //***************************************************************************** #define NVIC_ST_CAL_NOREF 0x80000000 // No reference clock #define NVIC_ST_CAL_SKEW 0x40000000 // Clock skew #define NVIC_ST_CAL_ONEMS_M 0x00FFFFFF // 1ms reference value #define NVIC_ST_CAL_ONEMS_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_EN0 register. // //***************************************************************************** #define NVIC_EN0_INT31 0x80000000 // Interrupt 31 enable #define NVIC_EN0_INT30 0x40000000 // Interrupt 30 enable #define NVIC_EN0_INT29 0x20000000 // Interrupt 29 enable #define NVIC_EN0_INT28 0x10000000 // Interrupt 28 enable #define NVIC_EN0_INT27 0x08000000 // Interrupt 27 enable #define NVIC_EN0_INT26 0x04000000 // Interrupt 26 enable #define NVIC_EN0_INT25 0x02000000 // Interrupt 25 enable #define NVIC_EN0_INT24 0x01000000 // Interrupt 24 enable #define NVIC_EN0_INT23 0x00800000 // Interrupt 23 enable #define NVIC_EN0_INT22 0x00400000 // Interrupt 22 enable #define NVIC_EN0_INT21 0x00200000 // Interrupt 21 enable #define NVIC_EN0_INT20 0x00100000 // Interrupt 20 enable #define NVIC_EN0_INT19 0x00080000 // Interrupt 19 enable #define NVIC_EN0_INT18 0x00040000 // Interrupt 18 enable #define NVIC_EN0_INT17 0x00020000 // Interrupt 17 enable #define NVIC_EN0_INT16 0x00010000 // Interrupt 16 enable #define NVIC_EN0_INT15 0x00008000 // Interrupt 15 enable #define NVIC_EN0_INT14 0x00004000 // Interrupt 14 enable #define NVIC_EN0_INT13 0x00002000 // Interrupt 13 enable #define NVIC_EN0_INT12 0x00001000 // Interrupt 12 enable #define NVIC_EN0_INT11 0x00000800 // Interrupt 11 enable #define NVIC_EN0_INT10 0x00000400 // Interrupt 10 enable #define NVIC_EN0_INT9 0x00000200 // Interrupt 9 enable #define NVIC_EN0_INT8 0x00000100 // Interrupt 8 enable #define NVIC_EN0_INT7 0x00000080 // Interrupt 7 enable #define NVIC_EN0_INT6 0x00000040 // Interrupt 6 enable #define NVIC_EN0_INT5 0x00000020 // Interrupt 5 enable #define NVIC_EN0_INT4 0x00000010 // Interrupt 4 enable #define NVIC_EN0_INT3 0x00000008 // Interrupt 3 enable #define NVIC_EN0_INT2 0x00000004 // Interrupt 2 enable #define NVIC_EN0_INT1 0x00000002 // Interrupt 1 enable #define NVIC_EN0_INT0 0x00000001 // Interrupt 0 enable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_EN1 register. // //***************************************************************************** #define NVIC_EN1_INT59 0x08000000 // Interrupt 59 enable #define NVIC_EN1_INT58 0x04000000 // Interrupt 58 enable #define NVIC_EN1_INT57 0x02000000 // Interrupt 57 enable #define NVIC_EN1_INT56 0x01000000 // Interrupt 56 enable #define NVIC_EN1_INT55 0x00800000 // Interrupt 55 enable #define NVIC_EN1_INT54 0x00400000 // Interrupt 54 enable #define NVIC_EN1_INT53 0x00200000 // Interrupt 53 enable #define NVIC_EN1_INT52 0x00100000 // Interrupt 52 enable #define NVIC_EN1_INT51 0x00080000 // Interrupt 51 enable #define NVIC_EN1_INT50 0x00040000 // Interrupt 50 enable #define NVIC_EN1_INT49 0x00020000 // Interrupt 49 enable #define NVIC_EN1_INT48 0x00010000 // Interrupt 48 enable #define NVIC_EN1_INT47 0x00008000 // Interrupt 47 enable #define NVIC_EN1_INT46 0x00004000 // Interrupt 46 enable #define NVIC_EN1_INT45 0x00002000 // Interrupt 45 enable #define NVIC_EN1_INT44 0x00001000 // Interrupt 44 enable #define NVIC_EN1_INT43 0x00000800 // Interrupt 43 enable #define NVIC_EN1_INT42 0x00000400 // Interrupt 42 enable #define NVIC_EN1_INT41 0x00000200 // Interrupt 41 enable #define NVIC_EN1_INT40 0x00000100 // Interrupt 40 enable #define NVIC_EN1_INT39 0x00000080 // Interrupt 39 enable #define NVIC_EN1_INT38 0x00000040 // Interrupt 38 enable #define NVIC_EN1_INT37 0x00000020 // Interrupt 37 enable #define NVIC_EN1_INT36 0x00000010 // Interrupt 36 enable #define NVIC_EN1_INT35 0x00000008 // Interrupt 35 enable #define NVIC_EN1_INT34 0x00000004 // Interrupt 34 enable #define NVIC_EN1_INT33 0x00000002 // Interrupt 33 enable #define NVIC_EN1_INT32 0x00000001 // Interrupt 32 enable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DIS0 register. // //***************************************************************************** #define NVIC_DIS0_INT31 0x80000000 // Interrupt 31 disable #define NVIC_DIS0_INT30 0x40000000 // Interrupt 30 disable #define NVIC_DIS0_INT29 0x20000000 // Interrupt 29 disable #define NVIC_DIS0_INT28 0x10000000 // Interrupt 28 disable #define NVIC_DIS0_INT27 0x08000000 // Interrupt 27 disable #define NVIC_DIS0_INT26 0x04000000 // Interrupt 26 disable #define NVIC_DIS0_INT25 0x02000000 // Interrupt 25 disable #define NVIC_DIS0_INT24 0x01000000 // Interrupt 24 disable #define NVIC_DIS0_INT23 0x00800000 // Interrupt 23 disable #define NVIC_DIS0_INT22 0x00400000 // Interrupt 22 disable #define NVIC_DIS0_INT21 0x00200000 // Interrupt 21 disable #define NVIC_DIS0_INT20 0x00100000 // Interrupt 20 disable #define NVIC_DIS0_INT19 0x00080000 // Interrupt 19 disable #define NVIC_DIS0_INT18 0x00040000 // Interrupt 18 disable #define NVIC_DIS0_INT17 0x00020000 // Interrupt 17 disable #define NVIC_DIS0_INT16 0x00010000 // Interrupt 16 disable #define NVIC_DIS0_INT15 0x00008000 // Interrupt 15 disable #define NVIC_DIS0_INT14 0x00004000 // Interrupt 14 disable #define NVIC_DIS0_INT13 0x00002000 // Interrupt 13 disable #define NVIC_DIS0_INT12 0x00001000 // Interrupt 12 disable #define NVIC_DIS0_INT11 0x00000800 // Interrupt 11 disable #define NVIC_DIS0_INT10 0x00000400 // Interrupt 10 disable #define NVIC_DIS0_INT9 0x00000200 // Interrupt 9 disable #define NVIC_DIS0_INT8 0x00000100 // Interrupt 8 disable #define NVIC_DIS0_INT7 0x00000080 // Interrupt 7 disable #define NVIC_DIS0_INT6 0x00000040 // Interrupt 6 disable #define NVIC_DIS0_INT5 0x00000020 // Interrupt 5 disable #define NVIC_DIS0_INT4 0x00000010 // Interrupt 4 disable #define NVIC_DIS0_INT3 0x00000008 // Interrupt 3 disable #define NVIC_DIS0_INT2 0x00000004 // Interrupt 2 disable #define NVIC_DIS0_INT1 0x00000002 // Interrupt 1 disable #define NVIC_DIS0_INT0 0x00000001 // Interrupt 0 disable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DIS1 register. // //***************************************************************************** #define NVIC_DIS1_INT59 0x08000000 // Interrupt 59 disable #define NVIC_DIS1_INT58 0x04000000 // Interrupt 58 disable #define NVIC_DIS1_INT57 0x02000000 // Interrupt 57 disable #define NVIC_DIS1_INT56 0x01000000 // Interrupt 56 disable #define NVIC_DIS1_INT55 0x00800000 // Interrupt 55 disable #define NVIC_DIS1_INT54 0x00400000 // Interrupt 54 disable #define NVIC_DIS1_INT53 0x00200000 // Interrupt 53 disable #define NVIC_DIS1_INT52 0x00100000 // Interrupt 52 disable #define NVIC_DIS1_INT51 0x00080000 // Interrupt 51 disable #define NVIC_DIS1_INT50 0x00040000 // Interrupt 50 disable #define NVIC_DIS1_INT49 0x00020000 // Interrupt 49 disable #define NVIC_DIS1_INT48 0x00010000 // Interrupt 48 disable #define NVIC_DIS1_INT47 0x00008000 // Interrupt 47 disable #define NVIC_DIS1_INT46 0x00004000 // Interrupt 46 disable #define NVIC_DIS1_INT45 0x00002000 // Interrupt 45 disable #define NVIC_DIS1_INT44 0x00001000 // Interrupt 44 disable #define NVIC_DIS1_INT43 0x00000800 // Interrupt 43 disable #define NVIC_DIS1_INT42 0x00000400 // Interrupt 42 disable #define NVIC_DIS1_INT41 0x00000200 // Interrupt 41 disable #define NVIC_DIS1_INT40 0x00000100 // Interrupt 40 disable #define NVIC_DIS1_INT39 0x00000080 // Interrupt 39 disable #define NVIC_DIS1_INT38 0x00000040 // Interrupt 38 disable #define NVIC_DIS1_INT37 0x00000020 // Interrupt 37 disable #define NVIC_DIS1_INT36 0x00000010 // Interrupt 36 disable #define NVIC_DIS1_INT35 0x00000008 // Interrupt 35 disable #define NVIC_DIS1_INT34 0x00000004 // Interrupt 34 disable #define NVIC_DIS1_INT33 0x00000002 // Interrupt 33 disable #define NVIC_DIS1_INT32 0x00000001 // Interrupt 32 disable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PEND0 register. // //***************************************************************************** #define NVIC_PEND0_INT31 0x80000000 // Interrupt 31 pend #define NVIC_PEND0_INT30 0x40000000 // Interrupt 30 pend #define NVIC_PEND0_INT29 0x20000000 // Interrupt 29 pend #define NVIC_PEND0_INT28 0x10000000 // Interrupt 28 pend #define NVIC_PEND0_INT27 0x08000000 // Interrupt 27 pend #define NVIC_PEND0_INT26 0x04000000 // Interrupt 26 pend #define NVIC_PEND0_INT25 0x02000000 // Interrupt 25 pend #define NVIC_PEND0_INT24 0x01000000 // Interrupt 24 pend #define NVIC_PEND0_INT23 0x00800000 // Interrupt 23 pend #define NVIC_PEND0_INT22 0x00400000 // Interrupt 22 pend #define NVIC_PEND0_INT21 0x00200000 // Interrupt 21 pend #define NVIC_PEND0_INT20 0x00100000 // Interrupt 20 pend #define NVIC_PEND0_INT19 0x00080000 // Interrupt 19 pend #define NVIC_PEND0_INT18 0x00040000 // Interrupt 18 pend #define NVIC_PEND0_INT17 0x00020000 // Interrupt 17 pend #define NVIC_PEND0_INT16 0x00010000 // Interrupt 16 pend #define NVIC_PEND0_INT15 0x00008000 // Interrupt 15 pend #define NVIC_PEND0_INT14 0x00004000 // Interrupt 14 pend #define NVIC_PEND0_INT13 0x00002000 // Interrupt 13 pend #define NVIC_PEND0_INT12 0x00001000 // Interrupt 12 pend #define NVIC_PEND0_INT11 0x00000800 // Interrupt 11 pend #define NVIC_PEND0_INT10 0x00000400 // Interrupt 10 pend #define NVIC_PEND0_INT9 0x00000200 // Interrupt 9 pend #define NVIC_PEND0_INT8 0x00000100 // Interrupt 8 pend #define NVIC_PEND0_INT7 0x00000080 // Interrupt 7 pend #define NVIC_PEND0_INT6 0x00000040 // Interrupt 6 pend #define NVIC_PEND0_INT5 0x00000020 // Interrupt 5 pend #define NVIC_PEND0_INT4 0x00000010 // Interrupt 4 pend #define NVIC_PEND0_INT3 0x00000008 // Interrupt 3 pend #define NVIC_PEND0_INT2 0x00000004 // Interrupt 2 pend #define NVIC_PEND0_INT1 0x00000002 // Interrupt 1 pend #define NVIC_PEND0_INT0 0x00000001 // Interrupt 0 pend //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PEND1 register. // //***************************************************************************** #define NVIC_PEND1_INT59 0x08000000 // Interrupt 59 pend #define NVIC_PEND1_INT58 0x04000000 // Interrupt 58 pend #define NVIC_PEND1_INT57 0x02000000 // Interrupt 57 pend #define NVIC_PEND1_INT56 0x01000000 // Interrupt 56 pend #define NVIC_PEND1_INT55 0x00800000 // Interrupt 55 pend #define NVIC_PEND1_INT54 0x00400000 // Interrupt 54 pend #define NVIC_PEND1_INT53 0x00200000 // Interrupt 53 pend #define NVIC_PEND1_INT52 0x00100000 // Interrupt 52 pend #define NVIC_PEND1_INT51 0x00080000 // Interrupt 51 pend #define NVIC_PEND1_INT50 0x00040000 // Interrupt 50 pend #define NVIC_PEND1_INT49 0x00020000 // Interrupt 49 pend #define NVIC_PEND1_INT48 0x00010000 // Interrupt 48 pend #define NVIC_PEND1_INT47 0x00008000 // Interrupt 47 pend #define NVIC_PEND1_INT46 0x00004000 // Interrupt 46 pend #define NVIC_PEND1_INT45 0x00002000 // Interrupt 45 pend #define NVIC_PEND1_INT44 0x00001000 // Interrupt 44 pend #define NVIC_PEND1_INT43 0x00000800 // Interrupt 43 pend #define NVIC_PEND1_INT42 0x00000400 // Interrupt 42 pend #define NVIC_PEND1_INT41 0x00000200 // Interrupt 41 pend #define NVIC_PEND1_INT40 0x00000100 // Interrupt 40 pend #define NVIC_PEND1_INT39 0x00000080 // Interrupt 39 pend #define NVIC_PEND1_INT38 0x00000040 // Interrupt 38 pend #define NVIC_PEND1_INT37 0x00000020 // Interrupt 37 pend #define NVIC_PEND1_INT36 0x00000010 // Interrupt 36 pend #define NVIC_PEND1_INT35 0x00000008 // Interrupt 35 pend #define NVIC_PEND1_INT34 0x00000004 // Interrupt 34 pend #define NVIC_PEND1_INT33 0x00000002 // Interrupt 33 pend #define NVIC_PEND1_INT32 0x00000001 // Interrupt 32 pend //***************************************************************************** // // The following are defines for the bit fields in the NVIC_UNPEND0 register. // //***************************************************************************** #define NVIC_UNPEND0_INT31 0x80000000 // Interrupt 31 unpend #define NVIC_UNPEND0_INT30 0x40000000 // Interrupt 30 unpend #define NVIC_UNPEND0_INT29 0x20000000 // Interrupt 29 unpend #define NVIC_UNPEND0_INT28 0x10000000 // Interrupt 28 unpend #define NVIC_UNPEND0_INT27 0x08000000 // Interrupt 27 unpend #define NVIC_UNPEND0_INT26 0x04000000 // Interrupt 26 unpend #define NVIC_UNPEND0_INT25 0x02000000 // Interrupt 25 unpend #define NVIC_UNPEND0_INT24 0x01000000 // Interrupt 24 unpend #define NVIC_UNPEND0_INT23 0x00800000 // Interrupt 23 unpend #define NVIC_UNPEND0_INT22 0x00400000 // Interrupt 22 unpend #define NVIC_UNPEND0_INT21 0x00200000 // Interrupt 21 unpend #define NVIC_UNPEND0_INT20 0x00100000 // Interrupt 20 unpend #define NVIC_UNPEND0_INT19 0x00080000 // Interrupt 19 unpend #define NVIC_UNPEND0_INT18 0x00040000 // Interrupt 18 unpend #define NVIC_UNPEND0_INT17 0x00020000 // Interrupt 17 unpend #define NVIC_UNPEND0_INT16 0x00010000 // Interrupt 16 unpend #define NVIC_UNPEND0_INT15 0x00008000 // Interrupt 15 unpend #define NVIC_UNPEND0_INT14 0x00004000 // Interrupt 14 unpend #define NVIC_UNPEND0_INT13 0x00002000 // Interrupt 13 unpend #define NVIC_UNPEND0_INT12 0x00001000 // Interrupt 12 unpend #define NVIC_UNPEND0_INT11 0x00000800 // Interrupt 11 unpend #define NVIC_UNPEND0_INT10 0x00000400 // Interrupt 10 unpend #define NVIC_UNPEND0_INT9 0x00000200 // Interrupt 9 unpend #define NVIC_UNPEND0_INT8 0x00000100 // Interrupt 8 unpend #define NVIC_UNPEND0_INT7 0x00000080 // Interrupt 7 unpend #define NVIC_UNPEND0_INT6 0x00000040 // Interrupt 6 unpend #define NVIC_UNPEND0_INT5 0x00000020 // Interrupt 5 unpend #define NVIC_UNPEND0_INT4 0x00000010 // Interrupt 4 unpend #define NVIC_UNPEND0_INT3 0x00000008 // Interrupt 3 unpend #define NVIC_UNPEND0_INT2 0x00000004 // Interrupt 2 unpend #define NVIC_UNPEND0_INT1 0x00000002 // Interrupt 1 unpend #define NVIC_UNPEND0_INT0 0x00000001 // Interrupt 0 unpend //***************************************************************************** // // The following are defines for the bit fields in the NVIC_UNPEND1 register. // //***************************************************************************** #define NVIC_UNPEND1_INT59 0x08000000 // Interrupt 59 unpend #define NVIC_UNPEND1_INT58 0x04000000 // Interrupt 58 unpend #define NVIC_UNPEND1_INT57 0x02000000 // Interrupt 57 unpend #define NVIC_UNPEND1_INT56 0x01000000 // Interrupt 56 unpend #define NVIC_UNPEND1_INT55 0x00800000 // Interrupt 55 unpend #define NVIC_UNPEND1_INT54 0x00400000 // Interrupt 54 unpend #define NVIC_UNPEND1_INT53 0x00200000 // Interrupt 53 unpend #define NVIC_UNPEND1_INT52 0x00100000 // Interrupt 52 unpend #define NVIC_UNPEND1_INT51 0x00080000 // Interrupt 51 unpend #define NVIC_UNPEND1_INT50 0x00040000 // Interrupt 50 unpend #define NVIC_UNPEND1_INT49 0x00020000 // Interrupt 49 unpend #define NVIC_UNPEND1_INT48 0x00010000 // Interrupt 48 unpend #define NVIC_UNPEND1_INT47 0x00008000 // Interrupt 47 unpend #define NVIC_UNPEND1_INT46 0x00004000 // Interrupt 46 unpend #define NVIC_UNPEND1_INT45 0x00002000 // Interrupt 45 unpend #define NVIC_UNPEND1_INT44 0x00001000 // Interrupt 44 unpend #define NVIC_UNPEND1_INT43 0x00000800 // Interrupt 43 unpend #define NVIC_UNPEND1_INT42 0x00000400 // Interrupt 42 unpend #define NVIC_UNPEND1_INT41 0x00000200 // Interrupt 41 unpend #define NVIC_UNPEND1_INT40 0x00000100 // Interrupt 40 unpend #define NVIC_UNPEND1_INT39 0x00000080 // Interrupt 39 unpend #define NVIC_UNPEND1_INT38 0x00000040 // Interrupt 38 unpend #define NVIC_UNPEND1_INT37 0x00000020 // Interrupt 37 unpend #define NVIC_UNPEND1_INT36 0x00000010 // Interrupt 36 unpend #define NVIC_UNPEND1_INT35 0x00000008 // Interrupt 35 unpend #define NVIC_UNPEND1_INT34 0x00000004 // Interrupt 34 unpend #define NVIC_UNPEND1_INT33 0x00000002 // Interrupt 33 unpend #define NVIC_UNPEND1_INT32 0x00000001 // Interrupt 32 unpend //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ACTIVE0 register. // //***************************************************************************** #define NVIC_ACTIVE0_INT31 0x80000000 // Interrupt 31 active #define NVIC_ACTIVE0_INT30 0x40000000 // Interrupt 30 active #define NVIC_ACTIVE0_INT29 0x20000000 // Interrupt 29 active #define NVIC_ACTIVE0_INT28 0x10000000 // Interrupt 28 active #define NVIC_ACTIVE0_INT27 0x08000000 // Interrupt 27 active #define NVIC_ACTIVE0_INT26 0x04000000 // Interrupt 26 active #define NVIC_ACTIVE0_INT25 0x02000000 // Interrupt 25 active #define NVIC_ACTIVE0_INT24 0x01000000 // Interrupt 24 active #define NVIC_ACTIVE0_INT23 0x00800000 // Interrupt 23 active #define NVIC_ACTIVE0_INT22 0x00400000 // Interrupt 22 active #define NVIC_ACTIVE0_INT21 0x00200000 // Interrupt 21 active #define NVIC_ACTIVE0_INT20 0x00100000 // Interrupt 20 active #define NVIC_ACTIVE0_INT19 0x00080000 // Interrupt 19 active #define NVIC_ACTIVE0_INT18 0x00040000 // Interrupt 18 active #define NVIC_ACTIVE0_INT17 0x00020000 // Interrupt 17 active #define NVIC_ACTIVE0_INT16 0x00010000 // Interrupt 16 active #define NVIC_ACTIVE0_INT15 0x00008000 // Interrupt 15 active #define NVIC_ACTIVE0_INT14 0x00004000 // Interrupt 14 active #define NVIC_ACTIVE0_INT13 0x00002000 // Interrupt 13 active #define NVIC_ACTIVE0_INT12 0x00001000 // Interrupt 12 active #define NVIC_ACTIVE0_INT11 0x00000800 // Interrupt 11 active #define NVIC_ACTIVE0_INT10 0x00000400 // Interrupt 10 active #define NVIC_ACTIVE0_INT9 0x00000200 // Interrupt 9 active #define NVIC_ACTIVE0_INT8 0x00000100 // Interrupt 8 active #define NVIC_ACTIVE0_INT7 0x00000080 // Interrupt 7 active #define NVIC_ACTIVE0_INT6 0x00000040 // Interrupt 6 active #define NVIC_ACTIVE0_INT5 0x00000020 // Interrupt 5 active #define NVIC_ACTIVE0_INT4 0x00000010 // Interrupt 4 active #define NVIC_ACTIVE0_INT3 0x00000008 // Interrupt 3 active #define NVIC_ACTIVE0_INT2 0x00000004 // Interrupt 2 active #define NVIC_ACTIVE0_INT1 0x00000002 // Interrupt 1 active #define NVIC_ACTIVE0_INT0 0x00000001 // Interrupt 0 active //***************************************************************************** // // The following are defines for the bit fields in the NVIC_ACTIVE1 register. // //***************************************************************************** #define NVIC_ACTIVE1_INT59 0x08000000 // Interrupt 59 active #define NVIC_ACTIVE1_INT58 0x04000000 // Interrupt 58 active #define NVIC_ACTIVE1_INT57 0x02000000 // Interrupt 57 active #define NVIC_ACTIVE1_INT56 0x01000000 // Interrupt 56 active #define NVIC_ACTIVE1_INT55 0x00800000 // Interrupt 55 active #define NVIC_ACTIVE1_INT54 0x00400000 // Interrupt 54 active #define NVIC_ACTIVE1_INT53 0x00200000 // Interrupt 53 active #define NVIC_ACTIVE1_INT52 0x00100000 // Interrupt 52 active #define NVIC_ACTIVE1_INT51 0x00080000 // Interrupt 51 active #define NVIC_ACTIVE1_INT50 0x00040000 // Interrupt 50 active #define NVIC_ACTIVE1_INT49 0x00020000 // Interrupt 49 active #define NVIC_ACTIVE1_INT48 0x00010000 // Interrupt 48 active #define NVIC_ACTIVE1_INT47 0x00008000 // Interrupt 47 active #define NVIC_ACTIVE1_INT46 0x00004000 // Interrupt 46 active #define NVIC_ACTIVE1_INT45 0x00002000 // Interrupt 45 active #define NVIC_ACTIVE1_INT44 0x00001000 // Interrupt 44 active #define NVIC_ACTIVE1_INT43 0x00000800 // Interrupt 43 active #define NVIC_ACTIVE1_INT42 0x00000400 // Interrupt 42 active #define NVIC_ACTIVE1_INT41 0x00000200 // Interrupt 41 active #define NVIC_ACTIVE1_INT40 0x00000100 // Interrupt 40 active #define NVIC_ACTIVE1_INT39 0x00000080 // Interrupt 39 active #define NVIC_ACTIVE1_INT38 0x00000040 // Interrupt 38 active #define NVIC_ACTIVE1_INT37 0x00000020 // Interrupt 37 active #define NVIC_ACTIVE1_INT36 0x00000010 // Interrupt 36 active #define NVIC_ACTIVE1_INT35 0x00000008 // Interrupt 35 active #define NVIC_ACTIVE1_INT34 0x00000004 // Interrupt 34 active #define NVIC_ACTIVE1_INT33 0x00000002 // Interrupt 33 active #define NVIC_ACTIVE1_INT32 0x00000001 // Interrupt 32 active //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI0 register. // //***************************************************************************** #define NVIC_PRI0_INT3_M 0xFF000000 // Interrupt 3 priority mask #define NVIC_PRI0_INT2_M 0x00FF0000 // Interrupt 2 priority mask #define NVIC_PRI0_INT1_M 0x0000FF00 // Interrupt 1 priority mask #define NVIC_PRI0_INT0_M 0x000000FF // Interrupt 0 priority mask #define NVIC_PRI0_INT3_S 24 #define NVIC_PRI0_INT2_S 16 #define NVIC_PRI0_INT1_S 8 #define NVIC_PRI0_INT0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI1 register. // //***************************************************************************** #define NVIC_PRI1_INT7_M 0xFF000000 // Interrupt 7 priority mask #define NVIC_PRI1_INT6_M 0x00FF0000 // Interrupt 6 priority mask #define NVIC_PRI1_INT5_M 0x0000FF00 // Interrupt 5 priority mask #define NVIC_PRI1_INT4_M 0x000000FF // Interrupt 4 priority mask #define NVIC_PRI1_INT7_S 24 #define NVIC_PRI1_INT6_S 16 #define NVIC_PRI1_INT5_S 8 #define NVIC_PRI1_INT4_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI2 register. // //***************************************************************************** #define NVIC_PRI2_INT11_M 0xFF000000 // Interrupt 11 priority mask #define NVIC_PRI2_INT10_M 0x00FF0000 // Interrupt 10 priority mask #define NVIC_PRI2_INT9_M 0x0000FF00 // Interrupt 9 priority mask #define NVIC_PRI2_INT8_M 0x000000FF // Interrupt 8 priority mask #define NVIC_PRI2_INT11_S 24 #define NVIC_PRI2_INT10_S 16 #define NVIC_PRI2_INT9_S 8 #define NVIC_PRI2_INT8_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI3 register. // //***************************************************************************** #define NVIC_PRI3_INT15_M 0xFF000000 // Interrupt 15 priority mask #define NVIC_PRI3_INT14_M 0x00FF0000 // Interrupt 14 priority mask #define NVIC_PRI3_INT13_M 0x0000FF00 // Interrupt 13 priority mask #define NVIC_PRI3_INT12_M 0x000000FF // Interrupt 12 priority mask #define NVIC_PRI3_INT15_S 24 #define NVIC_PRI3_INT14_S 16 #define NVIC_PRI3_INT13_S 8 #define NVIC_PRI3_INT12_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI4 register. // //***************************************************************************** #define NVIC_PRI4_INT19_M 0xFF000000 // Interrupt 19 priority mask #define NVIC_PRI4_INT18_M 0x00FF0000 // Interrupt 18 priority mask #define NVIC_PRI4_INT17_M 0x0000FF00 // Interrupt 17 priority mask #define NVIC_PRI4_INT16_M 0x000000FF // Interrupt 16 priority mask #define NVIC_PRI4_INT19_S 24 #define NVIC_PRI4_INT18_S 16 #define NVIC_PRI4_INT17_S 8 #define NVIC_PRI4_INT16_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI5 register. // //***************************************************************************** #define NVIC_PRI5_INT23_M 0xFF000000 // Interrupt 23 priority mask #define NVIC_PRI5_INT22_M 0x00FF0000 // Interrupt 22 priority mask #define NVIC_PRI5_INT21_M 0x0000FF00 // Interrupt 21 priority mask #define NVIC_PRI5_INT20_M 0x000000FF // Interrupt 20 priority mask #define NVIC_PRI5_INT23_S 24 #define NVIC_PRI5_INT22_S 16 #define NVIC_PRI5_INT21_S 8 #define NVIC_PRI5_INT20_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI6 register. // //***************************************************************************** #define NVIC_PRI6_INT27_M 0xFF000000 // Interrupt 27 priority mask #define NVIC_PRI6_INT26_M 0x00FF0000 // Interrupt 26 priority mask #define NVIC_PRI6_INT25_M 0x0000FF00 // Interrupt 25 priority mask #define NVIC_PRI6_INT24_M 0x000000FF // Interrupt 24 priority mask #define NVIC_PRI6_INT27_S 24 #define NVIC_PRI6_INT26_S 16 #define NVIC_PRI6_INT25_S 8 #define NVIC_PRI6_INT24_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI7 register. // //***************************************************************************** #define NVIC_PRI7_INT31_M 0xFF000000 // Interrupt 31 priority mask #define NVIC_PRI7_INT30_M 0x00FF0000 // Interrupt 30 priority mask #define NVIC_PRI7_INT29_M 0x0000FF00 // Interrupt 29 priority mask #define NVIC_PRI7_INT28_M 0x000000FF // Interrupt 28 priority mask #define NVIC_PRI7_INT31_S 24 #define NVIC_PRI7_INT30_S 16 #define NVIC_PRI7_INT29_S 8 #define NVIC_PRI7_INT28_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI8 register. // //***************************************************************************** #define NVIC_PRI8_INT35_M 0xFF000000 // Interrupt 35 priority mask #define NVIC_PRI8_INT34_M 0x00FF0000 // Interrupt 34 priority mask #define NVIC_PRI8_INT33_M 0x0000FF00 // Interrupt 33 priority mask #define NVIC_PRI8_INT32_M 0x000000FF // Interrupt 32 priority mask #define NVIC_PRI8_INT35_S 24 #define NVIC_PRI8_INT34_S 16 #define NVIC_PRI8_INT33_S 8 #define NVIC_PRI8_INT32_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI9 register. // //***************************************************************************** #define NVIC_PRI9_INT39_M 0xFF000000 // Interrupt 39 priority mask #define NVIC_PRI9_INT38_M 0x00FF0000 // Interrupt 38 priority mask #define NVIC_PRI9_INT37_M 0x0000FF00 // Interrupt 37 priority mask #define NVIC_PRI9_INT36_M 0x000000FF // Interrupt 36 priority mask #define NVIC_PRI9_INT39_S 24 #define NVIC_PRI9_INT38_S 16 #define NVIC_PRI9_INT37_S 8 #define NVIC_PRI9_INT36_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_PRI10 register. // //***************************************************************************** #define NVIC_PRI10_INT43_M 0xFF000000 // Interrupt 43 priority mask #define NVIC_PRI10_INT42_M 0x00FF0000 // Interrupt 42 priority mask #define NVIC_PRI10_INT41_M 0x0000FF00 // Interrupt 41 priority mask #define NVIC_PRI10_INT40_M 0x000000FF // Interrupt 40 priority mask #define NVIC_PRI10_INT43_S 24 #define NVIC_PRI10_INT42_S 16 #define NVIC_PRI10_INT41_S 8 #define NVIC_PRI10_INT40_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_CPUID register. // //***************************************************************************** #define NVIC_CPUID_IMP_M 0xFF000000 // Implementer #define NVIC_CPUID_VAR_M 0x00F00000 // Variant #define NVIC_CPUID_PARTNO_M 0x0000FFF0 // Processor part number #define NVIC_CPUID_REV_M 0x0000000F // Revision //***************************************************************************** // // The following are defines for the bit fields in the NVIC_INT_CTRL register. // //***************************************************************************** #define NVIC_INT_CTRL_NMI_SET 0x80000000 // Pend a NMI #define NVIC_INT_CTRL_PEND_SV 0x10000000 // Pend a PendSV #define NVIC_INT_CTRL_UNPEND_SV 0x08000000 // Unpend a PendSV #define NVIC_INT_CTRL_ISR_PRE 0x00800000 // Debug interrupt handling #define NVIC_INT_CTRL_ISR_PEND 0x00400000 // Debug interrupt pending #define NVIC_INT_CTRL_VEC_PEN_M 0x003FF000 // Highest pending exception #define NVIC_INT_CTRL_RET_BASE 0x00000800 // Return to base #define NVIC_INT_CTRL_VEC_ACT_M 0x000003FF // Current active exception #define NVIC_INT_CTRL_VEC_PEN_S 12 #define NVIC_INT_CTRL_VEC_ACT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_VTABLE register. // //***************************************************************************** #define NVIC_VTABLE_BASE 0x20000000 // Vector table base #define NVIC_VTABLE_OFFSET_M 0x1FFFFF00 // Vector table offset #define NVIC_VTABLE_OFFSET_S 8 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_APINT register. // //***************************************************************************** #define NVIC_APINT_VECTKEY_M 0xFFFF0000 // Vector key mask #define NVIC_APINT_VECTKEY 0x05FA0000 // Vector key #define NVIC_APINT_ENDIANESS 0x00008000 // Data endianess #define NVIC_APINT_PRIGROUP_M 0x00000700 // Priority group #define NVIC_APINT_PRIGROUP_0_8 0x00000700 // Priority group 0.8 split #define NVIC_APINT_PRIGROUP_1_7 0x00000600 // Priority group 1.7 split #define NVIC_APINT_PRIGROUP_2_6 0x00000500 // Priority group 2.6 split #define NVIC_APINT_PRIGROUP_3_5 0x00000400 // Priority group 3.5 split #define NVIC_APINT_PRIGROUP_4_4 0x00000300 // Priority group 4.4 split #define NVIC_APINT_PRIGROUP_5_3 0x00000200 // Priority group 5.3 split #define NVIC_APINT_PRIGROUP_6_2 0x00000100 // Priority group 6.2 split #define NVIC_APINT_SYSRESETREQ 0x00000004 // System reset request #define NVIC_APINT_VECT_CLR_ACT 0x00000002 // Clear active NMI/fault info #define NVIC_APINT_VECT_RESET 0x00000001 // System reset #define NVIC_APINT_PRIGROUP_7_1 0x00000000 // Priority group 7.1 split //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SYS_CTRL register. // //***************************************************************************** #define NVIC_SYS_CTRL_SEVONPEND 0x00000010 // Wakeup on pend #define NVIC_SYS_CTRL_SLEEPDEEP 0x00000004 // Deep sleep enable #define NVIC_SYS_CTRL_SLEEPEXIT 0x00000002 // Sleep on ISR exit //***************************************************************************** // // The following are defines for the bit fields in the NVIC_CFG_CTRL register. // //***************************************************************************** #define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore bus fault in NMI/fault #define NVIC_CFG_CTRL_DIV0 0x00000010 // Trap on divide by 0 #define NVIC_CFG_CTRL_UNALIGNED 0x00000008 // Trap on unaligned access #define NVIC_CFG_CTRL_DEEP_PEND 0x00000004 // Allow deep interrupt trigger #define NVIC_CFG_CTRL_MAIN_PEND 0x00000002 // Allow main interrupt trigger #define NVIC_CFG_CTRL_BASE_THR 0x00000001 // Thread state control //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SYS_PRI1 register. // //***************************************************************************** #define NVIC_SYS_PRI1_RES_M 0xFF000000 // Priority of reserved handler #define NVIC_SYS_PRI1_USAGE_M 0x00FF0000 // Priority of usage fault handler #define NVIC_SYS_PRI1_BUS_M 0x0000FF00 // Priority of bus fault handler #define NVIC_SYS_PRI1_MEM_M 0x000000FF // Priority of mem manage handler #define NVIC_SYS_PRI1_USAGE_S 16 #define NVIC_SYS_PRI1_BUS_S 8 #define NVIC_SYS_PRI1_MEM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SYS_PRI2 register. // //***************************************************************************** #define NVIC_SYS_PRI2_SVC_M 0xFF000000 // Priority of SVCall handler #define NVIC_SYS_PRI2_RES_M 0x00FFFFFF // Priority of reserved handlers #define NVIC_SYS_PRI2_SVC_S 24 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SYS_PRI3 register. // //***************************************************************************** #define NVIC_SYS_PRI3_TICK_M 0xFF000000 // Priority of Sys Tick handler #define NVIC_SYS_PRI3_PENDSV_M 0x00FF0000 // Priority of PendSV handler #define NVIC_SYS_PRI3_RES_M 0x0000FF00 // Priority of reserved handler #define NVIC_SYS_PRI3_DEBUG_M 0x000000FF // Priority of debug handler #define NVIC_SYS_PRI3_TICK_S 24 #define NVIC_SYS_PRI3_PENDSV_S 16 #define NVIC_SYS_PRI3_DEBUG_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SYS_HND_CTRL // register. // //***************************************************************************** #define NVIC_SYS_HND_CTRL_USAGE 0x00040000 // Usage fault enable #define NVIC_SYS_HND_CTRL_BUS 0x00020000 // Bus fault enable #define NVIC_SYS_HND_CTRL_MEM 0x00010000 // Mem manage fault enable #define NVIC_SYS_HND_CTRL_SVC 0x00008000 // SVCall is pended #define NVIC_SYS_HND_CTRL_BUSP 0x00004000 // Bus fault is pended #define NVIC_SYS_HND_CTRL_TICK 0x00000800 // Sys tick is active #define NVIC_SYS_HND_CTRL_PNDSV 0x00000400 // PendSV is active #define NVIC_SYS_HND_CTRL_MON 0x00000100 // Monitor is active #define NVIC_SYS_HND_CTRL_SVCA 0x00000080 // SVCall is active #define NVIC_SYS_HND_CTRL_USGA 0x00000008 // Usage fault is active #define NVIC_SYS_HND_CTRL_BUSA 0x00000002 // Bus fault is active #define NVIC_SYS_HND_CTRL_MEMA 0x00000001 // Mem manage is active //***************************************************************************** // // The following are defines for the bit fields in the NVIC_FAULT_STAT // register. // //***************************************************************************** #define NVIC_FAULT_STAT_DIV0 0x02000000 // Divide by zero fault #define NVIC_FAULT_STAT_UNALIGN 0x01000000 // Unaligned access fault #define NVIC_FAULT_STAT_NOCP 0x00080000 // No coprocessor fault #define NVIC_FAULT_STAT_INVPC 0x00040000 // Invalid PC fault #define NVIC_FAULT_STAT_INVSTAT 0x00020000 // Invalid state fault #define NVIC_FAULT_STAT_UNDEF 0x00010000 // Undefined instruction fault #define NVIC_FAULT_STAT_BFARV 0x00008000 // BFAR is valid #define NVIC_FAULT_STAT_BSTKE 0x00001000 // Stack bus fault #define NVIC_FAULT_STAT_BUSTKE 0x00000800 // Unstack bus fault #define NVIC_FAULT_STAT_IMPRE 0x00000400 // Imprecise data bus error #define NVIC_FAULT_STAT_PRECISE 0x00000200 // Precise data bus error #define NVIC_FAULT_STAT_IBUS 0x00000100 // Instruction bus fault #define NVIC_FAULT_STAT_MMARV 0x00000080 // MMAR is valid #define NVIC_FAULT_STAT_MSTKE 0x00000010 // Stack access violation #define NVIC_FAULT_STAT_MUSTKE 0x00000008 // Unstack access violation #define NVIC_FAULT_STAT_DERR 0x00000002 // Data access violation #define NVIC_FAULT_STAT_IERR 0x00000001 // Instruction access violation //***************************************************************************** // // The following are defines for the bit fields in the NVIC_HFAULT_STAT // register. // //***************************************************************************** #define NVIC_HFAULT_STAT_DBG 0x80000000 // Debug event #define NVIC_HFAULT_STAT_FORCED 0x40000000 // Cannot execute fault handler #define NVIC_HFAULT_STAT_VECT 0x00000002 // Vector table read fault //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DEBUG_STAT // register. // //***************************************************************************** #define NVIC_DEBUG_STAT_EXTRNL 0x00000010 // EDBGRQ asserted #define NVIC_DEBUG_STAT_VCATCH 0x00000008 // Vector catch #define NVIC_DEBUG_STAT_DWTTRAP 0x00000004 // DWT match #define NVIC_DEBUG_STAT_BKPT 0x00000002 // Breakpoint instruction #define NVIC_DEBUG_STAT_HALTED 0x00000001 // Halt request //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MM_ADDR register. // //***************************************************************************** #define NVIC_MM_ADDR_M 0xFFFFFFFF // Data fault address #define NVIC_MM_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_FAULT_ADDR // register. // //***************************************************************************** #define NVIC_FAULT_ADDR_M 0xFFFFFFFF // Data bus fault address #define NVIC_FAULT_ADDR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MPU_TYPE register. // //***************************************************************************** #define NVIC_MPU_TYPE_IREGION_M 0x00FF0000 // Number of I regions #define NVIC_MPU_TYPE_DREGION_M 0x0000FF00 // Number of D regions #define NVIC_MPU_TYPE_SEPARATE 0x00000001 // Separate or unified MPU #define NVIC_MPU_TYPE_IREGION_S 16 #define NVIC_MPU_TYPE_DREGION_S 8 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MPU_CTRL register. // //***************************************************************************** #define NVIC_MPU_CTRL_PRIVDEFEN 0x00000004 // MPU default region in priv mode #define NVIC_MPU_CTRL_HFNMIENA 0x00000002 // MPU enabled during faults #define NVIC_MPU_CTRL_ENABLE 0x00000001 // MPU enable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MPU_NUMBER // register. // //***************************************************************************** #define NVIC_MPU_NUMBER_M 0x000000FF // MPU region to access #define NVIC_MPU_NUMBER_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MPU_BASE register. // //***************************************************************************** #define NVIC_MPU_BASE_ADDR_M 0xFFFFFFE0 // Base address mask #define NVIC_MPU_BASE_VALID 0x00000010 // Region number valid #define NVIC_MPU_BASE_REGION_M 0x0000000F // Region number #define NVIC_MPU_BASE_ADDR_S 8 #define NVIC_MPU_BASE_REGION_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_MPU_ATTR register. // //***************************************************************************** #define NVIC_MPU_ATTR_M 0xFFFF0000 // Attributes #define NVIC_MPU_ATTR_AP_NO_NO 0x00000000 // prv: no access, usr: no access #define NVIC_MPU_ATTR_BUFFRABLE 0x00010000 // Bufferable #define NVIC_MPU_ATTR_CACHEABLE 0x00020000 // Cacheable #define NVIC_MPU_ATTR_SHAREABLE 0x00040000 // Shareable #define NVIC_MPU_ATTR_TEX_M 0x00380000 // Type extension mask #define NVIC_MPU_ATTR_AP_RW_NO 0x01000000 // prv: rw, usr: none #define NVIC_MPU_ATTR_AP_RW_RO 0x02000000 // prv: rw, usr: read-only #define NVIC_MPU_ATTR_AP_RW_RW 0x03000000 // prv: rw, usr: rw #define NVIC_MPU_ATTR_AP_RO_NO 0x05000000 // prv: ro, usr: none #define NVIC_MPU_ATTR_AP_RO_RO 0x06000000 // prv: ro, usr: ro #define NVIC_MPU_ATTR_AP_M 0x07000000 // Access permissions mask #define NVIC_MPU_ATTR_XN 0x10000000 // Execute disable #define NVIC_MPU_ATTR_SRD_M 0x0000FF00 // Sub-region disable mask #define NVIC_MPU_ATTR_SRD_0 0x00000100 // Sub-region 0 disable #define NVIC_MPU_ATTR_SRD_1 0x00000200 // Sub-region 1 disable #define NVIC_MPU_ATTR_SRD_2 0x00000400 // Sub-region 2 disable #define NVIC_MPU_ATTR_SRD_3 0x00000800 // Sub-region 3 disable #define NVIC_MPU_ATTR_SRD_4 0x00001000 // Sub-region 4 disable #define NVIC_MPU_ATTR_SRD_5 0x00002000 // Sub-region 5 disable #define NVIC_MPU_ATTR_SRD_6 0x00004000 // Sub-region 6 disable #define NVIC_MPU_ATTR_SRD_7 0x00008000 // Sub-region 7 disable #define NVIC_MPU_ATTR_SIZE_M 0x0000003E // Region size mask #define NVIC_MPU_ATTR_SIZE_32B 0x00000008 // Region size 32 bytes #define NVIC_MPU_ATTR_SIZE_64B 0x0000000A // Region size 64 bytes #define NVIC_MPU_ATTR_SIZE_128B 0x0000000C // Region size 128 bytes #define NVIC_MPU_ATTR_SIZE_256B 0x0000000E // Region size 256 bytes #define NVIC_MPU_ATTR_SIZE_512B 0x00000010 // Region size 512 bytes #define NVIC_MPU_ATTR_SIZE_1K 0x00000012 // Region size 1 Kbytes #define NVIC_MPU_ATTR_SIZE_2K 0x00000014 // Region size 2 Kbytes #define NVIC_MPU_ATTR_SIZE_4K 0x00000016 // Region size 4 Kbytes #define NVIC_MPU_ATTR_SIZE_8K 0x00000018 // Region size 8 Kbytes #define NVIC_MPU_ATTR_SIZE_16K 0x0000001A // Region size 16 Kbytes #define NVIC_MPU_ATTR_SIZE_32K 0x0000001C // Region size 32 Kbytes #define NVIC_MPU_ATTR_SIZE_64K 0x0000001E // Region size 64 Kbytes #define NVIC_MPU_ATTR_SIZE_128K 0x00000020 // Region size 128 Kbytes #define NVIC_MPU_ATTR_SIZE_256K 0x00000022 // Region size 256 Kbytes #define NVIC_MPU_ATTR_SIZE_512K 0x00000024 // Region size 512 Kbytes #define NVIC_MPU_ATTR_SIZE_1M 0x00000026 // Region size 1 Mbytes #define NVIC_MPU_ATTR_SIZE_2M 0x00000028 // Region size 2 Mbytes #define NVIC_MPU_ATTR_SIZE_4M 0x0000002A // Region size 4 Mbytes #define NVIC_MPU_ATTR_SIZE_8M 0x0000002C // Region size 8 Mbytes #define NVIC_MPU_ATTR_SIZE_16M 0x0000002E // Region size 16 Mbytes #define NVIC_MPU_ATTR_SIZE_32M 0x00000030 // Region size 32 Mbytes #define NVIC_MPU_ATTR_SIZE_64M 0x00000032 // Region size 64 Mbytes #define NVIC_MPU_ATTR_SIZE_128M 0x00000034 // Region size 128 Mbytes #define NVIC_MPU_ATTR_SIZE_256M 0x00000036 // Region size 256 Mbytes #define NVIC_MPU_ATTR_SIZE_512M 0x00000038 // Region size 512 Mbytes #define NVIC_MPU_ATTR_SIZE_1G 0x0000003A // Region size 1 Gbytes #define NVIC_MPU_ATTR_SIZE_2G 0x0000003C // Region size 2 Gbytes #define NVIC_MPU_ATTR_SIZE_4G 0x0000003E // Region size 4 Gbytes #define NVIC_MPU_ATTR_ENABLE 0x00000001 // Region enable //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DBG_CTRL register. // //***************************************************************************** #define NVIC_DBG_CTRL_DBGKEY_M 0xFFFF0000 // Debug key mask #define NVIC_DBG_CTRL_DBGKEY 0xA05F0000 // Debug key #define NVIC_DBG_CTRL_MON_PEND 0x00008000 // Pend the monitor #define NVIC_DBG_CTRL_MON_REQ 0x00004000 // Monitor request #define NVIC_DBG_CTRL_MON_EN 0x00002000 // Debug monitor enable #define NVIC_DBG_CTRL_MONSTEP 0x00001000 // Monitor step the core #define NVIC_DBG_CTRL_S_SLEEP 0x00000400 // Core is sleeping #define NVIC_DBG_CTRL_S_HALT 0x00000200 // Core status on halt #define NVIC_DBG_CTRL_S_REGRDY 0x00000100 // Register read/write available #define NVIC_DBG_CTRL_S_LOCKUP 0x00000080 // Core is locked up #define NVIC_DBG_CTRL_C_RESET 0x00000010 // Reset the core #define NVIC_DBG_CTRL_C_MASKINT 0x00000008 // Mask interrupts when stepping #define NVIC_DBG_CTRL_C_STEP 0x00000004 // Step the core #define NVIC_DBG_CTRL_C_HALT 0x00000002 // Halt the core #define NVIC_DBG_CTRL_C_DEBUGEN 0x00000001 // Enable debug //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DBG_XFER register. // //***************************************************************************** #define NVIC_DBG_XFER_REG_WNR 0x00010000 // Write or not read #define NVIC_DBG_XFER_REG_SEL_M 0x0000001F // Register #define NVIC_DBG_XFER_REG_CFBP 0x00000014 // Control/Fault/BasePri/PriMask #define NVIC_DBG_XFER_REG_DSP 0x00000013 // Deep SP #define NVIC_DBG_XFER_REG_PSP 0x00000012 // Process SP #define NVIC_DBG_XFER_REG_MSP 0x00000011 // Main SP #define NVIC_DBG_XFER_REG_FLAGS 0x00000010 // xPSR/Flags register #define NVIC_DBG_XFER_REG_R15 0x0000000F // Register R15 #define NVIC_DBG_XFER_REG_R14 0x0000000E // Register R14 #define NVIC_DBG_XFER_REG_R13 0x0000000D // Register R13 #define NVIC_DBG_XFER_REG_R12 0x0000000C // Register R12 #define NVIC_DBG_XFER_REG_R11 0x0000000B // Register R11 #define NVIC_DBG_XFER_REG_R10 0x0000000A // Register R10 #define NVIC_DBG_XFER_REG_R9 0x00000009 // Register R9 #define NVIC_DBG_XFER_REG_R8 0x00000008 // Register R8 #define NVIC_DBG_XFER_REG_R7 0x00000007 // Register R7 #define NVIC_DBG_XFER_REG_R6 0x00000006 // Register R6 #define NVIC_DBG_XFER_REG_R5 0x00000005 // Register R5 #define NVIC_DBG_XFER_REG_R4 0x00000004 // Register R4 #define NVIC_DBG_XFER_REG_R3 0x00000003 // Register R3 #define NVIC_DBG_XFER_REG_R2 0x00000002 // Register R2 #define NVIC_DBG_XFER_REG_R1 0x00000001 // Register R1 #define NVIC_DBG_XFER_REG_R0 0x00000000 // Register R0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DBG_DATA register. // //***************************************************************************** #define NVIC_DBG_DATA_M 0xFFFFFFFF // Data temporary cache #define NVIC_DBG_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the NVIC_DBG_INT register. // //***************************************************************************** #define NVIC_DBG_INT_HARDERR 0x00000400 // Debug trap on hard fault #define NVIC_DBG_INT_INTERR 0x00000200 // Debug trap on interrupt errors #define NVIC_DBG_INT_BUSERR 0x00000100 // Debug trap on bus error #define NVIC_DBG_INT_STATERR 0x00000080 // Debug trap on usage fault state #define NVIC_DBG_INT_CHKERR 0x00000040 // Debug trap on usage fault check #define NVIC_DBG_INT_NOCPERR 0x00000020 // Debug trap on coprocessor error #define NVIC_DBG_INT_MMERR 0x00000010 // Debug trap on mem manage fault #define NVIC_DBG_INT_RESET 0x00000008 // Core reset status #define NVIC_DBG_INT_RSTPENDCLR 0x00000004 // Clear pending core reset #define NVIC_DBG_INT_RSTPENDING 0x00000002 // Core reset is pending #define NVIC_DBG_INT_RSTVCATCH 0x00000001 // Reset vector catch //***************************************************************************** // // The following are defines for the bit fields in the NVIC_SW_TRIG register. // //***************************************************************************** #define NVIC_SW_TRIG_INTID_M 0x000003FF // Interrupt to trigger #define NVIC_SW_TRIG_INTID_S 0 #endif // __HW_NVIC_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_nvic.h
C
oos
58,773
//***************************************************************************** // // grlib.h - Prototypes for the low level primitives provided by the graphics // library. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Graphics Library. // //***************************************************************************** #ifndef __GRLIB_H__ #define __GRLIB_H__ //***************************************************************************** // //! \addtogroup primitives_api //! @{ // //***************************************************************************** //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // //! This structure defines the extents of a rectangle. All points greater than //! or equal to the minimum and less than or equal to the maximum are part of //! the rectangle. // //***************************************************************************** typedef struct { // //! The minimum X coordinate of the rectangle. // short sXMin; // //! The minimum Y coordinate of the rectangle. // short sYMin; // //! The maximum X coordinate of the rectangle. // short sXMax; // //! The maximum Y coordinate of the rectangle. // short sYMax; } tRectangle; //***************************************************************************** // //! This structure defines the characteristics of a display driver. // //***************************************************************************** typedef struct { // //! The size of this structure. // long lSize; // //! A pointer to display driver-specific data. // void *pvDisplayData; // //! The width of this display. // unsigned short usWidth; // //! The height of this display. // unsigned short usHeight; // //! A pointer to the function to draw a pixel on this display. // void (*pfnPixelDraw)(void *pvDisplayData, long lX, long lY, unsigned long ulValue); // //! A pointer to the function to draw multiple pixels on this display. // void (*pfnPixelDrawMultiple)(void *pvDisplayData, long lX, long lY, long lX0, long lCount, long lBPP, const unsigned char *pucData, const unsigned char *pucPalette); // //! A pointer to the function to draw a horizontal line on this display. // void (*pfnLineDrawH)(void *pvDisplayData, long lX1, long lX2, long lY, unsigned long ulValue); // //! A pointer to the function to draw a vertical line on this display. // void (*pfnLineDrawV)(void *pvDisplayData, long lX, long lY1, long lY2, unsigned long ulValue); // //! A pointer to the function to draw a filled rectangle on this display. // void (*pfnRectFill)(void *pvDisplayData, const tRectangle *pRect, unsigned long ulValue); // //! A pointer to the function to translate 24-bit RGB colors to //! display-specific colors. // unsigned long (*pfnColorTranslate)(void *pvDisplayData, unsigned long ulValue); // //! A pointer to the function to flush any cached drawing operations on //! this display. // void (*pfnFlush)(void *pvDisplayData); } tDisplay; //***************************************************************************** // //! This structure describes a font used for drawing text onto the screen. // //***************************************************************************** typedef struct { // //! The format of the font. Can be one of FONT_FMT_UNCOMPRESSED or //! FONT_FMT_PIXEL_RLE. // unsigned char ucFormat; // //! The maximum width of a character; this is the width of the widest //! character in the font, though any individual character may be narrower //! than this width. // unsigned char ucMaxWidth; // //! The height of the character cell; this may be taller than the font data //! for the characters (to provide inter-line spacing). // unsigned char ucHeight; // //! The offset between the top of the character cell and the baseline of //! the glyph. The baseline is the bottom row of a capital letter, below //! which only the descenders of the lower case letters occur. // unsigned char ucBaseline; // //! The offset within pucData to the data for each character in the font. // unsigned short pusOffset[96]; // //! A pointer to the data for the font. // const unsigned char *pucData; } tFont; //***************************************************************************** // //! Indicates that the font data is stored in an uncompressed format. // //***************************************************************************** #define FONT_FMT_UNCOMPRESSED 0x00 //***************************************************************************** // //! Indicates that the font data is stored using a pixel-based RLE format. // //***************************************************************************** #define FONT_FMT_PIXEL_RLE 0x01 //***************************************************************************** // //! Indicates that the image data is not compressed and represents each pixel //! with a single bit. // //***************************************************************************** #define IMAGE_FMT_1BPP_UNCOMP 0x01 //***************************************************************************** // //! Indicates that the image data is not compressed and represents each pixel //! with four bits. // //***************************************************************************** #define IMAGE_FMT_4BPP_UNCOMP 0x04 //***************************************************************************** // //! Indicates that the image data is not compressed and represents each pixel //! with eight bits. // //***************************************************************************** #define IMAGE_FMT_8BPP_UNCOMP 0x08 //***************************************************************************** // //! Indicates that the image data is compressed and represents each pixel with //! a single bit. // //***************************************************************************** #define IMAGE_FMT_1BPP_COMP 0x81 //***************************************************************************** // //! Indicates that the image data is compressed and represents each pixel with //! four bits. // //***************************************************************************** #define IMAGE_FMT_4BPP_COMP 0x84 //***************************************************************************** // //! Indicates that the image data is compressed and represents each pixel with //! eight bits. // //***************************************************************************** #define IMAGE_FMT_8BPP_COMP 0x88 //***************************************************************************** // //! This structure defines a drawing context to be used to draw onto the //! screen. Multiple drawing contexts may exist at any time. // //***************************************************************************** typedef struct { // //! The size of this structure. // long lSize; // //! The screen onto which drawing operations are performed. // const tDisplay *pDisplay; // //! The clipping region to be used when drawing onto the screen. // tRectangle sClipRegion; // //! The color used to draw primitives onto the screen. // unsigned long ulForeground; // //! The background color used to draw primitives onto the screen. // unsigned long ulBackground; // //! The font used to render text onto the screen. // const tFont *pFont; } tContext; //***************************************************************************** // //! Sets the background color to be used. //! //! \param pContext is a pointer to the drawing context to modify. //! \param ulValue is the 24-bit RGB color to be used. //! //! This function sets the background color to be used for drawing operations //! in the specified drawing context. //! //! \return None. // //***************************************************************************** #define GrContextBackgroundSet(pContext, ulValue) \ do \ { \ tContext *pC = pContext; \ pC->ulBackground = DpyColorTranslate(pC->pDisplay, ulValue); \ } \ while(0) //***************************************************************************** // //! Sets the background color to be used. //! //! \param pContext is a pointer to the drawing context to modify. //! \param ulValue is the display driver-specific color to be used. //! //! This function sets the background color to be used for drawing operations //! in the specified drawing context, using a color that has been previously //! translated to a driver-specific color (for example, via //! DpyColorTranslate()). //! //! \return None. // //***************************************************************************** #define GrContextBackgroundSetTranslated(pContext, ulValue) \ do \ { \ tContext *pC = pContext; \ pC->ulBackground = ulValue; \ } \ while(0) //***************************************************************************** // //! Gets the width of the display being used by this drawing context. //! //! \param pContext is a pointer to the drawing context to query. //! //! This function returns the width of the display that is being used by this //! drawing context. //! //! \return Returns the width of the display in pixels. // //***************************************************************************** #define GrContextDpyWidthGet(pContext) \ (DpyWidthGet((pContext)->pDisplay)) //***************************************************************************** // //! Gets the height of the display being used by this drawing context. //! //! \param pContext is a pointer to the drawing context to query. //! //! This function returns the height of the display that is being used by this //! drawing context. //! //! \return Returns the height of the display in pixels. // //***************************************************************************** #define GrContextDpyHeightGet(pContext) \ (DpyHeightGet((pContext)->pDisplay)) //***************************************************************************** // //! Sets the font to be used. //! //! \param pContext is a pointer to the drawing context to modify. //! \param pFnt is a pointer to the font to be used. //! //! This function sets the font to be used for string drawing operations in the //! specified drawing context. //! //! \return None. // //***************************************************************************** #define GrContextFontSet(pContext, pFnt) \ do \ { \ tContext *pC = pContext; \ const tFont *pF = pFnt; \ pC->pFont = pF; \ } \ while(0) //***************************************************************************** // //! Sets the foreground color to be used. //! //! \param pContext is a pointer to the drawing context to modify. //! \param ulValue is the 24-bit RGB color to be used. //! //! This function sets the color to be used for drawing operations in the //! specified drawing context. //! //! \return None. // //***************************************************************************** #define GrContextForegroundSet(pContext, ulValue) \ do \ { \ tContext *pC = pContext; \ pC->ulForeground = DpyColorTranslate(pC->pDisplay, ulValue); \ } \ while(0) //***************************************************************************** // //! Sets the foreground color to be used. //! //! \param pContext is a pointer to the drawing context to modify. //! \param ulValue is the display driver-specific color to be used. //! //! This function sets the foreground color to be used for drawing operations //! in the specified drawing context, using a color that has been previously //! translated to a driver-specific color (for example, via //! DpyColorTranslate()). //! //! \return None. // //***************************************************************************** #define GrContextForegroundSetTranslated(pContext, ulValue) \ do \ { \ tContext *pC = pContext; \ pC->ulForeground = ulValue; \ } \ while(0) //***************************************************************************** // //! Flushes any cached drawing operations. //! //! \param pContext is a pointer to the drawing context to use. //! //! This function flushes any cached drawing operations. For display drivers //! that draw into a local frame buffer before writing to the actual display, //! calling this function will cause the display to be updated to match the //! contents of the local frame buffer. //! //! \return None. // //***************************************************************************** #define GrFlush(pContext) \ do \ { \ const tContext *pC = pContext; \ DpyFlush(pC->pDisplay); \ } \ while(0) //***************************************************************************** // //! Gets the baseline of a font. //! //! \param pFont is a pointer to the font to query. //! //! This function determines the baseline position of a font. The baseline is //! the offset between the top of the font and the bottom of the capital //! letters. The only font data that exists below the baseline are the //! descenders on some lower-case letters (such as ``y''). //! //! \return Returns the baseline of the font, in pixels. // //***************************************************************************** #define GrFontBaselineGet(pFont) \ ((pFont)->ucBaseline) //***************************************************************************** // //! Gets the height of a font. //! //! \param pFont is a pointer to the font to query. //! //! This function determines the height of a font. The height is the offset //! between the top of the font and the bottom of the font, including any //! ascenders and descenders. //! //! \return Returns the height of the font, in pixels. // //***************************************************************************** #define GrFontHeightGet(pFont) \ ((pFont)->ucHeight) //***************************************************************************** // //! Gets the maximum width of a font. //! //! \param pFont is a pointer to the font to query. //! //! This function determines the maximum width of a font. The maximum width is //! the width of the widest individual character in the font. //! //! \return Returns the maximum width of the font, in pixels. // //***************************************************************************** #define GrFontMaxWidthGet(pFont) \ ((pFont)->ucMaxWidth) //***************************************************************************** // //! Gets the number of colors in an image. //! //! \param pucImage is a pointer to the image to query. //! //! This function determines the number of colors in the palette of an image. //! This is only valid for 4bpp and 8bpp images; 1bpp images do not contain a //! palette. //! //! \return Returns the number of colors in the image. // //***************************************************************************** #define GrImageColorsGet(pucImage) \ (((unsigned char *)pucImage)[5] + 1) //***************************************************************************** // //! Gets the height of an image. //! //! \param pucImage is a pointer to the image to query. //! //! This function determines the height of an image in pixels. //! //! \return Returns the height of the image in pixels. // //***************************************************************************** #define GrImageHeightGet(pucImage) \ (*(unsigned short *)(pucImage + 3)) //***************************************************************************** // //! Gets the width of an image. //! //! \param pucImage is a pointer to the image to query. //! //! This function determines the width of an image in pixels. //! //! \return Returns the width of the image in pixels. // //***************************************************************************** #define GrImageWidthGet(pucImage) \ (*(unsigned short *)(pucImage + 1)) //***************************************************************************** // //! Determines the size of the buffer for a 1 BPP off-screen image. //! //! \param lWidth is the width of the image in pixels. //! \param lHeight is the height of the image in pixels. //! //! This function determines the size of the memory buffer required to hold a //! 1 BPP off-screen image of the specified geometry. //! //! \return Returns the number of bytes required by the image. // //***************************************************************************** #define GrOffScreen1BPPSize(lWidth, lHeight) \ (5 + (((lWidth + 7) / 8) * lHeight)) //***************************************************************************** // //! Determines the size of the buffer for a 4 BPP off-screen image. //! //! \param lWidth is the width of the image in pixels. //! \param lHeight is the height of the image in pixels. //! //! This function determines the size of the memory buffer required to hold a //! 4 BPP off-screen image of the specified geometry. //! //! \return Returns the number of bytes required by the image. // //***************************************************************************** #define GrOffScreen4BPPSize(lWidth, lHeight) \ (6 + (16 * 3) + (((lWidth + 1) / 2) * lHeight)) //***************************************************************************** // //! Determines the size of the buffer for an 8 BPP off-screen image. //! //! \param lWidth is the width of the image in pixels. //! \param lHeight is the height of the image in pixels. //! //! This function determines the size of the memory buffer required to hold an //! 8 BPP off-screen image of the specified geometry. //! //! \return Returns the number of bytes required by the image. // //***************************************************************************** #define GrOffScreen8BPPSize(lWidth, lHeight) \ (6 + (256 * 3) + (lWidth * lHeight)) //***************************************************************************** // //! Draws a pixel. //! //! \param pContext is a pointer to the drawing context to use. //! \param lX is the X coordinate of the pixel. //! \param lY is the Y coordinate of the pixel. //! //! This function draws a pixel if it resides within the clipping region. //! //! \return None. // //***************************************************************************** #define GrPixelDraw(pContext, lX, lY) \ do \ { \ const tContext *pC = pContext; \ if((lX >= pC->sClipRegion.sXMin) && \ (lX <= pC->sClipRegion.sXMax) && \ (lY >= pC->sClipRegion.sYMin) && \ (lY <= pC->sClipRegion.sYMax)) \ { \ DpyPixelDraw(pC->pDisplay, lX, lY, pC->ulForeground); \ } \ } \ while(0) //***************************************************************************** // //! Gets the baseline of a string. //! //! \param pContext is a pointer to the drawing context to query. //! //! This function determines the baseline position of a string. The baseline //! is the offset between the top of the string and the bottom of the capital //! letters. The only string data that exists below the baseline are the //! descenders on some lower-case letters (such as ``y''). //! //! \return Returns the baseline of the string, in pixels. // //***************************************************************************** #define GrStringBaselineGet(pContext) \ ((pContext)->pFont->ucBaseline) //***************************************************************************** // //! Draws a centered string. //! //! \param pContext is a pointer to the drawing context to use. //! \param pcString is a pointer to the string to be drawn. //! \param lLength is the number of characters from the string that should be //! drawn on the screen. //! \param lX is the X coordinate of the center of the string position on the //! screen. //! \param lY is the Y coordinate of the center of the string position on the //! screen. //! \param bOpaque is \b true if the background of each character should be //! drawn and \b false if it should not (leaving the background as is). //! //! This function draws a string of test on the screen centered upon the //! provided position. The \e lLength parameter allows a portion of the //! string to be examined without having to insert a NULL character at the //! stopping point (which would not be possible if the string was located in //! flash); specifying a length of -1 will cause the entire string to be //! rendered (subject to clipping). //! //! \return None. // //***************************************************************************** #define GrStringDrawCentered(pContext, pcString, lLength, lX, lY, bOpaque) \ do \ { \ const tContext *pC = pContext; \ const char *pcStr = pcString; \ \ GrStringDraw(pC, pcStr, lLength, \ (lX) - (GrStringWidthGet(pC, pcStr, lLength) / 2), \ (lY) - (pC->pFont->ucBaseline / 2), bOpaque); \ } \ while(0) //***************************************************************************** // //! Gets the height of a string. //! //! \param pContext is a pointer to the drawing context to query. //! //! This function determines the height of a string. The height is the offset //! between the top of the string and the bottom of the string, including any //! ascenders and descenders. Note that this will not account for the case //! where the string in question does not have any characters that use //! descenders but the font in the drawing context does contain characters with //! descenders. //! //! \return Returns the height of the string, in pixels. // //***************************************************************************** #define GrStringHeightGet(pContext) \ ((pContext)->pFont->ucHeight) //***************************************************************************** // //! Gets the maximum width of a character in a string. //! //! \param pContext is a pointer to the drawing context to query. //! //! This function determines the maximum width of a character in a string. The //! maximum width is the width of the widest individual character in the font //! used to render the string, which may be wider than the widest character //! that is used to render a particular string. //! //! \return Returns the maximum width of a character in a string, in pixels. // //***************************************************************************** #define GrStringMaxWidthGet(pContext) \ ((pContext)->pFont->ucMaxWidth) //***************************************************************************** // // A set of color definitions. This set is the subset of the X11 colors (from // rgb.txt) that are supported by typical web browsers. // //***************************************************************************** #define ClrAliceBlue 0x00F0F8FF #define ClrAntiqueWhite 0x00FAEBD7 #define ClrAqua 0x0000FFFF #define ClrAquamarine 0x007FFFD4 #define ClrAzure 0x00F0FFFF #define ClrBeige 0x00F5F5DC #define ClrBisque 0x00FFE4C4 #define ClrBlack 0x00000000 #define ClrBlanchedAlmond 0x00FFEBCD #define ClrBlue 0x000000FF #define ClrBlueViolet 0x008A2BE2 #define ClrBrown 0x00A52A2A #define ClrBurlyWood 0x00DEB887 #define ClrCadetBlue 0x005F9EA0 #define ClrChartreuse 0x007FFF00 #define ClrChocolate 0x00D2691E #define ClrCoral 0x00FF7F50 #define ClrCornflowerBlue 0x006495ED #define ClrCornsilk 0x00FFF8DC #define ClrCrimson 0x00DC143C #define ClrCyan 0x0000FFFF #define ClrDarkBlue 0x0000008B #define ClrDarkCyan 0x00008B8B #define ClrDarkGoldenrod 0x00B8860B #define ClrDarkGray 0x00A9A9A9 #define ClrDarkGreen 0x00006400 #define ClrDarkKhaki 0x00BDB76B #define ClrDarkMagenta 0x008B008B #define ClrDarkOliveGreen 0x00556B2F #define ClrDarkOrange 0x00FF8C00 #define ClrDarkOrchid 0x009932CC #define ClrDarkRed 0x008B0000 #define ClrDarkSalmon 0x00E9967A #define ClrDarkSeaGreen 0x008FBC8F #define ClrDarkSlateBlue 0x00483D8B #define ClrDarkSlateGray 0x002F4F4F #define ClrDarkTurquoise 0x0000CED1 #define ClrDarkViolet 0x009400D3 #define ClrDeepPink 0x00FF1493 #define ClrDeepSkyBlue 0x0000BFFF #define ClrDimGray 0x00696969 #define ClrDodgerBlue 0x001E90FF #define ClrFireBrick 0x00B22222 #define ClrFloralWhite 0x00FFFAF0 #define ClrForestGreen 0x00228B22 #define ClrFuchsia 0x00FF00FF #define ClrGainsboro 0x00DCDCDC #define ClrGhostWhite 0x00F8F8FF #define ClrGold 0x00FFD700 #define ClrGoldenrod 0x00DAA520 #define ClrGray 0x00808080 #define ClrGreen 0x00008000 #define ClrGreenYellow 0x00ADFF2F #define ClrHoneydew 0x00F0FFF0 #define ClrHotPink 0x00FF69B4 #define ClrIndianRed 0x00CD5C5C #define ClrIndigo 0x004B0082 #define ClrIvory 0x00FFFFF0 #define ClrKhaki 0x00F0E68C #define ClrLavender 0x00E6E6FA #define ClrLavenderBlush 0x00FFF0F5 #define ClrLawnGreen 0x007CFC00 #define ClrLemonChiffon 0x00FFFACD #define ClrLightBlue 0x00ADD8E6 #define ClrLightCoral 0x00F08080 #define ClrLightCyan 0x00E0FFFF #define ClrLightGoldenrodYellow 0x00FAFAD2 #define ClrLightGreen 0x0090EE90 #define ClrLightGrey 0x00D3D3D3 #define ClrLightPink 0x00FFB6C1 #define ClrLightSalmon 0x00FFA07A #define ClrLightSeaGreen 0x0020B2AA #define ClrLightSkyBlue 0x0087CEFA #define ClrLightSlateGray 0x00778899 #define ClrLightSteelBlue 0x00B0C4DE #define ClrLightYellow 0x00FFFFE0 #define ClrLime 0x0000FF00 #define ClrLimeGreen 0x0032CD32 #define ClrLinen 0x00FAF0E6 #define ClrMagenta 0x00FF00FF #define ClrMaroon 0x00800000 #define ClrMediumAquamarine 0x0066CDAA #define ClrMediumBlue 0x000000CD #define ClrMediumOrchid 0x00BA55D3 #define ClrMediumPurple 0x009370DB #define ClrMediumSeaGreen 0x003CB371 #define ClrMediumSlateBlue 0x007B68EE #define ClrMediumSpringGreen 0x0000FA9A #define ClrMediumTurquoise 0x0048D1CC #define ClrMediumVioletRed 0x00C71585 #define ClrMidnightBlue 0x00191970 #define ClrMintCream 0x00F5FFFA #define ClrMistyRose 0x00FFE4E1 #define ClrMoccasin 0x00FFE4B5 #define ClrNavajoWhite 0x00FFDEAD #define ClrNavy 0x00000080 #define ClrOldLace 0x00FDF5E6 #define ClrOlive 0x00808000 #define ClrOliveDrab 0x006B8E23 #define ClrOrange 0x00FFA500 #define ClrOrangeRed 0x00FF4500 #define ClrOrchid 0x00DA70D6 #define ClrPaleGoldenrod 0x00EEE8AA #define ClrPaleGreen 0x0098FB98 #define ClrPaleTurquoise 0x00AFEEEE #define ClrPaleVioletRed 0x00DB7093 #define ClrPapayaWhip 0x00FFEFD5 #define ClrPeachPuff 0x00FFDAB9 #define ClrPeru 0x00CD853F #define ClrPink 0x00FFC0CB #define ClrPlum 0x00DDA0DD #define ClrPowderBlue 0x00B0E0E6 #define ClrPurple 0x00800080 #define ClrRed 0x00FF0000 #define ClrRosyBrown 0x00BC8F8F #define ClrRoyalBlue 0x004169E1 #define ClrSaddleBrown 0x008B4513 #define ClrSalmon 0x00FA8072 #define ClrSandyBrown 0x00F4A460 #define ClrSeaGreen 0x002E8B57 #define ClrSeashell 0x00FFF5EE #define ClrSienna 0x00A0522D #define ClrSilver 0x00C0C0C0 #define ClrSkyBlue 0x0087CEEB #define ClrSlateBlue 0x006A5ACD #define ClrSlateGray 0x00708090 #define ClrSnow 0x00FFFAFA #define ClrSpringGreen 0x0000FF7F #define ClrSteelBlue 0x004682B4 #define ClrTan 0x00D2B48C #define ClrTeal 0x00008080 #define ClrThistle 0x00D8BFD8 #define ClrTomato 0x00FF6347 #define ClrTurquoise 0x0040E0D0 #define ClrViolet 0x00EE82EE #define ClrWheat 0x00F5DEB3 #define ClrWhite 0x00FFFFFF #define ClrWhiteSmoke 0x00F5F5F5 #define ClrYellow 0x00FFFF00 #define ClrYellowGreen 0x009ACD32 //***************************************************************************** // // Masks and shifts to aid in color format translation by drivers. // //***************************************************************************** #define ClrRedMask 0x00FF0000 #define ClrRedShift 16 #define ClrGreenMask 0x0000FF00 #define ClrGreenShift 8 #define ClrBlueMask 0x000000FF #define ClrBlueShift 0 //***************************************************************************** // // Prototypes for the predefined fonts in the graphics library. ..Cm.. is the // computer modern font, which is a serif font. ..Cmsc.. is the computer // modern small-caps font, which is also a serif font. ..Cmss.. is the // computer modern sans-serif font. // //***************************************************************************** extern const tFont g_sFontCm12; extern const tFont g_sFontCm12b; extern const tFont g_sFontCm12i; extern const tFont g_sFontCm14; extern const tFont g_sFontCm14b; extern const tFont g_sFontCm14i; extern const tFont g_sFontCm16; extern const tFont g_sFontCm16b; extern const tFont g_sFontCm16i; extern const tFont g_sFontCm18; extern const tFont g_sFontCm18b; extern const tFont g_sFontCm18i; extern const tFont g_sFontCm20; extern const tFont g_sFontCm20b; extern const tFont g_sFontCm20i; extern const tFont g_sFontCm22; extern const tFont g_sFontCm22b; extern const tFont g_sFontCm22i; extern const tFont g_sFontCm24; extern const tFont g_sFontCm24b; extern const tFont g_sFontCm24i; extern const tFont g_sFontCm26; extern const tFont g_sFontCm26b; extern const tFont g_sFontCm26i; extern const tFont g_sFontCm28; extern const tFont g_sFontCm28b; extern const tFont g_sFontCm28i; extern const tFont g_sFontCm30; extern const tFont g_sFontCm30b; extern const tFont g_sFontCm30i; extern const tFont g_sFontCm32; extern const tFont g_sFontCm32b; extern const tFont g_sFontCm32i; extern const tFont g_sFontCm34; extern const tFont g_sFontCm34b; extern const tFont g_sFontCm34i; extern const tFont g_sFontCm36; extern const tFont g_sFontCm36b; extern const tFont g_sFontCm36i; extern const tFont g_sFontCm38; extern const tFont g_sFontCm38b; extern const tFont g_sFontCm38i; extern const tFont g_sFontCm40; extern const tFont g_sFontCm40b; extern const tFont g_sFontCm40i; extern const tFont g_sFontCm42; extern const tFont g_sFontCm42b; extern const tFont g_sFontCm42i; extern const tFont g_sFontCm44; extern const tFont g_sFontCm44b; extern const tFont g_sFontCm44i; extern const tFont g_sFontCm46; extern const tFont g_sFontCm46b; extern const tFont g_sFontCm46i; extern const tFont g_sFontCm48; extern const tFont g_sFontCm48b; extern const tFont g_sFontCm48i; extern const tFont g_sFontCmsc12; extern const tFont g_sFontCmsc14; extern const tFont g_sFontCmsc16; extern const tFont g_sFontCmsc18; extern const tFont g_sFontCmsc20; extern const tFont g_sFontCmsc22; extern const tFont g_sFontCmsc24; extern const tFont g_sFontCmsc26; extern const tFont g_sFontCmsc28; extern const tFont g_sFontCmsc30; extern const tFont g_sFontCmsc32; extern const tFont g_sFontCmsc34; extern const tFont g_sFontCmsc36; extern const tFont g_sFontCmsc38; extern const tFont g_sFontCmsc40; extern const tFont g_sFontCmsc42; extern const tFont g_sFontCmsc44; extern const tFont g_sFontCmsc46; extern const tFont g_sFontCmsc48; extern const tFont g_sFontCmss12; extern const tFont g_sFontCmss12b; extern const tFont g_sFontCmss12i; extern const tFont g_sFontCmss14; extern const tFont g_sFontCmss14b; extern const tFont g_sFontCmss14i; extern const tFont g_sFontCmss16; extern const tFont g_sFontCmss16b; extern const tFont g_sFontCmss16i; extern const tFont g_sFontCmss18; extern const tFont g_sFontCmss18b; extern const tFont g_sFontCmss18i; extern const tFont g_sFontCmss20; extern const tFont g_sFontCmss20b; extern const tFont g_sFontCmss20i; extern const tFont g_sFontCmss22; extern const tFont g_sFontCmss22b; extern const tFont g_sFontCmss22i; extern const tFont g_sFontCmss24; extern const tFont g_sFontCmss24b; extern const tFont g_sFontCmss24i; extern const tFont g_sFontCmss26; extern const tFont g_sFontCmss26b; extern const tFont g_sFontCmss26i; extern const tFont g_sFontCmss28; extern const tFont g_sFontCmss28b; extern const tFont g_sFontCmss28i; extern const tFont g_sFontCmss30; extern const tFont g_sFontCmss30b; extern const tFont g_sFontCmss30i; extern const tFont g_sFontCmss32; extern const tFont g_sFontCmss32b; extern const tFont g_sFontCmss32i; extern const tFont g_sFontCmss34; extern const tFont g_sFontCmss34b; extern const tFont g_sFontCmss34i; extern const tFont g_sFontCmss36; extern const tFont g_sFontCmss36b; extern const tFont g_sFontCmss36i; extern const tFont g_sFontCmss38; extern const tFont g_sFontCmss38b; extern const tFont g_sFontCmss38i; extern const tFont g_sFontCmss40; extern const tFont g_sFontCmss40b; extern const tFont g_sFontCmss40i; extern const tFont g_sFontCmss42; extern const tFont g_sFontCmss42b; extern const tFont g_sFontCmss42i; extern const tFont g_sFontCmss44; extern const tFont g_sFontCmss44b; extern const tFont g_sFontCmss44i; extern const tFont g_sFontCmss46; extern const tFont g_sFontCmss46b; extern const tFont g_sFontCmss46i; extern const tFont g_sFontCmss48; extern const tFont g_sFontCmss48b; extern const tFont g_sFontCmss48i; extern const tFont g_sFontFixed6x8; //***************************************************************************** // //! Translates a 24-bit RGB color to a display driver-specific color. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param ulValue is the 24-bit RGB color. The least-significant byte is the //! blue channel, the next byte is the green channel, and the third byte is the //! red channel. //! //! This function translates a 24-bit RGB color into a value that can be //! written into the display's frame buffer in order to reproduce that color, //! or the closest possible approximation of that color. //! //! \return Returns the display-driver specific color. // //***************************************************************************** #define DpyColorTranslate(pDisplay, ulValue) \ ((pDisplay)->pfnColorTranslate((pDisplay)->pvDisplayData, ulValue)) //***************************************************************************** // //! Flushes cached drawing operations. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! //! This function flushes any cached drawing operations on a display. //! //! \return None. // //***************************************************************************** #define DpyFlush(pDisplay) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnFlush(pD->pvDisplayData); \ } \ while(0) //***************************************************************************** // //! Gets the height of the display. //! //! \param pDisplay is a pointer to the display driver structure for the //! display to query. //! //! This function determines the height of the display. //! //! \return Returns the height of the display in pixels. // //***************************************************************************** #define DpyHeightGet(pDisplay) \ ((pDisplay)->usHeight) //***************************************************************************** // //! Draws a horizontal line on a display. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param lX1 is the starting X coordinate of the line. //! \param lX2 is the ending X coordinate of the line. //! \param lY is the Y coordinate of the line. //! \param ulValue is the color to draw the line. //! //! This function draws a horizontal line on a display. This assumes that //! clipping has already been performed, and that both end points of the line //! are within the extents of the display. //! //! \return None. // //***************************************************************************** #define DpyLineDrawH(pDisplay, lX1, lX2, lY, ulValue) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnLineDrawH(pD->pvDisplayData, lX1, lX2, lY, ulValue); \ } \ while(0) //***************************************************************************** // //! Draws a vertical line on a display. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param lX is the X coordinate of the line. //! \param lY1 is the starting Y coordinate of the line. //! \param lY2 is the ending Y coordinate of the line. //! \param ulValue is the color to draw the line. //! //! This function draws a vertical line on a display. This assumes that //! clipping has already been performed, and that both end points of the line //! are within the extents of the display. //! //! \return None. // //***************************************************************************** #define DpyLineDrawV(pDisplay, lX, lY1, lY2, ulValue) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnLineDrawV(pD->pvDisplayData, lX, lY1, lY2, ulValue); \ } \ while(0) //***************************************************************************** // //! Draws a pixel on a display. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param lX is the X coordinate of the pixel. //! \param lY is the Y coordinate of the pixel. //! \param ulValue is the color to draw the pixel. //! //! This function draws a pixel on a display. This assumes that clipping has //! already been performed. //! //! \return None. // //***************************************************************************** #define DpyPixelDraw(pDisplay, lX, lY, ulValue) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnPixelDraw(pD->pvDisplayData, lX, lY, ulValue); \ } \ while(0) //***************************************************************************** // //! Draws a horizontal sequence of pixels on a display. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param lX is the X coordinate of the first pixel. //! \param lY is the Y coordinate of the first pixel. //! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1 //! or 4 bit per pixel formats. //! \param lCount is the number of pixels to draw. //! \param lBPP is the number of bits per pixel; must be 1, 4, or 8. //! \param pucData is a pointer to the pixel data. For 1 and 4 bit per pixel //! formats, the most significant bit(s) represent the left-most pixel. //! \param pucPalette is a pointer to the palette used to draw the pixels. //! //! This function draws a horizontal sequence of pixels on a display, using the //! supplied palette. For 1 bit per pixel format, the palette contains //! pre-translated colors; for 4 and 8 bit per pixel formats, the palette //! contains 24-bit RGB values that must be translated before being written to //! the display. //! //! \return None. // //***************************************************************************** #define DpyPixelDrawMultiple(pDisplay, lX, lY, lX0, lCount, lBPP, pucData, \ pucPalette) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnPixelDrawMultiple(pD->pvDisplayData, lX, lY, lX0, lCount, \ lBPP, pucData, pucPalette); \ } \ while(0) //***************************************************************************** // //! Fills a rectangle on a display. //! //! \param pDisplay is the pointer to the display driver structure for the //! display to operate upon. //! \param pRect is a pointer to the structure describing the rectangle to //! fill. //! \param ulValue is the color to fill the rectangle. //! //! This function fills a rectangle on the display. This assumes that clipping //! has already been performed, and that all sides of the rectangle are within //! the extents of the display. //! //! \return None. // //***************************************************************************** #define DpyRectFill(pDisplay, pRect, ulValue) \ do \ { \ const tDisplay *pD = pDisplay; \ pD->pfnRectFill(pD->pvDisplayData, pRect, ulValue); \ } \ while(0) //***************************************************************************** // //! Gets the width of the display. //! //! \param pDisplay is a pointer to the display driver structure for the //! display to query. //! //! This function determines the width of the display. //! //! \return Returns the width of the display in pixels. // //***************************************************************************** #define DpyWidthGet(pDisplay) \ ((pDisplay)->usWidth) //***************************************************************************** // // Prototypes for the graphics library functions. // //***************************************************************************** extern void GrCircleDraw(const tContext *pContext, long lX, long lY, long lRadius); extern void GrCircleFill(const tContext *pContext, long lX, long lY, long lRadius); extern void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect); extern void GrContextInit(tContext *pContext, const tDisplay *pDisplay); extern void GrImageDraw(const tContext *pContext, const unsigned char *pucImage, long lX, long lY); extern void GrLineDraw(const tContext *pContext, long lX1, long lY1, long lX2, long lY2); extern void GrLineDrawH(const tContext *pContext, long lX1, long lX2, long lY); extern void GrLineDrawV(const tContext *pContext, long lX, long lY1, long lY2); extern void GrOffScreen1BPPInit(tDisplay *pDisplay, unsigned char *pucImage, long lWidth, long lHeight); extern void GrOffScreen4BPPInit(tDisplay *pDisplay, unsigned char *pucImage, long lWidth, long lHeight); extern void GrOffScreen4BPPPaletteSet(tDisplay *pDisplay, unsigned long *pulPalette, unsigned long ulOffset, unsigned long ulCount); extern void GrOffScreen8BPPInit(tDisplay *pDisplay, unsigned char *pucImage, long lWidth, long lHeight); extern void GrOffScreen8BPPPaletteSet(tDisplay *pDisplay, unsigned long *pulPalette, unsigned long ulOffset, unsigned long ulCount); extern void GrRectDraw(const tContext *pContext, const tRectangle *pRect); extern void GrRectFill(const tContext *pContext, const tRectangle *pRect); extern void GrStringDraw(const tContext *pContext, const char *pcString, long lLength, long lX, long lY, unsigned long bOpaque); extern long GrStringWidthGet(const tContext *pContext, const char *pcString, long lLength); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** #endif // __GRLIB_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/grlib.h
C
oos
51,784
//***************************************************************************** // // hw_ethernet.h - Macros used when accessing the Ethernet hardware. // // Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_ETHERNET_H__ #define __HW_ETHERNET_H__ //***************************************************************************** // // The following are defines for the MAC register offsets in the Ethernet // Controller. // //***************************************************************************** #define MAC_O_RIS 0x00000000 // Ethernet MAC Raw Interrupt // Status #define MAC_O_IACK 0x00000000 // Interrupt Acknowledge Register #define MAC_O_IM 0x00000004 // Interrupt Mask Register #define MAC_O_RCTL 0x00000008 // Receive Control Register #define MAC_O_TCTL 0x0000000C // Transmit Control Register #define MAC_O_DATA 0x00000010 // Data Register #define MAC_O_IA0 0x00000014 // Individual Address Register 0 #define MAC_O_IA1 0x00000018 // Individual Address Register 1 #define MAC_O_THR 0x0000001C // Threshold Register #define MAC_O_MCTL 0x00000020 // Management Control Register #define MAC_O_MDV 0x00000024 // Management Divider Register #define MAC_O_MTXD 0x0000002C // Management Transmit Data Reg #define MAC_O_MRXD 0x00000030 // Management Receive Data Reg #define MAC_O_NP 0x00000034 // Number of Packets Register #define MAC_O_TR 0x00000038 // Transmission Request Register #define MAC_O_TS 0x0000003C // Timer Support Register //***************************************************************************** // // The following are defines for the bit fields in the MAC_IACK register. // //***************************************************************************** #define MAC_IACK_PHYINT 0x00000040 // Clear PHY Interrupt #define MAC_IACK_MDINT 0x00000020 // Clear MDI Transaction Complete #define MAC_IACK_RXER 0x00000010 // Clear RX Error #define MAC_IACK_FOV 0x00000008 // Clear RX FIFO Overrun #define MAC_IACK_TXEMP 0x00000004 // Clear TX FIFO Empy #define MAC_IACK_TXER 0x00000002 // Clear TX Error #define MAC_IACK_RXINT 0x00000001 // Clear RX Packet Available //***************************************************************************** // // The following are defines for the bit fields in the MAC_IM register. // //***************************************************************************** #define MAC_IM_PHYINTM 0x00000040 // Mask PHY Interrupt #define MAC_IM_MDINTM 0x00000020 // Mask MDI Transaction Complete #define MAC_IM_RXERM 0x00000010 // Mask RX Error #define MAC_IM_FOVM 0x00000008 // Mask RX FIFO Overrun #define MAC_IM_TXEMPM 0x00000004 // Mask TX FIFO Empy #define MAC_IM_TXERM 0x00000002 // Mask TX Error #define MAC_IM_RXINTM 0x00000001 // Mask RX Packet Available //***************************************************************************** // // The following are defines for the bit fields in the MAC_RCTL register. // //***************************************************************************** #define MAC_RCTL_RSTFIFO 0x00000010 // Clear the Receive FIFO #define MAC_RCTL_BADCRC 0x00000008 // Reject Packets With Bad CRC #define MAC_RCTL_PRMS 0x00000004 // Enable Promiscuous Mode #define MAC_RCTL_AMUL 0x00000002 // Enable Multicast Packets #define MAC_RCTL_RXEN 0x00000001 // Enable Ethernet Receiver //***************************************************************************** // // The following are defines for the bit fields in the MAC_TCTL register. // //***************************************************************************** #define MAC_TCTL_DUPLEX 0x00000010 // Enable Duplex mode #define MAC_TCTL_CRC 0x00000004 // Enable CRC Generation #define MAC_TCTL_PADEN 0x00000002 // Enable Automatic Padding #define MAC_TCTL_TXEN 0x00000001 // Enable Ethernet Transmitter //***************************************************************************** // // The following are defines for the bit fields in the MAC_IA0 register. // //***************************************************************************** #define MAC_IA0_MACOCT4_M 0xFF000000 // MAC Address Octet 4. #define MAC_IA0_MACOCT3_M 0x00FF0000 // MAC Address Octet 3. #define MAC_IA0_MACOCT2_M 0x0000FF00 // MAC Address Octet 2. #define MAC_IA0_MACOCT1_M 0x000000FF // MAC Address Octet 1. #define MAC_IA0_MACOCT4_S 24 #define MAC_IA0_MACOCT3_S 16 #define MAC_IA0_MACOCT2_S 8 #define MAC_IA0_MACOCT1_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_IA1 register. // //***************************************************************************** #define MAC_IA1_MACOCT6_M 0x0000FF00 // MAC Address Octet 6. #define MAC_IA1_MACOCT5_M 0x000000FF // MAC Address Octet 5. #define MAC_IA1_MACOCT6_S 8 #define MAC_IA1_MACOCT5_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_TXTH register. // //***************************************************************************** #define MAC_THR_THRESH_M 0x0000003F // Threshold Value. #define MAC_THR_THRESH_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_MCTL register. // //***************************************************************************** #define MAC_MCTL_REGADR_M 0x000000F8 // MII Register Address. #define MAC_MCTL_WRITE 0x00000002 // Next MII Transaction is Write #define MAC_MCTL_START 0x00000001 // Start MII Transaction #define MAC_MCTL_REGADR_S 3 //***************************************************************************** // // The following are defines for the bit fields in the MAC_MDV register. // //***************************************************************************** #define MAC_MDV_DIV_M 0x000000FF // Clock Divider. #define MAC_MDV_DIV_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_MTXD register. // //***************************************************************************** #define MAC_MTXD_MDTX_M 0x0000FFFF // MII Register Transmit Data. #define MAC_MTXD_MDTX_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_MRXD register. // //***************************************************************************** #define MAC_MRXD_MDRX_M 0x0000FFFF // MII Register Receive Data. #define MAC_MRXD_MDRX_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_NP register. // //***************************************************************************** #define MAC_NP_NPR_M 0x0000003F // Number of Packets in Receive // FIFO. #define MAC_NP_NPR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the MAC_TXRQ register. // //***************************************************************************** #define MAC_TR_NEWTX 0x00000001 // Start an Ethernet Transmission //***************************************************************************** // // The following are defines for the bit fields in the MAC_TS register. // //***************************************************************************** #define MAC_TS_TSEN 0x00000001 // Enable Timestamp Logic //***************************************************************************** // // The following are defines for the Ethernet Controller PHY registers. // //***************************************************************************** #define PHY_MR24 0x00000018 // Ethernet PHY Management Register // 24 -MDI/MDIX Control #define PHY_MR23 0x00000017 // Ethernet PHY Management Register // 23 - LED Configuration #define PHY_MR19 0x00000013 // Ethernet PHY Management Register // 19 - Transceiver Control #define PHY_MR18 0x00000012 // Ethernet PHY Management Register // 18 - Diagnostic #define PHY_MR17 0x00000011 // Ethernet PHY Management Register // 17 - Interrupt Control/Status #define PHY_MR16 0x00000010 // Ethernet PHY Management Register // 16 - Vendor-Specific #define PHY_MR6 0x00000006 // Ethernet PHY Management Register // 6 - Auto-Negotiation Expansion #define PHY_MR5 0x00000005 // Ethernet PHY Management Register // 5 - Auto-Negotiation Link // Partner Base Page Ability #define PHY_MR4 0x00000004 // Ethernet PHY Management Register // 4 - Auto-Negotiation // Advertisement #define PHY_MR3 0x00000003 // Ethernet PHY Management Register // 3 - PHY Identifier 2 #define PHY_MR2 0x00000002 // Ethernet PHY Management Register // 2 - PHY Identifier 1 #define PHY_MR1 0x00000001 // Ethernet PHY Management Register // 1 - Status #define PHY_MR0 0x00000000 // Ethernet PHY Management Register // 0 - Control //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR0 register. // //***************************************************************************** #define PHY_MR0_RESET 0x00008000 // Reset Registers. #define PHY_MR0_LOOPBK 0x00004000 // Loopback Mode. #define PHY_MR0_SPEEDSL 0x00002000 // Speed Select. #define PHY_MR0_ANEGEN 0x00001000 // Auto-Negotiation Enable. #define PHY_MR0_PWRDN 0x00000800 // Power Down. #define PHY_MR0_ISO 0x00000400 // Isolate. #define PHY_MR0_RANEG 0x00000200 // Restart Auto-Negotiation. #define PHY_MR0_DUPLEX 0x00000100 // Set Duplex Mode. #define PHY_MR0_COLT 0x00000080 // Collision Test. //***************************************************************************** // // The following are defines for the bit fields in the MAC_O_RIS register. // //***************************************************************************** #define MAC_RIS_PHYINT 0x00000040 // PHY Interrupt. #define MAC_RIS_MDINT 0x00000020 // MII Transaction Complete. #define MAC_RIS_RXER 0x00000010 // Receive Error. #define MAC_RIS_FOV 0x00000008 // FIFO Overrrun. #define MAC_RIS_TXEMP 0x00000004 // Transmit FIFO Empty. #define MAC_RIS_TXER 0x00000002 // Transmit Error. #define MAC_RIS_RXINT 0x00000001 // Packet Received. //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR1 register. // //***************************************************************************** #define PHY_MR1_100X_F 0x00004000 // 100BASE-TX Full-Duplex Mode. #define PHY_MR1_100X_H 0x00002000 // 100BASE-TX Half-Duplex Mode. #define PHY_MR1_10T_F 0x00001000 // 10BASE-T Full-Duplex Mode. #define PHY_MR1_10T_H 0x00000800 // 10BASE-T Half-Duplex Mode. #define PHY_MR1_MFPS 0x00000040 // Management Frames with Preamble // Suppressed. #define PHY_MR1_ANEGC 0x00000020 // Auto-Negotiation Complete. #define PHY_MR1_RFAULT 0x00000010 // Remote Fault. #define PHY_MR1_ANEGA 0x00000008 // Auto-Negotiation. #define PHY_MR1_LINK 0x00000004 // Link Made. #define PHY_MR1_JAB 0x00000002 // Jabber Condition. #define PHY_MR1_EXTD 0x00000001 // Extended Capabilities. //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR2 register. // //***************************************************************************** #define PHY_MR2_OUI_M 0x0000FFFF // Organizationally Unique // Identifier[21:6]. #define PHY_MR2_OUI_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR3 register. // //***************************************************************************** #define PHY_MR3_OUI_M 0x0000FC00 // Organizationally Unique // Identifier[5:0]. #define PHY_MR3_MN_M 0x000003F0 // Model Number. #define PHY_MR3_RN_M 0x0000000F // Revision Number. #define PHY_MR3_OUI_S 10 #define PHY_MR3_MN_S 4 #define PHY_MR3_RN_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR4 register. // //***************************************************************************** #define PHY_MR4_NP 0x00008000 // Next Page. #define PHY_MR4_RF 0x00002000 // Remote Fault. #define PHY_MR4_A3 0x00000100 // Technology Ability Field[3]. #define PHY_MR4_A2 0x00000080 // Technology Ability Field[2]. #define PHY_MR4_A1 0x00000040 // Technology Ability Field[1]. #define PHY_MR4_A0 0x00000020 // Technology Ability Field[0]. #define PHY_MR4_S_M 0x0000001F // Selector Field. #define PHY_MR4_S_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR5 register. // //***************************************************************************** #define PHY_MR5_NP 0x00008000 // Next Page. #define PHY_MR5_ACK 0x00004000 // Acknowledge. #define PHY_MR5_RF 0x00002000 // Remote Fault. #define PHY_MR5_A_M 0x00001FE0 // Technology Ability Field. #define PHY_MR5_S_M 0x0000001F // Selector Field. #define PHY_MR5_S_8023 0x00000001 // IEEE Std 802.3 #define PHY_MR5_S_8029 0x00000002 // IEEE Std 802.9 ISLAN-16T #define PHY_MR5_S_8025 0x00000003 // IEEE Std 802.5 #define PHY_MR5_S_1394 0x00000004 // IEEE Std 1394 #define PHY_MR5_A_S 5 //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR6 register. // //***************************************************************************** #define PHY_MR6_PDF 0x00000010 // Parallel Detection Fault. #define PHY_MR6_LPNPA 0x00000008 // Link Partner is Next Page Able. #define PHY_MR6_PRX 0x00000002 // New Page Received. #define PHY_MR6_LPANEGA 0x00000001 // Link Partner is Auto-Negotiation // Able. //***************************************************************************** // // The following are defines for the bit fields in the MAC_O_DATA register. // //***************************************************************************** #define MAC_DATA_TXDATA_M 0xFFFFFFFF // Transmit FIFO Data. #define MAC_DATA_RXDATA_M 0xFFFFFFFF // Receive FIFO Data. #define MAC_DATA_RXDATA_S 0 #define MAC_DATA_TXDATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR16 register. // //***************************************************************************** #define PHY_MR16_RPTR 0x00008000 // Repeater Mode. #define PHY_MR16_INPOL 0x00004000 // Interrupt Polarity. #define PHY_MR16_TXHIM 0x00001000 // Transmit High Impedance Mode. #define PHY_MR16_SQEI 0x00000800 // SQE Inhibit Testing. #define PHY_MR16_NL10 0x00000400 // Natural Loopback Mode. #define PHY_MR16_APOL 0x00000020 // Auto-Polarity Disable. #define PHY_MR16_RVSPOL 0x00000010 // Receive Data Polarity. #define PHY_MR16_PCSBP 0x00000002 // PCS Bypass. #define PHY_MR16_RXCC 0x00000001 // Receive Clock Control. //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR17 register. // //***************************************************************************** #define PHY_MR17_JABBER_IE 0x00008000 // Jabber Interrupt Enable. #define PHY_MR17_RXER_IE 0x00004000 // Receive Error Interrupt Enable. #define PHY_MR17_PRX_IE 0x00002000 // Page Received Interrupt Enable. #define PHY_MR17_PDF_IE 0x00001000 // Parallel Detection Fault // Interrupt Enable. #define PHY_MR17_LPACK_IE 0x00000800 // LP Acknowledge Interrupt Enable. #define PHY_MR17_LSCHG_IE 0x00000400 // Link Status Change Interrupt // Enable. #define PHY_MR17_RFAULT_IE 0x00000200 // Remote Fault Interrupt Enable. #define PHY_MR17_ANEGCOMP_IE 0x00000100 // Auto-Negotiation Complete // Interrupt Enable. #define PHY_MR17_JABBER_INT 0x00000080 // Jabber Event Interrupt. #define PHY_MR17_RXER_INT 0x00000040 // Receive Error Interrupt. #define PHY_MR17_PRX_INT 0x00000020 // Page Receive Interrupt. #define PHY_MR17_PDF_INT 0x00000010 // Parallel Detection Fault // Interrupt. #define PHY_MR17_LPACK_INT 0x00000008 // LP Acknowledge Interrupt. #define PHY_MR17_LSCHG_INT 0x00000004 // Link Status Change Interrupt. #define PHY_MR17_RFAULT_INT 0x00000002 // Remote Fault Interrupt. #define PHY_MR17_ANEGCOMP_INT 0x00000001 // Auto-Negotiation Complete // Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR18 register. // //***************************************************************************** #define PHY_MR18_ANEGF 0x00001000 // Auto-Negotiation Failure. #define PHY_MR18_DPLX 0x00000800 // Duplex Mode. #define PHY_MR18_RATE 0x00000400 // Rate. #define PHY_MR18_RXSD 0x00000200 // Receive Detection. #define PHY_MR18_RX_LOCK 0x00000100 // Receive PLL Lock. //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR19 register. // //***************************************************************************** #define PHY_MR19_TXO_M 0x0000C000 // Transmit Amplitude Selection. #define PHY_MR19_TXO_00DB 0x00000000 // Gain set for 0.0dB of insertion // loss #define PHY_MR19_TXO_04DB 0x00004000 // Gain set for 0.4dB of insertion // loss #define PHY_MR19_TXO_08DB 0x00008000 // Gain set for 0.8dB of insertion // loss #define PHY_MR19_TXO_12DB 0x0000C000 // Gain set for 1.2dB of insertion // loss //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR23 register. // //***************************************************************************** #define PHY_MR23_LED1_M 0x000000F0 // LED1 Source. #define PHY_MR23_LED1_LINK 0x00000000 // Link OK #define PHY_MR23_LED1_RXTX 0x00000010 // RX or TX Activity (Default LED1) #define PHY_MR23_LED1_TX 0x00000020 // TX Activity #define PHY_MR23_LED1_RX 0x00000030 // RX Activity #define PHY_MR23_LED1_COL 0x00000040 // Collision #define PHY_MR23_LED1_100 0x00000050 // 100BASE-TX mode #define PHY_MR23_LED1_10 0x00000060 // 10BASE-T mode #define PHY_MR23_LED1_DUPLEX 0x00000070 // Full-Duplex #define PHY_MR23_LED1_LINKACT 0x00000080 // Link OK & Blink=RX or TX // Activity #define PHY_MR23_LED0_M 0x0000000F // LED0 Source. #define PHY_MR23_LED0_LINK 0x00000000 // Link OK (Default LED0) #define PHY_MR23_LED0_RXTX 0x00000001 // RX or TX Activity #define PHY_MR23_LED0_TX 0x00000002 // TX Activity #define PHY_MR23_LED0_RX 0x00000003 // RX Activity #define PHY_MR23_LED0_COL 0x00000004 // Collision #define PHY_MR23_LED0_100 0x00000005 // 100BASE-TX mode #define PHY_MR23_LED0_10 0x00000006 // 10BASE-T mode #define PHY_MR23_LED0_DUPLEX 0x00000007 // Full-Duplex #define PHY_MR23_LED0_LINKACT 0x00000008 // Link OK & Blink=RX or TX // Activity //***************************************************************************** // // The following are defines for the bit fields in the PHY_MR24 register. // //***************************************************************************** #define PHY_MR24_PD_MODE 0x00000080 // Parallel Detection Mode. #define PHY_MR24_AUTO_SW 0x00000040 // Auto-Switching Enable. #define PHY_MR24_MDIX 0x00000020 // Auto-Switching Configuration. #define PHY_MR24_MDIX_CM 0x00000010 // Auto-Switching Complete. #define PHY_MR24_MDIX_SD_M 0x0000000F // Auto-Switching Seed. #define PHY_MR24_MDIX_SD_S 0 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the MAC register offsets in the // Ethernet Controller. // //***************************************************************************** #define MAC_O_IS 0x00000000 // Interrupt Status Register #define MAC_O_MADD 0x00000028 // Management Address Register //***************************************************************************** // // The following are deprecated defines for the reset values of the MAC // registers. // //***************************************************************************** #define MAC_RV_MDV 0x00000080 #define MAC_RV_IM 0x0000007F #define MAC_RV_THR 0x0000003F #define MAC_RV_RCTL 0x00000008 #define MAC_RV_IA0 0x00000000 #define MAC_RV_TCTL 0x00000000 #define MAC_RV_DATA 0x00000000 #define MAC_RV_MRXD 0x00000000 #define MAC_RV_TR 0x00000000 #define MAC_RV_IS 0x00000000 #define MAC_RV_NP 0x00000000 #define MAC_RV_MCTL 0x00000000 #define MAC_RV_MTXD 0x00000000 #define MAC_RV_IA1 0x00000000 #define MAC_RV_IACK 0x00000000 #define MAC_RV_MADD 0x00000000 //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_IS // register. // //***************************************************************************** #define MAC_IS_PHYINT 0x00000040 // PHY Interrupt #define MAC_IS_MDINT 0x00000020 // MDI Transaction Complete #define MAC_IS_RXER 0x00000010 // RX Error #define MAC_IS_FOV 0x00000008 // RX FIFO Overrun #define MAC_IS_TXEMP 0x00000004 // TX FIFO Empy #define MAC_IS_TXER 0x00000002 // TX Error #define MAC_IS_RXINT 0x00000001 // RX Packet Available //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_IA0 // register. // //***************************************************************************** #define MAC_IA0_MACOCT4 0xFF000000 // 4th Octet of MAC address #define MAC_IA0_MACOCT3 0x00FF0000 // 3rd Octet of MAC address #define MAC_IA0_MACOCT2 0x0000FF00 // 2nd Octet of MAC address #define MAC_IA0_MACOCT1 0x000000FF // 1st Octet of MAC address //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_IA1 // register. // //***************************************************************************** #define MAC_IA1_MACOCT6 0x0000FF00 // 6th Octet of MAC address #define MAC_IA1_MACOCT5 0x000000FF // 5th Octet of MAC address //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_TXTH // register. // //***************************************************************************** #define MAC_THR_THRESH 0x0000003F // Transmit Threshold Value //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_MCTL // register. // //***************************************************************************** #define MAC_MCTL_REGADR 0x000000F8 // Address for Next MII Transaction //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_MDV // register. // //***************************************************************************** #define MAC_MDV_DIV 0x000000FF // Clock Divider for MDC for TX //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_MTXD // register. // //***************************************************************************** #define MAC_MTXD_MDTX 0x0000FFFF // Data for Next MII Transaction //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_MRXD // register. // //***************************************************************************** #define MAC_MRXD_MDRX 0x0000FFFF // Data Read from Last MII Trans. //***************************************************************************** // // The following are deprecated defines for the bit fields in the MAC_NP // register. // //***************************************************************************** #define MAC_NP_NPR 0x0000003F // Number of RX Frames in FIFO #endif #endif // __HW_ETHERNET_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_ethernet.h
C
oos
30,024
//***************************************************************************** // // hw_hibernate.h - Defines and Macros for the Hibernation module. // // Copyright (c) 2007-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_HIBERNATE_H__ #define __HW_HIBERNATE_H__ //***************************************************************************** // // The following are defines for the Hibernation module register addresses. // //***************************************************************************** #define HIB_RTCC 0x400FC000 // Hibernate RTC counter #define HIB_RTCM0 0x400FC004 // Hibernate RTC match 0 #define HIB_RTCM1 0x400FC008 // Hibernate RTC match 1 #define HIB_RTCLD 0x400FC00C // Hibernate RTC load #define HIB_CTL 0x400FC010 // Hibernate RTC control #define HIB_IM 0x400FC014 // Hibernate interrupt mask #define HIB_RIS 0x400FC018 // Hibernate raw interrupt status #define HIB_MIS 0x400FC01C // Hibernate masked interrupt stat #define HIB_IC 0x400FC020 // Hibernate interrupt clear #define HIB_RTCT 0x400FC024 // Hibernate RTC trim #define HIB_DATA 0x400FC030 // Hibernate data area //***************************************************************************** // // The following are defines for the bit fields in the Hibernate RTC counter // register. // //***************************************************************************** #define HIB_RTCC_M 0xFFFFFFFF // RTC Counter. #define HIB_RTCC_S 0 //***************************************************************************** // // The following are defines for the bit fields in the Hibernate RTC match 0 // register. // //***************************************************************************** #define HIB_RTCM0_M 0xFFFFFFFF // RTC Match 0. #define HIB_RTCM0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the Hibernate RTC match 1 // register. // //***************************************************************************** #define HIB_RTCM1_M 0xFFFFFFFF // RTC Match 1. #define HIB_RTCM1_S 0 //***************************************************************************** // // The following are defines for the bit fields in the Hibernate RTC load // register. // //***************************************************************************** #define HIB_RTCLD_M 0xFFFFFFFF // RTC Load. #define HIB_RTCLD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the Hibernate control // register // //***************************************************************************** #define HIB_CTL_WRC 0x80000000 // Write Complete/Capable. #define HIB_CTL_VABORT 0x00000080 // low bat abort #define HIB_CTL_CLK32EN 0x00000040 // enable clock/oscillator #define HIB_CTL_LOWBATEN 0x00000020 // enable low battery detect #define HIB_CTL_PINWEN 0x00000010 // enable wake on WAKE pin #define HIB_CTL_RTCWEN 0x00000008 // enable wake on RTC match #define HIB_CTL_CLKSEL 0x00000004 // clock input selection #define HIB_CTL_HIBREQ 0x00000002 // request hibernation #define HIB_CTL_RTCEN 0x00000001 // RTC enable //***************************************************************************** // // The following are defines for the bit fields in the Hibernate interrupt mask // reg. // //***************************************************************************** #define HIB_IM_EXTW 0x00000008 // wake from external pin interrupt #define HIB_IM_LOWBAT 0x00000004 // low battery interrupt #define HIB_IM_RTCALT1 0x00000002 // RTC match 1 interrupt #define HIB_IM_RTCALT0 0x00000001 // RTC match 0 interrupt //***************************************************************************** // // The following are defines for the bit fields in the Hibernate raw interrupt // status. // //***************************************************************************** #define HIB_RIS_EXTW 0x00000008 // wake from external pin interrupt #define HIB_RIS_LOWBAT 0x00000004 // low battery interrupt #define HIB_RIS_RTCALT1 0x00000002 // RTC match 1 interrupt #define HIB_RIS_RTCALT0 0x00000001 // RTC Alert0 Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the Hibernate masked int // status. // //***************************************************************************** #define HIB_MIS_EXTW 0x00000008 // wake from external pin interrupt #define HIB_MIS_LOWBAT 0x00000004 // low battery interrupt #define HIB_MIS_RTCALT1 0x00000002 // RTC match 1 interrupt #define HIB_MIS_RTCALT0 0x00000001 // RTC Alert0 Masked Interrupt // Status. //***************************************************************************** // // The following are defines for the bit fields in the Hibernate interrupt // clear reg. // //***************************************************************************** #define HIB_IC_EXTW 0x00000008 // wake from external pin interrupt #define HIB_IC_LOWBAT 0x00000004 // low battery interrupt #define HIB_IC_RTCALT1 0x00000002 // RTC match 1 interrupt #define HIB_IC_RTCALT0 0x00000001 // RTC match 0 interrupt //***************************************************************************** // // The following are defines for the bit fields in the Hibernate RTC trim // register. // //***************************************************************************** #define HIB_RTCT_TRIM_M 0x0000FFFF // RTC Trim Value. #define HIB_RTCT_TRIM_S 0 //***************************************************************************** // // The following are defines for the bit fields in the Hibernate data register. // //***************************************************************************** #define HIB_DATA_RTD_M 0xFFFFFFFF // Hibernation Module NV // Registers[63:0]. #define HIB_DATA_RTD_S 0 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the Hibernation module register // addresses. // //***************************************************************************** #define HIB_DATA_END 0x400FC130 // end of data area, exclusive //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate RTC // counter register. // //***************************************************************************** #define HIB_RTCC_MASK 0xFFFFFFFF // RTC counter mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate RTC // match 0 register. // //***************************************************************************** #define HIB_RTCM0_MASK 0xFFFFFFFF // RTC match 0 mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate RTC // match 1 register. // //***************************************************************************** #define HIB_RTCM1_MASK 0xFFFFFFFF // RTC match 1 mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate RTC // load register. // //***************************************************************************** #define HIB_RTCLD_MASK 0xFFFFFFFF // RTC load mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate raw // interrupt status. // //***************************************************************************** #define HIB_RID_RTCALT0 0x00000001 // RTC match 0 interrupt //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate // masked int status. // //***************************************************************************** #define HIB_MID_RTCALT0 0x00000001 // RTC match 0 interrupt //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate RTC // trim register. // //***************************************************************************** #define HIB_RTCT_MASK 0x0000FFFF // RTC trim mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the Hibernate // data register. // //***************************************************************************** #define HIB_DATA_MASK 0xFFFFFFFF // NV memory data mask #endif #endif // __HW_HIBERNATE_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_hibernate.h
C
oos
11,214
//***************************************************************************** // // systick.h - Prototypes for the SysTick driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __SYSTICK_H__ #define __SYSTICK_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern void SysTickEnable(void); extern void SysTickDisable(void); extern void SysTickIntRegister(void (*pfnHandler)(void)); extern void SysTickIntUnregister(void); extern void SysTickIntEnable(void); extern void SysTickIntDisable(void); extern void SysTickPeriodSet(unsigned long ulPeriod); extern unsigned long SysTickPeriodGet(void); extern unsigned long SysTickValueGet(void); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __SYSTICK_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/systick.h
C
oos
2,634
//***************************************************************************** // // hw_sysctl.h - Macros used when accessing the system control hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_SYSCTL_H__ #define __HW_SYSCTL_H__ //***************************************************************************** // // The following are defines for the system control register addresses. // //***************************************************************************** #define SYSCTL_DID0 0x400FE000 // Device identification register 0 #define SYSCTL_DID1 0x400FE004 // Device identification register 1 #define SYSCTL_DC0 0x400FE008 // Device capabilities register 0 #define SYSCTL_DC1 0x400FE010 // Device capabilities register 1 #define SYSCTL_DC2 0x400FE014 // Device capabilities register 2 #define SYSCTL_DC3 0x400FE018 // Device capabilities register 3 #define SYSCTL_DC4 0x400FE01C // Device capabilities register 4 #define SYSCTL_DC5 0x400FE020 // Device capabilities register 5 #define SYSCTL_DC6 0x400FE024 // Device capabilities register 6 #define SYSCTL_DC7 0x400FE028 // Device capabilities register 7 #define SYSCTL_PBORCTL 0x400FE030 // POR/BOR reset control register #define SYSCTL_LDOPCTL 0x400FE034 // LDO power control register #define SYSCTL_SRCR0 0x400FE040 // Software reset control reg 0 #define SYSCTL_SRCR1 0x400FE044 // Software reset control reg 1 #define SYSCTL_SRCR2 0x400FE048 // Software reset control reg 2 #define SYSCTL_RIS 0x400FE050 // Raw interrupt status register #define SYSCTL_IMC 0x400FE054 // Interrupt mask/control register #define SYSCTL_MISC 0x400FE058 // Interrupt status register #define SYSCTL_RESC 0x400FE05C // Reset cause register #define SYSCTL_RCC 0x400FE060 // Run-mode clock config register #define SYSCTL_PLLCFG 0x400FE064 // PLL configuration register #define SYSCTL_GPIOHSCTL 0x400FE06C // GPIO High Speed Control #define SYSCTL_RCC2 0x400FE070 // Run-mode clock config register 2 #define SYSCTL_MOSCCTL 0x400FE07C // Main Oscillator Control #define SYSCTL_RCGC0 0x400FE100 // Run-mode clock gating register 0 #define SYSCTL_RCGC1 0x400FE104 // Run-mode clock gating register 1 #define SYSCTL_RCGC2 0x400FE108 // Run-mode clock gating register 2 #define SYSCTL_SCGC0 0x400FE110 // Sleep-mode clock gating reg 0 #define SYSCTL_SCGC1 0x400FE114 // Sleep-mode clock gating reg 1 #define SYSCTL_SCGC2 0x400FE118 // Sleep-mode clock gating reg 2 #define SYSCTL_DCGC0 0x400FE120 // Deep Sleep-mode clock gate reg 0 #define SYSCTL_DCGC1 0x400FE124 // Deep Sleep-mode clock gate reg 1 #define SYSCTL_DCGC2 0x400FE128 // Deep Sleep-mode clock gate reg 2 #define SYSCTL_DSLPCLKCFG 0x400FE144 // Deep Sleep-mode clock config reg #define SYSCTL_CLKVCLR 0x400FE150 // Clock verifcation clear register #define SYSCTL_LDOARST 0x400FE160 // LDO reset control register //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DID0 register. // //***************************************************************************** #define SYSCTL_DID0_VER_M 0x70000000 // DID0 version mask #define SYSCTL_DID0_VER_0 0x00000000 // DID0 version 0 #define SYSCTL_DID0_VER_1 0x10000000 // DID0 version 1 #define SYSCTL_DID0_CLASS_M 0x00FF0000 // Device Class #define SYSCTL_DID0_CLASS_SANDSTORM \ 0x00000000 // Sandstorm-class Device #define SYSCTL_DID0_CLASS_FURY 0x00010000 // Fury-class Device #define SYSCTL_DID0_CLASS_DUSTDEVIL \ 0x00030000 // DustDevil-class Device #define SYSCTL_DID0_MAJ_M 0x0000FF00 // Major revision mask #define SYSCTL_DID0_MAJ_REVA 0x00000000 // Revision A (initial device) #define SYSCTL_DID0_MAJ_REVB 0x00000100 // Revision B (first base layer // revision) #define SYSCTL_DID0_MAJ_REVC 0x00000200 // Revision C (second base layer // revision) #define SYSCTL_DID0_MIN_M 0x000000FF // Minor revision mask #define SYSCTL_DID0_MIN_0 0x00000000 // Minor revision 0 #define SYSCTL_DID0_MIN_1 0x00000001 // Minor revision 1 #define SYSCTL_DID0_MIN_2 0x00000002 // Minor revision 2 #define SYSCTL_DID0_MIN_3 0x00000003 // Minor revision 3 #define SYSCTL_DID0_MIN_4 0x00000004 // Minor revision 4 #define SYSCTL_DID0_MIN_5 0x00000005 // Minor revision 5 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DID1 register. // //***************************************************************************** #define SYSCTL_DID1_VER_M 0xF0000000 // DID1 Version. #define SYSCTL_DID1_VER_0 0x00000000 // Initial DID1 register format // definition, indicating a // Stellaris LM3Snnn device. #define SYSCTL_DID1_VER_1 0x10000000 // First revision of the DID1 // register format, indicating a // Stellaris Fury-class device. #define SYSCTL_DID1_FAM_M 0x0F000000 // Family. #define SYSCTL_DID1_FAM_STELLARIS \ 0x00000000 // Stellaris family of // microcontollers, that is, all // devices with external part // numbers starting with LM3S. #define SYSCTL_DID1_PRTNO_M 0x00FF0000 // Part number mask #define SYSCTL_DID1_PRTNO_101 0x00010000 // LM3S101 #define SYSCTL_DID1_PRTNO_102 0x00020000 // LM3S102 #define SYSCTL_DID1_PRTNO_300 0x00190000 // LM3S300 #define SYSCTL_DID1_PRTNO_301 0x00110000 // LM3S301 #define SYSCTL_DID1_PRTNO_308 0x001A0000 // LM3S308 #define SYSCTL_DID1_PRTNO_310 0x00120000 // LM3S310 #define SYSCTL_DID1_PRTNO_315 0x00130000 // LM3S315 #define SYSCTL_DID1_PRTNO_316 0x00140000 // LM3S316 #define SYSCTL_DID1_PRTNO_317 0x00170000 // LM3S317 #define SYSCTL_DID1_PRTNO_328 0x00150000 // LM3S328 #define SYSCTL_DID1_PRTNO_600 0x002A0000 // LM3S600 #define SYSCTL_DID1_PRTNO_601 0x00210000 // LM3S601 #define SYSCTL_DID1_PRTNO_608 0x002B0000 // LM3S608 #define SYSCTL_DID1_PRTNO_610 0x00220000 // LM3S610 #define SYSCTL_DID1_PRTNO_611 0x00230000 // LM3S611 #define SYSCTL_DID1_PRTNO_612 0x00240000 // LM3S612 #define SYSCTL_DID1_PRTNO_613 0x00250000 // LM3S613 #define SYSCTL_DID1_PRTNO_615 0x00260000 // LM3S615 #define SYSCTL_DID1_PRTNO_617 0x00280000 // LM3S617 #define SYSCTL_DID1_PRTNO_618 0x00290000 // LM3S618 #define SYSCTL_DID1_PRTNO_628 0x00270000 // LM3S628 #define SYSCTL_DID1_PRTNO_800 0x00380000 // LM3S800 #define SYSCTL_DID1_PRTNO_801 0x00310000 // LM3S801 #define SYSCTL_DID1_PRTNO_808 0x00390000 // LM3S808 #define SYSCTL_DID1_PRTNO_811 0x00320000 // LM3S811 #define SYSCTL_DID1_PRTNO_812 0x00330000 // LM3S812 #define SYSCTL_DID1_PRTNO_815 0x00340000 // LM3S815 #define SYSCTL_DID1_PRTNO_817 0x00360000 // LM3S817 #define SYSCTL_DID1_PRTNO_818 0x00370000 // LM3S818 #define SYSCTL_DID1_PRTNO_828 0x00350000 // LM3S828 #define SYSCTL_DID1_PRTNO_1110 0x00BF0000 // LM3S1110 #define SYSCTL_DID1_PRTNO_1133 0x00C30000 // LM3S1133 #define SYSCTL_DID1_PRTNO_1138 0x00C50000 // LM3S1138 #define SYSCTL_DID1_PRTNO_1150 0x00C10000 // LM3S1150 #define SYSCTL_DID1_PRTNO_1162 0x00C40000 // LM3S1162 #define SYSCTL_DID1_PRTNO_1165 0x00C20000 // LM3S1165 #define SYSCTL_DID1_PRTNO_1332 0x00C60000 // LM3S1332 #define SYSCTL_DID1_PRTNO_1435 0x00BC0000 // LM3S1435 #define SYSCTL_DID1_PRTNO_1439 0x00BA0000 // LM3S1439 #define SYSCTL_DID1_PRTNO_1512 0x00BB0000 // LM3S1512 #define SYSCTL_DID1_PRTNO_1538 0x00C70000 // LM3S1538 #define SYSCTL_DID1_PRTNO_1601 0x00DB0000 // LM3S1601 #define SYSCTL_DID1_PRTNO_1607 0x00060000 // LM3S1607 #define SYSCTL_DID1_PRTNO_1608 0x00DA0000 // LM3S1608 #define SYSCTL_DID1_PRTNO_1620 0x00C00000 // LM3S1620 #define SYSCTL_DID1_PRTNO_1625 0x00030000 // LM3S1625 #define SYSCTL_DID1_PRTNO_1626 0x00040000 // LM3S1626 #define SYSCTL_DID1_PRTNO_1627 0x00050000 // LM3S1627 #define SYSCTL_DID1_PRTNO_1635 0x00B30000 // LM3S1635 #define SYSCTL_DID1_PRTNO_1637 0x00BD0000 // LM3S1637 #define SYSCTL_DID1_PRTNO_1751 0x00B90000 // LM3S1751 #define SYSCTL_DID1_PRTNO_1776 0x00100000 // LM3S1776 #define SYSCTL_DID1_PRTNO_1850 0x00B40000 // LM3S1850 #define SYSCTL_DID1_PRTNO_1911 0x00DD0000 // LM3S1911 #define SYSCTL_DID1_PRTNO_1918 0x00DC0000 // LM3S1918 #define SYSCTL_DID1_PRTNO_1937 0x00B70000 // LM3S1937 #define SYSCTL_DID1_PRTNO_1958 0x00BE0000 // LM3S1958 #define SYSCTL_DID1_PRTNO_1960 0x00B50000 // LM3S1960 #define SYSCTL_DID1_PRTNO_1968 0x00B80000 // LM3S1968 #define SYSCTL_DID1_PRTNO_2110 0x00510000 // LM3S2110 #define SYSCTL_DID1_PRTNO_2139 0x00840000 // LM3S2139 #define SYSCTL_DID1_PRTNO_2276 0x00390000 // LM3S2276 #define SYSCTL_DID1_PRTNO_2410 0x00A20000 // LM3S2410 #define SYSCTL_DID1_PRTNO_2412 0x00590000 // LM3S2412 #define SYSCTL_DID1_PRTNO_2432 0x00560000 // LM3S2432 #define SYSCTL_DID1_PRTNO_2533 0x005A0000 // LM3S2533 #define SYSCTL_DID1_PRTNO_2601 0x00E10000 // LM3S2601 #define SYSCTL_DID1_PRTNO_2608 0x00E00000 // LM3S2608 #define SYSCTL_DID1_PRTNO_2616 0x00330000 // LM3S2616 #define SYSCTL_DID1_PRTNO_2620 0x00570000 // LM3S2620 #define SYSCTL_DID1_PRTNO_2637 0x00850000 // LM3S2637 #define SYSCTL_DID1_PRTNO_2651 0x00530000 // LM3S2651 #define SYSCTL_DID1_PRTNO_2671 0x00800000 // LM3S2671 #define SYSCTL_DID1_PRTNO_2678 0x00500000 // LM3S2678 #define SYSCTL_DID1_PRTNO_2730 0x00A40000 // LM3S2730 #define SYSCTL_DID1_PRTNO_2739 0x00520000 // LM3S2739 #define SYSCTL_DID1_PRTNO_2776 0x003A0000 // LM3S2776 #define SYSCTL_DID1_PRTNO_2911 0x00E30000 // LM3S2911 #define SYSCTL_DID1_PRTNO_2918 0x00E20000 // LM3S2918 #define SYSCTL_DID1_PRTNO_2939 0x00540000 // LM3S2939 #define SYSCTL_DID1_PRTNO_2948 0x008F0000 // LM3S2948 #define SYSCTL_DID1_PRTNO_2950 0x00580000 // LM3S2950 #define SYSCTL_DID1_PRTNO_2965 0x00550000 // LM3S2965 #define SYSCTL_DID1_PRTNO_3651 0x00430000 // LM3S3651 #define SYSCTL_DID1_PRTNO_3739 0x00440000 // LM3S3739 #define SYSCTL_DID1_PRTNO_3748 0x00490000 // LM3S3748 #define SYSCTL_DID1_PRTNO_3749 0x00450000 // LM3S3749 #define SYSCTL_DID1_PRTNO_3759 0x00460000 // LM3S3759 #define SYSCTL_DID1_PRTNO_3768 0x00480000 // LM3S3768 #define SYSCTL_DID1_PRTNO_5632 0x00810000 // LM3S5632 #define SYSCTL_DID1_PRTNO_5652 0x008A0000 // LM3S5652 #define SYSCTL_DID1_PRTNO_5662 0x00910000 // LM3S5662 #define SYSCTL_DID1_PRTNO_5732 0x00960000 // LM3S5732 #define SYSCTL_DID1_PRTNO_5737 0x00970000 // LM3S5737 #define SYSCTL_DID1_PRTNO_5739 0x00A00000 // LM3S5739 #define SYSCTL_DID1_PRTNO_5747 0x00990000 // LM3S5747 #define SYSCTL_DID1_PRTNO_5749 0x00A70000 // LM3S5749 #define SYSCTL_DID1_PRTNO_5752 0x009A0000 // LM3S5752 #define SYSCTL_DID1_PRTNO_5757 0x009B0000 // LM3S5757 #define SYSCTL_DID1_PRTNO_5762 0x009C0000 // LM3S5762 #define SYSCTL_DID1_PRTNO_5767 0x009D0000 // LM3S5767 #define SYSCTL_DID1_PRTNO_5768 0x00A90000 // LM3S5768 #define SYSCTL_DID1_PRTNO_5769 0x00A80000 // LM3S5769 #define SYSCTL_DID1_PRTNO_6100 0x00A10000 // LM3S6100 #define SYSCTL_DID1_PRTNO_6110 0x00740000 // LM3S6110 #define SYSCTL_DID1_PRTNO_6420 0x00A50000 // LM3S6420 #define SYSCTL_DID1_PRTNO_6422 0x00820000 // LM3S6422 #define SYSCTL_DID1_PRTNO_6432 0x00750000 // LM3S6432 #define SYSCTL_DID1_PRTNO_6537 0x00760000 // LM3S6537 #define SYSCTL_DID1_PRTNO_6610 0x00710000 // LM3S6610 #define SYSCTL_DID1_PRTNO_6611 0x00E70000 // LM3S6611 #define SYSCTL_DID1_PRTNO_6618 0x00E60000 // LM3S6618 #define SYSCTL_DID1_PRTNO_6633 0x00830000 // LM3S6633 #define SYSCTL_DID1_PRTNO_6637 0x008B0000 // LM3S6637 #define SYSCTL_DID1_PRTNO_6730 0x00A30000 // LM3S6730 #define SYSCTL_DID1_PRTNO_6753 0x00770000 // LM3S6753 #define SYSCTL_DID1_PRTNO_6911 0x00E90000 // LM3S6911 #define SYSCTL_DID1_PRTNO_6918 0x00E80000 // LM3S6918 #define SYSCTL_DID1_PRTNO_6938 0x00890000 // LM3S6938 #define SYSCTL_DID1_PRTNO_6950 0x00720000 // LM3S6950 #define SYSCTL_DID1_PRTNO_6952 0x00780000 // LM3S6952 #define SYSCTL_DID1_PRTNO_6965 0x00730000 // LM3S6965 #define SYSCTL_DID1_PRTNO_8530 0x00640000 // LM3S8530 #define SYSCTL_DID1_PRTNO_8538 0x008E0000 // LM3S8538 #define SYSCTL_DID1_PRTNO_8630 0x00610000 // LM3S8630 #define SYSCTL_DID1_PRTNO_8730 0x00630000 // LM3S8730 #define SYSCTL_DID1_PRTNO_8733 0x008D0000 // LM3S8733 #define SYSCTL_DID1_PRTNO_8738 0x00860000 // LM3S8738 #define SYSCTL_DID1_PRTNO_8930 0x00650000 // LM3S8930 #define SYSCTL_DID1_PRTNO_8933 0x008C0000 // LM3S8933 #define SYSCTL_DID1_PRTNO_8938 0x00880000 // LM3S8938 #define SYSCTL_DID1_PRTNO_8962 0x00A60000 // LM3S8962 #define SYSCTL_DID1_PRTNO_8970 0x00620000 // LM3S8970 #define SYSCTL_DID1_PRTNO_8971 0x00D70000 // LM3S8971 #define SYSCTL_DID1_PINCNT_M 0x0000E000 // Package Pin Count. #define SYSCTL_DID1_PINCNT_28 0x00000000 // 28 pin package #define SYSCTL_DID1_PINCNT_48 0x00002000 // 48 pin package #define SYSCTL_DID1_PINCNT_100 0x00004000 // 100 pin package #define SYSCTL_DID1_PINCNT_64 0x00006000 // 64 pin package #define SYSCTL_DID1_TEMP_M 0x000000E0 // Temperature range mask #define SYSCTL_DID1_TEMP_C 0x00000000 // Commercial temp range (0..70C) #define SYSCTL_DID1_TEMP_I 0x00000020 // Industrial temp range (-40..85C) #define SYSCTL_DID1_TEMP_E 0x00000040 // Extended temperature range (-40C // to 105C) #define SYSCTL_DID1_PKG_M 0x00000018 // Package Type. #define SYSCTL_DID1_PKG_BGA 0x00000010 // BGA package #define SYSCTL_DID1_PKG_28SOIC 0x00000000 // 28-pin SOIC #define SYSCTL_DID1_PKG_48QFP 0x00000008 // 48-pin QFP #define SYSCTL_DID1_ROHS 0x00000004 // Part is RoHS compliant #define SYSCTL_DID1_QUAL_M 0x00000003 // Qualification status mask #define SYSCTL_DID1_QUAL_ES 0x00000000 // Engineering sample (unqualified) #define SYSCTL_DID1_QUAL_PP 0x00000001 // Pilot production (unqualified) #define SYSCTL_DID1_QUAL_FQ 0x00000002 // Fully qualified #define SYSCTL_DID1_PRTNO_S 16 // Part number shift //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC0 register. // //***************************************************************************** #define SYSCTL_DC0_SRAMSZ_M 0xFFFF0000 // SRAM size mask #define SYSCTL_DC0_SRAMSZ_2KB 0x00070000 // 2 KB of SRAM #define SYSCTL_DC0_SRAMSZ_4KB 0x000F0000 // 4 KB of SRAM #define SYSCTL_DC0_SRAMSZ_8KB 0x001F0000 // 8 KB of SRAM #define SYSCTL_DC0_SRAMSZ_16KB 0x003F0000 // 16 KB of SRAM #define SYSCTL_DC0_SRAMSZ_32KB 0x007F0000 // 32 KB of SRAM #define SYSCTL_DC0_SRAMSZ_64KB 0x00FF0000 // 64 KB of SRAM #define SYSCTL_DC0_FLASHSZ_M 0x0000FFFF // Flash size mask #define SYSCTL_DC0_FLASHSZ_8KB 0x00000003 // 8 KB of flash #define SYSCTL_DC0_FLASHSZ_16KB 0x00000007 // 16 KB of flash #define SYSCTL_DC0_FLASHSZ_32KB 0x0000000F // 32 KB of flash #define SYSCTL_DC0_FLASHSZ_64KB 0x0000001F // 64 KB of flash #define SYSCTL_DC0_FLASHSZ_96KB 0x0000002F // 96 KB of flash #define SYSCTL_DC0_FLASHSZ_128K 0x0000003F // 128 KB of flash #define SYSCTL_DC0_FLASHSZ_256K 0x0000007F // 256 KB of flash #define SYSCTL_DC0_SRAMSZ_S 16 // SRAM size shift #define SYSCTL_DC0_FLASHSZ_S 0 // Flash size shift //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC1 register. // //***************************************************************************** #define SYSCTL_DC1_CAN2 0x04000000 // CAN2 module present #define SYSCTL_DC1_CAN1 0x02000000 // CAN1 module present #define SYSCTL_DC1_CAN0 0x01000000 // CAN0 module present #define SYSCTL_DC1_PWM 0x00100000 // PWM module present #define SYSCTL_DC1_ADC 0x00010000 // ADC module present #define SYSCTL_DC1_MINSYSDIV_M 0x0000F000 // System Clock Divider. #define SYSCTL_DC1_MINSYSDIV_50 0x00003000 // Specifies a 50-MHz CPU clock // with a PLL divider of 4. #define SYSCTL_DC1_MINSYSDIV_25 0x00007000 // Specifies a 25-MHz clock with a // PLL divider of 8. #define SYSCTL_DC1_MINSYSDIV_20 0x00009000 // Specifies a 20-MHz clock with a // PLL divider of 10. #define SYSCTL_DC1_ADCSPD_M 0x00000F00 // ADC speed mask #define SYSCTL_DC1_ADCSPD_125K 0x00000000 // 125Ksps ADC #define SYSCTL_DC1_ADCSPD_250K 0x00000100 // 250Ksps ADC #define SYSCTL_DC1_ADCSPD_500K 0x00000200 // 500Ksps ADC #define SYSCTL_DC1_ADCSPD_1M 0x00000300 // 1Msps ADC #define SYSCTL_DC1_MPU 0x00000080 // Cortex-M3 MPU present #define SYSCTL_DC1_HIB 0x00000040 // Hibernation module present #define SYSCTL_DC1_TEMP 0x00000020 // Temperature sensor present #define SYSCTL_DC1_PLL 0x00000010 // PLL present #define SYSCTL_DC1_WDT 0x00000008 // Watchdog Timer Present. #define SYSCTL_DC1_SWO 0x00000004 // Serial wire output present #define SYSCTL_DC1_SWD 0x00000002 // Serial wire debug present #define SYSCTL_DC1_JTAG 0x00000001 // JTAG debug present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC2 register. // //***************************************************************************** #define SYSCTL_DC2_COMP2 0x04000000 // Analog comparator 2 present #define SYSCTL_DC2_COMP1 0x02000000 // Analog comparator 1 present #define SYSCTL_DC2_COMP0 0x01000000 // Analog comparator 0 present #define SYSCTL_DC2_TIMER3 0x00080000 // Timer 3 present #define SYSCTL_DC2_TIMER2 0x00040000 // Timer 2 present #define SYSCTL_DC2_TIMER1 0x00020000 // Timer 1 present #define SYSCTL_DC2_TIMER0 0x00010000 // Timer 0 present #define SYSCTL_DC2_I2C1 0x00004000 // I2C 1 present #define SYSCTL_DC2_I2C0 0x00001000 // I2C 0 present #define SYSCTL_DC2_QEI1 0x00000200 // QEI 1 present #define SYSCTL_DC2_QEI0 0x00000100 // QEI 0 present #define SYSCTL_DC2_SSI1 0x00000020 // SSI 1 present #define SYSCTL_DC2_SSI0 0x00000010 // SSI 0 present #define SYSCTL_DC2_UART2 0x00000004 // UART 2 present #define SYSCTL_DC2_UART1 0x00000002 // UART 1 present #define SYSCTL_DC2_UART0 0x00000001 // UART 0 present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC3 register. // //***************************************************************************** #define SYSCTL_DC3_32KHZ 0x80000000 // 32KHz Pin Present. #define SYSCTL_DC3_CCP5 0x20000000 // CCP5 pin present #define SYSCTL_DC3_CCP4 0x10000000 // CCP4 pin present #define SYSCTL_DC3_CCP3 0x08000000 // CCP3 pin present #define SYSCTL_DC3_CCP2 0x04000000 // CCP2 pin present #define SYSCTL_DC3_CCP1 0x02000000 // CCP1 pin present #define SYSCTL_DC3_CCP0 0x01000000 // CCP0 pin present #define SYSCTL_DC3_ADC7 0x00800000 // ADC7 pin present #define SYSCTL_DC3_ADC6 0x00400000 // ADC6 pin present #define SYSCTL_DC3_ADC5 0x00200000 // ADC5 pin present #define SYSCTL_DC3_ADC4 0x00100000 // ADC4 pin present #define SYSCTL_DC3_ADC3 0x00080000 // ADC3 pin present #define SYSCTL_DC3_ADC2 0x00040000 // ADC2 pin present #define SYSCTL_DC3_ADC1 0x00020000 // ADC1 pin present #define SYSCTL_DC3_ADC0 0x00010000 // ADC0 pin present #define SYSCTL_DC3_PWMFAULT 0x00008000 // PWM Fault Pin Present. #define SYSCTL_DC3_C2O 0x00004000 // C2o pin present #define SYSCTL_DC3_C2PLUS 0x00002000 // C2+ pin present #define SYSCTL_DC3_C2MINUS 0x00001000 // C2- pin present #define SYSCTL_DC3_C1O 0x00000800 // C1o pin present #define SYSCTL_DC3_C1PLUS 0x00000400 // C1+ pin present #define SYSCTL_DC3_C1MINUS 0x00000200 // C1- pin present #define SYSCTL_DC3_C0O 0x00000100 // C0o pin present #define SYSCTL_DC3_C0PLUS 0x00000080 // C0+ pin present #define SYSCTL_DC3_C0MINUS 0x00000040 // C0- pin present #define SYSCTL_DC3_PWM5 0x00000020 // PWM5 pin present #define SYSCTL_DC3_PWM4 0x00000010 // PWM4 pin present #define SYSCTL_DC3_PWM3 0x00000008 // PWM3 pin present #define SYSCTL_DC3_PWM2 0x00000004 // PWM2 pin present #define SYSCTL_DC3_PWM1 0x00000002 // PWM1 pin present #define SYSCTL_DC3_PWM0 0x00000001 // PWM0 pin present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC4 register. // //***************************************************************************** #define SYSCTL_DC4_ETH 0x50000000 // Ethernet present #define SYSCTL_DC4_EPHY0 0x40000000 // Ethernet PHY0 Present. #define SYSCTL_DC4_EMAC0 0x10000000 // Ethernet MAC0 Present. #define SYSCTL_DC4_E1588 0x01000000 // 1588 Capable. #define SYSCTL_DC4_CCP7 0x00008000 // CCP7 Pin Present. #define SYSCTL_DC4_CCP6 0x00004000 // CCP6 Pin Present. #define SYSCTL_DC4_UDMA 0x00002000 // Micro-DMA is present. #define SYSCTL_DC4_ROM 0x00001000 // Internal Code ROM is present. #define SYSCTL_DC4_GPIOH 0x00000080 // GPIO port H present #define SYSCTL_DC4_GPIOG 0x00000040 // GPIO port G present #define SYSCTL_DC4_GPIOF 0x00000020 // GPIO port F present #define SYSCTL_DC4_GPIOE 0x00000010 // GPIO port E present #define SYSCTL_DC4_GPIOD 0x00000008 // GPIO port D present #define SYSCTL_DC4_GPIOC 0x00000004 // GPIO port C present #define SYSCTL_DC4_GPIOB 0x00000002 // GPIO port B present #define SYSCTL_DC4_GPIOA 0x00000001 // GPIO port A present //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PBORCTL register. // //***************************************************************************** #define SYSCTL_PBORCTL_BORTIM_M 0x0000FFFC // BOR Time Delay. #define SYSCTL_PBORCTL_BORIOR 0x00000002 // BOR interrupt or reset #define SYSCTL_PBORCTL_BORWT 0x00000001 // BOR wait and check for noise #define SYSCTL_PBORCTL_BORTIM_S 2 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_LDOPCTL register. // //***************************************************************************** #define SYSCTL_LDOPCTL_M 0x0000003F // LDO Output Voltage. #define SYSCTL_LDOPCTL_2_55V 0x0000001F // LDO output of 2.55V #define SYSCTL_LDOPCTL_2_60V 0x0000001E // LDO output of 2.60V #define SYSCTL_LDOPCTL_2_65V 0x0000001D // LDO output of 2.65V #define SYSCTL_LDOPCTL_2_70V 0x0000001C // LDO output of 2.70V #define SYSCTL_LDOPCTL_2_75V 0x0000001B // LDO output of 2.75V #define SYSCTL_LDOPCTL_2_25V 0x00000005 // LDO output of 2.25V #define SYSCTL_LDOPCTL_2_30V 0x00000004 // LDO output of 2.30V #define SYSCTL_LDOPCTL_2_35V 0x00000003 // LDO output of 2.35V #define SYSCTL_LDOPCTL_2_40V 0x00000002 // LDO output of 2.40V #define SYSCTL_LDOPCTL_2_45V 0x00000001 // LDO output of 2.45V #define SYSCTL_LDOPCTL_2_50V 0x00000000 // LDO output of 2.50V //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RESC register. // //***************************************************************************** #define SYSCTL_RESC_MOSCFAIL 0x00010000 // MOSC Failure Reset. #define SYSCTL_RESC_LDO 0x00000020 // LDO power OK lost reset #define SYSCTL_RESC_SW 0x00000010 // Software reset #define SYSCTL_RESC_WDT 0x00000008 // Watchdog Timer Reset. #define SYSCTL_RESC_BOR 0x00000004 // Brown-out reset #define SYSCTL_RESC_POR 0x00000002 // Power on reset #define SYSCTL_RESC_EXT 0x00000001 // External reset //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCC register. // //***************************************************************************** #define SYSCTL_RCC_ACG 0x08000000 // Automatic clock gating #define SYSCTL_RCC_SYSDIV_M 0x07800000 // System Clock Divisor. #define SYSCTL_RCC_SYSDIV_2 0x00800000 // System clock /2 #define SYSCTL_RCC_SYSDIV_3 0x01000000 // System clock /3 #define SYSCTL_RCC_SYSDIV_4 0x01800000 // System clock /4 #define SYSCTL_RCC_SYSDIV_5 0x02000000 // System clock /5 #define SYSCTL_RCC_SYSDIV_6 0x02800000 // System clock /6 #define SYSCTL_RCC_SYSDIV_7 0x03000000 // System clock /7 #define SYSCTL_RCC_SYSDIV_8 0x03800000 // System clock /8 #define SYSCTL_RCC_SYSDIV_9 0x04000000 // System clock /9 #define SYSCTL_RCC_SYSDIV_10 0x04800000 // System clock /10 #define SYSCTL_RCC_SYSDIV_11 0x05000000 // System clock /11 #define SYSCTL_RCC_SYSDIV_12 0x05800000 // System clock /12 #define SYSCTL_RCC_SYSDIV_13 0x06000000 // System clock /13 #define SYSCTL_RCC_SYSDIV_14 0x06800000 // System clock /14 #define SYSCTL_RCC_SYSDIV_15 0x07000000 // System clock /15 #define SYSCTL_RCC_SYSDIV_16 0x07800000 // System clock /16 #define SYSCTL_RCC_USESYSDIV 0x00400000 // Enable System Clock Divider. #define SYSCTL_RCC_USEPWMDIV 0x00100000 // Enable PWM Clock Divisor. #define SYSCTL_RCC_PWMDIV_M 0x000E0000 // PWM clock divider #define SYSCTL_RCC_PWMDIV_2 0x00000000 // PWM clock /2 #define SYSCTL_RCC_PWMDIV_4 0x00020000 // PWM clock /4 #define SYSCTL_RCC_PWMDIV_8 0x00040000 // PWM clock /8 #define SYSCTL_RCC_PWMDIV_16 0x00060000 // PWM clock /16 #define SYSCTL_RCC_PWMDIV_32 0x00080000 // PWM clock /32 #define SYSCTL_RCC_PWMDIV_64 0x000A0000 // PWM clock /64 #define SYSCTL_RCC_PWRDN 0x00002000 // PLL power down #define SYSCTL_RCC_OEN 0x00001000 // PLL Output Enable. #define SYSCTL_RCC_BYPASS 0x00000800 // PLL bypass #define SYSCTL_RCC_XTAL_M 0x000007C0 // Crystal attached to main osc #define SYSCTL_RCC_XTAL_1MHZ 0x00000000 // Using a 1MHz crystal #define SYSCTL_RCC_XTAL_1_84MHZ 0x00000040 // Using a 1.8432MHz crystal #define SYSCTL_RCC_XTAL_2MHZ 0x00000080 // Using a 2MHz crystal #define SYSCTL_RCC_XTAL_2_45MHZ 0x000000C0 // Using a 2.4576MHz crystal #define SYSCTL_RCC_XTAL_3_57MHZ 0x00000100 // Using a 3.579545MHz crystal #define SYSCTL_RCC_XTAL_3_68MHZ 0x00000140 // Using a 3.6864MHz crystal #define SYSCTL_RCC_XTAL_4MHZ 0x00000180 // Using a 4MHz crystal #define SYSCTL_RCC_XTAL_4_09MHZ 0x000001C0 // Using a 4.096MHz crystal #define SYSCTL_RCC_XTAL_4_91MHZ 0x00000200 // Using a 4.9152MHz crystal #define SYSCTL_RCC_XTAL_5MHZ 0x00000240 // Using a 5MHz crystal #define SYSCTL_RCC_XTAL_5_12MHZ 0x00000280 // Using a 5.12MHz crystal #define SYSCTL_RCC_XTAL_6MHZ 0x000002C0 // Using a 6MHz crystal #define SYSCTL_RCC_XTAL_6_14MHZ 0x00000300 // Using a 6.144MHz crystal #define SYSCTL_RCC_XTAL_7_37MHZ 0x00000340 // Using a 7.3728MHz crystal #define SYSCTL_RCC_XTAL_8MHZ 0x00000380 // Using a 8MHz crystal #define SYSCTL_RCC_XTAL_8_19MHZ 0x000003C0 // Using a 8.192MHz crystal #define SYSCTL_RCC_XTAL_10MHZ 0x00000400 // 10.0 MHz (USB) #define SYSCTL_RCC_XTAL_12MHZ 0x00000440 // 12.0 MHz (USB) #define SYSCTL_RCC_XTAL_12_2MHZ 0x00000480 // 12.288 MHz #define SYSCTL_RCC_XTAL_13_5MHZ 0x000004C0 // 13.56 MHz #define SYSCTL_RCC_XTAL_14_3MHZ 0x00000500 // 14.31818 MHz #define SYSCTL_RCC_XTAL_16MHZ 0x00000540 // 16.0 MHz (USB) #define SYSCTL_RCC_XTAL_16_3MHZ 0x00000580 // 16.384 MHz #define SYSCTL_RCC_PLLVER 0x00000400 // PLL verification timer enable #define SYSCTL_RCC_OSCSRC_M 0x00000030 // Oscillator input select #define SYSCTL_RCC_OSCSRC_MAIN 0x00000000 // Use the main oscillator #define SYSCTL_RCC_OSCSRC_INT 0x00000010 // Use the internal oscillator #define SYSCTL_RCC_OSCSRC_INT4 0x00000020 // Use the internal oscillator / 4 #define SYSCTL_RCC_OSCSRC_30 0x00000030 // 30 KHz internal oscillator #define SYSCTL_RCC_IOSCVER 0x00000008 // Int. osc. verification timer en #define SYSCTL_RCC_MOSCVER 0x00000004 // Main osc. verification timer en #define SYSCTL_RCC_IOSCDIS 0x00000002 // Internal oscillator disable #define SYSCTL_RCC_MOSCDIS 0x00000001 // Main oscillator disable #define SYSCTL_RCC_SYSDIV_S 23 // Shift to the SYSDIV field #define SYSCTL_RCC_PWMDIV_S 17 // Shift to the PWMDIV field #define SYSCTL_RCC_XTAL_S 6 // Shift to the XTAL field #define SYSCTL_RCC_OSCSRC_S 4 // Shift to the OSCSRC field //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_PLLCFG register. // //***************************************************************************** #define SYSCTL_PLLCFG_OD_M 0x0000C000 // Output divider #define SYSCTL_PLLCFG_OD_1 0x00000000 // Output divider is 1 #define SYSCTL_PLLCFG_OD_2 0x00004000 // Output divider is 2 #define SYSCTL_PLLCFG_OD_4 0x00008000 // Output divider is 4 #define SYSCTL_PLLCFG_F_M 0x00003FE0 // PLL F Value. #define SYSCTL_PLLCFG_R_M 0x0000001F // PLL R Value. #define SYSCTL_PLLCFG_F_S 5 #define SYSCTL_PLLCFG_R_S 0 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCC2 register. // //***************************************************************************** #define SYSCTL_RCC2_USERCC2 0x80000000 // Use RCC2 #define SYSCTL_RCC2_SYSDIV2_M 0x1F800000 // System clock divider #define SYSCTL_RCC2_SYSDIV2_2 0x00800000 // System clock /2 #define SYSCTL_RCC2_SYSDIV2_3 0x01000000 // System clock /3 #define SYSCTL_RCC2_SYSDIV2_4 0x01800000 // System clock /4 #define SYSCTL_RCC2_SYSDIV2_5 0x02000000 // System clock /5 #define SYSCTL_RCC2_SYSDIV2_6 0x02800000 // System clock /6 #define SYSCTL_RCC2_SYSDIV2_7 0x03000000 // System clock /7 #define SYSCTL_RCC2_SYSDIV2_8 0x03800000 // System clock /8 #define SYSCTL_RCC2_SYSDIV2_9 0x04000000 // System clock /9 #define SYSCTL_RCC2_SYSDIV2_10 0x04800000 // System clock /10 #define SYSCTL_RCC2_SYSDIV2_11 0x05000000 // System clock /11 #define SYSCTL_RCC2_SYSDIV2_12 0x05800000 // System clock /12 #define SYSCTL_RCC2_SYSDIV2_13 0x06000000 // System clock /13 #define SYSCTL_RCC2_SYSDIV2_14 0x06800000 // System clock /14 #define SYSCTL_RCC2_SYSDIV2_15 0x07000000 // System clock /15 #define SYSCTL_RCC2_SYSDIV2_16 0x07800000 // System clock /16 #define SYSCTL_RCC2_SYSDIV2_17 0x08000000 // System clock /17 #define SYSCTL_RCC2_SYSDIV2_18 0x08800000 // System clock /18 #define SYSCTL_RCC2_SYSDIV2_19 0x09000000 // System clock /19 #define SYSCTL_RCC2_SYSDIV2_20 0x09800000 // System clock /20 #define SYSCTL_RCC2_SYSDIV2_21 0x0A000000 // System clock /21 #define SYSCTL_RCC2_SYSDIV2_22 0x0A800000 // System clock /22 #define SYSCTL_RCC2_SYSDIV2_23 0x0B000000 // System clock /23 #define SYSCTL_RCC2_SYSDIV2_24 0x0B800000 // System clock /24 #define SYSCTL_RCC2_SYSDIV2_25 0x0C000000 // System clock /25 #define SYSCTL_RCC2_SYSDIV2_26 0x0C800000 // System clock /26 #define SYSCTL_RCC2_SYSDIV2_27 0x0D000000 // System clock /27 #define SYSCTL_RCC2_SYSDIV2_28 0x0D800000 // System clock /28 #define SYSCTL_RCC2_SYSDIV2_29 0x0E000000 // System clock /29 #define SYSCTL_RCC2_SYSDIV2_30 0x0E800000 // System clock /30 #define SYSCTL_RCC2_SYSDIV2_31 0x0F000000 // System clock /31 #define SYSCTL_RCC2_SYSDIV2_32 0x0F800000 // System clock /32 #define SYSCTL_RCC2_SYSDIV2_33 0x10000000 // System clock /33 #define SYSCTL_RCC2_SYSDIV2_34 0x10800000 // System clock /34 #define SYSCTL_RCC2_SYSDIV2_35 0x11000000 // System clock /35 #define SYSCTL_RCC2_SYSDIV2_36 0x11800000 // System clock /36 #define SYSCTL_RCC2_SYSDIV2_37 0x12000000 // System clock /37 #define SYSCTL_RCC2_SYSDIV2_38 0x12800000 // System clock /38 #define SYSCTL_RCC2_SYSDIV2_39 0x13000000 // System clock /39 #define SYSCTL_RCC2_SYSDIV2_40 0x13800000 // System clock /40 #define SYSCTL_RCC2_SYSDIV2_41 0x14000000 // System clock /41 #define SYSCTL_RCC2_SYSDIV2_42 0x14800000 // System clock /42 #define SYSCTL_RCC2_SYSDIV2_43 0x15000000 // System clock /43 #define SYSCTL_RCC2_SYSDIV2_44 0x15800000 // System clock /44 #define SYSCTL_RCC2_SYSDIV2_45 0x16000000 // System clock /45 #define SYSCTL_RCC2_SYSDIV2_46 0x16800000 // System clock /46 #define SYSCTL_RCC2_SYSDIV2_47 0x17000000 // System clock /47 #define SYSCTL_RCC2_SYSDIV2_48 0x17800000 // System clock /48 #define SYSCTL_RCC2_SYSDIV2_49 0x18000000 // System clock /49 #define SYSCTL_RCC2_SYSDIV2_50 0x18800000 // System clock /50 #define SYSCTL_RCC2_SYSDIV2_51 0x19000000 // System clock /51 #define SYSCTL_RCC2_SYSDIV2_52 0x19800000 // System clock /52 #define SYSCTL_RCC2_SYSDIV2_53 0x1A000000 // System clock /53 #define SYSCTL_RCC2_SYSDIV2_54 0x1A800000 // System clock /54 #define SYSCTL_RCC2_SYSDIV2_55 0x1B000000 // System clock /55 #define SYSCTL_RCC2_SYSDIV2_56 0x1B800000 // System clock /56 #define SYSCTL_RCC2_SYSDIV2_57 0x1C000000 // System clock /57 #define SYSCTL_RCC2_SYSDIV2_58 0x1C800000 // System clock /58 #define SYSCTL_RCC2_SYSDIV2_59 0x1D000000 // System clock /59 #define SYSCTL_RCC2_SYSDIV2_60 0x1D800000 // System clock /60 #define SYSCTL_RCC2_SYSDIV2_61 0x1E000000 // System clock /61 #define SYSCTL_RCC2_SYSDIV2_62 0x1E800000 // System clock /62 #define SYSCTL_RCC2_SYSDIV2_63 0x1F000000 // System clock /63 #define SYSCTL_RCC2_SYSDIV2_64 0x1F800000 // System clock /64 #define SYSCTL_RCC2_USBPWRDN 0x00004000 // Power-Down USB PLL. #define SYSCTL_RCC2_PWRDN2 0x00002000 // PLL power down #define SYSCTL_RCC2_BYPASS2 0x00000800 // PLL bypass #define SYSCTL_RCC2_OSCSRC2_M 0x00000070 // System Clock Source. #define SYSCTL_RCC2_OSCSRC2_MO 0x00000000 // Use the main oscillator #define SYSCTL_RCC2_OSCSRC2_IO 0x00000010 // Use the internal oscillator #define SYSCTL_RCC2_OSCSRC2_IO4 0x00000020 // Use the internal oscillator / 4 #define SYSCTL_RCC2_OSCSRC2_30 0x00000030 // Use the 30 KHz internal osc. #define SYSCTL_RCC2_OSCSRC2_32 0x00000070 // Use the 32 KHz external osc. #define SYSCTL_RCC2_SYSDIV2_S 23 // Shift to the SYSDIV2 field //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DSLPCLKCFG // register. // //***************************************************************************** #define SYSCTL_DSLPCLKCFG_D_M 0x1F800000 // Divider Field Override. #define SYSCTL_DSLPCLKCFG_D_2 0x00800000 // System clock /2 #define SYSCTL_DSLPCLKCFG_D_3 0x01000000 // System clock /3 #define SYSCTL_DSLPCLKCFG_D_4 0x01800000 // System clock /4 #define SYSCTL_DSLPCLKCFG_D_5 0x02000000 // System clock /5 #define SYSCTL_DSLPCLKCFG_D_6 0x02800000 // System clock /6 #define SYSCTL_DSLPCLKCFG_D_7 0x03000000 // System clock /7 #define SYSCTL_DSLPCLKCFG_D_8 0x03800000 // System clock /8 #define SYSCTL_DSLPCLKCFG_D_9 0x04000000 // System clock /9 #define SYSCTL_DSLPCLKCFG_D_10 0x04800000 // System clock /10 #define SYSCTL_DSLPCLKCFG_D_11 0x05000000 // System clock /11 #define SYSCTL_DSLPCLKCFG_D_12 0x05800000 // System clock /12 #define SYSCTL_DSLPCLKCFG_D_13 0x06000000 // System clock /13 #define SYSCTL_DSLPCLKCFG_D_14 0x06800000 // System clock /14 #define SYSCTL_DSLPCLKCFG_D_15 0x07000000 // System clock /15 #define SYSCTL_DSLPCLKCFG_D_16 0x07800000 // System clock /16 #define SYSCTL_DSLPCLKCFG_D_17 0x08000000 // System clock /17 #define SYSCTL_DSLPCLKCFG_D_18 0x08800000 // System clock /18 #define SYSCTL_DSLPCLKCFG_D_19 0x09000000 // System clock /19 #define SYSCTL_DSLPCLKCFG_D_20 0x09800000 // System clock /20 #define SYSCTL_DSLPCLKCFG_D_21 0x0A000000 // System clock /21 #define SYSCTL_DSLPCLKCFG_D_22 0x0A800000 // System clock /22 #define SYSCTL_DSLPCLKCFG_D_23 0x0B000000 // System clock /23 #define SYSCTL_DSLPCLKCFG_D_24 0x0B800000 // System clock /24 #define SYSCTL_DSLPCLKCFG_D_25 0x0C000000 // System clock /25 #define SYSCTL_DSLPCLKCFG_D_26 0x0C800000 // System clock /26 #define SYSCTL_DSLPCLKCFG_D_27 0x0D000000 // System clock /27 #define SYSCTL_DSLPCLKCFG_D_28 0x0D800000 // System clock /28 #define SYSCTL_DSLPCLKCFG_D_29 0x0E000000 // System clock /29 #define SYSCTL_DSLPCLKCFG_D_30 0x0E800000 // System clock /30 #define SYSCTL_DSLPCLKCFG_D_31 0x0F000000 // System clock /31 #define SYSCTL_DSLPCLKCFG_D_32 0x0F800000 // System clock /32 #define SYSCTL_DSLPCLKCFG_D_33 0x10000000 // System clock /33 #define SYSCTL_DSLPCLKCFG_D_34 0x10800000 // System clock /34 #define SYSCTL_DSLPCLKCFG_D_35 0x11000000 // System clock /35 #define SYSCTL_DSLPCLKCFG_D_36 0x11800000 // System clock /36 #define SYSCTL_DSLPCLKCFG_D_37 0x12000000 // System clock /37 #define SYSCTL_DSLPCLKCFG_D_38 0x12800000 // System clock /38 #define SYSCTL_DSLPCLKCFG_D_39 0x13000000 // System clock /39 #define SYSCTL_DSLPCLKCFG_D_40 0x13800000 // System clock /40 #define SYSCTL_DSLPCLKCFG_D_41 0x14000000 // System clock /41 #define SYSCTL_DSLPCLKCFG_D_42 0x14800000 // System clock /42 #define SYSCTL_DSLPCLKCFG_D_43 0x15000000 // System clock /43 #define SYSCTL_DSLPCLKCFG_D_44 0x15800000 // System clock /44 #define SYSCTL_DSLPCLKCFG_D_45 0x16000000 // System clock /45 #define SYSCTL_DSLPCLKCFG_D_46 0x16800000 // System clock /46 #define SYSCTL_DSLPCLKCFG_D_47 0x17000000 // System clock /47 #define SYSCTL_DSLPCLKCFG_D_48 0x17800000 // System clock /48 #define SYSCTL_DSLPCLKCFG_D_49 0x18000000 // System clock /49 #define SYSCTL_DSLPCLKCFG_D_50 0x18800000 // System clock /50 #define SYSCTL_DSLPCLKCFG_D_51 0x19000000 // System clock /51 #define SYSCTL_DSLPCLKCFG_D_52 0x19800000 // System clock /52 #define SYSCTL_DSLPCLKCFG_D_53 0x1A000000 // System clock /53 #define SYSCTL_DSLPCLKCFG_D_54 0x1A800000 // System clock /54 #define SYSCTL_DSLPCLKCFG_D_55 0x1B000000 // System clock /55 #define SYSCTL_DSLPCLKCFG_D_56 0x1B800000 // System clock /56 #define SYSCTL_DSLPCLKCFG_D_57 0x1C000000 // System clock /57 #define SYSCTL_DSLPCLKCFG_D_58 0x1C800000 // System clock /58 #define SYSCTL_DSLPCLKCFG_D_59 0x1D000000 // System clock /59 #define SYSCTL_DSLPCLKCFG_D_60 0x1D800000 // System clock /60 #define SYSCTL_DSLPCLKCFG_D_61 0x1E000000 // System clock /61 #define SYSCTL_DSLPCLKCFG_D_62 0x1E800000 // System clock /62 #define SYSCTL_DSLPCLKCFG_D_63 0x1F000000 // System clock /63 #define SYSCTL_DSLPCLKCFG_D_64 0x1F800000 // System clock /64 #define SYSCTL_DSLPCLKCFG_O_M 0x00000070 // Clock Source. #define SYSCTL_DSLPCLKCFG_O_IGN 0x00000000 // Do not override #define SYSCTL_DSLPCLKCFG_O_IO 0x00000010 // Use the internal oscillator #define SYSCTL_DSLPCLKCFG_O_30 0x00000030 // Use the 30 KHz internal osc. #define SYSCTL_DSLPCLKCFG_O_32 0x00000070 // Use the 32 KHz external osc. #define SYSCTL_DSLPCLKCFG_IOSC 0x00000001 // IOSC Clock Source. #define SYSCTL_DSLPCLKCFG_D_S 23 //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_CLKVCLR register. // //***************************************************************************** #define SYSCTL_CLKVCLR_VERCLR 0x00000001 // Clock Verification Clear. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_LDOARST register. // //***************************************************************************** #define SYSCTL_LDOARST_LDOARST 0x00000001 // LDO Reset. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR0 register. // //***************************************************************************** #define SYSCTL_SRCR0_CAN2 0x04000000 // CAN2 Reset Control. #define SYSCTL_SRCR0_CAN1 0x02000000 // CAN1 Reset Control. #define SYSCTL_SRCR0_CAN0 0x01000000 // CAN0 Reset Control. #define SYSCTL_SRCR0_PWM 0x00100000 // PWM Reset Control. #define SYSCTL_SRCR0_ADC 0x00010000 // ADC0 Reset Control. #define SYSCTL_SRCR0_HIB 0x00000040 // HIB Reset Control. #define SYSCTL_SRCR0_WDT 0x00000008 // WDT Reset Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR1 register. // //***************************************************************************** #define SYSCTL_SRCR1_COMP2 0x04000000 // Analog Comp 2 Reset Control. #define SYSCTL_SRCR1_COMP1 0x02000000 // Analog Comp 1 Reset Control. #define SYSCTL_SRCR1_COMP0 0x01000000 // Analog Comp 0 Reset Control. #define SYSCTL_SRCR1_TIMER3 0x00080000 // Timer 3 Reset Control. #define SYSCTL_SRCR1_TIMER2 0x00040000 // Timer 2 Reset Control. #define SYSCTL_SRCR1_TIMER1 0x00020000 // Timer 1 Reset Control. #define SYSCTL_SRCR1_TIMER0 0x00010000 // Timer 0 Reset Control. #define SYSCTL_SRCR1_I2C1 0x00004000 // I2C1 Reset Control. #define SYSCTL_SRCR1_I2C0 0x00001000 // I2C0 Reset Control. #define SYSCTL_SRCR1_QEI1 0x00000200 // QEI1 Reset Control. #define SYSCTL_SRCR1_QEI0 0x00000100 // QEI0 Reset Control. #define SYSCTL_SRCR1_SSI1 0x00000020 // SSI1 Reset Control. #define SYSCTL_SRCR1_SSI0 0x00000010 // SSI0 Reset Control. #define SYSCTL_SRCR1_UART2 0x00000004 // UART2 Reset Control. #define SYSCTL_SRCR1_UART1 0x00000002 // UART1 Reset Control. #define SYSCTL_SRCR1_UART0 0x00000001 // UART0 Reset Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SRCR2 register. // //***************************************************************************** #define SYSCTL_SRCR2_EPHY0 0x40000000 // PHY0 Reset Control. #define SYSCTL_SRCR2_EMAC0 0x10000000 // MAC0 Reset Control. #define SYSCTL_SRCR2_USB0 0x00010000 // USB0 Reset Control. #define SYSCTL_SRCR2_UDMA 0x00002000 // UDMA Reset Control. #define SYSCTL_SRCR2_GPIOH 0x00000080 // Port H Reset Control. #define SYSCTL_SRCR2_GPIOG 0x00000040 // Port G Reset Control. #define SYSCTL_SRCR2_GPIOF 0x00000020 // Port F Reset Control. #define SYSCTL_SRCR2_GPIOE 0x00000010 // Port E Reset Control. #define SYSCTL_SRCR2_GPIOD 0x00000008 // Port D Reset Control. #define SYSCTL_SRCR2_GPIOC 0x00000004 // Port C Reset Control. #define SYSCTL_SRCR2_GPIOB 0x00000002 // Port B Reset Control. #define SYSCTL_SRCR2_GPIOA 0x00000001 // Port A Reset Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RIS register. // //***************************************************************************** #define SYSCTL_RIS_MOSCPUPRIS 0x00000100 // MOSC Power Up Raw Interrupt // Status. #define SYSCTL_RIS_USBPLLLRIS 0x00000080 // USB PLL Lock Raw Interrupt // Status. #define SYSCTL_RIS_PLLLRIS 0x00000040 // PLL Lock Raw Interrupt Status. #define SYSCTL_RIS_CLRIS 0x00000020 // Current Limit Raw Interrupt // Status. #define SYSCTL_RIS_IOFRIS 0x00000010 // Internal Oscillator Fault Raw // Interrupt Status. #define SYSCTL_RIS_MOFRIS 0x00000008 // Main Oscillator Fault Raw // Interrupt Status. #define SYSCTL_RIS_LDORIS 0x00000004 // LDO Power Unregulated Raw // Interrupt Status. #define SYSCTL_RIS_BORRIS 0x00000002 // Brown-Out Reset Raw Interrupt // Status. #define SYSCTL_RIS_PLLFRIS 0x00000001 // PLL Fault Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_IMC register. // //***************************************************************************** #define SYSCTL_IMC_MOSCPUPIM 0x00000100 // MOSC Power Up Interrupt Mask. #define SYSCTL_IMC_USBPLLLIM 0x00000080 // USB PLL Lock Interrupt Mask. #define SYSCTL_IMC_PLLLIM 0x00000040 // PLL Lock Interrupt Mask. #define SYSCTL_IMC_CLIM 0x00000020 // Current Limit Interrupt Mask. #define SYSCTL_IMC_IOFIM 0x00000010 // Internal Oscillator Fault // Interrupt Mask. #define SYSCTL_IMC_MOFIM 0x00000008 // Main Oscillator Fault Interrupt // Mask. #define SYSCTL_IMC_LDOIM 0x00000004 // LDO Power Unregulated Interrupt // Mask. #define SYSCTL_IMC_BORIM 0x00000002 // Brown-Out Reset Interrupt Mask. #define SYSCTL_IMC_PLLFIM 0x00000001 // PLL Fault Interrupt Mask. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_MISC register. // //***************************************************************************** #define SYSCTL_MISC_MOSCPUPMIS 0x00000100 // MOSC Power Up Masked Interrupt // Status. #define SYSCTL_MISC_USBPLLLMIS 0x00000080 // USB PLL Lock Masked Interrupt // Status. #define SYSCTL_MISC_PLLLMIS 0x00000040 // PLL Lock Masked Interrupt // Status. #define SYSCTL_MISC_CLMIS 0x00000020 // Current Limit Masked Interrupt // Status. #define SYSCTL_MISC_IOFMIS 0x00000010 // Internal Oscillator Fault Masked // Interrupt Status. #define SYSCTL_MISC_MOFMIS 0x00000008 // Main Oscillator Fault Masked // Interrupt Status. #define SYSCTL_MISC_LDOMIS 0x00000004 // LDO Power Unregulated Masked // Interrupt Status. #define SYSCTL_MISC_BORMIS 0x00000002 // BOR Masked Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC0 register. // //***************************************************************************** #define SYSCTL_RCGC0_CAN2 0x04000000 // CAN2 Clock Gating Control. #define SYSCTL_RCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control. #define SYSCTL_RCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control. #define SYSCTL_RCGC0_PWM 0x00100000 // PWM Clock Gating Control. #define SYSCTL_RCGC0_ADC 0x00010000 // ADC0 Clock Gating Control. #define SYSCTL_RCGC0_ADCSPD_M 0x00000F00 // ADC Sample Speed. #define SYSCTL_RCGC0_ADCSPD125K 0x00000000 // 125K samples/second #define SYSCTL_RCGC0_ADCSPD250K 0x00000100 // 250K samples/second #define SYSCTL_RCGC0_ADCSPD500K 0x00000200 // 500K samples/second #define SYSCTL_RCGC0_ADCSPD1M 0x00000300 // 1M samples/second #define SYSCTL_RCGC0_HIB 0x00000040 // HIB Clock Gating Control. #define SYSCTL_RCGC0_WDT 0x00000008 // WDT Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC1 register. // //***************************************************************************** #define SYSCTL_RCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock // Gating. #define SYSCTL_RCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock // Gating. #define SYSCTL_RCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock // Gating. #define SYSCTL_RCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control. #define SYSCTL_RCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control. #define SYSCTL_RCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control. #define SYSCTL_RCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control. #define SYSCTL_RCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control. #define SYSCTL_RCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control. #define SYSCTL_RCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control. #define SYSCTL_RCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control. #define SYSCTL_RCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control. #define SYSCTL_RCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control. #define SYSCTL_RCGC1_UART2 0x00000004 // UART2 Clock Gating Control. #define SYSCTL_RCGC1_UART1 0x00000002 // UART1 Clock Gating Control. #define SYSCTL_RCGC1_UART0 0x00000001 // UART0 Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_RCGC2 register. // //***************************************************************************** #define SYSCTL_RCGC2_EPHY0 0x40000000 // PHY0 Clock Gating Control. #define SYSCTL_RCGC2_EMAC0 0x10000000 // MAC0 Clock Gating Control. #define SYSCTL_RCGC2_USB0 0x00010000 // USB0 Clock Gating Control. #define SYSCTL_RCGC2_UDMA 0x00002000 // UDMA Clock Gating Control. #define SYSCTL_RCGC2_GPIOH 0x00000080 // Port H Clock Gating Control. #define SYSCTL_RCGC2_GPIOG 0x00000040 // Port G Clock Gating Control. #define SYSCTL_RCGC2_GPIOF 0x00000020 // Port F Clock Gating Control. #define SYSCTL_RCGC2_GPIOE 0x00000010 // Port E Clock Gating Control. #define SYSCTL_RCGC2_GPIOD 0x00000008 // Port D Clock Gating Control. #define SYSCTL_RCGC2_GPIOC 0x00000004 // Port C Clock Gating Control. #define SYSCTL_RCGC2_GPIOB 0x00000002 // Port B Clock Gating Control. #define SYSCTL_RCGC2_GPIOA 0x00000001 // Port A Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC0 register. // //***************************************************************************** #define SYSCTL_SCGC0_CAN2 0x04000000 // CAN2 Clock Gating Control. #define SYSCTL_SCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control. #define SYSCTL_SCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control. #define SYSCTL_SCGC0_PWM 0x00100000 // PWM Clock Gating Control. #define SYSCTL_SCGC0_ADC 0x00010000 // ADC0 Clock Gating Control. #define SYSCTL_SCGC0_ADCSPD_M 0x00000F00 // ADC Sample Speed. #define SYSCTL_SCGC0_ADCSPD125K 0x00000000 // 125K samples/second #define SYSCTL_SCGC0_ADCSPD250K 0x00000100 // 250K samples/second #define SYSCTL_SCGC0_ADCSPD500K 0x00000200 // 500K samples/second #define SYSCTL_SCGC0_ADCSPD1M 0x00000300 // 1M samples/second #define SYSCTL_SCGC0_HIB 0x00000040 // HIB Clock Gating Control. #define SYSCTL_SCGC0_WDT 0x00000008 // WDT Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC1 register. // //***************************************************************************** #define SYSCTL_SCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock // Gating. #define SYSCTL_SCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock // Gating. #define SYSCTL_SCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock // Gating. #define SYSCTL_SCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control. #define SYSCTL_SCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control. #define SYSCTL_SCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control. #define SYSCTL_SCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control. #define SYSCTL_SCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control. #define SYSCTL_SCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control. #define SYSCTL_SCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control. #define SYSCTL_SCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control. #define SYSCTL_SCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control. #define SYSCTL_SCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control. #define SYSCTL_SCGC1_UART2 0x00000004 // UART2 Clock Gating Control. #define SYSCTL_SCGC1_UART1 0x00000002 // UART1 Clock Gating Control. #define SYSCTL_SCGC1_UART0 0x00000001 // UART0 Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_SCGC2 register. // //***************************************************************************** #define SYSCTL_SCGC2_EPHY0 0x40000000 // PHY0 Clock Gating Control. #define SYSCTL_SCGC2_EMAC0 0x10000000 // MAC0 Clock Gating Control. #define SYSCTL_SCGC2_USB0 0x00010000 // USB0 Clock Gating Control. #define SYSCTL_SCGC2_UDMA 0x00002000 // UDMA Clock Gating Control. #define SYSCTL_SCGC2_GPIOH 0x00000080 // Port H Clock Gating Control. #define SYSCTL_SCGC2_GPIOG 0x00000040 // Port G Clock Gating Control. #define SYSCTL_SCGC2_GPIOF 0x00000020 // Port F Clock Gating Control. #define SYSCTL_SCGC2_GPIOE 0x00000010 // Port E Clock Gating Control. #define SYSCTL_SCGC2_GPIOD 0x00000008 // Port D Clock Gating Control. #define SYSCTL_SCGC2_GPIOC 0x00000004 // Port C Clock Gating Control. #define SYSCTL_SCGC2_GPIOB 0x00000002 // Port B Clock Gating Control. #define SYSCTL_SCGC2_GPIOA 0x00000001 // Port A Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC0 register. // //***************************************************************************** #define SYSCTL_DCGC0_CAN2 0x04000000 // CAN2 Clock Gating Control. #define SYSCTL_DCGC0_CAN1 0x02000000 // CAN1 Clock Gating Control. #define SYSCTL_DCGC0_CAN0 0x01000000 // CAN0 Clock Gating Control. #define SYSCTL_DCGC0_PWM 0x00100000 // PWM Clock Gating Control. #define SYSCTL_DCGC0_ADC 0x00010000 // ADC0 Clock Gating Control. #define SYSCTL_DCGC0_ADCSPD_M 0x00000F00 // ADC Sample Speed. #define SYSCTL_DCGC0_ADCSPD125K 0x00000000 // 125K samples/second #define SYSCTL_DCGC0_ADCSPD250K 0x00000100 // 250K samples/second #define SYSCTL_DCGC0_ADCSPD500K 0x00000200 // 500K samples/second #define SYSCTL_DCGC0_ADCSPD1M 0x00000300 // 1M samples/second #define SYSCTL_DCGC0_HIB 0x00000040 // HIB Clock Gating Control. #define SYSCTL_DCGC0_WDT 0x00000008 // WDT Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC1 register. // //***************************************************************************** #define SYSCTL_DCGC1_COMP2 0x04000000 // Analog Comparator 2 Clock // Gating. #define SYSCTL_DCGC1_COMP1 0x02000000 // Analog Comparator 1 Clock // Gating. #define SYSCTL_DCGC1_COMP0 0x01000000 // Analog Comparator 0 Clock // Gating. #define SYSCTL_DCGC1_TIMER3 0x00080000 // Timer 3 Clock Gating Control. #define SYSCTL_DCGC1_TIMER2 0x00040000 // Timer 2 Clock Gating Control. #define SYSCTL_DCGC1_TIMER1 0x00020000 // Timer 1 Clock Gating Control. #define SYSCTL_DCGC1_TIMER0 0x00010000 // Timer 0 Clock Gating Control. #define SYSCTL_DCGC1_I2C1 0x00004000 // I2C1 Clock Gating Control. #define SYSCTL_DCGC1_I2C0 0x00001000 // I2C0 Clock Gating Control. #define SYSCTL_DCGC1_QEI1 0x00000200 // QEI1 Clock Gating Control. #define SYSCTL_DCGC1_QEI0 0x00000100 // QEI0 Clock Gating Control. #define SYSCTL_DCGC1_SSI1 0x00000020 // SSI1 Clock Gating Control. #define SYSCTL_DCGC1_SSI0 0x00000010 // SSI0 Clock Gating Control. #define SYSCTL_DCGC1_UART2 0x00000004 // UART2 Clock Gating Control. #define SYSCTL_DCGC1_UART1 0x00000002 // UART1 Clock Gating Control. #define SYSCTL_DCGC1_UART0 0x00000001 // UART0 Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DCGC2 register. // //***************************************************************************** #define SYSCTL_DCGC2_EPHY0 0x40000000 // PHY0 Clock Gating Control. #define SYSCTL_DCGC2_EMAC0 0x10000000 // MAC0 Clock Gating Control. #define SYSCTL_DCGC2_USB0 0x00010000 // USB0 Clock Gating Control. #define SYSCTL_DCGC2_UDMA 0x00002000 // UDMA Clock Gating Control. #define SYSCTL_DCGC2_GPIOH 0x00000080 // Port H Clock Gating Control. #define SYSCTL_DCGC2_GPIOG 0x00000040 // Port G Clock Gating Control. #define SYSCTL_DCGC2_GPIOF 0x00000020 // Port F Clock Gating Control. #define SYSCTL_DCGC2_GPIOE 0x00000010 // Port E Clock Gating Control. #define SYSCTL_DCGC2_GPIOD 0x00000008 // Port D Clock Gating Control. #define SYSCTL_DCGC2_GPIOC 0x00000004 // Port C Clock Gating Control. #define SYSCTL_DCGC2_GPIOB 0x00000002 // Port B Clock Gating Control. #define SYSCTL_DCGC2_GPIOA 0x00000001 // Port A Clock Gating Control. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC5 register. // //***************************************************************************** #define SYSCTL_DC5_PWMFAULT3 0x08000000 // PWM Fault 3 Pin Present. #define SYSCTL_DC5_PWMFAULT2 0x04000000 // PWM Fault 2 Pin Present. #define SYSCTL_DC5_PWMFAULT1 0x02000000 // PWM Fault 1 Pin Present. #define SYSCTL_DC5_PWMFAULT0 0x01000000 // PWM Fault 0 Pin Present. #define SYSCTL_DC5_PWMEFLT 0x00200000 // PWM Extended Fault feature is // active. #define SYSCTL_DC5_PWMESYNC 0x00100000 // PWM Extended SYNC feature is // active. #define SYSCTL_DC5_PWM7 0x00000080 // PWM7 Pin Present. #define SYSCTL_DC5_PWM6 0x00000040 // PWM6 Pin Present. #define SYSCTL_DC5_PWM5 0x00000020 // PWM5 Pin Present. #define SYSCTL_DC5_PWM4 0x00000010 // PWM4 Pin Present. #define SYSCTL_DC5_PWM3 0x00000008 // PWM3 Pin Present. #define SYSCTL_DC5_PWM2 0x00000004 // PWM2 Pin Present. #define SYSCTL_DC5_PWM1 0x00000002 // PWM1 Pin Present. #define SYSCTL_DC5_PWM0 0x00000001 // PWM0 Pin Present. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC6 register. // //***************************************************************************** #define SYSCTL_DC6_USB0_M 0x00000003 // This specifies that USB0 is // present and its capability. #define SYSCTL_DC6_USB0_HOSTDEV 0x00000002 // USB is DEVICE or HOST #define SYSCTL_DC6_USB0_OTG 0x00000003 // USB is OTG //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_GPIOHSCTL // register. // //***************************************************************************** #define SYSCTL_GPIOHSCTL_PORTH 0x00000080 // Port H High-Speed. #define SYSCTL_GPIOHSCTL_PORTG 0x00000040 // Port G High-Speed. #define SYSCTL_GPIOHSCTL_PORTF 0x00000020 // Port F High-Speed. #define SYSCTL_GPIOHSCTL_PORTE 0x00000010 // Port E High-Speed. #define SYSCTL_GPIOHSCTL_PORTD 0x00000008 // Port D High-Speed. #define SYSCTL_GPIOHSCTL_PORTC 0x00000004 // Port C High-Speed. #define SYSCTL_GPIOHSCTL_PORTB 0x00000002 // Port B High-Speed. #define SYSCTL_GPIOHSCTL_PORTA 0x00000001 // Port A High-Speed. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_MOSCCTL register. // //***************************************************************************** #define SYSCTL_MOSCCTL_CVAL 0x00000001 // Clock Validation for MOSC. //***************************************************************************** // // The following are defines for the bit fields in the SYSCTL_DC7 register. // //***************************************************************************** #define SYSCTL_DC7_SSI1_TX 0x02000000 // SSI1 TX on uDMA Ch25. #define SYSCTL_DC7_SSI1_RX 0x01000000 // SSI1 RX on uDMA Ch24. #define SYSCTL_DC7_UART1_TX 0x00800000 // UART1 TX on uDMA Ch23. #define SYSCTL_DC7_UART1_RX 0x00400000 // UART1 RX on uDMA Ch22. #define SYSCTL_DC7_SSI0_TX 0x00000800 // SSI0 TX on uDMA Ch11. #define SYSCTL_DC7_SSI0_RX 0x00000400 // SSI0 RX on uDMA Ch10. #define SYSCTL_DC7_UART0_TX 0x00000200 // UART0 TX on uDMA Ch9. #define SYSCTL_DC7_UART0_RX 0x00000100 // UART0 RX on uDMA Ch8. #define SYSCTL_DC7_USB_EP3_TX 0x00000020 // USB EP3 TX on uDMA Ch5. #define SYSCTL_DC7_USB_EP3_RX 0x00000010 // USB EP3 RX on uDMA Ch4. #define SYSCTL_DC7_USB_EP2_TX 0x00000008 // USB EP2 TX on uDMA Ch3. #define SYSCTL_DC7_USB_EP2_RX 0x00000004 // USB EP2 RX on uDMA Ch2. #define SYSCTL_DC7_USB_EP1_TX 0x00000002 // USB EP1 TX on uDMA Ch1. #define SYSCTL_DC7_USB_EP1_RX 0x00000001 // USB EP1 RX on uDMA Ch0. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the system control register // addresses. // //***************************************************************************** #define SYSCTL_USER0 0x400FE1E0 // NV User Register 0 #define SYSCTL_USER1 0x400FE1E4 // NV User Register 1 //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DID0 // register. // //***************************************************************************** #define SYSCTL_DID0_VER_MASK 0x70000000 // DID0 version mask #define SYSCTL_DID0_CLASS_MASK 0x00FF0000 // Device Class #define SYSCTL_DID0_MAJ_MASK 0x0000FF00 // Major revision mask #define SYSCTL_DID0_MAJ_A 0x00000000 // Major revision A #define SYSCTL_DID0_MAJ_B 0x00000100 // Major revision B #define SYSCTL_DID0_MAJ_C 0x00000200 // Major revision C #define SYSCTL_DID0_MIN_MASK 0x000000FF // Minor revision mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DID1 // register. // //***************************************************************************** #define SYSCTL_DID1_VER_MASK 0xF0000000 // Register version mask #define SYSCTL_DID1_FAM_MASK 0x0F000000 // Family mask #define SYSCTL_DID1_FAM_S 0x00000000 // Stellaris family #define SYSCTL_DID1_PRTNO_MASK 0x00FF0000 // Part number mask #define SYSCTL_DID1_PINCNT_MASK 0x0000E000 // Pin count #define SYSCTL_DID1_TEMP_MASK 0x000000E0 // Temperature range mask #define SYSCTL_DID1_PKG_MASK 0x00000018 // Package mask #define SYSCTL_DID1_QUAL_MASK 0x00000003 // Qualification status mask #define SYSCTL_DID1_PRTNO_SHIFT 16 //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DC0 // register. // //***************************************************************************** #define SYSCTL_DC0_SRAMSZ_MASK 0xFFFF0000 // SRAM size mask #define SYSCTL_DC0_FLASHSZ_MASK 0x0000FFFF // Flash size mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DC1 // register. // //***************************************************************************** #define SYSCTL_DC1_SYSDIV_MASK 0x0000F000 // Minimum system divider mask #define SYSCTL_DC1_ADCSPD_MASK 0x00000F00 // ADC speed mask #define SYSCTL_DC1_WDOG 0x00000008 // Watchdog present //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DC2 // register. // //***************************************************************************** #define SYSCTL_DC2_I2C 0x00001000 // I2C present #define SYSCTL_DC2_QEI 0x00000100 // QEI present #define SYSCTL_DC2_SSI 0x00000010 // SSI present //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_DC3 // register. // //***************************************************************************** #define SYSCTL_DC3_MC_FAULT0 0x00008000 // MC0 fault pin present //***************************************************************************** // // The following are deprecated defines for the bit fields in the // SYSCTL_PBORCTL register. // //***************************************************************************** #define SYSCTL_PBORCTL_BOR_MASK 0x0000FFFC // BOR wait timer #define SYSCTL_PBORCTL_BOR_SH 2 //***************************************************************************** // // The following are deprecated defines for the bit fields in the // SYSCTL_LDOPCTL register. // //***************************************************************************** #define SYSCTL_LDOPCTL_MASK 0x0000003F // Voltage adjust mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_SRCR0, // SYSCTL_RCGC0, SYSCTL_SCGC0, and SYSCTL_DCGC0 registers. // //***************************************************************************** #define SYSCTL_SET0_CAN2 0x04000000 // CAN 2 module #define SYSCTL_SET0_CAN1 0x02000000 // CAN 1 module #define SYSCTL_SET0_CAN0 0x01000000 // CAN 0 module #define SYSCTL_SET0_PWM 0x00100000 // PWM module #define SYSCTL_SET0_ADC 0x00010000 // ADC module #define SYSCTL_SET0_ADCSPD_MASK 0x00000F00 // ADC speed mask #define SYSCTL_SET0_ADCSPD_125K 0x00000000 // 125Ksps ADC #define SYSCTL_SET0_ADCSPD_250K 0x00000100 // 250Ksps ADC #define SYSCTL_SET0_ADCSPD_500K 0x00000200 // 500Ksps ADC #define SYSCTL_SET0_ADCSPD_1M 0x00000300 // 1Msps ADC #define SYSCTL_SET0_HIB 0x00000040 // Hibernation module #define SYSCTL_SET0_WDOG 0x00000008 // Watchdog module //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_SRCR1, // SYSCTL_RCGC1, SYSCTL_SCGC1, and SYSCTL_DCGC1 registers. // //***************************************************************************** #define SYSCTL_SET1_COMP2 0x04000000 // Analog comparator module 2 #define SYSCTL_SET1_COMP1 0x02000000 // Analog comparator module 1 #define SYSCTL_SET1_COMP0 0x01000000 // Analog comparator module 0 #define SYSCTL_SET1_TIMER3 0x00080000 // Timer module 3 #define SYSCTL_SET1_TIMER2 0x00040000 // Timer module 2 #define SYSCTL_SET1_TIMER1 0x00020000 // Timer module 1 #define SYSCTL_SET1_TIMER0 0x00010000 // Timer module 0 #define SYSCTL_SET1_I2C1 0x00002000 // I2C module 1 #define SYSCTL_SET1_I2C0 0x00001000 // I2C module 0 #define SYSCTL_SET1_I2C 0x00001000 // I2C module #define SYSCTL_SET1_QEI1 0x00000200 // QEI module 1 #define SYSCTL_SET1_QEI 0x00000100 // QEI module #define SYSCTL_SET1_QEI0 0x00000100 // QEI module 0 #define SYSCTL_SET1_SSI1 0x00000020 // SSI module 1 #define SYSCTL_SET1_SSI0 0x00000010 // SSI module 0 #define SYSCTL_SET1_SSI 0x00000010 // SSI module #define SYSCTL_SET1_UART2 0x00000004 // UART module 2 #define SYSCTL_SET1_UART1 0x00000002 // UART module 1 #define SYSCTL_SET1_UART0 0x00000001 // UART module 0 //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_SRCR2, // SYSCTL_RCGC2, SYSCTL_SCGC2, and SYSCTL_DCGC2 registers. // //***************************************************************************** #define SYSCTL_SET2_ETH 0x50000000 // ETH module #define SYSCTL_SET2_GPIOH 0x00000080 // GPIO H module #define SYSCTL_SET2_GPIOG 0x00000040 // GPIO G module #define SYSCTL_SET2_GPIOF 0x00000020 // GPIO F module #define SYSCTL_SET2_GPIOE 0x00000010 // GPIO E module #define SYSCTL_SET2_GPIOD 0x00000008 // GPIO D module #define SYSCTL_SET2_GPIOC 0x00000004 // GPIO C module #define SYSCTL_SET2_GPIOB 0x00000002 // GPIO B module #define SYSCTL_SET2_GPIOA 0x00000001 // GIPO A module //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_RIS, // SYSCTL_IMC, and SYSCTL_IMS registers. // //***************************************************************************** #define SYSCTL_INT_PLL_LOCK 0x00000040 // PLL lock interrupt #define SYSCTL_INT_CUR_LIMIT 0x00000020 // Current limit interrupt #define SYSCTL_INT_IOSC_FAIL 0x00000010 // Internal oscillator failure int #define SYSCTL_INT_MOSC_FAIL 0x00000008 // Main oscillator failure int #define SYSCTL_INT_POR 0x00000004 // Power on reset interrupt #define SYSCTL_INT_BOR 0x00000002 // Brown out interrupt #define SYSCTL_INT_PLL_FAIL 0x00000001 // PLL failure interrupt //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_RESC // register. // //***************************************************************************** #define SYSCTL_RESC_WDOG 0x00000008 // Watchdog reset //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_RCC // register. // //***************************************************************************** #define SYSCTL_RCC_SYSDIV_MASK 0x07800000 // System clock divider #define SYSCTL_RCC_USE_SYSDIV 0x00400000 // Use sytem clock divider #define SYSCTL_RCC_USE_PWMDIV 0x00100000 // Use PWM clock divider #define SYSCTL_RCC_PWMDIV_MASK 0x000E0000 // PWM clock divider #define SYSCTL_RCC_OE 0x00001000 // PLL output enable #define SYSCTL_RCC_XTAL_3_68MHz 0x00000140 // Using a 3.6864 MHz crystal #define SYSCTL_RCC_XTAL_4MHz 0x00000180 // Using a 4 MHz crystal #define SYSCTL_RCC_XTAL_MASK 0x000003C0 // Crystal attached to main osc #define SYSCTL_RCC_OSCSRC_MASK 0x00000030 // Oscillator input select #define SYSCTL_RCC_SYSDIV_SHIFT 23 // Shift to the SYSDIV field #define SYSCTL_RCC_PWMDIV_SHIFT 17 // Shift to the PWMDIV field #define SYSCTL_RCC_XTAL_SHIFT 6 // Shift to the XTAL field #define SYSCTL_RCC_OSCSRC_SHIFT 4 // Shift to the OSCSRC field //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_PLLCFG // register. // //***************************************************************************** #define SYSCTL_PLLCFG_OD_MASK 0x0000C000 // Output divider #define SYSCTL_PLLCFG_F_MASK 0x00003FE0 // PLL multiplier #define SYSCTL_PLLCFG_R_MASK 0x0000001F // Input predivider #define SYSCTL_PLLCFG_F_SHIFT 5 #define SYSCTL_PLLCFG_R_SHIFT 0 //***************************************************************************** // // The following are deprecated defines for the bit fields in the SYSCTL_RCC2 // register. // //***************************************************************************** #define SYSCTL_RCC2_SYSDIV2_MSK 0x1F800000 // System clock divider #define SYSCTL_RCC2_OSCSRC2_MSK 0x00000070 // Oscillator input select //***************************************************************************** // // The following are deprecated defines for the bit fields in the // SYSCTL_DSLPCLKCFG register. // //***************************************************************************** #define SYSCTL_DSLPCLKCFG_D_MSK 0x1F800000 // Deep sleep system clock override #define SYSCTL_DSLPCLKCFG_O_MSK 0x00000070 // Deep sleep oscillator override //***************************************************************************** // // The following are deprecated defines for the bit fields in the // SYSCTL_CLKVCLR register. // //***************************************************************************** #define SYSCTL_CLKVCLR_CLR 0x00000001 // Clear clock verification fault //***************************************************************************** // // The following are deprecated defines for the bit fields in the // SYSCTL_LDOARST register. // //***************************************************************************** #define SYSCTL_LDOARST_ARST 0x00000001 // Allow LDO to reset device #endif #endif // __HW_SYSCTL_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_sysctl.h
C
oos
78,370
//***************************************************************************** // // interrupt.h - Prototypes for the NVIC Interrupt Controller Driver. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __INTERRUPT_H__ #define __INTERRUPT_H__ //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // // Macro to generate an interrupt priority mask based on the number of bits // of priority supported by the hardware. // //***************************************************************************** #define INT_PRIORITY_MASK ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF) //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern tBoolean IntMasterEnable(void); extern tBoolean IntMasterDisable(void); extern void IntRegister(unsigned long ulInterrupt, void (*pfnHandler)(void)); extern void IntUnregister(unsigned long ulInterrupt); extern void IntPriorityGroupingSet(unsigned long ulBits); extern unsigned long IntPriorityGroupingGet(void); extern void IntPrioritySet(unsigned long ulInterrupt, unsigned char ucPriority); extern long IntPriorityGet(unsigned long ulInterrupt); extern void IntEnable(unsigned long ulInterrupt); extern void IntDisable(unsigned long ulInterrupt); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #ifdef __cplusplus } #endif #endif // __INTERRUPT_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/interrupt.h
C
oos
3,233
//***************************************************************************** // // hw_watchdog.h - Macros used when accessing the Watchdog Timer hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_WATCHDOG_H__ #define __HW_WATCHDOG_H__ //***************************************************************************** // // The following are defines for the Watchdog Timer register offsets. // //***************************************************************************** #define WDT_O_LOAD 0x00000000 // Load register #define WDT_O_VALUE 0x00000004 // Current value register #define WDT_O_CTL 0x00000008 // Control register #define WDT_O_ICR 0x0000000C // Interrupt clear register #define WDT_O_RIS 0x00000010 // Raw interrupt status register #define WDT_O_MIS 0x00000014 // Masked interrupt status register #define WDT_O_TEST 0x00000418 // Test register #define WDT_O_LOCK 0x00000C00 // Lock register //***************************************************************************** // // The following are defines for the bit fields in the WDT_CTL register. // //***************************************************************************** #define WDT_CTL_RESEN 0x00000002 // Enable reset output #define WDT_CTL_INTEN 0x00000001 // Enable the WDT counter and int //***************************************************************************** // // The following are defines for the bit fields in the WDT_ISR, WDT_RIS, and // WDT_MIS registers. // //***************************************************************************** #define WDT_INT_TIMEOUT 0x00000001 // Watchdog timer expired //***************************************************************************** // // The following are defines for the bit fields in the WDT_TEST register. // //***************************************************************************** #define WDT_TEST_STALL 0x00000100 // Watchdog stall enable //***************************************************************************** // // The following are defines for the bit fields in the WDT_LOCK register. // //***************************************************************************** #define WDT_LOCK_M 0xFFFFFFFF // Watchdog Lock. #define WDT_LOCK_UNLOCK 0x1ACCE551 // Unlocks the watchdog timer #define WDT_LOCK_LOCKED 0x00000001 // Watchdog timer is locked #define WDT_LOCK_UNLOCKED 0x00000000 // Watchdog timer is unlocked //***************************************************************************** // // The following are defines for the bit fields in the WDT_O_LOAD register. // //***************************************************************************** #define WDT_LOAD_M 0xFFFFFFFF // Watchdog Load Value. #define WDT_LOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the WDT_O_VALUE register. // //***************************************************************************** #define WDT_VALUE_M 0xFFFFFFFF // Watchdog Value. #define WDT_VALUE_S 0 //***************************************************************************** // // The following are defines for the bit fields in the WDT_O_ICR register. // //***************************************************************************** #define WDT_ICR_M 0xFFFFFFFF // Watchdog Interrupt Clear. #define WDT_ICR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the WDT_O_RIS register. // //***************************************************************************** #define WDT_RIS_WDTRIS 0x00000001 // Watchdog Raw Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the WDT_O_MIS register. // //***************************************************************************** #define WDT_MIS_WDTMIS 0x00000001 // Watchdog Masked Interrupt // Status. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the Watchdog Timer register // offsets. // //***************************************************************************** #define WDT_O_PeriphID4 0x00000FD0 #define WDT_O_PeriphID5 0x00000FD4 #define WDT_O_PeriphID6 0x00000FD8 #define WDT_O_PeriphID7 0x00000FDC #define WDT_O_PeriphID0 0x00000FE0 #define WDT_O_PeriphID1 0x00000FE4 #define WDT_O_PeriphID2 0x00000FE8 #define WDT_O_PeriphID3 0x00000FEC #define WDT_O_PCellID0 0x00000FF0 #define WDT_O_PCellID1 0x00000FF4 #define WDT_O_PCellID2 0x00000FF8 #define WDT_O_PCellID3 0x00000FFC //***************************************************************************** // // The following are deprecated defines for the bit fields in the WDT_TEST // register. // //***************************************************************************** #define WDT_TEST_STALL_EN 0x00000100 // Watchdog stall enable //***************************************************************************** // // The following are deprecated defines for the reset values for the WDT // registers. // //***************************************************************************** #define WDT_RV_VALUE 0xFFFFFFFF // Current value register #define WDT_RV_LOAD 0xFFFFFFFF // Load register #define WDT_RV_PCellID1 0x000000F0 #define WDT_RV_PCellID3 0x000000B1 #define WDT_RV_PeriphID1 0x00000018 #define WDT_RV_PeriphID2 0x00000018 #define WDT_RV_PCellID0 0x0000000D #define WDT_RV_PCellID2 0x00000005 #define WDT_RV_PeriphID0 0x00000005 #define WDT_RV_PeriphID3 0x00000001 #define WDT_RV_PeriphID5 0x00000000 #define WDT_RV_RIS 0x00000000 // Raw interrupt status register #define WDT_RV_CTL 0x00000000 // Control register #define WDT_RV_PeriphID4 0x00000000 #define WDT_RV_PeriphID6 0x00000000 #define WDT_RV_PeriphID7 0x00000000 #define WDT_RV_LOCK 0x00000000 // Lock register #define WDT_RV_MIS 0x00000000 // Masked interrupt status register #endif #endif // __HW_WATCHDOG_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_watchdog.h
C
oos
8,220
//***************************************************************************** // // hw_memmap.h - Macros defining the memory map of Stellaris. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_MEMMAP_H__ #define __HW_MEMMAP_H__ //***************************************************************************** // // The following are defines for the base address of the memories and // peripherals. // //***************************************************************************** #define FLASH_BASE 0x00000000 // FLASH memory #define SRAM_BASE 0x20000000 // SRAM memory #define WATCHDOG_BASE 0x40000000 // Watchdog #define GPIO_PORTA_BASE 0x40004000 // GPIO Port A #define GPIO_PORTB_BASE 0x40005000 // GPIO Port B #define GPIO_PORTC_BASE 0x40006000 // GPIO Port C #define GPIO_PORTD_BASE 0x40007000 // GPIO Port D #define SSI0_BASE 0x40008000 // SSI0 #define SSI1_BASE 0x40009000 // SSI1 #define UART0_BASE 0x4000C000 // UART0 #define UART1_BASE 0x4000D000 // UART1 #define UART2_BASE 0x4000E000 // UART2 #define I2C0_MASTER_BASE 0x40020000 // I2C0 Master #define I2C0_SLAVE_BASE 0x40020800 // I2C0 Slave #define I2C1_MASTER_BASE 0x40021000 // I2C1 Master #define I2C1_SLAVE_BASE 0x40021800 // I2C1 Slave #define GPIO_PORTE_BASE 0x40024000 // GPIO Port E #define GPIO_PORTF_BASE 0x40025000 // GPIO Port F #define GPIO_PORTG_BASE 0x40026000 // GPIO Port G #define GPIO_PORTH_BASE 0x40027000 // GPIO Port H #define PWM_BASE 0x40028000 // PWM #define QEI0_BASE 0x4002C000 // QEI0 #define QEI1_BASE 0x4002D000 // QEI1 #define TIMER0_BASE 0x40030000 // Timer0 #define TIMER1_BASE 0x40031000 // Timer1 #define TIMER2_BASE 0x40032000 // Timer2 #define TIMER3_BASE 0x40033000 // Timer3 #define ADC_BASE 0x40038000 // ADC #define COMP_BASE 0x4003C000 // Analog comparators #define CAN0_BASE 0x40040000 // CAN0 #define CAN1_BASE 0x40041000 // CAN1 #define CAN2_BASE 0x40042000 // CAN2 #define ETH_BASE 0x40048000 // Ethernet #define MAC_BASE 0x40048000 // Ethernet #define USB0_BASE 0x40050000 // USB 0 Controller #define GPIO_PORTA_AHB_BASE 0x40058000 // GPIO Port A (high speed) #define GPIO_PORTB_AHB_BASE 0x40059000 // GPIO Port B (high speed) #define GPIO_PORTC_AHB_BASE 0x4005A000 // GPIO Port C (high speed) #define GPIO_PORTD_AHB_BASE 0x4005B000 // GPIO Port D (high speed) #define GPIO_PORTE_AHB_BASE 0x4005C000 // GPIO Port E (high speed) #define GPIO_PORTF_AHB_BASE 0x4005D000 // GPIO Port F (high speed) #define GPIO_PORTG_AHB_BASE 0x4005E000 // GPIO Port G (high speed) #define GPIO_PORTH_AHB_BASE 0x4005F000 // GPIO Port H (high speed) #define HIB_BASE 0x400FC000 // Hibernation Module #define FLASH_CTRL_BASE 0x400FD000 // FLASH Controller #define SYSCTL_BASE 0x400FE000 // System Control #define UDMA_BASE 0x400FF000 // uDMA Controller #define ITM_BASE 0xE0000000 // Instrumentation Trace Macrocell #define DWT_BASE 0xE0001000 // Data Watchpoint and Trace #define FPB_BASE 0xE0002000 // FLASH Patch and Breakpoint #define NVIC_BASE 0xE000E000 // Nested Vectored Interrupt Ctrl #define TPIU_BASE 0xE0040000 // Trace Port Interface Unit //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the base address of the memories // and peripherals. // //***************************************************************************** #define SSI_BASE 0x40008000 // SSI #define I2C_MASTER_BASE 0x40020000 // I2C Master #define I2C_SLAVE_BASE 0x40020800 // I2C Slave #define QEI_BASE 0x4002C000 // QEI #endif #endif // __HW_MEMMAP_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_memmap.h
C
oos
5,703
//***************************************************************************** // // hw_pwm.h - Defines and Macros for Pulse Width Modulation (PWM) ports // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_PWM_H__ #define __HW_PWM_H__ //***************************************************************************** // // The following are defines for the PWM Module Register offsets. // //***************************************************************************** #define PWM_O_CTL 0x00000000 // PWM Master Control register #define PWM_O_SYNC 0x00000004 // PWM Time Base Sync register #define PWM_O_ENABLE 0x00000008 // PWM Output Enable register #define PWM_O_INVERT 0x0000000C // PWM Output Inversion register #define PWM_O_FAULT 0x00000010 // PWM Output Fault register #define PWM_O_INTEN 0x00000014 // PWM Interrupt Enable register #define PWM_O_RIS 0x00000018 // PWM Interrupt Raw Status reg. #define PWM_O_ISC 0x0000001C // PWM Interrupt Status register #define PWM_O_STATUS 0x00000020 // PWM Status register #define PWM_O_FAULTVAL 0x00000024 // PWM Fault Condition Value #define PWM_O_0_CTL 0x00000040 // PWM0 Control #define PWM_O_0_INTEN 0x00000044 // PWM0 Interrupt and Trigger // Enable #define PWM_O_0_RIS 0x00000048 // PWM0 Raw Interrupt Status #define PWM_O_0_ISC 0x0000004C // PWM0 Interrupt Status and Clear #define PWM_O_0_LOAD 0x00000050 // PWM0 Load #define PWM_O_0_COUNT 0x00000054 // PWM0 Counter #define PWM_O_0_CMPA 0x00000058 // PWM0 Compare A #define PWM_O_0_CMPB 0x0000005C // PWM0 Compare B #define PWM_O_0_GENA 0x00000060 // PWM0 Generator A Control #define PWM_O_0_GENB 0x00000064 // PWM0 Generator B Control #define PWM_O_0_DBCTL 0x00000068 // PWM0 Dead-Band Control #define PWM_O_0_DBRISE 0x0000006C // PWM0 Dead-Band Rising-Edge Delay #define PWM_O_0_DBFALL 0x00000070 // PWM0 Dead-Band // Falling-Edge-Delay #define PWM_O_0_FLTSRC0 0x00000074 // PWM0 Fault Source 0 #define PWM_O_0_MINFLTPER 0x0000007C // PWM0 Minimum Fault Period #define PWM_O_1_CTL 0x00000080 // PWM1 Control #define PWM_O_1_INTEN 0x00000084 // PWM1 Interrupt Enable #define PWM_O_1_RIS 0x00000088 // PWM1 Raw Interrupt Status #define PWM_O_1_ISC 0x0000008C // PWM1 Interrupt Status and Clear #define PWM_O_1_LOAD 0x00000090 // PWM1 Load #define PWM_O_1_COUNT 0x00000094 // PWM1 Counter #define PWM_O_1_CMPA 0x00000098 // PWM1 Compare A #define PWM_O_1_CMPB 0x0000009C // PWM1 Compare B #define PWM_O_1_GENA 0x000000A0 // PWM1 Generator A Control #define PWM_O_1_GENB 0x000000A4 // PWM1 Generator B Control #define PWM_O_1_DBCTL 0x000000A8 // PWM1 Dead-Band Control #define PWM_O_1_DBRISE 0x000000AC // PWM1 Dead-Band Rising-Edge Delay #define PWM_O_1_DBFALL 0x000000B0 // PWM1 Dead-Band // Falling-Edge-Delay #define PWM_O_1_FLTSRC0 0x000000B4 // PWM1 Fault Source 0 #define PWM_O_1_MINFLTPER 0x000000BC // PWM1 Minimum Fault Period #define PWM_O_2_CTL 0x000000C0 // PWM2 Control #define PWM_O_2_INTEN 0x000000C4 // PWM2 InterruptEnable #define PWM_O_2_RIS 0x000000C8 // PWM2 Raw Interrupt Status #define PWM_O_2_ISC 0x000000CC // PWM2 Interrupt Status and Clear #define PWM_O_2_LOAD 0x000000D0 // PWM2 Load #define PWM_O_2_COUNT 0x000000D4 // PWM2 Counter #define PWM_O_2_CMPA 0x000000D8 // PWM2 Compare A #define PWM_O_2_CMPB 0x000000DC // PWM2 Compare B #define PWM_O_2_GENA 0x000000E0 // PWM2 Generator A Control #define PWM_O_2_GENB 0x000000E4 // PWM2 Generator B Control #define PWM_O_2_DBCTL 0x000000E8 // PWM2 Dead-Band Control #define PWM_O_2_DBRISE 0x000000EC // PWM2 Dead-Band Rising-Edge Delay #define PWM_O_2_DBFALL 0x000000F0 // PWM2 Dead-Band // Falling-Edge-Delay #define PWM_O_2_FLTSRC0 0x000000F4 // PWM2 Fault Source 0 #define PWM_O_2_MINFLTPER 0x000000FC // PWM2 Minimum Fault Period #define PWM_O_3_CTL 0x00000100 // PWM3 Control #define PWM_O_3_INTEN 0x00000104 // PWM3 Interrupt and Trigger // Enable #define PWM_O_3_RIS 0x00000108 // PWM3 Raw Interrupt Status #define PWM_O_3_ISC 0x0000010C // PWM3 Interrupt Status and Clear #define PWM_O_3_LOAD 0x00000110 // PWM3 Load #define PWM_O_3_COUNT 0x00000114 // PWM3 Counter #define PWM_O_3_CMPA 0x00000118 // PWM3 Compare A #define PWM_O_3_CMPB 0x0000011C // PWM3 Compare B #define PWM_O_3_GENA 0x00000120 // PWM3 Generator A Control #define PWM_O_3_GENB 0x00000124 // PWM3 Generator B Control #define PWM_O_3_DBCTL 0x00000128 // PWM3 Dead-Band Control #define PWM_O_3_DBRISE 0x0000012C // PWM3 Dead-Band Rising-Edge Delay #define PWM_O_3_DBFALL 0x00000130 // PWM3 Dead-Band // Falling-Edge-Delay #define PWM_O_3_FLTSRC0 0x00000134 // PWM3 Fault Source 0 #define PWM_O_3_MINFLTPER 0x0000013C // PWM3 Minimum Fault Period #define PWM_O_0_FLTSEN 0x00000800 // PWM0 Fault Pin Logic Sense #define PWM_O_0_FLTSTAT0 0x00000804 // PWM0 Fault Status 0 #define PWM_O_1_FLTSEN 0x00000880 // PWM1 Fault Pin Logic Sense #define PWM_O_1_FLTSTAT0 0x00000884 // PWM1 Fault Status 0 #define PWM_O_2_FLTSEN 0x00000900 // PWM2 Fault Pin Logic Sense #define PWM_O_2_FLTSTAT0 0x00000904 // PWM2 Fault Status 0 #define PWM_O_3_FLTSEN 0x00000980 // PWM3 Fault Pin Logic Sense #define PWM_O_3_FLTSTAT0 0x00000984 // PWM3 Fault Status 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM Master Control // register. // //***************************************************************************** #define PWM_CTL_GLOBALSYNC3 0x00000008 // Update PWM Generator 3. #define PWM_CTL_GLOBALSYNC2 0x00000004 // Update PWM Generator 2. #define PWM_CTL_GLOBALSYNC1 0x00000002 // Update PWM Generator 1. #define PWM_CTL_GLOBALSYNC0 0x00000001 // Update PWM Generator 0. //***************************************************************************** // // The following are defines for the bit fields in the PWM Time Base Sync // register. // //***************************************************************************** #define PWM_SYNC_SYNC3 0x00000008 // Reset generator 3 counter #define PWM_SYNC_SYNC2 0x00000004 // Reset generator 2 counter #define PWM_SYNC_SYNC1 0x00000002 // Reset generator 1 counter #define PWM_SYNC_SYNC0 0x00000001 // Reset generator 0 counter //***************************************************************************** // // The following are defines for the bit fields in the PWM Output Enable // register. // //***************************************************************************** #define PWM_ENABLE_PWM7EN 0x00000080 // PWM7 pin enable #define PWM_ENABLE_PWM6EN 0x00000040 // PWM6 pin enable #define PWM_ENABLE_PWM5EN 0x00000020 // PWM5 pin enable #define PWM_ENABLE_PWM4EN 0x00000010 // PWM4 pin enable #define PWM_ENABLE_PWM3EN 0x00000008 // PWM3 pin enable #define PWM_ENABLE_PWM2EN 0x00000004 // PWM2 pin enable #define PWM_ENABLE_PWM1EN 0x00000002 // PWM1 pin enable #define PWM_ENABLE_PWM0EN 0x00000001 // PWM0 pin enable //***************************************************************************** // // The following are defines for the bit fields in the PWM Inversion register. // //***************************************************************************** #define PWM_INVERT_PWM7INV 0x00000080 // PWM7 pin invert #define PWM_INVERT_PWM6INV 0x00000040 // PWM6 pin invert #define PWM_INVERT_PWM5INV 0x00000020 // PWM5 pin invert #define PWM_INVERT_PWM4INV 0x00000010 // PWM4 pin invert #define PWM_INVERT_PWM3INV 0x00000008 // PWM3 pin invert #define PWM_INVERT_PWM2INV 0x00000004 // PWM2 pin invert #define PWM_INVERT_PWM1INV 0x00000002 // PWM1 pin invert #define PWM_INVERT_PWM0INV 0x00000001 // PWM0 pin invert //***************************************************************************** // // The following are defines for the bit fields in the PWM Fault register. // //***************************************************************************** #define PWM_FAULT_FAULT7 0x00000080 // PWM7 pin fault #define PWM_FAULT_FAULT6 0x00000040 // PWM6 pin fault #define PWM_FAULT_FAULT5 0x00000020 // PWM5 pin fault #define PWM_FAULT_FAULT4 0x00000010 // PWM4 pin fault #define PWM_FAULT_FAULT3 0x00000008 // PWM3 pin fault #define PWM_FAULT_FAULT2 0x00000004 // PWM2 pin fault #define PWM_FAULT_FAULT1 0x00000002 // PWM1 pin fault #define PWM_FAULT_FAULT0 0x00000001 // PWM0 pin fault //***************************************************************************** // // The following are defines for the bit fields in the PWM Status register. // //***************************************************************************** #define PWM_STATUS_FAULT3 0x00000008 // Fault3 Interrupt Status. #define PWM_STATUS_FAULT2 0x00000004 // Fault2 Interrupt Status. #define PWM_STATUS_FAULT1 0x00000002 // Fault1 Interrupt Status. #define PWM_STATUS_FAULT0 0x00000001 // Fault0 Interrupt Status. //***************************************************************************** // // The following are defines for the PWM Generator standard offsets. // //***************************************************************************** #define PWM_O_X_CTL 0x00000000 // Gen Control Reg #define PWM_O_X_INTEN 0x00000004 // Gen Int/Trig Enable Reg #define PWM_O_X_RIS 0x00000008 // Gen Raw Int Status Reg #define PWM_O_X_ISC 0x0000000C // Gen Int Status Reg #define PWM_O_X_LOAD 0x00000010 // Gen Load Reg #define PWM_O_X_COUNT 0x00000014 // Gen Counter Reg #define PWM_O_X_CMPA 0x00000018 // Gen Compare A Reg #define PWM_O_X_CMPB 0x0000001C // Gen Compare B Reg #define PWM_O_X_GENA 0x00000020 // Gen Generator A Ctrl Reg #define PWM_O_X_GENB 0x00000024 // Gen Generator B Ctrl Reg #define PWM_O_X_DBCTL 0x00000028 // Gen Dead Band Ctrl Reg #define PWM_O_X_DBRISE 0x0000002C // Gen DB Rising Edge Delay Reg #define PWM_O_X_DBFALL 0x00000030 // Gen DB Falling Edge Delay Reg #define PWM_O_X_FLTSRC0 0x00000034 // Fault pin, comparator condition #define PWM_O_X_MINFLTPER 0x0000003C // Fault minimum period extension #define PWM_GEN_0_OFFSET 0x00000040 // PWM0 base #define PWM_GEN_1_OFFSET 0x00000080 // PWM1 base #define PWM_GEN_2_OFFSET 0x000000C0 // PWM2 base #define PWM_GEN_3_OFFSET 0x00000100 // PWM3 base //***************************************************************************** // // The following are defines for the PWM_X Control Register bit definitions. // //***************************************************************************** #define PWM_X_CTL_LATCH 0x00040000 // Latch Fault Input. #define PWM_X_CTL_MINFLTPER 0x00020000 // Minimum fault period enabled #define PWM_X_CTL_FLTSRC 0x00010000 // Fault Condition Source. #define PWM_X_CTL_DBFALLUPD_M 0x0000C000 // Specifies the update mode for // the PWMnDBFALL register. #define PWM_X_CTL_DBFALLUPD_I 0x00000000 // Immediate #define PWM_X_CTL_DBFALLUPD_LS 0x00008000 // Locally Synchronized #define PWM_X_CTL_DBFALLUPD_GS 0x0000C000 // Globally Synchronized #define PWM_X_CTL_DBRISEUPD_M 0x00003000 // PWMnDBRISE Update Mode. #define PWM_X_CTL_DBRISEUPD_I 0x00000000 // Immediate #define PWM_X_CTL_DBRISEUPD_LS 0x00002000 // Locally Synchronized #define PWM_X_CTL_DBRISEUPD_GS 0x00003000 // Globally Synchronized #define PWM_X_CTL_DBCTLUPD_M 0x00000C00 // PWMnDBCTL Update Mode. #define PWM_X_CTL_DBCTLUPD_I 0x00000000 // Immediate #define PWM_X_CTL_DBCTLUPD_LS 0x00000800 // Locally Synchronized #define PWM_X_CTL_DBCTLUPD_GS 0x00000C00 // Globally Synchronized #define PWM_X_CTL_GENBUPD_M 0x00000300 // PWMnGENB Update Mode. #define PWM_X_CTL_GENBUPD_I 0x00000000 // Immediate #define PWM_X_CTL_GENBUPD_LS 0x00000200 // Locally Synchronized #define PWM_X_CTL_GENBUPD_GS 0x00000300 // Globally Synchronized #define PWM_X_CTL_GENAUPD_M 0x000000C0 // PWMnGENA Update Mode. #define PWM_X_CTL_GENAUPD_I 0x00000000 // Immediate #define PWM_X_CTL_GENAUPD_LS 0x00000080 // Locally Synchronized #define PWM_X_CTL_GENAUPD_GS 0x000000C0 // Globally Synchronized #define PWM_X_CTL_CMPBUPD 0x00000020 // Update mode for comp B reg #define PWM_X_CTL_CMPAUPD 0x00000010 // Update mode for comp A reg #define PWM_X_CTL_LOADUPD 0x00000008 // Update mode for the load reg #define PWM_X_CTL_DEBUG 0x00000004 // Debug mode #define PWM_X_CTL_MODE 0x00000002 // Counter mode, down or up/down #define PWM_X_CTL_ENABLE 0x00000001 // Master enable for gen block //***************************************************************************** // // The following are defines for the PWM Generator extended offsets. // //***************************************************************************** #define PWM_O_X_FLTSEN 0x00000000 // Fault logic sense #define PWM_O_X_FLTSTAT0 0x00000004 // Pin and comparator status #define PWM_EXT_0_OFFSET 0x00000800 // PWM0 extended base #define PWM_EXT_1_OFFSET 0x00000880 // PWM1 extended base #define PWM_EXT_2_OFFSET 0x00000900 // PWM2 extended base #define PWM_EXT_3_OFFSET 0x00000980 // PWM3 extended base //***************************************************************************** // // The following are defines for the PWM_X Interrupt/Trigger Enable Register // bit definitions. // //***************************************************************************** #define PWM_X_INTEN_TRCMPBD 0x00002000 // Trig if COUNT = CMPA D #define PWM_X_INTEN_TRCMPBU 0x00001000 // Trig if COUNT = CMPA U #define PWM_X_INTEN_TRCMPAD 0x00000800 // Trig if COUNT = CMPA D #define PWM_X_INTEN_TRCMPAU 0x00000400 // Trig if COUNT = CMPA U #define PWM_X_INTEN_TRCNTLOAD 0x00000200 // Trig if COUNT = LOAD #define PWM_X_INTEN_TRCNTZERO 0x00000100 // Trig if COUNT = 0 #define PWM_X_INTEN_INTCMPBD 0x00000020 // Int if COUNT = CMPA D #define PWM_X_INTEN_INTCMPBU 0x00000010 // Int if COUNT = CMPA U #define PWM_X_INTEN_INTCMPAD 0x00000008 // Int if COUNT = CMPA D #define PWM_X_INTEN_INTCMPAU 0x00000004 // Int if COUNT = CMPA U #define PWM_X_INTEN_INTCNTLOAD 0x00000002 // Int if COUNT = LOAD #define PWM_X_INTEN_INTCNTZERO 0x00000001 // Int if COUNT = 0 //***************************************************************************** // // The following are defines for the PWM_X Raw Interrupt Status Register bit // definitions. // //***************************************************************************** #define PWM_X_RIS_INTCMPBD 0x00000020 // PWM_X_COUNT = PWM_X_CMPB D int #define PWM_X_RIS_INTCMPBU 0x00000010 // PWM_X_COUNT = PWM_X_CMPB U int #define PWM_X_RIS_INTCMPAD 0x00000008 // PWM_X_COUNT = PWM_X_CMPA D int #define PWM_X_RIS_INTCMPAU 0x00000004 // PWM_X_COUNT = PWM_X_CMPA U int #define PWM_X_RIS_INTCNTLOAD 0x00000002 // PWM_X_COUNT = PWM_X_LOAD int #define PWM_X_RIS_INTCNTZERO 0x00000001 // PWM_X_COUNT = 0 int //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_INTEN register. // //***************************************************************************** #define PWM_INTEN_INTFAULT3 0x00080000 // Interrupt Fault 3. #define PWM_INTEN_INTFAULT2 0x00040000 // Interrupt Fault 2. #define PWM_INTEN_INTFAULT1 0x00020000 // Interrupt Fault 1. #define PWM_INTEN_INTFAULT 0x00010000 // Fault Interrupt Enable. #define PWM_INTEN_INTFAULT0 0x00010000 // Interrupt Fault 0. #define PWM_INTEN_INTPWM3 0x00000008 // PWM3 Interrupt Enable. #define PWM_INTEN_INTPWM2 0x00000004 // PWM2 Interrupt Enable. #define PWM_INTEN_INTPWM1 0x00000002 // PWM1 Interrupt Enable. #define PWM_INTEN_INTPWM0 0x00000001 // PWM0 Interrupt Enable. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_RIS register. // //***************************************************************************** #define PWM_RIS_INTFAULT3 0x00080000 // Interrupt Fault PWM 3. #define PWM_RIS_INTFAULT2 0x00040000 // Interrupt Fault PWM 2. #define PWM_RIS_INTFAULT1 0x00020000 // Interrupt Fault PWM 1. #define PWM_RIS_INTFAULT0 0x00010000 // Interrupt Fault PWM 0. #define PWM_RIS_INTFAULT 0x00010000 // Fault Interrupt Asserted. #define PWM_RIS_INTPWM3 0x00000008 // PWM3 Interrupt Asserted. #define PWM_RIS_INTPWM2 0x00000004 // PWM2 Interrupt Asserted. #define PWM_RIS_INTPWM1 0x00000002 // PWM1 Interrupt Asserted. #define PWM_RIS_INTPWM0 0x00000001 // PWM0 Interrupt Asserted. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_ISC register. // //***************************************************************************** #define PWM_ISC_INTFAULT3 0x00080000 // FAULT3 Interrupt Asserted. #define PWM_ISC_INTFAULT2 0x00040000 // FAULT2 Interrupt Asserted. #define PWM_ISC_INTFAULT1 0x00020000 // FAULT1 Interrupt Asserted. #define PWM_ISC_INTFAULT 0x00010000 // Fault Interrupt Asserted. #define PWM_ISC_INTFAULT0 0x00010000 // FAULT0 Interrupt Asserted. #define PWM_ISC_INTPWM3 0x00000008 // PWM3 Interrupt Status. #define PWM_ISC_INTPWM2 0x00000004 // PWM2 Interrupt Status. #define PWM_ISC_INTPWM1 0x00000002 // PWM1 Interrupt Status. #define PWM_ISC_INTPWM0 0x00000001 // PWM0 Interrupt Status. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_ISC register. // //***************************************************************************** #define PWM_X_ISC_INTCMPBD 0x00000020 // Comparator B Down Interrupt. #define PWM_X_ISC_INTCMPBU 0x00000010 // Comparator B Up Interrupt. #define PWM_X_ISC_INTCMPAD 0x00000008 // Comparator A Down Interrupt. #define PWM_X_ISC_INTCMPAU 0x00000004 // Comparator A Up Interrupt. #define PWM_X_ISC_INTCNTLOAD 0x00000002 // Counter=Load Interrupt. #define PWM_X_ISC_INTCNTZERO 0x00000001 // Counter=0 Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_LOAD register. // //***************************************************************************** #define PWM_X_LOAD_M 0x0000FFFF // Counter Load Value. #define PWM_X_LOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_COUNT register. // //***************************************************************************** #define PWM_X_COUNT_M 0x0000FFFF // Counter Value. #define PWM_X_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_CMPA register. // //***************************************************************************** #define PWM_X_CMPA_M 0x0000FFFF // Comparator A Value. #define PWM_X_CMPA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_CMPB register. // //***************************************************************************** #define PWM_X_CMPB_M 0x0000FFFF // Comparator B Value. #define PWM_X_CMPB_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_GENA register. // //***************************************************************************** #define PWM_X_GENA_ACTCMPBD_M 0x00000C00 // Action for Comparator B Down. #define PWM_X_GENA_ACTCMPBD_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENA_ACTCMPBD_INV 0x00000400 // Invert the output signal. #define PWM_X_GENA_ACTCMPBD_ZERO \ 0x00000800 // Set the output signal to 0. #define PWM_X_GENA_ACTCMPBD_ONE 0x00000C00 // Set the output signal to 1. #define PWM_X_GENA_ACTCMPBU_M 0x00000300 // Action for Comparator B Up. #define PWM_X_GENA_ACTCMPBU_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENA_ACTCMPBU_INV 0x00000100 // Invert the output signal. #define PWM_X_GENA_ACTCMPBU_ZERO \ 0x00000200 // Set the output signal to 0. #define PWM_X_GENA_ACTCMPBU_ONE 0x00000300 // Set the output signal to 1. #define PWM_X_GENA_ACTCMPAD_M 0x000000C0 // Action for Comparator A Down. #define PWM_X_GENA_ACTCMPAD_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENA_ACTCMPAD_INV 0x00000040 // Invert the output signal. #define PWM_X_GENA_ACTCMPAD_ZERO \ 0x00000080 // Set the output signal to 0. #define PWM_X_GENA_ACTCMPAD_ONE 0x000000C0 // Set the output signal to 1. #define PWM_X_GENA_ACTCMPAU_M 0x00000030 // Action for Comparator A Up. #define PWM_X_GENA_ACTCMPAU_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENA_ACTCMPAU_INV 0x00000010 // Invert the output signal. #define PWM_X_GENA_ACTCMPAU_ZERO \ 0x00000020 // Set the output signal to 0. #define PWM_X_GENA_ACTCMPAU_ONE 0x00000030 // Set the output signal to 1. #define PWM_X_GENA_ACTLOAD_M 0x0000000C // Action for Counter=Load. #define PWM_X_GENA_ACTLOAD_NONE 0x00000000 // Do nothing. #define PWM_X_GENA_ACTLOAD_INV 0x00000004 // Invert the output signal. #define PWM_X_GENA_ACTLOAD_ZERO 0x00000008 // Set the output signal to 0. #define PWM_X_GENA_ACTLOAD_ONE 0x0000000C // Set the output signal to 1. #define PWM_X_GENA_ACTZERO_M 0x00000003 // Action for Counter=0. #define PWM_X_GENA_ACTZERO_NONE 0x00000000 // Do nothing. #define PWM_X_GENA_ACTZERO_INV 0x00000001 // Invert the output signal. #define PWM_X_GENA_ACTZERO_ZERO 0x00000002 // Set the output signal to 0. #define PWM_X_GENA_ACTZERO_ONE 0x00000003 // Set the output signal to 1. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_GENB register. // //***************************************************************************** #define PWM_X_GENB_ACTCMPBD_M 0x00000C00 // Action for Comparator B Down. #define PWM_X_GENB_ACTCMPBD_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENB_ACTCMPBD_INV 0x00000400 // Invert the output signal. #define PWM_X_GENB_ACTCMPBD_ZERO \ 0x00000800 // Set the output signal to 0. #define PWM_X_GENB_ACTCMPBD_ONE 0x00000C00 // Set the output signal to 1. #define PWM_X_GENB_ACTCMPBU_M 0x00000300 // Action for Comparator B Up. #define PWM_X_GENB_ACTCMPBU_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENB_ACTCMPBU_INV 0x00000100 // Invert the output signal. #define PWM_X_GENB_ACTCMPBU_ZERO \ 0x00000200 // Set the output signal to 0. #define PWM_X_GENB_ACTCMPBU_ONE 0x00000300 // Set the output signal to 1. #define PWM_X_GENB_ACTCMPAD_M 0x000000C0 // Action for Comparator A Down. #define PWM_X_GENB_ACTCMPAD_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENB_ACTCMPAD_INV 0x00000040 // Invert the output signal. #define PWM_X_GENB_ACTCMPAD_ZERO \ 0x00000080 // Set the output signal to 0. #define PWM_X_GENB_ACTCMPAD_ONE 0x000000C0 // Set the output signal to 1. #define PWM_X_GENB_ACTCMPAU_M 0x00000030 // Action for Comparator A Up. #define PWM_X_GENB_ACTCMPAU_NONE \ 0x00000000 // Do nothing. #define PWM_X_GENB_ACTCMPAU_INV 0x00000010 // Invert the output signal. #define PWM_X_GENB_ACTCMPAU_ZERO \ 0x00000020 // Set the output signal to 0. #define PWM_X_GENB_ACTCMPAU_ONE 0x00000030 // Set the output signal to 1. #define PWM_X_GENB_ACTLOAD_M 0x0000000C // Action for Counter=Load. #define PWM_X_GENB_ACTLOAD_NONE 0x00000000 // Do nothing. #define PWM_X_GENB_ACTLOAD_INV 0x00000004 // Invert the output signal. #define PWM_X_GENB_ACTLOAD_ZERO 0x00000008 // Set the output signal to 0. #define PWM_X_GENB_ACTLOAD_ONE 0x0000000C // Set the output signal to 1. #define PWM_X_GENB_ACTZERO_M 0x00000003 // Action for Counter=0. #define PWM_X_GENB_ACTZERO_NONE 0x00000000 // Do nothing. #define PWM_X_GENB_ACTZERO_INV 0x00000001 // Invert the output signal. #define PWM_X_GENB_ACTZERO_ZERO 0x00000002 // Set the output signal to 0. #define PWM_X_GENB_ACTZERO_ONE 0x00000003 // Set the output signal to 1. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_DBCTL register. // //***************************************************************************** #define PWM_X_DBCTL_ENABLE 0x00000001 // Dead-Band Generator Enable. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_DBRISE register. // //***************************************************************************** #define PWM_X_DBRISE_DELAY_M 0x00000FFF // Dead-Band Rise Delay. #define PWM_X_DBRISE_DELAY_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_DBFALL register. // //***************************************************************************** #define PWM_X_DBFALL_DELAY_M 0x00000FFF // Dead-Band Fall Delay. #define PWM_X_DBFALL_DELAY_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_FAULTVAL register. // //***************************************************************************** #define PWM_FAULTVAL_PWM7 0x00000080 // PWM7 Fault Value. #define PWM_FAULTVAL_PWM6 0x00000040 // PWM6 Fault Value. #define PWM_FAULTVAL_PWM5 0x00000020 // PWM5 Fault Value. #define PWM_FAULTVAL_PWM4 0x00000010 // PWM4 Fault Value. #define PWM_FAULTVAL_PWM3 0x00000008 // PWM3 Fault Value. #define PWM_FAULTVAL_PWM2 0x00000004 // PWM2 Fault Value. #define PWM_FAULTVAL_PWM1 0x00000002 // PWM1 Fault Value. #define PWM_FAULTVAL_PWM0 0x00000001 // PWM0 Fault Value. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_MINFLTPER // register. // //***************************************************************************** #define PWM_X_MINFLTPER_M 0x0000FFFF // Minimum Fault Period. #define PWM_X_MINFLTPER_S 0 //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_FLTSEN register. // //***************************************************************************** #define PWM_X_FLTSEN_FAULT3 0x00000008 // Fault3 Sense. #define PWM_X_FLTSEN_FAULT2 0x00000004 // Fault2 Sense. #define PWM_X_FLTSEN_FAULT1 0x00000002 // Fault1 Sense. #define PWM_X_FLTSEN_FAULT0 0x00000001 // Fault0 Sense. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_FLTSRC0 // register. // //***************************************************************************** #define PWM_X_FLTSRC0_FAULT3 0x00000008 // Fault3. #define PWM_X_FLTSRC0_FAULT2 0x00000004 // Fault2. #define PWM_X_FLTSRC0_FAULT1 0x00000002 // Fault1. #define PWM_X_FLTSRC0_FAULT0 0x00000001 // Fault0. //***************************************************************************** // // The following are defines for the bit fields in the PWM_O_X_FLTSTAT0 // register. // //***************************************************************************** #define PWM_X_FLTSTAT0_FAULT3 0x00000008 // Fault Input 3. #define PWM_X_FLTSTAT0_FAULT2 0x00000004 // Fault Input 2. #define PWM_X_FLTSTAT0_FAULT1 0x00000002 // Fault Input 1. #define PWM_X_FLTSTAT0_FAULT0 0x00000001 // Fault Input 0. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the bit fields in the PWM Master // Control register. // //***************************************************************************** #define PWM_CTL_GLOBAL_SYNC2 0x00000004 // Global sync generator 2 #define PWM_CTL_GLOBAL_SYNC1 0x00000002 // Global sync generator 1 #define PWM_CTL_GLOBAL_SYNC0 0x00000001 // Global sync generator 0 //***************************************************************************** // // The following are deprecated defines for the PWM Interrupt Register bit // definitions. // //***************************************************************************** #define PWM_INT_INTFAULT 0x00010000 // Fault interrupt pending //***************************************************************************** // // The following are deprecated defines for the bit fields in the PWM Status // register. // //***************************************************************************** #define PWM_STATUS_FAULT 0x00000001 // Fault status //***************************************************************************** // // The following are deprecated defines for the PWM_X Interrupt Status Register // bit definitions. // //***************************************************************************** #define PWM_X_INT_INTCMPBD 0x00000020 // PWM_X_COUNT = PWM_X_CMPB D rcvd #define PWM_X_INT_INTCMPBU 0x00000010 // PWM_X_COUNT = PWM_X_CMPB U rcvd #define PWM_X_INT_INTCMPAD 0x00000008 // PWM_X_COUNT = PWM_X_CMPA D rcvd #define PWM_X_INT_INTCMPAU 0x00000004 // PWM_X_COUNT = PWM_X_CMPA U rcvd #define PWM_X_INT_INTCNTLOAD 0x00000002 // PWM_X_COUNT = PWM_X_LOAD rcvd #define PWM_X_INT_INTCNTZERO 0x00000001 // PWM_X_COUNT = 0 received //***************************************************************************** // // The following are deprecated defines for the PWM_X Generator A/B Control // Register bit definitions. // //***************************************************************************** #define PWM_X_GEN_Y_ACTCMPBD 0x00000C00 // Act PWM_X_COUNT = PWM_X_CMPB D #define PWM_X_GEN_Y_ACTCMPBU 0x00000300 // Act PWM_X_COUNT = PWM_X_CMPB U #define PWM_X_GEN_Y_ACTCMPAD 0x000000C0 // Act PWM_X_COUNT = PWM_X_CMPA D #define PWM_X_GEN_Y_ACTCMPAU 0x00000030 // Act PWM_X_COUNT = PWM_X_CMPA U #define PWM_X_GEN_Y_ACTLOAD 0x0000000C // Act PWM_X_COUNT = PWM_X_LOAD #define PWM_X_GEN_Y_ACTZERO 0x00000003 // Act PWM_X_COUNT = 0 //***************************************************************************** // // The following are deprecated defines for the PWM_X Generator A/B Control // Register action definitions. // //***************************************************************************** #define PWM_GEN_ACT_ONE 0x00000003 // Set the output signal to one #define PWM_GEN_ACT_ZERO 0x00000002 // Set the output signal to zero #define PWM_GEN_ACT_INV 0x00000001 // Invert the output signal #define PWM_GEN_ACT_NONE 0x00000000 // Do nothing #define PWM_GEN_ACT_B_DN_SHIFT 10 // Shift amount for the B dn action #define PWM_GEN_ACT_B_UP_SHIFT 8 // Shift amount for the B up action #define PWM_GEN_ACT_A_DN_SHIFT 6 // Shift amount for the A dn action #define PWM_GEN_ACT_A_UP_SHIFT 4 // Shift amount for the A up action #define PWM_GEN_ACT_LOAD_SHIFT 2 // Shift amount for the load action #define PWM_GEN_ACT_ZERO_SHIFT 0 // Shift amount for the zero action //***************************************************************************** // // The following are deprecated defines for the PWM_X Dead Band Control // Register bit definitions. // //***************************************************************************** #define PWM_DBCTL_ENABLE 0x00000001 // Enable dead band insertion //***************************************************************************** // // The following are deprecated defines for the PWM Register reset values. // //***************************************************************************** #define PWM_RV_X_DBCTL 0x00000000 // Control the dead band generator #define PWM_RV_STATUS 0x00000000 // Status #define PWM_RV_X_ISC 0x00000000 // Interrupt status and clearing #define PWM_RV_X_RIS 0x00000000 // Raw interrupt status #define PWM_RV_X_CTL 0x00000000 // Master control of the PWM // generator block #define PWM_RV_SYNC 0x00000000 // Counter synch for PWM generators #define PWM_RV_X_DBFALL 0x00000000 // The dead band falling edge delay // count #define PWM_RV_X_INTEN 0x00000000 // Interrupt and trigger enable #define PWM_RV_X_LOAD 0x00000000 // The load value for the counter #define PWM_RV_X_GENA 0x00000000 // Controls PWM generator A #define PWM_RV_CTL 0x00000000 // Master control of the PWM module #define PWM_RV_FAULT 0x00000000 // Fault handling for the PWM // output pins #define PWM_RV_RIS 0x00000000 // Raw interrupt status #define PWM_RV_X_CMPA 0x00000000 // The comparator A value #define PWM_RV_INVERT 0x00000000 // Inversion control for PWM output // pins #define PWM_RV_X_DBRISE 0x00000000 // The dead band rising edge delay // count #define PWM_RV_ENABLE 0x00000000 // Master enable for the PWM output // pins #define PWM_RV_X_GENB 0x00000000 // Controls PWM generator B #define PWM_RV_X_CMPB 0x00000000 // The comparator B value #define PWM_RV_ISC 0x00000000 // Interrupt status and clearing #define PWM_RV_INTEN 0x00000000 // Interrupt enable #define PWM_RV_X_COUNT 0x00000000 // The current counter value #endif #endif // __HW_PWM_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_pwm.h
C
oos
38,243
//***************************************************************************** // // hw_qei.h - Macros used when accessing the QEI hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_QEI_H__ #define __HW_QEI_H__ //***************************************************************************** // // The following are defines for the QEI register offsets. // //***************************************************************************** #define QEI_O_CTL 0x00000000 // Configuration and control reg. #define QEI_O_STAT 0x00000004 // Status register #define QEI_O_POS 0x00000008 // Current position register #define QEI_O_MAXPOS 0x0000000C // Maximum position register #define QEI_O_LOAD 0x00000010 // Velocity timer load register #define QEI_O_TIME 0x00000014 // Velocity timer register #define QEI_O_COUNT 0x00000018 // Velocity pulse count register #define QEI_O_SPEED 0x0000001C // Velocity speed register #define QEI_O_INTEN 0x00000020 // Interrupt enable register #define QEI_O_RIS 0x00000024 // Raw interrupt status register #define QEI_O_ISC 0x00000028 // Interrupt status register //***************************************************************************** // // The following are defines for the bit fields in the QEI_CTL register. // //***************************************************************************** #define QEI_CTL_STALLEN 0x00001000 // Stall enable #define QEI_CTL_INVI 0x00000800 // Invert Index input #define QEI_CTL_INVB 0x00000400 // Invert PhB input #define QEI_CTL_INVA 0x00000200 // Invert PhA input #define QEI_CTL_VELDIV_M 0x000001C0 // Velocity predivider mask #define QEI_CTL_VELDIV_1 0x00000000 // Predivide by 1 #define QEI_CTL_VELDIV_2 0x00000040 // Predivide by 2 #define QEI_CTL_VELDIV_4 0x00000080 // Predivide by 4 #define QEI_CTL_VELDIV_8 0x000000C0 // Predivide by 8 #define QEI_CTL_VELDIV_16 0x00000100 // Predivide by 16 #define QEI_CTL_VELDIV_32 0x00000140 // Predivide by 32 #define QEI_CTL_VELDIV_64 0x00000180 // Predivide by 64 #define QEI_CTL_VELDIV_128 0x000001C0 // Predivide by 128 #define QEI_CTL_VELEN 0x00000020 // Velocity enable #define QEI_CTL_RESMODE 0x00000010 // Position counter reset mode #define QEI_CTL_CAPMODE 0x00000008 // Edge capture mode #define QEI_CTL_SIGMODE 0x00000004 // Encoder signaling mode #define QEI_CTL_SWAP 0x00000002 // Swap input signals #define QEI_CTL_ENABLE 0x00000001 // QEI enable //***************************************************************************** // // The following are defines for the bit fields in the QEI_STAT register. // //***************************************************************************** #define QEI_STAT_DIRECTION 0x00000002 // Direction of rotation #define QEI_STAT_ERROR 0x00000001 // Signalling error detected //***************************************************************************** // // The following are defines for the bit fields in the QEI_POS register. // //***************************************************************************** #define QEI_POS_M 0xFFFFFFFF // Current encoder position #define QEI_POS_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_MAXPOS register. // //***************************************************************************** #define QEI_MAXPOS_M 0xFFFFFFFF // Maximum encoder position #define QEI_MAXPOS_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_LOAD register. // //***************************************************************************** #define QEI_LOAD_M 0xFFFFFFFF // Velocity timer load value #define QEI_LOAD_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_TIME register. // //***************************************************************************** #define QEI_TIME_M 0xFFFFFFFF // Velocity timer current value #define QEI_TIME_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_COUNT register. // //***************************************************************************** #define QEI_COUNT_M 0xFFFFFFFF // Encoder running pulse count #define QEI_COUNT_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_SPEED register. // //***************************************************************************** #define QEI_SPEED_M 0xFFFFFFFF // Encoder pulse count #define QEI_SPEED_S 0 //***************************************************************************** // // The following are defines for the bit fields in the QEI_INTEN register. // //***************************************************************************** #define QEI_INTEN_ERROR 0x00000008 // Phase error detected #define QEI_INTEN_DIR 0x00000004 // Direction change #define QEI_INTEN_TIMER 0x00000002 // Velocity timer expired #define QEI_INTEN_INDEX 0x00000001 // Index pulse detected //***************************************************************************** // // The following are defines for the bit fields in the QEI_RIS register. // //***************************************************************************** #define QEI_RIS_ERROR 0x00000008 // Phase error detected #define QEI_RIS_DIR 0x00000004 // Direction change #define QEI_RIS_TIMER 0x00000002 // Velocity timer expired #define QEI_RIS_INDEX 0x00000001 // Index pulse detected //***************************************************************************** // // The following are defines for the bit fields in the QEI_O_ISC register. // //***************************************************************************** #define QEI_ISC_ERROR 0x00000008 // Phase Error Interrupt. #define QEI_ISC_DIR 0x00000004 // Direction Change Interrupt. #define QEI_ISC_TIMER 0x00000002 // Velocity Timer Expired // Interrupt. #define QEI_ISC_INDEX 0x00000001 // Index Pulse Interrupt. //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the bit fields in the QEI_ISC // register. // //***************************************************************************** #define QEI_INT_ERROR 0x00000008 // Phase error detected #define QEI_INT_DIR 0x00000004 // Direction change #define QEI_INT_TIMER 0x00000002 // Velocity timer expired #define QEI_INT_INDEX 0x00000001 // Index pulse detected //***************************************************************************** // // The following are deprecated defines for the reset values for the QEI // registers. // //***************************************************************************** #define QEI_RV_POS 0x00000000 // Current position register #define QEI_RV_LOAD 0x00000000 // Velocity timer load register #define QEI_RV_CTL 0x00000000 // Configuration and control reg. #define QEI_RV_RIS 0x00000000 // Raw interrupt status register #define QEI_RV_ISC 0x00000000 // Interrupt status register #define QEI_RV_SPEED 0x00000000 // Velocity speed register #define QEI_RV_INTEN 0x00000000 // Interrupt enable register #define QEI_RV_STAT 0x00000000 // Status register #define QEI_RV_COUNT 0x00000000 // Velocity pulse count register #define QEI_RV_MAXPOS 0x00000000 // Maximum position register #define QEI_RV_TIME 0x00000000 // Velocity timer register #endif #endif // __HW_QEI_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_qei.h
C
oos
10,029
//***************************************************************************** // // hw_timer.h - Defines and macros used when accessing the timer. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_TIMER_H__ #define __HW_TIMER_H__ //***************************************************************************** // // The following are defines for the timer register offsets. // //***************************************************************************** #define TIMER_O_CFG 0x00000000 // Configuration register #define TIMER_O_TAMR 0x00000004 // TimerA mode register #define TIMER_O_TBMR 0x00000008 // TimerB mode register #define TIMER_O_CTL 0x0000000C // Control register #define TIMER_O_IMR 0x00000018 // Interrupt mask register #define TIMER_O_RIS 0x0000001C // Interrupt status register #define TIMER_O_MIS 0x00000020 // Masked interrupt status reg. #define TIMER_O_ICR 0x00000024 // Interrupt clear register #define TIMER_O_TAILR 0x00000028 // TimerA interval load register #define TIMER_O_TBILR 0x0000002C // TimerB interval load register #define TIMER_O_TAMATCHR 0x00000030 // TimerA match register #define TIMER_O_TBMATCHR 0x00000034 // TimerB match register #define TIMER_O_TAPR 0x00000038 // TimerA prescale register #define TIMER_O_TBPR 0x0000003C // TimerB prescale register #define TIMER_O_TAPMR 0x00000040 // TimerA prescale match register #define TIMER_O_TBPMR 0x00000044 // TimerB prescale match register #define TIMER_O_TAR 0x00000048 // TimerA register #define TIMER_O_TBR 0x0000004C // TimerB register //***************************************************************************** // // The following are defines for the bit fields in the TIMER_CFG register. // //***************************************************************************** #define TIMER_CFG_M 0x00000007 // GPTM Configuration. #define TIMER_CFG_16_BIT 0x00000004 // Two 16 bit timers #define TIMER_CFG_32_BIT_RTC 0x00000001 // 32 bit RTC #define TIMER_CFG_32_BIT_TIMER 0x00000000 // 32 bit timer //***************************************************************************** // // The following are defines for the bit fields in the TIMER_CTL register. // //***************************************************************************** #define TIMER_CTL_TBPWML 0x00004000 // TimerB PWM output level invert #define TIMER_CTL_TBOTE 0x00002000 // TimerB output trigger enable #define TIMER_CTL_TBEVENT_POS 0x00000000 // TimerB event mode - pos edge #define TIMER_CTL_TBEVENT_NEG 0x00000400 // TimerB event mode - neg edge #define TIMER_CTL_TBEVENT_BOTH 0x00000C00 // TimerB event mode - both edges #define TIMER_CTL_TBEVENT_M 0x00000C00 // GPTM TimerB Event Mode. #define TIMER_CTL_TBSTALL 0x00000200 // TimerB stall enable #define TIMER_CTL_TBEN 0x00000100 // TimerB enable #define TIMER_CTL_TAPWML 0x00000040 // TimerA PWM output level invert #define TIMER_CTL_TAOTE 0x00000020 // TimerA output trigger enable #define TIMER_CTL_RTCEN 0x00000010 // RTC counter enable #define TIMER_CTL_TAEVENT_M 0x0000000C // GPTM TimerA Event Mode. #define TIMER_CTL_TAEVENT_POS 0x00000000 // TimerA event mode - pos edge #define TIMER_CTL_TAEVENT_NEG 0x00000004 // TimerA event mode - neg edge #define TIMER_CTL_TAEVENT_BOTH 0x0000000C // TimerA event mode - both edges #define TIMER_CTL_TASTALL 0x00000002 // TimerA stall enable #define TIMER_CTL_TAEN 0x00000001 // TimerA enable //***************************************************************************** // // The following are defines for the bit fields in the TIMER_IMR register. // //***************************************************************************** #define TIMER_IMR_CBEIM 0x00000400 // CaptureB event interrupt mask #define TIMER_IMR_CBMIM 0x00000200 // CaptureB match interrupt mask #define TIMER_IMR_TBTOIM 0x00000100 // TimerB time out interrupt mask #define TIMER_IMR_RTCIM 0x00000008 // RTC interrupt mask #define TIMER_IMR_CAEIM 0x00000004 // CaptureA event interrupt mask #define TIMER_IMR_CAMIM 0x00000002 // CaptureA match interrupt mask #define TIMER_IMR_TATOIM 0x00000001 // TimerA time out interrupt mask //***************************************************************************** // // The following are defines for the bit fields in the TIMER_RIS register. // //***************************************************************************** #define TIMER_RIS_CBERIS 0x00000400 // CaptureB event raw int status #define TIMER_RIS_CBMRIS 0x00000200 // CaptureB match raw int status #define TIMER_RIS_TBTORIS 0x00000100 // TimerB time out raw int status #define TIMER_RIS_RTCRIS 0x00000008 // RTC raw int status #define TIMER_RIS_CAERIS 0x00000004 // CaptureA event raw int status #define TIMER_RIS_CAMRIS 0x00000002 // CaptureA match raw int status #define TIMER_RIS_TATORIS 0x00000001 // TimerA time out raw int status //***************************************************************************** // // The following are defines for the bit fields in the TIMER_ICR register. // //***************************************************************************** #define TIMER_ICR_CBECINT 0x00000400 // CaptureB event interrupt clear #define TIMER_ICR_CBMCINT 0x00000200 // CaptureB match interrupt clear #define TIMER_ICR_TBTOCINT 0x00000100 // TimerB time out interrupt clear #define TIMER_ICR_RTCCINT 0x00000008 // RTC interrupt clear #define TIMER_ICR_CAECINT 0x00000004 // CaptureA event interrupt clear #define TIMER_ICR_CAMCINT 0x00000002 // CaptureA match interrupt clear #define TIMER_ICR_TATOCINT 0x00000001 // TimerA time out interrupt clear //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TAILR register. // //***************************************************************************** #define TIMER_TAILR_TAILRH_M 0xFFFF0000 // GPTM TimerA Interval Load // Register High. #define TIMER_TAILR_TAILRL_M 0x0000FFFF // GPTM TimerA Interval Load // Register Low. #define TIMER_TAILR_TAILRH_S 16 #define TIMER_TAILR_TAILRL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TBILR register. // //***************************************************************************** #define TIMER_TBILR_TBILRL_M 0x0000FFFF // GPTM TimerB Interval Load // Register. #define TIMER_TBILR_TBILRL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TAMATCHR register. // //***************************************************************************** #define TIMER_TAMATCHR_TAMRH_M 0xFFFF0000 // GPTM TimerA Match Register High. #define TIMER_TAMATCHR_TAMRL_M 0x0000FFFF // GPTM TimerA Match Register Low. #define TIMER_TAMATCHR_TAMRH_S 16 #define TIMER_TAMATCHR_TAMRL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TBMATCHR register. // //***************************************************************************** #define TIMER_TBMATCHR_TBMRL_M 0x0000FFFF // GPTM TimerB Match Register Low. #define TIMER_TBMATCHR_TBMRL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TAR register. // //***************************************************************************** #define TIMER_TAR_TARH_M 0xFFFF0000 // GPTM TimerA Register High. #define TIMER_TAR_TARL_M 0x0000FFFF // GPTM TimerA Register Low. #define TIMER_TAR_TARH_S 16 #define TIMER_TAR_TARL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_TBR register. // //***************************************************************************** #define TIMER_TBR_TBRL_M 0x0000FFFF // GPTM TimerB. #define TIMER_TBR_TBRL_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TAMR register. // //***************************************************************************** #define TIMER_TAMR_TAAMS 0x00000008 // GPTM TimerA Alternate Mode // Select. #define TIMER_TAMR_TACMR 0x00000004 // GPTM TimerA Capture Mode. #define TIMER_TAMR_TAMR_M 0x00000003 // GPTM TimerA Mode. #define TIMER_TAMR_TAMR_1_SHOT 0x00000001 // One-Shot Timer mode. #define TIMER_TAMR_TAMR_PERIOD 0x00000002 // Periodic Timer mode. #define TIMER_TAMR_TAMR_CAP 0x00000003 // Capture mode. //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TBMR register. // //***************************************************************************** #define TIMER_TBMR_TBAMS 0x00000008 // GPTM TimerB Alternate Mode // Select. #define TIMER_TBMR_TBCMR 0x00000004 // GPTM TimerB Capture Mode. #define TIMER_TBMR_TBMR_M 0x00000003 // GPTM TimerB Mode. #define TIMER_TBMR_TBMR_1_SHOT 0x00000001 // One-Shot Timer mode. #define TIMER_TBMR_TBMR_PERIOD 0x00000002 // Periodic Timer mode. #define TIMER_TBMR_TBMR_CAP 0x00000003 // Capture mode. //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_MIS register. // //***************************************************************************** #define TIMER_MIS_CBEMIS 0x00000400 // GPTM CaptureB Event Masked // Interrupt. #define TIMER_MIS_CBMMIS 0x00000200 // GPTM CaptureB Match Masked // Interrupt. #define TIMER_MIS_TBTOMIS 0x00000100 // GPTM TimerB Time-Out Masked // Interrupt. #define TIMER_MIS_RTCMIS 0x00000008 // GPTM RTC Masked Interrupt. #define TIMER_MIS_CAEMIS 0x00000004 // GPTM CaptureA Event Masked // Interrupt. #define TIMER_MIS_CAMMIS 0x00000002 // GPTM CaptureA Match Masked // Interrupt. #define TIMER_MIS_TATOMIS 0x00000001 // GPTM TimerA Time-Out Masked // Interrupt. //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TAPR register. // //***************************************************************************** #define TIMER_TAPR_TAPSR_M 0x000000FF // GPTM TimerA Prescale. #define TIMER_TAPR_TAPSR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TBPR register. // //***************************************************************************** #define TIMER_TBPR_TBPSR_M 0x000000FF // GPTM TimerB Prescale. #define TIMER_TBPR_TBPSR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TAPMR register. // //***************************************************************************** #define TIMER_TAPMR_TAPSMR_M 0x000000FF // GPTM TimerA Prescale Match. #define TIMER_TAPMR_TAPSMR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the TIMER_O_TBPMR register. // //***************************************************************************** #define TIMER_TBPMR_TBPSMR_M 0x000000FF // GPTM TimerB Prescale Match. #define TIMER_TBPMR_TBPSMR_S 0 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the reset values of the timer // registers. // //***************************************************************************** #define TIMER_RV_TAILR 0xFFFFFFFF // TimerA interval load reg RV #define TIMER_RV_TAR 0xFFFFFFFF // TimerA register RV #define TIMER_RV_TAMATCHR 0xFFFFFFFF // TimerA match register RV #define TIMER_RV_TBILR 0x0000FFFF // TimerB interval load reg RV #define TIMER_RV_TBMATCHR 0x0000FFFF // TimerB match register RV #define TIMER_RV_TBR 0x0000FFFF // TimerB register RV #define TIMER_RV_TAPR 0x00000000 // TimerA prescale register RV #define TIMER_RV_CFG 0x00000000 // Configuration register RV #define TIMER_RV_TBPMR 0x00000000 // TimerB prescale match regi RV #define TIMER_RV_TAPMR 0x00000000 // TimerA prescale match reg RV #define TIMER_RV_CTL 0x00000000 // Control register RV #define TIMER_RV_ICR 0x00000000 // Interrupt clear register RV #define TIMER_RV_TBMR 0x00000000 // TimerB mode register RV #define TIMER_RV_MIS 0x00000000 // Masked interrupt status reg RV #define TIMER_RV_RIS 0x00000000 // Interrupt status register RV #define TIMER_RV_TBPR 0x00000000 // TimerB prescale register RV #define TIMER_RV_IMR 0x00000000 // Interrupt mask register RV #define TIMER_RV_TAMR 0x00000000 // TimerA mode register RV //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_CFG // register. // //***************************************************************************** #define TIMER_CFG_CFG_MSK 0x00000007 // Configuration options mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TnMR // register. // //***************************************************************************** #define TIMER_TNMR_TNAMS 0x00000008 // Alternate mode select #define TIMER_TNMR_TNCMR 0x00000004 // Capture mode - count or time #define TIMER_TNMR_TNTMR_MSK 0x00000003 // Timer mode mask #define TIMER_TNMR_TNTMR_1_SHOT 0x00000001 // Mode - one shot #define TIMER_TNMR_TNTMR_PERIOD 0x00000002 // Mode - periodic #define TIMER_TNMR_TNTMR_CAP 0x00000003 // Mode - capture //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_CTL // register. // //***************************************************************************** #define TIMER_CTL_TBEVENT_MSK 0x00000C00 // TimerB event mode mask #define TIMER_CTL_TAEVENT_MSK 0x0000000C // TimerA event mode mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_MIS // register. // //***************************************************************************** #define TIMER_RIS_CBEMIS 0x00000400 // CaptureB event masked int status #define TIMER_RIS_CBMMIS 0x00000200 // CaptureB match masked int status #define TIMER_RIS_TBTOMIS 0x00000100 // TimerB time out masked int stat #define TIMER_RIS_RTCMIS 0x00000008 // RTC masked int status #define TIMER_RIS_CAEMIS 0x00000004 // CaptureA event masked int status #define TIMER_RIS_CAMMIS 0x00000002 // CaptureA match masked int status #define TIMER_RIS_TATOMIS 0x00000001 // TimerA time out masked int stat //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TAILR // register. // //***************************************************************************** #define TIMER_TAILR_TAILRH 0xFFFF0000 // TimerB load val in 32 bit mode #define TIMER_TAILR_TAILRL 0x0000FFFF // TimerA interval load value //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TBILR // register. // //***************************************************************************** #define TIMER_TBILR_TBILRL 0x0000FFFF // TimerB interval load value //***************************************************************************** // // The following are deprecated defines for the bit fields in the // TIMER_TAMATCHR register. // //***************************************************************************** #define TIMER_TAMATCHR_TAMRH 0xFFFF0000 // TimerB match val in 32 bit mode #define TIMER_TAMATCHR_TAMRL 0x0000FFFF // TimerA match value //***************************************************************************** // // The following are deprecated defines for the bit fields in the // TIMER_TBMATCHR register. // //***************************************************************************** #define TIMER_TBMATCHR_TBMRL 0x0000FFFF // TimerB match load value //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TnPR // register. // //***************************************************************************** #define TIMER_TNPR_TNPSR 0x000000FF // TimerN prescale value //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TnPMR // register. // //***************************************************************************** #define TIMER_TNPMR_TNPSMR 0x000000FF // TimerN prescale match value //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TAR // register. // //***************************************************************************** #define TIMER_TAR_TARH 0xFFFF0000 // TimerB val in 32 bit mode #define TIMER_TAR_TARL 0x0000FFFF // TimerA value //***************************************************************************** // // The following are deprecated defines for the bit fields in the TIMER_TBR // register. // //***************************************************************************** #define TIMER_TBR_TBRL 0x0000FFFF // TimerB value #endif #endif // __HW_TIMER_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_timer.h
C
oos
21,041
//***************************************************************************** // // hw_adc.h - Macros used when accessing the ADC hardware. // // Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved. // // Software License Agreement // // Luminary Micro, Inc. (LMI) is supplying this software for use solely and // exclusively on LMI's microcontroller products. // // The software is owned by LMI and/or its suppliers, and is protected under // applicable copyright laws. All rights are reserved. You may not combine // this software with "viral" open-source software in order to form a larger // program. Any use in violation of the foregoing restrictions may subject // the user to criminal sanctions under applicable laws, as well as to civil // liability for the breach of the terms and conditions of this license. // // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 2523 of the Stellaris Peripheral Driver Library. // //***************************************************************************** #ifndef __HW_ADC_H__ #define __HW_ADC_H__ //***************************************************************************** // // The following are defines for the ADC register offsets. // //***************************************************************************** #define ADC_O_ACTSS 0x00000000 // Active sample register #define ADC_O_RIS 0x00000004 // Raw interrupt status register #define ADC_O_IM 0x00000008 // Interrupt mask register #define ADC_O_ISC 0x0000000C // Interrupt status/clear register #define ADC_O_OSTAT 0x00000010 // Overflow status register #define ADC_O_EMUX 0x00000014 // Event multiplexer select reg. #define ADC_O_USTAT 0x00000018 // Underflow status register #define ADC_O_SSPRI 0x00000020 // Channel priority register #define ADC_O_PSSI 0x00000028 // Processor sample initiate reg. #define ADC_O_SAC 0x00000030 // Sample Averaging Control reg. #define ADC_O_SSMUX0 0x00000040 // Multiplexer select 0 register #define ADC_O_SSCTL0 0x00000044 // Sample sequence control 0 reg. #define ADC_O_SSFIFO0 0x00000048 // Result FIFO 0 register #define ADC_O_SSFSTAT0 0x0000004C // FIFO 0 status register #define ADC_O_SSMUX1 0x00000060 // Multiplexer select 1 register #define ADC_O_SSCTL1 0x00000064 // Sample sequence control 1 reg. #define ADC_O_SSFIFO1 0x00000068 // Result FIFO 1 register #define ADC_O_SSFSTAT1 0x0000006C // FIFO 1 status register #define ADC_O_SSMUX2 0x00000080 // Multiplexer select 2 register #define ADC_O_SSCTL2 0x00000084 // Sample sequence control 2 reg. #define ADC_O_SSFIFO2 0x00000088 // Result FIFO 2 register #define ADC_O_SSFSTAT2 0x0000008C // FIFO 2 status register #define ADC_O_SSMUX3 0x000000A0 // Multiplexer select 3 register #define ADC_O_SSCTL3 0x000000A4 // Sample sequence control 3 reg. #define ADC_O_SSFIFO3 0x000000A8 // Result FIFO 3 register #define ADC_O_SSFSTAT3 0x000000AC // FIFO 3 status register #define ADC_O_TMLB 0x00000100 // Test mode loopback register //***************************************************************************** // // The following are defines for the bit fields in the ADC_ACTSS register. // //***************************************************************************** #define ADC_ACTSS_ASEN3 0x00000008 // Sample sequence 3 enable #define ADC_ACTSS_ASEN2 0x00000004 // Sample sequence 2 enable #define ADC_ACTSS_ASEN1 0x00000002 // Sample sequence 1 enable #define ADC_ACTSS_ASEN0 0x00000001 // Sample sequence 0 enable //***************************************************************************** // // The following are defines for the bit fields in the ADC_RIS register. // //***************************************************************************** #define ADC_RIS_INR3 0x00000008 // Sample sequence 3 interrupt #define ADC_RIS_INR2 0x00000004 // Sample sequence 2 interrupt #define ADC_RIS_INR1 0x00000002 // Sample sequence 1 interrupt #define ADC_RIS_INR0 0x00000001 // Sample sequence 0 interrupt //***************************************************************************** // // The following are defines for the bit fields in the ADC_IM register. // //***************************************************************************** #define ADC_IM_MASK3 0x00000008 // Sample sequence 3 mask #define ADC_IM_MASK2 0x00000004 // Sample sequence 2 mask #define ADC_IM_MASK1 0x00000002 // Sample sequence 1 mask #define ADC_IM_MASK0 0x00000001 // Sample sequence 0 mask //***************************************************************************** // // The following are defines for the bit fields in the ADC_ISC register. // //***************************************************************************** #define ADC_ISC_IN3 0x00000008 // Sample sequence 3 interrupt #define ADC_ISC_IN2 0x00000004 // Sample sequence 2 interrupt #define ADC_ISC_IN1 0x00000002 // Sample sequence 1 interrupt #define ADC_ISC_IN0 0x00000001 // Sample sequence 0 interrupt //***************************************************************************** // // The following are defines for the bit fields in the ADC_OSTAT register. // //***************************************************************************** #define ADC_OSTAT_OV3 0x00000008 // Sample sequence 3 overflow #define ADC_OSTAT_OV2 0x00000004 // Sample sequence 2 overflow #define ADC_OSTAT_OV1 0x00000002 // Sample sequence 1 overflow #define ADC_OSTAT_OV0 0x00000001 // Sample sequence 0 overflow //***************************************************************************** // // The following are defines for the bit fields in the ADC_EMUX register. // //***************************************************************************** #define ADC_EMUX_EM3_M 0x0000F000 // Event mux 3 mask #define ADC_EMUX_EM3_PROCESSOR 0x00000000 // Processor event #define ADC_EMUX_EM3_COMP0 0x00001000 // Analog comparator 0 event #define ADC_EMUX_EM3_COMP1 0x00002000 // Analog comparator 1 event #define ADC_EMUX_EM3_COMP2 0x00003000 // Analog comparator 2 event #define ADC_EMUX_EM3_EXTERNAL 0x00004000 // External event #define ADC_EMUX_EM3_TIMER 0x00005000 // Timer event #define ADC_EMUX_EM3_PWM0 0x00006000 // PWM0 event #define ADC_EMUX_EM3_PWM1 0x00007000 // PWM1 event #define ADC_EMUX_EM3_PWM2 0x00008000 // PWM2 event #define ADC_EMUX_EM3_ALWAYS 0x0000F000 // Always event #define ADC_EMUX_EM2_M 0x00000F00 // Event mux 2 mask #define ADC_EMUX_EM2_PROCESSOR 0x00000000 // Processor event #define ADC_EMUX_EM2_COMP0 0x00000100 // Analog comparator 0 event #define ADC_EMUX_EM2_COMP1 0x00000200 // Analog comparator 1 event #define ADC_EMUX_EM2_COMP2 0x00000300 // Analog comparator 2 event #define ADC_EMUX_EM2_EXTERNAL 0x00000400 // External event #define ADC_EMUX_EM2_TIMER 0x00000500 // Timer event #define ADC_EMUX_EM2_PWM0 0x00000600 // PWM0 event #define ADC_EMUX_EM2_PWM1 0x00000700 // PWM1 event #define ADC_EMUX_EM2_PWM2 0x00000800 // PWM2 event #define ADC_EMUX_EM2_ALWAYS 0x00000F00 // Always event #define ADC_EMUX_EM1_M 0x000000F0 // Event mux 1 mask #define ADC_EMUX_EM1_PROCESSOR 0x00000000 // Processor event #define ADC_EMUX_EM1_COMP0 0x00000010 // Analog comparator 0 event #define ADC_EMUX_EM1_COMP1 0x00000020 // Analog comparator 1 event #define ADC_EMUX_EM1_COMP2 0x00000030 // Analog comparator 2 event #define ADC_EMUX_EM1_EXTERNAL 0x00000040 // External event #define ADC_EMUX_EM1_TIMER 0x00000050 // Timer event #define ADC_EMUX_EM1_PWM0 0x00000060 // PWM0 event #define ADC_EMUX_EM1_PWM1 0x00000070 // PWM1 event #define ADC_EMUX_EM1_PWM2 0x00000080 // PWM2 event #define ADC_EMUX_EM1_ALWAYS 0x000000F0 // Always event #define ADC_EMUX_EM0_M 0x0000000F // Event mux 0 mask #define ADC_EMUX_EM0_PROCESSOR 0x00000000 // Processor event #define ADC_EMUX_EM0_COMP0 0x00000001 // Analog comparator 0 event #define ADC_EMUX_EM0_COMP1 0x00000002 // Analog comparator 1 event #define ADC_EMUX_EM0_COMP2 0x00000003 // Analog comparator 2 event #define ADC_EMUX_EM0_EXTERNAL 0x00000004 // External event #define ADC_EMUX_EM0_TIMER 0x00000005 // Timer event #define ADC_EMUX_EM0_PWM0 0x00000006 // PWM0 event #define ADC_EMUX_EM0_PWM1 0x00000007 // PWM1 event #define ADC_EMUX_EM0_PWM2 0x00000008 // PWM2 event #define ADC_EMUX_EM0_ALWAYS 0x0000000F // Always event //***************************************************************************** // // The following are defines for the bit fields in the ADC_USTAT register. // //***************************************************************************** #define ADC_USTAT_UV3 0x00000008 // Sample sequence 3 underflow #define ADC_USTAT_UV2 0x00000004 // Sample sequence 2 underflow #define ADC_USTAT_UV1 0x00000002 // Sample sequence 1 underflow #define ADC_USTAT_UV0 0x00000001 // Sample sequence 0 underflow //***************************************************************************** // // The following are defines for the bit fields in the ADC_SSPRI register. // //***************************************************************************** #define ADC_SSPRI_SS3_M 0x00003000 // Sequencer 3 priority mask #define ADC_SSPRI_SS3_1ST 0x00000000 // First priority #define ADC_SSPRI_SS3_2ND 0x00001000 // Second priority #define ADC_SSPRI_SS3_3RD 0x00002000 // Third priority #define ADC_SSPRI_SS3_4TH 0x00003000 // Fourth priority #define ADC_SSPRI_SS2_M 0x00000300 // Sequencer 2 priority mask #define ADC_SSPRI_SS2_1ST 0x00000000 // First priority #define ADC_SSPRI_SS2_2ND 0x00000100 // Second priority #define ADC_SSPRI_SS2_3RD 0x00000200 // Third priority #define ADC_SSPRI_SS2_4TH 0x00000300 // Fourth priority #define ADC_SSPRI_SS1_M 0x00000030 // Sequencer 1 priority mask #define ADC_SSPRI_SS1_1ST 0x00000000 // First priority #define ADC_SSPRI_SS1_2ND 0x00000010 // Second priority #define ADC_SSPRI_SS1_3RD 0x00000020 // Third priority #define ADC_SSPRI_SS1_4TH 0x00000030 // Fourth priority #define ADC_SSPRI_SS0_M 0x00000003 // Sequencer 0 priority mask #define ADC_SSPRI_SS0_1ST 0x00000000 // First priority #define ADC_SSPRI_SS0_2ND 0x00000001 // Second priority #define ADC_SSPRI_SS0_3RD 0x00000002 // Third priority #define ADC_SSPRI_SS0_4TH 0x00000003 // Fourth priority //***************************************************************************** // // The following are defines for the bit fields in the ADC_PSSI register. // //***************************************************************************** #define ADC_PSSI_SS3 0x00000008 // Trigger sample sequencer 3 #define ADC_PSSI_SS2 0x00000004 // Trigger sample sequencer 2 #define ADC_PSSI_SS1 0x00000002 // Trigger sample sequencer 1 #define ADC_PSSI_SS0 0x00000001 // Trigger sample sequencer 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_SAC register. // //***************************************************************************** #define ADC_SAC_AVG_M 0x00000007 // Hardware Averaging Control. #define ADC_SAC_AVG_64X 0x00000006 // 64x hardware oversampling #define ADC_SAC_AVG_32X 0x00000005 // 32x hardware oversampling #define ADC_SAC_AVG_16X 0x00000004 // 16x hardware oversampling #define ADC_SAC_AVG_8X 0x00000003 // 8x hardware oversampling #define ADC_SAC_AVG_4X 0x00000002 // 4x hardware oversampling #define ADC_SAC_AVG_2X 0x00000001 // 2x hardware oversampling #define ADC_SAC_AVG_OFF 0x00000000 // No hardware oversampling //***************************************************************************** // // The following are defines for the bit fields in the ADC_TMLB register. // //***************************************************************************** #define ADC_TMLB_CNT_M 0x000003C0 // Continuous Sample Counter. #define ADC_TMLB_CONT 0x00000020 // Continuation Sample Indicator. #define ADC_TMLB_DIFF 0x00000010 // Differential Sample Indicator. #define ADC_TMLB_TS 0x00000008 // Temp Sensor Sample Indicator. #define ADC_TMLB_MUX_M 0x00000007 // Analog Input Indicator. #define ADC_TMLB_LB 0x00000001 // Loopback control signals #define ADC_TMLB_CNT_S 6 // Sample counter shift #define ADC_TMLB_MUX_S 0 // Input channel number shift //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSMUX0 register. // //***************************************************************************** #define ADC_SSMUX0_MUX7_M 0x70000000 // 8th Sample Input Select. #define ADC_SSMUX0_MUX6_M 0x07000000 // 7th Sample Input Select. #define ADC_SSMUX0_MUX5_M 0x00700000 // 6th Sample Input Select. #define ADC_SSMUX0_MUX4_M 0x00070000 // 5th Sample Input Select. #define ADC_SSMUX0_MUX3_M 0x00007000 // 4th Sample Input Select. #define ADC_SSMUX0_MUX2_M 0x00000700 // 3rd Sample Input Select. #define ADC_SSMUX0_MUX1_M 0x00000070 // 2nd Sample Input Select. #define ADC_SSMUX0_MUX0_M 0x00000007 // 1st Sample Input Select. #define ADC_SSMUX0_MUX7_S 28 #define ADC_SSMUX0_MUX6_S 24 #define ADC_SSMUX0_MUX5_S 20 #define ADC_SSMUX0_MUX4_S 16 #define ADC_SSMUX0_MUX3_S 12 #define ADC_SSMUX0_MUX2_S 8 #define ADC_SSMUX0_MUX1_S 4 #define ADC_SSMUX0_MUX0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSCTL0 register. // //***************************************************************************** #define ADC_SSCTL0_TS7 0x80000000 // 8th Sample Temp Sensor Select. #define ADC_SSCTL0_IE7 0x40000000 // 8th Sample Interrupt Enable. #define ADC_SSCTL0_END7 0x20000000 // 8th Sample is End of Sequence. #define ADC_SSCTL0_D7 0x10000000 // 8th Sample Diff Input Select. #define ADC_SSCTL0_TS6 0x08000000 // 7th Sample Temp Sensor Select. #define ADC_SSCTL0_IE6 0x04000000 // 7th Sample Interrupt Enable. #define ADC_SSCTL0_END6 0x02000000 // 7th Sample is End of Sequence. #define ADC_SSCTL0_D6 0x01000000 // 7th Sample Diff Input Select. #define ADC_SSCTL0_TS5 0x00800000 // 6th Sample Temp Sensor Select. #define ADC_SSCTL0_IE5 0x00400000 // 6th Sample Interrupt Enable. #define ADC_SSCTL0_END5 0x00200000 // 6th Sample is End of Sequence. #define ADC_SSCTL0_D5 0x00100000 // 6th Sample Diff Input Select. #define ADC_SSCTL0_TS4 0x00080000 // 5th Sample Temp Sensor Select. #define ADC_SSCTL0_IE4 0x00040000 // 5th Sample Interrupt Enable. #define ADC_SSCTL0_END4 0x00020000 // 5th Sample is End of Sequence. #define ADC_SSCTL0_D4 0x00010000 // 5th Sample Diff Input Select. #define ADC_SSCTL0_TS3 0x00008000 // 4th Sample Temp Sensor Select. #define ADC_SSCTL0_IE3 0x00004000 // 4th Sample Interrupt Enable. #define ADC_SSCTL0_END3 0x00002000 // 4th Sample is End of Sequence. #define ADC_SSCTL0_D3 0x00001000 // 4th Sample Diff Input Select. #define ADC_SSCTL0_TS2 0x00000800 // 3rd Sample Temp Sensor Select. #define ADC_SSCTL0_IE2 0x00000400 // 3rd Sample Interrupt Enable. #define ADC_SSCTL0_END2 0x00000200 // 3rd Sample is End of Sequence. #define ADC_SSCTL0_D2 0x00000100 // 3rd Sample Diff Input Select. #define ADC_SSCTL0_TS1 0x00000080 // 2nd Sample Temp Sensor Select. #define ADC_SSCTL0_IE1 0x00000040 // 2nd Sample Interrupt Enable. #define ADC_SSCTL0_END1 0x00000020 // 2nd Sample is End of Sequence. #define ADC_SSCTL0_D1 0x00000010 // 2nd Sample Diff Input Select. #define ADC_SSCTL0_TS0 0x00000008 // 1st Sample Temp Sensor Select. #define ADC_SSCTL0_IE0 0x00000004 // 1st Sample Interrupt Enable. #define ADC_SSCTL0_END0 0x00000002 // 1st Sample is End of Sequence. #define ADC_SSCTL0_D0 0x00000001 // 1st Sample Diff Input Select. //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFIFO0 register. // //***************************************************************************** #define ADC_SSFIFO0_DATA_M 0x000003FF // Conversion Result Data. #define ADC_SSFIFO0_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFSTAT0 register. // //***************************************************************************** #define ADC_SSFSTAT0_FULL 0x00001000 // FIFO Full. #define ADC_SSFSTAT0_EMPTY 0x00000100 // FIFO Empty. #define ADC_SSFSTAT0_HPTR_M 0x000000F0 // FIFO Head Pointer. #define ADC_SSFSTAT0_TPTR_M 0x0000000F // FIFO Tail Pointer. #define ADC_SSFSTAT0_HPTR_S 4 #define ADC_SSFSTAT0_TPTR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSMUX1 register. // //***************************************************************************** #define ADC_SSMUX1_MUX3_M 0x00007000 // 4th Sample Input Select. #define ADC_SSMUX1_MUX2_M 0x00000700 // 3rd Sample Input Select. #define ADC_SSMUX1_MUX1_M 0x00000070 // 2nd Sample Input Select. #define ADC_SSMUX1_MUX0_M 0x00000007 // 1st Sample Input Select. #define ADC_SSMUX1_MUX3_S 12 #define ADC_SSMUX1_MUX2_S 8 #define ADC_SSMUX1_MUX1_S 4 #define ADC_SSMUX1_MUX0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSCTL1 register. // //***************************************************************************** #define ADC_SSCTL1_TS3 0x00008000 // 4th Sample Temp Sensor Select. #define ADC_SSCTL1_IE3 0x00004000 // 4th Sample Interrupt Enable. #define ADC_SSCTL1_END3 0x00002000 // 4th Sample is End of Sequence. #define ADC_SSCTL1_D3 0x00001000 // 4th Sample Diff Input Select. #define ADC_SSCTL1_TS2 0x00000800 // 3rd Sample Temp Sensor Select. #define ADC_SSCTL1_IE2 0x00000400 // 3rd Sample Interrupt Enable. #define ADC_SSCTL1_END2 0x00000200 // 3rd Sample is End of Sequence. #define ADC_SSCTL1_D2 0x00000100 // 3rd Sample Diff Input Select. #define ADC_SSCTL1_TS1 0x00000080 // 2nd Sample Temp Sensor Select. #define ADC_SSCTL1_IE1 0x00000040 // 2nd Sample Interrupt Enable. #define ADC_SSCTL1_END1 0x00000020 // 2nd Sample is End of Sequence. #define ADC_SSCTL1_D1 0x00000010 // 2nd Sample Diff Input Select. #define ADC_SSCTL1_TS0 0x00000008 // 1st Sample Temp Sensor Select. #define ADC_SSCTL1_IE0 0x00000004 // 1st Sample Interrupt Enable. #define ADC_SSCTL1_END0 0x00000002 // 1st Sample is End of Sequence. #define ADC_SSCTL1_D0 0x00000001 // 1st Sample Diff Input Select. //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFIFO1 register. // //***************************************************************************** #define ADC_SSFIFO1_DATA_M 0x000003FF // Conversion Result Data. #define ADC_SSFIFO1_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFSTAT1 register. // //***************************************************************************** #define ADC_SSFSTAT1_FULL 0x00001000 // FIFO Full. #define ADC_SSFSTAT1_EMPTY 0x00000100 // FIFO Empty. #define ADC_SSFSTAT1_HPTR_M 0x000000F0 // FIFO Head Pointer. #define ADC_SSFSTAT1_TPTR_M 0x0000000F // FIFO Tail Pointer. #define ADC_SSFSTAT1_HPTR_S 4 #define ADC_SSFSTAT1_TPTR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSMUX2 register. // //***************************************************************************** #define ADC_SSMUX2_MUX3_M 0x00007000 // 4th Sample Input Select. #define ADC_SSMUX2_MUX2_M 0x00000700 // 3rd Sample Input Select. #define ADC_SSMUX2_MUX1_M 0x00000070 // 2nd Sample Input Select. #define ADC_SSMUX2_MUX0_M 0x00000007 // 1st Sample Input Select. #define ADC_SSMUX2_MUX3_S 12 #define ADC_SSMUX2_MUX2_S 8 #define ADC_SSMUX2_MUX1_S 4 #define ADC_SSMUX2_MUX0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSCTL2 register. // //***************************************************************************** #define ADC_SSCTL2_TS3 0x00008000 // 4th Sample Temp Sensor Select. #define ADC_SSCTL2_IE3 0x00004000 // 4th Sample Interrupt Enable. #define ADC_SSCTL2_END3 0x00002000 // 4th Sample is End of Sequence. #define ADC_SSCTL2_D3 0x00001000 // 4th Sample Diff Input Select. #define ADC_SSCTL2_TS2 0x00000800 // 3rd Sample Temp Sensor Select. #define ADC_SSCTL2_IE2 0x00000400 // 3rd Sample Interrupt Enable. #define ADC_SSCTL2_END2 0x00000200 // 3rd Sample is End of Sequence. #define ADC_SSCTL2_D2 0x00000100 // 3rd Sample Diff Input Select. #define ADC_SSCTL2_TS1 0x00000080 // 2nd Sample Temp Sensor Select. #define ADC_SSCTL2_IE1 0x00000040 // 2nd Sample Interrupt Enable. #define ADC_SSCTL2_END1 0x00000020 // 2nd Sample is End of Sequence. #define ADC_SSCTL2_D1 0x00000010 // 2nd Sample Diff Input Select. #define ADC_SSCTL2_TS0 0x00000008 // 1st Sample Temp Sensor Select. #define ADC_SSCTL2_IE0 0x00000004 // 1st Sample Interrupt Enable. #define ADC_SSCTL2_END0 0x00000002 // 1st Sample is End of Sequence. #define ADC_SSCTL2_D0 0x00000001 // 1st Sample Diff Input Select. //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFIFO2 register. // //***************************************************************************** #define ADC_SSFIFO2_DATA_M 0x000003FF // Conversion Result Data. #define ADC_SSFIFO2_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFSTAT2 register. // //***************************************************************************** #define ADC_SSFSTAT2_FULL 0x00001000 // FIFO Full. #define ADC_SSFSTAT2_EMPTY 0x00000100 // FIFO Empty. #define ADC_SSFSTAT2_HPTR_M 0x000000F0 // FIFO Head Pointer. #define ADC_SSFSTAT2_TPTR_M 0x0000000F // FIFO Tail Pointer. #define ADC_SSFSTAT2_HPTR_S 4 #define ADC_SSFSTAT2_TPTR_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSMUX3 register. // //***************************************************************************** #define ADC_SSMUX3_MUX0_M 0x00000007 // 1st Sample Input Select. #define ADC_SSMUX3_MUX0_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSCTL3 register. // //***************************************************************************** #define ADC_SSCTL3_TS0 0x00000008 // 1st Sample Temp Sensor Select. #define ADC_SSCTL3_IE0 0x00000004 // 1st Sample Interrupt Enable. #define ADC_SSCTL3_END0 0x00000002 // 1st Sample is End of Sequence. #define ADC_SSCTL3_D0 0x00000001 // 1st Sample Diff Input Select. //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFIFO3 register. // //***************************************************************************** #define ADC_SSFIFO3_DATA_M 0x000003FF // Conversion Result Data. #define ADC_SSFIFO3_DATA_S 0 //***************************************************************************** // // The following are defines for the bit fields in the ADC_O_SSFSTAT3 register. // //***************************************************************************** #define ADC_SSFSTAT3_FULL 0x00001000 // FIFO Full. #define ADC_SSFSTAT3_EMPTY 0x00000100 // FIFO Empty. #define ADC_SSFSTAT3_HPTR_M 0x000000F0 // FIFO Head Pointer. #define ADC_SSFSTAT3_TPTR_M 0x0000000F // FIFO Tail Pointer. #define ADC_SSFSTAT3_HPTR_S 4 #define ADC_SSFSTAT3_TPTR_S 0 //***************************************************************************** // // The following definitions are deprecated. // //***************************************************************************** #ifndef DEPRECATED //***************************************************************************** // // The following are deprecated defines for the ADC sequence register offsets. // //***************************************************************************** #define ADC_O_SEQ 0x00000040 // Offset to the first sequence #define ADC_O_SEQ_STEP 0x00000020 // Increment to the next sequence #define ADC_O_X_SSFSTAT 0x0000000C // FIFO status register #define ADC_O_X_SSFIFO 0x00000008 // Result FIFO register #define ADC_O_X_SSCTL 0x00000004 // Sample sequence control register #define ADC_O_X_SSMUX 0x00000000 // Multiplexer select register //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_EMUX // register. // //***************************************************************************** #define ADC_EMUX_EM3_MASK 0x0000F000 // Event mux 3 mask #define ADC_EMUX_EM2_MASK 0x00000F00 // Event mux 2 mask #define ADC_EMUX_EM1_MASK 0x000000F0 // Event mux 1 mask #define ADC_EMUX_EM0_MASK 0x0000000F // Event mux 0 mask #define ADC_EMUX_EM3_SHIFT 12 // The shift for the fourth event #define ADC_EMUX_EM2_SHIFT 8 // The shift for the third event #define ADC_EMUX_EM1_SHIFT 4 // The shift for the second event #define ADC_EMUX_EM0_SHIFT 0 // The shift for the first event //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_SSPRI // register. // //***************************************************************************** #define ADC_SSPRI_SS3_MASK 0x00003000 // Sequencer 3 priority mask #define ADC_SSPRI_SS2_MASK 0x00000300 // Sequencer 2 priority mask #define ADC_SSPRI_SS1_MASK 0x00000030 // Sequencer 1 priority mask #define ADC_SSPRI_SS0_MASK 0x00000003 // Sequencer 0 priority mask //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_SSMUX0, // ADC_SSMUX1, ADC_SSMUX2, and ADC_SSMUX3 registers. Not all fields are present // in all registers. // //***************************************************************************** #define ADC_SSMUX_MUX7_MASK 0x70000000 // 8th mux select mask #define ADC_SSMUX_MUX6_MASK 0x07000000 // 7th mux select mask #define ADC_SSMUX_MUX5_MASK 0x00700000 // 6th mux select mask #define ADC_SSMUX_MUX4_MASK 0x00070000 // 5th mux select mask #define ADC_SSMUX_MUX3_MASK 0x00007000 // 4th mux select mask #define ADC_SSMUX_MUX2_MASK 0x00000700 // 3rd mux select mask #define ADC_SSMUX_MUX1_MASK 0x00000070 // 2nd mux select mask #define ADC_SSMUX_MUX0_MASK 0x00000007 // 1st mux select mask #define ADC_SSMUX_MUX7_SHIFT 28 #define ADC_SSMUX_MUX6_SHIFT 24 #define ADC_SSMUX_MUX5_SHIFT 20 #define ADC_SSMUX_MUX4_SHIFT 16 #define ADC_SSMUX_MUX3_SHIFT 12 #define ADC_SSMUX_MUX2_SHIFT 8 #define ADC_SSMUX_MUX1_SHIFT 4 #define ADC_SSMUX_MUX0_SHIFT 0 //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_SSCTL0, // ADC_SSCTL1, ADC_SSCTL2, and ADC_SSCTL3 registers. Not all fields are present // in all registers. // //***************************************************************************** #define ADC_SSCTL_TS7 0x80000000 // 8th temperature sensor select #define ADC_SSCTL_IE7 0x40000000 // 8th interrupt enable #define ADC_SSCTL_END7 0x20000000 // 8th sequence end select #define ADC_SSCTL_D7 0x10000000 // 8th differential select #define ADC_SSCTL_TS6 0x08000000 // 7th temperature sensor select #define ADC_SSCTL_IE6 0x04000000 // 7th interrupt enable #define ADC_SSCTL_END6 0x02000000 // 7th sequence end select #define ADC_SSCTL_D6 0x01000000 // 7th differential select #define ADC_SSCTL_TS5 0x00800000 // 6th temperature sensor select #define ADC_SSCTL_IE5 0x00400000 // 6th interrupt enable #define ADC_SSCTL_END5 0x00200000 // 6th sequence end select #define ADC_SSCTL_D5 0x00100000 // 6th differential select #define ADC_SSCTL_TS4 0x00080000 // 5th temperature sensor select #define ADC_SSCTL_IE4 0x00040000 // 5th interrupt enable #define ADC_SSCTL_END4 0x00020000 // 5th sequence end select #define ADC_SSCTL_D4 0x00010000 // 5th differential select #define ADC_SSCTL_TS3 0x00008000 // 4th temperature sensor select #define ADC_SSCTL_IE3 0x00004000 // 4th interrupt enable #define ADC_SSCTL_END3 0x00002000 // 4th sequence end select #define ADC_SSCTL_D3 0x00001000 // 4th differential select #define ADC_SSCTL_TS2 0x00000800 // 3rd temperature sensor select #define ADC_SSCTL_IE2 0x00000400 // 3rd interrupt enable #define ADC_SSCTL_END2 0x00000200 // 3rd sequence end select #define ADC_SSCTL_D2 0x00000100 // 3rd differential select #define ADC_SSCTL_TS1 0x00000080 // 2nd temperature sensor select #define ADC_SSCTL_IE1 0x00000040 // 2nd interrupt enable #define ADC_SSCTL_END1 0x00000020 // 2nd sequence end select #define ADC_SSCTL_D1 0x00000010 // 2nd differential select #define ADC_SSCTL_TS0 0x00000008 // 1st temperature sensor select #define ADC_SSCTL_IE0 0x00000004 // 1st interrupt enable #define ADC_SSCTL_END0 0x00000002 // 1st sequence end select #define ADC_SSCTL_D0 0x00000001 // 1st differential select //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_SSFIFO0, // ADC_SSFIFO1, ADC_SSFIFO2, and ADC_SSFIFO3 registers. // //***************************************************************************** #define ADC_SSFIFO_DATA_MASK 0x000003FF // Sample data #define ADC_SSFIFO_DATA_SHIFT 0 //***************************************************************************** // // The following are deprecated defines for the bit fields in the ADC_SSFSTAT0, // ADC_SSFSTAT1, ADC_SSFSTAT2, and ADC_SSFSTAT3 registers. // //***************************************************************************** #define ADC_SSFSTAT_FULL 0x00001000 // FIFO is full #define ADC_SSFSTAT_EMPTY 0x00000100 // FIFO is empty #define ADC_SSFSTAT_HPTR 0x000000F0 // FIFO head pointer #define ADC_SSFSTAT_TPTR 0x0000000F // FIFO tail pointer //***************************************************************************** // // The following are deprecated defines for the bit fields in the loopback ADC // data. // //***************************************************************************** #define ADC_LB_CNT_MASK 0x000003C0 // Sample counter mask #define ADC_LB_CONT 0x00000020 // Continuation sample #define ADC_LB_DIFF 0x00000010 // Differential sample #define ADC_LB_TS 0x00000008 // Temperature sensor sample #define ADC_LB_MUX_MASK 0x00000007 // Input channel number mask #define ADC_LB_CNT_SHIFT 6 // Sample counter shift #define ADC_LB_MUX_SHIFT 0 // Input channel number shift #endif #endif // __HW_ADC_H__
zz314326255--adkping
iNEMO-accessory/firmware/FreeRTOSv7.0.2/Demo/Common/drivers/LuminaryMicro/hw_adc.h
C
oos
34,735