summaryrefslogtreecommitdiff
path: root/common_smp/src/tx_queue_send.c
diff options
context:
space:
mode:
authorYuxin Zhou <[email protected]>2021-10-14 00:51:26 +0000
committerYuxin Zhou <[email protected]>2021-10-14 00:51:26 +0000
commit1af8404c54f9c8d3caa2ac3523c2a5f014aecb1c (patch)
tree93e4f4d64ec8c21c01b77f19b8e7326e85227e3d /common_smp/src/tx_queue_send.c
parent215df45d4b59d4ce8606a88f566d1d426e64a84c (diff)
Release 6.1.9
Diffstat (limited to 'common_smp/src/tx_queue_send.c')
-rw-r--r--common_smp/src/tx_queue_send.c106
1 files changed, 54 insertions, 52 deletions
diff --git a/common_smp/src/tx_queue_send.c b/common_smp/src/tx_queue_send.c
index 8163350a..7cbb9b73 100644
--- a/common_smp/src/tx_queue_send.c
+++ b/common_smp/src/tx_queue_send.c
@@ -12,8 +12,8 @@
/**************************************************************************/
/**************************************************************************/
-/** */
-/** ThreadX Component */
+/** */
+/** ThreadX Component */
/** */
/** Queue */
/** */
@@ -31,57 +31,59 @@
#include "tx_queue.h"
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _tx_queue_send PORTABLE C */
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _tx_queue_send PORTABLE C */
/* 6.1 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
-/* */
-/* This function places a message into the specified queue. If there */
-/* is no room in the queue, this function waits according to the */
-/* option specified. */
-/* */
-/* INPUT */
-/* */
-/* queue_ptr Pointer to queue control block */
-/* source_ptr Pointer to message source */
-/* wait_option Suspension option */
-/* */
-/* OUTPUT */
-/* */
-/* status Completion status */
-/* */
-/* CALLS */
-/* */
-/* _tx_thread_system_resume Resume thread routine */
-/* _tx_thread_system_ni_resume Non-interruptable resume thread */
-/* _tx_thread_system_suspend Suspend thread routine */
-/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */
-/* */
-/* CALLED BY */
-/* */
-/* Application Code */
-/* */
-/* RELEASE HISTORY */
-/* */
+/* */
+/* This function places a message into the specified queue. If there */
+/* is no room in the queue, this function waits according to the */
+/* option specified. */
+/* */
+/* INPUT */
+/* */
+/* queue_ptr Pointer to queue control block */
+/* source_ptr Pointer to message source */
+/* wait_option Suspension option */
+/* */
+/* OUTPUT */
+/* */
+/* status Completion status */
+/* */
+/* CALLS */
+/* */
+/* _tx_thread_system_resume Resume thread routine */
+/* _tx_thread_system_ni_resume Non-interruptable resume thread */
+/* _tx_thread_system_suspend Suspend thread routine */
+/* _tx_thread_system_ni_suspend Non-interruptable suspend thread */
+/* */
+/* CALLED BY */
+/* */
+/* Application Code */
+/* */
+/* RELEASE HISTORY */
+/* */
/* DATE NAME DESCRIPTION */
/* */
-/* 09-30-2020 William E. Lamie Initial Version 6.1 */
+/* 05-19-2020 William E. Lamie Initial Version 6.0 */
+/* 09-30-2020 Yuxin Zhou Modified comment(s), */
+/* resulting in version 6.1 */
/* */
/**************************************************************************/
UINT _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option)
{
TX_INTERRUPT_SAVE_AREA
-
-TX_THREAD *thread_ptr;
-ULONG *source;
+
+TX_THREAD *thread_ptr;
+ULONG *source;
ULONG *destination;
UINT size;
UINT suspended_count;
@@ -126,9 +128,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
/* Determine if there are suspended on this queue. */
if (suspended_count == TX_NO_SUSPENSIONS)
{
-
+
/* No suspended threads, simply place the message in the queue. */
-
+
/* Reduce the amount of available storage. */
queue_ptr -> tx_queue_available_storage--;
@@ -138,9 +140,9 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
/* Setup source and destination pointers. */
source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr);
destination = queue_ptr -> tx_queue_write;
- size = queue_ptr -> tx_queue_message_size;
+ size = queue_ptr -> tx_queue_message_size;
- /* Copy message. Note that the source and destination pointers are
+ /* Copy message. Note that the source and destination pointers are
incremented by the macro. */
TX_QUEUE_MESSAGE_COPY(source, destination, size)
@@ -180,7 +182,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
else
{
- /* There is a thread suspended on an empty queue. Simply
+ /* There is a thread suspended on an empty queue. Simply
copy the message to the suspended thread's destination
pointer. */
@@ -213,8 +215,8 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
previous_thread = thread_ptr -> tx_thread_suspended_previous;
next_thread -> tx_thread_suspended_previous = previous_thread;
previous_thread -> tx_thread_suspended_next = next_thread;
- }
-
+ }
+
/* Decrement the suspension count. */
queue_ptr -> tx_queue_suspended_count = suspended_count;
@@ -226,14 +228,14 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
/* Setup source and destination pointers. */
source = TX_VOID_TO_ULONG_POINTER_CONVERT(source_ptr);
destination = TX_VOID_TO_ULONG_POINTER_CONVERT(thread_ptr -> tx_thread_additional_suspend_info);
- size = queue_ptr -> tx_queue_message_size;
+ size = queue_ptr -> tx_queue_message_size;
- /* Copy message. Note that the source and destination pointers are
+ /* Copy message. Note that the source and destination pointers are
incremented by the macro. */
TX_QUEUE_MESSAGE_COPY(source, destination, size)
/* Put return status into the thread control block. */
- thread_ptr -> tx_thread_suspend_status = TX_SUCCESS;
+ thread_ptr -> tx_thread_suspend_status = TX_SUCCESS;
#ifndef TX_DISABLE_NOTIFY_CALLBACKS
@@ -264,7 +266,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
/* Determine if a notify callback is required. */
if (queue_send_notify != TX_NULL)
- {
+ {
/* Call application queue send notification. */
(queue_send_notify)(queue_ptr);
@@ -272,7 +274,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
#endif
}
}
-
+
/* At this point, the queue is full. Determine if suspension is requested. */
else if (wait_option != TX_NO_WAIT)
{
@@ -300,7 +302,7 @@ VOID (*queue_send_notify)(struct TX_QUEUE_STRUCT *notify_queue_ptr);
/* Increment the number of full suspensions on this queue. */
queue_ptr -> tx_queue_performance_full_suspension_count++;
#endif
-
+
/* Pickup thread pointer. */
TX_THREAD_GET_CURRENT(thread_ptr)