diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-10-07 16:28:04 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-10-07 16:35:13 +0200 |
commit | 7fd5e89c96cc92254e36012eee733748d255ff29 (patch) | |
tree | e17930368a0dbdd460e99808795beaa1f815497f /doc/bsp_howto/console.t | |
parent | termios: Separate flow control from normal handler (diff) | |
download | rtems-7fd5e89c96cc92254e36012eee733748d255ff29.tar.bz2 |
termios: Partially hide rtems_termios_tty
Move interrupt lock to device context and expose only this structure to
the read, write and set attributes device handler. This makes these
device handler independent of the general Termios infrastructure
suitable for direct use in printk() support.
Diffstat (limited to '')
-rw-r--r-- | doc/bsp_howto/console.t | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/doc/bsp_howto/console.t b/doc/bsp_howto/console.t index a165f72016..687ecda1a7 100644 --- a/doc/bsp_howto/console.t +++ b/doc/bsp_howto/console.t @@ -274,6 +274,7 @@ initialization example the device name is also present. Her is an example heade /* Low-level driver specific data structure */ typedef struct @{ + rtems_termios_device_context base; const char *device_name; volatile module_register_block *regs; /* More stuff */ @@ -298,12 +299,12 @@ characters from @code{buf} to the serial device specified by @code{tty}. @example @group static void my_driver_poll_write( - rtems_termios_tty *tty, - const char *buf, - size_t n + rtems_termios_device_context *base, + const char *buf, + size_t n ) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; size_t i; /* Write */ @@ -320,9 +321,9 @@ available, then the routine should return minus one. @example @group -static int my_driver_poll_read(rtems_termios_tty *tty) +static int my_driver_poll_read(rtems_termios_device_context *base) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; /* Check if a character is available */ if (my_driver_can_read_char(ctx)) @{ @@ -409,12 +410,12 @@ character. @example @group static void my_driver_interrupt_write( - rtems_termios_tty *tty, - const char *buf, - size_t n + rtems_termios_device_context *base, + const char *buf, + size_t n ) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; /* * Tell the device to transmit some characters from buf (less than @@ -518,10 +519,12 @@ During the first open of the device Termios will call the @group static bool my_driver_first_open( rtems_termios_tty *tty, + rtems_termios_device_context *base, + struct termios *term, rtems_libio_open_close_args_t *args ) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; rtems_status_code sc; bool ok; @@ -542,13 +545,13 @@ static bool my_driver_first_open( /* * Alternatively you can set the best baud. */ - rtems_termios_set_best_baud(tty, MY_DRIVER_BAUD_RATE); + rtems_termios_set_best_baud(term, MY_DRIVER_BAUD_RATE); /* * To propagate the initial Termios attributes to the device use * this. */ - ok = my_driver_set_attributes(tty, rtems_termios_get_termios(tty)); + ok = my_driver_set_attributes(base, term); if (!ok) @{ /* This is bad */ @} @@ -574,10 +577,11 @@ happens on the device. @group static void my_driver_last_close( rtems_termios_tty *tty, + rtems_termios_device_context *base, rtems_libio_open_close_args_t *args ) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; /* * The driver may do some cleanup here. @@ -618,11 +622,11 @@ handler. @example @group static bool my_driver_set_attributes( - rtems_termios_tty *tty, - const struct termios *term + rtems_termios_device_context *base, + const struct termios *term ) @{ - my_driver_context *ctx = rtems_termios_get_device_context(tty); + my_driver_context *ctx = (my_driver_context *) base; /* * Inspect the termios data structure and configure the device |