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_trace.h"
30 #include "tx_queue.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _tx_queue_send_notify PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* William E. Lamie, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function registers an application callback function that is */
46 /* called whenever a messages is sent to this queue. */
47 /* */
48 /* INPUT */
49 /* */
50 /* queue_ptr Pointer to queue control block*/
51 /* queue_send_notify Application callback function */
52 /* (TX_NULL disables notify) */
53 /* */
54 /* OUTPUT */
55 /* */
56 /* status Completion status */
57 /* */
58 /* CALLS */
59 /* */
60 /* None */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* Application Code */
65 /* */
66 /* RELEASE HISTORY */
67 /* */
68 /* DATE NAME DESCRIPTION */
69 /* */
70 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
71 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
72 /* resulting in version 6.1 */
73 /* */
74 /**************************************************************************/
_tx_queue_send_notify(TX_QUEUE * queue_ptr,VOID (* queue_send_notify)(TX_QUEUE * notify_queue_ptr))75 UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr))
76 {
77
78 #ifdef TX_DISABLE_NOTIFY_CALLBACKS
79
80 TX_QUEUE_NOT_USED(queue_ptr);
81 TX_QUEUE_SEND_NOTIFY_NOT_USED(queue_send_notify);
82
83 /* Feature is not enabled, return error. */
84 return(TX_FEATURE_NOT_ENABLED);
85 #else
86
87 TX_INTERRUPT_SAVE_AREA
88
89
90 /* Disable interrupts. */
91 TX_DISABLE
92
93 /* Make entry in event log. */
94 TX_TRACE_IN_LINE_INSERT(TX_TRACE_QUEUE_SEND_NOTIFY, queue_ptr, 0, 0, 0, TX_TRACE_QUEUE_EVENTS)
95
96 /* Make entry in event log. */
97 TX_EL_QUEUE_SEND_NOTIFY_INSERT
98
99 /* Setup queue send notification callback function. */
100 queue_ptr -> tx_queue_send_notify = queue_send_notify;
101
102 /* Restore interrupts. */
103 TX_RESTORE
104
105 /* Return success to caller. */
106 return(TX_SUCCESS);
107 #endif
108 }
109
110