Understanding the character device

This is a forum for the communication between the beta testers and our developers. It is only visible for PEAK-System employees and authorized testers.
Post Reply
Gabriel Guilbert
Posts: 6
Joined: Fri 5. Aug 2022, 15:08

Understanding the character device

Post by Gabriel Guilbert » 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

M.Maidhof
Support
Support
Posts: 1661
Joined: Wed 22. Sep 2010, 14:00

Re: Understanding the character device

Post by M.Maidhof » Mon 8. Aug 2022, 11:25

Hi,

please have a look on that pdf file, where we show some typical tasks for the PLIN driver.

https://www.peak-system.com/fileadmin/m ... rt_eng.pdf

Please note that a LIN slave cannot send frames and therefore can't have a scheduler. Only a LIN master is able to handle a scheduler. Please see LIN specification for more details on how LIN is working.

regards

Michael

Gabriel Guilbert
Posts: 6
Joined: Fri 5. Aug 2022, 15:08

Re: Understanding the character device

Post by Gabriel Guilbert » Wed 10. Aug 2022, 17:37

I found out that the Linux driver work in really similar way to the PLIN-API library for Windows. For anyone wondering how the ioctl()read()/write() system call work, the documentation for the PLIN-API should be good reference.

Post Reply