Lines Matching refs:dev
15 static void polling_verify(const struct device *dev, bool is_async, bool active) in polling_verify() argument
26 uart_poll_out(dev, outs[i]); in polling_verify()
32 err = uart_poll_in(dev, &c); in polling_verify()
36 uart_poll_out(dev, outs[i]); in polling_verify()
43 err = uart_poll_in(dev, &c); in polling_verify()
48 err = uart_poll_in(dev, &c); in polling_verify()
53 static void async_callback(const struct device *dev, struct uart_event *evt, void *ctx) in async_callback() argument
66 static bool async_verify(const struct device *dev, bool active) in async_verify() argument
73 err = uart_callback_set(dev, async_callback, (void *)&tx_done); in async_verify()
91 err = uart_rx_enable(dev, rxbuf, sizeof(rxbuf), 1 * USEC_PER_MSEC); in async_verify()
95 err = uart_tx(dev, txbuf, sizeof(txbuf), 10 * USEC_PER_MSEC); in async_verify()
101 err = uart_rx_disable(dev); in async_verify()
115 static void communication_verify(const struct device *dev, bool active) in communication_verify() argument
117 bool is_async = async_verify(dev, active); in communication_verify()
119 polling_verify(dev, is_async, active); in communication_verify()
122 #define state_verify(dev, exp_state) do {\ argument
124 int error = pm_device_state_get(dev, &power_state); \
129 static void action_run(const struct device *dev, enum pm_device_action action, in action_run() argument
135 err = pm_device_state_get(dev, &prev_state); in action_run()
138 err = pm_device_action_run(dev, action); in action_run()
157 state_verify(dev, exp_state); in action_run()
162 const struct device *dev; in ZTEST() local
164 dev = DEVICE_DT_GET(UART_NODE); in ZTEST()
165 zassert_true(device_is_ready(dev), "uart device is not ready"); in ZTEST()
167 state_verify(dev, PM_DEVICE_STATE_ACTIVE); in ZTEST()
168 communication_verify(dev, true); in ZTEST()
170 action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); in ZTEST()
171 communication_verify(dev, false); in ZTEST()
173 action_run(dev, PM_DEVICE_ACTION_RESUME, 0); in ZTEST()
174 communication_verify(dev, true); in ZTEST()
176 action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); in ZTEST()
177 communication_verify(dev, false); in ZTEST()
179 action_run(dev, PM_DEVICE_ACTION_RESUME, 0); in ZTEST()
180 communication_verify(dev, true); in ZTEST()
188 const struct device *dev; in ZTEST() local
190 dev = DEVICE_DT_GET(UART_NODE); in ZTEST()
191 zassert_true(device_is_ready(dev), "uart device is not ready"); in ZTEST()
193 communication_verify(dev, true); in ZTEST()
195 uart_poll_out(dev, 'a'); in ZTEST()
196 action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); in ZTEST()
198 communication_verify(dev, false); in ZTEST()
200 action_run(dev, PM_DEVICE_ACTION_RESUME, 0); in ZTEST()
202 communication_verify(dev, true); in ZTEST()
205 uart_poll_out(dev, 'a'); in ZTEST()
206 action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); in ZTEST()
208 communication_verify(dev, false); in ZTEST()
210 action_run(dev, PM_DEVICE_ACTION_RESUME, 0); in ZTEST()
212 communication_verify(dev, true); in ZTEST()
217 const struct device *dev = DEVICE_DT_GET(UART_NODE); in work_handler() local
219 action_run(dev, PM_DEVICE_ACTION_SUSPEND, 0); in work_handler()
229 const struct device *dev; in ZTEST() local
232 dev = DEVICE_DT_GET(UART_NODE); in ZTEST()
233 zassert_true(device_is_ready(dev), "uart device is not ready"); in ZTEST()
241 uart_poll_out(dev, str[j]); in ZTEST()
246 action_run(dev, PM_DEVICE_ACTION_RESUME, 0); in ZTEST()
248 communication_verify(dev, true); in ZTEST()