Lines Matching full:wd
56 static int watchdog_index(const Watchdog *wd) in watchdog_index() argument
58 ptrdiff_t diff = wd - watchdog_list; in watchdog_index()
65 static uint32_t watchdog_read_wtcr(QTestState *qts, const Watchdog *wd) in watchdog_read_wtcr() argument
67 return qtest_readl(qts, wd->base_addr + WTCR_OFFSET); in watchdog_read_wtcr()
70 static void watchdog_write_wtcr(QTestState *qts, const Watchdog *wd, in watchdog_write_wtcr() argument
73 qtest_writel(qts, wd->base_addr + WTCR_OFFSET, value); in watchdog_write_wtcr()
76 static uint32_t watchdog_prescaler(QTestState *qts, const Watchdog *wd) in watchdog_prescaler() argument
78 switch (extract32(watchdog_read_wtcr(qts, wd), 10, 2)) { in watchdog_prescaler()
104 static uint32_t watchdog_interrupt_cycles(QTestState *qts, const Watchdog *wd) in watchdog_interrupt_cycles() argument
106 uint32_t wtis = extract32(watchdog_read_wtcr(qts, wd), 4, 2); in watchdog_interrupt_cycles()
115 static int64_t watchdog_interrupt_steps(QTestState *qts, const Watchdog *wd) in watchdog_interrupt_steps() argument
117 return watchdog_calculate_steps(watchdog_interrupt_cycles(qts, wd), in watchdog_interrupt_steps()
118 watchdog_prescaler(qts, wd)); in watchdog_interrupt_steps()
124 const Watchdog *wd = watchdog; in test_init() local
129 watchdog_write_wtcr(qts, wd, WTCLK(1) | WTRF | WTIF | WTR); in test_init()
130 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(1)); in test_init()
138 const Watchdog *wd = watchdog; in test_reset_action() local
144 watchdog_write_wtcr(qts, wd, in test_reset_action()
146 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, in test_reset_action()
150 qtest_clock_step(qts, watchdog_interrupt_steps(qts, wd)); in test_reset_action()
151 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, in test_reset_action()
153 g_assert_true(qtest_get_irq(qts, wd->irq)); in test_reset_action()
157 watchdog_prescaler(qts, wd))); in test_reset_action()
167 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(1) | WTRF); in test_reset_action()
174 const Watchdog *wd = watchdog; in test_prescaler() local
182 watchdog_write_wtcr(qts, wd, in test_prescaler()
188 qtest_clock_step(qts, watchdog_interrupt_steps(qts, wd) - 1); in test_prescaler()
189 g_assert_false(watchdog_read_wtcr(qts, wd) & WTIF); in test_prescaler()
190 g_assert_false(qtest_get_irq(qts, wd->irq)); in test_prescaler()
192 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_prescaler()
193 g_assert_true(qtest_get_irq(qts, wd->irq)); in test_prescaler()
206 const Watchdog *wd = watchdog; in test_enabling_flags() local
213 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTE | WTIF | WTRF | WTR); in test_enabling_flags()
214 qtest_clock_step(qts, watchdog_interrupt_steps(qts, wd)); in test_enabling_flags()
215 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_enabling_flags()
216 g_assert_false(qtest_get_irq(qts, wd->irq)); in test_enabling_flags()
218 watchdog_prescaler(qts, wd))); in test_enabling_flags()
219 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_enabling_flags()
220 g_assert_false(watchdog_read_wtcr(qts, wd) & WTRF); in test_enabling_flags()
226 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTE | WTIF | WTIE | WTRF | WTR); in test_enabling_flags()
227 qtest_clock_step(qts, watchdog_interrupt_steps(qts, wd)); in test_enabling_flags()
228 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_enabling_flags()
229 g_assert_true(qtest_get_irq(qts, wd->irq)); in test_enabling_flags()
231 watchdog_prescaler(qts, wd))); in test_enabling_flags()
232 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_enabling_flags()
233 g_assert_false(watchdog_read_wtcr(qts, wd) & WTRF); in test_enabling_flags()
239 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTE | WTIF | WTRE | WTRF | WTR); in test_enabling_flags()
240 qtest_clock_step(qts, watchdog_interrupt_steps(qts, wd)); in test_enabling_flags()
241 g_assert_true(watchdog_read_wtcr(qts, wd) & WTIF); in test_enabling_flags()
242 g_assert_false(qtest_get_irq(qts, wd->irq)); in test_enabling_flags()
244 watchdog_prescaler(qts, wd))); in test_enabling_flags()
260 const Watchdog *wd = watchdog; in test_pause() local
266 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTE | WTIF | WTIE | WTRF | WTR); in test_pause()
267 remaining_steps = watchdog_interrupt_steps(qts, wd); in test_pause()
268 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(0) | WTE | WTIE); in test_pause()
276 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTIE); in test_pause()
277 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(0) | WTIE); in test_pause()
281 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(0) | WTIE); in test_pause()
282 g_assert_false(qtest_get_irq(qts, wd->irq)); in test_pause()
285 watchdog_write_wtcr(qts, wd, WTCLK(0) | WTE | WTIE); in test_pause()
286 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, WTCLK(0) | WTE | WTIE); in test_pause()
290 g_assert_cmphex(watchdog_read_wtcr(qts, wd), ==, in test_pause()
292 g_assert_true(qtest_get_irq(qts, wd->irq)); in test_pause()
297 static void watchdog_add_test(const char *name, const Watchdog* wd, in watchdog_add_test() argument
301 "npcm7xx_watchdog_timer[%d]/%s", watchdog_index(wd), name); in watchdog_add_test()
302 qtest_add_data_func(full_name, wd, fn); in watchdog_add_test()
312 const Watchdog *wd = &watchdog_list[i]; in main() local
314 add_test(init, wd); in main()
315 add_test(reset_action, wd); in main()
316 add_test(prescaler, wd); in main()
317 add_test(enabling_flags, wd); in main()
318 add_test(pause, wd); in main()