source: trunk/tools/bootloader_tsar/boot_tty_driver.h @ 166

Last change on this file since 166 was 6, checked in by alain, 8 years ago

Modify the boot_info_t struct to describe external peripherals in all clusters.

File size: 3.3 KB
RevLine 
[6]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/****************************************************************************
[6]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()'.
[1]30 ****************************************************************************/
31
32#ifndef BOOT_TTY_DRIVER_H
33#define BOOT_TTY_DRIVER_H
34
35#include <hal_types.h>
36
37/****************************************************************************
38 *                           Driver register map.                           *
39 ****************************************************************************/
40
41enum TTY_registers
42{
[6]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                                       */
[1]47   
48    TTY_SPAN    = 4,    /* segment size for one channel ( words )           */
49};
50
51/****************************************************************************
52 *                           Driver status value.                           *
53 ****************************************************************************/
54
55enum TTY_status
56{
[6]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.   */
[1]59};
60
61/****************************************************************************
[6]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.     
[1]71 ****************************************************************************/
72int boot_tty_write( char    * buf,
73                    uint32_t  nbytes );
74
75#endif // BOOT_TTY_DRIVER_H
Note: See TracBrowser for help on using the repository browser.