1 /*
2 * UAE - The Un*x Amiga Emulator
3 *
4 * Not a parser, but parallel and serial emulation for Linux
5 *
6 * Copyright 2010 Mustafa TUFAN
7 */
8
9 #include "sysconfig.h"
10
11 #undef SERIAL_ENET
12
13 #include "sysdeps.h"
14 #include "options.h"
15 #include "gensound.h"
16 #include "events.h"
17 #include "uae.h"
18 #include "include/memory_uae.h"
19 #include "custom.h"
20 #include "autoconf.h"
21 #include "newcpu.h"
22 #include "traps.h"
23 #include "threaddep/thread.h"
24 #include "serial.h"
25 #include "savestate.h"
26 #include "xwin.h"
27 #include "drawing.h"
28
29 #define MIN_PRTBYTES 10
30
31 struct uaeserialdata
32 {
33 long hCom;
34 long evtr, evtw, evtt, evtwce;
35 long olr, olw, olwce;
36 int writeactive;
37 void *readdata, *writedata;
38 volatile int threadactive;
39 uae_sem_t change_sem, sync_sem;
40 void *user;
41 };
42
uaeser_getdatalength(void)43 int uaeser_getdatalength (void)
44 {
45 return sizeof (struct uaeserialdata);
46 }
47
uaeser_initdata(void * vsd,void * user)48 void uaeser_initdata (void *vsd, void *user)
49 {
50 }
51
uaeser_query(void * vsd,uae_u16 * status,uae_u32 * pending)52 int uaeser_query (void *vsd, uae_u16 *status, uae_u32 *pending)
53 {
54 return 0;
55 }
56
uaeser_break(void * vsd,int brklen)57 int uaeser_break (void *vsd, int brklen)
58 {
59 return 0;
60 }
61
uaeser_setparams(void * vsd,int baud,int rbuffer,int bits,int sbits,int rtscts,int parity,uae_u32 xonxoff)62 int uaeser_setparams (void *vsd, int baud, int rbuffer, int bits, int sbits, int rtscts, int parity, uae_u32 xonxoff)
63 {
64 return 0;
65 }
66
uaeser_trigger(void * vsd)67 void uaeser_trigger (void *vsd)
68 {
69 }
70
uaeser_write(void * vsd,uae_u8 * data,uae_u32 len)71 int uaeser_write (void *vsd, uae_u8 *data, uae_u32 len)
72 {
73 return 0;
74 }
75
uaeser_read(void * vsd,uae_u8 * data,uae_u32 len)76 int uaeser_read (void *vsd, uae_u8 *data, uae_u32 len)
77 {
78 return 0;
79 }
80
uaeser_clearbuffers(void * vsd)81 void uaeser_clearbuffers (void *vsd)
82 {
83 }
84
uaeser_open(void * vsd,void * user,int unit)85 int uaeser_open (void *vsd, void *user, int unit)
86 {
87 return 0;
88 }
89
uaeser_close(void * vsd)90 void uaeser_close (void *vsd)
91 {
92 }
93
94 #define SERIAL_WRITE_BUFFER 100
95 #define SERIAL_READ_BUFFER 100
96 static uae_u8 outputbuffer[SERIAL_WRITE_BUFFER];
97 static uae_u8 outputbufferout[SERIAL_WRITE_BUFFER];
98 static uae_u8 inputbuffer[SERIAL_READ_BUFFER];
99 static int datainoutput;
100 static int dataininput, dataininputcnt;
101 static int writepending;
102