public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] aeb-serial driver
@ 2000-08-18  5:09 Andreas.Karlsson
  2000-08-18  6:14 ` Jesper Skov
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas.Karlsson @ 2000-08-18  5:09 UTC (permalink / raw)
  To: ecos-discuss

I am playing a little with the serial ports on my AEB-board. My program
hangs when the 'cyg_io_get_config' function is called. I probably do a fatal
error as I am a eCos-beginner:)

Can someone please tell me what I am doing wrong.

I would really like to see some examples of programs using the tty or the
serial drivers, got any?

Is there any description of the functions in eCos (in and out parameters and
what they are doing)?



static void simple_prog(CYG_ADDRESS data)

{

    cyg_io_handle_t handle;

	cyg_serial_info_t info_buf;



    Cyg_ErrNo err;

    const char test_string[] = "serial example is working correctly!\n";

    cyg_uint32 len = strlen(test_string);



    printf("Starting serial example\n");

	printf("Stacksize is %d\n", STACKSIZE);



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

	if (ENOERR == err) 

	{

		printf("Found /dev/ser0. Writing string....\n");



		err = cyg_io_write( handle, test_string, &len );



		if (ENOERR == err) 

		{

			len=sizeof(cyg_serial_info_t);

			err=cyg_io_get_config(&handle,
CYG_IO_GET_CONFIG_SERIAL_INFO, &info_buf, &len);

			/*This function returns current [runtime]
information about the device and/or driver. */

			if (ENOERR == err) 

			{

				printf("got config info...\n");

			}

			else

			{

				printf("failed to get config\n");

			}

		}

		else

		{

			printf("failed to write...\n");

		}

	}

	else

	{

		printf("failed to find /dev/ser0... \n");

	}

	



    printf("Serial example finished\n");



}

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

* Re: [ECOS] aeb-serial driver
  2000-08-18  5:09 [ECOS] aeb-serial driver Andreas.Karlsson
@ 2000-08-18  6:14 ` Jesper Skov
  0 siblings, 0 replies; 2+ messages in thread
From: Jesper Skov @ 2000-08-18  6:14 UTC (permalink / raw)
  To: Andreas.Karlsson; +Cc: ecos-discuss

>>>>> "Andreas" == Andreas Karlsson <Andreas.Karlsson@combitechsystems.com> writes:

Andreas> I am playing a little with the serial ports on my
Andreas> AEB-board. My program hangs when the 'cyg_io_get_config'
Andreas> function is called. I probably do a fatal error as I am a
Andreas> eCos-beginner:)

Andreas> Can someone please tell me what I am doing wrong.

Looks OK to me. You'd want to enable GDB support and step into the
function to see what happens.

Andreas> I would really like to see some examples of programs using
Andreas> the tty or the serial drivers, got any?

Look in the io/serial test directory.

Andreas> Is there any description of the functions in eCos (in and out
Andreas> parameters and what they are doing)?

Yes, see the eCos documentation:
http://sources.redhat.com/ecos/docs-latest/ref/ecos-ref.2.html

Jesper

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

end of thread, other threads:[~2000-08-18  6:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-18  5:09 [ECOS] aeb-serial driver Andreas.Karlsson
2000-08-18  6:14 ` Jesper Skov

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