Lines Matching full:dmic
8 * Based on DMIC driver sample, which is:
13 #include <zephyr/audio/dmic.h>
30 #error "Unsupported DMIC device"
62 /* Verify that dmic_trigger fails when DMIC is not configured
63 * this test must run first, before DMIC has been configured
65 ZTEST(dmic, test_0_start_fail) in ZTEST() argument
69 zassert_true(device_is_ready(dmic_dev), "DMIC device is not ready"); in ZTEST()
71 zassert_not_equal(ret, 0, "DMIC trigger should fail when DMIC is not configured"); in ZTEST()
74 static int do_pdm_transfer(const struct device *dmic, in do_pdm_transfer() argument
84 ret = dmic_configure(dmic, cfg); in do_pdm_transfer()
86 TC_PRINT("DMIC configuration failed: %d\n", ret); in do_pdm_transfer()
93 "DMIC configure should populate act_num_chan field"); in do_pdm_transfer()
96 "DMIC configure should populate act_chan_map_lo field"); in do_pdm_transfer()
99 "DMIC configure should populate act_chan_map_hi field"); in do_pdm_transfer()
100 ret = dmic_trigger(dmic, DMIC_TRIGGER_START); in do_pdm_transfer()
102 TC_PRINT("DMIC start trigger failed: %d\n", ret); in do_pdm_transfer()
106 /* We read more than the total BLOCK_COUNT to insure the DMIC in do_pdm_transfer()
111 ret = dmic_read(dmic, 0, &buffer, &size, READ_TIMEOUT); in do_pdm_transfer()
113 TC_PRINT("DMIC read failed: %d\n", ret); in do_pdm_transfer()
121 ret = dmic_trigger(dmic, DMIC_TRIGGER_STOP); in do_pdm_transfer()
123 TC_PRINT("DMIC stop trigger failed: %d\n", ret); in do_pdm_transfer()
130 /* Verify that the DMIC can transfer from a single channel */
131 ZTEST(dmic, test_single_channel) in ZTEST() argument
144 /* Verify that the DMIC can transfer from a L/R channel pair */
145 ZTEST(dmic, test_stereo_channel) in ZTEST() argument
164 /* Test DMIC with maximum number of channels */
165 ZTEST(dmic, test_max_channel) in ZTEST() argument
194 ZTEST(dmic, test_pause_restart) in ZTEST() argument
208 zassert_equal(ret, 0, "DMIC configure failed"); in ZTEST()
210 /* Start the DMIC, and pause it immediately */ in ZTEST()
212 zassert_equal(ret, 0, "DMIC start failed"); in ZTEST()
214 zassert_equal(ret, 0, "DMIC pause failed"); in ZTEST()
215 /* There may be some buffers in the DMIC queue, but a read in ZTEST()
225 zassert_not_equal(ret, 0, "DMIC is paused, reads should timeout"); in ZTEST()
227 /* Unpause the DMIC */ in ZTEST()
229 zassert_equal(ret, 0, "DMIC release failed"); in ZTEST()
238 zassert_equal(ret, 0, "DMIC is active, reads should succeed"); in ZTEST()
240 /* Stop the DMIC, and repeat the same tests */ in ZTEST()
242 zassert_equal(ret, 0, "DMIC stop failed"); in ZTEST()
243 /* Versus a pause, DMIC reads should immediately stop once DMIC times in ZTEST()
247 zassert_not_equal(ret, 0, "DMIC read should timeout when DMIC is stopped"); in ZTEST()
249 zassert_equal(ret, 0, "DMIC restart failed"); in ZTEST()
258 zassert_equal(ret, 0, "DMIC is active, reads should succeed"); in ZTEST()
260 /* Test is over. Stop the DMIC */ in ZTEST()
262 zassert_equal(ret, 0, "DMIC stop failed"); in ZTEST()
266 ZTEST(dmic, test_bad_pair) in ZTEST() argument
279 zassert_not_equal(ret, 0, "DMIC configure should fail with " in ZTEST()
287 zassert_not_equal(ret, 0, "DMIC configure should fail with " in ZTEST()
291 ZTEST_SUITE(dmic, NULL, NULL, NULL, NULL, NULL);