Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Münchhalfen
wine
Commits
542b29db
Commit
542b29db
authored
25 years ago
by
Ove Kåven
Committed by
Alexandre Julliard
25 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Made win16 serial comms less of a CPU hog.
parent
d16319ce
No related branches found
Branches containing commit
Tags
wine-960818
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/comm.h
+1
-1
1 addition, 1 deletion
include/comm.h
misc/comm.c
+35
-10
35 additions, 10 deletions
misc/comm.c
with
36 additions
and
11 deletions
include/comm.h
+
1
−
1
View file @
542b29db
...
...
@@ -20,7 +20,7 @@ struct DosDeviceStruct {
unsigned
obuf_size
,
obuf_head
,
obuf_tail
;
/* notifications */
int
wnd
,
n_read
,
n_write
;
HANDLE
s
ervic
e
;
HANDLE
s
_read
,
s_writ
e
;
};
extern
void
COMM_Init
(
void
);
...
...
This diff is collapsed.
Click to expand it.
misc/comm.c
+
35
−
10
View file @
542b29db
...
...
@@ -272,9 +272,15 @@ static void CALLBACK comm_notification( ULONG_PTR private )
if
(
ptr
->
obuf_tail
>=
ptr
->
obuf_size
)
ptr
->
obuf_tail
=
0
;
/* flag event */
if
((
ptr
->
obuf_tail
==
ptr
->
obuf_head
)
&&
(
ptr
->
eventmask
&
EV_TXEMPTY
))
{
*
(
WORD
*
)(
unknown
[
cid
])
|=
EV_TXEMPTY
;
mask
|=
CN_EVENT
;
if
(
ptr
->
obuf_tail
==
ptr
->
obuf_head
)
{
if
(
ptr
->
s_write
)
{
SERVICE_Delete
(
ptr
->
s_write
);
ptr
->
s_write
=
INVALID_HANDLE_VALUE
;
}
if
(
ptr
->
eventmask
&
EV_TXEMPTY
)
{
*
(
WORD
*
)(
unknown
[
cid
])
|=
EV_TXEMPTY
;
mask
|=
CN_EVENT
;
}
}
}
}
while
(
len
>
0
);
...
...
@@ -292,6 +298,24 @@ static void CALLBACK comm_notification( ULONG_PTR private )
}
}
static
void
comm_waitread
(
struct
DosDeviceStruct
*
ptr
)
{
if
(
ptr
->
s_read
!=
INVALID_HANDLE_VALUE
)
return
;
ptr
->
s_read
=
SERVICE_AddObject
(
FILE_DupUnixHandle
(
ptr
->
fd
,
GENERIC_READ
|
SYNCHRONIZE
),
comm_notification
,
(
ULONG_PTR
)
ptr
);
}
static
void
comm_waitwrite
(
struct
DosDeviceStruct
*
ptr
)
{
if
(
ptr
->
s_write
!=
INVALID_HANDLE_VALUE
)
return
;
ptr
->
s_write
=
SERVICE_AddObject
(
FILE_DupUnixHandle
(
ptr
->
fd
,
GENERIC_WRITE
|
SYNCHRONIZE
),
comm_notification
,
(
ULONG_PTR
)
ptr
);
}
/**************************************************************************
* BuildCommDCB (USER.213)
*/
...
...
@@ -456,12 +480,9 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
return
IE_MEMORY
;
}
COM
[
port
].
service
=
SERVICE_AddObject
(
FILE_DupUnixHandle
(
COM
[
port
].
fd
,
GENERIC_READ
|
GENERIC_WRITE
|
SYNCHRONIZE
),
comm_notification
,
(
ULONG_PTR
)
&
COM
[
port
]
);
/* bootstrap notifications, just in case */
comm_notification
(
(
ULONG_PTR
)
&
COM
[
port
]
);
COM
[
port
].
s_read
=
INVALID_HANDLE_VALUE
;
COM
[
port
].
s_write
=
INVALID_HANDLE_VALUE
;
comm_waitread
(
&
COM
[
port
]
);
return
port
;
}
}
...
...
@@ -502,7 +523,8 @@ INT16 WINAPI CloseComm16(INT16 cid)
/* COM port */
SEGPTR_FREE
(
unknown
[
cid
]);
/* [LW] */
SERVICE_Delete
(
COM
[
cid
].
service
);
SERVICE_Delete
(
COM
[
cid
].
s_write
);
SERVICE_Delete
(
COM
[
cid
].
s_read
);
/* free buffers */
free
(
ptr
->
outbuf
);
free
(
ptr
->
inbuf
);
...
...
@@ -1178,10 +1200,12 @@ INT16 WINAPI TransmitCommChar16(INT16 cid,CHAR chTransmit)
if
(
write
(
ptr
->
fd
,
&
chTransmit
,
1
)
==
-
1
)
{
/* didn't work, queue it */
ptr
->
xmit
=
chTransmit
;
comm_waitwrite
(
ptr
);
}
}
else
{
/* data in queue, let this char be transmitted next */
ptr
->
xmit
=
chTransmit
;
comm_waitwrite
(
ptr
);
}
ptr
->
commerror
=
0
;
...
...
@@ -1311,6 +1335,7 @@ INT16 WINAPI WriteComm16(INT16 cid, LPSTR lpvBuf, INT16 cbWrite)
ptr
->
obuf_head
=
0
;
lpvBuf
+=
status
;
length
+=
status
;
comm_waitwrite
(
ptr
);
}
ptr
->
commerror
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment