Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / devs / serial / serial_intern.h
blob3ec66f25f809393b4aa77c6e81096edb92ce7034
1 #ifndef SERIAL_INTERN_H
2 #define SERIAL_INTERN_H
3 /*
4 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 $Id$
7 Desc: Private definitions for Serial device.
8 Lang:
9 */
11 #ifndef AROS_LIBCALL_H
12 # include <aros/libcall.h>
13 #endif
14 #ifndef EXEC_EXECBASE_H
15 # include <exec/execbase.h>
16 #endif
17 #ifndef EXEC_DEVICES_H
18 # include <exec/devices.h>
19 #endif
20 #ifndef EXEC_SEMAPHORES_H
21 # include <exec/semaphores.h>
22 #endif
23 #ifndef DOS_DOS_H
24 # include <dos/dos.h>
25 #endif
26 #ifndef EXEC_SEMAPHORES_H
27 # include <exec/semaphores.h>
28 #endif
29 #ifndef EXEC_NODES_H
30 # include <exec/nodes.h>
31 #endif
32 #ifndef DEVICES_SERIAL_H
33 # include <devices/serial.h>
34 #endif
35 #ifndef OOP_OOP_H
36 # include <oop/oop.h>
37 #endif
40 /* Predeclaration */
41 struct serialbase;
44 struct SerialUnit;
47 /* Prototypes */
48 BOOL copyInData(struct SerialUnit * SU, struct IOStdReq * IOStdReq);
49 BOOL copyInDataUntilZero(struct SerialUnit * SU, struct IOStdReq * IOStdReq);
50 struct SerialUnit * findUnit(struct serialbase * SerialDevice,
51 ULONG unitnum);
54 ULONG RBF_InterruptHandler(UBYTE * data, ULONG length, ULONG unitnum, APTR userdata);
55 ULONG WBE_InterruptHandler(ULONG unitum, APTR userdata);
57 #define MINBUFSIZE 512
59 struct serialbase
61 struct Device device;
63 struct List UnitList;
64 ULONG Status;
66 struct Library *SerialHidd;
67 struct Library *oopBase;
69 OOP_Object *SerialObject;
73 struct SerialUnit
75 struct MinNode su_Node;
76 OOP_Object * su_Unit;
78 struct SignalSemaphore su_Lock;
80 struct MsgPort su_QReadCommandPort;
81 struct Message * su_ActiveRead;
83 struct MsgPort su_QWriteCommandPort;
84 struct Message * su_ActiveWrite;
85 ULONG su_NextToWrite; /* index in the buffer of next data to tx */
86 ULONG su_WriteLength; /* Number of bytes left to tx */
88 ULONG su_UnitNum;
89 ULONG su_SerFlags; // copy of IOExtSer->io_SerFlags;
90 ULONG su_Status;
92 ULONG su_CtlChar;
93 ULONG su_Baud;
94 ULONG su_BrkTime;
95 struct IOTArray su_TermArray;
96 UBYTE su_ReadLen;
97 UBYTE su_WriteLen;
98 UBYTE su_StopBits;
100 UBYTE su_OpenerCount; // Count how many openers this unit has. Important in shared mode
102 BYTE * su_InputBuffer;
103 UWORD su_InputNextPos; // InputCurPos may never "overtake" InputFirst
104 UWORD su_InputFirst; // the input buffer is organized as a "circle"
105 // Next Pos is the Position in the buffer
106 // where the NEXT byte will go into.
107 UWORD su_InBufLength;
110 /* a few flags for the status */
111 #define STATUS_CHANGING_IN_BUFFER 1 /* the user requested a change of the size
112 of the input buffer and is now changing
113 the input buffer. During this time
114 it could happen that the interrupt that
115 holds incoming bytes writes to a memory
116 location that would be invalid.
117 This tells the interrupt to simply drop
118 the data that it was about to write
119 to the input buffer.
121 #define STATUS_READS_PENDING 2
122 #define STATUS_WRITES_PENDING 4 /* When the task write the first byte into the UART
123 it has to set this flag.
124 When the HW-interrupt happens and there is
125 no more byte to write to the UART this
126 flag has to be cleared immediately
128 #define STATUS_BUFFEROVERFLOW 8 /* This flag indicates that an overflow
129 occurred with the internal receive
130 buffer. All further bytes will be
131 dropped until somebody reads the contents
132 of the buffer.
135 #ifdef OOPBase
136 #undef OOPBase
137 #endif
139 #define OOPBase (((struct serialbase *)SerialDevice)->oopBase)
141 #endif /* SERIAL_INTERN_H */