Yes, that was one of the main reasons for selecting to use the linux kernel
and OS, to eliminate driver development for peripherals such as ethernet and
file system support which can be time consuming at an embedded level.
But still I need to manipulate these peripherals even if it only their
parameters/settings.

I've been working through the kernel documentation but cant get to the
bottom of things.
Lets take for example the UART baudrate, how do I set that? It will be a
file write procedure for the UART settings, but which file?

I've been looking at the examples from friendlyarm. Is the ptx peripheral
control the same or is it different?
lets take a simple uart example from the friendlyarm examples:

struct termios TtyAttr;
struct termios BackupTtyAttr;

CommFd = open("/dev/ttyS0", O_RDWR, 0);

memset(&TtyAttr, 0, sizeof(struct termios));
TtyAttr.c_iflag = IGNPAR;
TtyAttr.c_cflag = DeviceSpeed | HUPCL | ByteBits | CREAD | CLOCAL;
TtyAttr.c_cc[VMIN] = 1;

TtyFd = open("/dev/tty", O_RDWR | O_NDELAY, 0);

TtyAttr.c_cflag = TtySpeed | HUPCL | ByteBits | CREAD | CLOCAL;

tcsetattr(TtyFd, TCSANOW, &TtyAttr)

>From these example there is struct, where can I find a prototype of the
struct to know what parameters it can take?
In the struct is a c_clag parameter. Where can I find a list of supported
flags?
Then there is tcsetattr function, where can I find a prototype of the
function with a description of parameters that is passed to it?

Clearly the kernel provides an abstraction layer or library through which I
can access the peripherals.
I honestly have been working through the kernel documentation but could not
find relevant information.

I'm not asking ptx because I need ptx to give me the answers, I'm asking ptx
because I'm not sure whether your peripheral abstraction layer is different
from other kernel branches.

Will you please be so kind as to direct me or guide me to the relevant
literature.

Thank you



On Thu, Jun 30, 2011 at 2:36 PM, Josef Holzmayr <
[email protected]> wrote:

> > I almost have all the tools I require. One of the big outstanding items
> is
> > documentation or examples for peripheral initialization and control in C.
> > You have given me an example for the IO control but I still need info on
> the
> > following:
> >
> > - Serial (UART)
> > - Ethernet
> > - Timers
> > - Delays (builtin if any)
> > - Threads
> > - Interrupts for all peripheral events
>
> I guess the better approach is to have a thorough look at the linux kernel
> drivers and their infrastructure. PTXdist is meant for building an embedded
> _linux_ system, where linux means you have an os kernel that handles this
> stuff for you and provides an abstract, stable interface to it.
>
> For example taking the UARTs:
> they get provided as /dev/tty* nodes. You just use them like any other
> file, no need to do some initialization/control stuff like in the embedded
> market (where you obviously come from).
>
> The already existing device drivers will probably make up ~99.5% of all
> your hardware handling code, and for the rest there's things like UIO, for
> example.
>
> But it's really essential to get your head around the OS kernel thing and
> stop thinking embedded.
>
> Greetz Sepp
>
> Dipl-Ing. (FH) J. Holzmayr
> Entwicklung Embedded Devices / Software
>
> Telefon: (08444) 9204-48
> Telefax: (08444) 9204-50
>
> R-S-I Elektrotechnik GmbH & Co. KG
> Woelkestrasse 11
> 85301 Schweitenkirchen
> Germany
>
>
> Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
> Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
> USt-IdNr.: DE 128592548
>
>
>
> --
> ptxdist mailing list
> [email protected]
>
-- 
ptxdist mailing list
[email protected]

Reply via email to