Digital Power Starter Kit 3 Firmware
dsPIC33C Buck Converter Voltage Mode Control Example
p33c_opa.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 
33 // This is a guard condition so that contents of this file are not included
34 // more than once.
35 #ifndef P33C_OPA_SFR_ABSTRACTION_H
36 #define P33C_OPA_SFR_ABSTRACTION_H
37 
38 // Include standard header files
39 #include <xc.h> // include processor files - each processor file is guarded.
40 #include <stdint.h> // include standard integer data types
41 #include <stdbool.h> // include standard boolean data types
42 #include <stddef.h> // include standard definition data types
43 
44 
45 // GENERIC PDM OP-AMP MODULE SPECIAL FUNCTION REGISTER SET
46 #ifndef P33C_OPA_MODULE_s
47 
49  union {
50  volatile struct tagAMPCON1LBITS bits; // Register bit-field
51  volatile uint16_t value; // 16-bit wide register value
52  } AmpCon1L; // (AMPCON1L) OP-AMP CONTROL 1 REGISTER LOW
53  union {
54  volatile struct tagAMPCON1HBITS bits; // Register bit-field
55  volatile uint16_t value; // 16-bit wide register value
56  } AmpCon1H; // (AMPCON1H) OP-AMP CONTROL 2 REGISTER LOW
57  } __attribute__((packed));
58  typedef struct P33C_OPA_MODULE_s P33C_OPA_MODULE_t; // PDM OP-AMP MODULE REGISTER SET
59 
60 #endif
61 
62 
63 /* ********************************************************************************************* *
64  * API FUNCTION PROTOTYPES
65  * ********************************************************************************************* */
66 
67 extern volatile struct P33C_OPA_MODULE_s* p33c_OpaModule_GetHandle(void);
68 
69 extern volatile uint16_t p33c_OpaModule_Dispose(void);
70 
71 extern volatile struct P33C_OPA_MODULE_s p33c_OpaModule_ConfigRead(void);
72 extern volatile uint16_t p33c_OpaModule_ConfigWrite(
73  volatile struct P33C_OPA_MODULE_s opaConfig
74  );
75 
76 
77 /* ********************************************************************************************* *
78  * OP-AMP INSTANCE CONFIGURATION TEMPLATES
79  * ********************************************************************************************* */
80 extern volatile struct P33C_OPA_MODULE_s opaModuleConfigClear;
81 extern volatile struct P33C_OPA_MODULE_s opaModuleDefault;
82 
83 #endif /* P33C_OPA_SFR_ABSTRACTION_H */
84 
85 // end of file
P33C_OPA_MODULE_s::AmpCon1H
union P33C_OPA_MODULE_s::@1 AmpCon1H
P33C_OPA_MODULE_s::bits
volatile struct tagAMPCON1LBITS bits
Definition: p33c_opa.h:50
P33C_OPA_MODULE_s::value
volatile uint16_t value
Definition: p33c_opa.h:51
P33C_OPA_MODULE_s::AmpCon1L
union P33C_OPA_MODULE_s::@0 AmpCon1L
opaModuleDefault
volatile struct P33C_OPA_MODULE_s opaModuleDefault
Default configuration of op-amp module running from 500 MHz input clock.
Definition: p33c_opa.c:176
p33c_OpaModule_ConfigRead
volatile struct P33C_OPA_MODULE_s p33c_OpaModule_ConfigRead(void)
Read the current configuration from the op-amp module base registers.
Definition: p33c_opa.c:95
p33c_OpaModule_GetHandle
volatile struct P33C_OPA_MODULE_s * p33c_OpaModule_GetHandle(void)
Gets pointer to op-amp Module SFR set.
Definition: p33c_opa.c:43
opaModuleConfigClear
volatile struct P33C_OPA_MODULE_s opaModuleConfigClear
Default RESET configuration of the op-amp module base SFRs.
Definition: p33c_opa.c:154
p33c_OpaModule_ConfigWrite
volatile uint16_t p33c_OpaModule_ConfigWrite(volatile struct P33C_OPA_MODULE_s opaConfig)
Writes a user-defined configuration to the op-amp module base registers.
Definition: p33c_opa.c:125
P33C_OPA_MODULE_s
Definition: p33c_opa.h:48
p33c_OpaModule_Dispose
volatile uint16_t p33c_OpaModule_Dispose(void)
Resets all Op-Amp Module registers to their RESET default values.
Definition: p33c_opa.c:72