- for (idx = 0; (idx < chip->max_objects) && !(rxdf & (1<<idx)); idx++) { }
-
- /* realy i got one? */
- if (idx < chip->max_objects) {
- hcan2_irq_read_handler(chip, chip->msgobj[idx]);
-
- /* clear RXPR flag for this msgobj */
- can_write_reg_w(chip, (1 << (idx % 16)), HCAN2_RXPR0 - 2*(idx / 16));
-
- rxdf = (can_read_reg_w(chip, HCAN2_RXPR1) << 16) +
+ for (idx = 0; (idx < chip->max_objects) && rxdf; idx++)
+ if ((rxdf & (1<<idx))) {
+ hcan2_irq_read_handler(chip, chip->msgobj[idx]);
+ /* RXPR flag for this msgobj is cleared during irq_read_handler*/
+ rxdf &= ~(1 << idx);
+ }
+
+
+ DEBUGMSG("Before reset flags [0x%08x]\n", rxdf);
+ rxdf = (can_read_reg_w(chip, HCAN2_RXPR1) << 16) +