File tree Expand file tree Collapse file tree 7 files changed +105
-0
lines changed
Expand file tree Collapse file tree 7 files changed +105
-0
lines changed Original file line number Diff line number Diff line change 1313
1414#define MAX_HANDLERS 32
1515
16+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
17+ {
18+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
19+ }
20+
1621extern rt_atomic_t rt_interrupt_nest ;
1722
1823rt_uint32_t rt_interrupt_from_thread , rt_interrupt_to_thread ;
@@ -53,6 +58,11 @@ void rt_hw_interrupt_init()
5358 */
5459void rt_hw_interrupt_mask (int vector )
5560{
61+ if (!_interrupt_vector_is_valid (vector ))
62+ {
63+ return ;
64+ }
65+
5666 /* disable interrupt */
5767 AT91C_AIC_IDCR = 1 << vector ;
5868
@@ -66,6 +76,11 @@ void rt_hw_interrupt_mask(int vector)
6676 */
6777void rt_hw_interrupt_umask (int vector )
6878{
79+ if (!_interrupt_vector_is_valid (vector ))
80+ {
81+ return ;
82+ }
83+
6984 AT91C_AIC_IECR = 1 << vector ;
7085}
7186
Original file line number Diff line number Diff line change 1515
1616#define MAX_HANDLERS 32
1717
18+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
19+ {
20+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
21+ }
22+
1823/* exception and interrupt handler table */
1924struct rt_irq_desc irq_desc [MAX_HANDLERS ];
2025
@@ -65,6 +70,11 @@ void rt_hw_interrupt_init(void)
6570 */
6671void rt_hw_interrupt_mask (int vector )
6772{
73+ if (!_interrupt_vector_is_valid (vector ))
74+ {
75+ return ;
76+ }
77+
6878 /* disable interrupt */
6979 AT91C_BASE_AIC -> AIC_IDCR = 1 << vector ;
7080
@@ -78,6 +88,11 @@ void rt_hw_interrupt_mask(int vector)
7888 */
7989void rt_hw_interrupt_umask (int vector )
8090{
91+ if (!_interrupt_vector_is_valid (vector ))
92+ {
93+ return ;
94+ }
95+
8196 AT91C_BASE_AIC -> AIC_IECR = 1 << vector ;
8297}
8398
Original file line number Diff line number Diff line change 1616#define MAX_HANDLERS 32
1717#define SVCMODE 0x13
1818
19+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
20+ {
21+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
22+ }
23+
1924extern rt_atomic_t rt_interrupt_nest ;
2025
2126/* exception and interrupt handler table */
@@ -116,6 +121,11 @@ void rt_hw_interrupt_init(void)
116121 */
117122void rt_hw_interrupt_mask (int vector )
118123{
124+ if (!_interrupt_vector_is_valid (vector ))
125+ {
126+ return ;
127+ }
128+
119129 VICIntEnClr = (1 << vector );
120130}
121131
@@ -125,6 +135,11 @@ void rt_hw_interrupt_mask(int vector)
125135 */
126136void rt_hw_interrupt_umask (int vector )
127137{
138+ if (!_interrupt_vector_is_valid (vector ))
139+ {
140+ return ;
141+ }
142+
128143 VICIntEnable = (1 << vector );
129144}
130145
Original file line number Diff line number Diff line change 1515
1616#define MAX_HANDLERS 32
1717
18+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
19+ {
20+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
21+ }
22+
1823/* exception and interrupt handler table */
1924struct rt_irq_desc irq_desc [MAX_HANDLERS ];
2025
@@ -65,11 +70,21 @@ void rt_hw_interrupt_init(void)
6570
6671void rt_hw_interrupt_mask (int vector )
6772{
73+ if (!_interrupt_vector_is_valid (vector ))
74+ {
75+ return ;
76+ }
77+
6878 VICIntEnClr = (1 << vector );
6979}
7080
7181void rt_hw_interrupt_umask (int vector )
7282{
83+ if (!_interrupt_vector_is_valid (vector ))
84+ {
85+ return ;
86+ }
87+
7388 VICIntEnable = (1 << vector );
7489}
7590
Original file line number Diff line number Diff line change 1515
1616#define MAX_HANDLERS 32
1717
18+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
19+ {
20+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
21+ }
22+
1823extern rt_atomic_t rt_interrupt_nest ;
1924
2025/* exception and interrupt handler table */
@@ -77,6 +82,11 @@ void rt_hw_interrupt_init(void)
7782 */
7883void rt_hw_interrupt_mask (int vector )
7984{
85+ if (!_interrupt_vector_is_valid (vector ))
86+ {
87+ return ;
88+ }
89+
8090 INTMSK |= 1 << vector ;
8191}
8292
@@ -86,6 +96,11 @@ void rt_hw_interrupt_mask(int vector)
8696 */
8797void rt_hw_interrupt_umask (int vector )
8898{
99+ if (!_interrupt_vector_is_valid (vector ))
100+ {
101+ return ;
102+ }
103+
89104 if (vector == INTNOTUSED6 )
90105 {
91106 rt_kprintf ("Interrupt vec %d is not used!\n" , vector );
Original file line number Diff line number Diff line change 1515
1616#define MAX_HANDLERS 26
1717
18+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
19+ {
20+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
21+ }
22+
1823extern rt_atomic_t rt_interrupt_nest ;
1924
2025/* exception and interrupt handler table */
@@ -114,6 +119,11 @@ void rt_hw_interrupt_init()
114119 */
115120void rt_hw_interrupt_mask (int vector )
116121{
122+ if (!_interrupt_vector_is_valid (vector ))
123+ {
124+ return ;
125+ }
126+
117127 INTMSK |= 1 << vector ;
118128}
119129
@@ -123,6 +133,11 @@ void rt_hw_interrupt_mask(int vector)
123133 */
124134void rt_hw_interrupt_umask (int vector )
125135{
136+ if (!_interrupt_vector_is_valid (vector ))
137+ {
138+ return ;
139+ }
140+
126141 INTMSK &= ~(1 << vector );
127142}
128143
Original file line number Diff line number Diff line change 1515
1616#define MAX_HANDLERS 32
1717
18+ rt_inline rt_bool_t _interrupt_vector_is_valid (int vector )
19+ {
20+ return (vector >= 0 ) && (vector < MAX_HANDLERS );
21+ }
22+
1823extern rt_atomic_t rt_interrupt_nest ;
1924
2025/* exception and interrupt handler table */
@@ -82,6 +87,11 @@ void rt_hw_interrupt_init(void)
8287 */
8388void rt_hw_interrupt_mask (int vector )
8489{
90+ if (!_interrupt_vector_is_valid (vector ))
91+ {
92+ return ;
93+ }
94+
8595 * (RP )(INTC_IMR ) |= 1 << vector ;
8696}
8797
@@ -91,6 +101,11 @@ void rt_hw_interrupt_mask(int vector)
91101 */
92102void rt_hw_interrupt_umask (int vector )
93103{
104+ if (!_interrupt_vector_is_valid (vector ))
105+ {
106+ return ;
107+ }
108+
94109 if (vector == 16 )
95110 {
96111 rt_kprintf ("Interrupt vec %d is not used!\n" , vector );
You can’t perform that action at this time.
0 commit comments