vfs: check userland buffers before reading them.
[haiku.git] / headers / os / device / DigitalPort.h
blobb357e7b8d6e15186b6fa5f8ac618ccfdbbd2ccbf
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
8 #include <BeBuild.h>
9 #include <SupportDefs.h>
11 #include <stddef.h>
14 class BDigitalPort {
15 public:
16 BDigitalPort();
17 virtual ~BDigitalPort();
19 status_t Open(const char* portName);
20 void Close();
21 bool IsOpen();
23 ssize_t Read(uint8* buf);
24 ssize_t Write(uint8 value);
26 status_t SetAsOutput();
27 bool IsOutput();
29 status_t SetAsInput();
30 bool IsInput();
32 private:
33 virtual void _ReservedDigitalPort1();
34 virtual void _ReservedDigitalPort2();
35 virtual void _ReservedDigitalPort3();
37 int fFd;
38 bool fIsInput;
39 uint32 _fReserved[3];
42 #endif // _DIGITAL_PORT_H