This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Clarification on serial port drivers


On Thu, 20 May 2010, Manuel Borchers wrote:
Am Donnerstag, den 20.05.2010, 16:58 +0300 schrieb Sergei Gavrikov:
And what is about your driver's DEVTAB entries then? I do not know: Did
you design your driver on top of some generic serial or monolith driver
is yours?  May be I missed something. Where are netx_serial_* defined?
Where those called from? Having no sources it is difficult to know about
your implementation details. I can guess only. Your serial stuff should
be handled in both places: HAL (either plf or variant part) and device
driver (devs/serial/netx ?).

Your snippets (not cut for other comments) looks good for me. IMO, you do not see /dev/serX in DBG I/O output, because you do not use the device.

FYI: By default libc console I/O used /dev/ttydiag, dive in your ecos.ecc

  cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE {
      # ...
      # user_value "\"/dev/ttydiag\""
      # value_source default
      # ...
  };

To force a usage of /dev/ser0 or /dev/tty0 for printf() you must change
this option.

Some example in bash (to use UART1)

$ ecosconfig import /dev/stdin <<<$(echo 'cdl_option CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE {user_value "\"/dev/tty1\""};')


Look your ecos.ecc and grep for ser? to get it. What application do you use? I hope that is examples/serial (good point to catch right DBG I/O).

Sergei

Well, to start with the last point: I have implemented the (dumb) serial
driver in the platform port, as do most arm9 ports. This one works fine
for the debug/console channel.

What I'm having problems with is a driver package for the UARTs. It's
sitting in devs/serial/arm/netx. It's defined as a package. Parent is
CYGPKG_IO_SERIAL_DEVICES. You'll find the cdl attached.

I followed this guide when porting the old v2 driver to v3:
http://ecos.sourceware.org/docs-3.0/ref/io-how-to-write-a-driver.html
(How to Write a Serial Hardware Interface Driver).

The devtab entry looks liek this:
-- snip --
#if defined(CYGPKG_IO_SERIAL_ARM_NETX_UART0)

 static netx_serial_info netx_serial_info0 = {Addr_uart0, CYGNUM_HAL_INTERRUPT_UART0};
 static unsigned char netx_serial_out_buf0[BUFFER_SIZE];
 static unsigned char netx_serial_in_buf0[BUFFER_SIZE];

 static SERIAL_CHANNEL_USING_INTERRUPTS(netx_serial_channel0,
                                        netx_serial_funs,
                                        netx_serial_info0,
                                        CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_ARM_NETX_UART0_BAUD),
                                        CYG_SERIAL_STOP_DEFAULT,
                                        CYG_SERIAL_PARITY_DEFAULT,
                                        CYG_SERIAL_WORD_LENGTH_DEFAULT,
                                        CYG_SERIAL_FLAGS_DEFAULT,
                                        &netx_serial_out_buf0[0], sizeof(netx_serial_out_buf0),
                                        &netx_serial_in_buf0[0], sizeof(netx_serial_in_buf0));

 DEVTAB_ENTRY(netx_serial_io0,
              "/dev/ser0",
              0,                     // Does not depend on a lower level interface
              &cyg_io_serial_devio,
              netx_serial_init,
              netx_serial_lookup,     // Serial driver may need initializing
              &netx_serial_channel0);
#endif
-- snip --

CYGPKG_IO_SERIAL_ARM_NETX_UART0 is per default on (see cdl), the serial
stuff is pulled in from my ecm:

[...]
package -hardware CYGPKG_IO_SERIAL_ARM_NETX v3_0 ;
package -template CYGPKG_IO v3_0 ;
package -template CYGPKG_IO_SERIAL v3_0 ;

[...]
cdl_component CYGPKG_IO_SERIAL_DEVICES {
   user_value 1
};

The resulting ecos.ecc shows that the packages are there and that
CYGPKG_IO_SERIAL_ARM_NETX_UART0 is selected. The libextras.a includes
the netx_serial.o file. But the application elf shows no sign of the
netx_serial_* functions.


Do you need anything more? Or any hints on the functions / call flow that initialize the serial subsystem would be great, too.

I enabled CYGDBG_IO_INIT, which shows no sign of serial initialization
besides the tty driver and the haldiag init using the
platform-implemented serial driver:

-- snip --
Init device
'/dev/ttydiag'
Init tty channel:
0x8003f54c
Init device
'/dev/haldiag'
HAL/diag SERIAL init
-- snip --


Cheers, Manuel

--
manuel@matronix.de
http://www.matronix.de

-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]