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

Last change on this file since 739 was 709, checked in by alain, 9 years ago

Major release: Change the task model to implement the POSIX threads API.

  • The shell "exec" and "kill" commands can be used to activate/de-activate the applications.
  • The "pause", "resume", and "context" commands can be used to stop, restart, a single thtead or to display the thread context.

This version has been tested on the following multi-threaded applications,
that have been modified to use the POSIX threads:

  • classif
  • convol
  • transpose
  • gameoflife
  • raycast
File size: 3.3 KB
RevLine 
[258]1///////////////////////////////////////////////////////////////////////////////////
2// File     : tty_driver.h
3// Date     : 01/11/2013
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
[437]7// The tty_driver.c and tty_drivers.h files are part ot the GIET-VM kernel.
8// This driver supports the SocLib vci_multi_tty component.
9//
10// The total number of TTY terminals must be defined by the configuration
11// parameter NB_TTY_CHANNELS in the hard_config.h file.
12//
13// The "system" terminal is TTY[0].
14// The "user" TTYs are allocated to applications requesting it.
15//
16// The SEG_TTY_BASE address must be defined in the hard_config.h file.
17//
18// All physical accesses to device registers are done by the two
19// _tty_get_register(), _tty_set_register() low-level functions,
20// that are handling virtual / physical addressing.
21///////////////////////////////////////////////////////////////////////////////////
[258]22
23#ifndef _GIET_TTY_DRIVERS_H_
24#define _GIET_TTY_DRIVERS_H_
25
[469]26#include "hard_config.h"
[496]27#include "kernel_locks.h"
[350]28
[709]29
[258]30///////////////////////////////////////////////////////////////////////////////////
[437]31//                     registers offsets
[258]32///////////////////////////////////////////////////////////////////////////////////
33
34enum TTY_registers
35{
36    TTY_WRITE   = 0,
37    TTY_STATUS  = 1,
38    TTY_READ    = 2,
39    TTY_CONFIG  = 3,
40    /**/
41    TTY_SPAN    = 4,
42};
43
[709]44
[295]45//////////////////////////////////////////////////////////////////////////////////
[709]46//                    struct tty_fifo_t
47//////////////////////////////////////////////////////////////////////////////////
48
49#define TTY_FIFO_DEPTH  16
50
51typedef struct tty_fifo_s     // 32 bytes
52{
53    char          data[TTY_FIFO_DEPTH];   // one char per slot
54    unsigned int  trdid;                  // owner thread trdid
55    unsigned int  ptr;                    // next free slot index
56    unsigned int  ptw;                    // next full slot index
57    unsigned int  sts;                    // number of full slots
58} tty_fifo_t;
59 
60//////////////////////////////////////////////////////////////////////////////////
[437]61//                    access functions
[295]62//////////////////////////////////////////////////////////////////////////////////
[258]63
[437]64extern unsigned int _tty_get_register( unsigned int channel,
65                                       unsigned int index );
[258]66
[437]67extern void _tty_set_register( unsigned int channel,
68                               unsigned int index,
69                               unsigned int value );
[258]70
[456]71extern void _tty_init( unsigned int channel );
72
73//////////////////////////////////////////////////////////////////////////////////
[437]74//                 Interrupt Service Routine
75///////////////////////////////////////////////////////////////////////////////////
[258]76
[295]77extern void _tty_rx_isr( unsigned int irq_type,
78                         unsigned int irq_id,
79                         unsigned int channel );
[258]80
[295]81extern void _tty_tx_isr( unsigned int irq_type,
82                         unsigned int irq_id,
83                         unsigned int channel );
[258]84
85
86#endif
87
88// Local Variables:
89// tab-width: 4
90// c-basic-offset: 4
91// c-file-offsets:((innamespace . 0)(inline-open . 0))
92// indent-tabs-mode: nil
93// End:
94// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
95
Note: See TracBrowser for help on using the repository browser.