source: svn/newcon3bcm2_21bu/magnum/basemodules/kni/ucos_ii/bkni_event_group.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 5.8 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2010, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bkni_event_group.h $
11 * $brcm_Revision: Hydra_Software_Devel/1 $
12 * $brcm_Date: 8/19/10 8:08a $
13 *
14 * Module Description:
15 *
16 * Implementatation of the Magnum KNI for user space Linux applications.
17 *
18 * Revision History:
19 *
20 * $brcm_Log: /magnum/basemodules/kni/ucos_ii/bkni_event_group.h $ *
21 *
22 * Hydra_Software_Devel/1   8/19/10 8:08a jfisher
23 * SW7572-49:  Add nesting check.
24 *
25 * Hydra_Software_Devel/3   2/26/04 12:29p erickson
26 * PR9736: fixed comment
27 *
28 * Hydra_Software_Devel/2   2/26/04 12:21p erickson
29 * PR9736: updated comments
30 *
31 * Hydra_Software_Devel/1   2/11/04 10:52p vsilyaev
32 * PR 9736: API for event multiplexing
33 *
34 ***************************************************************************/
35#ifndef BKNI_EVENT_GROUP_H_
36#define BKNI_EVENT_GROUP_H_
37
38#include "bkni_multi.h"
39
40/*=*************************************************************************
41Summary:
42The event group implements event multiplexing. An application
43can group multiple events and then wait in the single thread any of these
44events to be set.
45
46The BKNI_EventGroup kernel interface is an optional component of the kernel interface.
47It shall not be used by the porting interface, base modules or common utilites.
48It is only for application needs.
49
50Example:
51  #include "bkni_event_group.h"
52
53  ...
54  BKNI_EventHandle event1, event2;
55  BKNI_EventHandle events[2];
56  unsigned nevents;
57
58  BKNI_EventGroupHandle group;
59
60  BKNI_CreateEvent(&event1);
61  BKNI_CreateEvent(&event2);
62
63  BKNI_CreateEventGroup(&group);
64
65  BKNI_AddEventGroup(group, event1);
66  BKNI_AddEventGroup(group, event2);
67
68  BKNI_WaitForGroup(group, 1000, events, 2, &nevents);
69
70  printf("Got %d events", nevents);
71
72
73****************************************************************************/
74
75
76/**************************************************************************
77Summary:
78 Event group handle
79**************************************************************************/
80typedef struct BKNI_GroupObj *BKNI_EventGroupHandle;
81
82
83/**************************************************************************
84Summary:
85 This function is used to create a new event group
86
87Description:
88 This function create a new evetn group
89
90Returns:
91        BERR_SUCCESS - Event groupt was created successfully.
92        BERR_OS_ERROR - The system failed and group wasn't created
93**************************************************************************/
94BERR_Code BKNI_CreateEventGroup(
95                BKNI_EventGroupHandle *pGroup
96                );
97
98/**************************************************************************
99Summary:
100 This function is used to destroy an event group
101
102Description:
103 This function destroy a new evetn group.
104Note: application shall not be inside BKNI_WaitForGroup while calling this function.
105
106Returns:
107  N/A
108**************************************************************************/
109void BKNI_DestroyEventGroup(
110                BKNI_EventGroupHandle group
111                );
112
113/**************************************************************************
114Summary:
115 This function is used to add an event into the event group
116
117Description:
118 This function adds an event into the event group. If event is already
119 set off, active BKNI_WaitForGroup would be woken up immediatly.
120
121Note: Event could belong only to the one group at the time.
122
123Returns:
124        BERR_SUCCESS - Event was added into the group successfully
125        BERR_OS_ERROR - The system failed and event wasn't added
126**************************************************************************/
127BERR_Code
128BKNI_AddEventGroup(
129                BKNI_EventGroupHandle group,  /* Event group */
130                BKNI_EventHandle event /* Event to add into the group */
131                );
132
133/**************************************************************************
134Summary:
135 This function is used to remove an event from the event group
136
137Description:
138 This function removes to event from the event group
139
140Returns:
141        BERR_SUCCESS - Event was removed from the group successfully
142        BERR_OS_ERROR - The system failed and the group state is unspecified
143**************************************************************************/
144BERR_Code
145BKNI_RemoveEventGroup(
146                BKNI_EventGroupHandle group,  /* Event group */
147                BKNI_EventHandle event /* Event to remove from the group */
148                );
149
150/**************************************************************************
151Summary:
152 This function is used to wait for the any event from the group.
153
154Description:
155 This function waits for the any event from the group. This function
156 could exit either because of timeout, or when some event[s] are set.
157 In the latter case it would save the number of events and events themselves in
158 the events structure.
159 After the event is saved in the user specified area, the event is cleared out.
160
161Returns:
162        BERR_SUCCESS - Event was removed from the group successfully
163        BERR_OS_ERROR - The system failed and the group state is unspecified
164**************************************************************************/
165BERR_Code
166BKNI_WaitForGroup(
167                BKNI_EventGroupHandle group, /* event group */
168                int timeoutMsec,  /* timeout in milliseconds, use BKNI_INFINITE to wait without timeout */
169                BKNI_EventHandle *events, /* [out] pass out the events that were triggered
170                                                        (specified by *nevents) */
171                unsigned max_events,  /* the maximum number of events which can be passed out using
172                                                        the events parameter. Generally this should be equal to the
173                                                        number of events in the BKNI_EventGroup. */
174                unsigned *nevents /* [out] number of events which were stored in the user specified area */
175                );
176
177
178#endif /* BKNI_EVENT_GROUP_H_ */
179
180
Note: See TracBrowser for help on using the repository browser.