X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=sim%2Fucsim%2Fsim.src%2Fhwcl.h;h=a67921e02a4e752317b67628b158df5aa4f827f5;hb=c2a0ea8e1e3331b8ea967a0c23cfaabf6fc33e59;hp=0efce2e6997200b653b5224fd32cc136c87385f4;hpb=0ac34444ce2ccdcaa5fe722e2420f96c46224039;p=fw%2Fsdcc diff --git a/sim/ucsim/sim.src/hwcl.h b/sim/ucsim/sim.src/hwcl.h index 0efce2e6..a67921e0 100644 --- a/sim/ucsim/sim.src/hwcl.h +++ b/sim/ucsim/sim.src/hwcl.h @@ -1,5 +1,5 @@ /* - * Simulator of microcontrollers (hwcl.h) + * Simulator of microcontrollers (sim.src/hwcl.h) * * Copyright (C) 1999,99 Drotos Daniel, Talker Bt. * @@ -27,17 +27,62 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Abstract hw element. It can be a timer, serial line or whatever */ -#ifndef HWCL_HEADER -#define HWCL_HEADER +#ifndef SIM_HWCL_HEADER +#define SIM_HWCL_HEADER #include "stypes.h" #include "pobjcl.h" -#include "uccl.h" +#include "guiobjcl.h" +// cmd.src #include "newcmdcl.h" +// local +#include "memcl.h" +#include "uccl.h" + + +enum what_to_do_on_cell_change { + wtd_none = 0x01, + wtd_write = 0x02, + wtd_restore = 0x04, + wtd_restore_write = 0x08 +}; + +#define WTD_WRITE (wtd_write|wtd_restore_write) +#define WTD_RESTORE (wtd_restore|wtd_restore_write) + +class cl_hw; // forward + +class cl_watched_cell: public cl_base +{ +protected: + class cl_mem *mem; + t_addr addr; + class cl_cell *cell; + class cl_cell **store; +public: + enum what_to_do_on_cell_change wtd; +public: + cl_watched_cell(class cl_mem *amem, t_addr aaddr, class cl_cell **astore, + enum what_to_do_on_cell_change awtd); + + virtual void mem_cell_changed(class cl_mem *amem, t_addr aaddr, + class cl_hw *hw); +}; + +class cl_used_cell: public cl_watched_cell +{ +public: + cl_used_cell(class cl_mem *amem, t_addr aaddr, class cl_cell **astore, + enum what_to_do_on_cell_change awtd): + cl_watched_cell(amem, aaddr, astore, awtd) {} + + /*virtual void mem_cell_changed(class cl_mem *amem, t_addr aaddr, + class cl_hw *hw);*/ +}; -class cl_hw: public cl_base +class cl_hw: public cl_guiobj { public: int flags; @@ -45,18 +90,65 @@ public: enum hw_cath cathegory; int id; char *id_string; - +protected: + class cl_list *partners; + class cl_list *watched_cells; public: cl_hw(class cl_uc *auc, enum hw_cath cath, int aid, char *aid_string); - ~cl_hw(void); + virtual ~cl_hw(void); + + virtual void new_hw_adding(class cl_hw *new_hw); + virtual void new_hw_added(class cl_hw *new_hw); + virtual void added_to_uc(void) {} + virtual class cl_hw *make_partner(enum hw_cath cath, int id); + + virtual t_mem read(class cl_cell *cell) { return(cell->get()); } + virtual void write(class cl_cell */*cell*/, t_mem */*val*/) {} - virtual ulong read(class cl_mem *mem, long addr); - virtual void write(class cl_mem *mem, long addr, ulong *val); + virtual void set_cmd(class cl_cmdline *cmdline, class cl_console *con) {} + virtual class cl_cell *register_cell(class cl_mem *mem, t_addr addr, + class cl_cell **store, + enum what_to_do_on_cell_change awtd); + virtual class cl_cell *use_cell(class cl_mem *mem, t_addr addr, + class cl_cell **store, + enum what_to_do_on_cell_change awtd); + virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); virtual int tick(int cycles); + virtual void reset(void) {} + virtual void happen(class cl_hw */*where*/, enum hw_event /*he*/, + void */*params*/) {} + virtual void inform_partners(enum hw_event he, void *params); + virtual void print_info(class cl_console *con); }; +class cl_hws: public cl_list +{ +public: + cl_hws(void): cl_list(2, 2) {} + virtual t_index add(void *item); + virtual void mem_cell_changed(class cl_mem *mem, t_addr addr); +}; + + +class cl_partner_hw: public cl_base +{ +protected: + class cl_uc *uc; + enum hw_cath cathegory; + int id; + class cl_hw *partner; +public: + cl_partner_hw(class cl_uc *auc, enum hw_cath cath, int aid); + + virtual class cl_hw *get_partner(void); + virtual void refresh(void); + virtual void refresh(class cl_hw *new_hw); + + virtual void happen(class cl_hw *where, enum hw_event he, void *params); +}; + #endif