Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change fixes some issues where watermark sizes were interpreted the wrong way. Before this commit, watermarks for Rx FIFOs and Tx Event FIFO were clamped to the maximum permissible watermark. But the behavior according to the users manual is that watermark sizes over the maximum permissible will disable the corresponding interrupt. P.31 and p.34 of the M_CAN users manual v330 states that Rx FIFO Watermarks, FnWM, can take values 1-64 inclusive. Any value greater than 64 is interpreted as "Watermark interrupt disabled". P.44 of the M_CAN users manual v330 states that the Tx Event FIFO Watermark, EFWM, can take values 1-32 inclusive, Any value greater than 32 is interpreted as "Watermark interrupt disabled". This change makes the implementation consistent with the users manual on those specifics. A value greater than the maximum will be changed to zero for consistency. The bit ranges are 6 bits wide for the Tx Event and 7 bits wide for the Rx configs but the u8 datatype is used in the software interface. That u8 will be masked and shifted so that f.ex. writing 129 to either bit range will actually set the value to 1, not consistent with the user manual. Clamping to any value over the maximum seems arbitrary, and for that reason values larger than the maximum permissible are set to zero, which also disables the interrupt.
- Loading branch information