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 /** ThreadX Component */
16 /** */
17 /** Queue */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define TX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "tx_api.h"
28 #include "tx_queue.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _txe_queue_info_get PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* William E. Lamie, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks for errors in the queue information get */
44 /* service. */
45 /* */
46 /* INPUT */
47 /* */
48 /* queue_ptr Pointer to queue control block */
49 /* name Destination for the queue name */
50 /* enqueued Destination for enqueued count */
51 /* available_storage Destination for available storage */
52 /* first_suspended Destination for pointer of first */
53 /* thread suspended on this queue */
54 /* suspended_count Destination for suspended count */
55 /* next_queue Destination for pointer to next */
56 /* queue on the created list */
57 /* */
58 /* OUTPUT */
59 /* */
60 /* TX_QUEUE_ERROR Invalid queue pointer */
61 /* status Completion status */
62 /* */
63 /* CALLS */
64 /* */
65 /* _tx_queue_info_get Actual information get service */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Application Code */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
76 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
77 /* resulting in version 6.1 */
78 /* */
79 /**************************************************************************/
_txe_queue_info_get(TX_QUEUE * queue_ptr,CHAR ** name,ULONG * enqueued,ULONG * available_storage,TX_THREAD ** first_suspended,ULONG * suspended_count,TX_QUEUE ** next_queue)80 UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage,
81 TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue)
82 {
83
84 UINT status;
85
86
87 /* Check for an invalid queue pointer. */
88 if (queue_ptr == TX_NULL)
89 {
90
91 /* Queue pointer is invalid, return appropriate error code. */
92 status = TX_QUEUE_ERROR;
93 }
94
95 /* Now check for a valid queue ID. */
96 else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID)
97 {
98
99 /* Queue pointer is invalid, return appropriate error code. */
100 status = TX_QUEUE_ERROR;
101 }
102 else
103 {
104
105 /* Otherwise, call the actual queue information get service. */
106 status = _tx_queue_info_get(queue_ptr, name, enqueued, available_storage, first_suspended,
107 suspended_count, next_queue);
108 }
109
110 /* Return completion status. */
111 return(status);
112 }
113
114