Lines Matching refs:test_data
162 struct test_async_rx *test_data = (struct test_async_rx *)user_data; in producer_no_chunks() local
163 struct uart_async_rx *async_rx = &test_data->async_rx; in producer_no_chunks()
167 if (test_data->curr_buf) { in producer_no_chunks()
170 test_data->curr_buf[i] = (uint8_t)test_data->byte_cnt; in producer_no_chunks()
171 test_data->byte_cnt++; in producer_no_chunks()
173 uart_async_rx_on_rdy(async_rx, test_data->curr_buf, len); in producer_no_chunks()
174 uart_async_rx_on_buf_rel(async_rx, test_data->curr_buf); in producer_no_chunks()
175 test_data->curr_buf = test_data->next_buf; in producer_no_chunks()
176 test_data->next_buf = NULL; in producer_no_chunks()
181 if (test_data->curr_buf == NULL) { in producer_no_chunks()
182 test_data->curr_buf = buf; in producer_no_chunks()
184 test_data->next_buf = buf; in producer_no_chunks()
187 atomic_inc(&test_data->pending_req); in producer_no_chunks()
188 atomic_inc(&test_data->total_pending_req); in producer_no_chunks()
197 struct test_async_rx *test_data = (struct test_async_rx *)user_data; in consumer() local
198 struct uart_async_rx *async_rx = &test_data->async_rx; in consumer()
217 zassert_equal(buf[j], test_data->exp_consume, in consumer()
219 buf[j], test_data->exp_consume, len, test_data->byte_cnt); in consumer()
220 test_data->exp_consume++; in consumer()
225 if (buf_released && test_data->pending_req) { in consumer()
229 atomic_dec(&test_data->pending_req); in consumer()
230 k_spinlock_key_t key = k_spin_lock(&test_data->lock); in consumer()
232 if (test_data->curr_buf == NULL) { in consumer()
233 test_data->curr_buf = buf; in consumer()
234 } else if (test_data->next_buf == NULL) { in consumer()
235 test_data->next_buf = buf; in consumer()
239 k_spin_unlock(&test_data->lock, key); in consumer()
248 struct test_async_rx *test_data = (struct test_async_rx *)user_data; in producer_in_chunks() local
249 struct uart_async_rx *async_rx = &test_data->async_rx; in producer_in_chunks()
251 uint32_t rem = uart_async_rx_get_buf_len(async_rx) - test_data->curr_len; in producer_in_chunks()
256 if (test_data->curr_buf) { in producer_in_chunks()
258 test_data->curr_buf[test_data->curr_len + i] = (uint8_t)test_data->byte_cnt; in producer_in_chunks()
259 test_data->byte_cnt++; in producer_in_chunks()
261 uart_async_rx_on_rdy(async_rx, test_data->curr_buf, len); in producer_in_chunks()
262 test_data->curr_len += len; in producer_in_chunks()
264 if ((test_data->curr_len == uart_async_rx_get_buf_len(async_rx)) || (r & BIT(31))) { in producer_in_chunks()
265 test_data->curr_len = 0; in producer_in_chunks()
266 uart_async_rx_on_buf_rel(async_rx, test_data->curr_buf); in producer_in_chunks()
268 test_data->curr_buf = test_data->next_buf; in producer_in_chunks()
269 test_data->next_buf = NULL; in producer_in_chunks()
274 if (test_data->curr_buf == NULL) { in producer_in_chunks()
275 test_data->curr_buf = buf; in producer_in_chunks()
277 test_data->next_buf = buf; in producer_in_chunks()
280 atomic_inc(&test_data->pending_req); in producer_in_chunks()
295 struct test_async_rx test_data; in stress_test() local
302 memset(&test_data, 0, sizeof(test_data)); in stress_test()
304 err = uart_async_rx_init(&test_data.async_rx, &config); in stress_test()
307 test_data.in_chunks = in_chunks; in stress_test()
308 test_data.curr_buf = uart_async_rx_buf_req(&test_data.async_rx); in stress_test()
313 &test_data, 0, 0, Z_TIMEOUT_TICKS(20)), in stress_test()
314 ZTRESS_THREAD(consumer, &test_data, 0, preempt, Z_TIMEOUT_TICKS(20))); in stress_test()
316 TC_PRINT("total bytes: %d\n", test_data.byte_cnt); in stress_test()