/* * Model of the TCA9539 output stage and the S1D13700 indirect interface. * * It sees only the I2C bytes the panel core produces, so what it renders is * what the real panel would receive, and it counts anything the hardware * would not tolerate. */ #ifndef S1D13700_SIM_H #define S1D13700_SIM_H #include #include #include struct s1d_sim_faults { unsigned int a0_with_wr_edge; /* A0 changed in the same update as WR# */ unsigned int data_no_command; /* parameter with no command in progress */ unsigned int data_no_mwrite; /* parameter beyond what a command takes */ unsigned int unknown_command; unsigned int bad_tca_register; unsigned int short_message; /* message ended between P0 and P1 */ unsigned int bad_system_set; /* FX != 7 or C/R, AP mismatch */ unsigned int write_in_reset; }; struct s1d_sim { uint8_t vram[32768]; uint8_t out[2]; /* TCA output latches */ uint8_t config[2]; /* TCA direction: 1 = input */ uint8_t cmd; unsigned int nparam; uint8_t params[16]; unsigned int cursor; int step; /* decoded configuration */ unsigned int cr, tcr, lf, ap, fx, sad1, sl1, bpp; bool configured; bool display_on; uint8_t disp_flags; struct s1d_sim_faults faults; unsigned long latches; }; void s1d_sim_init(struct s1d_sim *s); /* One I2C write message: buf[0] is the TCA9539 command byte */ void s1d_sim_i2c_write(struct s1d_sim *s, const uint8_t *buf, size_t len); unsigned int s1d_sim_fault_count(const struct s1d_sim *s); /* * Render what the panel shows into levels[width * height], one level per * pixel, using only the controller's decoded configuration. Returns false if * the display is off or not configured, or the size does not match. */ bool s1d_sim_render(const struct s1d_sim *s, unsigned int width, unsigned int height, uint8_t *levels); #endif /* S1D13700_SIM_H */