TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_wait.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __TFM_WAIT_H__
8 #define __TFM_WAIT_H__
9 
10 #include <stddef.h>
11 
12 #include "cmsis_compiler.h"
13 
14 /* The magic number has two purposes: corruption detection and debug */
15 #define TFM_EVENT_MAGIC 0x65766e74
16 
17 struct tfm_event_t {
18  uint32_t magic; /* 'evnt' */
19  struct tfm_core_thread_t *owner; /* Event blocked thread */
20 };
21 
22 /*
23  * Initialize an event object.
24  *
25  * Parameters:
26  * pevnt - The pointer of event object allocated by the caller
27  */
28 void __STATIC_INLINE tfm_event_init(struct tfm_event_t *pevnt)
29 {
30  pevnt->magic = TFM_EVENT_MAGIC;
31  pevnt->owner = NULL;
32 }
33 
34 /*
35  * Wait on an event object.
36  *
37  * Parameters:
38  * pevnt - The pointer of event object allocated by the caller
39  *
40  * Notes:
41  * Block caller thread by calling this function.
42  */
43 void tfm_event_wait(struct tfm_event_t *pevnt);
44 
45 /*
46  * Wake up an event object.
47  *
48  * Parameters :
49  * pevnt - The pointer of event object allocated by the caller
50  * retval - Value to be returned to owner
51  *
52  * Notes:
53  * Wake up the blocked thread and set parameter 'retval' as the return value.
54  */
55 void tfm_event_wake(struct tfm_event_t *pevnt, uint32_t retval);
56 
57 #endif
uint32_t magic
Definition: tfm_wait.h:18
void tfm_event_wait(struct tfm_event_t *pevnt)
Definition: tfm_wait.c:11
struct tfm_core_thread_t * owner
Definition: tfm_wait.h:19
void tfm_event_wake(struct tfm_event_t *pevnt, uint32_t retval)
Definition: tfm_wait.c:20
void __STATIC_INLINE tfm_event_init(struct tfm_event_t *pevnt)
Definition: tfm_wait.h:28
#define TFM_EVENT_MAGIC
Definition: tfm_wait.h:15