Re: Single UART handling multiple devices.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 13, 2009 at 3:52 PM,
srinivasramana<srinivas.ramana@xxxxxxxxx> wrote:
>
> Hi All,
>
> I have been working on the feasibility of having multiple device
> nodes(serial type device) for a single device so that applications can treat
> each of these device nodes as separate devices.
>
> 1. Can i write a tty driver which creates multiple nodes(i will set minors
> to the number of nodes i need)
> 2. Now, If I write from user space on any of these nodes i have seen that it
> comes to the tty drivers write call.
> 3. I want to know how do i link my physical driver with this tty driver?
> 4. If mutiple applications are waiting on read on different nodes, how do i
> wake up a particular read based on the incoming data from hardware(on Rx
> interrupt)?
>
> please help.
>
> Thanks & Regards,
> -- Srinivas R
>
>
>
> srinivasramana wrote:
>>
>> Hi,
>>
>> Thanks for the response. I have explored the option of FIFOs, but the
>> issue is I need Full duplex support from the devices. In that case I will
>> have to use two FIFOs for each device. So, it would be good to know if
>> there is any better option.
>>
>> Also, I was thinking of multiple virtual device nodes with single UART.
>> But, I want to know how do I have these layers communicate? multiple
>> virtual ttys with single UART work?
>> Please suggest.
>>
>> Thanks & Regards,
>> -- Srinivas R
>>
>>
>> matthias-44 wrote:
>>>
>>> Hi,
>>>
>>> Why you don't put everything in user space. So you just need the
>>> driver to communicate with your UART port.
>>> Use pipes for communication between your applications and the
>>> UART-controller-application in user space.
>>>
>>> regards,
>>> Matthias
>>>
>>> 2009/7/19 srinivas ramana <srinivas.ramana@xxxxxxxxx>:
>>>> Hi All,
>>>>
>>>> I have a UART port on my device. A micro controller which drives
>>>> multiple
>>>> other devices is connected to this UART port.
>>>> I need all those devices, connected to micro controller, to be visible
>>>> to
>>>> Linux applications as separate UART devices/ports.
>>>>
>>>> What is the best way to do this? What all driver layers i need to
>>>> add/modify. Please help.
>>>> Thanks in advance.
>>>>
>>>> Note: assume there is a protocol between micro controller & Linux to
>>>> understand which device is requesting service.
>>>>
>>>> Thanks & Regards,
>>>> -- Srinivas R

I'm going to ignore the electrical aspect of multidrop rs-232, but I
really don't think that works at all.

Assuming you have somehow overcome that major hurdle, I don't
understand your problem.

You start with a standard multi-port uart serial driver.  Then modify
it such that when data comes in your driver decodes the protocol to
get the address/routing info and delivers the data payload to
appropriate device (/dev/ttyx) as if it were a multi-port device.

On write, your driver gets data from userspace (/dev/ttyx) and wraps
the comm protocol around it and sends it on its way.

>From a software perspective none of this unusual, strange, or weird in any way.

If you think about a 8-port serial card, it works exactly as you
describe.  A single hardware driver gets the incoming data from the
card, decodes the cards signaling protocol and delivers the data to
the correct device (/dev/ttyx).   And on write, it uses the cards
signalling protocol to tell it which port to send the data out.  The
only difference is a hardware card uses hardware registers to control
the routing, where as you have it embedded in the data stream.

Note: TCP/IP also embeds the routing info in the data stream  (ie. the
port).  It is a totally standard thing to do.

Greg
-- 
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
Preservation and Forensic processing of Exchange Repositories White Paper -
<http://www.norcrossgroup.com/forms/whitepapers/tng_whitepaper_fpe.html>

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux