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                                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define TXM_MODULE
23 #include "txm_module.h"
24 #ifndef TXM_MODULE_OBJECT_ALLOCATE_CALL_NOT_USED
25 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _txm_module_manager_object_allocate                 PORTABLE C      */
30 /*                                                           6.1.10       */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Scott Larson, Microsoft Corporation                                 */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This function allocates memory for an object from the memory pool   */
38 /*    supplied to txm_module_manager_initialize.                          */
39 /*                                                                        */
40 /*  INPUT                                                                 */
41 /*                                                                        */
42 /*    object_ptr                        Destination of object pointer on  */
43 /*                                        successful allocation           */
44 /*    object_size                       Size in bytes of the object to be */
45 /*                                        allocated                       */
46 /*    module_instance                   The module instance that the      */
47 /*                                        object belongs to               */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    status                            Completion status                 */
52 /*                                                                        */
53 /*  CALLS                                                                 */
54 /*                                                                        */
55 /*    _txm_module_kernel_call_dispatcher                                  */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Module application code                                             */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
66 /*  01-31-2022      Scott Larson            Modified comments and added   */
67 /*                                            CALL_NOT_USED option,       */
68 /*                                            resulting in version 6.1.10 */
69 /*                                                                        */
70 /**************************************************************************/
_txm_module_object_allocate(VOID ** object_ptr,ULONG object_size)71 UINT _txm_module_object_allocate(VOID **object_ptr, ULONG object_size)
72 {
73 
74 UINT return_value;
75 
76     /* Call module manager dispatcher.  */
77     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MODULE_OBJECT_ALLOCATE_CALL, (ALIGN_TYPE) object_ptr, (ALIGN_TYPE) object_size, 0);
78 
79     /* Return value to the caller.  */
80     return(return_value);
81 }
82 #endif
83