Changeset 6 for trunk/tools/bootloader_tsar/boot_tty_driver.h
- Timestamp:
- Apr 26, 2017, 2:14:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/bootloader_tsar/boot_tty_driver.h
r1 r6 1 /* 2 * boot_tty_driver.h - TSAR bootloader TTY driver definition. 3 * 4 * Authors : Alain Greiner / Vu Son (2016) 5 * 6 * Copyright (c) UPMC Sorbonne Universites 7 * 8 * This file is part of ALMOS-MKH. 9 * 10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 11 * under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; version 2.0 of the License. 13 * 14 * ALMOS-MKH is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 */ 23 1 24 /**************************************************************************** 2 * This file defines a nano-driver for SocLib vci_multi_tty component, used * 3 * by the ALMOS-MKH boot-loader. * 4 * * 5 * The SEG_TTY_BASE address must be defined in the 'hard_config.h' file. * 6 * * 7 * All accesses to the device registers are performed via 2 low-level * 8 * functions 'boot_tty_get_register()' and 'boot_tty_set_register()'. * 25 * This file defines a nano-driver for SocLib vci_multi_tty component, 26 * used by the ALMOS-MKH boot-loader. 27 * The SEG_TTY_BASE address must be defined in the 'hard_config.h' file. 28 * All accesses to the device registers are performed via 2 low-level 29 * functions 'boot_tty_get_register()' and 'boot_tty_set_register()'. 9 30 ****************************************************************************/ 10 31 … … 20 41 enum TTY_registers 21 42 { 22 TTY_WRITE = 0, /* character to be displayed on screen*/23 TTY_STATUS = 1, /* read and write buffer status*/24 TTY_READ = 2, /* character in the keyboard*/25 TTY_CONFIG = 3, /* unused*/43 TTY_WRITE_REG = 0, /* character to be displayed on screen */ 44 TTY_STATUS_REG = 1, /* read and write buffer status */ 45 TTY_READ_REG = 2, /* character in the keyboard */ 46 TTY_CONFIG_REG = 3, /* unused */ 26 47 27 48 TTY_SPAN = 4, /* segment size for one channel ( words ) */ … … 34 55 enum TTY_status 35 56 { 36 TTY_ READ_BUSY = 1,/* Set if TTY_READ register contains a data. */37 TTY_ WRITE_BUSY = 2,/* Set if TTY_WRITE register contains a data. */57 TTY_STATUS_RX_FULL = 1, /* Set if TTY_READ register contains a data. */ 58 TTY_STATUS_TX_FULL = 2, /* Set if TTY_WRITE register contains a data. */ 38 59 }; 39 60 40 61 /**************************************************************************** 41 * Driver API functions. * 42 ****************************************************************************/ 43 44 /**************************************************************************** 45 * This function writes a character string from the 'buf' buffer to the * 46 * boot TTY terminal. It tests the TTY_STATUS register before writing each * 47 * character of the string to the TTY_WRITE register. If TTY_WRITE_BUSY * 48 * bit is set, it keeps testing the TTY_STATUS register. If after 10000 * 49 * retries the bit is still set, the function reports an error and returns. * 50 * @ buf : buffer containing the string to be printed * 51 * @ nbytes : number of characters to be printed * 52 * @ returns 0 on success, -1 on error. * 62 * This function writes a character string from the 'buf' buffer to the 63 * boot TTY terminal. It tests the TTY_STATUS register before writing each 64 * character of the string to the TTY_WRITE register. If TTY_WRITE_BUSY 65 * bit is set, it keeps testing the TTY_STATUS register. If after 10000 66 * retries the bit is still set, the function reports an error and returns. 67 **************************************************************************** 68 * @ buf : buffer containing the string to be printed. 69 * @ nbytes : number of characters to be printed. 70 * @ returns 0 on success, -1 on error. 53 71 ****************************************************************************/ 54 72 int boot_tty_write( char * buf,
Note: See TracChangeset
for help on using the changeset viewer.