adc.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //*****************************************************************************
  2. //
  3. // adc.h - ADC headers for using the ADC driver functions.
  4. //
  5. // Copyright (c) 2005-2009 Luminary Micro, Inc. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  9. // exclusively on LMI's microcontroller products.
  10. //
  11. // The software is owned by LMI and/or its suppliers, and is protected under
  12. // applicable copyright laws. All rights are reserved. You may not combine
  13. // this software with "viral" open-source software in order to form a larger
  14. // program. Any use in violation of the foregoing restrictions may subject
  15. // the user to criminal sanctions under applicable laws, as well as to civil
  16. // liability for the breach of the terms and conditions of this license.
  17. //
  18. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  19. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  20. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  21. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  22. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  23. //
  24. // This is part of revision 4694 of the Stellaris Peripheral Driver Library.
  25. //
  26. //*****************************************************************************
  27. #ifndef __ADC_H__
  28. #define __ADC_H__
  29. //*****************************************************************************
  30. //
  31. // If building with a C++ compiler, make all of the definitions in this header
  32. // have a C binding.
  33. //
  34. //*****************************************************************************
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. //*****************************************************************************
  40. //
  41. // Values that can be passed to ADCSequenceConfigure as the ulTrigger
  42. // parameter.
  43. //
  44. //*****************************************************************************
  45. #define ADC_TRIGGER_PROCESSOR 0x00000000 // Processor event
  46. #define ADC_TRIGGER_COMP0 0x00000001 // Analog comparator 0 event
  47. #define ADC_TRIGGER_COMP1 0x00000002 // Analog comparator 1 event
  48. #define ADC_TRIGGER_COMP2 0x00000003 // Analog comparator 2 event
  49. #define ADC_TRIGGER_EXTERNAL 0x00000004 // External event
  50. #define ADC_TRIGGER_TIMER 0x00000005 // Timer event
  51. #define ADC_TRIGGER_PWM0 0x00000006 // PWM0 event
  52. #define ADC_TRIGGER_PWM1 0x00000007 // PWM1 event
  53. #define ADC_TRIGGER_PWM2 0x00000008 // PWM2 event
  54. #define ADC_TRIGGER_ALWAYS 0x0000000F // Always event
  55. //*****************************************************************************
  56. //
  57. // Values that can be passed to ADCSequenceStepConfigure as the ulConfig
  58. // parameter.
  59. //
  60. //*****************************************************************************
  61. #define ADC_CTL_TS 0x00000080 // Temperature sensor select
  62. #define ADC_CTL_IE 0x00000040 // Interrupt enable
  63. #define ADC_CTL_END 0x00000020 // Sequence end select
  64. #define ADC_CTL_D 0x00000010 // Differential select
  65. #define ADC_CTL_CH0 0x00000000 // Input channel 0
  66. #define ADC_CTL_CH1 0x00000001 // Input channel 1
  67. #define ADC_CTL_CH2 0x00000002 // Input channel 2
  68. #define ADC_CTL_CH3 0x00000003 // Input channel 3
  69. #define ADC_CTL_CH4 0x00000004 // Input channel 4
  70. #define ADC_CTL_CH5 0x00000005 // Input channel 5
  71. #define ADC_CTL_CH6 0x00000006 // Input channel 6
  72. #define ADC_CTL_CH7 0x00000007 // Input channel 7
  73. #define ADC_CTL_CH8 0x00000008 // Input channel 8
  74. #define ADC_CTL_CH9 0x00000009 // Input channel 9
  75. #define ADC_CTL_CH10 0x0000000A // Input channel 10
  76. #define ADC_CTL_CH11 0x0000000B // Input channel 11
  77. #define ADC_CTL_CH12 0x0000000C // Input channel 12
  78. #define ADC_CTL_CH13 0x0000000D // Input channel 13
  79. #define ADC_CTL_CH14 0x0000000E // Input channel 14
  80. #define ADC_CTL_CH15 0x0000000F // Input channel 15
  81. //*****************************************************************************
  82. //
  83. // Prototypes for the APIs.
  84. //
  85. //*****************************************************************************
  86. extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum,
  87. void (*pfnHandler)(void));
  88. extern void ADCIntUnregister(unsigned long ulBase,
  89. unsigned long ulSequenceNum);
  90. extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum);
  91. extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum);
  92. extern unsigned long ADCIntStatus(unsigned long ulBase,
  93. unsigned long ulSequenceNum,
  94. tBoolean bMasked);
  95. extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum);
  96. extern void ADCSequenceEnable(unsigned long ulBase,
  97. unsigned long ulSequenceNum);
  98. extern void ADCSequenceDisable(unsigned long ulBase,
  99. unsigned long ulSequenceNum);
  100. extern void ADCSequenceConfigure(unsigned long ulBase,
  101. unsigned long ulSequenceNum,
  102. unsigned long ulTrigger,
  103. unsigned long ulPriority);
  104. extern void ADCSequenceStepConfigure(unsigned long ulBase,
  105. unsigned long ulSequenceNum,
  106. unsigned long ulStep,
  107. unsigned long ulConfig);
  108. extern long ADCSequenceOverflow(unsigned long ulBase,
  109. unsigned long ulSequenceNum);
  110. extern void ADCSequenceOverflowClear(unsigned long ulBase,
  111. unsigned long ulSequenceNum);
  112. extern long ADCSequenceUnderflow(unsigned long ulBase,
  113. unsigned long ulSequenceNum);
  114. extern void ADCSequenceUnderflowClear(unsigned long ulBase,
  115. unsigned long ulSequenceNum);
  116. extern long ADCSequenceDataGet(unsigned long ulBase,
  117. unsigned long ulSequenceNum,
  118. unsigned long *pulBuffer);
  119. extern void ADCProcessorTrigger(unsigned long ulBase,
  120. unsigned long ulSequenceNum);
  121. extern void ADCSoftwareOversampleConfigure(unsigned long ulBase,
  122. unsigned long ulSequenceNum,
  123. unsigned long ulFactor);
  124. extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase,
  125. unsigned long ulSequenceNum,
  126. unsigned long ulStep,
  127. unsigned long ulConfig);
  128. extern void ADCSoftwareOversampleDataGet(unsigned long ulBase,
  129. unsigned long ulSequenceNum,
  130. unsigned long *pulBuffer,
  131. unsigned long ulCount);
  132. extern void ADCHardwareOversampleConfigure(unsigned long ulBase,
  133. unsigned long ulFactor);
  134. //*****************************************************************************
  135. //
  136. // Mark the end of the C bindings section for C++ compilers.
  137. //
  138. //*****************************************************************************
  139. #ifdef __cplusplus
  140. }
  141. #endif
  142. #endif // __ADC_H__