8051-ELL库  beta 1.1.6
8051-ELL library API Document Center
ELL_CORE.h
浏览该文件的文档.
1 /*-----------------------------------------------------------------------
2 | FILE DESCRIPTION |
3 -----------------------------------------------------------------------*/
4 /*-----------------------------------------------------------------------
5  - File name : STC8x_CORE.h
6  - Author : Quark Team
7  - Update date : 2020.12.20
8  - Copyright : Gevico Electronic studio
9  - Module comments: Header file of MCU core.
10 -----------------------------------------------------------------------*/
11 /*------------------------------------------------------------------------
12 | COPYRIGHT NOTICE |
13 ------------------------------------------------------------------------*/
14 /*
15  * Copyright (C) 2021, zeweni (17870070675@163.com)
16 
17  * This file is part of 8051 ELL low-layer libraries.
18 
19  * 8051 ELL low-layer libraries is free software: you can redistribute
20  * it and/or modify it under the terms of the Apache-2.0 License.
21 
22  * 8051 ELL low-layer libraries is distributed in the hope that it will
23  * be useful,but WITHOUT ANY WARRANTY; without even the implied warranty
24  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * Apache-2.0 License for more details.
26 
27  * You should have received a copy of the Apache-2.0 License.8051 ELL
28  * low-layer libraries. If not, see <http://www.apache.org/licenses/>.
29 **/
30 /*-----------------------------------------------------------------------
31 | INCLUDES |
32 -----------------------------------------------------------------------*/
33 #ifndef __ELL_CORE_H_
34 #define __ELL_CORE_H_
35 
36 #include "ELL_CFG.h"
37 /*-----------------------------------------------------------------------
38 | DATA |
39 -----------------------------------------------------------------------*/
40 
49 typedef enum
50 {
51  DISABLE = 0,
52  ENABLE = !DISABLE
53 } BOOL;
54 
55 
64 typedef enum
65 {
66  FSC_FAIL= 1, /* Function self checking failed */
67  FSC_SUCCESS = !FSC_FAIL /* Function self checking successfed */
69 
70 
80 typedef enum
81 {
82  SW_Port1 = 0x00 ,
83  SW_Port2 = 0x01 ,
84  SW_Port3 = 0x02 ,
85  SW_Port4 = 0x03
87 
88 
98 typedef enum
99 {
100  NVIC_PR0 = 0x00, //Lowest priority |
101  NVIC_PR1 = 0x01, //Lower priority |
102  NVIC_PR2 = 0x02, //Higher priority |
103  NVIC_PR3 = 0x03 //Highest priority V
105 
106 /*-----------------------------------------------------------------------
107 | API FUNCTION |
108 -----------------------------------------------------------------------*/
109 
110 extern void _nop_ (void);
111 
112 /*--------------------------------------------------------
113 | @Description: Global interrupt switch define |
114 --------------------------------------------------------*/
115 
121 #define NVIC_GLOBAL_ENABLE() do{_nop_();EA = 1;_nop_();}while(0)
122 
123 
129 #define NVIC_GLOBAL_DISABLE() do{_nop_();EA = 0;_nop_();}while(0)
130 
131 /*-----------------------------------------------------------------------
132 | ISR FUNCTION(Public STC) |
133 -----------------------------------------------------------------------*/
134 
135 /*--------------------------------------------------------
136 | @Description: EXTI ISR define |
137 --------------------------------------------------------*/
138 
139 #define EXTI0_ISRQ_Handler(void) EXTI0_ISR(void) interrupt 0
140 #define EXTI1_ISRQ_Handler(void) EXTI1_ISR(void) interrupt 2
141 #define EXTI2_ISRQ_Handler(void) EXTI2_ISR(void) interrupt 10
142 #define EXTI3_ISRQ_Handler(void) EXTI3_ISR(void) interrupt 11
143 #define EXTI4_ISRQ_Handler(void) EXTI4_ISR(void) interrupt 16
144 
145 /*--------------------------------------------------------
146 | @Description: TIMER ISR define |
147 --------------------------------------------------------*/
148 
149 #define TIMER0_ISRQ_Handler(void) TIMER0_ISR(void) interrupt 1
150 #define TIMER1_ISRQ_Handler(void) TIMER1_ISR(void) interrupt 3
151 #define TIMER2_ISRQ_Handler(void) TIMER2_ISR(void) interrupt 12
152 #define TIMER3_ISRQ_Handler(void) TIMER3_ISR(void) interrupt 19
153 #define TIMER4_ISRQ_Handler(void) TIMER4_ISR(void) interrupt 20
154 
155 /*--------------------------------------------------------
156 | @Description: UART ISR define |
157 --------------------------------------------------------*/
158 
159 #define UART1_ISRQ_Handler(void) UART1_ISR(void) interrupt 4
160 #define UART2_ISRQ_Handler(void) UART2_ISR(void) interrupt 8
161 #define UART3_ISRQ_Handler(void) UART3_ISR(void) interrupt 17
162 #define UART4_ISRQ_Handler(void) UART4_ISR(void) interrupt 18
163 
164 /*--------------------------------------------------------
165 | @Description: SPI ISR define |
166 --------------------------------------------------------*/
167 
168 #define SPI_ISRQ_Handler(void) SPI_ISR(void) interrupt 9
169 
170 /*--------------------------------------------------------
171 | @Description: COMP ISR define |
172 --------------------------------------------------------*/
173 
174 #define COMP_ISRQ_Handler(void) COMP_ISR(void) interrupt 21
175 
176 /*--------------------------------------------------------
177 | @Description: I2C ISR define |
178 --------------------------------------------------------*/
179 
180 #define I2C_ISRQ_Handler(void) I2C_ISR(void) interrupt 24
181 
182 /*--------------------------------------------------------
183 | @Description: LVD ISR define |
184 --------------------------------------------------------*/
185 
186 #define LVD_ISRQ_Handler(void) LVD_ISR(void) interrupt 6
187 
188 
189 /*-----------------------------------------------------------------------
190 | ISR FUNCTION(STC8x) |
191 -----------------------------------------------------------------------*/
192 
193 /*--------------------------------------------------------
194 | @Description: ADC ISR define |
195 --------------------------------------------------------*/
196 
197 #if (PER_LIB_MCU_MUODEL == STC8Ax || PER_LIB_MCU_MUODEL == STC8Gx || PER_LIB_MCU_MUODEL == STC8Hx)
198 
199  #define ADC_ISRQ_Handler(void) ADC_ISR(void) interrupt 5
200 
201 #endif
202 
203 /*--------------------------------------------------------
204 | @Description: PCA ISR define |
205 --------------------------------------------------------*/
206 
207 #if (PER_LIB_MCU_MUODEL == STC8Ax || PER_LIB_MCU_MUODEL == STC8Gx)
208 
209  #define PCA_ISRQ_Handler(void) PCA_ISR(void) interrupt 7
210 
211 #endif
212 
213 /*--------------------------------------------------------
214 | @Description: PWM ISR define |
215 --------------------------------------------------------*/
216 
217 #if (PER_LIB_MCU_MUODEL == STC8Ax)
218 
219  #define PWM_ISRQ_Handler(void) PWM_ISR(void) interrupt 22
220  #define PWM_ABD_ISRQ_Handler(void) PWM_ABD_ISR(void) interrupt 23
221 
222 #endif
223 
224 
225 
226 
227 
228 
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 #endif
239 /*-----------------------------------------------------------------------
240 | END OF FLIE (C) COPYRIGHT Gevico Electronics |
241 -----------------------------------------------------------------------*/
NVICPri_Type
Definition: ELL_CORE.h:99
@ NVIC_PR2
Definition: ELL_CORE.h:102
@ NVIC_PR0
Definition: ELL_CORE.h:100
@ NVIC_PR1
Definition: ELL_CORE.h:101
@ NVIC_PR3
Definition: ELL_CORE.h:103
void _nop_(void)
BOOL
Definition: ELL_CORE.h:50
@ ENABLE
Definition: ELL_CORE.h:52
@ DISABLE
Definition: ELL_CORE.h:51
FSCSTATE
Definition: ELL_CORE.h:65
@ FSC_FAIL
Definition: ELL_CORE.h:66
@ FSC_SUCCESS
Definition: ELL_CORE.h:67
GPIOSWPort_Type
Definition: ELL_CORE.h:81
@ SW_Port4
Definition: ELL_CORE.h:85
@ SW_Port3
Definition: ELL_CORE.h:84
@ SW_Port2
Definition: ELL_CORE.h:83
@ SW_Port1
Definition: ELL_CORE.h:82