Skip to content

Commit 1d0792d

Browse files
committed
fixed some off by ones
1 parent 89e22a2 commit 1d0792d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cores/arduino/IRQManager.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
609609
mcfg->ipl = I2C_MASTER_PRIORITY;
610610

611611
if (mcfg->txi_irq == FSP_INVALID_VECTOR) {
612-
if (last_interrupt_index + WIRE_MASTER_INTERRUPT_COUNT >= PROG_IRQ_NUM){
612+
if (last_interrupt_index + WIRE_MASTER_INTERRUPT_COUNT > PROG_IRQ_NUM){
613613
rv = false;
614614
goto end_config;
615615
}
@@ -658,7 +658,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
658658
i2c_master_cfg_t *mcfg = (i2c_master_cfg_t *)p_cfg->mcfg;
659659
mcfg->ipl = I2C_MASTER_PRIORITY;
660660
if (mcfg->txi_irq == FSP_INVALID_VECTOR) {
661-
if (last_interrupt_index + WIRE_SCI_MASTER_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
661+
if (last_interrupt_index + WIRE_SCI_MASTER_INTERRUPT_COUNT > PROG_IRQ_NUM) {
662662
rv = false;
663663
goto end_config;
664664
}
@@ -707,7 +707,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
707707
scfg->eri_ipl = I2C_SLAVE_PRIORITY;
708708

709709
if (scfg->txi_irq == FSP_INVALID_VECTOR) {
710-
if (last_interrupt_index + WIRE_SLAVE_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
710+
if (last_interrupt_index + WIRE_SLAVE_INTERRUPT_COUNT > PROG_IRQ_NUM) {
711711
rv = false;
712712
goto end_config;
713713
}
@@ -773,7 +773,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
773773
uint8_t const hw_channel = reinterpret_cast<SpiMasterIrqReq_t *>(cfg)->hw_channel;
774774

775775
if (p_cfg->txi_irq == FSP_INVALID_VECTOR) {
776-
if (last_interrupt_index + SPI_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
776+
if (last_interrupt_index + SPI_INTERRUPT_COUNT > PROG_IRQ_NUM) {
777777
rv = false;
778778
goto end_config;
779779
}
@@ -825,7 +825,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
825825
uint8_t const hw_channel = reinterpret_cast<SciSpiMasterIrqReq_t *>(cfg)->hw_channel;
826826

827827
if (p_cfg->txi_irq == FSP_INVALID_VECTOR) {
828-
if (last_interrupt_index + SPI_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
828+
if (last_interrupt_index + SPI_INTERRUPT_COUNT > PROG_IRQ_NUM) {
829829
rv = false;
830830
goto end_config;
831831
}
@@ -878,7 +878,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
878878
p_cfg->ipl = CAN_PRIORITY; /* All interrupts share the same priority. */
879879

880880
if (p_cfg->error_irq == FSP_INVALID_VECTOR) {
881-
if (last_interrupt_index + CAN_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
881+
if (last_interrupt_index + CAN_INTERRUPT_COUNT > PROG_IRQ_NUM) {
882882
rv = false;
883883
goto end_config;
884884
}
@@ -936,7 +936,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
936936
p_cfg->ipl = CAN_PRIORITY; /* All interrupts share the same priority. */
937937

938938
if (p_cfg->error_irq == FSP_INVALID_VECTOR) {
939-
if (last_interrupt_index + CANFD_INTERRUPT_COUNT >= PROG_IRQ_NUM) {
939+
if (last_interrupt_index + CANFD_INTERRUPT_COUNT > PROG_IRQ_NUM) {
940940
rv = false;
941941
goto end_config;
942942
}
@@ -975,7 +975,7 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
975975
sdmmc_cfg_t *sd_cfg = (sdmmc_cfg_t *)cfg;
976976
/* SDCARD_ACCESS */
977977
if(sd_cfg->access_irq == FSP_INVALID_VECTOR) {
978-
if (last_interrupt_index + SD_INTERRUPT_COUNT >= PROG_IRQ_NUM){
978+
if (last_interrupt_index + SD_INTERRUPT_COUNT > PROG_IRQ_NUM){
979979
rv = false;
980980
goto end_config;
981981
}

0 commit comments

Comments
 (0)