typedef struct {
i2c_slave i2c;
- int i2c_dir;
- int i2c_cycle;
- int reg;
+ uint8_t i2c_dir;
+ uint8_t i2c_cycle;
+ uint8_t reg;
qemu_irq nirq;
uint16_t model;
struct {
uint8_t dbnctime;
uint8_t size;
- int start;
- int len;
+ uint8_t start;
+ uint8_t len;
uint8_t fifo[16];
} kbd;
LM832x_CMD_PWM_WRITE = 0x95, /* Write PWM script. */
LM832x_CMD_PWM_START = 0x96, /* Start PWM engine. */
LM832x_CMD_PWM_STOP = 0x97, /* Stop PWM engine. */
+ LM832x_GENERAL_ERROR = 0xff, /* There was one error.
+ Previously was represented by -1
+ This is not a command */
};
#define LM832x_MAX_KPX 8
lm_kbd_irq_update(s);
s->kbd.len = 0;
s->kbd.start = 0;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
break;
case LM832x_CMD_RESET:
lm_kbd_reset(s);
else
lm_kbd_error(s, ERR_BADPAR);
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
break;
case LM823x_CMD_WRITE_PULL_DOWN:
else {
s->gpio.pull |= value << 8;
lm_kbd_gpio_update(s);
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
}
break;
case LM832x_CMD_WRITE_PORT_SEL:
else {
s->gpio.dir |= value << 8;
lm_kbd_gpio_update(s);
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
}
break;
case LM832x_CMD_WRITE_PORT_STATE:
else {
s->gpio.mask |= value << 8;
lm_kbd_gpio_update(s);
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
}
break;
case LM832x_CMD_SET_ACTIVE:
s->acttime = value;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
break;
case LM832x_CMD_SET_DEBOUNCE:
s->kbd.dbnctime = value;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
if (!value)
lm_kbd_error(s, ERR_BADPAR);
break;
case LM832x_CMD_SET_KEY_SIZE:
s->kbd.size = value;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
if (
(value & 0xf) < 3 || (value & 0xf) > LM832x_MAX_KPY ||
(value >> 4) < 3 || (value >> 4) > LM832x_MAX_KPX)
case LM832x_CMD_WRITE_CLOCK:
s->clock = value;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
if ((value & 3) && (value & 3) != 3) {
lm_kbd_error(s, ERR_BADPAR);
fprintf(stderr, "%s: invalid clock setting in RCPWM\n",
if (byte == 0) {
if (!(value & 3) || (value >> 2) > 59) {
lm_kbd_error(s, ERR_BADPAR);
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
break;
}
s->pwm.file[s->pwm.faddr] |= value << 8;
} else if (byte == 2) {
s->pwm.file[s->pwm.faddr] |= value << 0;
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
}
break;
case LM832x_CMD_PWM_START:
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
if (!(value & 3) || (value >> 2) > 59) {
lm_kbd_error(s, ERR_BADPAR);
break;
lm_kbd_pwm_start(s, (value & 3) - 1);
break;
case LM832x_CMD_PWM_STOP:
- s->reg = -1;
+ s->reg = LM832x_GENERAL_ERROR;
if (!(value & 3)) {
lm_kbd_error(s, ERR_BADPAR);
break;
qemu_del_timer(s->pwm.tm[(value & 3) - 1]);
break;
- case -1:
+ case LM832x_GENERAL_ERROR:
lm_kbd_error(s, ERR_BADPAR);
break;
default: