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_MUTEX_CREATE_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_mutex_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 mutex function        */
39 /*    call.                                                               */
40 /*                                                                        */
41 /*  INPUT                                                                 */
42 /*                                                                        */
43 /*    mutex_ptr                         Pointer to mutex control block    */
44 /*    name_ptr                          Pointer to mutex name             */
45 /*    inherit                           Initial mutex count               */
46 /*    mutex_control_block_size          Size of mutex control block       */
47 /*                                                                        */
48 /*  OUTPUT                                                                */
49 /*                                                                        */
50 /*    TX_MUTEX_ERROR                    Invalid mutex pointer             */
51 /*    TX_CALLER_ERROR                   Invalid caller of this function   */
52 /*    TX_INHERIT_ERROR                  Invalid inherit option            */
53 /*    status                            Actual completion status          */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _txm_module_kernel_call_dispatcher                                  */
58 /*                                                                        */
59 /*  CALLED BY                                                             */
60 /*                                                                        */
61 /*    Module application code                                             */
62 /*                                                                        */
63 /*  RELEASE HISTORY                                                       */
64 /*                                                                        */
65 /*    DATE              NAME                      DESCRIPTION             */
66 /*                                                                        */
67 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
68 /*  01-31-2022      Scott Larson            Modified comments and added   */
69 /*                                            CALL_NOT_USED option,       */
70 /*                                            resulting in version 6.1.10 */
71 /*                                                                        */
72 /**************************************************************************/
_txe_mutex_create(TX_MUTEX * mutex_ptr,CHAR * name_ptr,UINT inherit,UINT mutex_control_block_size)73 UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size)
74 {
75 
76 UINT return_value;
77 ALIGN_TYPE extra_parameters[2];
78 
79     extra_parameters[0] = (ALIGN_TYPE) inherit;
80     extra_parameters[1] = (ALIGN_TYPE) mutex_control_block_size;
81 
82     /* Call module manager dispatcher.  */
83     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_MUTEX_CREATE_CALL, (ALIGN_TYPE) mutex_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
84 
85     /* Return value to the caller.  */
86     return(return_value);
87 }
88 #endif
89