@@ -67,8 +67,10 @@ bool IRQManager::addADCScanEnd(ADC_Container *adc, Irq_f fnc /*= nullptr*/) {
67
67
/* set the displacement to the "programmable" part of the table */
68
68
irq_ptr += FIXED_IRQ_NUM;
69
69
bool rv = true ;
70
-
71
- if (adc->cfg .scan_end_irq == FSP_INVALID_VECTOR) {
70
+ if (last_interrupt_index >= PROG_IRQ_NUM){
71
+ rv = false ;
72
+ }
73
+ else if (adc->cfg .scan_end_irq == FSP_INVALID_VECTOR) {
72
74
if (set_adc_end_link_event (last_interrupt_index, adc->cfg .unit )) {
73
75
adc->cfg .scan_end_ipl = TIMER_PRIORITY;
74
76
adc->cfg .scan_end_irq = (IRQn_Type)last_interrupt_index;
@@ -101,8 +103,10 @@ bool IRQManager::addADCScanEndB(ADC_Container *adc, Irq_f fnc /*= nullptr*/) {
101
103
/* set the displacement to the "programmable" part of the table */
102
104
irq_ptr += FIXED_IRQ_NUM;
103
105
bool rv = true ;
104
-
105
- if (adc->cfg .scan_end_b_irq == FSP_INVALID_VECTOR) {
106
+ if (last_interrupt_index >= PROG_IRQ_NUM){
107
+ rv = false ;
108
+ }
109
+ else if (adc->cfg .scan_end_b_irq == FSP_INVALID_VECTOR) {
106
110
if (set_adc_end_b_link_event (last_interrupt_index, adc->cfg .unit )) {
107
111
adc->cfg .scan_end_b_ipl = TIMER_PRIORITY;
108
112
adc->cfg .scan_end_b_irq = (IRQn_Type)last_interrupt_index;
@@ -125,8 +129,10 @@ bool IRQManager::addADCWinCmpA(ADC_Container *adc, Irq_f fnc /*= nullptr*/) {
125
129
/* set the displacement to the "programmable" part of the table */
126
130
irq_ptr += FIXED_IRQ_NUM;
127
131
bool rv = true ;
128
-
129
- if ( ((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_a_irq == FSP_INVALID_VECTOR) {
132
+ if (last_interrupt_index >= PROG_IRQ_NUM){
133
+ rv = false ;
134
+ }
135
+ else if ( ((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_a_irq == FSP_INVALID_VECTOR) {
130
136
if (set_adc_win_a_link_event (last_interrupt_index, adc->cfg .unit )) {
131
137
((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_a_ipl = TIMER_PRIORITY;
132
138
((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_a_irq = (IRQn_Type)last_interrupt_index;
@@ -150,8 +156,10 @@ bool IRQManager::addADCWinCmpB(ADC_Container *adc, Irq_f fnc /*= nullptr*/) {
150
156
/* set the displacement to the "programmable" part of the table */
151
157
irq_ptr += FIXED_IRQ_NUM;
152
158
bool rv = true ;
153
-
154
- if (((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_b_irq == FSP_INVALID_VECTOR) {
159
+ if (last_interrupt_index >= PROG_IRQ_NUM){
160
+ rv = false ;
161
+ }
162
+ else if (((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_b_irq == FSP_INVALID_VECTOR) {
155
163
if (set_adc_win_b_link_event (last_interrupt_index, adc->cfg .unit )) {
156
164
((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_b_ipl = TIMER_PRIORITY;
157
165
((adc_extended_cfg_t *)(adc->cfg .p_extend ))->window_b_irq = (IRQn_Type)last_interrupt_index;
@@ -177,8 +185,10 @@ bool IRQManager::addTimerOverflow(TimerIrqCfg_t &cfg, Irq_f fnc /* = nullptr */)
177
185
/* set the displacement to the "programmable" part of the table */
178
186
irq_ptr += FIXED_IRQ_NUM;
179
187
bool rv = true ;
180
-
181
- if (cfg.base_cfg ->cycle_end_irq == FSP_INVALID_VECTOR) {
188
+ if (last_interrupt_index >= PROG_IRQ_NUM){
189
+ rv = false ;
190
+ }
191
+ else if (cfg.base_cfg ->cycle_end_irq == FSP_INVALID_VECTOR) {
182
192
if (cfg.gpt_ext_cfg != nullptr ) {
183
193
if (set_gpt_over_link_event (last_interrupt_index, cfg.base_cfg ->channel )) {
184
194
cfg.base_cfg ->cycle_end_ipl = TIMER_PRIORITY;
@@ -224,7 +234,7 @@ bool IRQManager::addTimerUnderflow(TimerIrqCfg_t &cfg, Irq_f fnc /*= nullptr*/)
224
234
irq_ptr += FIXED_IRQ_NUM;
225
235
bool rv = true ;
226
236
227
- if (cfg.agt_ext_cfg != nullptr ) {
237
+ if (( cfg.agt_ext_cfg != nullptr ) || (last_interrupt_index >= PROG_IRQ_NUM) ) {
228
238
/* not supported for AGT */
229
239
rv = false ;
230
240
}
@@ -258,7 +268,7 @@ bool IRQManager::addTimerCompareCaptureA(TimerIrqCfg_t &cfg, Irq_f fnc /*= nullp
258
268
irq_ptr += FIXED_IRQ_NUM;
259
269
bool rv = true ;
260
270
261
- if (cfg.agt_ext_cfg != nullptr ) {
271
+ if (( cfg.agt_ext_cfg != nullptr ) || (last_interrupt_index >= PROG_IRQ_NUM) ) {
262
272
/* not supported for AGT */
263
273
rv = false ;
264
274
}
@@ -292,7 +302,7 @@ bool IRQManager::addTimerCompareCaptureB(TimerIrqCfg_t &cfg, Irq_f fnc /*= nullp
292
302
irq_ptr += FIXED_IRQ_NUM;
293
303
bool rv = true ;
294
304
295
- if (cfg.agt_ext_cfg != nullptr ) {
305
+ if (( cfg.agt_ext_cfg != nullptr ) || (last_interrupt_index >= PROG_IRQ_NUM) ) {
296
306
/* not supported for AGT */
297
307
rv = false ;
298
308
}
@@ -326,8 +336,10 @@ bool IRQManager::addDMA(dmac_extended_cfg_t &cfg, Irq_f fnc /* = nullptr */) {
326
336
/* set the displacement to the "programmable" part of the table */
327
337
irq_ptr += FIXED_IRQ_NUM;
328
338
bool rv = true ;
329
-
330
- if (cfg.irq == FSP_INVALID_VECTOR) {
339
+ if (last_interrupt_index >= PROG_IRQ_NUM){
340
+ rv = false ;
341
+ }
342
+ else if (cfg.irq == FSP_INVALID_VECTOR) {
331
343
/* to check correctness of the channel */
332
344
if (set_dma_link_event (last_interrupt_index, cfg.channel )) {
333
345
cfg.ipl = DMA_PRIORITY;
@@ -357,6 +369,11 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
357
369
irq_ptr += FIXED_IRQ_NUM;
358
370
bool rv = true ;
359
371
372
+ if (last_interrupt_index >= PROG_IRQ_NUM){
373
+ rv = false ;
374
+ goto end_config;
375
+ }
376
+
360
377
__disable_irq ();
361
378
/* **********************************************************************
362
379
USB
0 commit comments