-
Notifications
You must be signed in to change notification settings - Fork 2
/
msl.c
52 lines (41 loc) · 1.33 KB
/
msl.c
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdint.h>
#include <stdio.h>
#include "msl.h"
#include "msl-timings.h"
#include "log.h"
#include "ge.h"
struct msl_timing_state* msl_get_state(uint8_t SO)
{
struct msl_timing_state *state = &msl_timings[SO];
return (!state->chart)
? NULL
: state;
}
void msl_run_state(struct ge* ge, struct msl_timing_state *state)
{
const struct msl_timing_chart *chart;
uint32_t i = 0;
do {
const char *clock_name = ge_clock_name(ge->current_clock);
chart = &state->chart[i++];
if (chart->clock != ge->current_clock)
continue;
ge_print_registers_verbose(ge);
if (chart->additional) {
if (!chart->additional(ge)) {
ge_log(LOG_CONDS, " time %-4s - additional false\n", clock_name);
continue;
}
ge_log(LOG_CONDS, " time %-4s - additional true\n", clock_name);
}
if (chart->condition) {
if (!chart->condition(ge)) {
ge_log(LOG_CONDS, " time %-4s - condition false\n", clock_name);
continue;
}
ge_log(LOG_CONDS, " time %-4s - condition true\n", clock_name);
}
ge_log(LOG_CMDS, " %s\n", msl_comment_for_command(chart->command));
chart->command(ge);
} while (chart->clock < END_OF_STATUS);
}