MSPM0G1X0X_G3X0X Driver Library  1.10.01.05
dl_dac12.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file dl_dac12.h
34  * @brief 12-bit DAC Driver Library
35  * @defgroup DAC12 Digital to Analog Converter (DAC12)
36  *
37  * @anchor ti_dl_dl_dac12_Overview
38  * # Overview
39  *
40  * The Digital to Analog Converter Driver Library allows full configuration of
41  * the MSPM0 DAC12 module. The DAC module is a 12-bit voltage-output
42  * digital-to-analog converter (DAC).
43  *
44  * <hr>
45  ******************************************************************************
46  */
50 #ifndef ti_dl_dl_dac12__include
51 #define ti_dl_dl_dac12__include
52 
53 #include <stdbool.h>
54 #include <stdint.h>
55 
56 #include <ti/devices/msp/msp.h>
57 #include <ti/driverlib/dl_common.h>
58 
59 #ifdef __MSPM0_HAS_DAC12__
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* clang-format off */
66 
68 typedef enum {
70  DL_DAC12_OUTPUT_DISABLED = DAC12_CTL1_OPS_NOC0,
72  DL_DAC12_OUTPUT_ENABLED = DAC12_CTL1_OPS_OUT0,
74 
76 typedef enum {
78  DL_DAC12_REPRESENTATION_BINARY = DAC12_CTL0_DFM_BINARY,
80  DL_DAC12_REPRESENTATION_TWOS_COMPLEMENT = DAC12_CTL0_DFM_TWOS_COMP,
82 
84 typedef enum {
86  DL_DAC12_RESOLUTION_12BIT = DAC12_CTL0_RES__12BITS,
88  DL_DAC12_RESOLUTION_8BIT = DAC12_CTL0_RES__8BITS,
90 
92 typedef enum {
94  DL_DAC12_AMP_OFF_TRISTATE = DAC12_CTL1_AMPHIZ_HIZ,
96  DL_DAC12_AMP_OFF_0V = DAC12_CTL1_AMPHIZ_PULLDOWN,
98  DL_DAC12_AMP_ON = DAC12_CTL1_AMPEN_ENABLE,
99 } DL_DAC12_AMP;
100 
102 typedef enum {
104  DL_DAC12_VREF_SOURCE_VDDA_VEREFN = (DAC12_CTL1_REFSP_VDDA |
105  DAC12_CTL1_REFSN_VEREFN) ,
107  DL_DAC12_VREF_SOURCE_VEREFP_VEREFN = (DAC12_CTL1_REFSP_VEREFP |
108  DAC12_CTL1_REFSN_VEREFN),
110  DL_DAC12_VREF_SOURCE_VDDA_VSSA = (DAC12_CTL1_REFSP_VDDA |
111  DAC12_CTL1_REFSN_VSSA),
113  DL_DAC12_VREF_SOURCE_VEREFP_VSSA = (DAC12_CTL1_REFSP_VEREFP |
114  DAC12_CTL1_REFSN_VSSA),
116 
118 typedef enum {
120  DL_DAC12_SAMPLETIMER_DISABLE = DAC12_CTL3_STIMEN_CLR,
122  DL_DAC12_SAMPLETIMER_ENABLE = DAC12_CTL3_STIMEN_SET,
124 
125 
127 typedef enum {
129  DL_DAC12_SAMPLES_PER_SECOND_500 = DAC12_CTL3_STIMCONFIG__500SPS,
131  DL_DAC12_SAMPLES_PER_SECOND_1K = DAC12_CTL3_STIMCONFIG__1KSPS,
133  DL_DAC12_SAMPLES_PER_SECOND_2K = DAC12_CTL3_STIMCONFIG__2KSPS,
135  DL_DAC12_SAMPLES_PER_SECOND_4K = DAC12_CTL3_STIMCONFIG__4KSPS,
137  DL_DAC12_SAMPLES_PER_SECOND_8K = DAC12_CTL3_STIMCONFIG__8KSPS,
139  DL_DAC12_SAMPLES_PER_SECOND_16K = DAC12_CTL3_STIMCONFIG__16KSPS,
141  DL_DAC12_SAMPLES_PER_SECOND_100K = DAC12_CTL3_STIMCONFIG__100KSPS,
143  DL_DAC12_SAMPLES_PER_SECOND_200K = DAC12_CTL3_STIMCONFIG__200KSPS,
145  DL_DAC12_SAMPLES_PER_SECOND_500K = DAC12_CTL3_STIMCONFIG__500KSPS,
147  DL_DAC12_SAMPLES_PER_SECOND_1M = DAC12_CTL3_STIMCONFIG__1MSPS,
149 
151 typedef enum {
153  DL_DAC12_FIFO_DISABLED = DAC12_CTL2_FIFOEN_CLR,
155  DL_DAC12_FIFO_ENABLED = DAC12_CTL2_FIFOEN_SET,
156 } DL_DAC12_FIFO;
157 
158 
160 typedef enum {
162  DL_DAC12_FIFO_THRESHOLD_ONE_QTR_EMPTY = DAC12_CTL2_FIFOTH_LOW,
164  DL_DAC12_FIFO_THRESHOLD_TWO_QTRS_EMPTY = DAC12_CTL2_FIFOTH_MED,
168 
170 typedef enum {
172  DL_DAC12_FIFO_TRIGGER_SAMPLETIMER = DAC12_CTL2_FIFOTRIGSEL_STIM,
174  DL_DAC12_FIFO_TRIGGER_HWTRIG0 = DAC12_CTL2_FIFOTRIGSEL_TRIG0,
176 
178 typedef enum {
180  DL_DAC12_DMA_TRIGGER_DISABLED = DAC12_CTL2_DMATRIGEN_CLR,
182  DL_DAC12_DMA_TRIGGER_ENABLED = DAC12_CTL2_DMATRIGEN_SET,
184 
186 typedef enum {
187 
189  DL_DAC12_CALIBRATION_FACTORY = DAC12_CALCTL_CALSEL_FACTORYTRIM,
191  DL_DAC12_CALIBRATION_SELF = DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM,
192 
194 
202 #define DL_DAC12_INTERRUPT_MODULE_READY (DAC12_GEN_EVENT_IMASK_MODRDYIFG_SET)
203 
207 #define DL_DAC12_INTERRUPT_FIFO_EMPTY (DAC12_GEN_EVENT_IMASK_FIFOEMPTYIFG_SET)
208 
212 #define DL_DAC12_INTERRUPT_FIFO_THREE_QTRS_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO3B4IFG_SET)
213 
217 #define DL_DAC12_INTERRUPT_FIFO_TWO_QTRS_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO1B2IFG_SET)
218 
222 #define DL_DAC12_INTERRUPT_FIFO_ONE_QTR_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO1B4IFG_SET)
223 
227 #define DL_DAC12_INTERRUPT_FIFO_FULL (DAC12_GEN_EVENT_IMASK_FIFOFULLIFG_SET)
228 
233 #define DL_DAC12_INTERRUPT_FIFO_UNDERRUN (DAC12_GEN_EVENT_IMASK_FIFOURUNIFG_SET)
234 
245 #define DL_DAC12_INTERRUPT_DMA_DONE (DAC12_GEN_EVENT_IMASK_DMADONEIFG_SET)
246 
256 #define DL_DAC12_EVENT_MODULE_READY (DAC12_GEN_EVENT_IMASK_MODRDYIFG_SET)
257 
261 #define DL_DAC12_EVENT_FIFO_EMPTY (DAC12_GEN_EVENT_IMASK_FIFOEMPTYIFG_SET)
262 
266 #define DL_DAC12_EVENT_FIFO_THREE_QTRS_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO3B4IFG_SET)
267 
271 #define DL_DAC12_EVENT_FIFO_TWO_QTRS_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO1B2IFG_SET)
272 
276 #define DL_DAC12_EVENT_FIFO_ONE_QTR_EMPTY (DAC12_GEN_EVENT_IMASK_FIFO1B4IFG_SET)
277 
281 #define DL_DAC12_EVENT_FIFO_FULL (DAC12_GEN_EVENT_IMASK_FIFOFULLIFG_SET)
282 
287 #define DL_DAC12_EVENT_FIFO_UNDERRUN (DAC12_GEN_EVENT_IMASK_FIFOURUNIFG_SET)
288 
299 #define DL_DAC12_EVENT_DMA_DONE (DAC12_GEN_EVENT_IMASK_DMADONEIFG_SET)
300 
303 /* clang-format on */
304 
306 typedef enum {
308  DL_DAC12_IIDX_NO_INT = DAC12_CPU_INT_IIDX_STAT_NO_INTR,
310  DL_DAC12_IIDX_MODULE_READY = DAC12_CPU_INT_IIDX_STAT_MODRDYIFG,
312  DL_DAC12_IIDX_FIFO_FULL = DAC12_CPU_INT_IIDX_STAT_FIFOFULLIFG,
314  DL_DAC12_IIDX_FIFO_1_4_EMPTY = DAC12_CPU_INT_IIDX_STAT_FIFO1B4IFG,
316  DL_DAC12_IIDX_FIFO_1_2_EMPTY = DAC12_CPU_INT_IIDX_STAT_FIFO1B2IFG,
318  DL_DAC12_IIDX_FIFO_3_4_EMPTY = DAC12_CPU_INT_IIDX_STAT_FIFO3B4IFG,
320  DL_DAC12_IIDX_FIFO_EMPTY = DAC12_CPU_INT_IIDX_STAT_FIFOEMPTYIFG,
322  DL_DAC12_IIDX_FIFO_UNDERRUN = DAC12_CPU_INT_IIDX_STAT_FIFOURUNIFG,
324  DL_DAC12_IIDX_DMA_DONE = DAC12_CPU_INT_IIDX_STAT_DMADONEIFG
325 } DL_DAC12_IIDX;
326 
328 typedef enum {
332 
334 typedef enum {
338 
342 typedef struct {
344  DL_DAC12_OUTPUT outputEnable;
345 
347  DL_DAC12_RESOLUTION resolution;
348 
350  DL_DAC12_REPRESENTATION representation;
351 
354 
356  DL_DAC12_AMP amplifierSetting;
357 
359  DL_DAC12_FIFO fifoEnable;
360 
362  DL_DAC12_FIFO_TRIGGER fifoTriggerSource;
363 
368  DL_DAC12_DMA_TRIGGER dmaTriggerEnable;
369 
373  DL_DAC12_FIFO_THRESHOLD dmaTriggerThreshold;
374 
378  DL_DAC12_SAMPLETIMER sampleTimeGeneratorEnable;
379 
383  DL_DAC12_SAMPLES_PER_SECOND sampleRate;
385 
396 void DL_DAC12_init(DAC12_Regs *dac12, DL_DAC12_Config *config);
397 
403 __STATIC_INLINE void DL_DAC12_enablePower(DAC12_Regs *dac12)
404 {
405  dac12->GPRCM.PWREN =
406  (DAC12_PWREN_KEY_UNLOCK_W | DAC12_PWREN_ENABLE_ENABLE);
407 }
408 
414 __STATIC_INLINE void DL_DAC12_disablePower(DAC12_Regs *dac12)
415 {
416  dac12->GPRCM.PWREN =
417  (DAC12_PWREN_KEY_UNLOCK_W | DAC12_PWREN_ENABLE_DISABLE);
418 }
419 
428 __STATIC_INLINE bool DL_DAC12_isPowerEnabled(DAC12_Regs *dac12)
429 {
430  return ((dac12->GPRCM.PWREN & DAC12_PWREN_ENABLE_MASK) ==
431  DAC12_PWREN_ENABLE_ENABLE);
432 }
433 
439 __STATIC_INLINE void DL_DAC12_reset(DAC12_Regs *dac12)
440 {
441  dac12->GPRCM.RSTCTL =
442  (DAC12_RSTCTL_KEY_UNLOCK_W | DAC12_RSTCTL_RESETSTKYCLR_CLR |
443  DAC12_RSTCTL_RESETASSERT_ASSERT);
444 }
445 
455 __STATIC_INLINE bool DL_DAC12_isReset(DAC12_Regs *dac12)
456 {
457  return ((dac12->GPRCM.STAT & DAC12_STAT_RESETSTKY_MASK) ==
458  DAC12_STAT_RESETSTKY_RESET);
459 }
460 
466 __STATIC_INLINE void DL_DAC12_enable(DAC12_Regs *dac12)
467 {
468  dac12->CTL0 |= DAC12_CTL0_ENABLE_SET;
469 }
470 
476 __STATIC_INLINE void DL_DAC12_disable(DAC12_Regs *dac12)
477 {
478  dac12->CTL0 &= ~DAC12_CTL0_ENABLE_MASK;
479 }
480 
491 __STATIC_INLINE bool DL_DAC12_isEnabled(DAC12_Regs *dac12)
492 {
493  uint32_t t = (dac12->CTL0 & DAC12_CTL0_ENABLE_MASK);
494  return (t == DAC12_CTL0_ENABLE_SET);
495 }
496 
505 __STATIC_INLINE void DL_DAC12_configDataFormat(
506  DAC12_Regs *dac12, DL_DAC12_REPRESENTATION rep, DL_DAC12_RESOLUTION res)
507 {
508  DL_Common_updateReg(&dac12->CTL0, ((uint32_t) rep | (uint32_t) res),
509  DAC12_CTL0_RES_MASK | DAC12_CTL0_DFM_MASK);
510 }
511 
521 __STATIC_INLINE DL_DAC12_AMP DL_DAC12_getAmplifier(DAC12_Regs *dac12)
522 {
523  uint32_t ampVal =
524  (dac12->CTL1 & (DAC12_CTL1_AMPEN_MASK | DAC12_CTL1_AMPHIZ_MASK));
525 
526  return (DL_DAC12_AMP)(ampVal);
527 }
528 
535 __STATIC_INLINE void DL_DAC12_setAmplifier(
536  DAC12_Regs *dac12, DL_DAC12_AMP ampVal)
537 {
538  DL_Common_updateReg(&dac12->CTL1, (uint32_t) ampVal,
539  (DAC12_CTL1_AMPEN_MASK | DAC12_CTL1_AMPHIZ_MASK));
540 }
541 
552  DAC12_Regs *dac12)
553 {
554  uint32_t refsVal =
555  (dac12->CTL1 & (DAC12_CTL1_REFSP_MASK | DAC12_CTL1_REFSN_MASK));
556 
557  return (DL_DAC12_VREF_SOURCE)(refsVal);
558 }
559 
568  DAC12_Regs *dac12, DL_DAC12_VREF_SOURCE refsVal)
569 {
570  DL_Common_updateReg(&dac12->CTL1, (uint32_t) refsVal,
571  (DAC12_CTL1_REFSP_MASK | DAC12_CTL1_REFSN_MASK));
572 }
573 
579 __STATIC_INLINE void DL_DAC12_enableOutputPin(DAC12_Regs *dac12)
580 {
581  dac12->CTL1 |= DAC12_CTL1_OPS_OUT0;
582 }
583 
589 __STATIC_INLINE void DL_DAC12_disableOutputPin(DAC12_Regs *dac12)
590 {
591  dac12->CTL1 &= ~DAC12_CTL1_OPS_MASK;
592 }
593 
604 __STATIC_INLINE bool DL_DAC12_isOutputPinEnabled(DAC12_Regs *dac12)
605 {
606  return ((dac12->CTL1 & DAC12_CTL1_OPS_MASK) == DAC12_CTL1_OPS_OUT0);
607 }
608 
616 __STATIC_INLINE void DL_DAC12_enableFIFO(DAC12_Regs *dac12)
617 {
618  /* Insert value */
619  dac12->CTL2 |= DAC12_CTL2_FIFOEN_SET;
620 }
621 
629 __STATIC_INLINE void DL_DAC12_disableFIFO(DAC12_Regs *dac12)
630 {
631  /* Clear out the bit */
632  dac12->CTL2 &= ~DAC12_CTL2_FIFOEN_MASK;
633 }
634 
645 __STATIC_INLINE bool DL_DAC12_isFIFOEnabled(DAC12_Regs *dac12)
646 {
647  uint32_t t = (dac12->CTL2 & DAC12_CTL2_FIFOEN_MASK);
648  return (t == DAC12_CTL2_FIFOEN_SET);
649 }
650 
662 __STATIC_INLINE DL_DAC12_FIFO_THRESHOLD DL_DAC12_getFIFOThreshold(
663  DAC12_Regs *dac12)
664 {
665  uint32_t fifoThreshold = (dac12->CTL2 & DAC12_CTL2_FIFOTH_MASK);
666 
667  return (DL_DAC12_FIFO_THRESHOLD)(fifoThreshold);
668 }
669 
683 __STATIC_INLINE void DL_DAC12_setFIFOThreshold(
684  DAC12_Regs *dac12, DL_DAC12_FIFO_THRESHOLD fifoThreshold)
685 {
687  &dac12->CTL2, (uint32_t) fifoThreshold, DAC12_CTL2_FIFOTH_MASK);
688 }
689 
701 __STATIC_INLINE DL_DAC12_FIFO_TRIGGER DL_DAC12_getFIFOTriggerSource(
702  DAC12_Regs *dac12)
703 {
704  uint32_t fifoTrig = (dac12->CTL2 & DAC12_CTL2_FIFOTRIGSEL_MASK);
705 
706  return (DL_DAC12_FIFO_TRIGGER)(fifoTrig);
707 }
708 
720 __STATIC_INLINE void DL_DAC12_setFIFOTriggerSource(
721  DAC12_Regs *dac12, DL_DAC12_FIFO_TRIGGER fifoTrig)
722 {
724  &dac12->CTL2, (uint32_t) fifoTrig, DAC12_CTL2_FIFOTRIGSEL_MASK);
725 }
726 
740 __STATIC_INLINE void DL_DAC12_enableDMATrigger(DAC12_Regs *dac12)
741 {
742  /* Insert value */
743  dac12->CTL2 |= DAC12_CTL2_DMATRIGEN_SET;
744 }
745 
753 __STATIC_INLINE void DL_DAC12_disableDMATrigger(DAC12_Regs *dac12)
754 {
755  /* Clear out the bit */
756  dac12->CTL2 &= ~DAC12_CTL2_DMATRIGEN_MASK;
757 }
758 
769 __STATIC_INLINE bool DL_DAC12_isDMATriggerEnabled(DAC12_Regs *dac12)
770 {
771  uint32_t t = (dac12->CTL2 & DAC12_CTL2_DMATRIGEN_MASK);
772  return (t == DAC12_CTL2_DMATRIGEN_SET);
773 }
774 
784 __STATIC_INLINE void DL_DAC12_enableSampleTimeGenerator(DAC12_Regs *dac12)
785 {
786  /* Insert value */
787  dac12->CTL3 |= DAC12_CTL3_STIMEN_SET;
788 }
789 
797 __STATIC_INLINE void DL_DAC12_disableSampleTimeGenerator(DAC12_Regs *dac12)
798 {
799  /* Clear out the bit */
800  dac12->CTL3 &= ~DAC12_CTL3_STIMEN_MASK;
801 }
802 
813 __STATIC_INLINE bool DL_DAC12_isSampleTimeGeneratorEnabled(DAC12_Regs *dac12)
814 {
815  uint32_t t = (dac12->CTL3 & DAC12_CTL3_STIMEN_MASK);
816  return (t == DAC12_CTL3_STIMEN_SET);
817 }
818 
828 __STATIC_INLINE DL_DAC12_SAMPLES_PER_SECOND DL_DAC12_getSampleRate(
829  DAC12_Regs *dac12)
830 {
831  uint32_t sampleRate = (dac12->CTL3 & DAC12_CTL3_STIMCONFIG_MASK);
832 
833  return (DL_DAC12_SAMPLES_PER_SECOND)(sampleRate);
834 }
835 
848 __STATIC_INLINE void DL_DAC12_setSampleRate(
849  DAC12_Regs *dac12, DL_DAC12_SAMPLES_PER_SECOND sampleRate)
850 {
852  &dac12->CTL3, (uint32_t) sampleRate, DAC12_CTL3_STIMCONFIG_MASK);
853 }
854 
867 __STATIC_INLINE bool DL_DAC12_isCalibrationRunning(DAC12_Regs *dac12)
868 {
869  uint32_t t = (dac12->CALCTL & DAC12_CALCTL_CALON_MASK);
870  return (t == DAC12_CALCTL_CALON_ACTIVE);
871 }
872 
893 __STATIC_INLINE void DL_DAC12_startCalibration(DAC12_Regs *dac12)
894 {
895  dac12->CALCTL =
896  (DAC12_CALCTL_CALON_ACTIVE | DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM);
897 }
898 
912 __STATIC_INLINE uint32_t DL_DAC12_getCalibrationData(DAC12_Regs *dac12)
913 {
914  return (dac12->CALDATA & DAC12_CALDATA_DATA_MASK);
915 }
916 
929 void DL_DAC12_performSelfCalibrationBlocking(DAC12_Regs *dac12);
930 
948 __STATIC_INLINE void DL_DAC12_output8(DAC12_Regs *dac12, uint8_t dataValue)
949 {
950  dac12->DATA0 = dataValue;
951 }
952 
970 __STATIC_INLINE void DL_DAC12_output12(DAC12_Regs *dac12, uint32_t dataValue)
971 {
972  dac12->DATA0 = (dataValue & DAC12_DATA0_DATA_VALUE_MASK);
973 }
974 
990 uint32_t DL_DAC12_fillFIFO8(
991  DAC12_Regs *dac12, uint8_t *buffer, uint32_t count);
992 
1008 uint32_t DL_DAC12_fillFIFO12(
1009  DAC12_Regs *dac12, uint16_t *buffer, uint32_t count);
1010 
1019 void DL_DAC12_outputBlocking8(DAC12_Regs *dac12, uint8_t data);
1020 
1029 void DL_DAC12_outputBlocking12(DAC12_Regs *dac12, uint16_t data);
1030 
1048 __STATIC_INLINE uint32_t DL_DAC12_getInterruptStatus(
1049  DAC12_Regs *dac12, uint32_t interruptMask)
1050 {
1051  return (dac12->CPU_INT.RIS & interruptMask);
1052 }
1053 
1065 __STATIC_INLINE void DL_DAC12_clearInterruptStatus(
1066  DAC12_Regs *dac12, uint32_t interruptMask)
1067 {
1068  dac12->CPU_INT.ICLR = interruptMask;
1069 }
1070 
1080 __STATIC_INLINE void DL_DAC12_enableInterrupt(
1081  DAC12_Regs *dac12, uint32_t interruptMask)
1082 {
1083  dac12->CPU_INT.IMASK |= interruptMask;
1084 }
1085 
1095 __STATIC_INLINE void DL_DAC12_disableInterrupt(
1096  DAC12_Regs *dac12, uint32_t interruptMask)
1097 {
1098  dac12->CPU_INT.IMASK &= ~interruptMask;
1099 }
1100 
1116 __STATIC_INLINE DL_DAC12_IIDX DL_DAC12_getPendingInterrupt(DAC12_Regs *dac12)
1117 {
1118  return ((DL_DAC12_IIDX) dac12->CPU_INT.IIDX);
1119 }
1120 
1134 __STATIC_INLINE bool DL_DAC12_isFIFOFull(DAC12_Regs *dac12)
1135 {
1136  uint32_t t =
1138  return (t == DL_DAC12_INTERRUPT_FIFO_FULL);
1139 }
1140 
1149 __STATIC_INLINE void DL_DAC12_setPublisherChanID(
1150  DAC12_Regs *dac12, uint8_t chanID)
1151 {
1152  dac12->FPUB_1 = (chanID & DAC12_FPUB_1_CHANID_MAXIMUM);
1153 }
1154 
1163 __STATIC_INLINE uint8_t DL_DAC12_getPublisherChanID(DAC12_Regs *dac12)
1164 {
1165  return ((uint8_t)((dac12->FPUB_1) & DAC12_FPUB_1_CHANID_MASK));
1166 }
1167 
1177 __STATIC_INLINE void DL_DAC12_setSubscriberChanID(
1178  DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index, uint8_t chanID)
1179 {
1180  volatile uint32_t *pReg = &dac12->FSUB_0;
1181 
1182  *(pReg + (uint32_t) index) = (chanID & DAC12_FSUB_0_CHANID_MAXIMUM);
1183 }
1184 
1194 __STATIC_INLINE uint8_t DL_DAC12_getSubscriberChanID(
1195  DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index)
1196 {
1197  volatile uint32_t *pReg = &dac12->FSUB_0;
1198 
1199  return ((uint8_t)(*(pReg + (uint32_t) index) & DAC12_FSUB_0_CHANID_MASK));
1200 }
1201 
1209 __STATIC_INLINE void DL_DAC12_enableEvent(
1210  DAC12_Regs *dac12, uint32_t eventMask)
1211 {
1212  dac12->GEN_EVENT.IMASK |= (eventMask);
1213 }
1214 
1222 __STATIC_INLINE void DL_DAC12_disableEvent(
1223  DAC12_Regs *dac12, uint32_t eventMask)
1224 {
1225  dac12->GEN_EVENT.IMASK &= ~(eventMask);
1226 }
1227 
1239 __STATIC_INLINE uint32_t DL_DAC12_getEnabledEvents(
1240  DAC12_Regs *dac12, uint32_t eventMask)
1241 {
1242  return ((dac12->GEN_EVENT.IMASK) & (eventMask));
1243 }
1244 
1261 __STATIC_INLINE uint32_t DL_DAC12_getEnabledEventStatus(
1262  DAC12_Regs *dac12, uint32_t eventMask)
1263 {
1264  return ((dac12->GEN_EVENT.MIS) & eventMask);
1265 }
1266 
1281 __STATIC_INLINE uint32_t DL_DAC12_getRawEventsStatus(
1282  DAC12_Regs *dac12, uint32_t eventMask)
1283 {
1284  return ((dac12->GEN_EVENT.RIS) & eventMask);
1285 }
1286 
1294 __STATIC_INLINE void DL_DAC12_clearEventsStatus(
1295  DAC12_Regs *dac12, uint32_t eventMask)
1296 {
1297  dac12->GEN_EVENT.ICLR |= (eventMask);
1298 }
1299 
1300 #ifdef __cplusplus
1301 }
1302 #endif
1303 #endif /* __MSPM0_HAS_DAC12__ */
1304 
1305 #endif /* ti_dl_dl_dac12__include */
1306 
DL_DAC12_REPRESENTATION representation
Definition: dl_dac12.h:350
Definition: dl_dac12.h:182
Definition: dl_dac12.h:153
__STATIC_INLINE void DL_Common_updateReg(volatile uint32_t *reg, uint32_t val, uint32_t mask)
Writes value to specified register - retaining bits unaffected by mask.
Definition: dl_common.h:63
__STATIC_INLINE DL_DAC12_FIFO_THRESHOLD DL_DAC12_getFIFOThreshold(DAC12_Regs *dac12)
Gets the FIFO threshold.
Definition: dl_dac12.h:662
DL_DAC12_AMP amplifierSetting
Definition: dl_dac12.h:356
__STATIC_INLINE bool DL_DAC12_isCalibrationRunning(DAC12_Regs *dac12)
Checks whether a calibration sequence is currently running.
Definition: dl_dac12.h:867
__STATIC_INLINE uint8_t DL_DAC12_getSubscriberChanID(DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index)
Gets the event subscriber channel id.
Definition: dl_dac12.h:1194
Definition: dl_dac12.h:129
__STATIC_INLINE DL_DAC12_FIFO_TRIGGER DL_DAC12_getFIFOTriggerSource(DAC12_Regs *dac12)
Gets the FIFO read trigger source.
Definition: dl_dac12.h:701
Definition: dl_dac12.h:312
DL_DAC12_FIFO
Definition: dl_dac12.h:151
__STATIC_INLINE uint32_t DL_DAC12_getRawEventsStatus(DAC12_Regs *dac12, uint32_t eventMask)
Check interrupt flag of any DAC event.
Definition: dl_dac12.h:1281
DL_DAC12_DMA_TRIGGER dmaTriggerEnable
Definition: dl_dac12.h:368
void DL_DAC12_outputBlocking8(DAC12_Regs *dac12, uint8_t data)
Blocking 8-bit output to the DAC FIFO.
Definition: dl_dac12.h:336
__STATIC_INLINE uint32_t DL_DAC12_getEnabledEventStatus(DAC12_Regs *dac12, uint32_t eventMask)
Check event flag of enabled DAC event.
Definition: dl_dac12.h:1261
DL_DAC12_SAMPLETIMER sampleTimeGeneratorEnable
Definition: dl_dac12.h:378
__STATIC_INLINE void DL_DAC12_setReferenceVoltageSource(DAC12_Regs *dac12, DL_DAC12_VREF_SOURCE refsVal)
Set the reference voltage source of the DAC.
Definition: dl_dac12.h:567
void DL_DAC12_outputBlocking12(DAC12_Regs *dac12, uint16_t data)
Blocking 12-bit output to the DAC FIFO.
__STATIC_INLINE void DL_DAC12_disableFIFO(DAC12_Regs *dac12)
Disables the FIFO.
Definition: dl_dac12.h:629
__STATIC_INLINE void DL_DAC12_enableEvent(DAC12_Regs *dac12, uint32_t eventMask)
Enable DAC event.
Definition: dl_dac12.h:1209
__STATIC_INLINE bool DL_DAC12_isSampleTimeGeneratorEnabled(DAC12_Regs *dac12)
Checks whether the sample time trigger generator is enabled.
Definition: dl_dac12.h:813
Definition: dl_dac12.h:145
DL_DAC12_OUTPUT outputEnable
Definition: dl_dac12.h:344
Configuration struct for DL_DAC12_init.
Definition: dl_dac12.h:342
Definition: dl_dac12.h:310
DL_DAC12_VREF_SOURCE voltageReferenceSource
Definition: dl_dac12.h:353
Definition: dl_dac12.h:143
Definition: dl_dac12.h:70
void DL_DAC12_performSelfCalibrationBlocking(DAC12_Regs *dac12)
Perform calibration sequence.
Definition: dl_dac12.h:78
Definition: dl_dac12.h:162
__STATIC_INLINE void DL_DAC12_enableSampleTimeGenerator(DAC12_Regs *dac12)
Enables the sample time generator.
Definition: dl_dac12.h:784
Definition: dl_dac12.h:86
__STATIC_INLINE void DL_DAC12_setPublisherChanID(DAC12_Regs *dac12, uint8_t chanID)
Sets the event publisher channel id.
Definition: dl_dac12.h:1149
Definition: dl_dac12.h:330
Definition: dl_dac12.h:324
__STATIC_INLINE uint8_t DL_DAC12_getPublisherChanID(DAC12_Regs *dac12)
Gets the event publisher channel id.
Definition: dl_dac12.h:1163
Definition: dl_dac12.h:96
__STATIC_INLINE void DL_DAC12_disablePower(DAC12_Regs *dac12)
Disables power on dac12 module.
Definition: dl_dac12.h:414
__STATIC_INLINE DL_DAC12_IIDX DL_DAC12_getPendingInterrupt(DAC12_Regs *dac12)
Gets the highest priority pending interrupt.
Definition: dl_dac12.h:1116
Definition: dl_dac12.h:122
Definition: dl_dac12.h:107
__STATIC_INLINE bool DL_DAC12_isFIFOEnabled(DAC12_Regs *dac12)
Checks whether the FIFO is enabled.
Definition: dl_dac12.h:645
__STATIC_INLINE void DL_DAC12_setSubscriberChanID(DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index, uint8_t chanID)
Sets the event subscriber channel id.
Definition: dl_dac12.h:1177
Definition: dl_dac12.h:141
__STATIC_INLINE void DL_DAC12_disableSampleTimeGenerator(DAC12_Regs *dac12)
Disables the sample time generator.
Definition: dl_dac12.h:797
__STATIC_INLINE void DL_DAC12_clearInterruptStatus(DAC12_Regs *dac12, uint32_t interruptMask)
Clears the interrupt status of one or more interrupts.
Definition: dl_dac12.h:1065
DriverLib Common APIs.
__STATIC_INLINE void DL_DAC12_reset(DAC12_Regs *dac12)
Resets dac12 peripheral.
Definition: dl_dac12.h:439
__STATIC_INLINE void DL_DAC12_startCalibration(DAC12_Regs *dac12)
Initiates the DAC offset error calibration sequence.
Definition: dl_dac12.h:893
__STATIC_INLINE void DL_DAC12_setFIFOTriggerSource(DAC12_Regs *dac12, DL_DAC12_FIFO_TRIGGER fifoTrig)
Sets the FIFO read trigger source.
Definition: dl_dac12.h:720
__STATIC_INLINE void DL_DAC12_disableInterrupt(DAC12_Regs *dac12, uint32_t interruptMask)
Disables one or more interrupts.
Definition: dl_dac12.h:1095
__STATIC_INLINE void DL_DAC12_setFIFOThreshold(DAC12_Regs *dac12, DL_DAC12_FIFO_THRESHOLD fifoThreshold)
Sets the FIFO threshold.
Definition: dl_dac12.h:683
Definition: dl_dac12.h:191
Definition: dl_dac12.h:318
__STATIC_INLINE uint32_t DL_DAC12_getCalibrationData(DAC12_Regs *dac12)
Gets the DAC Calibration offset.
Definition: dl_dac12.h:912
DL_DAC12_FIFO_THRESHOLD
Definition: dl_dac12.h:160
__STATIC_INLINE uint32_t DL_DAC12_getEnabledEvents(DAC12_Regs *dac12, uint32_t eventMask)
Check which DAC events are enabled.
Definition: dl_dac12.h:1239
DL_DAC12_EVENT_ROUTE
Definition: dl_dac12.h:334
Definition: dl_dac12.h:174
DL_DAC12_REPRESENTATION
Definition: dl_dac12.h:76
__STATIC_INLINE void DL_DAC12_enablePower(DAC12_Regs *dac12)
Enables power on DAC12 module.
Definition: dl_dac12.h:403
__STATIC_INLINE void DL_DAC12_disableEvent(DAC12_Regs *dac12, uint32_t eventMask)
Disable DAC event.
Definition: dl_dac12.h:1222
Definition: dl_dac12.h:113
Definition: dl_dac12.h:322
Definition: dl_dac12.h:88
#define DL_DAC12_INTERRUPT_FIFO_FULL
Interrupt raised when the FIFO is full.
Definition: dl_dac12.h:227
Definition: dl_dac12.h:133
Definition: dl_dac12.h:131
__STATIC_INLINE void DL_DAC12_configDataFormat(DAC12_Regs *dac12, DL_DAC12_REPRESENTATION rep, DL_DAC12_RESOLUTION res)
Sets all elements of the input data format at once.
Definition: dl_dac12.h:505
Definition: dl_dac12.h:155
void DL_DAC12_init(DAC12_Regs *dac12, DL_DAC12_Config *config)
Initialize the DAC module.
Definition: dl_dac12.h:147
__STATIC_INLINE void DL_DAC12_disable(DAC12_Regs *dac12)
Disables the DAC Module.
Definition: dl_dac12.h:476
Definition: dl_dac12.h:135
uint32_t DL_DAC12_fillFIFO12(DAC12_Regs *dac12, uint16_t *buffer, uint32_t count)
Fills the DAC fifo with 12-bit data values from the buffer.
DL_DAC12_SAMPLETIMER
Definition: dl_dac12.h:118
__STATIC_INLINE void DL_DAC12_output8(DAC12_Regs *dac12, uint8_t dataValue)
Outputs an 8-bit data value.
Definition: dl_dac12.h:948
DL_DAC12_CALIBRATION
Definition: dl_dac12.h:186
Definition: dl_dac12.h:172
DL_DAC12_AMP
Definition: dl_dac12.h:92
Definition: dl_dac12.h:320
Definition: dl_dac12.h:139
Definition: dl_dac12.h:316
__STATIC_INLINE void DL_DAC12_output12(DAC12_Regs *dac12, uint32_t dataValue)
Outputs a 12-bit Data Value.
Definition: dl_dac12.h:970
DL_DAC12_RESOLUTION resolution
Definition: dl_dac12.h:347
__STATIC_INLINE void DL_DAC12_enableOutputPin(DAC12_Regs *dac12)
Enables the DAC output by connecting it to the OUT0 pin.
Definition: dl_dac12.h:579
__STATIC_INLINE void DL_DAC12_disableOutputPin(DAC12_Regs *dac12)
Disable the DAC output by disconnecting it from the OUT0 pin.
Definition: dl_dac12.h:589
__STATIC_INLINE bool DL_DAC12_isEnabled(DAC12_Regs *dac12)
Checks the enable bit of the DAC.
Definition: dl_dac12.h:491
Definition: dl_dac12.h:120
Definition: dl_dac12.h:104
__STATIC_INLINE void DL_DAC12_setAmplifier(DAC12_Regs *dac12, DL_DAC12_AMP ampVal)
Sets the DAC and output amplifer setting.
Definition: dl_dac12.h:535
__STATIC_INLINE DL_DAC12_VREF_SOURCE DL_DAC12_getReferenceVoltageSource(DAC12_Regs *dac12)
Gets the currently configured reference voltage source.
Definition: dl_dac12.h:551
__STATIC_INLINE void DL_DAC12_enableDMATrigger(DAC12_Regs *dac12)
Enables the DMA trigger generator.
Definition: dl_dac12.h:740
__STATIC_INLINE void DL_DAC12_enableFIFO(DAC12_Regs *dac12)
Enables the FIFO module.
Definition: dl_dac12.h:616
__STATIC_INLINE bool DL_DAC12_isPowerEnabled(DAC12_Regs *dac12)
Returns if power on dac12 module.
Definition: dl_dac12.h:428
__STATIC_INLINE uint32_t DL_DAC12_getInterruptStatus(DAC12_Regs *dac12, uint32_t interruptMask)
Checks the raw interrupt status of one or more interrupts.
Definition: dl_dac12.h:1048
DL_DAC12_FIFO_THRESHOLD dmaTriggerThreshold
Definition: dl_dac12.h:373
Definition: dl_dac12.h:189
Definition: dl_dac12.h:308
Definition: dl_dac12.h:94
__STATIC_INLINE bool DL_DAC12_isOutputPinEnabled(DAC12_Regs *dac12)
Checks to see whether the output is connected.
Definition: dl_dac12.h:604
Definition: dl_dac12.h:98
__STATIC_INLINE DL_DAC12_AMP DL_DAC12_getAmplifier(DAC12_Regs *dac12)
Gets the currently configured amplifier setting.
Definition: dl_dac12.h:521
Definition: dl_dac12.h:137
DL_DAC12_FIFO_TRIGGER fifoTriggerSource
Definition: dl_dac12.h:362
Definition: dl_dac12.h:72
__STATIC_INLINE bool DL_DAC12_isReset(DAC12_Regs *dac12)
Returns if dac12 peripheral was reset.
Definition: dl_dac12.h:455
DL_DAC12_SAMPLES_PER_SECOND
Definition: dl_dac12.h:127
__STATIC_INLINE void DL_DAC12_disableDMATrigger(DAC12_Regs *dac12)
Disables the DMA trigger generator.
Definition: dl_dac12.h:753
DL_DAC12_VREF_SOURCE
Definition: dl_dac12.h:102
__STATIC_INLINE void DL_DAC12_setSampleRate(DAC12_Regs *dac12, DL_DAC12_SAMPLES_PER_SECOND sampleRate)
Sets the sample triggering rate of the sample time generator.
Definition: dl_dac12.h:848
DL_DAC12_FIFO_TRIGGER
Definition: dl_dac12.h:170
__STATIC_INLINE bool DL_DAC12_isFIFOFull(DAC12_Regs *dac12)
Checks if the DAC FIFO is currently full.
Definition: dl_dac12.h:1134
uint32_t DL_DAC12_fillFIFO8(DAC12_Regs *dac12, uint8_t *buffer, uint32_t count)
Fills the DAC fifo with 8-bit data values from the buffer.
DL_DAC12_RESOLUTION
Definition: dl_dac12.h:84
__STATIC_INLINE void DL_DAC12_clearEventsStatus(DAC12_Regs *dac12, uint32_t eventMask)
Clear pending DAC events.
Definition: dl_dac12.h:1294
DL_DAC12_DMA_TRIGGER
Definition: dl_dac12.h:178
__STATIC_INLINE bool DL_DAC12_isDMATriggerEnabled(DAC12_Regs *dac12)
Checks whether the DMA trigger generator is enabled.
Definition: dl_dac12.h:769
DL_DAC12_IIDX
Definition: dl_dac12.h:306
DL_DAC12_FIFO fifoEnable
Definition: dl_dac12.h:359
__STATIC_INLINE DL_DAC12_SAMPLES_PER_SECOND DL_DAC12_getSampleRate(DAC12_Regs *dac12)
Gets the sample trigger rate of the sample time generator.
Definition: dl_dac12.h:828
Definition: dl_dac12.h:314
Definition: dl_dac12.h:110
__STATIC_INLINE void DL_DAC12_enable(DAC12_Regs *dac12)
Enables the DAC module.
Definition: dl_dac12.h:466
DL_DAC12_SUBSCRIBER_INDEX
Definition: dl_dac12.h:328
Definition: dl_dac12.h:180
__STATIC_INLINE void DL_DAC12_enableInterrupt(DAC12_Regs *dac12, uint32_t interruptMask)
Enables one or more interrupts.
Definition: dl_dac12.h:1080
DL_DAC12_SAMPLES_PER_SECOND sampleRate
Definition: dl_dac12.h:383
DL_DAC12_OUTPUT
Definition: dl_dac12.h:68
Definition: dl_dac12.h:164
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale