EPC9143 300 W 16th Brick DC/DC Module Reference Design
p33c_gpio.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_gpio.h
23  * ************************************************************************************************
24  * Summary:
25  * Generic Digital Signal Processor 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_gpio.c
34  *
35  * ***********************************************************************************************#
36  * Revision history:
37  * 12/10/20 1.0 initial release
38  * ***********************************************************************************************/
39 
40 // This is a guard condition so that contents of this file are not included
41 // more than once.
42 #ifndef P33C_GPIO_SFR_ABSTRACTION_H
43 #define P33C_GPIO_SFR_ABSTRACTION_H
44 
45 // Include standard header files
46 #include <xc.h> // include processor files - each processor file is guarded.
47 #include <stdint.h> // include standard integer data types
48 #include <stdbool.h> // include standard boolean data types
49 #include <stddef.h> // include standard definition data types
50 
51 // GENERIC GPIO INSTANCE SPECIAL FUNCTION REGISTER SET
52 // DO NOT REORDER ELEMENTS AS THEY MAP ONTO DEVICE REGISTER MEMORY !!!
53 #ifndef P33C_GPIO_INSTANCE_s
54 
55  typedef struct P33C_GPIO_INSTANCE_s {
56  union {
57  volatile struct tagLATABITS bits; // Register bit-field
58  volatile uint16_t value; // 16-bit wide register value
59  }ANSELx; // ANSELx: ANALOG SELECT FOR PORTx REGISTER
60  union {
61  volatile struct tagLATABITS bits; // Register bit-field
62  volatile uint16_t value; // 16-bit wide register value
63  }TRISx; // TRISx: OUTPUT ENABLE FOR PORTx REGISTER
64  union {
65  volatile struct tagLATABITS bits; // Register bit-field
66  volatile uint16_t value; // 16-bit wide register value
67  }PORTx; // PORTx: INPUT DATA FOR PORTx REGISTER
68  union {
69  volatile struct tagLATABITS bits; // Register bit-field
70  volatile uint16_t value; // 16-bit wide register value
71  }LATx; // LATx: OUTPUT DATA FOR PORTx REGISTER
72  union {
73  volatile struct tagLATABITS bits; // Register bit-field
74  volatile uint16_t value; // 16-bit wide register value
75  }ODCx; // ODCx: OPEN-DRAIN ENABLE FOR PORTx REGISTER
76  union {
77  volatile struct tagLATABITS bits; // Register bit-field
78  volatile uint16_t value; // 16-bit wide register value
79  }CNPUx; // CNPUx: CHANGE NOTIFICATION PULL-UP ENABLE FOR PORTx REGISTER
80  union {
81  volatile struct tagLATABITS bits; // Register bit-field
82  volatile uint16_t value; // 16-bit wide register value
83  }CNPDx; // CNPDx: CHANGE NOTIFICATION PULL-DOWN ENABLE FOR PORTx REGISTER
84  union {
85  volatile struct tagLATABITS bits; // Register bit-field
86  volatile uint16_t value; // 16-bit wide register value
87  }CNCONx; // CNCONx: CHANGE NOTIFICATION CONTROL FOR PORTx REGISTER
88  union {
89  volatile struct tagLATABITS bits; // Register bit-field
90  volatile uint16_t value; // 16-bit wide register value
91  }CNEN0x; // CNEN0x: CHANGE NOTIFICATION INTERRUPT ENABLE FOR PORTx REGISTER
92  union {
93  volatile struct tagLATABITS bits; // Register bit-field
94  volatile uint16_t value; // 16-bit wide register value
95  }CNSTATx; // CNSTATx: CHANGE NOTIFICATION STATUS FOR PORTx REGISTER
96  union {
97  volatile struct tagLATABITS bits; // Register bit-field
98  volatile uint16_t value; // 16-bit wide register value
99  }CNEN1x; // CNEN1x: CHANGE NOTIFICATION EDGE SELECT FOR PORTx REGISTER
100  union {
101  volatile struct tagLATABITS bits; // Register bit-field
102  volatile uint16_t value; // 16-bit wide register value
103  }CNFx; // CNFx: CHANGE NOTIFICATION INTERRUPT FLAG FOR PORTx REGISTER
104  } __attribute__((packed)) P33C_GPIO_INSTANCE_t; // GPIO REGISTER SET
105 
106  #define P33C_GPIO_SFR_OFFSET ((volatile uint16_t)&ANSELB - (volatile uint16_t)&ANSELA)
107 
108 #endif
109 
110 /* ********************************************************************************************* *
111  * API FUNCTION PROTOTYPES
112  * ********************************************************************************************* */
113 
114 extern volatile struct P33C_GPIO_INSTANCE_s* p33c_GpioInstance_GetHandle(
115  volatile uint16_t gpio_Instance
116  );
117 
118 extern volatile uint16_t p33c_GpioInstance_Dispose(
119  volatile uint16_t gpioInstance
120  );
121 
123  volatile uint16_t gpioInstance
124  );
125 
126 extern volatile uint16_t p33c_GpioInstance_ConfigWrite(
127  volatile uint16_t gpioInstance,
128  volatile struct P33C_GPIO_INSTANCE_s gpioConfig
129  );
130 
131 /* ********************************************************************************************* *
132  * GPIO INSTANCE CONFIGURATION TEMPLATES
133  * ********************************************************************************************* */
134 extern volatile struct P33C_GPIO_INSTANCE_s gpioConfigClear;
135 
136 #endif /* P33C_GPIO_SFR_ABSTRACTION_H */
137 
P33C_GPIO_INSTANCE_s::value
volatile uint16_t value
Definition: p33c_gpio.h:58
P33C_GPIO_INSTANCE_s::PORTx
union P33C_GPIO_INSTANCE_s::@2 PORTx
p33c_GpioInstance_ConfigRead
volatile struct P33C_GPIO_INSTANCE_s p33c_GpioInstance_ConfigRead(volatile uint16_t gpioInstance)
Read the current configuration from the GPIO instance registers
Definition: p33c_gpio.c:102
P33C_GPIO_INSTANCE_s::LATx
union P33C_GPIO_INSTANCE_s::@3 LATx
P33C_GPIO_INSTANCE_s::TRISx
union P33C_GPIO_INSTANCE_s::@1 TRISx
P33C_GPIO_INSTANCE_s::CNPUx
union P33C_GPIO_INSTANCE_s::@5 CNPUx
P33C_GPIO_INSTANCE_s::bits
volatile struct tagLATABITS bits
Definition: p33c_gpio.h:57
p33c_GpioInstance_ConfigWrite
volatile uint16_t p33c_GpioInstance_ConfigWrite(volatile uint16_t gpioInstance, volatile struct P33C_GPIO_INSTANCE_s gpioConfig)
Writes a user-defined configuration to the GPIO instance registers.
Definition: p33c_gpio.c:133
p33c_GpioInstance_Dispose
volatile uint16_t p33c_GpioInstance_Dispose(volatile uint16_t gpioInstance)
Resets all GPIO Instance registers to their RESET default values.
Definition: p33c_gpio.c:77
p33c_GpioInstance_GetHandle
volatile struct P33C_GPIO_INSTANCE_s * p33c_GpioInstance_GetHandle(volatile uint16_t gpio_Instance)
Gets pointer to GPIO Instance SFR set.
Definition: p33c_gpio.c:45
gpioConfigClear
volatile struct P33C_GPIO_INSTANCE_s gpioConfigClear
Default RESET configuration of one GPIO instance SFRs.
Definition: p33c_gpio.c:169
P33C_GPIO_INSTANCE_s::CNFx
union P33C_GPIO_INSTANCE_s::@11 CNFx
P33C_GPIO_INSTANCE_s::ODCx
union P33C_GPIO_INSTANCE_s::@4 ODCx
P33C_GPIO_INSTANCE_s::CNEN1x
union P33C_GPIO_INSTANCE_s::@10 CNEN1x
P33C_GPIO_INSTANCE_s::ANSELx
union P33C_GPIO_INSTANCE_s::@0 ANSELx
P33C_GPIO_INSTANCE_s::CNCONx
union P33C_GPIO_INSTANCE_s::@7 CNCONx
P33C_GPIO_INSTANCE_s::CNSTATx
union P33C_GPIO_INSTANCE_s::@9 CNSTATx
P33C_GPIO_INSTANCE_s
Definition: p33c_gpio.h:55
P33C_GPIO_INSTANCE_s::CNPDx
union P33C_GPIO_INSTANCE_s::@6 CNPDx
P33C_GPIO_INSTANCE_s::CNEN0x
union P33C_GPIO_INSTANCE_s::@8 CNEN0x