-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFtd245IOUX.h
130 lines (103 loc) · 4.47 KB
/
Ftd245IOUX.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/**
Astronomy USB Appliance - Control Library
Copyright (C) 2009 Martin Burri ([email protected])
This program is free software licensed under LGPL;
you can redistribute it and/or modify it under the terms of
the GNU Lesser General Public License as published by the
Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file Ftd245IOUX.h
*****************************************************************************
* class Ftd245IOUX
*
* Astronomy USB Appliance driver for Linux using ftdi_sio
* Upper Level driver for FTDI245 equipped boards
* specifically for the Artemis/ATIK USB1.1 cameras
*
* This is part of the Driver Library of wxAstroCapture
*
* Copyright (C) 2009 Martin Burri ([email protected])
*
*<hr>
*
* @b Project wxAstroCapture<br>
*
* @author M. Burri
* @date 14-Feb-2009
*
*****************************************************************************
*<hr>
* @b Updates
* - dd-mmm-yyyy V. Name: Description
*
*****************************************************************************/
#ifndef _FTD245IOUX_H__
#define _FTD245IOUX_H__
#include "Ftd245IO.h"
//////////////////////////////////////////////////////////////////////
//! The USB Interface class
class Ftd245IOUX : public Ftd245IO
{
public:
Ftd245IOUX();
virtual ~Ftd245IOUX();
//////////////////////////////////////////////////////////////////////
//! External Interface
//////////////////////////////////////////////////////////////////////
//! @brief does some initialization and test of connection with the USB board
//! @param int deviceIndex: the index of the device to open
bool InitBoard(int deviceIndex);
//! @brief Close the connection with a device
void ShutConnection();
/// @brief An OS independent millisecond sleep command
void Sleep_ms(unsigned short milliseconds);
protected:
//! local methods to support the generic interface
//! @brief Returns the status of the connected device
//! @return bool: true if the device is ready
bool DeviceAvailable();
//! @brief Read from the device
//! @param void* lpvBuffer: the read buffer
//! @param size_t dwBuffSize: the size of the read buffer
//! @param size_t& lpdwBytesRead: variable to return the bytes read
//! @return State information (Ftd245IOState)
Ftd245IOState Read(void* lpvBuffer, size_t dwBuffSize, size_t& lpdwBytesRead);
//! @brief Empty the read channel
void ClearInputChannel();
//! @brief Write to the device
//! @param void* lpvBuffer: the write buffer
//! @param size_t dwBuffSize: the size of the write buffer
//! @param size_t& lpdwBytes: variable to return the bytes written
//! @return State information (Ftd245IOState)
Ftd245IOState Write(void* lpvBuffer, size_t dwBuffSize, size_t& lpdwBytes);
//! @brief Get the size of the read queue
//! @param size_t& lpdwAmountInRxQueue: variable to return the bytes in read queue
//! @return State information (Ftd245IOState)
Ftd245IOState GetQueueStatus(size_t& lpdwAmountInRxQueue);
//! @brief Set the board timeouts
//! @param unsigned long dwReadTimeout: read timeout in milliseconds
//! @param unsigned long dwWriteTimeout: write timeout in milliseconds
//! @return State information (Ftd245IOState)
Ftd245IOState SetTimeouts(unsigned long dwReadTimeout, unsigned long dwWriteTimeout);
//! @brief Get the board timeouts
//! @param unsigned long& dwReadTimeout: returns read timeout in milliseconds
//! @param unsigned long& dwWriteTimeout: returns write timeout in milliseconds
void GetTimeouts(unsigned long& dwReadTimeout, unsigned long& dwWriteTimeout);
//! @brief Set the transfer parameter
//! @param size_t dwInTransferSize: read transfer size of the usb interface
//! @return State information (Ftd245IOState)
Ftd245IOState SetUSBParameters (size_t dwInTransferSize);
private:
int xioctl(int device, int request, void* arg);
int m_device;
};
#endif // _FTD245IOUX_H__