1 /* -------------------------------- Arctic Core ------------------------------
\r
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
\r
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
\r
6 * This source code is free software; you can redistribute it and/or modify it
\r
7 * under the terms of the GNU General Public License version 2 as published by the
\r
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
\r
10 * This program is distributed in the hope that it will be useful, but
\r
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
\r
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
\r
14 * -------------------------------- Arctic Core ------------------------------*/
\r
16 /** @addtogroup Adc ADC Driver
\r
20 * API and type definitions for ADC Driver.
\r
26 #include "Std_Types.h"
\r
28 #define ADC_VENDOR_ID 1
\r
29 #define ADC_MODULE_ID MODULE_ID_ADC
\r
30 #define ADC_AR_MAJOR_VERSION 3
\r
31 #define ADC_AR_MINOR_VERSION 0
\r
32 #define ADC_AR_PATCH_VERSION 3
\r
34 #define ADC_SW_MAJOR_VERSION 1
\r
35 #define ADC_SW_MINOR_VERSION 0
\r
36 #define ADC_SW_PATCH_VERSION 0
\r
38 /** Group status. */
\r
44 ADC_STREAM_COMPLETED,
\r
48 /* DET errors that the ADC can produce. */
\r
51 ADC_E_UNINIT = 0x0A,
\r
54 ADC_E_ALREADY_INITIALIZED = 0x0D,
\r
55 ADC_E_PARAM_CONFIG = 0x0E,
\r
56 ADC_E_PARAM_GROUP = 0x15,
\r
57 ADC_E_WRONG_CONV_MODE = 0x16,
\r
58 ADC_E_WRONG_TRIGG_SRC = 0x17,
\r
59 ADC_E_NOTIF_CAPABILITY = 0x18,
\r
60 ADC_E_BUFFER_UNINIT = 0x19
\r
63 /** API service ID's */
\r
67 ADC_DEINIT_ID = 0x01,
\r
68 ADC_STARTGROUPCONVERSION_ID = 0x02,
\r
69 ADC_STOPGROUPCONVERSION_ID = 0x03,
\r
70 ADC_READGROUP_ID = 0x04,
\r
71 ADC_ENABLEHARDWARETRIGGER_ID = 0x05,
\r
72 ADC_DISBALEHARDWARETRIGGER_ID = 0x06,
\r
73 ADC_ENABLEGROUPNOTIFICATION_ID = 0x07,
\r
74 ADC_DISABLEGROUPNOTIFICATION_ID = 0x08,
\r
75 ADC_GETGROUPSTATUS_ID = 0x09,
\r
76 ADC_GETVERSIONINFO_ID = 0x0A,
\r
77 ADC_GETSTREAMLASTPOINTER_ID = 0x0B,
\r
78 ADC_SETUPRESULTBUFFER_ID = 0x0C,
\r
79 }Adc_APIServiceIDType;
\r
85 /** Access mode to group conversion results. */
\r
88 ADC_ACCESS_MODE_SINGLE,
\r
89 ADC_ACCESS_MODE_STREAMING
\r
90 }Adc_GroupAccessModeType;
\r
92 /** Group trigger source (Not supported). */
\r
97 }Adc_TriggerSourceType;
\r
99 /** HW trigger edge (Not supported). */
\r
103 ADC_HW_TRIG_BOTH_EDGES,
\r
104 ADC_HW_TRIG_FALLING_EDGE,
\r
105 ADC_HW_TRIG_RISING_EDGE,
\r
106 }Adc_HwTriggerSignalType;
\r
108 /** Stream buffer type. */
\r
112 ADC_STREAM_BUFFER_CIRCULAR,
\r
113 ADC_STREAM_BUFFER_LINEAR,
\r
114 }Adc_StreamBufferModeType;
\r
116 #include "Adc_Cfg.h"
\r
118 /* Function interface. */
\r
119 /** Initializes the ADC hardware units and driver. */
\r
120 void Adc_Init (const Adc_ConfigType *ConfigPtr);
\r
121 #if (ADC_DEINIT_API == STD_ON)
\r
122 /** Returns all ADC HW Units to a state comparable to their power on reset state. */
\r
123 void Adc_DeInit ();
\r
125 /** Sets up the result buffer for a group. */
\r
126 Std_ReturnType Adc_SetupResultBuffer (Adc_GroupType group, Adc_ValueGroupType *bufferPtr);
\r
127 #if (ADC_ENABLE_START_STOP_GROUP_API == STD_ON)
\r
128 /** Starts the conversion of all channels of the requested ADC Channel group. */
\r
129 void Adc_StartGroupConversion (Adc_GroupType group);
\r
130 void Adc_StopGroupConversion (Adc_GroupType group);
\r
132 #if (ADC_READ_GROUP_API == STD_ON)
\r
133 /** Reads results from last conversion into buffer */
\r
134 Std_ReturnType Adc_ReadGroup (Adc_GroupType group, Adc_ValueGroupType *dataBufferPtr);
\r
137 #if !defined(CFG_HC1X)
\r
138 /** Reads results from last streaming conversion into buffer */
\r
139 Adc_StreamNumSampleType Adc_GetStreamLastPointer(Adc_GroupType group, Adc_ValueGroupType** PtrToSamplePtr);
\r
142 #if (ADC_GRP_NOTIF_CAPABILITY == STD_ON)
\r
143 /** Enables the notification mechanism for the requested ADC Channel group. */
\r
144 void Adc_EnableGroupNotification (Adc_GroupType group);
\r
145 /** Disables the notification mechanism for the requested ADC Channel group. */
\r
146 void Adc_DisableGroupNotification (Adc_GroupType group);
\r
148 /** Returns the conversion status of the requested ADC Channel group. */
\r
149 Adc_StatusType Adc_GetGroupStatus (Adc_GroupType group);
\r