This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Serial ports on Evaluator -7T (AEB-2)


Hello!

I'm having problems accessing the two serial-ports on the Evaluator
7T-board. 
Does eCos support the two serial-ports on this card, and if it does (which i
assume ;) why can i not configure them as i can with many other boards? 

In eCos Configtool (for windows) i see that the template for the AEB-1 board
has options for switching on and off the serialports, and changing the name
of the serial devices (such as "/dev/ser0" under [configuration/Serial
device drivers/Hardware serial device drivers/ARM AEB serial devices/....]
). But with the AEB-2 card theese options are not available. Are they
"generic", and is by default named as /dev/serial0 and /dev/serial1, or
should i use diffrent names, and if so, which else names do i use for
accessing serial ports on AEB-2?

i try to access the ports using the serial.c-file in the
RedHat\eCos\examples -directory, but changing dev/haldiag to dev/serial0,
but it doesn't work. 

I use eCos Config-tool (1.3.1.2) and i have downloaded the latest eCos
sources from the CVS.

I would be very glad if someone could just give me a hint! thanks!

/marcus ohlsson

below is the current program which doesn't detect any serialports:

<start file serial.c>

/* 
 * 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

/* 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 */



/* 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_io_handle_t handle_pog1;
	cyg_io_handle_t handle_pog2;
	cyg_io_handle_t handle_pog3;
	cyg_io_handle_t handle_pog4;
	cyg_io_handle_t handle_pog5;
	Cyg_ErrNo err;
	const char test_string[] = "serial example is working correctly!\n";
	cyg_uint32 len = strlen(test_string);

	printf("Starting serial example\n");

	err = cyg_io_lookup( "/dev/serial0", &handle_pog1 );

	if (ENOERR == err)
	{
		printf("Found /dev/serial0. Writing string....\n");
		err = cyg_io_write( handle_pog1, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the string serial 0. Did you see
it?\n");
	}

	if (ENOERR != err)
	{
		printf("Serial0 failed\n");
	}
	
	err = cyg_io_lookup( "/dev/haldiag", &handle );

	if (ENOERR == err)
	{
		printf("Found /dev/haldiag. Writing string....\n");
		err = cyg_io_write( handle, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the string 1. Did you see it?\n");
	}



	err = cyg_io_lookup( "/dev/serial1", &handle_pog2 );

	if (ENOERR == err)
	{
		printf("Found /dev/serial1. Writing string....\n");
		err = cyg_io_write( handle_pog2, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the serial1. Did you see it?\n");
	}

	if (ENOERR != err)
	{
		printf("Serial1 failed\n");
	}


	err = cyg_io_lookup( "/dev/console", &handle_pog3 );

	if (ENOERR == err)
	{
		printf("Found /dev/console. Writing string....\n");
		err = cyg_io_write( handle_pog3, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the console. Did you see it?\n");
	}

	if (ENOERR != err)
	{
		printf("console failed\n");
	}


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

	if (ENOERR == err)
	{
		printf("Found /dev/ser0. Writing string....\n");
		err = cyg_io_write( handle_pog4, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the ser0. Did you see it?\n");
	}

	if (ENOERR != err)
	{
		printf("Ser0 failed\n");
	}


	err = cyg_io_lookup( "/dev/tty0", &handle_pog5 );

	if (ENOERR == err)
	{
		printf("Found /dev/tty0. Writing string....\n");
		err = cyg_io_write( handle_pog5, test_string, &len );
	}

	if (ENOERR == err)
	{
		printf("I think I wrote the tty0. Did you see it?\n");
	}

	if (ENOERR != err)
	{
		printf("tty0 failed\n");
	}


	printf("Serial example finished. Errorcode: %x\n",err);

}

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]);
}

<end serial.c>


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