EPC9143 300 W 16th Brick DC/DC Module Reference Design
p33c_dac.h
1 /* Microchip Technology Inc. and its subsidiaries. You may use this software
2  * and any derivatives exclusively with Microchip products.
3  *
4  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
5  * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
6  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
7  * PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
8  * WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
9  *
10  * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
11  * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
12  * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
13  * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
14  * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS
15  * IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF
16  * ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
17  *
18  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
19  * TERMS.
20  */
21 
22 /*@@p33c_dac.h
23  * ************************************************************************************************
24  * Summary:
25  * Generic Digital-To-Analog Converter Driver Module (header file)
26  *
27  * Description:
28  * This additional header file contains defines for all required bit-settings of all related
29  * special function registers of a peripheral module and/or instance.
30  * This file is an additional header file on top of the generic device header file.
31  *
32  * See Also:
33  * p33c_dac.c
34  * ***********************************************************************************************/
35 
36 // This is a guard condition so that contents of this file are not included
37 // more than once.
38 #ifndef P33C_DAC_SFR_ABSTRACTION_H
39 #define P33C_DAC_SFR_ABSTRACTION_H
40 
41 // Include standard header files
42 #include <xc.h> // include processor files - each processor file is guarded.
43 #include <stdint.h> // include standard integer data types
44 #include <stdbool.h> // include standard boolean data types
45 #include <stddef.h> // include standard definition data types
46 
47 
48 // GENERIC PDM DAC MODULE SPECIAL FUNCTION REGISTER SET
49 #ifndef P33C_DAC_MODULE_s
50 
51  typedef struct P33C_DAC_MODULE_s{
52  union {
53  volatile struct tagDACCTRL1LBITS bits; // Register bit-field
54  volatile uint16_t value; // 16-bit wide register value
55  } DacModuleCtrl1L; // (DACCTRL1L) DAC CONTROL 1 REGISTER LOW
56  volatile unsigned : 16; // (reserved)
57  union {
58  volatile struct tagDACCTRL2LBITS bits; // Register bit-field
59  volatile uint16_t value; // 16-bit wide register value
60  } DacModuleCtrl2L; // (DACCTRL2L) DAC CONTROL 2 REGISTER LOW
61  union {
62  volatile struct tagDACCTRL2HBITS bits; // Register bit-field
63  volatile uint16_t value; // 16-bit wide register value
64  } DacModuleCtrl2H; // (DACCTRL2H) DAC CONTROL 2 REGISTER HIGH
65  } __attribute__((packed)) obj_P33C_DAC_MODULE_t; // PDM DAC MODULE REGISTER SET
66 
67 #endif
68 
69 // GENERIC PDM DAC INSTANCE SPECIAL FUNCTION REGISTER SET
70 #ifndef P33C_DAC_INSTANCE_s
71 
72  typedef struct P33C_DAC_INSTANCE_s{
73  union {
74  volatile struct tagDAC1CONLBITS bits; // Register bit-field
75  volatile uint16_t value; // 16-bit wide register value
76  } DACxCONL; // DACxCONL: DACx CONTROL LOW REGISTER
77  union {
78  volatile struct tagDAC1CONHBITS bits; // Register bit-field
79  volatile uint16_t value; // 16-bit wide register value
80  } DACxCONH; // DACxCONH: DACx CONTROL HIGH REGISTER
81  union {
82  volatile struct tagDAC1DATLBITS bits; // Register bit-field
83  volatile uint16_t value; // 16-bit wide register value
84  } DACxDATL; // DACxDATL: DACx DATA LOW REGISTER
85  union {
86  volatile struct tagDAC1DATHBITS bits; // Register bit-field
87  volatile uint16_t value; // 16-bit wide register value
88  } DACxDATH; // DACxDATH: DACx DATA HIGH REGISTER
89  union {
90  volatile struct tagSLP1CONLBITS bits; // Register bit-field
91  volatile uint16_t value; // 16-bit wide register value
92  } SLPxCONL; // SLPxCONL: DACx SLOPE CONTROL LOW REGISTER
93  union {
94  volatile struct tagSLP1CONHBITS bits; // Register bit-field
95  volatile uint16_t value; // 16-bit wide register value
96  } SLPxCONH; // SLPxCONH: DACx SLOPE CONTROL HIGH REGISTER
97  union {
98  volatile struct tagSLP1DATBITS bits; // Register bit-field
99  volatile uint16_t value; // 16-bit wide register value
100  } SLPxDAT; // SLPxDAT: DACx SLOPE DATA REGISTER
101  } __attribute__((packed)) obj_P33C_DAC_INSTANCE_t; // PDM DAC INSTANCE REGISTER SET
102 
103  #define P33C_DAC_SFR_OFFSET ((volatile uint16_t)&DAC2CONL - (volatile uint16_t)&DAC1CONL)
104 
105 #endif
106 
107 
108 /* ********************************************************************************************* *
109  * API FUNCTION PROTOTYPES
110  * ********************************************************************************************* */
111 
112 extern volatile struct P33C_DAC_MODULE_s* p33c_DacModule_GetHandle(void);
113 
114 extern volatile uint16_t p33c_DacModule_Dispose(void);
115 
116 extern volatile struct P33C_DAC_MODULE_s p33c_DacModule_ConfigRead(void);
117 extern volatile uint16_t p33c_DacModule_ConfigWrite(
118  volatile struct P33C_DAC_MODULE_s dacConfig
119  );
120 
121 
122 extern volatile struct P33C_DAC_INSTANCE_s* p33c_DacInstance_GetHandle(
123  volatile uint16_t dac_Instance
124  );
125 
126 extern volatile uint16_t p33c_DacInstance_Dispose(
127  volatile uint16_t dacInstance
128  );
129 
130 extern volatile struct P33C_DAC_INSTANCE_s p33c_DacInstance_ConfigRead(
131  volatile uint16_t dacInstance
132  );
133 
134 extern volatile uint16_t p33c_DacInstance_ConfigWrite(
135  volatile uint16_t dacInstance,
136  volatile struct P33C_DAC_INSTANCE_s dacConfig
137  );
138 
139 /* ********************************************************************************************* *
140  * DAC INSTANCE CONFIGURATION TEMPLATES
141  * ********************************************************************************************* */
142 extern volatile struct P33C_DAC_MODULE_s dacModuleConfigClear;
143 extern volatile struct P33C_DAC_INSTANCE_s dacConfigClear;
144 extern volatile struct P33C_DAC_MODULE_s dacModuleDefault;
145 
146 #endif /* P33C_DAC_SFR_ABSTRACTION_H */
147 // END OF FILE
P33C_DAC_INSTANCE_s::SLPxCONL
union P33C_DAC_INSTANCE_s::@10 SLPxCONL
P33C_DAC_INSTANCE_s
Definition: p33c_dac.h:72
p33c_DacInstance_ConfigWrite
volatile uint16_t p33c_DacInstance_ConfigWrite(volatile uint16_t dacInstance, volatile struct P33C_DAC_INSTANCE_s dacConfig)
Writes a user-defined configuration to the DAC instance registers.
Definition: p33c_dac.c:252
p33c_DacModule_GetHandle
volatile struct P33C_DAC_MODULE_s * p33c_DacModule_GetHandle(void)
Gets pointer to DAC Module SFR set.
Definition: p33c_dac.c:44
p33c_DacModule_ConfigWrite
volatile uint16_t p33c_DacModule_ConfigWrite(volatile struct P33C_DAC_MODULE_s dacConfig)
Writes a user-defined configuration to the DAC module base registers.
Definition: p33c_dac.c:129
dacModuleConfigClear
volatile struct P33C_DAC_MODULE_s dacModuleConfigClear
Default RESET configuration of the DAC module base SFRs.
Definition: p33c_dac.c:287
p33c_DacModule_ConfigRead
volatile struct P33C_DAC_MODULE_s p33c_DacModule_ConfigRead(void)
Read the current configuration from the DAC module base registers.
Definition: p33c_dac.c:100
P33C_DAC_INSTANCE_s::DACxCONH
union P33C_DAC_INSTANCE_s::@7 DACxCONH
dacModuleDefault
volatile struct P33C_DAC_MODULE_s dacModuleDefault
Default configuration of DAC module running from 500 MHz input clock.
Definition: p33c_dac.c:314
P33C_DAC_INSTANCE_s::DACxCONL
union P33C_DAC_INSTANCE_s::@6 DACxCONL
P33C_DAC_MODULE_s::DacModuleCtrl2H
union P33C_DAC_MODULE_s::@2 DacModuleCtrl2H
P33C_DAC_MODULE_s::unsigned
volatile unsigned
Definition: p33c_dac.h:56
P33C_DAC_INSTANCE_s::DACxDATL
union P33C_DAC_INSTANCE_s::@8 DACxDATL
P33C_DAC_MODULE_s::DacModuleCtrl2L
union P33C_DAC_MODULE_s::@1 DacModuleCtrl2L
P33C_DAC_INSTANCE_s::bits
volatile struct tagDAC1CONLBITS bits
Definition: p33c_dac.h:74
p33c_DacModule_Dispose
volatile uint16_t p33c_DacModule_Dispose(void)
Resets all DAC Module registers to their RESET default values.
Definition: p33c_dac.c:75
P33C_DAC_INSTANCE_s::SLPxCONH
union P33C_DAC_INSTANCE_s::@11 SLPxCONH
P33C_DAC_MODULE_s::DacModuleCtrl1L
union P33C_DAC_MODULE_s::@0 DacModuleCtrl1L
P33C_DAC_MODULE_s::value
volatile uint16_t value
Definition: p33c_dac.h:54
P33C_DAC_INSTANCE_s::SLPxDAT
union P33C_DAC_INSTANCE_s::@12 SLPxDAT
dacConfigClear
volatile struct P33C_DAC_INSTANCE_s dacConfigClear
Default RESET configuration of one DAC instance channel SFRs.
Definition: p33c_dac.c:335
P33C_DAC_MODULE_s
Definition: p33c_dac.h:51
P33C_DAC_INSTANCE_s::DACxDATH
union P33C_DAC_INSTANCE_s::@9 DACxDATH
p33c_DacInstance_ConfigRead
volatile struct P33C_DAC_INSTANCE_s p33c_DacInstance_ConfigRead(volatile uint16_t dacInstance)
Read the current configuration from the DAC instance registers.
Definition: p33c_dac.c:221
P33C_DAC_INSTANCE_s::value
volatile uint16_t value
Definition: p33c_dac.h:75
p33c_DacInstance_GetHandle
volatile struct P33C_DAC_INSTANCE_s * p33c_DacInstance_GetHandle(volatile uint16_t dac_Instance)
Gets pointer to DAC Instance SFR set.
Definition: p33c_dac.c:165
p33c_DacInstance_Dispose
volatile uint16_t p33c_DacInstance_Dispose(volatile uint16_t dacInstance)
Resets all DAC Instance registers to their RESET default values.
Definition: p33c_dac.c:197
P33C_DAC_MODULE_s::bits
volatile struct tagDACCTRL1LBITS bits
Definition: p33c_dac.h:53