~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/amunits/units/serial.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{
2
 
    This file is part of the Free Pascal run time library.
3
 
 
4
 
    A file in Amiga system run time library.
5
 
    Copyright (c) 1998 by Nils Sjoholm
6
 
    member of the Amiga RTL development team.
7
 
 
8
 
    See the file COPYING.FPC, included in this distribution,
9
 
    for details about the copyright.
10
 
 
11
 
    This program is distributed in the hope that it will be useful,
12
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 
 
15
 
 **********************************************************************}
16
 
 
17
 
unit serial;
18
 
 
19
 
INTERFACE
20
 
 
21
 
uses exec;
22
 
 
23
 
 
24
 
Type
25
 
 
26
 
                   { array of termination char's }
27
 
                   { to use,see serial.doc setparams }
28
 
 
29
 
    pIOTArray = ^tIOTArray;
30
 
    tIOTArray = record
31
 
        TermArray0 : ULONG;
32
 
        TermArray1 : ULONG;
33
 
    end;
34
 
 
35
 
Const
36
 
 
37
 
    SER_DEFAULT_CTLCHAR = $11130000;    { default chars for xON,xOFF }
38
 
 
39
 
{ You may change these via SETPARAMS.   At this time, parity is not
40
 
   calculated for xON/xOFF characters.  You must supply them with the
41
 
   desired parity. }
42
 
 
43
 
{****************************************************************}
44
 
{ CAUTION !!  IF YOU ACCESS the serial.device, you MUST (!!!!) use an
45
 
   IOExtSer-sized structure or you may overlay innocent memory !! }
46
 
{****************************************************************}
47
 
 
48
 
Type
49
 
 
50
 
    pIOExtSer = ^tIOExtSer;
51
 
    tIOExtSer = record
52
 
        IOSer   : tIOStdReq;
53
 
 
54
 
{     STRUCT    MsgNode
55
 
*   0   APTR     Succ
56
 
*   4   APTR     Pred
57
 
*   8   UBYTE    Type
58
 
*   9   UBYTE    Pri
59
 
*   A   APTR     Name
60
 
*   E   APTR     ReplyPort
61
 
*  12   UWORD    MNLength
62
 
*     STRUCT   IOExt
63
 
*  14   APTR     io_Device
64
 
*  18   APTR     io_Unit
65
 
*  1C   UWORD    io_Command
66
 
*  1E   UBYTE    io_Flags
67
 
*  1F   UBYTE    io_Error
68
 
*     STRUCT   IOStdExt
69
 
*  20   ULONG    io_Actual
70
 
*  24   ULONG    io_Length
71
 
*  28   APTR     io_Data
72
 
*  2C   ULONG    io_Offset
73
 
*
74
 
*  30 }
75
 
 
76
 
        io_CtlChar      : ULONG; { control char's (order = xON,xOFF,INQ,ACK) }
77
 
        io_RBufLen      : ULONG; { length in bytes of serial port's read buffer }
78
 
        io_ExtFlags     : ULONG; { additional serial flags (see bitdefs below) }
79
 
        io_Baud         : ULONG; { baud rate requested (true baud) }
80
 
        io_BrkTime      : ULONG; { duration of break signal in MICROseconds }
81
 
        io_TermArray    : tIOTArray; { termination character array }
82
 
        io_ReadLen      : Byte;   { bits per read character (# of bits) }
83
 
        io_WriteLen     : Byte;   { bits per write character (# of bits) }
84
 
        io_StopBits     : Byte;   { stopbits for read (# of bits) }
85
 
        io_SerFlags     : Byte;   { see SerFlags bit definitions below   }
86
 
        io_Status       : Word;
87
 
    end;
88
 
 
89
 
   { status of serial port, as follows:
90
 
*                  BIT  ACTIVE  FUNCTION
91
 
*                   0    ---    reserved
92
 
*                   1    ---    reserved
93
 
*                   2    high   Connected to parallel "select" on the A1000.
94
 
*                               Connected to both the parallel "select" and
95
 
*                               serial "ring indicator" pins on the A500 &
96
 
*                               A2000.  Take care when making cables.
97
 
*                   3    low    Data Set Ready
98
 
*                   4    low    Clear To Send
99
 
*                   5    low    Carrier Detect
100
 
*                   6    low    Ready To Send
101
 
*                   7    low    Data Terminal Ready
102
 
*                   8    high   read overrun
103
 
*                   9    high   break sent
104
 
*                  10    high   break received
105
 
*                  11    high   transmit x-OFFed
106
 
*                  12    high   receive x-OFFed
107
 
*               13-15           reserved
108
 
}
109
 
 
110
 
Const
111
 
 
112
 
    SDCMD_QUERY         = CMD_NONSTD;
113
 
    SDCMD_BREAK         = CMD_NONSTD + 1;
114
 
    SDCMD_SETPARAMS     = CMD_NONSTD + 2;
115
 
 
116
 
 
117
 
    SERB_XDISABLED      = 7;    { io_SerFlags xOn-xOff feature disabled bit }
118
 
    SERF_XDISABLED      = 128;  {    "      xOn-xOff feature disabled mask }
119
 
    SERB_EOFMODE        = 6;    {    "      EOF mode enabled bit }
120
 
    SERF_EOFMODE        = 64;   {    "      EOF mode enabled mask }
121
 
    SERB_SHARED         = 5;    {    "      non-exclusive access bit }
122
 
    SERF_SHARED         = 32;   {    "      non-exclusive access mask }
123
 
    SERB_RAD_BOOGIE     = 4;    {    "      high-speed mode active bit }
124
 
    SERF_RAD_BOOGIE     = 16;   {    "      high-speed mode active mask }
125
 
    SERB_QUEUEDBRK      = 3;    {    "      queue this Break ioRqst }
126
 
    SERF_QUEUEDBRK      = 8;    {    "      queue this Break ioRqst }
127
 
    SERB_7WIRE          = 2;    {    "      RS232 7-wire protocol }
128
 
    SERF_7WIRE          = 4;    {    "      RS232 7-wire protocol }
129
 
    SERB_PARTY_ODD      = 1;    {    "      parity feature enabled bit }
130
 
    SERF_PARTY_ODD      = 2;    {    "      parity feature enabled mask }
131
 
    SERB_PARTY_ON       = 0;    {    "      parity-enabled bit }
132
 
    SERF_PARTY_ON       = 1;    {    "      parity-enabled mask }
133
 
 
134
 
{ These now refect the actual bit positions in the io_Status UWORD }
135
 
 
136
 
    IO_STATB_XOFFREAD   = 12;      { io_Status receive currently xOFF'ed bit }
137
 
    IO_STATF_XOFFREAD   = $1000;   {     "     receive currently xOFF'ed mask }
138
 
    IO_STATB_XOFFWRITE  = 11;      {     "     transmit currently xOFF'ed bit }
139
 
    IO_STATF_XOFFWRITE  = $0800;   {     "     transmit currently xOFF'ed mask }
140
 
    IO_STATB_READBREAK  = 10;      {     "     break was latest input bit }
141
 
    IO_STATF_READBREAK  = $0400;   {     "     break was latest input mask }
142
 
    IO_STATB_WROTEBREAK = 9;       {     "     break was latest output bit }
143
 
    IO_STATF_WROTEBREAK = $0200;   {     "     break was latest output mask }
144
 
    IO_STATB_OVERRUN    = 8;       {     "     status word RBF overrun bit }
145
 
    IO_STATF_OVERRUN    = $0100;   {     "     status word RBF overrun mask }
146
 
 
147
 
 
148
 
    SEXTB_MSPON         = 1;    { io_ExtFlags. Use mark-space parity, }
149
 
                                {           instead of odd-even. }
150
 
    SEXTF_MSPON         = 2;    {    "      mark-space parity mask }
151
 
    SEXTB_MARK          = 0;    {    "      if mark-space, use mark }
152
 
    SEXTF_MARK          = 1;    {    "      if mark-space, use mark mask }
153
 
 
154
 
 
155
 
    SerErr_DevBusy      = 1;
156
 
    SerErr_BaudMismatch = 2;    { baud rate not supported by hardware }
157
 
    SerErr_BufErr       = 4;    { Failed to allocate new read buffer }
158
 
    SerErr_InvParam     = 5;
159
 
    SerErr_LineErr      = 6;
160
 
    SerErr_ParityErr    = 9;
161
 
    SerErr_TimerErr     = 11;   {(See the serial/OpenDevice autodoc)}
162
 
    SerErr_BufOverflow  = 12;
163
 
    SerErr_NoDSR        = 13;
164
 
    SerErr_DetectedBreak = 15;
165
 
 
166
 
 
167
 
{ These defines refer to the HIGH ORDER byte of io_Status.  They have
168
 
   been replaced by the new, corrected ones above }
169
 
    IOSTB_XOFFREAD  = 4;       { iost_hob receive currently xOFF'ed bit }
170
 
    IOSTF_XOFFREAD  = 16;      {    "     receive currently xOFF'ed mask }
171
 
    IOSTB_XOFFWRITE = 3;       {    "     transmit currently xOFF'ed bit }
172
 
    IOSTF_XOFFWRITE = 8;       {    "     transmit currently xOFF'ed mask }
173
 
    IOSTB_READBREAK = 2;       {    "     break was latest input bit }
174
 
    IOSTF_READBREAK = 4;       {    "     break was latest input mask }
175
 
    IOSTB_WROTEBREAK= 1;       {    "     break was latest output bit }
176
 
    IOSTF_WROTEBREAK= 2;       {    "     break was latest output mask }
177
 
    IOSTB_OVERRUN   = 0;       {    "     status word RBF overrun bit }
178
 
    IOSTF_OVERRUN   = 1;       {    "     status word RBF overrun mask }
179
 
 
180
 
    IOSERB_BUFRREAD = 7  ;     { io_Flags from read buffer bit }
181
 
    IOSERF_BUFRREAD = 128;  {    "     from read buffer mask }
182
 
    IOSERB_QUEUED   = 6  ;     {    "     rqst-queued bit }
183
 
    IOSERF_QUEUED   = 64 ; {    "     rqst-queued mask }
184
 
    IOSERB_ABORT    = 5  ;     {    "     rqst-aborted bit }
185
 
    IOSERF_ABORT    = 32 ; {    "     rqst-aborted mask }
186
 
    IOSERB_ACTIVE   = 4  ;     {    "     rqst-qued-OR-current bit }
187
 
    IOSERF_ACTIVE   = 16 ; {    "     rqst-qued-OR-current mask }
188
 
 
189
 
 
190
 
 
191
 
    SERIALNAME          : PChar = 'serial.device';
192
 
 
193
 
IMPLEMENTATION
194
 
 
195
 
end.