Understanding the character device
Posted: Fri 5. Aug 2022, 21:02
Hi all,
I'm trying to get a better understanding of the API this LIN linux driver. I've read the lin/linread/linwrite examples, but we'll have our own application use the device directly.
I understand that in "manual" mode, we can send/receive messages with write/read system calls on the character device. What is the execution flow for a LIN slave? Should it first read() the device, then write() the response (since master controls bus access)?
In "schedule" mode, is it fair to say that we don't need write()/read() system calls and everything should be done with ioctl() system calls? For the example of a LIN master (from what I understand), I can add slots to the schedule table with PLIOADDSCHDSLOT, then use PLIOSETFRMENTRY to configure the bytes or PLIOGETFRMENTRY to read the bytes.
Can the LIN slave be run in "schedule" mode also? e.g. use PLIOSETFRMENTRY/PLIOGETFRMENTRY to write/read frame bytes rather than write()/read() syscalls?
The interface is actually pretty simple and I don't think we'd need a full fledge library like under Windows, but I think we'd need a better documentation of the driver usage. Or maybe other examples.
Thank you!
Gabriel
I'm trying to get a better understanding of the API this LIN linux driver. I've read the lin/linread/linwrite examples, but we'll have our own application use the device directly.
I understand that in "manual" mode, we can send/receive messages with write/read system calls on the character device. What is the execution flow for a LIN slave? Should it first read() the device, then write() the response (since master controls bus access)?
In "schedule" mode, is it fair to say that we don't need write()/read() system calls and everything should be done with ioctl() system calls? For the example of a LIN master (from what I understand), I can add slots to the schedule table with PLIOADDSCHDSLOT, then use PLIOSETFRMENTRY to configure the bytes or PLIOGETFRMENTRY to read the bytes.
Can the LIN slave be run in "schedule" mode also? e.g. use PLIOSETFRMENTRY/PLIOGETFRMENTRY to write/read frame bytes rather than write()/read() syscalls?
The interface is actually pretty simple and I don't think we'd need a full fledge library like under Windows, but I think we'd need a better documentation of the driver usage. Or maybe other examples.
Thank you!
Gabriel