2 Driver for USB Ethernet Control Model devices
3 Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch>
4 Distributed under the terms of the MIT license.
6 #ifndef HAIKU_TARGET_PLATFORM_HAIKU
7 #ifndef _BEOS_COMPATIBILITY_H_
8 #define _BEOS_COMPATIBILITY_H_
12 #define USB_ENDPOINT_ATTR_CONTROL 0x00
13 #define USB_ENDPOINT_ATTR_ISOCHRONOUS 0x01
14 #define USB_ENDPOINT_ATTR_BULK 0x02
15 #define USB_ENDPOINT_ATTR_INTERRUPT 0x03
16 #define USB_ENDPOINT_ATTR_MASK 0x03
18 #define USB_ENDPOINT_ADDR_DIR_IN 0x80
19 #define USB_ENDPOINT_ADDR_DIR_OUT 0x00
21 typedef struct mutex
{
28 mutex_init(mutex
*lock
, const char *name
)
30 lock
->sem
= create_sem(0, name
);
36 mutex_destroy(mutex
*lock
)
38 delete_sem(lock
->sem
);
42 static inline status_t
43 mutex_lock(mutex
*lock
)
45 if (atomic_add(&lock
->count
, -1) < 0)
46 return acquire_sem(lock
->sem
);
52 mutex_unlock(mutex
*lock
)
54 if (atomic_add(&lock
->count
, 1) < -1)
55 release_sem(lock
->sem
);
58 #endif /* !HAIKU_TARGET_PLATFORM_HAIKU */
59 #endif /* _BEOS_COMPATIBILITY_H_ */