This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Runtime changing of serial port baud rate
- To: <ecos-discuss at sources dot redhat dot com>
- Subject: Re: [ECOS] Runtime changing of serial port baud rate
- From: rob dot wj dot jansen at philips dot com
- Date: Tue, 22 May 2001 10:29:29 +0200
Stanley,
> Does eCos support runtime changing of serial port baud rate?
>
> Thanks
> Stanley
Yes, but only if you use the serial driver instead of the diagnostics I/O.
Look at the chapters 11 and 12 in the eCos Reference Manual.
Setting the baudrate involves some magic with the cyg_io_***_config functions:
cyg_io_handle_t ser_handle;
cyg_io_serial_info_t ser_info;
cyg_io_lookup("/dev/ser1", &ser_handle);
cyg_io_get_config(ser_handle, CYG_IO_GET_CONFIG_SERIAL_INFO, &ser_info, sizeof(ser_info));
ser_info.baud = CYGNUM_SERIAL_BAUD_110;
ser_info.word_length = CYGNUM_SERIAL_WORD_LENGTH_7;
cyg_io_set_config(ser_handle, CYG_IO_SET_CONFIG_SERIAL_INFO, &ser_info, sizeof(ser_info));
You might want to add the obvious #include lines, checks for the error values returned and
maybe some other baudrate figures (but these ones enable you to use your old mechanical TTY ;-)
Cheers,
Rob