OSDN Git Service

[VM][COMMON_VM] Include IO:: class to common_vm.
[csp-qt/common_source_project-fm7.git] / source / src / vm / sio_redirector.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Kyuma Ohta <whatisthis.sowhat _at_ gmail.com>
5         Date   : 2019.06.06 -
6
7         [ SERIAL I/O REDIRECTOR ]
8
9         This is redirection from some outputs to osd depended midi port.
10 */
11
12 #ifndef _SIO_REDIRECTOR_H_
13 #define _SIO_REDIRECTOR_H_
14
15 #include "midi_redirector.h"
16
17 #define SIG_SIO_RESET                                           1
18 #define SIG_SIO_SEND                                            2
19 #define SIG_SIO_ENABLE_TO_SEND                          3
20 #define SIG_SIO_ENABLE_TO_RECEIVE                       4
21 #define SIG_SIO_REMAIN_SEND                                     5
22 #define SIG_SIO_REMAIN_RECEIVE                          6
23
24 class SIO_REDIRECTOR : public MIDI_REDIRECTOR {
25 public:
26         SIO_REDIRECTOR(VM_TEMPLATE* parent_vm, EMU* parent_emu) : MIDI_REDIRECTOR(parent_vm, parent_emu)
27         {
28                 set_device_name(_T("SERIAL I/O REDIRECTOR"));
29         }
30         ~SIO_REDIRECTOR() {}
31         virtual void reset();
32         virtual void initialize();
33         virtual void release();
34         virtual uint32_t __FASTCALL read_signal(int id);
35         virtual void __FASTCALL write_signal(int id, uint32_t data, uint32_t mask);
36         virtual bool process_state(FILEIO* state_fio, bool loading);
37
38         // Unique functions
39         // API for OSD.
40         virtual bool __FASTCALL push_receive_data(int port_num, uint32_t data); // Push receive data by OSD.
41         virtual int __FASTCALL bind_receive_port(void); // Request bind port from OSD to DEVICE or VM.
42         virtual int __FASTCALL bind_send_port(void);    // Request bind port from DEVICE or VM to OSD.
43 };
44
45 #endif /* _SIO_REDIRECTOR_H_ */