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]

Re: Runtime changing of serial port baud rate


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

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