@@ -74,15 +74,17 @@ static bool dmm_buffer_in_region_check(struct dmm_test_region *dtr, void *buf, s
74
74
}
75
75
76
76
static void dmm_check_output_buffer (struct dmm_test_region * dtr , uint32_t * fill_value ,
77
- void * data , size_t size , bool was_prealloc )
77
+ void * data , size_t size , bool was_prealloc , bool is_cached )
78
78
{
79
79
void * buf ;
80
80
int retval ;
81
81
82
82
memset (data , (* fill_value )++ , size );
83
83
retval = dmm_buffer_out_prepare (dtr -> mem_reg , data , size , & buf );
84
84
zassert_ok (retval );
85
- zassert_true (IS_ALIGNED (buf , DMM_DCACHE_LINE_SIZE ));
85
+ if (IS_ENABLED (CONFIG_DCACHE ) && is_cached ) {
86
+ zassert_true (IS_ALIGNED (buf , CONFIG_DCACHE_LINE_SIZE ));
87
+ }
86
88
87
89
if (IS_ENABLED (CONFIG_HAS_NORDIC_DMM )) {
88
90
if (was_prealloc ) {
@@ -112,7 +114,9 @@ static void dmm_check_input_buffer(struct dmm_test_region *dtr, uint32_t *fill_v
112
114
113
115
retval = dmm_buffer_in_prepare (dtr -> mem_reg , data , size , & buf );
114
116
zassert_ok (retval );
115
- zassert_true (IS_ALIGNED (buf , DMM_DCACHE_LINE_SIZE ));
117
+ if (IS_ENABLED (CONFIG_DCACHE ) && is_cached ) {
118
+ zassert_true (IS_ALIGNED (buf , CONFIG_DCACHE_LINE_SIZE ));
119
+ }
116
120
117
121
if (IS_ENABLED (CONFIG_HAS_NORDIC_DMM )) {
118
122
if (was_prealloc ) {
@@ -162,15 +166,15 @@ ZTEST_USER_F(dmm, test_check_dev_cache_out_allocate)
162
166
uint8_t user_data [16 ];
163
167
164
168
dmm_check_output_buffer (& fixture -> regions [DMM_TEST_REGION_CACHE ], & fixture -> fill_value ,
165
- user_data , sizeof (user_data ), false);
169
+ user_data , sizeof (user_data ), false, true );
166
170
}
167
171
168
172
ZTEST_USER_F (dmm , test_check_dev_cache_out_preallocate )
169
173
{
170
174
static uint8_t user_data [16 ] DMM_MEMORY_SECTION (DUT_CACHE );
171
175
172
176
dmm_check_output_buffer (& fixture -> regions [DMM_TEST_REGION_CACHE ], & fixture -> fill_value ,
173
- user_data , sizeof (user_data ), true);
177
+ user_data , sizeof (user_data ), true, true );
174
178
}
175
179
176
180
ZTEST_USER_F (dmm , test_check_dev_nocache_in_allocate )
@@ -194,15 +198,15 @@ ZTEST_USER_F(dmm, test_check_dev_nocache_out_allocate)
194
198
uint8_t user_data [16 ];
195
199
196
200
dmm_check_output_buffer (& fixture -> regions [DMM_TEST_REGION_NOCACHE ], & fixture -> fill_value ,
197
- user_data , sizeof (user_data ), false);
201
+ user_data , sizeof (user_data ), false, false );
198
202
}
199
203
200
204
ZTEST_USER_F (dmm , test_check_dev_nocache_out_preallocate )
201
205
{
202
206
static uint8_t user_data [16 ] DMM_MEMORY_SECTION (DUT_NOCACHE );
203
207
204
208
dmm_check_output_buffer (& fixture -> regions [DMM_TEST_REGION_NOCACHE ], & fixture -> fill_value ,
205
- user_data , sizeof (user_data ), true);
209
+ user_data , sizeof (user_data ), true, false );
206
210
}
207
211
208
212
ZTEST_SUITE (dmm , NULL , test_setup , NULL , test_cleanup , NULL );
0 commit comments