public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Clarification on serial port drivers
@ 2010-05-20 11:30 Manuel Borchers
  2010-05-20 13:21 ` Sergei Gavrikov
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Borchers @ 2010-05-20 11:30 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 1765 bytes --]

Hi all,

in the process of porting to the netX family, I'm somewhat stuck with
the serial port drivers. I got an old (non-officially) version of a
serial driver for these chips. They were written for eCos v2, so what I
modified them a bit and went through the APIs and function calls. I'm
using and going through the porting/writing guide at
http://ecos.sourceware.org/docs-3.0/ref/io-how-to-write-a-driver.html.

Everything seems quite right and in the build process I can see that my
netx_serial.o is linked into libextras.a

The configuration includes the driver as well as the common serial io
driver and the tty driver.

But when I link my simple serial demo application, which tries to
use /dev/haldiag, /dev/ser0 and printf directly, /dev/haldiag works
fine. /dev/ser0 isnt't found and printf rises the assertion "
Cyg_StdioStream::write() Stream object is not a valid stream!".

So I used arm-eabi-nm to see if the serial routines have been linked in.
And there I saw, that the netx_serial* functions aren't in there. only
the general serial functions are there, but the serial_init() is never
being called.

So, I'm somewhat stuck here.
What I didn't get quite clear in my mind is the playing together of the
(dumb) serial driver in the platform port and the 'real' serial driver
(as a package).

The dumb driver seems to work fine, as /dev/haldiag is using it and the
assertions come through fine on the port.

I've configured the debug and console channel to be on the second port
of the board, so it doesn't interfer with the first port, which should
be grabbed by the serial driver package.

Any hints, pointers and clarifications are welcome!

Cheers,
Manuel

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

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 11:30 [ECOS] Clarification on serial port drivers Manuel Borchers
@ 2010-05-20 13:21 ` Sergei Gavrikov
  2010-05-20 13:58   ` Manuel Borchers
  0 siblings, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2010-05-20 13:21 UTC (permalink / raw)
  To: Manuel Borchers; +Cc: ecos-discuss

On Thu, 20 May 2010, Manuel Borchers wrote:

[snip]

> But when I link my simple serial demo application, which tries to
> use /dev/haldiag, /dev/ser0 and printf directly, /dev/haldiag works
> fine. /dev/ser0 isnt't found and printf rises the assertion "
> Cyg_StdioStream::write() Stream object is not a valid stream!".
>
> So I used arm-eabi-nm to see if the serial routines have been linked in.
> And there I saw, that the netx_serial* functions aren't in there. only
> the general serial functions are there, but the serial_init() is never
> being called.

Hi Manuel,

You must enable next CDL component: CYGPKG_IO_SERIAL_DEVICES to built-in
your serial driver.

HIH

Sergei

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 13:21 ` Sergei Gavrikov
@ 2010-05-20 13:58   ` Manuel Borchers
  2010-05-20 15:30     ` Sergei Gavrikov
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Borchers @ 2010-05-20 13:58 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

Hi Sergei,

Am Donnerstag, den 20.05.2010, 14:51 +0300 schrieb Sergei Gavrikov: 
> You must enable next CDL component: CYGPKG_IO_SERIAL_DEVICES to built-in
> your serial driver.

I did that, but still no joy. in the resulting elf there is no sign of
my driver. And setting a breakpoint on the general serial_init() shows
that the init is not called at all.

Any other hints? Or anything you need to know (config)?

Cheers,
Manuel

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

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 13:58   ` Manuel Borchers
@ 2010-05-20 15:30     ` Sergei Gavrikov
  2010-05-20 16:07       ` Manuel Borchers
  0 siblings, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2010-05-20 15:30 UTC (permalink / raw)
  To: Manuel Borchers; +Cc: ecos-discuss

On Thu, 20 May 2010, Manuel Borchers wrote:

> Hi Sergei,
>
> Am Donnerstag, den 20.05.2010, 14:51 +0300 schrieb Sergei Gavrikov:
>> You must enable next CDL component: CYGPKG_IO_SERIAL_DEVICES to built-in
>> your serial driver.
>
> I did that, but still no joy. in the resulting elf there is no sign of
> my driver. And setting a breakpoint on the general serial_init() shows
> that the init is not called at all.
>
> Any other hints? Or anything you need to know (config)?

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 ?).

Sergei

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 15:30     ` Sergei Gavrikov
@ 2010-05-20 16:07       ` Manuel Borchers
  2010-05-21  0:04         ` Sergei Gavrikov
  2010-05-21  9:28         ` Sergei Gavrikov
  0 siblings, 2 replies; 10+ messages in thread
From: Manuel Borchers @ 2010-05-20 16:07 UTC (permalink / raw)
  To: ecos-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3765 bytes --]

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 ?).

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

[-- Attachment #1.2: ser_arm_netx.cdl --]
[-- Type: text/plain, Size: 5116 bytes --]

# ====================================================================
#
#      ser_arm_netx.cdl
#
#      eCos serial ARM/netX configuration data
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s):      Michael Trensch
# Original data:  
# Contributors:	  
# Date:           March 11, 2006
#
#####DESCRIPTIONEND####
#
# ====================================================================


cdl_package CYGPKG_IO_SERIAL_ARM_NETX {
    display       "Hilscher netX serial device drivers"

    parent        CYGPKG_IO_SERIAL_DEVICES
    active_if     CYGPKG_IO_SERIAL
    active_if     CYGPKG_HAL_ARM_ARM9_NETX50

    requires      CYGPKG_ERROR
    include_dir   cyg/io
    description   "
           This option enables the serial device drivers for the
           Hilscher netX."

    compile       -library=libextras.a netx_serial.c

    cdl_component CYGPKG_IO_SERIAL_ARM_NETX_UART0 {
	    display       "Hilscher netX UART 0 driver"
	    flavor        bool
	    default_value 1
	    description   "
            This option includes the serial device driver for the Hilscher netX 
            UART 0."

	    cdl_option CYGNUM_IO_SERIAL_ARM_NETX_UART0_BAUD {
	        display       "Baud rate for the Hilscher netX UART 0 driver"
  	      flavor        data
	        legal_values  { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600
	    	  	      4800 7200 9600 14400 19200 38400 57600 115200 234000
			    }
	        default_value 115200
	        description   "
                This option specifies the default baud rate (speed) for the 
                Hilscher netX UART 0."
  	  }
    }

    cdl_component CYGPKG_IO_SERIAL_ARM_NETX_UART1 {
	    display       "Hilscher netX UART 1 driver"
	    flavor        bool
	    default_value 0
	    description   "
            This option includes the serial device driver for the Hilscher netX 
            UART 1."

	    cdl_option CYGNUM_IO_SERIAL_ARM_NETX_UART1_BAUD {
	        display       "Baud rate for the Hilscher netX UART 1 driver"
  	      flavor        data
	        legal_values  { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600
	    	  	      4800 7200 9600 14400 19200 38400 57600 115200 234000
			    }
	        default_value 115200
	        description   "
                This option specifies the default baud rate (speed) for the 
                Hilscher netX UART 1."
  	  }
    }

    cdl_component CYGPKG_IO_SERIAL_ARM_NETX_UART2 {
	    display       "Hilscher netX UART 2 driver"
	    flavor        bool
	    default_value 0
	    description   "
            This option includes the serial device driver for the Hilscher netX 
            UART 2."

	    cdl_option CYGNUM_IO_SERIAL_ARM_NETX_UART2_BAUD {
	        display       "Baud rate for the Hilscher netX UART 2 driver"
  	      flavor        data
	        legal_values  { 50 75 110 "134_5" 150 200 300 600 1200 1800 2400 3600
	    	  	      4800 7200 9600 14400 19200 38400 57600 115200 234000
			    }
	        default_value 115200
	        description   "
                This option specifies the default baud rate (speed) for the 
                Hilscher netX UART 2."
  	  }
    }
}

# EOF ser_arm_netx.cdl

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 16:07       ` Manuel Borchers
@ 2010-05-21  0:04         ` Sergei Gavrikov
  2010-05-21  9:06           ` Manuel Borchers
  2010-05-21  9:28         ` Sergei Gavrikov
  1 sibling, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2010-05-21  0:04 UTC (permalink / raw)
  To: Manuel Borchers; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-21  0:04         ` Sergei Gavrikov
@ 2010-05-21  9:06           ` Manuel Borchers
  0 siblings, 0 replies; 10+ messages in thread
From: Manuel Borchers @ 2010-05-21  9:06 UTC (permalink / raw)
  To: ecos-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1457 bytes --]

Am Donnerstag, den 20.05.2010, 19:06 +0300 schrieb Sergei Gavrikov: 
> 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).

I tried your suggestion, but this changes nothing at all.

I'm using a modified version of the serial example, that tries to print
using /dev/haldiag (works) and /dev/ser0 (-ENOENT). As a last step it
tries to write using printf.
In the beginning the source checks for CYGPKG_IO_SERIAL_ARM_NETX and
CYGPKG_IO_SERIAL_ARM_NETX_UART0 being defined, and in case it is not
raising an error (which is not the case, so the ecc seems to include
them). See the attached file.

So, I stepped a little bit more with my debugger an stopped in
cyg_io_lookup(). I investigated __DEVTAB__ and the only elements
are /dev/ttydiag and /dev/haldiag. No sign of /dev/ser0.

I'm not quite familiar with how and where each packages pull each other
in, but it seems as the netx_serial driver isn't pulled in properly. Any
way I can check that? How is the process of starting up the serial
devices?

Cheers,
Manuel

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

[-- Attachment #1.2: serial.c --]
[-- Type: text/x-csrc, Size: 2866 bytes --]

/* 
 * Written 1999-03-19 by Jonathan Larmour, Cygnus Solutions
 * This file is in the public domain and may be used for any purpose
 */

/* CONFIGURATION CHECKS */

#include <pkgconf/system.h>     /* which packages are enabled/disabled */
#ifdef CYGPKG_KERNEL
# include <pkgconf/kernel.h>
#endif
#ifdef CYGPKG_LIBC
# include <pkgconf/libc.h>
#endif
#ifdef CYGPKG_IO_SERIAL
# include <pkgconf/io_serial.h>
#endif

#ifndef CYGFUN_KERNEL_API_C
# error Kernel API must be enabled to build this example
#endif

#ifndef CYGPKG_LIBC_STDIO
# error C library standard I/O must be enabled to build this example
#endif

#ifndef CYGPKG_IO_SERIAL_HALDIAG
# error I/O HALDIAG pseudo-device driver must be enabled to build this example
#endif

#ifndef CYGPKG_IO_SERIAL_ARM_NETX
# error netX serial driver is not included
#else
#include <pkgconf/io_serial_arm_netx.h>
#endif

#ifndef CYGPKG_IO_SERIAL_ARM_NETX_UART0
# error netX UART0 not defined
#endif


/* INCLUDES */

#include <stdio.h>                      /* printf */
#include <string.h>                     /* strlen */
#include <cyg/kernel/kapi.h>            /* All the kernel specific stuff */
#include <cyg/io/io.h>                  /* I/O functions */
#include <cyg/hal/hal_arch.h>           /* CYGNUM_HAL_STACK_SIZE_TYPICAL */

#include <cyg/infra/diag.h>



/* DEFINES */

#define NTHREADS 1
#define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL + 4096 )

/* STATICS */

static cyg_handle_t thread[NTHREADS];
static cyg_thread thread_obj[NTHREADS];
static char stack[NTHREADS][STACKSIZE];

/* FUNCTIONS */

static void simple_prog(CYG_ADDRESS data)
{
    cyg_io_handle_t handle;
    Cyg_ErrNo err;
    const char test_string[] = "serial example is working correctly!\n";
    cyg_uint32 len = strlen(test_string);

    diag_printf("Starting serial example\n");

    err = cyg_io_lookup( "/dev/haldiag", &handle );
    
    if (ENOERR == err) {
        diag_printf("Found /dev/haldiag. Writing string....\n");
        err = cyg_io_write( handle, test_string, &len );
        if (ENOERR == err) {
            diag_printf("I think I wrote the string. Did you see it?\n");
        }
    }

    err = cyg_io_lookup( "/dev/ser0", &handle );

    if (ENOERR == err) {
        diag_printf("Found /dev/ser0. Writing string....\n");
        err = cyg_io_write( handle, test_string, &len );
        if (ENOERR == err) {
            diag_printf("I think I wrote the string. Did you see it?\n");
        }
    }
    

    diag_printf("Serial example finished\n");
    printf("Serial example finished (printf)\n");
}

void cyg_user_start(void)
{
    cyg_thread_create(4, simple_prog, (cyg_addrword_t) 0, "serial",
                      (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
    cyg_thread_resume(thread[0]);
}

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-20 16:07       ` Manuel Borchers
  2010-05-21  0:04         ` Sergei Gavrikov
@ 2010-05-21  9:28         ` Sergei Gavrikov
  2010-05-21 14:48           ` Manuel Borchers
  1 sibling, 1 reply; 10+ messages in thread
From: Sergei Gavrikov @ 2010-05-21  9:28 UTC (permalink / raw)
  To: Manuel Borchers; +Cc: ecos-discuss

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?

[snip]

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

Ups. I missed important thing. I reviewed your attached serial CDL file
and I did not find something likes the below there:

     cdl_option CYGDAT_IO_SERIAL_ARM_NETX_UART0_NAME {
         display       "Device name for ARM NETX serial port 0 driver"
         flavor        data
         default_value {"\"/dev/ser0\""}
         description   "
             This option specifies the name of the serial device
             for the ARM NETX port 0."
     }

Look, please, on another devs/serial/arm/*/*/cdl/*.cdl files for the
references. Your CDL must contain *UARTx_NAME CDL options.

HIH

Sergei

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-21  9:28         ` Sergei Gavrikov
@ 2010-05-21 14:48           ` Manuel Borchers
  2010-05-26  9:11             ` Manuel Borchers
  0 siblings, 1 reply; 10+ messages in thread
From: Manuel Borchers @ 2010-05-21 14:48 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

Am Freitag, den 21.05.2010, 12:06 +0300 schrieb Sergei Gavrikov: 
> cdl_option CYGDAT_IO_SERIAL_ARM_NETX_UART0_NAME {
>          display       "Device name for ARM NETX serial port 0 driver"
>          flavor        data
>          default_value {"\"/dev/ser0\""}
>          description   "
>              This option specifies the name of the serial device
>              for the ARM NETX port 0."
>      }
> 
> Look, please, on another devs/serial/arm/*/*/cdl/*.cdl files for the
> references. Your CDL must contain *UARTx_NAME CDL options.

Okay, I added this option for all ports. I even renamed everything from
UART to SERIAL, just in case. But nothing changed. No __DEVTAB__ entry
for the port in the resulting application elf...

Cheers,
Manuel

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

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ECOS] Clarification on serial port drivers
  2010-05-21 14:48           ` Manuel Borchers
@ 2010-05-26  9:11             ` Manuel Borchers
  0 siblings, 0 replies; 10+ messages in thread
From: Manuel Borchers @ 2010-05-26  9:11 UTC (permalink / raw)
  To: ecos-discuss; +Cc: sergei.gavrikov

[-- Attachment #1: Type: text/plain, Size: 861 bytes --]

Hi list,
hi Sergei,

replying to myself to present the solution of the problem. Thanks again,
Sergei, for your ongoing help!

Am Freitag, den 21.05.2010, 11:27 +0200 schrieb Manuel Borchers: 
> Okay, I added this option for all ports. I even renamed everything from
> UART to SERIAL, just in case. But nothing changed. No __DEVTAB__ entry
> for the port in the resulting application elf...

The problem is solved. Quite "stupid" one...
The serial driver didn't include <pkgconf/io_serial_arm_netx.h> and
therefore the defines from the CDL weren't seen by the driver. Result:
no DEVTAB entry for the enabled UARTs...

Included this one, and the netx_serial routines are there and the driver
is being initialized. Now, I'm back to driver debugging.

Again, thanks, Sergei!

Cheers,
Manuel

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

[-- Attachment #2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-05-25 13:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-20 11:30 [ECOS] Clarification on serial port drivers Manuel Borchers
2010-05-20 13:21 ` Sergei Gavrikov
2010-05-20 13:58   ` Manuel Borchers
2010-05-20 15:30     ` Sergei Gavrikov
2010-05-20 16:07       ` Manuel Borchers
2010-05-21  0:04         ` Sergei Gavrikov
2010-05-21  9:06           ` Manuel Borchers
2010-05-21  9:28         ` Sergei Gavrikov
2010-05-21 14:48           ` Manuel Borchers
2010-05-26  9:11             ` Manuel Borchers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).