Have you tried getting info and/or drivers from IBM or Microsoft?
Printable View
Have you tried getting info and/or drivers from IBM or Microsoft?
No, I have not.
though the TESTCFG.SYS device driver can perform the function i want...however from the last thing I posted that guy suggested it was no good.
though this page says it works
http://notebook.arkane-systems.net/i...I/O_under_OS/2
Code:// Include all needed includes for the .DLL definitions
#define INCL_DOS
#include <os2.h>
// TESTCFG driver command constants
#define CFG_CATEGORY 0x80
#define CFG_IN_IO 0x41
#define CFG_OUT_IO 0x42
#define CFG_IO_BYTE 1
#define CFG_IO_WORD 2
#define CFG_IO_DWORD 4
// TESTCFG driver structures
// IO packet structures
typedef struct _IOPKT {
USHORT io_address ;
USHORT data_width ;
union {
UCHAR ucData ;
USHORT usData ;
ULONG ulData ;
} d ;
} IOPKT ;
typedef IOPKT * PIOPKT ;
typedef struct _IODATAPKT {
union {
UCHAR ucData ;
USHORT usData ;
ULONG ulData ;
} d ;
} IODATAPKT ;
typedef IODATAPKT * PIODATAPKT ;
// exported functions
// open_ports - prepare the system I/O ports to be read/written
HFILE _Export open_ports (void)
{
HFILE hfDevice ;
ULONG action ;
DosOpen ("TESTCFG$", &hfDevice, &action, 0, 0, FILE_OPEN, OPEN_ACCESS_READWRITE |
OPEN_SHARE_DENYNONE, NULL) ;
return hfDevice ;
}
// close_ports - close the I/O port device driver
APIRET _Export close_ports (HFILE hfDevice)
{
return DosClose (hfDevice) ;
}
// port i/o input functions
APIRET _Export input_byte (HFILE hfDevice, USHORT port, PBYTE pb)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
IODATAPKT iodatapkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_BYTE ;
cbparm = sizeof (iopkt) ;
cbdata = sizeof (iodatapkt) ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_IN_IO, &iopkt, sizeof (iopkt), &cbparm,
&iodatapkt, sizeof (iodatapkt), &cbdata) ;
*pb = iodatapkt.d.ucData ;
return rc ;
}
APIRET _Export input_word (HFILE hfDevice, USHORT port, PUSHORT pw)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
IODATAPKT iodatapkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_WORD ;
cbparm = sizeof (iopkt) ;
cbdata = sizeof (iodatapkt) ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_IN_IO, &iopkt, sizeof (iopkt), &cbparm,
&iodatapkt, sizeof (iodatapkt), &cbdata) ;
*pw = iodatapkt.d.usData ;
return rc ;
}
APIRET _Export input_dword (HFILE hfDevice, USHORT port, PULONG pd)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
IODATAPKT iodatapkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_DWORD ;
cbparm = sizeof (iopkt) ;
cbdata = sizeof (iodatapkt) ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_IN_IO, &iopkt, sizeof (iopkt), &cbparm,
&iodatapkt, sizeof (iodatapkt), &cbdata) ;
*pd = iodatapkt.d.ulData ;
return rc ;
}
// port i/o output functions
APIRET _Export output_byte (HFILE hfDevice, USHORT port, BYTE b)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_BYTE ;
iopkt.d.ucData = b ;
cbparm = sizeof (iopkt) ;
cbdata = 0 ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_OUT_IO, &iopkt, sizeof (iopkt), &cbparm, NULL,
0, &cbdata) ;
return rc ;
}
APIRET _Export output_word (HFILE hfDevice, USHORT port, USHORT w)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_WORD ;
iopkt.d.usData = w ;
cbparm = sizeof (iopkt) ;
cbdata = 0 ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_OUT_IO, &iopkt, sizeof (iopkt), &cbparm, NULL,
0, &cbdata) ;
return rc ;
}
APIRET _Export output_dword (HFILE hfDevice, USHORT port, ULONG d)
{
APIRET rc ;
ULONG cbparm, cbdata ;
IOPKT iopkt ;
iopkt.io_address = port ;
iopkt.data_width = CFG_IO_DWORD ;
iopkt.d.ulData = d ;
cbparm = sizeof (iopkt) ;
cbdata = 0 ;
rc = DosDevIOCtl (hfDevice, CFG_CATEGORY, CFG_OUT_IO, &iopkt, sizeof (iopkt), &cbparm, NULL,
0, &cbdata) ;
return rc ;
}
I have no idea how I would incorporate that code and the code for my timer .
Here is what the connector looks like
http://img77.imageshack.us/img77/3281/wiringwd2.jpg
Its hard to read but it reads from top to bottom:
Not used
Not used
Not used
AENOUT-
AENOUT+
CONTACTOR+
CONTACTOR-
INTERLOCK+
INTERLOCK-
TERMINATE+
TERMINATE-
AENRIN-
AENRIN+
DATA/CLK-
DATA/CLK+
more info on reading i/o info
http://www.edm2.com/0501/devicedrivers5.html
Looks like a standard "D" 15 pin serial port.
The important thing to me is that the port is being handled currently (successfully), by OS2, and OS2 was a joint effort by IBM and Microsoft, which MS eventually separated themselves from.
Why not go straight to the "horse's mouth", and contact IBM? They obviously would know how to do this in OS2, since OS2 is their baby.
So... test the code you got from wiki!
You will use it like this, if that is what your asking:
I m just guessing here. But usually you use them like that. So you will read the data from the machine with output_data and ...well see what you are going to do.Code:HFILE portHandler;
USHORT port;
BYTE data;
portHandler = open_ports(); //initialize, open port, run this before the machine runs (or not)
output_byte (PortHandler, port, data); //you get a BYTE from the port
input_byte (PortHandler, port, data); //you send a BYTE from the port
close_port (portHandler); //you close the port, when you are done
Test these functions the way I posted by sending/receiving bytes and you/we will see from there.
But... you still need the port number or definition (like PARAPORT) for the port number... Search os2.h?
well its not IBMs baby anymore....they stopped supporting it a while ago.
granted im sure someone there knows what to do, it seems I have found all the relevent information ill need to do this. The problem is sorting through it all, coming up with the right code and getting it to work with my little program. As I keep saying im a newb so this is a slow process, and I appreciate the help so far from everyone.
Ok so I found out some ways to look at some system info....and i also got an email letting me know that the card has to be used with IRQ5.
I look up various info and nothing is listed for irq 5...hrmmm its like its hidden.
i might try a port sniffer next. but thats a pain due to security reasons.
:/
"Port sniffer" is something for sniffing ethernet packages.
You need the specifications of that board to be able to find out what IO port to use. Is it a PCI board or a ISA board?
--
Mats