source: rtems/bsps/arm/atsam/include/libchip/include/adc.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 7.3 KB
RevLine 
[e1eeb883]1/* ---------------------------------------------------------------------------- */
2/*                  Atmel Microcontroller Software Support                      */
3/*                       SAM Software Package License                           */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation                                        */
6/*                                                                              */
7/* All rights reserved.                                                         */
8/*                                                                              */
9/* Redistribution and use in source and binary forms, with or without           */
10/* modification, are permitted provided that the following condition is met:    */
11/*                                                                              */
12/* - Redistributions of source code must retain the above copyright notice,     */
13/* this list of conditions and the disclaimer below.                            */
14/*                                                                              */
15/* Atmel's name may not be used to endorse or promote products derived from     */
16/* this software without specific prior written permission.                     */
17/*                                                                              */
18/* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
28/* ---------------------------------------------------------------------------- */
29
30/**
31 *  \file
32 *
33 *  \section Purpose
34 *
35 *  Interface for configuration the Analog-to-Digital Converter (ADC) peripheral.
36 *
37 *  \section Usage
38 *
39 *  -# Configurate the pins for ADC.
40 *  -# Initialize the ADC with ADC_Initialize().
41 *  -# Set ADC clock and timing with ADC_SetClock() and ADC_SetTiming().
42 *  -# Select the active channel using ADC_EnableChannel().
43 *  -# Start the conversion with ADC_StartConversion().
44 *  -# Wait the end of the conversion by polling status with ADC_GetStatus().
45 *  -# Finally, get the converted data using ADC_GetConvertedData() or
46 * ADC_GetLastConvertedData().
47 *
48*/
49#ifndef _ADC_
50#define _ADC_
51
52/*----------------------------------------------------------------------------
53 *        Headers
54 *----------------------------------------------------------------------------*/
55#include <assert.h>
56#include <stdint.h>
57
58/*------------------------------------------------------------------------------
59 *         Definitions
60 *------------------------------------------------------------------------------*/
61
62/* Max. ADC Clock Frequency (Hz) */
63#define ADC_CLOCK_MAX   20000000
64
65/* Max. normal ADC startup time (us) */
66#define ADC_STARTUP_NORMAL_MAX     40
67/* Max. fast ADC startup time (us) */
68#define ADC_STARTUP_FAST_MAX       12
69
70/* Definitions for ADC channels */
71#define ADC_CHANNEL_0  0
72#define ADC_CHANNEL_1  1
73#define ADC_CHANNEL_2  2
74#define ADC_CHANNEL_3  3
75#define ADC_CHANNEL_4  4
76#define ADC_CHANNEL_5  5
77#define ADC_CHANNEL_6  6
78#define ADC_CHANNEL_7  7
79#define ADC_CHANNEL_8  8
80#define ADC_CHANNEL_9  9
81#define ADC_CHANNEL_10 10
82#define ADC_CHANNEL_11 11
83#define ADC_CHANNEL_12 12
84#define ADC_CHANNEL_13 13
85#define ADC_CHANNEL_14 14
86#define ADC_CHANNEL_15 15
87
88#ifdef __cplusplus
89extern "C" {
90#endif
91
92/*------------------------------------------------------------------------------
93 *         Macros function of register access
94 *------------------------------------------------------------------------------*/
95
96#define ADC_GetModeReg(pAdc)                ((pAdc)->ADC_MR)
97
98#define ADC_StartConversion(pAdc)           ((pAdc)->ADC_CR = ADC_CR_START)
99
100#define ADC_SetCalibMode(pAdc)                ((pAdc)->ADC_CR |= ADC_CR_AUTOCAL)
101
102#define ADC_EnableChannel(pAdc, dwChannel)    {\
103                (pAdc)->ADC_CHER = (1 << (dwChannel));\
104        }
105
106#define ADC_DisableChannel(pAdc, dwChannel)  {\
107                (pAdc)->ADC_CHDR = (1 << (dwChannel));\
108        }
109
110#define ADC_EnableIt(pAdc, dwMode)            {\
111                (pAdc)->ADC_IER = (dwMode);\
112        }
113
114#define ADC_DisableIt(pAdc, dwMode)           {\
115                (pAdc)->ADC_IDR = (dwMode);\
116        }
117
118#define ADC_SetChannelGain(pAdc,dwMode)       {\
119                (pAdc)->ADC_CGR = dwMode;\
120        }
121
122#define ADC_SetChannelOffset(pAdc,dwMode)     {\
123                (pAdc)->ADC_COR = dwMode;\
124        }
125
126#define ADC_EnableDataReadyIt(pAdc)         ((pAdc)->ADC_IER = ADC_IER_DRDY)
127
128#define ADC_GetStatus(pAdc)                 ((pAdc)->ADC_ISR)
129
130#define ADC_GetCompareMode(pAdc)            (((pAdc)->ADC_EMR)& (ADC_EMR_CMPMODE_Msk))
131
132#define ADC_GetChannelStatus(pAdc)          ((pAdc)->ADC_CHSR)
133
134#define ADC_GetInterruptMaskStatus(pAdc)    ((pAdc)->ADC_IMR)
135
136#define ADC_GetLastConvertedData(pAdc)      ((pAdc)->ADC_LCDR)
137
138/*------------------------------------------------------------------------------
139 *         Exported functions
140 *------------------------------------------------------------------------------*/
141extern void ADC_Initialize(Adc *pAdc, uint32_t dwId);
142extern uint32_t ADC_SetClock(Adc *pAdc, uint32_t dwPres, uint32_t dwMck);
143extern void ADC_SetTiming(Adc *pAdc, uint32_t dwStartup, uint32_t dwTracking,
144                                                   uint32_t dwSettling);
145extern void ADC_SetTrigger(Adc *pAdc, uint32_t dwTrgSel);
146extern void ADC_SetTriggerMode(Adc *pAdc, uint32_t dwMode);
147extern void ADC_SetLowResolution(Adc *pAdc, uint32_t bEnDis);
148extern void ADC_SetSleepMode(Adc *pAdc, uint8_t bEnDis);
149extern void ADC_SetFastWakeup(Adc *pAdc, uint8_t bEnDis);
150extern void ADC_SetSequenceMode(Adc *pAdc, uint8_t bEnDis);
151extern void ADC_SetSequence(Adc *pAdc, uint32_t dwSEQ1, uint32_t dwSEQ2);
152extern void ADC_SetSequenceByList(Adc *pAdc, uint8_t ucChList[],
153                                                                   uint8_t ucNumCh);
154extern void ADC_SetAnalogChange(Adc *pAdc, uint8_t bEnDis);
155extern void ADC_SetTagEnable(Adc *pAdc, uint8_t bEnDis);
156extern void ADC_SetCompareChannel(Adc *pAdc, uint32_t dwChannel);
157extern void ADC_SetCompareMode(Adc *pAdc, uint32_t dwMode);
158extern void ADC_SetComparisonWindow(Adc *pAdc, uint32_t dwHi_Lo);
159extern uint8_t ADC_CheckConfiguration(Adc *pAdc, uint32_t dwMcK);
160extern uint32_t ADC_GetConvertedData(Adc *pAdc, uint32_t dwChannel);
161extern void ADC_SetTsAverage(Adc *pADC, uint32_t dwAvg2Conv);
162extern uint32_t ADC_GetTsXPosition(Adc *pADC);
163extern uint32_t ADC_GetTsYPosition(Adc *pADC);
164extern uint32_t ADC_GetTsPressure(Adc *pADC);
165extern void ADC_SetTsDebounce(Adc *pADC, uint32_t dwTime);
166extern void ADC_SetTsPenDetect(Adc *pADC, uint8_t bEnDis);
167extern void ADC_SetStartupTime(Adc *pAdc, uint32_t dwUs);
168extern void ADC_SetTrackingTime(Adc *pAdc, uint32_t dwNs);
169extern void ADC_SetTriggerPeriod(Adc *pAdc, uint32_t dwPeriod);
170extern void ADC_SetTsMode(Adc *pADC, uint32_t dwMode);
171extern void ADC_TsCalibration(Adc *pAdc);
172
173
174#ifdef __cplusplus
175}
176#endif
177
178#endif /* #ifndef _ADC_ */
179
Note: See TracBrowser for help on using the repository browser.