|
7 | 7 | * Date Author Notes |
8 | 8 | * 2022-12-14 WangXiaoyao the first version |
9 | 9 | * 2023-03-20 WangXiaoyao Format & add more testcases for API under mm_aspace.h |
| 10 | + * 2025-12-14 ChuanN-sudo Add standardized utest documentation block |
| 11 | + */ |
| 12 | + |
| 13 | +/** |
| 14 | + * Test Case Name: MM API Test |
| 15 | + * |
| 16 | + * Test Objectives: |
| 17 | + * - Verify I/O remapping functionality with cached memory access. |
| 18 | + * - Test memory mapping flag creation and extraction mechanisms. |
| 19 | + * - Validate address space management operations. |
| 20 | + * - Test core APIs: rt_pages_alloc(), rt_ioremap_cached(), rt_iounmap(), rt_pages_free(), |
| 21 | + * rt_pages_free(), MMF_CREATE(), MMF_GET_CNTL(), MMF_GET_ALIGN(). |
| 22 | + * |
| 23 | + * Test Scenarios: |
| 24 | + * - Address Space Test (aspace_tc): Tests memory address space management APIs. |
| 25 | + * - I/O Remap Test (ioremap_tc): Allocates physical pages, maps to virtual address with cache, verifies data consistency, and cleans up resources. |
| 26 | + * - Flag Test (flag_tc): Creates memory mapping flags with different parameters and validates control bits and alignment values extraction. |
| 27 | + * |
| 28 | + * Verification Metrics: |
| 29 | + * - I/O remapping should correctly map physical to virtual addresses. |
| 30 | + * - Cached memory access should maintain data consistency between physical and virtual addresses. |
| 31 | + * - Memory mapping flags should correctly encode and decode control bits and alignment values. |
| 32 | + * - Flag creation with alignment should set MMF_REQUEST_ALIGN bit and store alignment value. |
| 33 | + * - Flag creation without alignment should not set alignment-related bits. |
| 34 | + * |
| 35 | + Dependencies: |
| 36 | + * - Hardware requirements: QEMU emulator or any hardware platform that supports RT-Thread with MMU. |
| 37 | + * - Software configuration: |
| 38 | + * - RT_UTEST_MM_API must be enabled (enable via: RT-Thread Utestcases -> RT-Thread Utestcases -> Memory Management Subsystem Testcase -> Enable Utest for MM API). |
| 39 | + * - RT_USING_SMART must be enabled (enable via: Enable RT-Thread Kernel -> RT-Thread Smart (microkernel on kernel/userland)). |
| 40 | + * - Environmental Assumptions: MMU support must be available on the target platform. |
| 41 | +
|
| 42 | + * Expected Results: |
| 43 | + * - Final output: "[ PASSED ] [ result ] testcase (testcases.mm.api_tc)" |
| 44 | + * - No assertion failures during test execution. |
10 | 45 | */ |
11 | 46 | #include "common.h" |
12 | 47 |
|
|
0 commit comments