VSF Documented
intc.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_ALLWINNER_F1CX00S_INTC_H__
19#define __HAL_DRIVER_ALLWINNER_F1CX00S_INTC_H__
20
21/*============================ INCLUDES ======================================*/
22#include "hal/vsf_hal_cfg.h"
23#include "../../__device.h"
25#include "./i_reg_inc.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/*============================ MACROS ========================================*/
32/*============================ MACROFIED FUNCTIONS ===========================*/
33/*============================ TYPES =========================================*/
34/*============================ GLOBAL VARIABLES ==============================*/
35/*============================ INCLUDES ======================================*/
36/*============================ PROTOTYPES ====================================*/
37
38
46{
47 if (IRQn >= 64) {
48 return ;
49 }
50
51 __COMPILER_BARRIER();
52 F1CX00S_INTC.DISABLE[(((uint32_t)IRQn) >> 5UL)] &= ~(uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
53 __COMPILER_BARRIER();
54}
55
56
66{
67 if (IRQn >= 64) {
68 return false;
69 }
70
71 return !( ( F1CX00S_INTC.DISABLE[(((uint32_t)IRQn) >> 5UL)]
72 & (1UL << (((uint32_t)IRQn) & 0x1FUL)))
73 != 0UL);
74}
75
76
83__arm
85
86
96{
97 if (IRQn >= 64) {
98 return false;
99 }
100
101 return ( ( F1CX00S_INTC.PENDING[(((uint32_t)IRQn) >> 5UL)]
102 & (1UL << (((uint32_t)IRQn) & 0x1FUL)))
103 != 0UL);
104}
105
106
114{
115 if (IRQn >= 64) {
116 return ;
117 }
118
119 F1CX00S_INTC.STIR[(((uint32_t)IRQn) >> 5UL)]
120 |= (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
121
122}
123
124
132{
133 if (IRQn >= 64) {
134 return ;
135 }
136
137
138 F1CX00S_INTC.PENDING[(((uint32_t)IRQn) >> 5UL)]
139 = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
140 F1CX00S_INTC.STIR[(((uint32_t)IRQn) >> 5UL)]
141 &= ~(uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
142
143}
144
145
147{
148 return (F1CX00S_INTC.VECTOR - F1CX00S_INTC.VTOR) >> 2;
149}
150
151
162{
163 if (IRQn >= 64) {
164 return ;
165 }
166
167 F1CX00S_INTC.PRIO[IRQn>>4] &= ~(0x03 << (IRQn & 0x0F));
168 F1CX00S_INTC.PRIO[IRQn>>4] |= ((priority & 0x03) << (IRQn & 0x0F));
169}
170
171
182{
183 if (IRQn >= 64) {
184 return 0;
185 }
186
187 return F1CX00S_INTC.PRIO[IRQn>>4] & (0x03 << (IRQn & 0x0F));
188}
189
190extern void intc_init(void);
191
192
193#ifdef __cplusplus
194}
195#endif
196
197#endif
198/* EOF */
enum IRQn IRQn_Type
IRQn
Definition f1c100s_reg.h:1131
#define __STATIC_INLINE
Definition compiler.h:14
#define F1CX00S_INTC
define the INTC register page
Definition i_reg_inc.h:134
void intc_init(void)
Definition intc.c:72
__STATIC_INLINE void intc_enable_irq(IRQn_Type IRQn)
Enable Interrupt.
Definition intc.h:45
__STATIC_INLINE void intc_priority_set(IRQn_Type IRQn, uint32_t priority)
Set Interrupt Priority.
Definition intc.h:161
__STATIC_INLINE uint32_t intc_priority_get(IRQn_Type IRQn)
Get Interrupt Priority.
Definition intc.h:181
__STATIC_INLINE bool intc_is_irq_enabled(IRQn_Type IRQn)
Get Interrupt Enable status.
Definition intc.h:65
__arm void intc_disable_irq(IRQn_Type IRQn)
Disable Interrupt.
Definition intc.c:106
__STATIC_INLINE uint32_t intc_get_active_irq(void)
Definition intc.h:146
__STATIC_INLINE void intc_pending_clear(IRQn_Type IRQn)
Clear Pending Interrupt.
Definition intc.h:131
__STATIC_INLINE void intc_pending_set(IRQn_Type IRQn)
Set Pending Interrupt.
Definition intc.h:113
__STATIC_INLINE bool intc_is_irq_pending(IRQn_Type IRQn)
Get Pending Interrupt.
Definition intc.h:95
unsigned uint32_t
Definition stdint.h:9