| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | DosDevIOCtl for COM ports |
I'm _trying_ to write some OS/2 routines (using Watcom 10.6) to control
the COM port.. and thus far I'm not having any luck. The documention I have
seems to be FAR from user friendly. I can't even lock the port at a different
rate. :)
Here's my code..
#define INCL_DOSPROCESS
#define INCL_DOSFILEMGR
#define INCL_DOSDEVICES
#include
int main(void)
{
HFILE FileHandle;
ULONG Action;
ULONG FileSize, SizeInOut = 0L;
USHORT FileAttribute = 32;
ULONG baud=115200;
APIRET rc;
rc = DosOpen("COM2", &FileHandle, &Action, 0L, 0,
0x01, 0x0012, 0L);
rc = DosDevIOCtl(FileHandle, 0x01, 0x43, &baud, 4L, &FileSize, NULL, 0L,
&SizeInOut);
rc = DosClose(FileHandle);
return 0;
}
Now, my questions being:
A) what INCL_xxxx lines do I need?
B) Could someone explain to me the "best" way to open a COM port
for reading
and writing?
C) For DosDevIOCtl, would someone explain, in detail (if at all possible) what
the ParmList is, and how/when to use it.. what the DataArea is, and how/when
to use it, what the ParmLengthMax, DataLengthMax, DataLengthInOut, and
ParmLengthInOut are, and how to use them.
D) I have two .INF files that give two different specifications for the
DosDevIOCtl. One needs 6 parameters, I believe, and the other needs 9.
Unfortunately Watcom complains if I only use 6, so I guess I should use 9.
The "6 parameter one" would be for OS/2 2.0 (pre-Warp), correct?
I'm really lost here, in case you hadn't noticed. :)
Also, just to make sure, a "word" is an "int" or
"short", correct?
And a "dword" is a "long", correct?
And a "byte" is a "char", correct?
So for function 0x43 in DosDevIOCtl for catagory 1, the ParmList is
supposed to contain a "dword" (long baud=xxxxxx) and a
"byte" (char
divisor=xxxx)? IF this is the case, how do you pass both of those as one
parameter? Use a structure?
If above is correct, then ParmLengthMax would be 5 ("dword"
is 4 bytes +
"byte" which is 1 byte). What about DataLengthInOut, ParmLengthInOut, and
DataLengthMax?
And if a port is "locked", do you have to "unlock"
it before you can
change the rate, then do you have to "relock" it?
I appreciate any and all feedback. What would _really_ help me is some
source code with comments telling me exactly what does what. :)
Thanks..
C. Gaefke
cdgaefke{at}sgi.net
[CDRMAIL Author]
--- RG05-11/CDRMAIL 104á
* Origin: LOTL/2 * 412 746 3592 * V34 33.6k * RGSNet PA Host (1:129/230)SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1 @PATH: 129/230 11 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.