Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make queue max message size configurable #447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions common/inc/tx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ extern "C" {
#define TX_TIMER_TICKS_PER_SECOND (100UL)
#endif

/* Define the default maximum message size in a queue. The default value is TX_16_ULONG, but may
be customized in tx_user.h or as a compilation option. */

#ifndef TX_QUEUE_MESSAGE_MAX_SIZE
#define TX_QUEUE_MESSAGE_MAX_SIZE TX_16_ULONG
#endif

/* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are:

Expand Down
7 changes: 7 additions & 0 deletions common/inc/tx_user_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@
#define TX_TIMER_THREAD_PRIORITY ????
*/

/* Define the maximum size of a message in the a queue. the Default value is TX_ULONG_16.
the new value must be a multiple of ULONG. */

/*
#define TX_QUEUE_MESSAGE_MAX_SIZE TX_ULONG_16
*/

/* Define the common timer tick reference for use by other middleware components. The default
value is 10ms (i.e. 100 ticks, defined in tx_api.h), but may be replaced by a port-specific
version in tx_port.h or here.
Expand Down
4 changes: 2 additions & 2 deletions common/src/txe_queue_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ TX_THREAD *thread_ptr;
status = TX_SIZE_ERROR;
}

/* Check for an invalid message size - greater than 16. */
else if (message_size > TX_16_ULONG)
/* Check for an invalid message size - greater than TX_QUEUE_MESSAGE_MAX_SIZE 16 by default. */
else if (message_size > TX_QUEUE_MESSAGE_MAX_SIZE)
{

/* Invalid message size specified. */
Expand Down
1 change: 1 addition & 0 deletions test/smp/cmake/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(regression_test_cases
${SOURCE_DIR}/threadx_queue_basic_one_word_test.c
${SOURCE_DIR}/threadx_queue_basic_sixteen_word_test.c
${SOURCE_DIR}/threadx_queue_basic_two_word_test.c
${SOURCE_DIR}/threadx_queue_basic_max_message_size_test.c
${SOURCE_DIR}/threadx_queue_empty_suspension_test.c
${SOURCE_DIR}/threadx_queue_flush_no_suspension_test.c
${SOURCE_DIR}/threadx_queue_flush_test.c
Expand Down
1 change: 1 addition & 0 deletions test/smp/regression/testcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ void threadx_queue_basic_two_word_application_define(void *);
void threadx_queue_basic_four_word_application_define(void *);
void threadx_queue_basic_eight_word_application_define(void *);
void threadx_queue_basic_sixteen_word_application_define(void *);
void threadx_queue_basic_max_message_size_application_define(void *);
void threadx_queue_empty_suspension_application_define(void *);
void threadx_queue_full_suspension_application_define(void *);
void threadx_queue_suspension_timeout_application_define(void *);
Expand Down
10 changes: 5 additions & 5 deletions test/tx/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ endif()

message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.")
set(default_build_coverage "")
set(disable_notify_callbacks_build -DTX_DISABLE_NOTIFY_CALLBACKS)
set(stack_checking_build -DTX_ENABLE_STACK_CHECKING)
set(stack_checking_rand_fill_build -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING)
set(trace_build -DTX_ENABLE_EVENT_TRACE)
set(default_build_coverage -DTX_QUEUE_MESSAGE_MAX_SIZE=32)
set(disable_notify_callbacks_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_DISABLE_NOTIFY_CALLBACKS)
set(stack_checking_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING)
set(stack_checking_rand_fill_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_STACK_CHECKING -DTX_ENABLE_RANDOM_NUMBER_STACK_FILLING)
set(trace_build -DTX_QUEUE_MESSAGE_MAX_SIZE=32 -DTX_ENABLE_EVENT_TRACE)

add_compile_options(
-m32
Expand Down
1 change: 1 addition & 0 deletions test/tx/cmake/regression/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ set(regression_test_cases
${SOURCE_DIR}/threadx_queue_basic_one_word_test.c
${SOURCE_DIR}/threadx_queue_basic_sixteen_word_test.c
${SOURCE_DIR}/threadx_queue_basic_two_word_test.c
${SOURCE_DIR}/threadx_queue_basic_max_message_size_test.c
${SOURCE_DIR}/threadx_queue_empty_suspension_test.c
${SOURCE_DIR}/threadx_queue_flush_no_suspension_test.c
${SOURCE_DIR}/threadx_queue_flush_test.c
Expand Down
3 changes: 3 additions & 0 deletions test/tx/regression/testcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ void threadx_queue_basic_two_word_application_define(void *);
void threadx_queue_basic_four_word_application_define(void *);
void threadx_queue_basic_eight_word_application_define(void *);
void threadx_queue_basic_sixteen_word_application_define(void *);
void threadx_queue_basic_max_message_size_application_define(void *);
void threadx_queue_empty_suspension_application_define(void *);
void threadx_queue_full_suspension_application_define(void *);
void threadx_queue_suspension_timeout_application_define(void *);
Expand Down Expand Up @@ -287,6 +288,7 @@ TEST_ENTRY test_control_tests[] =
threadx_queue_basic_four_word_application_define,
threadx_queue_basic_eight_word_application_define,
threadx_queue_basic_sixteen_word_application_define,
threadx_queue_basic_max_message_size_application_define,
threadx_queue_empty_suspension_application_define,
threadx_queue_full_suspension_application_define,
threadx_queue_suspension_timeout_application_define,
Expand Down Expand Up @@ -1193,6 +1195,7 @@ void test_control_return(UINT status)

UINT old_posture = TX_INT_ENABLE;

printf("********** Running Queue Max Message Size Test (%u) ************** \n ", TX_QUEUE_MESSAGE_MAX_SIZE);

/* Save the status in a global. */
test_control_return_status = status;
Expand Down
Loading
Loading