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 /** Block 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_block_pool.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _txe_block_pool_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 block pool information get */
45 /* service. */
46 /* */
47 /* INPUT */
48 /* */
49 /* pool_ptr Pointer to block pool control blk */
50 /* name Destination for the pool name */
51 /* available_blocks Number of free blocks in pool */
52 /* total_blocks Total number of blocks in pool */
53 /* first_suspended Destination for pointer of first */
54 /* thread suspended on block pool */
55 /* suspended_count Destination for suspended count */
56 /* next_pool Destination for pointer to next */
57 /* block pool on the created list */
58 /* */
59 /* OUTPUT */
60 /* */
61 /* TX_POOL_ERROR Invalid block pool pointer */
62 /* status Completion status */
63 /* */
64 /* CALLS */
65 /* */
66 /* _tx_block_pool_info_get Actual block pool info 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_block_pool_info_get(TX_BLOCK_POOL * pool_ptr,CHAR ** name,ULONG * available_blocks,ULONG * total_blocks,TX_THREAD ** first_suspended,ULONG * suspended_count,TX_BLOCK_POOL ** next_pool)81 UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks,
82 ULONG *total_blocks, TX_THREAD **first_suspended,
83 ULONG *suspended_count, TX_BLOCK_POOL **next_pool)
84 {
85
86
87 UINT status;
88
89
90 /* Check for an invalid block pool pointer. */
91 if (pool_ptr == TX_NULL)
92 {
93
94 /* Block pool pointer is invalid, return appropriate error code. */
95 status = TX_POOL_ERROR;
96 }
97
98 /* Now check the pool ID. */
99 else if (pool_ptr -> tx_block_pool_id != TX_BLOCK_POOL_ID)
100 {
101
102 /* Block pool pointer is invalid, return appropriate error code. */
103 status = TX_POOL_ERROR;
104 }
105 else
106 {
107
108 /* Otherwise, call the actual block pool information get service. */
109 status = _tx_block_pool_info_get(pool_ptr, name, available_blocks,
110 total_blocks, first_suspended, suspended_count, next_pool);
111 }
112
113 /* Return completion status. */
114 return(status);
115 }
116
117