struct hv_device *DeviceObject;
- HANDLE PollTimer; /* SA-111 workaround */
+ struct osd_timer *PollTimer; /* SA-111 workaround */
VMBUS_CHANNEL_STATE State;
/* typedef unsigned char GUID[16]; */
typedef void* HANDLE;
+typedef void (*PFN_WORKITEM_CALLBACK)(void* context);
+typedef void (*PFN_TIMER_CALLBACK)(void* context);
+
+
typedef struct {
unsigned char Data[16];
} GUID;
wait_queue_head_t event;
};
+struct osd_timer {
+ struct timer_list timer;
+ PFN_TIMER_CALLBACK callback;
+ void* context;
+};
-typedef void (*PFN_WORKITEM_CALLBACK)(void* context);
-typedef void (*PFN_TIMER_CALLBACK)(void* context);
#ifdef __x86_64__
extern void* MemMapIO(unsigned long phys, unsigned long size);
extern void MemUnmapIO(void* virt);
-extern HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context);
-extern void TimerClose(HANDLE hTimer);
-extern int TimerStop(HANDLE hTimer);
-extern void TimerStart(HANDLE hTimer, u32 expirationInUs);
+extern struct osd_timer *TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context);
+extern void TimerClose(struct osd_timer *t);
+extern int TimerStop(struct osd_timer *t);
+extern void TimerStart(struct osd_timer *t, u32 expirationInUs);
extern struct osd_waitevent *WaitEventCreate(void);
extern void WaitEventClose(struct osd_waitevent *waitEvent);
/* Data types */
-typedef struct _TIMER {
- struct timer_list timer;
- PFN_TIMER_CALLBACK callback;
- void* context;
-}TIMER;
typedef struct _WORKITEM {
struct work_struct work;
void TimerCallback(unsigned long data)
{
- TIMER* t = (TIMER*)data;
+ struct osd_timer *t = (struct osd_timer *) data;
t->callback(t->context);
}
-HANDLE TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context)
+struct osd_timer *TimerCreate(PFN_TIMER_CALLBACK pfnTimerCB, void* context)
{
- TIMER* t = kmalloc(sizeof(TIMER), GFP_KERNEL);
+ struct osd_timer *t = kmalloc(sizeof(struct osd_timer), GFP_KERNEL);
if (!t)
{
return NULL;
return t;
}
-void TimerStart(HANDLE hTimer, u32 expirationInUs)
+void TimerStart(struct osd_timer *t, u32 expirationInUs)
{
- TIMER* t = (TIMER* )hTimer;
-
t->timer.expires = jiffies + usecs_to_jiffies(expirationInUs);
add_timer(&t->timer);
}
-int TimerStop(HANDLE hTimer)
+int TimerStop(struct osd_timer *t)
{
- TIMER* t = (TIMER* )hTimer;
-
return del_timer(&t->timer);
}
-void TimerClose(HANDLE hTimer)
+void TimerClose(struct osd_timer *t)
{
- TIMER* t = (TIMER* )hTimer;
-
del_timer(&t->timer);
kfree(t);
}