| 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 variables | 
|---|
| 27 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 28 |  | 
|---|
| 29 | extern volatile unsigned char _tty_get_buf[]; | 
|---|
| 30 |  | 
|---|
| 31 | extern volatile unsigned char _tty_get_full[]; | 
|---|
| 32 |  | 
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 34 | // TTY access functions | 
|---|
| 35 | ////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 36 |  | 
|---|
| 37 | extern unsigned int _tty_write( const char*  buffer, | 
|---|
| 38 | unsigned int length, | 
|---|
| 39 | unsigned int channel ); | 
|---|
| 40 |  | 
|---|
| 41 | extern unsigned int _tty_read(  char*        buffer, | 
|---|
| 42 | unsigned int length, | 
|---|
| 43 | unsigned int channel ); | 
|---|
| 44 |  | 
|---|
| 45 | extern void _tty_get_lock( unsigned int  channel, | 
|---|
| 46 | unsigned int* save_sr_ptr ); | 
|---|
| 47 |  | 
|---|
| 48 | extern void _tty_release_lock( unsigned int  channel, | 
|---|
| 49 | unsigned int* save_sr_ptr ); | 
|---|
| 50 |  | 
|---|
| 51 | extern void _tty_rx_isr( unsigned int irq_type, | 
|---|
| 52 | unsigned int irq_id, | 
|---|
| 53 | unsigned int channel ); | 
|---|
| 54 |  | 
|---|
| 55 | extern void _tty_tx_isr( unsigned int irq_type, | 
|---|
| 56 | unsigned int irq_id, | 
|---|
| 57 | unsigned int channel ); | 
|---|
| 58 |  | 
|---|
| 59 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 60 | // low-level access functions | 
|---|
| 61 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 62 |  | 
|---|
| 63 | extern unsigned int _tty_get_register( unsigned int channel, | 
|---|
| 64 | unsigned int index ); | 
|---|
| 65 |  | 
|---|
| 66 | extern void _tty_set_register( unsigned int channel, | 
|---|
| 67 | unsigned int index, | 
|---|
| 68 | unsigned int value ); | 
|---|
| 69 |  | 
|---|
| 70 | #endif | 
|---|
| 71 |  | 
|---|
| 72 | // Local Variables: | 
|---|
| 73 | // tab-width: 4 | 
|---|
| 74 | // c-basic-offset: 4 | 
|---|
| 75 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
| 76 | // indent-tabs-mode: nil | 
|---|
| 77 | // End: | 
|---|
| 78 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
| 79 |  | 
|---|