2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2009 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "lowlatency.h"
27 /** PEI16 / BCU1 user mode driver */
28 class BCU1SerialLowLevelDriver
:public LowLevelDriverInterface
, private Thread
30 /** file descriptor */
32 /** old termios settings */
34 /** old serial port settings */
35 low_latency_save sold
;
38 /** semaphore for inqueue */
40 /** semaphore for outqueue */
43 Queue
< CArray
> inqueue
;
45 Queue
< CArray
* >outqueue
;
46 /** semaphore to wait for outqueue */
48 /** semaphore to signal empty sendqueue */
51 /** gets the serial port line status */
53 /** sets the serial port line status */
55 /** runs a start sync of a byte exchange */
57 /** finishes the byte exchange */
59 /** exchange two bytes*/
60 bool exchange (uchar c
, uchar
& result
, pth_event_t stop
);
61 void Run (pth_sem_t
* stop
);
63 BCU1SerialLowLevelDriver (const char *device
, Trace
* tr
);
64 ~BCU1SerialLowLevelDriver ();
67 void Send_Packet (CArray l
);
68 bool Send_Queue_Empty ();
69 pth_sem_t
*Send_Queue_Empty_Cond ();
70 CArray
*Get_Packet (pth_event_t stop
);
72 bool Connection_Lost ();