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 /**   Queue                                                               */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 #define TX_SOURCE_CODE
24 
25 
26 /* Include necessary system files.  */
27 
28 #include "tx_api.h"
29 #include "tx_queue.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _txe_queue_send_notify                              PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    William E. Lamie, Microsoft Corporation                             */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function checks for errors in the queue send notify            */
45 /*    callback function call.                                             */
46 /*                                                                        */
47 /*  INPUT                                                                 */
48 /*                                                                        */
49 /*    queue_ptr                             Pointer to queue control block*/
50 /*    queue_send_notify                     Application callback function */
51 /*                                            (TX_NULL disables notify)   */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    status                                Completion status             */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _tx_queue_send_notify                 Actual queue send notify call */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
70 /*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
71 /*                                            resulting in version 6.1    */
72 /*                                                                        */
73 /**************************************************************************/
_txe_queue_send_notify(TX_QUEUE * queue_ptr,VOID (* queue_send_notify)(TX_QUEUE * notify_queue_ptr))74 UINT  _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr))
75 {
76 
77 UINT    status;
78 
79 
80     /* Check for an invalid queue pointer.  */
81     if (queue_ptr == TX_NULL)
82     {
83 
84         /* Queue pointer is invalid, return appropriate error code.  */
85         status =  TX_QUEUE_ERROR;
86     }
87 
88     /* Now check for a valid queue ID.  */
89     else if (queue_ptr -> tx_queue_id != TX_QUEUE_ID)
90     {
91 
92         /* Queue pointer is invalid, return appropriate error code.  */
93         status =  TX_QUEUE_ERROR;
94     }
95     else
96     {
97 
98         /* Call actual queue send notify function.  */
99         status =  _tx_queue_send_notify(queue_ptr, queue_send_notify);
100     }
101 
102     /* Return completion status.  */
103     return(status);
104 }
105 
106