RE: Using DLC or data byte count in frame in a CAN driver API
"Bram Kerkhof" <[email protected]>
| Newsgroups | gmane.comp.hardware.bus.can |
|---|---|
| Message-ID | <[email protected]> |
My personal preference would be to use the number of payload bytes rather than the mapped DLC values. Otherwise, user application code would have to make that conversion somewhere anyway with the increased risk of errors. It's the driver writer's job to get it right. I would also like to see a (runtime configurable) feature that allows for automatically selecting the best matching payload buffer size when transmitting data. E.g. with this feature enabled, I could pass a buffer with an arbitrary size up to 64 bytes to the driver and let the driver figure out which type of frame to use (i.e. smallest one that can contain all the payload data). Alternatively, when it is disabled I would only be able to pass a buffer that matches one of the allowed sizes in CAN FD. cheers, Bram -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Heinz-Jürgen Oertel Sent: woensdag 6 februari 2013 21:23 To: [email protected] Subject: [CANLIST] Using DLC or data byte count in frame in a CAN driver API Hello, currently some of us working already on integrating CAN FD in different CAN device driver software. In the past we had the Data Length Code DLC, which was a one to one translation to the number of bytes in a CAN frame. This was used in the API for receiving and transmitting CAN frames. With CAN FD that is more tricky. There is the following relationship: DLC bytes ------------------- 0 0 1 1 ... 8 8 9 12 10 16 11 20 12 24 13 32 14 48 15 64 The question is now: - should we still use the DLC when exchanging data between user application and driver - should we use a 'length' as number of bytes - or both, (but who takes care that both fit together?) Any suggestions and ideas are welcome. May be some of you are later working with such kind of software. It's on you to define the interface. Regards Heinz -- Archives and useful links: http://groups.yahoo.com/group/CANbus Subscribe and unsubscribe at www.vector.com/canlist/ Report any problems to <[email protected]> -- Archives and useful links: http://groups.yahoo.com/group/CANbus Subscribe and unsubscribe at www.vector.com/canlist/ Report any problems to <[email protected]>