On 9/30/2024 11:50 AM, Gregory Nutt wrote:
On 9/30/2024 10:51 AM, Matteo Golin wrote:
The best idea I can come up with is to have the RN2483 driver perform such an 
`open()` call, so that the registration
function for the device takes the UART output's pathname as an input parameter 
in place of the device struct
(`uart_dev_t`). But this requires that there be a pathname for the UART 
interface as well as the RN2483. I would like to
avoid this so that the RN2483 device takes control of that UART bus and 
arbitrates all communications with the
peripheral.

There is a special set of interfaces that must be used inside of the OS to access device drivers:

  * file_open() and file_close() are the moral equivalent of open()
    and close(), but these return a struct file.  You should use the
    struct file instance to access the driver, not the raw driver
    interface.

Then there is another set file internal OS interface like:

  * file_read(), file_write(), file_seek(), etc that can be used from
    within the OS to access the file or driver.  These take the the
    struct file instance as a parameter

Do 'grep -r file_open *'  to see dozens of examples of this. There are some specific examples under drivers/ of drivers that build functionality on top a UART serial driver as you are trying to do.

Reply via email to