Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions common/inc/tx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ typedef struct TX_TIMER_INTERNAL_STRUCT
/* Define the timeout function and timeout function parameter. */
VOID (*tx_timer_internal_timeout_function)(ULONG id);
ULONG tx_timer_internal_timeout_param;
VOID (*tx_timer_internal_timeout_function_ptr)(VOID *id);
VOID *tx_timer_internal_timeout_param_ptr;


/* Define the next and previous internal link pointers for active
Expand Down Expand Up @@ -467,6 +469,8 @@ typedef struct TX_THREAD_STRUCT
/* Define the thread's entry point and input parameter. */
VOID (*tx_thread_entry)(ULONG id);
ULONG tx_thread_entry_parameter;
VOID (*tx_thread_entry_ptr)(VOID *id);
VOID *tx_thread_entry_parameter_ptr;

/* Define the thread's timer block. This is used for thread
sleep and timeout requests. */
Expand Down Expand Up @@ -1140,7 +1144,12 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
#define tx_semaphore_put _tx_semaphore_put
#define tx_semaphore_put_notify _tx_semaphore_put_notify

#define tx_thread_create_ptr _tx_thread_create_ptr
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_thread_create _tx_thread_create_ptr
#else
#define tx_thread_create _tx_thread_create
#endif
#define tx_thread_delete _tx_thread_delete
#define tx_thread_entry_exit_notify _tx_thread_entry_exit_notify
#define tx_thread_identify _tx_thread_identify
Expand All @@ -1163,7 +1172,12 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
#define tx_time_set _tx_time_set
#define tx_timer_activate _tx_timer_activate
#define tx_timer_change _tx_timer_change
#define tx_timer_create_ptr _tx_timer_create_ptr
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_timer_create _tx_timer_create_ptr
#else
#define tx_timer_create _tx_timer_create
#endif
#define tx_timer_deactivate _tx_timer_deactivate
#define tx_timer_delete _tx_timer_delete
#define tx_timer_info_get _tx_timer_info_get
Expand Down Expand Up @@ -1263,7 +1277,12 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
#define tx_semaphore_put _txr_semaphore_put
#define tx_semaphore_put_notify _txr_semaphore_put_notify

#define tx_thread_create_ptr(t,n,e,i,s,l,p,r,c,a) _txe_thread_create_ptr((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txe_thread_create_ptr((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#else
#define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txr_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#endif
#define tx_thread_delete _txr_thread_delete
#define tx_thread_entry_exit_notify _txr_thread_entry_exit_notify
#define tx_thread_identify _tx_thread_identify
Expand All @@ -1286,7 +1305,12 @@ UINT _tx_trace_interrupt_control(UINT new_posture);
#define tx_time_set _tx_time_set
#define tx_timer_activate _txr_timer_activate
#define tx_timer_change _txr_timer_change
#define tx_timer_create_ptr(t,n,e,i,c,r,a) _txe_timer_create_ptr((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_timer_create(t,n,e,i,c,r,a) _txe_timer_create_ptr((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#else
#define tx_timer_create(t,n,e,i,c,r,a) _txr_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#endif
#define tx_timer_deactivate _txr_timer_deactivate
#define tx_timer_delete _txr_timer_delete
#define tx_timer_info_get _txr_timer_info_get
Expand Down Expand Up @@ -1374,7 +1398,12 @@ UINT _tx_el_interrupt_control(UINT new_posture);
#define tx_semaphore_put _txe_semaphore_put
#define tx_semaphore_put_notify _txe_semaphore_put_notify

#define tx_thread_create_ptr(t,n,e,i,s,l,p,r,c,a) _txe_thread_create_ptr((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txe_thread_create_ptr((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#else
#define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txe_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD)))
#endif
#define tx_thread_delete _txe_thread_delete
#define tx_thread_entry_exit_notify _txe_thread_entry_exit_notify
#define tx_thread_identify _tx_thread_identify
Expand All @@ -1397,7 +1426,12 @@ UINT _tx_el_interrupt_control(UINT new_posture);
#define tx_time_set _tx_time_set
#define tx_timer_activate _txe_timer_activate
#define tx_timer_change _txe_timer_change
#define tx_timer_create_ptr(t,n,e,i,c,r,a) _txe_timer_create_ptr((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#ifdef TX_ENABLE_POINTER_CALLBACKS
#define tx_timer_create(t,n,e,i,c,r,a) _txe_timer_create_ptr((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#else
#define tx_timer_create(t,n,e,i,c,r,a) _txe_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER)))
#endif
#define tx_timer_deactivate _txe_timer_deactivate
#define tx_timer_delete _txe_timer_delete
#define tx_timer_info_get _txe_timer_info_get
Expand Down Expand Up @@ -1704,6 +1738,11 @@ UINT _tx_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_pt
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start);
UINT _tx_thread_create_ptr(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(VOID *entry_input), VOID *entry_input,
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start);
UINT _tx_thread_delete(TX_THREAD *thread_ptr);
UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
TX_THREAD *_tx_thread_identify(VOID);
Expand Down Expand Up @@ -1741,6 +1780,11 @@ UINT _txe_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_p
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
UINT _txe_thread_create_ptr(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(VOID *entry_input), VOID *entry_input,
VOID *stack_start, ULONG stack_size,
UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start, UINT thread_control_block_size);
UINT _txe_thread_delete(TX_THREAD *thread_ptr);
UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type));
UINT _txe_thread_info_get(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR **name, UINT *state, ULONG *run_count,
Expand Down Expand Up @@ -1788,6 +1832,9 @@ UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG res
UINT _tx_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(ULONG input), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate);
UINT _tx_timer_create_ptr(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(VOID *input), VOID *expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate);
UINT _tx_timer_deactivate(TX_TIMER *timer_ptr);
UINT _tx_timer_delete(TX_TIMER *timer_ptr);
UINT _tx_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
Expand All @@ -1809,6 +1856,9 @@ UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG re
UINT _txe_timer_create(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(ULONG input), ULONG expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
UINT _txe_timer_create_ptr(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*expiration_function)(VOID *input), VOID *expiration_input,
ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size);
UINT _txe_timer_deactivate(TX_TIMER *timer_ptr);
UINT _txe_timer_delete(TX_TIMER *timer_ptr);
UINT _txe_timer_info_get(TX_TIMER *timer_ptr, TX_NAME_CONST CHAR **name, UINT *active, ULONG *remaining_ticks,
Expand Down
112 changes: 106 additions & 6 deletions common/src/tx_thread_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,18 @@
/* Application Code */
/* _tx_timer_initialize Create system timer thread */
/* */
static UINT _tx_thread_create_initial(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG id), ULONG entry_input,
VOID (*entry_function_ptr)(VOID *id), VOID *entry_input_ptr,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start);

/**************************************************************************/
UINT _tx_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr, VOID (*entry_function)(ULONG id), ULONG entry_input,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start)
static UINT _tx_thread_create_initial(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG id), ULONG entry_input,
VOID (*entry_function_ptr)(VOID *id), VOID *entry_input_ptr,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start)
{

TX_INTERRUPT_SAVE_AREA
Expand Down Expand Up @@ -164,9 +172,11 @@ ULONG stack_fill_value;
#endif

/* Place the supplied parameters into the thread's control block. */
thread_ptr -> tx_thread_name = name_ptr;
thread_ptr -> tx_thread_entry = entry_function;
thread_ptr -> tx_thread_entry_parameter = entry_input;
thread_ptr -> tx_thread_name = name_ptr;
thread_ptr -> tx_thread_entry = entry_function;
thread_ptr -> tx_thread_entry_parameter = entry_input;
thread_ptr -> tx_thread_entry_ptr = entry_function_ptr;
thread_ptr -> tx_thread_entry_parameter_ptr = entry_input_ptr;
thread_ptr -> tx_thread_stack_start = stack_start;
thread_ptr -> tx_thread_stack_size = stack_size;
thread_ptr -> tx_thread_priority = priority;
Expand Down Expand Up @@ -384,3 +394,93 @@ ULONG stack_fill_value;
return(TX_SUCCESS);
}


/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_create PORTABLE C */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a thread with ULONG input parameter. */
/* */
/* INPUT */
/* */
/* thread_ptr Thread control block pointer */
/* name Pointer to thread name string */
/* entry_function Entry function of the thread */
/* entry_input 32-bit input value to thread */
/* stack_start Pointer to start of stack */
/* stack_size Stack size in bytes */
/* priority Priority of thread */
/* preempt_threshold Preemption threshold */
/* time_slice Thread time-slice value */
/* auto_start Automatic start selection */
/* */
/* OUTPUT */
/* */
/* return status Thread create return status */
/* */
/**************************************************************************/
UINT _tx_thread_create(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(ULONG id), ULONG entry_input,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start)
{
return(_tx_thread_create_initial(thread_ptr, name_ptr,
entry_function, entry_input,
TX_NULL, TX_NULL,
stack_start, stack_size, priority, preempt_threshold,
time_slice, auto_start));
}


/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _tx_thread_create_ptr PORTABLE C */
/* 6.3.0 */
/* AUTHOR */
/* */
/* William E. Lamie, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function creates a thread with pointer context input. */
/* */
/* INPUT */
/* */
/* thread_ptr Thread control block pointer */
/* name Pointer to thread name string */
/* entry_function Entry function of the thread */
/* entry_input Pointer input value to thread */
/* stack_start Pointer to start of stack */
/* stack_size Stack size in bytes */
/* priority Priority of thread */
/* preempt_threshold Preemption threshold */
/* time_slice Thread time-slice value */
/* auto_start Automatic start selection */
/* */
/* OUTPUT */
/* */
/* return status Thread create return status */
/* */
/**************************************************************************/
UINT _tx_thread_create_ptr(TX_THREAD *thread_ptr, TX_NAME_CONST CHAR *name_ptr,
VOID (*entry_function)(VOID *id), VOID *entry_input,
VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold,
ULONG time_slice, UINT auto_start)
{
return(_tx_thread_create_initial(thread_ptr, name_ptr,
TX_NULL, 0,
entry_function, entry_input,
stack_start, stack_size, priority, preempt_threshold,
time_slice, auto_start));
}

11 changes: 10 additions & 1 deletion common/src/tx_thread_shell_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ VOID (*entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type);
#endif

/* Call current thread's entry function. */
(thread_ptr -> tx_thread_entry) (thread_ptr -> tx_thread_entry_parameter);
if (thread_ptr -> tx_thread_entry_ptr != TX_NULL)
{

(thread_ptr -> tx_thread_entry_ptr)(thread_ptr -> tx_thread_entry_parameter_ptr);
}
else
{

(thread_ptr -> tx_thread_entry)(thread_ptr -> tx_thread_entry_parameter);
}

/* Suspend thread with a "completed" state. */

Expand Down
Loading