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]

aeb-serial driver




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");



}

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