2 * Copyright (C) 2009, Broadcom Corporation
5 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 * the contents of this file may not be disclosed to third parties, copied
7 * or duplicated in any form, in whole or in part, without the prior
8 * written permission of Broadcom Corporation.
10 * $Id: osl_linux.h,v 1.2 2008/08/12 17:50:33 Exp $
16 #include <linux/types.h>
17 #include <linux/timer.h>
18 #include <linux/kernel.h>
19 #include <linux/spinlock.h>
23 spinlock_t slock
; /* Spin lock */
24 uint8 name
[16]; /* Name of the lock */
27 typedef struct osl_lock
*osl_lock_t
;
29 static inline osl_lock_t
30 OSL_LOCK_CREATE(uint8
*name
)
34 lock
= MALLOC(NULL
, sizeof(osl_lock_t
));
38 printf("Memory alloc for lock object failed\n");
42 spin_lock_init(&lock
->slock
);
43 strncpy(lock
->name
, name
, 16);
49 OSL_LOCK_DESTROY(osl_lock_t lock
)
51 MFREE(NULL
, lock
, sizeof(osl_lock_t
));
55 #define OSL_LOCK(lock) spin_lock_bh(&((lock)->slock))
56 #define OSL_UNLOCK(lock) spin_unlock_bh(&((lock)->slock))
58 #define DEV_IFNAME(dev) (((struct net_device *)dev)->name)
60 typedef struct osl_timer
{
61 struct timer_list timer
;
69 extern osl_timer_t
*osl_timer_init(const char *name
, void (*fn
)(void *arg
), void *arg
);
70 extern void osl_timer_add(osl_timer_t
*t
, uint32 ms
, bool periodic
);
71 extern void osl_timer_update(osl_timer_t
*t
, uint32 ms
, bool periodic
);
72 extern bool osl_timer_del(osl_timer_t
*t
);
73 extern osl_lock_t
OSL_LOCK_CREATE(uint8
*name
);
74 extern void OSL_LOCK_DESTROY(osl_lock_t lock
);
76 #endif /* _OSL_LINUX_H_ */