@@ -8,14 +8,11 @@ uint8_t create_queue(TX_BYTE_POOL *byte_pool, queue_t *queue)
88 uint8_t status ;
99 void * pointer ;
1010
11- /* Calculate message size in 32-bit words (round up), and then validate it . */
12- /* According to the Azure RTOS ThreadX Docs, " message sizes range from 1 32-bit word to 16 32-bit words" . */
11+ /* Calculate message size in 32-bit words (round up). */
12+ /* According to the Azure RTOS ThreadX Docs, message sizes have to be given in 32-bit words. */
1313 /* Basically, queue messages have to be a multiple of 4 bytes? Kinda weird but this should handle it. */
1414 UINT message_size_words = (queue -> message_size + 3 ) / 4 ;
15- if (message_size_words < 1 || message_size_words > 16 ) {
16- PRINTLN_ERROR ("Invalid message size %d bytes (must be 1-64 bytes). Queue: %s" , queue -> message_size , queue -> name );
17- return U_ERROR ;
18- }
15+ // Not going to validate the size of message_size_words, because if it's invalid, ThreadX should return a TX_SIZE_ERROR.
1916
2017 /* Store metadata */
2118 queue -> _bytes = queue -> message_size ;
@@ -27,14 +24,14 @@ uint8_t create_queue(TX_BYTE_POOL *byte_pool, queue_t *queue)
2724 /* Allocate the stack for the queue. */
2825 status = tx_byte_allocate (byte_pool , (VOID * * )& pointer , queue_size_bytes , TX_NO_WAIT );
2926 if (status != TX_SUCCESS ) {
30- PRINTLN_ERROR ("Failed to allocate memory before creating queue (Status: %d/%s, Queue: %s)." , status , tx_status_toString (status ), queue -> name );
27+ PRINTLN_ERROR ("Failed to allocate memory before creating queue (Status: %d/%s, Queue: %s, queue_size_bytes: %d )." , status , tx_status_toString (status ), queue -> name , queue_size_bytes );
3128 return U_ERROR ;
3229 }
3330
3431 /* Create the queue */
3532 status = tx_queue_create (& queue -> _TX_QUEUE , (CHAR * )queue -> name , message_size_words , pointer , queue_size_bytes );
3633 if (status != TX_SUCCESS ) {
37- PRINTLN_ERROR ("Failed to create queue (Status: %d/%s, Queue: %s)." , status , tx_status_toString (status ), queue -> name );
34+ PRINTLN_ERROR ("Failed to create queue (Status: %d/%s, Queue: %s, message_size_words: %d, queue_size_bytes: %d )." , status , tx_status_toString (status ), queue -> name , message_size_words , queue_size_bytes );
3835 tx_byte_release (pointer ); // Free allocated memory if queue creation fails
3936 return U_ERROR ;
4037 }
0 commit comments