1 | #ifndef COSY_VmodIcan
|
---|
2 | #define COSY_VmodIcan
|
---|
3 |
|
---|
4 | #ifdef __CINT__
|
---|
5 | //#include <TROOT.h>
|
---|
6 | typedef UShort_t WORD_t;
|
---|
7 | typedef Byte_t BYTE_t;
|
---|
8 | struct Message;
|
---|
9 | struct FastMessage;
|
---|
10 | #else
|
---|
11 | #include "gendef.h"
|
---|
12 | #include "dpm.h"
|
---|
13 | #endif
|
---|
14 |
|
---|
15 | #ifndef MARS_MThread
|
---|
16 | #include "MThread.h"
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | #ifndef COSY_Interface
|
---|
20 | #include "interface.h"
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | typedef struct timeval timeval_t;
|
---|
24 |
|
---|
25 | class CanOpen;
|
---|
26 |
|
---|
27 | class VmodIcan : public Interface, public MThread
|
---|
28 | {
|
---|
29 | private:
|
---|
30 | int fd; // file descriptor for can module
|
---|
31 |
|
---|
32 | // Specific tp the VmodIcan module
|
---|
33 | int Ioctl(int msg, void *arg);
|
---|
34 |
|
---|
35 | void SetBaudRate(int rate);
|
---|
36 | void EnableCanBusConnection();
|
---|
37 | int EnableFastCan(int rbuffers, int wbuffers);
|
---|
38 | void DisableCanBusConnection();
|
---|
39 | int EnableFifo();
|
---|
40 | int Reset();
|
---|
41 | void SetTermination(int strate=1);
|
---|
42 | int StdHost2NewStyle(int rbuffers, int wbuffers, int wbuffers_hi, int wbuffers_low);
|
---|
43 | void DisableAllCobIds();
|
---|
44 |
|
---|
45 | void PrintMsg(Message *m);
|
---|
46 |
|
---|
47 | int Send(Message *pm);
|
---|
48 | int SendHi(Message *pm);
|
---|
49 | int SendLo(Message *pm);
|
---|
50 | int Send(FastMessage *pm);
|
---|
51 |
|
---|
52 | void Close();
|
---|
53 | int Open(const char *devname); /* pathname of device */
|
---|
54 |
|
---|
55 | // Receiver
|
---|
56 | int Receive(Message *pm);
|
---|
57 | //int ReceiveFast(FastMessage *pm);
|
---|
58 | Int_t Thread();
|
---|
59 |
|
---|
60 | void Start() { RunThread(); }
|
---|
61 | void Stop() { CancelThread(); }
|
---|
62 |
|
---|
63 | public:
|
---|
64 | VmodIcan(CanOpen *rx, const char *dev, const int baud);
|
---|
65 | virtual ~VmodIcan();
|
---|
66 |
|
---|
67 | // Sending interface inherited from Interface
|
---|
68 | void EnableCobId(WORD_t cobid, int flag=TRUE);
|
---|
69 | void SendCanFrame(WORD_t cobid, BYTE_t m[8], BYTE_t rtr=0);
|
---|
70 |
|
---|
71 | ClassDef(VmodIcan, 0) // hardware interface to the vmodican can module (Janz)
|
---|
72 | };
|
---|
73 |
|
---|
74 | #endif
|
---|