EE445M RTOS
Taken at the University of Texas Spring 2015
adc.c
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // adc.c - Driver for the ADC.
4 //
5 // Copyright (c) 2005-2014 Texas Instruments Incorporated. All rights reserved.
6 // Software License Agreement
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 //
12 // Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the
18 // distribution.
19 //
20 // Neither the name of Texas Instruments Incorporated nor the names of
21 // its contributors may be used to endorse or promote products derived
22 // from this software without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 //
36 // This is part of revision 2.1.0.12573 of the Tiva Peripheral Driver Library.
37 //
38 //*****************************************************************************
39 
40 //*****************************************************************************
41 //
44 //
45 //*****************************************************************************
46 
47 #include <stdbool.h>
48 #include <stdint.h>
49 #include "inc/hw_adc.h"
50 #include "inc/hw_ints.h"
51 #include "inc/hw_memmap.h"
52 #include "inc/hw_types.h"
53 #include "inc/hw_sysctl.h"
54 #include "driverlib/adc.h"
55 #include "driverlib/debug.h"
56 #include "driverlib/interrupt.h"
57 
58 //*****************************************************************************
59 //
60 // These defines are used by the ADC driver to simplify access to the ADC
61 // sequencer's registers.
62 //
63 //*****************************************************************************
64 #define ADC_SEQ (ADC_O_SSMUX0)
65 #define ADC_SEQ_STEP (ADC_O_SSMUX1 - ADC_O_SSMUX0)
66 #define ADC_SSMUX (ADC_O_SSMUX0 - ADC_O_SSMUX0)
67 #define ADC_SSEMUX (ADC_O_SSEMUX0 - ADC_O_SSMUX0)
68 #define ADC_SSCTL (ADC_O_SSCTL0 - ADC_O_SSMUX0)
69 #define ADC_SSFIFO (ADC_O_SSFIFO0 - ADC_O_SSMUX0)
70 #define ADC_SSFSTAT (ADC_O_SSFSTAT0 - ADC_O_SSMUX0)
71 #define ADC_SSOP (ADC_O_SSOP0 - ADC_O_SSMUX0)
72 #define ADC_SSDC (ADC_O_SSDC0 - ADC_O_SSMUX0)
73 #define ADC_SSTSH (ADC_O_SSTSH0 - ADC_O_SSMUX0)
74 
75 //*****************************************************************************
76 //
77 // The currently configured software oversampling factor for each of the ADC
78 // sequencers.
79 //
80 //*****************************************************************************
81 static uint8_t g_pui8OversampleFactor[3];
82 
83 //*****************************************************************************
84 //
96 //
97 //*****************************************************************************
98 static uint_fast8_t
99 _ADCIntNumberGet(uint32_t ui32Base, uint32_t ui32SequenceNum)
100 {
101  uint_fast8_t ui8Int;
102 
103  //
104  // Determine the interrupt to register based on the sequence number.
105  //
106  if(CLASS_IS_TM4C123)
107  {
108  ui8Int = ((ui32Base == ADC0_BASE) ?
109  (INT_ADC0SS0_TM4C123 + ui32SequenceNum) :
110  (INT_ADC0SS0_TM4C123 + ui32SequenceNum));
111  }
112  else if(CLASS_IS_TM4C129)
113  {
114  ui8Int = ((ui32Base == ADC0_BASE) ?
115  (INT_ADC0SS0_TM4C129 + ui32SequenceNum) :
116  (INT_ADC1SS0_TM4C129 + ui32SequenceNum));
117  }
118  else
119  {
120  ui8Int = 0;
121  }
122 
123  return(ui8Int);
124 }
125 
126 //*****************************************************************************
127 //
145 //
146 //*****************************************************************************
147 void
148 ADCIntRegister(uint32_t ui32Base, uint32_t ui32SequenceNum,
149  void (*pfnHandler)(void))
150 {
151  uint_fast8_t ui8Int;
152 
153  //
154  // Check the arguments.
155  //
156  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
157  ASSERT(ui32SequenceNum < 4);
158 
159  //
160  // Determine the interrupt to register based on the sequence number.
161  //
162  ui8Int = _ADCIntNumberGet(ui32Base, ui32SequenceNum);
163  ASSERT(ui8Int != 0);
164 
165  //
166  // Register the interrupt handler.
167  //
168  IntRegister(ui8Int, pfnHandler);
169 
170  //
171  // Enable the timer interrupt.
172  //
173  IntEnable(ui8Int);
174 }
175 
176 //*****************************************************************************
177 //
191 //
192 //*****************************************************************************
193 void
194 ADCIntUnregister(uint32_t ui32Base, uint32_t ui32SequenceNum)
195 {
196  uint_fast8_t ui8Int;
197 
198  //
199  // Check the arguments.
200  //
201  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
202  ASSERT(ui32SequenceNum < 4);
203 
204  //
205  // Determine the interrupt to unregister based on the sequence number.
206  //
207  ui8Int = _ADCIntNumberGet(ui32Base, ui32SequenceNum);
208  ASSERT(ui8Int != 0);
209 
210  //
211  // Disable the interrupt.
212  //
213  IntDisable(ui8Int);
214 
215  //
216  // Unregister the interrupt handler.
217  //
218  IntUnregister(ui8Int);
219 }
220 
221 //*****************************************************************************
222 //
231 //
232 //*****************************************************************************
233 void
234 ADCIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
235 {
236  //
237  // Check the arguments.
238  //
239  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
240  ASSERT(ui32SequenceNum < 4);
241 
242  //
243  // Disable this sample sequence interrupt.
244  //
245  HWREG(ui32Base + ADC_O_IM) &= ~(1 << ui32SequenceNum);
246 }
247 
248 //*****************************************************************************
249 //
260 //
261 //*****************************************************************************
262 void
263 ADCIntEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
264 {
265  //
266  // Check the arguments.
267  //
268  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
269  ASSERT(ui32SequenceNum < 4);
270 
271  //
272  // Clear any outstanding interrupts on this sample sequence.
273  //
274  HWREG(ui32Base + ADC_O_ISC) = 1 << ui32SequenceNum;
275 
276  //
277  // Enable this sample sequence interrupt.
278  //
279  HWREG(ui32Base + ADC_O_IM) |= 1 << ui32SequenceNum;
280 }
281 
282 //*****************************************************************************
283 //
296 //
297 //*****************************************************************************
298 uint32_t
299 ADCIntStatus(uint32_t ui32Base, uint32_t ui32SequenceNum, bool bMasked)
300 {
301  uint32_t ui32Temp;
302 
303  //
304  // Check the arguments.
305  //
306  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
307  ASSERT(ui32SequenceNum < 4);
308 
309  //
310  // Return either the interrupt status or the raw interrupt status as
311  // requested.
312  //
313  if(bMasked)
314  {
315  ui32Temp = HWREG(ui32Base + ADC_O_ISC) & (0x10001 << ui32SequenceNum);
316  }
317  else
318  {
319  ui32Temp = (HWREG(ui32Base + ADC_O_RIS) &
320  (0x10000 | (1 << ui32SequenceNum)));
321 
322  //
323  // If the digital comparator status bit is set, reflect it to the
324  // appropriate sequence bit.
325  //
326  if(ui32Temp & 0x10000)
327  {
328  ui32Temp |= 0xF0000;
329  ui32Temp &= ~(0x10000 << ui32SequenceNum);
330  }
331  }
332 
333  //
334  // Return the interrupt status
335  //
336  return(ui32Temp);
337 }
338 
339 //*****************************************************************************
340 //
360 //
361 //*****************************************************************************
362 void
363 ADCIntClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
364 {
365  //
366  // Check the arguments.
367  //
368  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
369  ASSERT(ui32SequenceNum < 4);
370 
371  //
372  // Clear the interrupt.
373  //
374  HWREG(ui32Base + ADC_O_ISC) = 1 << ui32SequenceNum;
375 }
376 
377 //*****************************************************************************
378 //
388 //
389 //*****************************************************************************
390 void
391 ADCSequenceEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
392 {
393  //
394  // Check the arguments.
395  //
396  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
397  ASSERT(ui32SequenceNum < 4);
398 
399  //
400  // Enable the specified sequence.
401  //
402  HWREG(ui32Base + ADC_O_ACTSS) |= 1 << ui32SequenceNum;
403 }
404 
405 //*****************************************************************************
406 //
416 //
417 //*****************************************************************************
418 void
419 ADCSequenceDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
420 {
421  //
422  // Check the arguments.
423  //
424  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
425  ASSERT(ui32SequenceNum < 4);
426 
427  //
428  // Disable the specified sequences.
429  //
430  HWREG(ui32Base + ADC_O_ACTSS) &= ~(1 << ui32SequenceNum);
431 }
432 
433 //*****************************************************************************
434 //
499 //
500 //*****************************************************************************
501 void
502 ADCSequenceConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum,
503  uint32_t ui32Trigger, uint32_t ui32Priority)
504 {
505  //
506  // Check the arugments.
507  //
508  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
509  ASSERT(ui32SequenceNum < 4);
510  ASSERT(((ui32Trigger & 0xF) == ADC_TRIGGER_PROCESSOR) ||
511  ((ui32Trigger & 0xF) == ADC_TRIGGER_COMP0) ||
512  ((ui32Trigger & 0xF) == ADC_TRIGGER_COMP1) ||
513  ((ui32Trigger & 0xF) == ADC_TRIGGER_COMP2) ||
514  ((ui32Trigger & 0xF) == ADC_TRIGGER_EXTERNAL) ||
515  ((ui32Trigger & 0xF) == ADC_TRIGGER_TIMER) ||
516  ((ui32Trigger & 0xF) == ADC_TRIGGER_PWM0) ||
517  ((ui32Trigger & 0xF) == ADC_TRIGGER_PWM1) ||
518  ((ui32Trigger & 0xF) == ADC_TRIGGER_PWM2) ||
519  ((ui32Trigger & 0xF) == ADC_TRIGGER_PWM3) ||
520  ((ui32Trigger & 0xF) == ADC_TRIGGER_ALWAYS) ||
521  ((ui32Trigger & 0x30) == ADC_TRIGGER_PWM_MOD0) ||
522  ((ui32Trigger & 0x30) == ADC_TRIGGER_PWM_MOD1));
523  ASSERT(ui32Priority < 4);
524 
525  //
526  // Compute the shift for the bits that control this sample sequence.
527  //
528  ui32SequenceNum *= 4;
529 
530  //
531  // Set the trigger event for this sample sequence.
532  //
533  HWREG(ui32Base + ADC_O_EMUX) = ((HWREG(ui32Base + ADC_O_EMUX) &
534  ~(0xf << ui32SequenceNum)) |
535  ((ui32Trigger & 0xf) << ui32SequenceNum));
536 
537  //
538  // Set the priority for this sample sequence.
539  //
540  HWREG(ui32Base + ADC_O_SSPRI) = ((HWREG(ui32Base + ADC_O_SSPRI) &
541  ~(0xf << ui32SequenceNum)) |
542  ((ui32Priority & 0x3) <<
543  ui32SequenceNum));
544 
545  //
546  // Set the source PWM module for this sequence's PWM triggers.
547  //
548  ui32SequenceNum *= 2;
549  HWREG(ui32Base + ADC_O_TSSEL) = ((HWREG(ui32Base + ADC_O_TSSEL) &
550  ~(0x30 << ui32SequenceNum)) |
551  ((ui32Trigger & 0x30) <<
552  ui32SequenceNum));
553 }
554 
555 //*****************************************************************************
556 //
602 //
603 //*****************************************************************************
604 void
605 ADCSequenceStepConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum,
606  uint32_t ui32Step, uint32_t ui32Config)
607 {
608  uint32_t ui32Temp;
609 
610  //
611  // Check the arguments.
612  //
613  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
614  ASSERT(ui32SequenceNum < 4);
615  ASSERT(((ui32SequenceNum == 0) && (ui32Step < 8)) ||
616  ((ui32SequenceNum == 1) && (ui32Step < 4)) ||
617  ((ui32SequenceNum == 2) && (ui32Step < 4)) ||
618  ((ui32SequenceNum == 3) && (ui32Step < 1)));
619 
620  //
621  // Get the offset of the sequence to be configured.
622  //
623  ui32Base += ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum);
624 
625  //
626  // Compute the shift for the bits that control this step.
627  //
628  ui32Step *= 4;
629 
630  //
631  // Set the analog mux value for this step.
632  //
633  HWREG(ui32Base + ADC_SSMUX) = ((HWREG(ui32Base + ADC_SSMUX) &
634  ~(0x0000000f << ui32Step)) |
635  ((ui32Config & 0x0f) << ui32Step));
636 
637  //
638  // Set the upper bits of the analog mux value for this step.
639  //
640  HWREG(ui32Base + ADC_SSEMUX) = ((HWREG(ui32Base + ADC_SSEMUX) &
641  ~(0x0000000f << ui32Step)) |
642  (((ui32Config & 0xf00) >> 8) << ui32Step));
643 
644  //
645  // Set the control value for this step.
646  //
647  HWREG(ui32Base + ADC_SSCTL) = ((HWREG(ui32Base + ADC_SSCTL) &
648  ~(0x0000000f << ui32Step)) |
649  (((ui32Config & 0xf0) >> 4) << ui32Step));
650 
651  //
652  // Set the sample and hold time for this step. This is not available on
653  // all devices, however on devices that do not support this feature these
654  // reserved bits are ignored on write access.
655  //
656  HWREG(ui32Base + ADC_SSTSH) = ((HWREG(ui32Base + ADC_SSTSH) &
657  ~(0x0000000f << ui32Step)) |
658  (((ui32Config & 0xf00000) >> 20) << ui32Step));
659 
660  //
661  // Enable digital comparator if specified in the ui32Config bit-fields.
662  //
663  if(ui32Config & 0x000F0000)
664  {
665  //
666  // Program the comparator for the specified step.
667  //
668  ui32Temp = HWREG(ui32Base + ADC_SSDC);
669  ui32Temp &= ~(0xF << ui32Step);
670  ui32Temp |= (((ui32Config & 0x00070000) >> 16) << ui32Step);
671  HWREG(ui32Base + ADC_SSDC) = ui32Temp;
672 
673  //
674  // Enable the comparator.
675  //
676  HWREG(ui32Base + ADC_SSOP) |= (1 << ui32Step);
677  }
678 
679  //
680  // Disable digital comparator if not specified.
681  //
682  else
683  {
684  HWREG(ui32Base + ADC_SSOP) &= ~(1 << ui32Step);
685  }
686 }
687 
688 //*****************************************************************************
689 //
701 //
702 //*****************************************************************************
703 int32_t
704 ADCSequenceOverflow(uint32_t ui32Base, uint32_t ui32SequenceNum)
705 {
706  //
707  // Check the arguments.
708  //
709  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
710  ASSERT(ui32SequenceNum < 4);
711 
712  //
713  // Determine if there was an overflow on this sequence.
714  //
715  return(HWREG(ui32Base + ADC_O_OSTAT) & (1 << ui32SequenceNum));
716 }
717 
718 //*****************************************************************************
719 //
730 //
731 //*****************************************************************************
732 void
733 ADCSequenceOverflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
734 {
735  //
736  // Check the arguments.
737  //
738  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
739  ASSERT(ui32SequenceNum < 4);
740 
741  //
742  // Clear the overflow condition for this sequence.
743  //
744  HWREG(ui32Base + ADC_O_OSTAT) = 1 << ui32SequenceNum;
745 }
746 
747 //*****************************************************************************
748 //
759 //
760 //*****************************************************************************
761 int32_t
762 ADCSequenceUnderflow(uint32_t ui32Base, uint32_t ui32SequenceNum)
763 {
764  //
765  // Check the arguments.
766  //
767  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
768  ASSERT(ui32SequenceNum < 4);
769 
770  //
771  // Determine if there was an underflow on this sequence.
772  //
773  return(HWREG(ui32Base + ADC_O_USTAT) & (1 << ui32SequenceNum));
774 }
775 
776 //*****************************************************************************
777 //
788 //
789 //*****************************************************************************
790 void
791 ADCSequenceUnderflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
792 {
793  //
794  // Check the arguments.
795  //
796  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
797  ASSERT(ui32SequenceNum < 4);
798 
799  //
800  // Clear the underflow condition for this sequence.
801  //
802  HWREG(ui32Base + ADC_O_USTAT) = 1 << ui32SequenceNum;
803 }
804 
805 //*****************************************************************************
806 //
821 //
822 //*****************************************************************************
823 int32_t
824 ADCSequenceDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum,
825  uint32_t *pui32Buffer)
826 {
827  uint32_t ui32Count;
828 
829  //
830  // Check the arguments.
831  //
832  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
833  ASSERT(ui32SequenceNum < 4);
834 
835  //
836  // Get the offset of the sequence to be read.
837  //
838  ui32Base += ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum);
839 
840  //
841  // Read samples from the FIFO until it is empty.
842  //
843  ui32Count = 0;
844  while(!(HWREG(ui32Base + ADC_SSFSTAT) & ADC_SSFSTAT0_EMPTY) &&
845  (ui32Count < 8))
846  {
847  //
848  // Read the FIFO and copy it to the destination.
849  //
850  *pui32Buffer++ = HWREG(ui32Base + ADC_SSFIFO);
851 
852  //
853  // Increment the count of samples read.
854  //
855  ui32Count++;
856  }
857 
858  //
859  // Return the number of samples read.
860  //
861  return(ui32Count);
862 }
863 
864 //*****************************************************************************
865 //
881 //
882 //*****************************************************************************
883 void
884 ADCProcessorTrigger(uint32_t ui32Base, uint32_t ui32SequenceNum)
885 {
886  //
887  // Check the arguments.
888  //
889  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
890  ASSERT(ui32SequenceNum < 4);
891 
892  //
893  // Generate a processor trigger for this sample sequence.
894  //
895  HWREG(ui32Base + ADC_O_PSSI) |= ((ui32SequenceNum & 0xffff0000) |
896  (1 << (ui32SequenceNum & 0xf)));
897 }
898 
899 //*****************************************************************************
900 //
920 //
921 //*****************************************************************************
922 void
923 ADCSoftwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum,
924  uint32_t ui32Factor)
925 {
926  uint32_t ui32Value;
927 
928  //
929  // Check the arguments.
930  //
931  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
932  ASSERT(ui32SequenceNum < 3);
933  ASSERT(((ui32Factor == 2) || (ui32Factor == 4) || (ui32Factor == 8)) &&
934  ((ui32SequenceNum == 0) || (ui32Factor != 8)));
935 
936  //
937  // Convert the oversampling factor to a shift factor.
938  //
939  for(ui32Value = 0, ui32Factor >>= 1; ui32Factor;
940  ui32Value++, ui32Factor >>= 1)
941  {
942  }
943 
944  //
945  // Save the shift factor.
946  //
947  g_pui8OversampleFactor[ui32SequenceNum] = ui32Value;
948 }
949 
950 //*****************************************************************************
951 //
965 //
966 //*****************************************************************************
967 void
968 ADCSoftwareOversampleStepConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum,
969  uint32_t ui32Step, uint32_t ui32Config)
970 {
971  //
972  // Check the arguments.
973  //
974  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
975  ASSERT(ui32SequenceNum < 3);
976  ASSERT(((ui32SequenceNum == 0) &&
977  (ui32Step < (8 >> g_pui8OversampleFactor[ui32SequenceNum]))) ||
978  (ui32Step < (4 >> g_pui8OversampleFactor[ui32SequenceNum])));
979 
980  //
981  // Get the offset of the sequence to be configured.
982  //
983  ui32Base += ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum);
984 
985  //
986  // Compute the shift for the bits that control this step.
987  //
988  ui32Step *= 4 << g_pui8OversampleFactor[ui32SequenceNum];
989 
990  //
991  // Loop through the hardware steps that make up this step of the software
992  // oversampled sequence.
993  //
994  for(ui32SequenceNum = 1 << g_pui8OversampleFactor[ui32SequenceNum];
995  ui32SequenceNum; ui32SequenceNum--)
996  {
997  //
998  // Set the analog mux value for this step.
999  //
1000  HWREG(ui32Base + ADC_SSMUX) = ((HWREG(ui32Base + ADC_SSMUX) &
1001  ~(0x0000000f << ui32Step)) |
1002  ((ui32Config & 0x0f) << ui32Step));
1003 
1004  //
1005  // Set the upper bits of the analog mux value for this step.
1006  //
1007  HWREG(ui32Base + ADC_SSEMUX) = ((HWREG(ui32Base + ADC_SSEMUX) &
1008  ~(0x0000000f << ui32Step)) |
1009  (((ui32Config & 0xf00) >> 8) <<
1010  ui32Step));
1011 
1012  //
1013  // Set the control value for this step.
1014  //
1015  HWREG(ui32Base + ADC_SSCTL) = ((HWREG(ui32Base + ADC_SSCTL) &
1016  ~(0x0000000f << ui32Step)) |
1017  (((ui32Config & 0xf0) >> 4) <<
1018  ui32Step));
1019  if(ui32SequenceNum != 1)
1020  {
1021  HWREG(ui32Base + ADC_SSCTL) &= ~((ADC_SSCTL0_IE0 |
1022  ADC_SSCTL0_END0) << ui32Step);
1023  }
1024 
1025  //
1026  // Go to the next hardware step.
1027  //
1028  ui32Step += 4;
1029  }
1030 }
1031 
1032 //*****************************************************************************
1033 //
1050 //
1051 //*****************************************************************************
1052 void
1053 ADCSoftwareOversampleDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum,
1054  uint32_t *pui32Buffer, uint32_t ui32Count)
1055 {
1056  uint32_t ui32Idx, ui32Accum;
1057 
1058  //
1059  // Check the arguments.
1060  //
1061  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1062  ASSERT(ui32SequenceNum < 3);
1063  ASSERT(((ui32SequenceNum == 0) &&
1064  (ui32Count < (8 >> g_pui8OversampleFactor[ui32SequenceNum]))) ||
1065  (ui32Count < (4 >> g_pui8OversampleFactor[ui32SequenceNum])));
1066 
1067  //
1068  // Get the offset of the sequence to be read.
1069  //
1070  ui32Base += ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum);
1071 
1072  //
1073  // Read the samples from the FIFO until it is empty.
1074  //
1075  while(ui32Count--)
1076  {
1077  //
1078  // Compute the sum of the samples.
1079  //
1080  ui32Accum = 0;
1081  for(ui32Idx = 1 << g_pui8OversampleFactor[ui32SequenceNum]; ui32Idx;
1082  ui32Idx--)
1083  {
1084  //
1085  // Read the FIFO and add it to the accumulator.
1086  //
1087  ui32Accum += HWREG(ui32Base + ADC_SSFIFO);
1088  }
1089 
1090  //
1091  // Write the averaged sample to the output buffer.
1092  //
1093  *pui32Buffer++ = ui32Accum >> g_pui8OversampleFactor[ui32SequenceNum];
1094  }
1095 }
1096 
1097 //*****************************************************************************
1098 //
1121 //
1122 //*****************************************************************************
1123 void
1124 ADCHardwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32Factor)
1125 {
1126  uint32_t ui32Value;
1127 
1128  //
1129  // Check the arguments.
1130  //
1131  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1132  ASSERT(((ui32Factor == 0) || (ui32Factor == 2) || (ui32Factor == 4) ||
1133  (ui32Factor == 8) || (ui32Factor == 16) || (ui32Factor == 32) ||
1134  (ui32Factor == 64)));
1135 
1136  //
1137  // Convert the oversampling factor to a shift factor.
1138  //
1139  for(ui32Value = 0, ui32Factor >>= 1; ui32Factor;
1140  ui32Value++, ui32Factor >>= 1)
1141  {
1142  }
1143 
1144  //
1145  // Write the shift factor to the ADC to configure the hardware oversampler.
1146  //
1147  HWREG(ui32Base + ADC_O_SAC) = ui32Value;
1148 }
1149 
1150 //*****************************************************************************
1151 //
1219 //
1220 //*****************************************************************************
1221 void
1222 ADCComparatorConfigure(uint32_t ui32Base, uint32_t ui32Comp,
1223  uint32_t ui32Config)
1224 {
1225  //
1226  // Check the arguments.
1227  //
1228  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1229  ASSERT(ui32Comp < 8);
1230 
1231  //
1232  // Save the new setting.
1233  //
1234  HWREG(ui32Base + ADC_O_DCCTL0 + (ui32Comp * 4)) = ui32Config;
1235 }
1236 
1237 //*****************************************************************************
1238 //
1255 //
1256 //*****************************************************************************
1257 void
1258 ADCComparatorRegionSet(uint32_t ui32Base, uint32_t ui32Comp,
1259  uint32_t ui32LowRef, uint32_t ui32HighRef)
1260 {
1261  //
1262  // Check the arguments.
1263  //
1264  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1265  ASSERT(ui32Comp < 8);
1266  ASSERT((ui32LowRef < 4096) && (ui32LowRef <= ui32HighRef));
1267  ASSERT(ui32HighRef < 4096);
1268 
1269  //
1270  // Save the new region settings.
1271  //
1272  HWREG(ui32Base + ADC_O_DCCMP0 + (ui32Comp * 4)) = ((ui32HighRef << 16) |
1273  ui32LowRef);
1274 }
1275 
1276 //*****************************************************************************
1277 //
1290 //
1291 //*****************************************************************************
1292 void
1293 ADCComparatorReset(uint32_t ui32Base, uint32_t ui32Comp, bool bTrigger,
1294  bool bInterrupt)
1295 {
1296  uint32_t ui32Temp;
1297 
1298  //
1299  // Check the arguments.
1300  //
1301  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1302  ASSERT(ui32Comp < 8);
1303 
1304  //
1305  // Set the appropriate bits to reset the trigger and/or interrupt
1306  // comparator conditions.
1307  //
1308  ui32Temp = 0;
1309  if(bTrigger)
1310  {
1311  ui32Temp |= (1 << (16 + ui32Comp));
1312  }
1313  if(bInterrupt)
1314  {
1315  ui32Temp |= (1 << ui32Comp);
1316  }
1317 
1318  HWREG(ui32Base + ADC_O_DCRIC) = ui32Temp;
1319 }
1320 
1321 //*****************************************************************************
1322 //
1331 //
1332 //*****************************************************************************
1333 void
1334 ADCComparatorIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
1335 {
1336  //
1337  // Check the arguments.
1338  //
1339  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1340  ASSERT(ui32SequenceNum < 4);
1341 
1342  //
1343  // Disable this sample sequence comparator interrupt.
1344  //
1345  HWREG(ui32Base + ADC_O_IM) &= ~(0x10000 << ui32SequenceNum);
1346 }
1347 
1348 //*****************************************************************************
1349 //
1358 //
1359 //*****************************************************************************
1360 void
1361 ADCComparatorIntEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
1362 {
1363  //
1364  // Check the arguments.
1365  //
1366  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1367  ASSERT(ui32SequenceNum < 4);
1368 
1369  //
1370  // Enable this sample sequence interrupt.
1371  //
1372  HWREG(ui32Base + ADC_O_IM) |= 0x10000 << ui32SequenceNum;
1373 }
1374 
1375 //*****************************************************************************
1376 //
1385 //
1386 //*****************************************************************************
1387 uint32_t
1388 ADCComparatorIntStatus(uint32_t ui32Base)
1389 {
1390  //
1391  // Check the arguments.
1392  //
1393  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1394 
1395  //
1396  // Return the digital comparator interrupt status.
1397  //
1398  return(HWREG(ui32Base + ADC_O_DCISC));
1399 }
1400 
1401 //*****************************************************************************
1402 //
1411 //
1412 //*****************************************************************************
1413 void
1414 ADCComparatorIntClear(uint32_t ui32Base, uint32_t ui32Status)
1415 {
1416  //
1417  // Check the arguments.
1418  //
1419  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1420 
1421  //
1422  // Clear the interrupt.
1423  //
1424  HWREG(ui32Base + ADC_O_DCISC) = ui32Status;
1425 }
1426 
1427 //*****************************************************************************
1428 //
1458 //
1459 //*****************************************************************************
1460 void
1461 ADCIntDisableEx(uint32_t ui32Base, uint32_t ui32IntFlags)
1462 {
1463  //
1464  // Check the arguments.
1465  //
1466  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1467 
1468  //
1469  // Disable the requested interrupts.
1470  //
1471  HWREG(ui32Base + ADC_O_IM) &= ~ui32IntFlags;
1472 }
1473 
1474 //*****************************************************************************
1475 //
1505 //
1506 //*****************************************************************************
1507 void
1508 ADCIntEnableEx(uint32_t ui32Base, uint32_t ui32IntFlags)
1509 {
1510  //
1511  // Check the arguments.
1512  //
1513  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1514 
1515  //
1516  // Enable the requested interrupts.
1517  //
1518  HWREG(ui32Base + ADC_O_IM) |= ui32IntFlags;
1519 }
1520 
1521 //*****************************************************************************
1522 //
1535 //
1536 //*****************************************************************************
1537 uint32_t
1538 ADCIntStatusEx(uint32_t ui32Base, bool bMasked)
1539 {
1540  uint32_t ui32Temp;
1541 
1542  //
1543  // Check the arguments.
1544  //
1545  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1546 
1547  //
1548  // Return either the masked interrupt status or the raw interrupt status as
1549  // requested.
1550  //
1551  if(bMasked)
1552  {
1553  ui32Temp = HWREG(ui32Base + ADC_O_ISC);
1554  }
1555  else
1556  {
1557  //
1558  // Read the Raw interrupt status to see if a digital comparator
1559  // interrupt is active.
1560  //
1561  ui32Temp = HWREG(ui32Base + ADC_O_RIS);
1562 
1563  //
1564  // Since, the raw interrupt status only indicates that any one of the
1565  // digital comparators caused an interrupt, if the raw interrupt status
1566  // is set then the return value is modified to indicate that all sample
1567  // sequences have a pending digital comparator interrupt.
1568  // This is exactly how the hardware works so the return code is
1569  // modified to match this behavior.
1570  //
1571  if(ui32Temp & ADC_RIS_INRDC)
1572  {
1573  ui32Temp |= (ADC_INT_DCON_SS3 | ADC_INT_DCON_SS2 |
1575  }
1576  }
1577  return(ui32Temp);
1578 }
1579 
1580 //*****************************************************************************
1581 //
1603 //
1604 //*****************************************************************************
1605 void
1606 ADCIntClearEx(uint32_t ui32Base, uint32_t ui32IntFlags)
1607 {
1608  HWREG(ui32Base + ADC_O_ISC) |= ui32IntFlags;
1609 }
1610 
1611 //*****************************************************************************
1612 //
1631 //
1632 //*****************************************************************************
1633 void
1634 ADCReferenceSet(uint32_t ui32Base, uint32_t ui32Ref)
1635 {
1636  //
1637  // Check the arguments.
1638  //
1639  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1640  ASSERT((ui32Ref == ADC_REF_INT) || (ui32Ref == ADC_REF_EXT_3V) ||
1641  (ui32Ref == ADC_REF_EXT_1V));
1642 
1643  //
1644  // Set the reference.
1645  //
1646  HWREG(ui32Base + ADC_O_CTL) =
1647  (HWREG(ui32Base + ADC_O_CTL) & ~ADC_CTL_VREF_M) | ui32Ref;
1648 }
1649 
1650 //*****************************************************************************
1651 //
1664 //
1665 //*****************************************************************************
1666 uint32_t
1667 ADCReferenceGet(uint32_t ui32Base)
1668 {
1669  //
1670  // Check the arguments.
1671  //
1672  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1673 
1674  //
1675  // Return the value of the reference.
1676  //
1677  return(HWREG(ui32Base + ADC_O_CTL) & ADC_CTL_VREF_M);
1678 }
1679 
1680 //*****************************************************************************
1681 //
1704 //
1705 //*****************************************************************************
1706 void
1707 ADCPhaseDelaySet(uint32_t ui32Base, uint32_t ui32Phase)
1708 {
1709  //
1710  // Check the arguments.
1711  //
1712  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1713  ASSERT((ui32Phase == ADC_PHASE_0) || (ui32Phase == ADC_PHASE_22_5) ||
1714  (ui32Phase == ADC_PHASE_45) || (ui32Phase == ADC_PHASE_67_5) ||
1715  (ui32Phase == ADC_PHASE_90) || (ui32Phase == ADC_PHASE_112_5) ||
1716  (ui32Phase == ADC_PHASE_135) || (ui32Phase == ADC_PHASE_157_5) ||
1717  (ui32Phase == ADC_PHASE_180) || (ui32Phase == ADC_PHASE_202_5) ||
1718  (ui32Phase == ADC_PHASE_225) || (ui32Phase == ADC_PHASE_247_5) ||
1719  (ui32Phase == ADC_PHASE_270) || (ui32Phase == ADC_PHASE_292_5) ||
1720  (ui32Phase == ADC_PHASE_315) || (ui32Phase == ADC_PHASE_337_5));
1721 
1722  //
1723  // Set the phase delay.
1724  //
1725  HWREG(ui32Base + ADC_O_SPC) = ui32Phase;
1726 }
1727 
1728 //*****************************************************************************
1729 //
1742 //
1743 //*****************************************************************************
1744 uint32_t
1745 ADCPhaseDelayGet(uint32_t ui32Base)
1746 {
1747  //
1748  // Check the arguments.
1749  //
1750  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1751 
1752  //
1753  // Return the phase delay.
1754  //
1755  return(HWREG(ui32Base + ADC_O_SPC));
1756 }
1757 
1758 //*****************************************************************************
1759 //
1769 //
1770 //*****************************************************************************
1771 void
1772 ADCSequenceDMAEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
1773 {
1774  //
1775  // Check the arguments.
1776  //
1777  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1778  ASSERT(ui32SequenceNum < 4);
1779 
1780  //
1781  // Enable the DMA on the specified sequencer.
1782  //
1783  HWREG(ui32Base + ADC_O_ACTSS) |= 0x100 << ui32SequenceNum;
1784 }
1785 
1786 //*****************************************************************************
1787 //
1796 //
1797 //*****************************************************************************
1798 void
1799 ADCSequenceDMADisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
1800 {
1801  //
1802  // Check the arguments.
1803  //
1804  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1805  ASSERT(ui32SequenceNum < 4);
1806 
1807  //
1808  // Disable the DMA on the specified sequencer.
1809  //
1810  HWREG(ui32Base + ADC_O_ACTSS) &= ~(0x100 << ui32SequenceNum);
1811 }
1812 
1813 //*****************************************************************************
1814 //
1831 //
1832 //*****************************************************************************
1833 bool
1834 ADCBusy(uint32_t ui32Base)
1835 {
1836  //
1837  // Check the argument.
1838  //
1839  ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
1840 
1841  //
1842  // Determine if the ADC is busy.
1843  //
1844  return((HWREG(ui32Base + ADC_O_ACTSS) & ADC_ACTSS_BUSY) ? true : false);
1845 }
1846 
1847 //*****************************************************************************
1848 //
1913 //
1914 //*****************************************************************************
1915 void
1916 ADCClockConfigSet(uint32_t ui32Base, uint32_t ui32Config,
1917  uint32_t ui32ClockDiv)
1918 {
1919  //
1920  // Check the argument.
1921  //
1922  ASSERT(ui32Base == ADC0_BASE);
1923 
1924  //
1925  // A rate must be supplied.
1926  //
1927  ASSERT((ui32Config & ADC_CLOCK_RATE_FULL) != 0);
1928 
1929  //
1930  // Clock must be valid divider.
1931  //
1932  ASSERT(((ui32ClockDiv - 1) & ~ADC_CC_CLKDIV_M) == 0);
1933 
1934  //
1935  // Write the sample conversion rate.
1936  //
1937  HWREG(ui32Base + ADC_O_PC) = (ui32Config >> 4) & ADC_PC_SR_M;
1938 
1939  //
1940  // Write the clock select and divider.
1941  //
1942  HWREG(ui32Base + ADC_O_CC) = (ui32Config & ADC_CC_CS_M) |
1943  (((ui32ClockDiv - 1) << ADC_CC_CLKDIV_S)) ;
1944 }
1945 
1946 //*****************************************************************************
1947 //
1975 //
1976 //*****************************************************************************
1977 uint32_t
1978 ADCClockConfigGet(uint32_t ui32Base, uint32_t *pui32ClockDiv)
1979 {
1980  uint32_t ui32Config;
1981 
1982  //
1983  // Check the argument.
1984  //
1985  ASSERT(ui32Base == ADC0_BASE);
1986 
1987  //
1988  // Read the current configuration.
1989  //
1990  ui32Config = HWREG(ui32Base + ADC_O_CC);
1991 
1992  //
1993  // If the clock divider was requested provide the current value.
1994  //
1995  if(pui32ClockDiv)
1996  {
1997  *pui32ClockDiv =
1998  ((ui32Config & ADC_CC_CLKDIV_M) >> ADC_CC_CLKDIV_S) + 1;
1999  }
2000 
2001  //
2002  // Clear out the divider bits.
2003  //
2004  ui32Config &= ~ADC_CC_CLKDIV_M;
2005 
2006  //
2007  // Add in the sample interval to the configuration.
2008  //
2009  ui32Config = (HWREG(ui32Base + ADC_O_PC) & ADC_PC_SR_M) << 4;
2010 
2011  return(ui32Config);
2012 }
2013 
2014 //*****************************************************************************
2015 //
2016 // Close the Doxygen group.
2018 //
2019 //*****************************************************************************
#define ADC_SSDC
Definition: adc.c:72
void ADCReferenceSet(uint32_t ui32Base, uint32_t ui32Ref)
Definition: adc.c:1634
#define ADC_SSOP
Definition: adc.c:71
void ADCSequenceUnderflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:791
#define ADC_PHASE_225
Definition: adc.h:195
#define ADC_O_OSTAT
Definition: hw_adc.h:52
#define ADC_O_IM
Definition: hw_adc.h:50
void ADCComparatorIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:1334
#define INT_ADC0SS0_TM4C123
Definition: hw_ints.h:78
#define ADC_SSTSH
Definition: adc.c:73
void ADCIntRegister(uint32_t ui32Base, uint32_t ui32SequenceNum, void(*pfnHandler)(void))
Definition: adc.c:148
#define ADC_O_RIS
Definition: hw_adc.h:49
#define ADC_SSCTL
Definition: adc.c:68
void ADCIntClearEx(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: adc.c:1606
#define ADC_RIS_INRDC
Definition: hw_adc.h:162
#define ADC_O_CC
Definition: hw_adc.h:140
uint32_t ADCClockConfigGet(uint32_t ui32Base, uint32_t *pui32ClockDiv)
Definition: adc.c:1978
uint32_t ADCReferenceGet(uint32_t ui32Base)
Definition: adc.c:1667
#define HWREG(x)
Definition: hw_types.h:48
#define ADC_O_TSSEL
Definition: hw_adc.h:55
void ADCComparatorConfigure(uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32Config)
Definition: adc.c:1222
#define ADC_PHASE_90
Definition: adc.h:189
#define ADC1_BASE
Definition: hw_memmap.h:90
#define ADC_CC_CLKDIV_S
Definition: hw_adc.h:1305
bool ADCBusy(uint32_t ui32Base)
Definition: adc.c:1834
#define ADC_PHASE_0
Definition: adc.h:185
#define ADC_O_CTL
Definition: hw_adc.h:63
void ADCSequenceDMADisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:1799
#define ADC_ACTSS_BUSY
Definition: hw_adc.h:147
#define ADC_PHASE_22_5
Definition: adc.h:186
#define ADC_REF_EXT_3V
Definition: adc.h:208
#define ADC_SSMUX
Definition: adc.c:66
int32_t ADCSequenceUnderflow(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:762
#define ADC_PHASE_247_5
Definition: adc.h:196
#define ADC_SSCTL0_IE0
Definition: hw_adc.h:486
#define ASSERT(expr)
Definition: debug.h:67
void ADCSequenceDMAEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:1772
#define ADC_PHASE_67_5
Definition: adc.h:188
uint32_t ADCIntStatus(uint32_t ui32Base, uint32_t ui32SequenceNum, bool bMasked)
Definition: adc.c:299
#define ADC_PHASE_270
Definition: adc.h:197
#define ADC_INT_DCON_SS0
Definition: adc.h:225
#define ADC_INT_DCON_SS3
Definition: adc.h:228
void ADCIntEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:263
void ADCSequenceOverflowClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:733
#define INT_ADC1SS0_TM4C129
Definition: hw_ints.h:222
uint32_t ADCIntStatusEx(uint32_t ui32Base, bool bMasked)
Definition: adc.c:1538
void ADCIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:234
#define ADC_SSCTL0_END0
Definition: hw_adc.h:487
#define ADC_TRIGGER_PWM_MOD1
Definition: adc.h:73
#define ADC_CLOCK_RATE_FULL
Definition: adc.h:235
static uint_fast8_t _ADCIntNumberGet(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:99
#define ADC_O_SSPRI
Definition: hw_adc.h:56
void ADCHardwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32Factor)
Definition: adc.c:1124
#define ADC_TRIGGER_COMP1
Definition: adc.h:62
void ADCSoftwareOversampleDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer, uint32_t ui32Count)
Definition: adc.c:1053
#define ADC_TRIGGER_PWM0
Definition: adc.h:66
void ADCSoftwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor)
Definition: adc.c:923
#define ADC_REF_EXT_1V
Definition: adc.h:209
#define ADC_CC_CLKDIV_M
Definition: hw_adc.h:1300
#define ADC0_BASE
Definition: hw_memmap.h:89
int32_t ADCSequenceOverflow(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:704
void ADCComparatorReset(uint32_t ui32Base, uint32_t ui32Comp, bool bTrigger, bool bInterrupt)
Definition: adc.c:1293
#define ADC_TRIGGER_PWM2
Definition: adc.h:68
#define ADC_O_PSSI
Definition: hw_adc.h:58
int32_t ADCSequenceDataGet(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t *pui32Buffer)
Definition: adc.c:824
#define ADC_PHASE_337_5
Definition: adc.h:200
#define ADC_TRIGGER_PROCESSOR
Definition: adc.h:60
#define ADC_PHASE_135
Definition: adc.h:191
#define ADC_TRIGGER_PWM3
Definition: adc.h:69
void ADCComparatorIntClear(uint32_t ui32Base, uint32_t ui32Status)
Definition: adc.c:1414
#define ADC_TRIGGER_COMP2
Definition: adc.h:63
#define ADC_O_ACTSS
Definition: hw_adc.h:48
#define ADC_PHASE_157_5
Definition: adc.h:192
#define ADC_O_DCCMP0
Definition: hw_adc.h:130
#define ADC_TRIGGER_COMP0
Definition: adc.h:61
#define ADC_PHASE_315
Definition: adc.h:199
#define ADC_CC_CS_M
Definition: hw_adc.h:1301
#define INT_ADC0SS0_TM4C129
Definition: hw_ints.h:190
void ADCSoftwareOversampleStepConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config)
Definition: adc.c:968
void ADCIntDisableEx(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: adc.c:1461
void ADCIntClear(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:363
#define ADC_CTL_VREF_M
Definition: hw_adc.h:416
#define ADC_O_DCCTL0
Definition: hw_adc.h:122
#define CLASS_IS_TM4C123
Definition: hw_types.h:93
void ADCClockConfigSet(uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32ClockDiv)
Definition: adc.c:1916
void ADCSequenceEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:391
#define ADC_SSEMUX
Definition: adc.c:67
void ADCSequenceDisable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:419
#define ADC_O_SPC
Definition: hw_adc.h:57
#define ADC_O_DCISC
Definition: hw_adc.h:61
#define ADC_PHASE_202_5
Definition: adc.h:194
#define ADC_O_EMUX
Definition: hw_adc.h:53
#define ADC_SSFIFO
Definition: adc.c:69
#define ADC_O_PC
Definition: hw_adc.h:139
uint32_t ADCComparatorIntStatus(uint32_t ui32Base)
Definition: adc.c:1388
#define ADC_SSFSTAT
Definition: adc.c:70
#define ADC_TRIGGER_TIMER
Definition: adc.h:65
#define ADC_O_SAC
Definition: hw_adc.h:60
void IntUnregister(uint32_t ui32Interrupt)
Definition: interrupt.c:381
void ADCSequenceConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Trigger, uint32_t ui32Priority)
Definition: adc.c:502
#define ADC_TRIGGER_ALWAYS
Definition: adc.h:71
#define ADC_INT_DCON_SS2
Definition: adc.h:227
static uint8_t g_pui8OversampleFactor[3]
Definition: adc.c:81
#define ADC_SSFSTAT0_EMPTY
Definition: hw_adc.h:505
#define ADC_O_DCRIC
Definition: hw_adc.h:120
#define ADC_O_ISC
Definition: hw_adc.h:51
uint32_t ADCPhaseDelayGet(uint32_t ui32Base)
Definition: adc.c:1745
#define ADC_TRIGGER_PWM1
Definition: adc.h:67
void ADCSequenceStepConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Step, uint32_t ui32Config)
Definition: adc.c:605
#define ADC_PHASE_292_5
Definition: adc.h:198
#define ADC_PC_SR_M
Definition: hw_adc.h:1271
void ADCPhaseDelaySet(uint32_t ui32Base, uint32_t ui32Phase)
Definition: adc.c:1707
#define CLASS_IS_TM4C129
Definition: hw_types.h:99
void ADCProcessorTrigger(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:884
#define ADC_PHASE_112_5
Definition: adc.h:190
void ADCComparatorIntEnable(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:1361
#define ADC_TRIGGER_PWM_MOD0
Definition: adc.h:72
#define ADC_PHASE_180
Definition: adc.h:193
#define ADC_TRIGGER_EXTERNAL
Definition: adc.h:64
#define ADC_REF_INT
Definition: adc.h:207
#define ADC_SEQ
Definition: adc.c:64
void ADCComparatorRegionSet(uint32_t ui32Base, uint32_t ui32Comp, uint32_t ui32LowRef, uint32_t ui32HighRef)
Definition: adc.c:1258
#define ADC_INT_DCON_SS1
Definition: adc.h:226
void ADCIntEnableEx(uint32_t ui32Base, uint32_t ui32IntFlags)
Definition: adc.c:1508
void IntDisable(uint32_t ui32Interrupt)
Definition: interrupt.c:684
void ADCIntUnregister(uint32_t ui32Base, uint32_t ui32SequenceNum)
Definition: adc.c:194
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Definition: interrupt.c:309
void IntEnable(uint32_t ui32Interrupt)
Definition: interrupt.c:610
#define ADC_SEQ_STEP
Definition: adc.c:65
#define ADC_O_USTAT
Definition: hw_adc.h:54
#define ADC_PHASE_45
Definition: adc.h:187