Avi Weiss created an issue: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5594



## Summary
`bsp_reset` tries to clear ESM channel `4294967295` and then skips channel `0` 
(`IOFFHR == 1`)

## Steps to reproduce
I added a test probe:
```c
...
raw=0: 0x00000000, channel=(raw-1)=4294967295 / 0xffffffff
raw=0: *** INSIDE THE "if (esm_irq_channel)" BLOCK ***
handle_esm_errors: channel=4294967295 / 0xffffffff outside range
...
raw=1: 0x00000001, channel=(raw-1)=0 / 0x00000000
raw=1: DID NOT enter if (esm_irq_channel)
...
raw=2: 0x00000002, channel=(raw-1)=1 / 0x00000001
raw=2: *** INSIDE THE "if (esm_irq_channel)" BLOCK ***
handle_esm_errors: clearing SR[0] bit 1, mask=0x00000002
```

This shows that when:  
`IOFFHR == 0` - becomes `UINT32_MAX` and enters the `if`  
`IOFFHR == 1` - becomes `0` and does not enter the `if` block  
`IOFFHR == 2` - works as expected  

## Expected behaviour
Correct the logic so expected channels are cleared. 
I think the correct logic pattern can be seen in `bsp_interrupt_dispatch()`:
```c
void bsp_interrupt_dispatch(void)
{
  while (true) {
    uint32_t irqindex;

    irqindex = TMS570_VIM.IRQINDEX;

    if (irqindex == 0) {
      return;
    }

    bsp_interrupt_handler_dispatch(irqindex - 1);
  }
}
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5594
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to