| 1 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 2 | // File : tty_driver.h |
|---|
| 3 | // Date : 01/11/2013 |
|---|
| 4 | // Author : alain greiner |
|---|
| 5 | // Copyright (c) UPMC-LIP6 |
|---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 7 | |
|---|
| 8 | #ifndef _GIET_TTY_DRIVERS_H_ |
|---|
| 9 | #define _GIET_TTY_DRIVERS_H_ |
|---|
| 10 | |
|---|
| 11 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 12 | // TTY (vci_multi_tty) registers offsets |
|---|
| 13 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 14 | |
|---|
| 15 | enum TTY_registers |
|---|
| 16 | { |
|---|
| 17 | TTY_WRITE = 0, |
|---|
| 18 | TTY_STATUS = 1, |
|---|
| 19 | TTY_READ = 2, |
|---|
| 20 | TTY_CONFIG = 3, |
|---|
| 21 | /**/ |
|---|
| 22 | TTY_SPAN = 4, |
|---|
| 23 | }; |
|---|
| 24 | |
|---|
| 25 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 26 | // TTY access functions and variables |
|---|
| 27 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 28 | |
|---|
| 29 | extern volatile unsigned char _tty_get_buf[]; |
|---|
| 30 | |
|---|
| 31 | extern volatile unsigned char _tty_get_full[]; |
|---|
| 32 | |
|---|
| 33 | /////// rather high level access functions /////////////////////////////////////// |
|---|
| 34 | |
|---|
| 35 | extern unsigned int _tty_write( const char* buffer, |
|---|
| 36 | unsigned int length, // number of characters |
|---|
| 37 | unsigned int channel ); // channel index |
|---|
| 38 | |
|---|
| 39 | extern unsigned int _tty_read( char* buffer, |
|---|
| 40 | unsigned int length, // unused |
|---|
| 41 | unsigned int channel ); // channel index |
|---|
| 42 | |
|---|
| 43 | /////// very low level access functions ////////////////////////////////////////// |
|---|
| 44 | |
|---|
| 45 | extern void _tty_write_data( unsigned int channel, char byte ); |
|---|
| 46 | |
|---|
| 47 | extern unsigned int _tty_read_data( unsigned int channel ); |
|---|
| 48 | |
|---|
| 49 | extern unsigned int _tty_get_status( unsigned int channel ); |
|---|
| 50 | |
|---|
| 51 | extern void _tty_get_lock( unsigned int channel ); |
|---|
| 52 | |
|---|
| 53 | extern void _tty_release_lock( unsigned int channel ); |
|---|
| 54 | |
|---|
| 55 | /////////////////////////////////////////////////////////////////////////////////// |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | #endif |
|---|
| 59 | |
|---|
| 60 | // Local Variables: |
|---|
| 61 | // tab-width: 4 |
|---|
| 62 | // c-basic-offset: 4 |
|---|
| 63 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
|---|
| 64 | // indent-tabs-mode: nil |
|---|
| 65 | // End: |
|---|
| 66 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
|---|
| 67 | |
|---|