xref: /haiku/headers/os/device/DigitalPort.h (revision ab83d3e93214227a4bfb368c96c69141518943de)
1 /*
2  * Copyright 2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_DIGITAL_PORT_H
6 #define	_DIGITAL_PORT_H
7 
8 #include <BeBuild.h>
9 #include <SupportDefs.h>
10 
11 #include <stddef.h>
12 
13 
14 class BDigitalPort {
15 public:
16 							BDigitalPort();
17 	virtual					~BDigitalPort();
18 
19 			status_t		Open(const char* portName);
20 			void			Close();
21 			bool			IsOpen();
22 
23 			ssize_t			Read(uint8* buf);
24 			ssize_t			Write(uint8 value);
25 
26 			status_t		SetAsOutput();
27 			bool			IsOutput();
28 
29 			status_t		SetAsInput();
30 			bool			IsInput();
31 
32 private:
33 	virtual	void		_ReservedDigitalPort1();
34 	virtual	void		_ReservedDigitalPort2();
35 	virtual	void		_ReservedDigitalPort3();
36 
37 			int			fFd;
38 			bool		fIsInput;
39 			uint32		_fReserved[3];
40 };
41 
42 #endif // _DIGITAL_PORT_H
43 
44