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_BYTE_ALLOCATE_CALL_NOT_USED
26 /**************************************************************************/
27 /* */
28 /* FUNCTION RELEASE */
29 /* */
30 /* _txe_byte_allocate 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 allocate bytes function call. */
39 /* */
40 /* INPUT */
41 /* */
42 /* pool_ptr Pointer to pool control block */
43 /* memory_ptr Pointer to place allocated bytes */
44 /* pointer */
45 /* memory_size Number of bytes to allocate */
46 /* wait_option Suspension option */
47 /* */
48 /* OUTPUT */
49 /* */
50 /* TX_POOL_ERROR Invalid memory pool pointer */
51 /* TX_PTR_ERROR Invalid destination pointer */
52 /* TX_WAIT_ERROR Invalid wait option */
53 /* TX_CALLER_ERROR Invalid caller of this function */
54 /* TX_SIZE_ERROR Invalid size of memory request */
55 /* status Actual completion status */
56 /* */
57 /* CALLS */
58 /* */
59 /* _txm_module_kernel_call_dispatcher */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Module application code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 09-30-2020 Scott Larson Initial Version 6.1 */
70 /* 01-31-2022 Scott Larson Modified comments and added */
71 /* CALL_NOT_USED option, */
72 /* resulting in version 6.1.10 */
73 /* */
74 /**************************************************************************/
_txe_byte_allocate(TX_BYTE_POOL * pool_ptr,VOID ** memory_ptr,ULONG memory_size,ULONG wait_option)75 UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, ULONG wait_option)
76 {
77
78 UINT return_value;
79 ALIGN_TYPE extra_parameters[2];
80
81 extra_parameters[0] = (ALIGN_TYPE) memory_size;
82 extra_parameters[1] = (ALIGN_TYPE) wait_option;
83
84 /* Call module manager dispatcher. */
85 return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_BYTE_ALLOCATE_CALL, (ALIGN_TYPE) pool_ptr, (ALIGN_TYPE) memory_ptr, (ALIGN_TYPE) extra_parameters);
86
87 /* Return value to the caller. */
88 return(return_value);
89 }
90 #endif
91