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

-- 
man...@matronix.de
http://www.matronix.de
# ====================================================================
#
#      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: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to