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
18 #warning "This default file may only be used as an example!"
\r
22 #include "mpc5516.h"
\r
24 const struct tcd_t AdcGroupDMACommandConfig [ADC_NBR_OF_GROUPS];
\r
25 const struct tcd_t AdcGroupDMAResultConfig [ADC_NBR_OF_GROUPS];
\r
27 Adc_GroupStatus AdcGroupStatus[ADC_NBR_OF_GROUPS];
\r
29 /* Configuration goes here. */
\r
30 void Adc_Group0Notification (void)
\r
34 void Adc_Group1Notification (void)
\r
38 const Adc_HWConfigurationType AdcHWUnitConfiguration =
\r
41 .adcPrescale = ADC_SYSTEM_CLOCK_DIVIDE_FACTOR_8,
\r
42 .clockSource = ADC_SYSTEM_CLOCK,
\r
45 const Adc_ChannelConfigurationType AdcChannelConfiguration [ADC_NBR_OF_CHANNELS] =
\r
47 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
48 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
49 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
50 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
51 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_DISABLED},
\r
52 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
53 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
54 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
55 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
56 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
57 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
58 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
59 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
60 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
61 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
62 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
63 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
64 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
65 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
66 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
67 { ADC_CONVERSION_TIME_8_CLOCKS, 10, 0, ADC_RESOLUTION_12BITS, ADC_CALIBRATION_ENABLED},
\r
70 const Adc_ChannelType Adc_Group0ChannelList[ADC_NBR_OF_GROUP0_CHANNELS] =
\r
72 ADC_CH1, ADC_CH2, ADC_CH3, ADC_CH4, ADC_CH5, ADC_CH6, ADC_CH7
\r
75 const Adc_ChannelType Adc_Group1ChannelList[ADC_NBR_OF_GROUP1_CHANNELS] =
\r
77 ADC_CH0, ADC_CH2, ADC_CH3, ADC_CH4
\r
80 const Adc_ChannelType Adc_Group2ChannelList[ADC_NBR_OF_GROUP2_CHANNELS] =
\r
82 ADC_CH0, ADC_CH1, ADC_CH2
\r
85 const Adc_ChannelType Adc_Group3ChannelList[ADC_NBR_OF_GROUP3_CHANNELS] =
\r
87 ADC_CH0, ADC_CH1, ADC_CH2
\r
90 /* Ram buffers for command and result queues. These are located here in the
\r
91 configuration to be able to reconfigure system without recompiling the
\r
93 Adc_ValueGroupType Adc_Group0Buffer [sizeof(Adc_Group0ChannelList)/sizeof(Adc_Group0ChannelList[0])];
\r
94 Adc_CommandType Adc_Group0Commands [sizeof(Adc_Group0ChannelList)/sizeof(Adc_Group0ChannelList[0])];
\r
96 Adc_ValueGroupType Adc_Group1Buffer [sizeof(Adc_Group1ChannelList)/sizeof(Adc_Group1ChannelList[0])];
\r
97 Adc_CommandType Adc_Group1Commands [sizeof(Adc_Group1ChannelList)/sizeof(Adc_Group1ChannelList[0])];
\r
99 Adc_ValueGroupType Adc_Group2Buffer [sizeof(Adc_Group2ChannelList)/sizeof(Adc_Group2ChannelList[0])];
\r
100 Adc_CommandType Adc_Group2Commands [sizeof(Adc_Group2ChannelList)/sizeof(Adc_Group2ChannelList[0])];
\r
102 Adc_ValueGroupType Adc_Group3Buffer [sizeof(Adc_Group3ChannelList)/sizeof(Adc_Group3ChannelList[0])];
\r
103 Adc_CommandType Adc_Group3Commands [sizeof(Adc_Group3ChannelList)/sizeof(Adc_Group3ChannelList[0])];
\r
106 const Adc_GroupDefType AdcGroupConfiguration [] =
\r
108 { .accessMode = ADC_ACCESS_MODE_SINGLE, .conversionMode = ADC_CONV_MODE_ONESHOT,
\r
109 .triggerSrc = ADC_TRIGG_SRC_SW, .hwTriggerSignal = ADC_NO_HW_TRIG,
\r
110 .hwTriggerTimer = ADC_NO_TIMER,
\r
111 .groupCallback = Adc_Group0Notification,
\r
112 .streamBufferMode = ADC_NO_STREAMING, .streamNumSamples = 0,
\r
113 .channelList = Adc_Group0ChannelList,
\r
114 .resultBuffer = Adc_Group0Buffer,
\r
115 .commandBuffer = Adc_Group0Commands,
\r
116 .numberOfChannels = sizeof(Adc_Group0Commands)/sizeof(Adc_Group0Commands[0]),
\r
117 .status = &AdcGroupStatus[ADC_GROUP0],
\r
118 .dmaCommandChannel = DMA_ADC_GROUP0_COMMAND_CHANNEL,
\r
119 .dmaResultChannel = DMA_ADC_GROUP0_RESULT_CHANNEL,
\r
120 .groupDMACommands = &AdcGroupDMACommandConfig[ADC_GROUP0],
\r
121 .groupDMAResults = &AdcGroupDMAResultConfig[ADC_GROUP0]},
\r
123 { .accessMode = ADC_ACCESS_MODE_SINGLE, .conversionMode = ADC_CONV_MODE_CONTINOUS,
\r
124 .triggerSrc = ADC_TRIGG_SRC_SW, .hwTriggerSignal = ADC_NO_HW_TRIG,
\r
125 .hwTriggerTimer = ADC_NO_TIMER,
\r
126 .groupCallback = Adc_Group1Notification,
\r
127 .streamBufferMode = ADC_NO_STREAMING, .streamNumSamples = 0,
\r
128 .channelList = Adc_Group1ChannelList,
\r
129 .resultBuffer = Adc_Group1Buffer,
\r
130 .commandBuffer = Adc_Group1Commands,
\r
131 .numberOfChannels = sizeof(Adc_Group1Commands)/sizeof(Adc_Group1Commands[0]),
\r
132 .status = &AdcGroupStatus[ADC_GROUP1],
\r
133 .dmaCommandChannel = DMA_ADC_GROUP1_COMMAND_CHANNEL,
\r
134 .dmaResultChannel = DMA_ADC_GROUP1_RESULT_CHANNEL,
\r
135 .groupDMACommands = &AdcGroupDMACommandConfig[ADC_GROUP1],
\r
136 .groupDMAResults = &AdcGroupDMAResultConfig[ADC_GROUP1]}
\r
140 /******************************************************************/
\r
142 /* End of user configuration area. DO NOT modify the code below!! */
\r
144 /******************************************************************/
\r
145 const Adc_ConfigType AdcConfig [] =
\r
148 .hwConfigPtr = &AdcHWUnitConfiguration,
\r
149 .channelConfigPtr = AdcChannelConfiguration,
\r
150 .nbrOfChannels = sizeof(AdcChannelConfiguration)/sizeof(AdcChannelConfiguration[0]),
\r
151 .groupConfigPtr = AdcGroupConfiguration,
\r
152 .nbrOfGroups = sizeof(AdcGroupConfiguration)/sizeof(AdcGroupConfiguration[0])}
\r
155 /* DMA configuration. */
\r
156 const struct tcd_t AdcGroupDMACommandConfig [ADC_NBR_OF_GROUPS] =
\r
159 .SADDR = (uint32_t)Adc_Group0Commands,
\r
161 .SSIZE = DMA_TRANSFER_SIZE_32BITS,
\r
163 .DSIZE = DMA_TRANSFER_SIZE_32BITS,
\r
164 .SOFF = sizeof(Adc_CommandType),
\r
165 .NBYTES = sizeof(Adc_CommandType),
\r
166 .SLAST = -sizeof(Adc_Group0Commands),
\r
167 .DADDR = (vint32_t)&EQADC.CFPR[ADC_GROUP0].R,
\r
169 .CITER = sizeof(Adc_Group0Commands)/sizeof(Adc_Group0Commands[0]),
\r
173 .BITER = sizeof(Adc_Group0Commands)/sizeof(Adc_Group0Commands[0]),
\r
186 .SADDR = (uint32_t)Adc_Group1Commands,
\r
188 .SSIZE = DMA_TRANSFER_SIZE_32BITS,
\r
190 .DSIZE = DMA_TRANSFER_SIZE_32BITS,
\r
191 .SOFF = sizeof(Adc_CommandType),
\r
192 .NBYTES = sizeof(Adc_CommandType),
\r
193 .SLAST = -sizeof(Adc_Group1Commands),
\r
194 .DADDR = (vint32_t)&EQADC.CFPR[ADC_GROUP1].R,
\r
196 .CITER = sizeof(Adc_Group1Commands)/sizeof(Adc_Group1Commands[0]),
\r
200 .BITER = sizeof(Adc_Group1Commands)/sizeof(Adc_Group1Commands[0]),
\r
214 const struct tcd_t AdcGroupDMAResultConfig [ADC_NBR_OF_GROUPS]=
\r
217 .SADDR = (vint32_t)&EQADC.RFPR[ADC_GROUP0].R + 2,
\r
219 .SSIZE = DMA_TRANSFER_SIZE_16BITS,
\r
221 .DSIZE = DMA_TRANSFER_SIZE_16BITS,
\r
223 .NBYTES = sizeof(Adc_ValueGroupType),
\r
225 .DADDR = (uint32_t)Adc_Group0Buffer,
\r
227 .CITER = sizeof(Adc_Group0Buffer)/sizeof(Adc_Group0Buffer[0]),
\r
228 .DOFF = sizeof(Adc_ValueGroupType),
\r
229 .DLAST_SGA = -sizeof(Adc_Group0Buffer),
\r
231 .BITER = sizeof(Adc_Group0Buffer)/sizeof(Adc_Group0Buffer[0]),
\r
244 .SADDR = (vint32_t)&EQADC.RFPR[ADC_GROUP1].R + 2,
\r
246 .SSIZE = DMA_TRANSFER_SIZE_16BITS,
\r
248 .DSIZE = DMA_TRANSFER_SIZE_16BITS,
\r
250 .NBYTES = sizeof(Adc_ValueGroupType),
\r
252 .DADDR = (uint32_t)Adc_Group1Buffer,
\r
254 .CITER = sizeof(Adc_Group1Buffer)/sizeof(Adc_Group1Buffer[0]),
\r
255 .DOFF = sizeof(Adc_ValueGroupType),
\r
256 .DLAST_SGA = -sizeof(Adc_Group1Buffer),
\r
258 .BITER = sizeof(Adc_Group1Buffer)/sizeof(Adc_Group1Buffer[0]),
\r