source: soft/giet_vm/giet_drivers/tty_driver.h @ 415

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

Introducing two modifications regarding the locks protecting
exclusive access to BDV and TTY peripherals channels:

  • use the giet_lock_t type to have only one lock per cache line.
  • store these locks in the seg_kernel_data or in seg_kernel_uncdata, depending on the GIET_NO HARD_CC configuration parameter, to have cacheable locks when it is possible.
File size: 2.7 KB
Line 
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#include "utils.h"
12
13///////////////////////////////////////////////////////////////////////////////////
14// TTY (vci_multi_tty) registers offsets
15///////////////////////////////////////////////////////////////////////////////////
16
17enum TTY_registers
18{
19    TTY_WRITE   = 0,
20    TTY_STATUS  = 1,
21    TTY_READ    = 2,
22    TTY_CONFIG  = 3,
23    /**/
24    TTY_SPAN    = 4,
25};
26
27///////////////////////////////////////////////////////////////////////////////////
28// TTY variables
29///////////////////////////////////////////////////////////////////////////////////
30
31extern volatile unsigned int _tty_rx_buf[];
32
33extern volatile unsigned int _tty_rx_full[];
34
35extern giet_lock_t _tty_lock[];
36
37//////////////////////////////////////////////////////////////////////////////////
38// TTY access functions
39//////////////////////////////////////////////////////////////////////////////////
40
41extern unsigned int _tty_write( const char*  buffer,
42                                unsigned int length,     
43                                unsigned int channel ); 
44
45extern unsigned int _tty_read(  char*        buffer,
46                                unsigned int length, 
47                                unsigned int channel ); 
48
49extern void _tty_get_lock( unsigned int  channel, 
50                           unsigned int* save_sr_ptr );
51
52extern void _tty_release_lock( unsigned int  channel,
53                               unsigned int* save_sr_ptr );
54
55extern void _tty_rx_isr( unsigned int irq_type,
56                         unsigned int irq_id,
57                         unsigned int channel );
58
59extern void _tty_tx_isr( unsigned int irq_type,
60                         unsigned int irq_id,
61                         unsigned int channel );
62
63///////////////////////////////////////////////////////////////////////////////////
64// low-level access functions
65///////////////////////////////////////////////////////////////////////////////////
66
67extern unsigned int _tty_get_register( unsigned int channel,
68                                       unsigned int index );
69
70extern void _tty_set_register( unsigned int channel,
71                               unsigned int index,
72                               unsigned int value );
73
74#endif
75
76// Local Variables:
77// tab-width: 4
78// c-basic-offset: 4
79// c-file-offsets:((innamespace . 0)(inline-open . 0))
80// indent-tabs-mode: nil
81// End:
82// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
83
Note: See TracBrowser for help on using the repository browser.