-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcal_internal_interrupt.h
180 lines (162 loc) · 9.61 KB
/
mcal_internal_interrupt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
* File : mcal_internal_interrupt.h
* Author : Mohamed Ahmed Abdel Wahab
* LinkedIn : https://www.linkedin.com/in/mohamed-abdel-wahab-162413253/
* Github : https://github.com/moabdelwahab6611
* Created on June 2, 2023, 9:32 PM
*/
#ifndef MCAL_INTERNAL_INTERRUPT_H
#define MCAL_INTERNAL_INTERRUPT_H
/**************************Includes-Section*****************************/
#include "mcal_interrupt_config.h"
/***********************************************************************/
/**********************Macro Declarations-Section***********************/
/***********************************************************************/
/******************Macro Function Declarations-Section******************/
#if ADC_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* Brief : This routine clears the interrupt enable for the (ADC) module. */
#define ADC_InterruptDisable() (PIE1bits.ADIE = 0)
/* Brief : This routine sets enable interrupt for the (ADC) module. */
#define ADC_InterruptEnable() (PIE1bits.ADIE = 1)
/* Brief : This routine clears the interrupt flag for the (ADC) module. */
#define ADC_InterruptFlagClear() (PIR1bits.ADIF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* Brief : This routine set high priority for the (ADC) module interrupt. */
#define ADC_HighPrioritySet() (IPR1bits.ADIP = 1)
/* Brief : This routine set low priority for the (ADC) module interrupt. */
#define ADC_LowPrioritySet() (IPR1bits.ADIP = 0)
#endif
#endif
#if USART_TX_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (USART) module. */
#define USART_TX_InterruptDisable() (PIE1bits.TXIE = 0)
/* @Brief : This routine sets enable interrupt for the (USART) module. */
#define USART_TX_InterruptEnable() (PIE1bits.TXIE = 1)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (USART) module interrupt. */
#define USART_TX_HighPrioritySet() (IPR1bits.TXIP = 1)
/* @Brief : This routine set low priority for the (USART) module interrupt. */
#define USART_TX_LowPrioritySet() (IPR1bits.TXIP = 0)
#endif
#endif
#if USART_RX_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (USART) module. */
#define USART_RX_InterruptDisable() (PIE1bits.RCIE = 0)
/* @Brief : This routine sets enable interrupt for the (USART) module. */
#define USART_RX_InterruptEnable() (PIE1bits.RCIE = 1)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (USART) module interrupt. */
#define USART_RX_HighPrioritySet() (IPR1bits.RCIP = 1)
/* @Brief : This routine set low priority for the (USART) module interrupt.*/
#define USART_RX_LowPrioritySet() (IPR1bits.RCIP = 0)
#endif
#endif
#if TIMER0_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (TIMER0) module.*/
#define TIMER0_InterruptDisable() (INTCONbits.TMR0IE = 0)
/* @Brief : This routine sets enable interrupt for the (TIMER0) module. */
#define TIMER0_InterruptEnable() (INTCONbits.TMR0IE = 1)
/* @Brief : This routine clears the interrupt flag for the (TIMER0) module. */
#define TIMER0_InterruptFlagClear() (INTCONbits.TMR0IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (TIMER0) module interrupt. */
#define TIMER0_HighPrioritySet() (INTCON2bits.TMR0IP = 1)
/* @Brief : This routine set low priority for the (TIMER0) module interrupt. */
#define TIMER0_LowPrioritySet() (INTCON2bits.TMR0IP = 0)
#endif
#endif
#if TIMER1_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (TIMER1) module. */
#define TIMER1_InterruptDisable() (PIE1bits.TMR1IE = 0)
/* @Brief : This routine sets enable interrupt for the (TIMER1) module. */
#define TIMER1_InterruptEnable() (PIE1bits.TMR1IE = 1)
/* @Brief : This routine clears the interrupt flag for the (TIMER1) module. */
#define TIMER1_InterruptFlagClear() (PIR1bits.TMR1IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (TIMER1) module interrupt. */
#define TIMER1_HighPrioritySet() (IPR1bits.TMR1IP = 1)
/* @Brief : This routine set low priority for the (TIMER1) module interrupt. */
#define TIMER1_LowPrioritySet() (IPR1bits.TMR1IP = 0)
#endif
#endif
#if TIMER2_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (TIMER2) module. */
#define TIMER2_InterruptDisable() (PIE1bits.TMR2IE = 0)
/* @Brief : This routine sets enable interrupt for the (TIMER2) module. */
#define TIMER2_InterruptEnable() (PIE1bits.TMR2IE = 1)
/* @Brief : This routine clears the interrupt flag for the (TIMER2) module. */
#define TIMER2_InterruptFlagClear() (PIR1bits.TMR2IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (TIMER2) module interrupt. */
#define TIMER2_HighPrioritySet() (IPR1bits.TMR2IP = 1)
/* @Brief : This routine set low priority for the (TIMER2) module interrupt. */
#define TIMER2_LowPrioritySet() (IPR1bits.TMR2IP = 0)
#endif
#endif
#if TIMER3_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the (TIMER3) module. */
#define TIMER3_InterruptDisable() (PIE2bits.TMR3IE = 0)
/* @Brief : This routine sets enable interrupt for the (TIMER3) module. */
#define TIMER3_InterruptEnable() (PIE2bits.TMR3IE = 1)
/* @Brief : This routine clears the interrupt flag for the (TIMER3) module. */
#define TIMER3_InterruptFlagClear() (PIR2bits.TMR3IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the (TIMER3) module interrupt. */
#define TIMER3_HighPrioritySet() (IPR2bits.TMR3IP = 1)
/* @Brief : This routine set low priority for the (TIMER3) module interrupt. */
#define TIMER3_LowPrioritySet() (IPR2bits.TMR3IP = 0)
#endif
#endif
#if MSSP_I2C_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the MSSP I2C module. */
#define MSSP_I2C_InterruptDisable() (PIE1bits.SSPIE = 0)
#define MSSP_I2C_BUS_COL_InterruptDisable() (PIE2bits.BCLIE = 0)
/* @Brief : This routine sets the interrupt enable for the MSSP I2C module. */
#define MSSP_I2C_InterruptEnable() (PIE1bits.SSPIE = 1)
#define MSSP_I2C_BUS_COL_InterruptEnable() (PIE2bits.BCLIE = 1)
/* @Brief : This routine clears the interrupt flag for the MSSP I2C module. */
#define MSSP_I2C_InterruptFlagClear() (PIR1bits.SSPIF = 0)
#define MSSP_I2C_BUS_COL_InterruptFlagClear() (PIR2bits.BCLIF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the MSSP I2C module Interrupt. */
#define MSSP_I2C_HighPrioritySet() (IPR1bits.SSPIP = 1)
#define MSSP_I2C_BUS_COL_HighPrioritySet() (IPR2bits.BCLIP = 1)
/* @Brief : This routine set low priority for the MSSP I2C module Interrupt. */
#define MSSP_I2C_LowPrioritySet() (IPR1bits.SSPIP = 0)
#define MSSP_I2C_BUS_COL_LowPrioritySet() (IPR2bits.BCLIP = 0)
#endif
#endif
#if CCP1_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the CCP1 module. */
#define CCP1_InterruptDisable() (PIE1bits.CCP1IE = 0)
/* @Brief : This routine sets the interrupt enable for the CCP1 module. */
#define CCP1_InterruptEnable() (PIE1bits.CCP1IE = 1)
/* @Brief : This routine clears the interrupt flag for the CCP1 module. */
#define CCP1_InterruptFlagClear() (PIR1bits.CCP1IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the CCP1 module Interrupt. */
#define CCP1_HighPrioritySet() (IPR1bits.CCP1IP = 1)
/* @Brief : This routine set low priority for the CCP1 module interrupt. */
#define CCP1_LowPrioritySet() (IPR1bits.CCP1IP = 0)
#endif
#endif
#if CCP2_INTERRUPT_FEATURE_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine clears the interrupt enable for the CCP2 module. */
#define CCP2_InterruptDisable() (PIE2bits.CCP2IE = 0)
/* @Brief : This routine sets the interrupt enable for the CCP2 module. */
#define CCP2_InterruptEnable() (PIE2bits.CCP2IE = 1)
/* @Brief : This routine clears the interrupt flag for the CCP2 module. */
#define CCP2_InterruptFlagClear() (PIR2bits.CCP2IF = 0)
#if INTERRUPT_PRIORITY_LEVELS_ENABLE==INTERRUPT_FEATURE_ENABLE
/* @Brief : This routine set high priority for the CCP2 module interrupt. */
#define CCP2_HighPrioritySet() (IPR2bits.CCP2IP = 1)
/* @Brief : This routine set low priority for the CCP2 module interrupt. */
#define CCP2_LowPrioritySet() (IPR2bits.CCP2IP = 0)
#endif
#endif
/***********************************************************************/
/********************Data Types Declarations-Section********************/
/***********************************************************************/
/**********Software Interfaces Functions Declarations-Section***********/
/***********************************************************************/
#endif /* MCAL_INTERNAL_INTERRUPT_H */