SYS/BIOS  7.00
Event.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated - http://www.ti.com
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
173 #ifndef ti_sysbios_knl_Event__include
174 #define ti_sysbios_knl_Event__include
175 
176 /* BIOS 6.x compatibility, use -Dxdc_std__include to disable */
178 #include <xdc/std.h>
181 #include <stdbool.h>
182 #include <stddef.h>
183 #include <stdint.h>
184 
185 #include <ti/sysbios/knl/Queue.h>
186 #include <ti/sysbios/knl/Task.h>
187 
189 
190 /* @cond NODOC */
191 #define ti_sysbios_knl_Event_long_names
192 #include "Event_defs.h"
195 #ifdef __cplusplus
196 extern "C" {
197 #endif
198 
202 #define Event_A_nullEventMasks "orMask and andMask are null"
203 
207 #define Event_A_nullEventId "posted eventId is null"
208 
213 #define Event_A_eventInUse "event object already in use"
214 
219 #define Event_A_badContext "bad calling context - must be called from a Task"
220 
225 #define Event_A_pendTaskDisabled "cannot call Event_pend() while the Task or Swi scheduler is disabled"
226 
252 #define Event_Id_00 (0x1)
253 #define Event_Id_01 (0x2)
254 #define Event_Id_02 (0x4)
255 #define Event_Id_03 (0x8)
256 #define Event_Id_04 (0x10)
257 #define Event_Id_05 (0x20)
258 #define Event_Id_06 (0x40)
259 #define Event_Id_07 (0x80)
260 #define Event_Id_08 (0x100)
261 #define Event_Id_09 (0x200)
262 #define Event_Id_10 (0x400)
263 #define Event_Id_11 (0x800)
264 #define Event_Id_12 (0x1000)
265 #define Event_Id_13 (0x2000)
266 #define Event_Id_14 (0x4000)
267 #define Event_Id_15 (0x8000)
268 #define Event_Id_16 (0x10000)
269 #define Event_Id_17 (0x20000)
270 #define Event_Id_18 (0x40000)
271 #define Event_Id_19 (0x80000)
272 #define Event_Id_20 (0x100000)
273 #define Event_Id_21 (0x200000)
274 #define Event_Id_22 (0x400000)
275 #define Event_Id_23 (0x800000)
276 #define Event_Id_24 (0x1000000)
277 #define Event_Id_25 (0x2000000)
278 #define Event_Id_26 (0x4000000)
279 #define Event_Id_27 (0x8000000)
280 #define Event_Id_28 (0x10000000)
281 #define Event_Id_29 (0x20000000)
282 #define Event_Id_30 (0x40000000)
283 #define Event_Id_31 (0x80000000)
284 #define Event_Id_NONE (0)
285 
286 
287 /*
288  * ======== INTERNAL DEFINITIONS ========
289  */
290 
291 typedef enum {
297 
298 typedef struct {
299  Task_PendElem tpElem;
301  unsigned int matchingEvents;
302  unsigned int andMask;
303  unsigned int orMask;
305 
306 struct Event_Params {
307  unsigned int dummy;
308 };
309 
310 struct Event_Struct {
312  volatile unsigned int postedEvents;
314 };
315 
316 typedef struct Event_Params Event_Params;
317 typedef struct Event_Struct Event_Object;
318 typedef struct Event_Struct Event_Struct;
319 typedef struct Event_Struct *Event_Handle;
320 
322 typedef struct {
323  Queue_Struct objQ;
324 } Event_Module_State;
327 /*
328  * ======== FUNCTION DECLARATIONS ========
329  */
330 
332 extern void Event_Instance_init(Event_Object *obj, const Event_Params *params);
340 extern Event_Handle Event_create(const Event_Params *params, Error_Block *eb);
341 
348 extern Event_Handle Event_construct(Event_Struct *obj, const Event_Params *params);
349 
358 void Event_delete(Event_Handle *event);
359 
367 extern void Event_destruct(Event_Struct *obj);
368 
411 extern unsigned int Event_pend(Event_Handle event, unsigned int andMask, unsigned int orMask, uint32_t timeout);
412 
423 extern void Event_post(Event_Handle event, unsigned int eventMask);
424 
434 extern unsigned int Event_getPostedEvents(Event_Handle event);
435 
447 extern void Event_Params_init(Event_Params *prms);
448 
457 extern Event_Handle Event_Object_first(void);
458 
469 extern Event_Handle Event_Object_next(Event_Handle event);
470 
480 extern void Event_sync(Event_Handle event, unsigned int eventId, unsigned int count);
481 
482 extern void Event_pendTimeout__I(uintptr_t arg);
483 extern unsigned int Event_checkEvents(Event_Object *event, unsigned int andMask, unsigned int orMask);
484 
485 
486 static inline Event_Handle Event_handle(Event_Struct *str)
487 {
488  return ((Event_Handle)str);
489 }
490 
491 static inline Event_Struct * Event_struct(Event_Handle h)
492 {
493  return ((Event_Struct *)h);
494 }
495 
496 #define Event_module ((Event_Module_State *) &(Event_Module_state))
497 
499 #ifdef __cplusplus
500 }
501 #endif
502 
503 #endif /* ti_sysbios_knl_Event__include */
504 
505 /* @cond NODOC */
506 #undef ti_sysbios_knl_Event_long_names
507 #include "Event_defs.h"
Event_Handle Event_create(const Event_Params *params, Error_Block *eb)
Create an Event object.
Queue_Struct pendQ
Definition: Event.h:313
void Event_Params_init(Event_Params *prms)
Initialize the Event_Params structure with default values.
Definition: Event.h:306
Definition: Event.h:295
void Event_delete(Event_Handle *event)
Delete an Event.
unsigned int Event_pend(Event_Handle event, unsigned int andMask, unsigned int orMask, uint32_t timeout)
Wait for events defined in &#39;and&#39; OR &#39;or&#39; masks.
Opaque queue element.
Definition: Queue.h:204
Definition: Event.h:310
Runtime error manager.
Event_PendState pendState
Definition: Event.h:300
Queue Manager.
volatile unsigned int postedEvents
Definition: Event.h:312
Error block.
Definition: Error.h:152
unsigned int Event_getPostedEvents(Event_Handle event)
Returns the set of events that have not been consumed by a task (ie those events that have not fully ...
Event_Handle Event_Object_first(void)
return handle of the first Event on Event list
Definition: Event.h:294
unsigned int andMask
Definition: Event.h:302
Task_PendElem tpElem
Definition: Event.h:299
void Event_post(Event_Handle event, unsigned int eventMask)
Post event(s) to an event object.
Definition: Event.h:292
Definition: Event.h:293
Task Manager.
unsigned int dummy
Definition: Event.h:307
Event_PendState
Definition: Event.h:291
unsigned int orMask
Definition: Event.h:303
void Event_destruct(Event_Struct *obj)
Destruct an Event.
struct Event_Struct * Event_Handle
Definition: Event.h:319
Event_Handle Event_construct(Event_Struct *obj, const Event_Params *params)
Construct an Event object.
Queue_Elem objElem
Definition: Event.h:311
Event_Handle Event_Object_next(Event_Handle event)
return handle of the next Event on Event list
Definition: Event.h:298
unsigned int matchingEvents
Definition: Event.h:301
© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale