2 * Simulator of microcontrollers (sim.src/serial_hwcl.h)
4 * Copyright (C) 2016,16 Drotos Daniel, Talker Bt.
6 * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
10 /* This file is part of microcontroller simulator: ucsim.
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING. If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 #ifndef SERIAL_HWCL_HEADER
29 #define SERIAL_HWCL_HEADER
31 #include "newcmdposixcl.h"
38 serconf_check_often
= 1,
43 serconf_able_receive
= 6,
49 class cl_serial_io
: public cl_hw_io
52 cl_serial_io(class cl_hw
*ihw
):
55 //virtual bool prevent_quit(void) { return true; }
56 virtual bool input_avail(void);
59 class cl_serial_hw
: public cl_hw
61 friend class cl_serial_listener
;
63 class cl_optref
*serial_in_file_option
;
64 class cl_optref
*serial_out_file_option
;
65 class cl_optref
*serial_port_option
;
66 class cl_optref
*serial_iport_option
;
67 class cl_optref
*serial_oport_option
;
68 class cl_optref
*serial_ifirst_option
;
69 class cl_optref
*serial_raw_option
;
70 class cl_serial_listener
*listener_io
, *listener_i
, *listener_o
;
81 cl_serial_hw(class cl_uc
*auc
, int aid
, chars aid_string
);
82 virtual ~cl_serial_hw(void);
83 virtual int init(void);
84 virtual unsigned int cfg_size(void) { return serconf_nr
; }
85 virtual const char *cfg_help(t_addr addr
);
87 virtual bool set_cmd(class cl_cmdline
*cmdline
, class cl_console_base
*con
);
88 virtual void set_help(class cl_console_base
*con
);
89 virtual t_mem
conf_op(cl_memory_cell
*cell
, t_addr addr
, t_mem
*val
);
90 virtual bool is_nl(char c
) { return (c
=='\n') || (c
=='\r'); }
91 virtual char opposite_nl(char c
) { return (c
=='\n')?'\r':((c
=='\r')?'\n':c
); }
92 virtual u8_t
get_input(void);
94 virtual void make_io(void);
95 virtual void new_io(class cl_f
*f_in
, class cl_f
*f_out
);
96 virtual void new_i(class cl_f
*f_in
);
97 virtual void new_o(class cl_f
*f_out
);
98 virtual void set_raw(void);
99 virtual void del_listener_i(void);
100 virtual void del_listener_o(void);
101 virtual bool proc_input(void);
102 virtual void refresh_display(bool force
) {}
103 virtual void draw_state_time(bool force
) {}
104 virtual void draw_display(void) {}
106 virtual void reset(void);
109 enum ser_listener_for
116 class cl_serial_listener
: public cl_listen_console
119 enum ser_listener_for sl_for
;
121 class cl_serial_hw
*serial_hw
;
122 cl_serial_listener(int serverport
, class cl_app
*the_app
,
123 class cl_serial_hw
*the_serial
,
124 enum ser_listener_for slf
);
125 virtual int init(void);
126 virtual int proc_input(class cl_cmdset
*cmdset
);
127 virtual bool prevent_quit(void) { return false; }
133 /* End of sim.src/serial_hwcl.h */