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 Manager                                                      */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TX_SOURCE_CODE
24 
25 #include "tx_api.h"
26 #include "txm_module.h"
27 #include "tx_byte_pool.h"
28 
29 /**************************************************************************/
30 /*                                                                        */
31 /*  FUNCTION                                               RELEASE        */
32 /*                                                                        */
33 /*    txm_module_manager_object_pool_create               PORTABLE C      */
34 /*                                                           6.1          */
35 /*  AUTHOR                                                                */
36 /*                                                                        */
37 /*    Scott Larson, Microsoft Corporation                                 */
38 /*                                                                        */
39 /*  DESCRIPTION                                                           */
40 /*                                                                        */
41 /*    This function creates an object pool for the module manager,        */
42 /*    which is used by modules to allocate system resources outside       */
43 /*    the memory area of the module. This is especially useful in         */
44 /*    memory protection.                                                  */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    object_memory                     Object memory address             */
49 /*    object_memory_size                Size in bytes of memory area      */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                            Completion status                 */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _tx_byte_pool_create              Create module memory byte pool    */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Application code                                                    */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
68 /*                                                                        */
69 /**************************************************************************/
_txm_module_manager_object_pool_create(VOID * object_memory,ULONG object_memory_size)70 UINT  _txm_module_manager_object_pool_create(VOID *object_memory, ULONG object_memory_size)
71 {
72 
73     /* Create a byte pool for allocating RAM areas for modules.  */
74     _tx_byte_pool_create(&_txm_module_manager_object_pool, "Module Manager Object Pool", object_memory, object_memory_size);
75 
76     /* Indicate the module manager object pool has been created.  */
77     _txm_module_manager_object_pool_created =  TX_TRUE;
78 
79     /* Return success.  */
80     return(TX_SUCCESS);
81 }
82 
83