1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** USBX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Utility */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
/* Include necessary system files. */ |
24 |
|
|
|
25 |
|
|
#define UX_SOURCE_CODE |
26 |
|
|
|
27 |
|
|
#include "ux_api.h" |
28 |
|
|
|
29 |
|
|
|
30 |
|
|
#if !defined(UX_STANDALONE) |
31 |
|
|
/**************************************************************************/ |
32 |
|
|
/* */ |
33 |
|
|
/* FUNCTION RELEASE */ |
34 |
|
|
/* */ |
35 |
|
|
/* _ux_utility_event_flags_create PORTABLE C */ |
36 |
|
|
/* 6.1.11 */ |
37 |
|
|
/* AUTHOR */ |
38 |
|
|
/* */ |
39 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
40 |
|
|
/* */ |
41 |
|
|
/* DESCRIPTION */ |
42 |
|
|
/* */ |
43 |
|
|
/* This function creates a threadx group of flags */ |
44 |
|
|
/* */ |
45 |
|
|
/* INPUT */ |
46 |
|
|
/* */ |
47 |
|
|
/* group_ptr Event flag control group */ |
48 |
|
|
/* name Pointer to thread name string */ |
49 |
|
|
/* */ |
50 |
|
|
/* OUTPUT */ |
51 |
|
|
/* */ |
52 |
|
|
/* Completion Status */ |
53 |
|
|
/* */ |
54 |
|
|
/* CALLS */ |
55 |
|
|
/* */ |
56 |
|
|
/* tx_event_flags_create ThreadX create event flag */ |
57 |
|
|
/* */ |
58 |
|
|
/* CALLED BY */ |
59 |
|
|
/* */ |
60 |
|
|
/* USBX Components */ |
61 |
|
|
/* */ |
62 |
|
|
/* RELEASE HISTORY */ |
63 |
|
|
/* */ |
64 |
|
|
/* DATE NAME DESCRIPTION */ |
65 |
|
|
/* */ |
66 |
|
|
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ |
67 |
|
|
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ |
68 |
|
|
/* used UX prefix to refer to */ |
69 |
|
|
/* TX symbols instead of using */ |
70 |
|
|
/* them directly, */ |
71 |
|
|
/* resulting in version 6.1 */ |
72 |
|
|
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ |
73 |
|
|
/* off in standalone build, */ |
74 |
|
|
/* resulting in version 6.1.11 */ |
75 |
|
|
/* */ |
76 |
|
|
/**************************************************************************/ |
77 |
|
301 |
UINT _ux_utility_event_flags_create(UX_EVENT_FLAGS_GROUP*group_ptr, CHAR *name) |
78 |
|
|
{ |
79 |
|
|
|
80 |
|
|
UINT status; |
81 |
|
|
|
82 |
|
|
/* Call ThreadX to create the event flags. */ |
83 |
|
301 |
status = tx_event_flags_create(group_ptr, name); |
84 |
|
|
|
85 |
|
|
/* Check for status. */ |
86 |
✓✓ |
301 |
if (status != UX_SUCCESS) |
87 |
|
|
{ |
88 |
|
|
|
89 |
|
|
/* Error trap. */ |
90 |
|
4 |
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_UTILITY, UX_EVENT_ERROR); |
91 |
|
|
|
92 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
93 |
|
|
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_EVENT_ERROR, group_ptr, 0, 0, UX_TRACE_ERRORS, 0, 0) |
94 |
|
|
|
95 |
|
|
} |
96 |
|
|
/* Return completion status. */ |
97 |
|
301 |
return(status); |
98 |
|
|
} |
99 |
|
|
#endif |