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 /**   Module                                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TXM_MODULE
24 #include "txm_module.h"
25 #ifndef TXM_BLOCK_POOL_CREATE_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_block_pool_create                              PORTABLE C      */
31 /*                                                           6.1.10       */
32 /*  AUTHOR                                                                */
33 /*                                                                        */
34 /*    Scott Larson, Microsoft Corporation                                 */
35 /*                                                                        */
36 /*  DESCRIPTION                                                           */
37 /*                                                                        */
38 /*    This function checks for errors in the create block memory pool     */
39 /*    function call.                                                      */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    pool_ptr                          Pointer to pool control block     */
44 /*    name_ptr                          Pointer to block pool name        */
45 /*    block_size                        Number of bytes in each block     */
46 /*    pool_start                        Address of beginning of pool area */
47 /*    pool_size                         Number of bytes in the block pool */
48 /*    pool_control_block_size           Size of block pool control block  */
49 /*                                                                        */
50 /*  OUTPUT                                                                */
51 /*                                                                        */
52 /*    TX_POOL_ERROR                     Invalid pool pointer              */
53 /*    TX_PTR_ERROR                      Invalid starting address          */
54 /*    TX_SIZE_ERROR                     Invalid pool size                 */
55 /*    TX_CALLER_ERROR                   Invalid caller of pool            */
56 /*    status                            Actual completion status          */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _txm_module_kernel_call_dispatcher                                  */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Module application code                                             */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
71 /*  01-31-2022      Scott Larson            Modified comments and added   */
72 /*                                            CALL_NOT_USED option,       */
73 /*                                            resulting in version 6.1.10 */
74 /*                                                                        */
75 /**************************************************************************/
_txe_block_pool_create(TX_BLOCK_POOL * pool_ptr,CHAR * name_ptr,ULONG block_size,VOID * pool_start,ULONG pool_size,UINT pool_control_block_size)76 UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, VOID *pool_start, ULONG pool_size, UINT pool_control_block_size)
77 {
78 
79 UINT return_value;
80 ALIGN_TYPE extra_parameters[4];
81 
82     extra_parameters[0] = (ALIGN_TYPE) block_size;
83     extra_parameters[1] = (ALIGN_TYPE) pool_start;
84     extra_parameters[2] = (ALIGN_TYPE) pool_size;
85     extra_parameters[3] = (ALIGN_TYPE) pool_control_block_size;
86 
87     /* Call module manager dispatcher.  */
88     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BLOCK_POOL_CREATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
89 
90     /* Return value to the caller.  */
91     return(return_value);
92 }
93 #endif
94