diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-19 06:28:01 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 13:08:32 +0200 |
commit | d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc (patch) | |
tree | caa54b4229e86a68c84ab5961af34e087dce5302 /c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c | |
parent | bsps/powerpc: Move shared btimer support (diff) | |
download | rtems-d7d66d7d4523b904c8ccc6aea3709dc0d5aa5bdc.tar.bz2 |
bsps: Move console drivers to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c')
-rw-r--r-- | c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c deleted file mode 100644 index 71385adf2b..0000000000 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @file - * - * @brief Generic console driver implementation. - */ - -/* - * Copyright (c) 2011 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Obere Lagerstr. 30 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include <sys/cdefs.h> - -#include <bsp.h> -#include <bsp/console-generic.h> -#include <bsp/fatal.h> - -#include <rtems/bspIo.h> -#include <rtems/console.h> - -static const struct termios console_generic_termios = { - .c_cflag = CS8 | CREAD | CLOCAL | __CONCAT(B, BSP_DEFAULT_BAUD_RATE) -}; - -static void console_generic_char_out(char c) -{ - int minor = (int) console_generic_minor; - const console_generic_callbacks *cb = - console_generic_info_table [minor].callbacks; - - (*cb->poll_write)(minor, c); -} - -static int console_generic_char_in(void) -{ - int minor = (int) console_generic_minor; - const console_generic_callbacks *cb = - console_generic_info_table [minor].callbacks; - - return (*cb->poll_read)(minor); -} - -static void console_generic_char_out_do_init(void) -{ - int minor = (int) console_generic_minor; - const console_generic_callbacks *cb = - console_generic_info_table [minor].callbacks; - const struct termios *term = &console_generic_termios; - - BSP_output_char = console_generic_char_out; - (*cb->termios_callbacks.setAttributes)(minor, term); -} - -static void console_generic_char_out_init(char c) -{ - console_generic_char_out_do_init(); - console_generic_char_out(c); -} - -rtems_device_driver console_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - const console_generic_info *info_table = console_generic_info_table; - rtems_device_minor_number count = console_generic_info_count; - rtems_device_minor_number console = console_generic_minor; - - if (count <= 0) { - bsp_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_COUNT); - } - - rtems_termios_initialize(); - - for (minor = 0; minor < count; ++minor) { - const console_generic_info *info = info_table + minor; - - sc = rtems_io_register_name(info->device_path, major, minor); - if (sc != RTEMS_SUCCESSFUL) { - bsp_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER); - } - } - - sc = rtems_io_register_name(CONSOLE_DEVICE_NAME, major, console); - if (sc != RTEMS_SUCCESSFUL) { - bsp_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER_CONSOLE); - } - - console_generic_char_out_do_init(); - - return sc; -} - -rtems_device_driver console_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - rtems_device_minor_number count = console_generic_info_count; - - if (minor < count) { - const console_generic_info *info = &console_generic_info_table [minor]; - - sc = rtems_termios_open( - major, - minor, - arg, - &info->callbacks->termios_callbacks - ); - } else { - sc = RTEMS_INVALID_ID; - } - - return sc; -} - -rtems_device_driver console_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - return rtems_termios_close(arg); -} - -rtems_device_driver console_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - return rtems_termios_read(arg); -} - -rtems_device_driver console_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - return rtems_termios_write(arg); -} - -rtems_device_driver console_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - return rtems_termios_ioctl(arg); -} - -BSP_output_char_function_type BSP_output_char = console_generic_char_out_init; - -BSP_polling_getchar_function_type BSP_poll_char = console_generic_char_in; |