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_QUEUE_CREATE_CALL_NOT_USED
26 /**************************************************************************/
27 /*                                                                        */
28 /*  FUNCTION                                               RELEASE        */
29 /*                                                                        */
30 /*    _txe_queue_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 queue create function call.  */
39 /*                                                                        */
40 /*  INPUT                                                                 */
41 /*                                                                        */
42 /*    queue_ptr                         Pointer to queue control block    */
43 /*    name_ptr                          Pointer to queue name             */
44 /*    message_size                      Size of each queue message        */
45 /*    queue_start                       Starting address of the queue area*/
46 /*    queue_size                        Number of bytes in the queue      */
47 /*    queue_control_block_size          Size of queue control block       */
48 /*                                                                        */
49 /*  OUTPUT                                                                */
50 /*                                                                        */
51 /*    TX_QUEUE_ERROR                    Invalid queue pointer             */
52 /*    TX_PTR_ERROR                      Invalid starting address of queue */
53 /*    TX_SIZE_ERROR                     Invalid message queue size        */
54 /*    status                            Actual completion status          */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*                                                                        */
58 /*    _txm_module_kernel_call_dispatcher                                  */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    Module application code                                             */
63 /*                                                                        */
64 /*  RELEASE HISTORY                                                       */
65 /*                                                                        */
66 /*    DATE              NAME                      DESCRIPTION             */
67 /*                                                                        */
68 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
69 /*  01-31-2022      Scott Larson            Modified comments and added   */
70 /*                                            CALL_NOT_USED option,       */
71 /*                                            resulting in version 6.1.10 */
72 /*                                                                        */
73 /**************************************************************************/
_txe_queue_create(TX_QUEUE * queue_ptr,CHAR * name_ptr,UINT message_size,VOID * queue_start,ULONG queue_size,UINT queue_control_block_size)74 UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, VOID *queue_start, ULONG queue_size, UINT queue_control_block_size)
75 {
76 
77 UINT return_value;
78 ALIGN_TYPE extra_parameters[4];
79 
80     extra_parameters[0] = (ALIGN_TYPE) message_size;
81     extra_parameters[1] = (ALIGN_TYPE) queue_start;
82     extra_parameters[2] = (ALIGN_TYPE) queue_size;
83     extra_parameters[3] = (ALIGN_TYPE) queue_control_block_size;
84 
85     /* Call module manager dispatcher.  */
86     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_CREATE_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
87 
88     /* Return value to the caller.  */
89     return(return_value);
90 }
91 #endif
92