HALFRED  0.4.0
hali_iodevice.h
Go to the documentation of this file.
1 
10 #ifndef HALI_IODEVICE_H
11 #define HALI_IODEVICE_H
12 
13 #include "hal_defs.h"
14 #include "hal_iodevice.h"
15 #if defined HAL_IO_OS_INTEGRATION && (HAL_IO_OS_INTEGRATION != 0)
16 #include "hal_osnotifier.h"
17 #endif
18 
19 #if HAL_ENABLE_OS != 0
20 #include "hal_os.h"
21 #endif
22 
23 
24 #include <stdarg.h>
25 #include <stddef.h>
26 
27 
38 
39 
44 struct IODeviceDesc {
53  HALRESULT (*Init)(IODevice iodevice);
54 
62  HALRESULT (*Deinit)(IODevice iodevice);
63 
73  HALRESULT (*IOCtl)(IODevice iodevice, unsigned int request, va_list args);
74 
82 
90 
98 
106 
114  size_t (*GetReadCount)(IODevice iodevice);
115 
123  size_t (*GetWriteSpace)(IODevice iodevice);
124 
133  size_t (*Write)(IODevice iodevice, const void* data, size_t size);
134 
143  size_t (*Read)(IODevice iodevice, void* data, size_t size);
144 
145 #if defined HAL_ENABLE_OS && (HAL_ENABLE_OS != 0)
146 
153  OSRecursiveMutex lock;
154 
155 #if defined HAL_IO_OS_INTEGRATION && (HAL_IO_OS_INTEGRATION != 0)
156 
162  OSMutex read_lock;
163 
169  OSMutex write_lock;
170 
183  OSNotifier read_notifier;
184 
197  OSNotifier write_notifier;
198 
199 #endif // HAL_IO_OS_INTEGRATION
200 
201 #endif // HAL_ENABLE_OS
202 
203 }; // struct IODeviceDesc
204 
205 
207 typedef struct IODeviceDesc IODeviceDesc;
208 
211 
213 typedef HALRESULT (*IODeviceIOCtlFunc)(IODevice, unsigned int, va_list);
214 
216 typedef size_t (*IODeviceGetCountFunc)(IODevice);
217 
219 typedef size_t (*IODeviceWriteFunc)(IODevice, const void*, size_t);
220 
222 typedef size_t (*IODeviceReadFunc)(IODevice, void*, size_t);
223 
224 
236 void IODEV_SignalReadEvent(IODevice iodevice, int count);
237 
249 void IODEV_SignalWriteEvent(IODevice iodevice, int count);
250 
254 #endif /* HALI_IODEVICE_H */
size_t(* IODeviceGetCountFunc)(IODevice)
Definition: hali_iodevice.h:216
struct IODeviceDesc * IODevice
Definition: hal_iodevice.h:287
HALRESULT(* EnableWrite)(IODevice iodevice)
Definition: hali_iodevice.h:81
HALRESULT(* IODeviceIOCtlFunc)(IODevice, unsigned int, va_list)
Definition: hali_iodevice.h:213
HALRESULT
Definition: hal_defs.h:16
size_t(* IODeviceWriteFunc)(IODevice, const void *, size_t)
Definition: hali_iodevice.h:219
size_t(* Read)(IODevice iodevice, void *data, size_t size)
Definition: hali_iodevice.h:143
HALRESULT(* Deinit)(IODevice iodevice)
Definition: hali_iodevice.h:62
HALRESULT(* DisableWrite)(IODevice iodevice)
Definition: hali_iodevice.h:89
IODevice API.
Definition: hali_iodevice.h:44
HALRESULT(* Init)(IODevice iodevice)
Definition: hali_iodevice.h:53
size_t(* GetReadCount)(IODevice iodevice)
Definition: hali_iodevice.h:114
HALRESULT(* IODeviceCtrlFunc)(IODevice)
Definition: hali_iodevice.h:210
void IODEV_SignalWriteEvent(IODevice iodevice, int count)
size_t(* GetWriteSpace)(IODevice iodevice)
Definition: hali_iodevice.h:123
OS notifier API.
void IODEV_SignalReadEvent(IODevice iodevice, int count)
struct OSNotifierDesc * OSNotifier
Definition: hal_osnotifier.h:68
Various HAL definitions.
Operating system (OS) API.
size_t(* Write)(IODevice iodevice, const void *data, size_t size)
Definition: hali_iodevice.h:133
HALRESULT(* DisableRead)(IODevice iodevice)
Definition: hali_iodevice.h:105
HALRESULT(* EnableRead)(IODevice iodevice)
Definition: hali_iodevice.h:97
size_t(* IODeviceReadFunc)(IODevice, void *, size_t)
Definition: hali_iodevice.h:222
HALRESULT(* IOCtl)(IODevice iodevice, unsigned int request, va_list args)
Definition: hali_iodevice.h:73