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

Last change on this file since 1 was 1, checked in by alain, 10 years ago

First import

File size: 2.9 KB
Line 
1/****************************************************************************
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()'. *
9 ****************************************************************************/
10
11#ifndef BOOT_TTY_DRIVER_H
12#define BOOT_TTY_DRIVER_H
13
14#include <hal_types.h>
15
16/****************************************************************************
17 * Driver register map. *
18 ****************************************************************************/
19
20enum TTY_registers
21{
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 */
26
27 TTY_SPAN = 4, /* segment size for one channel ( words ) */
28};
29
30/****************************************************************************
31 * Driver status value. *
32 ****************************************************************************/
33
34enum TTY_status
35{
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. */
38};
39
40/****************************************************************************
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. *
53 ****************************************************************************/
54int boot_tty_write( char * buf,
55 uint32_t nbytes );
56
57#endif // BOOT_TTY_DRIVER_H
Note: See TracBrowser for help on using the repository browser.