summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mvme162/consolex/README
blob: 719ed245eb8b87cf6a59ea980a9c187d54eea709 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#
#  $Id$
#

This driver was submitted by Katsutoshi Shibuya <shibuya@mxb.meshnet.or.jp>.

Configuration
-------------
The application can choose this driver by using "CONSOLEX_DRIVER_TABLE_ENTRY"
in the driver table definition, in place of "CONSOLE_DRIVER_TABLE_ENTRY".
See consolex/cTest.c for an example and consolex/README for more information.

Programmatic Usage
------------------

- You can open 9 devices; console tty00, tty01, tty02, tty03,
  rtty00, rtty01, rtty02, rtty03
  tty00, rtty00 and console correspond to port#1 of MVME162LX,
  tty01 and rtty01 correspond to port#2, and so on.
- tty0x are "cooked" devices. They support following flags on termios
  definition;
    ISTRIP, INLCR, IGNCR, ICRNL, IUCLC, OLCUC, ONLCR, OCRNL, ICANON, ECHO,
    CBAUD, B38400, B19200, B9600, CSIZE, CS8, CS7, PARENB, PARODD, CSTOPB,
- rtty0x are "raw" devices. They support following flags on termios
  definition;
    CBAUD, B38400, B19200, B9600, CSIZE, CS8, CS7, PARENB, PARODD, CSTOPB,
- The default parameter is;
    B38400, CS8, ICRNL, ONLCR, ICANON, ECHO
  (but all flags except B38400 and CS8 will be ignored on raw device.)
- All devices support O_NDELAY (non blocking read/write) mode operation.
  (Non-blocking cooked mode output is valid, but will not work fine.)
  (Non-blocking cooked mode input with ECHO flag may be blocked while sending
  echoed character.)
- All devices support hardware flow control by CTS/RTS.
  (There is no way to disable it. There are no supports for soft flow control.)
- The application can use tcgetattr or ioctl to obtain the parameters of the
  device into struct termios.
- The application can use tcsetattr or ioctl to set the parameters of the
  device within the struct temios. The action argument (2nd arg) of the
  tcsetattr must be TCSANOW.
- On opening the device, the driver activate DTR line.  On closing the device,
  the driver deactivate DTR line.
  If 2 or more device opening occures at the same time on the same port, only
  the first open procedure activates DTR line, and only the last close
  procedure deactivate it.
- There are no device locking mechanisms. Application can open same device
  several times.
  But 2 simultanious reading operation on the same port will cause unexpected
  result.

Porting Notes
-------------
- This code can be used for any Zilog SCC based board.
  Change the time constant parameters and SCC register base addresses.

- This code is well separated into "device depended part" and "device
  independed part".
  They can use device independed part for any other board. The device
  independed part requires following functions;

  void SCCInitialize();
    Initialize hardware.
  rtems_boolean SCCGetOne(int port, char *ch);
    Get one character from port. If no character is in the receiver buffer,
    this function returns FALSE, otherwise TRUE.
  char SCCGetOneBlocked(int port);
    Get one character from port. If no character is in the receiver buffer,
    wait it passing the CPU to the other task.
  rtems_boolean SCCSendOne(int port, char ch);
    Send one character via port. If the transmitter is not ready, this function
    returns FALSE, otherwise TRUE.
  void SCCSendOneBlocked(int port, char ch);
    Send one character via port. Wait until the transmitter is ready, passing
    the CPU to the other task.
  unsigned32 SCCSetAttributes(int port, struct termios *tm);
    Set device attribute according to the information in the struct termios.
    c_cflags parameter (baud, parity, stopbits and code size) will be checked.
    On the successful completion, this function should return 0.
  unsigned32 SCCGetAttributes(int port, struct termios *tm);
    Get device attribute according into the struct termios.
    c_cflags parameter (baud, parity, stopbits and code size) will be set.
    On the successful completion, this function should return 0.
  void SCCSetDTR(port);
    Activate DTR line.
  void SCCResetDTR(port);
    Deactivate DTR line.
  void SCCSetRTS(port);
    Activate RTS line.
  void SCCResetRTS(port);
    Deactivate RTS line.
  int SCCGetCTS(port);
    Return non zero when CTS line is activated.

- If you don't want console port, undefine "CONSOLEPORT".

- This code does not use ESCC feature; i.e. does not read register #4/#5/#14