diff options
Diffstat (limited to 'test/smp/regression/threadx_block_memory_basic_test.c')
| -rw-r--r-- | test/smp/regression/threadx_block_memory_basic_test.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/test/smp/regression/threadx_block_memory_basic_test.c b/test/smp/regression/threadx_block_memory_basic_test.c index 12e301d1..28edee3f 100644 --- a/test/smp/regression/threadx_block_memory_basic_test.c +++ b/test/smp/regression/threadx_block_memory_basic_test.c @@ -1,8 +1,20 @@ +/***************************************************************************/ +/* Copyright (c) 2024 Microsoft Corporation */ +/* Copyright (c) 2026 Eclipse ThreadX contributors */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the MIT License which is available at */ +/* https://opensource.org/licenses/MIT. */ +/* */ +/* SPDX-License-Identifier: MIT */ +/***************************************************************************/ + /* This test is designed to test simple memory block pool creation, deletion, and allocates and releases. */ #include <stdio.h> #include "tx_api.h" +#include "threadx_test_port.h" typedef struct BLOCK_MEMORY_TEST_STRUCT { @@ -86,7 +98,7 @@ CHAR *pointer; /* Attempt to create a block pool from a timer. */ pointer = (CHAR *) 0x30000; - status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -146,7 +158,7 @@ UINT status; } /* Attempt to create a block pool from an ISR. */ - status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, 320); + status = tx_block_pool_create(&pool_3, "pool 3", 100, (void *) 0x100000, TX_TEST_BLOCK_POOL_BYTES(100, 3)); /* Check status. */ if (status != TX_CALLER_ERROR) @@ -217,8 +229,8 @@ CHAR *pointer; } /* Create block pools 0 and 1. */ - status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_0, "pool 0", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -228,8 +240,8 @@ CHAR *pointer; test_control_return(1); } - status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, 320); - pointer = pointer + 320; + status = tx_block_pool_create(&pool_1, "pool 1", 100, pointer, TX_TEST_BLOCK_POOL_BYTES(100, 3)); + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SUCCESS) @@ -241,7 +253,7 @@ CHAR *pointer; /* Check the no-blocks path. */ status = _tx_block_pool_create(&pool_2, "pool 2", 100, pointer, 50); - pointer = pointer + 320; + pointer = pointer + TX_TEST_BLOCK_POOL_BYTES(100, 3); /* Check status. */ if (status != TX_SIZE_ERROR) @@ -265,7 +277,7 @@ CHAR *pointer_2; CHAR *pointer_3; CHAR *pointer_4; INT i; -unsigned long fake_block[20]; +TX_TEST_POINTER_WORD fake_block[20]; /* Inform user. */ @@ -316,7 +328,7 @@ unsigned long fake_block[20]; /* Try to release a block that points to a non-pool. */ fake_block[0] = 0; - fake_block[1] = (unsigned long) &fake_block[0]; + TX_TEST_STORE_POINTER(fake_block[1], &fake_block[0]); status = tx_block_release(&fake_block[2]); /* Check status. */ @@ -519,7 +531,7 @@ unsigned long fake_block[20]; { /* Block memory error. */ - printf("ERROR #20\n"); + printf("ERROR #20 (%lu %lu %lu)\n", error, timer_executed, isr_executed); test_control_return(1); } |
