Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
tidspbridge
include
dspbridge
sync.h
Go to the documentation of this file.
1
/*
2
* sync.h
3
*
4
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
5
*
6
* Provide synchronization services.
7
*
8
* Copyright (C) 2005-2006 Texas Instruments, Inc.
9
*
10
* This package is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License version 2 as
12
* published by the Free Software Foundation.
13
*
14
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17
*/
18
19
#ifndef _SYNC_H
20
#define _SYNC_H
21
22
#include <
dspbridge/dbdefs.h
>
23
#include <
dspbridge/host_os.h
>
24
25
26
/* Special timeout value indicating an infinite wait: */
27
#define SYNC_INFINITE 0xffffffff
28
35
struct
sync_object
{
36
struct
completion
comp
;
37
struct
completion
*
multi_comp
;
38
};
39
47
static
inline
void
sync_init_event(
struct
sync_object
*
event
)
48
{
49
init_completion(&event->
comp
);
50
event
->multi_comp =
NULL
;
51
}
52
60
static
inline
void
sync_reset_event(
struct
sync_object
*
event
)
61
{
62
INIT_COMPLETION
(event->
comp
);
63
event
->multi_comp =
NULL
;
64
}
65
74
void
sync_set_event
(
struct
sync_object
*
event
);
75
87
static
inline
int
sync_wait_on_event(
struct
sync_object
*
event
,
88
unsigned
timeout)
89
{
90
int
res
;
91
92
res =
wait_for_completion_interruptible_timeout
(&event->
comp
,
93
msecs_to_jiffies
(timeout));
94
if
(!res)
95
res = -
ETIME
;
96
else
if
(res > 0)
97
res = 0;
98
99
return
res
;
100
}
101
115
int
sync_wait_on_multiple_events
(
struct
sync_object
**
events
,
116
unsigned
count
,
unsigned
timeout,
117
unsigned
*
index
);
118
119
#endif
/* _SYNC_H */
Generated on Thu Jan 10 2013 14:32:05 for Linux Kernel by
1.8.2