MSPM0L111X Driver Library  2.05.01.00
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,
73 } DL_DAC12_OUTPUT;
74 
76 typedef enum {
78  DL_DAC12_REPRESENTATION_BINARY = DAC12_CTL0_DFM_BINARY,
80  DL_DAC12_REPRESENTATION_TWOS_COMPLEMENT = DAC12_CTL0_DFM_TWOS_COMP,
81 } DL_DAC12_REPRESENTATION;
82 
84 typedef enum {
86  DL_DAC12_RESOLUTION_12BIT = DAC12_CTL0_RES__12BITS,
88  DL_DAC12_RESOLUTION_8BIT = DAC12_CTL0_RES__8BITS,
89 } DL_DAC12_RESOLUTION;
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),
115 } DL_DAC12_VREF_SOURCE;
116 
118 typedef enum {
120  DL_DAC12_SAMPLETIMER_DISABLE = DAC12_CTL3_STIMEN_CLR,
122  DL_DAC12_SAMPLETIMER_ENABLE = DAC12_CTL3_STIMEN_SET,
123 } DL_DAC12_SAMPLETIMER;
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,
148 } DL_DAC12_SAMPLES_PER_SECOND;
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,
166  DL_DAC12_FIFO_THRESHOLD_THREE_QTRS_EMPTY = DAC12_CTL2_FIFOTH_HIGH,
167 } DL_DAC12_FIFO_THRESHOLD;
168 
170 typedef enum {
172  DL_DAC12_FIFO_TRIGGER_SAMPLETIMER = DAC12_CTL2_FIFOTRIGSEL_STIM,
174  DL_DAC12_FIFO_TRIGGER_HWTRIG0 = DAC12_CTL2_FIFOTRIGSEL_TRIG0,
175 } DL_DAC12_FIFO_TRIGGER;
176 
178 typedef enum {
180  DL_DAC12_DMA_TRIGGER_DISABLED = DAC12_CTL2_DMATRIGEN_CLR,
182  DL_DAC12_DMA_TRIGGER_ENABLED = DAC12_CTL2_DMATRIGEN_SET,
183 } DL_DAC12_DMA_TRIGGER;
184 
186 typedef enum {
187 
189  DL_DAC12_CALIBRATION_FACTORY = DAC12_CALCTL_CALSEL_FACTORYTRIM,
191  DL_DAC12_CALIBRATION_SELF = DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM,
192 
193 } DL_DAC12_CALIBRATION;
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 {
330  DL_DAC12_SUBSCRIBER_INDEX_0 = 0,
331 } DL_DAC12_SUBSCRIBER_INDEX;
332 
334 typedef enum {
336  DL_DAC12_EVENT_ROUTE_1 = 0,
337 } DL_DAC12_EVENT_ROUTE;
338 
342 typedef struct {
344  DL_DAC12_OUTPUT outputEnable;
345 
347  DL_DAC12_RESOLUTION resolution;
348 
350  DL_DAC12_REPRESENTATION representation;
351 
353  DL_DAC12_VREF_SOURCE voltageReferenceSource;
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;
384 } DL_DAC12_Config;
385 
396 void DL_DAC12_init(DAC12_Regs *dac12, const DL_DAC12_Config *config);
397 
409 __STATIC_INLINE void DL_DAC12_enablePower(DAC12_Regs *dac12)
410 {
411  dac12->GPRCM.PWREN =
412  (DAC12_PWREN_KEY_UNLOCK_W | DAC12_PWREN_ENABLE_ENABLE);
413 }
414 
426 __STATIC_INLINE void DL_DAC12_disablePower(DAC12_Regs *dac12)
427 {
428  dac12->GPRCM.PWREN =
429  (DAC12_PWREN_KEY_UNLOCK_W | DAC12_PWREN_ENABLE_DISABLE);
430 }
431 
449 __STATIC_INLINE bool DL_DAC12_isPowerEnabled(const DAC12_Regs *dac12)
450 {
451  return ((dac12->GPRCM.PWREN & DAC12_PWREN_ENABLE_MASK) ==
452  DAC12_PWREN_ENABLE_ENABLE);
453 }
454 
460 __STATIC_INLINE void DL_DAC12_reset(DAC12_Regs *dac12)
461 {
462  dac12->GPRCM.RSTCTL =
463  (DAC12_RSTCTL_KEY_UNLOCK_W | DAC12_RSTCTL_RESETSTKYCLR_CLR |
464  DAC12_RSTCTL_RESETASSERT_ASSERT);
465 }
466 
476 __STATIC_INLINE bool DL_DAC12_isReset(const DAC12_Regs *dac12)
477 {
478  return ((dac12->GPRCM.STAT & DAC12_STAT_RESETSTKY_MASK) ==
479  DAC12_STAT_RESETSTKY_RESET);
480 }
481 
487 __STATIC_INLINE void DL_DAC12_enable(DAC12_Regs *dac12)
488 {
489  dac12->CTL0 |= DAC12_CTL0_ENABLE_SET;
490 }
491 
497 __STATIC_INLINE void DL_DAC12_disable(DAC12_Regs *dac12)
498 {
499  dac12->CTL0 &= ~DAC12_CTL0_ENABLE_MASK;
500 }
501 
512 __STATIC_INLINE bool DL_DAC12_isEnabled(const DAC12_Regs *dac12)
513 {
514  uint32_t t = (dac12->CTL0 & DAC12_CTL0_ENABLE_MASK);
515  return (t == DAC12_CTL0_ENABLE_SET);
516 }
517 
526 __STATIC_INLINE void DL_DAC12_configDataFormat(
527  DAC12_Regs *dac12, DL_DAC12_REPRESENTATION rep, DL_DAC12_RESOLUTION res)
528 {
529  DL_Common_updateReg(&dac12->CTL0, ((uint32_t) rep | (uint32_t) res),
530  DAC12_CTL0_RES_MASK | DAC12_CTL0_DFM_MASK);
531 }
532 
542 __STATIC_INLINE DL_DAC12_AMP DL_DAC12_getAmplifier(const DAC12_Regs *dac12)
543 {
544  uint32_t ampVal =
545  (dac12->CTL1 & (DAC12_CTL1_AMPEN_MASK | DAC12_CTL1_AMPHIZ_MASK));
546 
547  return (DL_DAC12_AMP)(ampVal);
548 }
549 
556 __STATIC_INLINE void DL_DAC12_setAmplifier(
557  DAC12_Regs *dac12, DL_DAC12_AMP ampVal)
558 {
559  DL_Common_updateReg(&dac12->CTL1, (uint32_t) ampVal,
560  (DAC12_CTL1_AMPEN_MASK | DAC12_CTL1_AMPHIZ_MASK));
561 }
562 
572 __STATIC_INLINE DL_DAC12_VREF_SOURCE DL_DAC12_getReferenceVoltageSource(
573  const DAC12_Regs *dac12)
574 {
575  uint32_t refsVal =
576  (dac12->CTL1 & (DAC12_CTL1_REFSP_MASK | DAC12_CTL1_REFSN_MASK));
577 
578  return (DL_DAC12_VREF_SOURCE)(refsVal);
579 }
580 
588 __STATIC_INLINE void DL_DAC12_setReferenceVoltageSource(
589  DAC12_Regs *dac12, DL_DAC12_VREF_SOURCE refsVal)
590 {
591  DL_Common_updateReg(&dac12->CTL1, (uint32_t) refsVal,
592  (DAC12_CTL1_REFSP_MASK | DAC12_CTL1_REFSN_MASK));
593 }
594 
600 __STATIC_INLINE void DL_DAC12_enableOutputPin(DAC12_Regs *dac12)
601 {
602  dac12->CTL1 |= DAC12_CTL1_OPS_OUT0;
603 }
604 
610 __STATIC_INLINE void DL_DAC12_disableOutputPin(DAC12_Regs *dac12)
611 {
612  dac12->CTL1 &= ~DAC12_CTL1_OPS_MASK;
613 }
614 
625 __STATIC_INLINE bool DL_DAC12_isOutputPinEnabled(const DAC12_Regs *dac12)
626 {
627  return ((dac12->CTL1 & DAC12_CTL1_OPS_MASK) == DAC12_CTL1_OPS_OUT0);
628 }
629 
637 __STATIC_INLINE void DL_DAC12_enableFIFO(DAC12_Regs *dac12)
638 {
639  /* Insert value */
640  dac12->CTL2 |= DAC12_CTL2_FIFOEN_SET;
641 }
642 
650 __STATIC_INLINE void DL_DAC12_disableFIFO(DAC12_Regs *dac12)
651 {
652  /* Clear out the bit */
653  dac12->CTL2 &= ~DAC12_CTL2_FIFOEN_MASK;
654 }
655 
666 __STATIC_INLINE bool DL_DAC12_isFIFOEnabled(const DAC12_Regs *dac12)
667 {
668  uint32_t t = (dac12->CTL2 & DAC12_CTL2_FIFOEN_MASK);
669  return (t == DAC12_CTL2_FIFOEN_SET);
670 }
671 
683 __STATIC_INLINE DL_DAC12_FIFO_THRESHOLD DL_DAC12_getFIFOThreshold(
684  const DAC12_Regs *dac12)
685 {
686  uint32_t fifoThreshold = (dac12->CTL2 & DAC12_CTL2_FIFOTH_MASK);
687 
688  return (DL_DAC12_FIFO_THRESHOLD)(fifoThreshold);
689 }
690 
704 __STATIC_INLINE void DL_DAC12_setFIFOThreshold(
705  DAC12_Regs *dac12, DL_DAC12_FIFO_THRESHOLD fifoThreshold)
706 {
708  &dac12->CTL2, (uint32_t) fifoThreshold, DAC12_CTL2_FIFOTH_MASK);
709 }
710 
722 __STATIC_INLINE DL_DAC12_FIFO_TRIGGER DL_DAC12_getFIFOTriggerSource(
723  const DAC12_Regs *dac12)
724 {
725  uint32_t fifoTrig = (dac12->CTL2 & DAC12_CTL2_FIFOTRIGSEL_MASK);
726 
727  return (DL_DAC12_FIFO_TRIGGER)(fifoTrig);
728 }
729 
741 __STATIC_INLINE void DL_DAC12_setFIFOTriggerSource(
742  DAC12_Regs *dac12, DL_DAC12_FIFO_TRIGGER fifoTrig)
743 {
745  &dac12->CTL2, (uint32_t) fifoTrig, DAC12_CTL2_FIFOTRIGSEL_MASK);
746 }
747 
761 __STATIC_INLINE void DL_DAC12_enableDMATrigger(DAC12_Regs *dac12)
762 {
763  /* Insert value */
764  dac12->CTL2 |= DAC12_CTL2_DMATRIGEN_SET;
765 }
766 
774 __STATIC_INLINE void DL_DAC12_disableDMATrigger(DAC12_Regs *dac12)
775 {
776  /* Clear out the bit */
777  dac12->CTL2 &= ~DAC12_CTL2_DMATRIGEN_MASK;
778 }
779 
790 __STATIC_INLINE bool DL_DAC12_isDMATriggerEnabled(const DAC12_Regs *dac12)
791 {
792  uint32_t t = (dac12->CTL2 & DAC12_CTL2_DMATRIGEN_MASK);
793  return (t == DAC12_CTL2_DMATRIGEN_SET);
794 }
795 
805 __STATIC_INLINE void DL_DAC12_enableSampleTimeGenerator(DAC12_Regs *dac12)
806 {
807  /* Insert value */
808  dac12->CTL3 |= DAC12_CTL3_STIMEN_SET;
809 }
810 
818 __STATIC_INLINE void DL_DAC12_disableSampleTimeGenerator(DAC12_Regs *dac12)
819 {
820  /* Clear out the bit */
821  dac12->CTL3 &= ~DAC12_CTL3_STIMEN_MASK;
822 }
823 
834 __STATIC_INLINE bool DL_DAC12_isSampleTimeGeneratorEnabled(
835  const DAC12_Regs *dac12)
836 {
837  uint32_t t = (dac12->CTL3 & DAC12_CTL3_STIMEN_MASK);
838  return (t == DAC12_CTL3_STIMEN_SET);
839 }
840 
850 __STATIC_INLINE DL_DAC12_SAMPLES_PER_SECOND DL_DAC12_getSampleRate(
851  const DAC12_Regs *dac12)
852 {
853  uint32_t sampleRate = (dac12->CTL3 & DAC12_CTL3_STIMCONFIG_MASK);
854 
855  return (DL_DAC12_SAMPLES_PER_SECOND)(sampleRate);
856 }
857 
870 __STATIC_INLINE void DL_DAC12_setSampleRate(
871  DAC12_Regs *dac12, DL_DAC12_SAMPLES_PER_SECOND sampleRate)
872 {
874  &dac12->CTL3, (uint32_t) sampleRate, DAC12_CTL3_STIMCONFIG_MASK);
875 }
876 
889 __STATIC_INLINE bool DL_DAC12_isCalibrationRunning(const DAC12_Regs *dac12)
890 {
891  uint32_t t = (dac12->CALCTL & DAC12_CALCTL_CALON_MASK);
892  return (t == DAC12_CALCTL_CALON_ACTIVE);
893 }
894 
915 __STATIC_INLINE void DL_DAC12_startCalibration(DAC12_Regs *dac12)
916 {
917  dac12->CALCTL =
918  (DAC12_CALCTL_CALON_ACTIVE | DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM);
919 }
920 
934 __STATIC_INLINE uint32_t DL_DAC12_getCalibrationData(const DAC12_Regs *dac12)
935 {
936  return (dac12->CALDATA & DAC12_CALDATA_DATA_MASK);
937 }
938 
951 void DL_DAC12_performSelfCalibrationBlocking(DAC12_Regs *dac12);
952 
970 __STATIC_INLINE void DL_DAC12_output8(DAC12_Regs *dac12, uint8_t dataValue)
971 {
972  dac12->DATA0 = dataValue;
973 }
974 
992 __STATIC_INLINE void DL_DAC12_output12(DAC12_Regs *dac12, uint32_t dataValue)
993 {
994  dac12->DATA0 = (dataValue & DAC12_DATA0_DATA_VALUE_MASK);
995 }
996 
1012 uint32_t DL_DAC12_fillFIFO8(
1013  DAC12_Regs *dac12, const uint8_t *buffer, uint32_t count);
1014 
1030 uint32_t DL_DAC12_fillFIFO12(
1031  DAC12_Regs *dac12, const uint16_t *buffer, uint32_t count);
1032 
1041 void DL_DAC12_outputBlocking8(DAC12_Regs *dac12, uint8_t data);
1042 
1051 void DL_DAC12_outputBlocking12(DAC12_Regs *dac12, uint16_t data);
1052 
1070 __STATIC_INLINE uint32_t DL_DAC12_getInterruptStatus(
1071  const DAC12_Regs *dac12, uint32_t interruptMask)
1072 {
1073  return (dac12->CPU_INT.RIS & interruptMask);
1074 }
1075 
1087 __STATIC_INLINE void DL_DAC12_clearInterruptStatus(
1088  DAC12_Regs *dac12, uint32_t interruptMask)
1089 {
1090  dac12->CPU_INT.ICLR = interruptMask;
1091 }
1092 
1102 __STATIC_INLINE void DL_DAC12_enableInterrupt(
1103  DAC12_Regs *dac12, uint32_t interruptMask)
1104 {
1105  dac12->CPU_INT.IMASK |= interruptMask;
1106 }
1107 
1117 __STATIC_INLINE void DL_DAC12_disableInterrupt(
1118  DAC12_Regs *dac12, uint32_t interruptMask)
1119 {
1120  dac12->CPU_INT.IMASK &= ~interruptMask;
1121 }
1122 
1138 __STATIC_INLINE DL_DAC12_IIDX DL_DAC12_getPendingInterrupt(
1139  const DAC12_Regs *dac12)
1140 {
1141  return ((DL_DAC12_IIDX) dac12->CPU_INT.IIDX);
1142 }
1143 
1157 __STATIC_INLINE bool DL_DAC12_isFIFOFull(const DAC12_Regs *dac12)
1158 {
1159  uint32_t t =
1160  DL_DAC12_getInterruptStatus(dac12, DL_DAC12_INTERRUPT_FIFO_FULL);
1161  return (t == DL_DAC12_INTERRUPT_FIFO_FULL);
1162 }
1163 
1172 __STATIC_INLINE void DL_DAC12_setPublisherChanID(
1173  DAC12_Regs *dac12, uint8_t chanID)
1174 {
1175  dac12->FPUB_1 = (chanID & DAC12_FPUB_1_CHANID_MAXIMUM);
1176 }
1177 
1186 __STATIC_INLINE uint8_t DL_DAC12_getPublisherChanID(const DAC12_Regs *dac12)
1187 {
1188  return ((uint8_t)((dac12->FPUB_1) & DAC12_FPUB_1_CHANID_MASK));
1189 }
1190 
1200 __STATIC_INLINE void DL_DAC12_setSubscriberChanID(
1201  DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index, uint8_t chanID)
1202 {
1203  volatile uint32_t *pReg = &dac12->FSUB_0;
1204 
1205  *(pReg + (uint32_t) index) = (chanID & DAC12_FSUB_0_CHANID_MAXIMUM);
1206 }
1207 
1217 __STATIC_INLINE uint8_t DL_DAC12_getSubscriberChanID(
1218  DAC12_Regs *dac12, DL_DAC12_SUBSCRIBER_INDEX index)
1219 {
1220  volatile uint32_t *pReg = &dac12->FSUB_0;
1221 
1222  return ((uint8_t)(*(pReg + (uint32_t) index) & DAC12_FSUB_0_CHANID_MASK));
1223 }
1224 
1232 __STATIC_INLINE void DL_DAC12_enableEvent(
1233  DAC12_Regs *dac12, uint32_t eventMask)
1234 {
1235  dac12->GEN_EVENT.IMASK |= (eventMask);
1236 }
1237 
1245 __STATIC_INLINE void DL_DAC12_disableEvent(
1246  DAC12_Regs *dac12, uint32_t eventMask)
1247 {
1248  dac12->GEN_EVENT.IMASK &= ~(eventMask);
1249 }
1250 
1262 __STATIC_INLINE uint32_t DL_DAC12_getEnabledEvents(
1263  const DAC12_Regs *dac12, uint32_t eventMask)
1264 {
1265  return ((dac12->GEN_EVENT.IMASK) & (eventMask));
1266 }
1267 
1284 __STATIC_INLINE uint32_t DL_DAC12_getEnabledEventStatus(
1285  const DAC12_Regs *dac12, uint32_t eventMask)
1286 {
1287  return ((dac12->GEN_EVENT.MIS) & eventMask);
1288 }
1289 
1304 __STATIC_INLINE uint32_t DL_DAC12_getRawEventsStatus(
1305  const DAC12_Regs *dac12, uint32_t eventMask)
1306 {
1307  return ((dac12->GEN_EVENT.RIS) & eventMask);
1308 }
1309 
1317 __STATIC_INLINE void DL_DAC12_clearEventsStatus(
1318  DAC12_Regs *dac12, uint32_t eventMask)
1319 {
1320  dac12->GEN_EVENT.ICLR |= (eventMask);
1321 }
1322 
1323 #ifdef __cplusplus
1324 }
1325 #endif
1326 #endif /* __MSPM0_HAS_DAC12__ */
1327 
1328 #endif /* ti_dl_dl_dac12__include */
1329 
__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
DriverLib Common APIs.
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale