Copyright update for 2011
[bcusdk.git] / eibd / backend / bcu1.h
blobd1ef0509a9f99b2c7440de99f330528f549cf464
1 /*
2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef EIB_BCU1_H
21 #define EIB_BCU1_H
23 #include "lowlevel.h"
25 /** PEI16 / BCU1 kernel driver backend */
26 class BCU1DriverLowLevelDriver:public LowLevelDriverInterface, private Thread
28 /** file descriptor */
29 int fd;
30 /** debug output */
31 Trace *t;
32 /** semaphore for inqueue */
33 pth_sem_t in_signal;
34 /** semaphore for outqueue */
35 pth_sem_t out_signal;
36 /** input queue */
37 Queue < CArray > inqueue;
38 /** output queue */
39 Queue < CArray * >outqueue;
40 /** event to wait for outqueue */
41 pth_event_t getwait;
42 /** semaphore to signal empty sendqueue */
43 pth_sem_t send_empty;
44 /** event to wait for send finished */
45 pth_event_t send_done;
47 void Run (pth_sem_t * stop);
48 public:
49 BCU1DriverLowLevelDriver (const char *device, Trace * tr);
50 ~BCU1DriverLowLevelDriver ();
51 bool init ();
53 void Send_Packet (CArray l);
54 bool Send_Queue_Empty ();
55 pth_sem_t *Send_Queue_Empty_Cond ();
56 CArray *Get_Packet (pth_event_t stop);
57 void SendReset ();
58 bool Connection_Lost ();
59 EMIVer getEMIVer ();
63 #endif