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_prioritize 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 prioritize call. */
44 /* */
45 /* INPUT */
46 /* */
47 /* queue_ptr Pointer to queue control block */
48 /* */
49 /* OUTPUT */
50 /* */
51 /* status Completion status */
52 /* */
53 /* CALLS */
54 /* */
55 /* _tx_queue_prioritize Actual queue prioritize function */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* Application Code */
60 /* */
61 /* RELEASE HISTORY */
62 /* */
63 /* DATE NAME DESCRIPTION */
64 /* */
65 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
66 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
67 /* resulting in version 6.1 */
68 /* */
69 /**************************************************************************/
_txe_queue_prioritize(TX_QUEUE * queue_ptr)70 UINT _txe_queue_prioritize(TX_QUEUE *queue_ptr)
71 {
72
73 UINT status;
74
75
76 /* Check for an invalid queue pointer. */
77 if (queue_ptr == TX_NULL)
78 {
79 /* Queue pointer is invalid, return appropriate error code. */
80 status = TX_QUEUE_ERROR;
81 }
82
83 /* Now check for invalid queue ID. */
84 else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID)
85 {
86 /* Queue pointer is invalid, return appropriate error code. */
87 status = TX_QUEUE_ERROR;
88 }
89 else
90 {
91
92 /* Call actual queue prioritize function. */
93 status = _tx_queue_prioritize(queue_ptr);
94 }
95
96 /* Return completion status. */
97 return(status);
98 }
99
100