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