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_RECEIVE_CALL_NOT_USED
25 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _txe_queue_receive                                  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 receive function call. */
38 /*                                                                        */
39 /*  INPUT                                                                 */
40 /*                                                                        */
41 /*    queue_ptr                         Pointer to queue control block    */
42 /*    destination_ptr                   Pointer to message destination    */
43 /*                                        **** MUST BE LARGE ENOUGH TO    */
44 /*                                             HOLD MESSAGE ****          */
45 /*    wait_option                       Suspension option                 */
46 /*                                                                        */
47 /*  OUTPUT                                                                */
48 /*                                                                        */
49 /*    TX_QUEUE_ERROR                    Invalid queue pointer             */
50 /*    TX_PTR_ERROR                      Invalid destination pointer (NULL)*/
51 /*    TX_WAIT_ERROR                     Invalid wait option               */
52 /*    status                            Actual completion status          */
53 /*                                                                        */
54 /*  CALLS                                                                 */
55 /*                                                                        */
56 /*    _txm_module_kernel_call_dispatcher                                  */
57 /*                                                                        */
58 /*  CALLED BY                                                             */
59 /*                                                                        */
60 /*    Module application code                                             */
61 /*                                                                        */
62 /*  RELEASE HISTORY                                                       */
63 /*                                                                        */
64 /*    DATE              NAME                      DESCRIPTION             */
65 /*                                                                        */
66 /*  09-30-2020      Scott Larson            Initial Version 6.1           */
67 /*  01-31-2022      Scott Larson            Modified comments and added   */
68 /*                                            CALL_NOT_USED option,       */
69 /*                                            resulting in version 6.1.10 */
70 /*                                                                        */
71 /**************************************************************************/
_txe_queue_receive(TX_QUEUE * queue_ptr,VOID * destination_ptr,ULONG wait_option)72 UINT _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option)
73 {
74 
75 UINT return_value;
76 
77     /* Call module manager dispatcher.  */
78     return_value = (UINT) (_txm_module_kernel_call_dispatcher)(TXM_QUEUE_RECEIVE_CALL, (ALIGN_TYPE) queue_ptr, (ALIGN_TYPE) destination_ptr, (ALIGN_TYPE) wait_option);
79 
80     /* Return value to the caller.  */
81     return(return_value);
82 }
83 #endif
84