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