add adc and dac switch
This commit is contained in:
parent
c7fc965fcf
commit
0ead095044
20
creole.c
20
creole.c
|
@ -42,7 +42,7 @@ enum creole_arg_type {
|
||||||
[i] = v,
|
[i] = v,
|
||||||
* in C89 indicies are implicit from 0 to the maximum filled-in value.
|
* in C89 indicies are implicit from 0 to the maximum filled-in value.
|
||||||
*/
|
*/
|
||||||
#define defop(s, n, a1, a2, a3) {n, {a1, a2, a3}}
|
#define defop(s, n, a1, a2, a3) [CREOLE_##s] = {n, {a1, a2, a3}}
|
||||||
static const struct {
|
static const struct {
|
||||||
int arglen;
|
int arglen;
|
||||||
enum creole_arg_type argtype[CREOLE_MAX_ARG];
|
enum creole_arg_type argtype[CREOLE_MAX_ARG];
|
||||||
|
@ -66,7 +66,7 @@ static const struct {
|
||||||
defop(CLOOP_READ, 2, TYPE_VAL, TYPE_REG, TYPE_NONE),
|
defop(CLOOP_READ, 2, TYPE_VAL, TYPE_REG, TYPE_NONE),
|
||||||
defop(CLOOP_WRITE, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE),
|
defop(CLOOP_WRITE, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE),
|
||||||
defop(WF_LOAD, 2, TYPE_VAL, TYPE_IMM, TYPE_NONE),
|
defop(WF_LOAD, 2, TYPE_VAL, TYPE_IMM, TYPE_NONE),
|
||||||
defop(WF_EXEC, 3, TYPE_VAL, TYPE_VAL, TYPE_VAL),
|
defop(WF_ARM, 3, TYPE_VAL, TYPE_VAL, TYPE_VAL),
|
||||||
defop(SENDVAL, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
defop(SENDVAL, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
||||||
defop(SENDDAT, 1, TYPE_IMM, TYPE_NONE, TYPE_NONE),
|
defop(SENDDAT, 1, TYPE_IMM, TYPE_NONE, TYPE_NONE),
|
||||||
defop(WF_DISARM, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
defop(WF_DISARM, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
||||||
|
@ -77,7 +77,9 @@ static const struct {
|
||||||
defop(TAKE_WF, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE),
|
defop(TAKE_WF, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE),
|
||||||
defop(RELEASE_WF, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
defop(RELEASE_WF, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
||||||
defop(TAKE_CLOOP, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
defop(TAKE_CLOOP, 1, TYPE_VAL, TYPE_NONE, TYPE_NONE),
|
||||||
defop(RELEASE_CLOOP, 0, TYPE_NONE, TYPE_NONE, TYPE_NONE)
|
defop(RELEASE_CLOOP, 0, TYPE_NONE, TYPE_NONE, TYPE_NONE),
|
||||||
|
defop(SWITCH_ADC, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE),
|
||||||
|
defop(SWITCH_DAC, 2, TYPE_VAL, TYPE_VAL, TYPE_NONE)
|
||||||
};
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -843,6 +845,18 @@ enum creole_run_ret creole_step(struct creole_env *env, creole_word *sc)
|
||||||
check(creole_push(env, cloop_release()));
|
check(creole_push(env, cloop_release()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CREOLE_SWITCH_ADC:
|
||||||
|
check(read_val(env, &ins, 0, &a0));
|
||||||
|
check(read_val(env, &ins, 1, &a1));
|
||||||
|
check(creole_push(env, adc_switch(a0, a1, K_FOREVER)));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CREOLE_SWITCH_DAC:
|
||||||
|
check(read_val(env, &ins, 0, &a0));
|
||||||
|
check(read_val(env, &ins, 1, &a1));
|
||||||
|
check(creole_push(env, dac_switch(a0, a1, K_FOREVER)));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rcode = CREOLE_STEP_UNKNOWN_OPCODE;
|
rcode = CREOLE_STEP_UNKNOWN_OPCODE;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue