1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#define ET_TEST_IMPL
#include "../test.h"
#include <inttypes.h>
static int flash_led_tick(const struct et_state *state, void *data, struct et_next_state *next_state) {
struct et_test_state_private_base *priv = data;
struct et_test_plan *plan = priv->plan;
struct et_test_plan_entry *cur = test_current(plan);
et_test_status status = TEST_PASS;
for (int i = 0; i < 1024; ++i) {
u16 cmd_orig, cmd;
if (i & 1) {
/* LED off */
cmd_orig = 0x7000;
} else {
/* LED on */
cmd_orig = 0x8000;
}
cmd = cmd_orig;
if ((status = test_exi_readwrite(plan, &cmd, sizeof(cmd), TEST_EPRIV_BASE)) != TEST_PASS) {
break;
}
if (cmd != 0x0000) {
status = TEST_FAIL;
test_plan_entry_set_error(cur, "spurious response to 0x%04" PRIx16 ": 0x%04" PRIx16 " (should be 0x0000)", cmd_orig, cmd);
break;
}
}
cur->status = status;
return test_next(plan, next_state);
}
TEST_DEF(flash_led, "Flash LED", 0, NULL, flash_led_tick, NULL, struct et_test_state_private_base);
|