On 07/25/2010 11:09 PM, Marc Kleine-Budde wrote: > Wolfgang Grandegger wrote: ... >> Well, CAN_CTRLMODE_BERR_REPORTING was introduced to reduce the CPU load >> due to bus errors by instructing the hardware to enable/disable bus >> error interrupts. If that's not possible, there is no need to support >> CAN_CTRLMODE_BERR_REPORTING. It does not tell if bus errors can be >> generated by the hardware, at least that was the initial idea. I >> realized that it's used in the Flexcan driver to suppress sending error >> frames upstream, which is OK. I will update the ESD USB2 driver accordingly. > > This way it reduces the cpu load on the flexcan driver, too. :)
Yes, to a small extend. That way it could also be used to check if bus-error reporting is supported. >> Why, the calling function needs to allocate the frame anyway. Filling > > Depends, flexcan has two functions, one for bus errors, the other for > state changes.....but this can be merged into a single function. For the moment we deal with state changes. ... >> I looked to your Flexcan implementation and I actually don't like that >> more than one state might be set in the error message. It just makes it >> tricky for the user space to handle it properly. The error message >> reports a state change to "x" and it does not matter, if it does not >> report state changes in between. What do you think? > > From the make-it-easy-for-the-userspace point of view this makes > perfectly sense! > > Two things about "tx- and rx-errs to data[6..7]." One of these can have > a value of 0x100 (IIRC it was the tx), that would not fit into an u8. Well, we have just 3 bytes left at the end and I hesitate to start the bec values on a non-byte boundary. Maybe using 3 nibbles would be acceptable. On the other hand, 256 means bus-off and it's therefore not really required. What's your favorite? > There are controllers, which are buggy, i.e. the at91. The tx-err value > has just the lower 8bits visible in the register set, but internally its > the full 9bit long. This will result into a wrong tx-err value in case > of a bus-off. All other CAN controllers use a an 8 bit value. Unfortunately, there are many hardware quirks :-(. I realized another one with setting TX/RX warning and passive state for the MSCAN: http://lxr.linux.no/#linux+v2.6.34.1/drivers/net/can/mscan/mscan.c#L363 Wolfgang. _______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
