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 /**   Byte Memory                                                         */
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_byte_pool.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _tx_byte_pool_prioritize                            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 byte pool prioritize call.   */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    pool_ptr                          Pointer to pool control block     */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    status                            Completion status                 */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _tx_byte_pool_prioritize         Actual byte pool prioritize        */
57 /*                                        function                        */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Application Code                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
68 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
69 /*                                            resulting in version 6.1    */
70 /*                                                                        */
71 /**************************************************************************/
_txe_byte_pool_prioritize(TX_BYTE_POOL * pool_ptr)72 UINT  _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr)
73 {
74 
75 UINT        status;
76 
77 
78     /* Check for an invalid byte memory pool pointer.  */
79     if (pool_ptr == TX_NULL)
80     {
81 
82         /* Byte pool pointer is invalid, return appropriate error code.  */
83         status =  TX_POOL_ERROR;
84     }
85 
86     /* Now check for invalid pool ID.  */
87     else if (pool_ptr -> tx_byte_pool_id != TX_BYTE_POOL_ID)
88     {
89 
90         /* Byte pool pointer is invalid, return appropriate error code.  */
91         status =  TX_POOL_ERROR;
92     }
93     else
94     {
95 
96         /* Call actual byte pool prioritize function.  */
97         status =  _tx_byte_pool_prioritize(pool_ptr);
98     }
99 
100     /* Return completion status.  */
101     return(status);
102 }
103 
104