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_QUEUE_CREATE_CALL_NOT_USED
25 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _txe_queue_create                                   PORTABLE C      */
30 /*                                                           6.1.10       */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Scott Larson, Microsoft Corporation                                 */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This function checks for errors in the queue create function call.  */
38 /*                                                                        */
39 /*  INPUT                                                                 */
40 /*                                                                        */
41 /*    queue_ptr                         Pointer to queue control block    */
42 /*    name_ptr                          Pointer to queue name             */
43 /*    message_size                      Size of each queue message        */
44 /*    queue_start                       Starting address of the queue area*/
45 /*    queue_size                        Number of bytes in the queue      */
46 /*    queue_control_block_size          Size of queue control block       */
47 /*                                                                        */
48 /*  OUTPUT                                                                */
49 /*                                                                        */
50 /*    TX_QUEUE_ERROR                    Invalid queue pointer             */
51 /*    TX_PTR_ERROR                      Invalid starting address of queue */
52 /*    TX_SIZE_ERROR                     Invalid message queue size        */
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_queue_create(TX_QUEUE * queue_ptr,CHAR * name_ptr,UINT message_size,VOID * queue_start,ULONG queue_size,UINT queue_control_block_size)73 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)
74 {
75 
76 UINT return_value;
77 ALIGN_TYPE extra_parameters[4];
78 
79     extra_parameters[0] = (ALIGN_TYPE) message_size;
80     extra_parameters[1] = (ALIGN_TYPE) queue_start;
81     extra_parameters[2] = (ALIGN_TYPE) queue_size;
82     extra_parameters[3] = (ALIGN_TYPE) queue_control_block_size;
83 
84     /* Call module manager dispatcher.  */
85     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_CREATE_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) name_ptr, (ALIGN_TYPE) extra_parameters);
86 
87     /* Return value to the caller.  */
88     return(return_value);
89 }
90 #endif
91