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