Georgia
SoftWorks
Windows NT IOBlaster User Manual
User Manual
Georgia
SoftWorks
Georgia SoftWorks Windows NT IOBlaster
ã Georgia SoftWorks
Public Square
17 Hwy 9 South • PO Box 729
Dawsonville Georgia 30534
Phone 706.265.1018 • Fax 706.265.1020
http://www.georgiasoftworks.com
Copyright © Georgia SoftWorks,
1997,1998,1999,2000,2001 All Rights Reserved.
User's Manual, Version 1.3, January 1998
Microsoft, Windows, Windows NT, Windows 95 are
trademarks of Microsoft Corporation.
THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
LICENSOR MAKES NO WARRANTIES OR REPRESENTATIONS, EXPRESS OR IMPLIED, ORAL
OR WRITTEN, REGARDING THE PROGRAM OR DOCUMENTATION AND HEREBY EXPRESSLY
DISCLAIMS ALL OTHER EXPRESS OR IMPLIED WARRANTIES, INCLUDING MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. LICENSOR DOES NOT WARRANT THE PROGRAM
WILL MEET YOUR REQUIREMENTS OR THAT ITS OPERATION WILL BE UNITERRUPTED OR ERROR
FREE.
IN NO EVENT WILL GEORGIA SOFTWORKS BE LIABLE TO YOU FOR ANY DAMAGES,
INCLUDING ANY LOST PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL
DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE SUCH PROGRAMS.
COPYING:
WHILE YOU ARE PERMITTED TO MAKE BACKUP COPIES OF THE SOFTWARE FOR YOU OWN
USE AND PROTECTION, YOU ARE NOT PERMITTED TO MAKE COPIES FOR THE USE OF ANYONE
ELSE.
LICENSE:
YOU ARE LICENSED FOR A ROYALITY FREE DISTRIBUTION OF THE RUNTIME
ENVIRONMENT. THE DEVELOPMENT ENVIRONMENT IS LICENSED FOR A SINGLE COMPUTER
ONLY. ALL FILES INSTALLED INTO THE SUBDIRECTORY DEV ARE PART OF THE DEVLOPMENT
ENVIRONMENT AND CAN NOT BE REDISTRIBUTED.
Table of Contents
Product Description........................................................................................................................ 1
Installation........................................................................................................................................... 2
Procedure............................................................................................................................................... 2
Runtime Environment................................................................................................................... 3
Development Environment...................................................................................................... 3
Directory Structure....................................................................................................................... 3
C
Development................................................................................................................................... 4
C Header file.................................................................................................................................................. 4
Sample C program.......................................................................................................................................... 5
Sample Makefile............................................................................................................................................ 7
Visual Basic Development........................................................................................................... 8
VB Declaration file........................................................................................................................................ 8
VB Sample Files............................................................................................................................................ 9
IOBLASTER FUNCTIONS...................................................................................................................... 12
GS_inpb - Read data byte from the port........................................................................................................ 12
GS_inpw - Read data word from the port....................................................................................................... 13
GS_inpd - Read double word from the port..................................................................................................... 14
GS_outb - Write data byte to the port.......................................................................................................... 15
GS_outw - Write word to the port................................................................................................................. 16
GS_outd - Write double word to the port....................................................................................................... 17
Technical Support........................................................................................................................... 18
Typographic Conventions
Italics: are used to emphasize
certain words, especially new terms or phrases when they are introduced.
Initial Caps Bold: Words that appear in initial
caps boldface represent menu options, buttons, icons or any object that you may
click.
Courier: This font represents anything you
must type.
"<enter>" This represents
the enter key.
User Manual
The time saved using IOBlaster functions will prove to be a wise investment!
|
T |
hank you for purchasing the Georgia SoftWorks Windows NT IOBlaster Software. You will be pleased with the performance and robustness provided with this product. Ease of use will be a significant time saver when using the Georgia SoftWorks Windows NT IOBlaster software.
There is no need to learn how to write device drivers with the Georgia SoftWorks IOBlaster software. Those familiar with DOS Port I/O can move quickly to NT to implement port input output solutions in C or Visual Basic.
The Georgia SoftWorks
Windows NT IOBlaster is a tool for people who need to perform Port I/O under
the Windows NT 4.0 environment and do not want to learn writing devices
drivers.
|
T |
he
Georgia SoftWorks Windows NT IOBlaster consist of the gsioman.dll dll and the
gsioman.sys device driver that provide functions that are called from
either C or Visual Basic programs to execute the equivalents to the low level inp and outp functions.
Either
a runtime or development version can be installed. The runtime version is
installed for the applications that you develop and distribute. The development
version contains the runtime as well as the header, source and examples files.
The IOBlaster functions do
not provide interrupt handling, so boards that have to use interrupts will
still require DDK programming.
|
I |
nstallation is simple and quick. The same installation program installs the runtime or the development version.
Installation of the development software is simple. Run the setup.exe program. From Windows NT perform the following:
Run the setup.exe program.
1. The IOBlaster screen of the setup program that contains
the name and copyright information. Click
Finish.
2. The Welcome screen is displayed, urging you to exit all Windows applications before proceeding with the installation. After reading the copyright information click Next.
3. The User Information screen in now displayed. Please type in your name, the company name and the serial number that in included with your software. Click Next.
4. The Choose Destination screen is now displayed. You may select the installation directory. Click Next.
5. The Setup Type screen is displayed. Choose Typical for the full development installation. Choose compact for the runtime only installation. Choose custom for some combination of the two. Click Next
6. The Check Setup Information Screen is now displayed. If any changes need to be made click Back otherwise click Next.
7. The Information screen is now displayed indicating the Successful Installation of the NT Driver. Click OK
8. The Setup complete screen is displayed prompting for the reboot of the computer.
The IOBlaster is now installed.
The Runtime environment (or compact install) should be install when distributing applications that use IOBlaster functions. This installs only the required elements for runtime IOBlaster functions.
The Development environment (or typical install) should be installed when developing applications that use IOBlaster functions. It is not necessary to install the development environment when distributing applications.
The IOBlaster directory structure is as follows. The default installation directory is
C:\programfiles\Gerogia SoftWorks\IOBlaster
This directory contains the subdirectories:
bin and Dev
The \bin directory contains the
· IOBlaster NT Device driver GS_IoMan.sys and
· the IOBlaster NT dll GS_IOMUI.dll - This is for the Un-Install program
The \Dev directory contains the subdirectories \Interface and \Samples.
The \Interfaces directory contains the interfaces that are required for C and Visual Basic development.
The \Samples directory contains examples of C and Visual Basic programs to help the developer understand the usage of the IOBlaster functions.
The interfaces header file is GS_IoMan.h located in the
C:\programfiles\Gerogia SoftWorks\IOBlaster\Dev\Interface\C directory.
|
/* ------------------------------------------------------------------------ * * GS_IoMan.h -- I/O Blaster API Declarations for C and C++ * * Copyright (C) 1998 Georgia SoftWorks * * * This file contains function prototype statements for I/O Blaster APIs. * */ #ifndef _INC_GS_IOMAN #define _INC_GS_IOMAN #ifdef __cplusplus extern "C" BYTE _stdcall GS_inpb(WORD wPort, BOOL *pbSuccess); extern "C" WORD _stdcall GS_inpw(WORD wPort, BOOL *pbSuccess); extern "C" DWORD _stdcall GS_inpd(WORD wPort, BOOL *pbSuccess); extern "C" BOOL _stdcall GS_outpb(WORD wPort, BYTE byData); extern "C" BOOL _stdcall GS_outpw(WORD wPort, WORD wData); extern "C" BOOL _stdcall GS_outpd(WORD wPort, DWORD dwData); #else extern BYTE _stdcall GS_inpb(WORD wPort, BOOL *pbSuccess); extern WORD _stdcall GS_inpw(WORD wPort, BOOL *pbSuccess); extern DWORD _stdcall GS_inpd(WORD wPort, BOOL *pbSuccess); extern BOOL _stdcall GS_outpb(WORD wPort, BYTE byData); extern BOOL _stdcall GS_outpw(WORD wPort, WORD wData); extern BOOL _stdcall GS_outpd(WORD wPort, DWORD dwData); #endif #endif /* _INC_GS_IOMAN */ |
The library file GS_IoMan.lib is the import library to be used when C/C++ programs are written. The library was built under Visual C++ version 4.2b.
The
sample C programs allows you to programmatically determine the amount of
physical memory installed on a computer. When the computer runs under an operating
system that has virtual memory or emulates other operating systems, you may not
be able to determine the amount of installed memory from the APIs that the
particular operating system provides. In the case of 80x86-based machines, you
can obtain that information from the CMOS data.
"Reading"
CMOS data isn't as simple as obtaining a pointer to point to a particular
memory location. You must output values to an I/O port and then read values
from another port. The Georgia SoftWorks Library functions "GS_inpb"
and "GS_outpb" can be used
to accomplish the goal under Windows NT 4.0.
The
procedure is straightforward: write values to I/O port 0x70 and read them from
0x71. The values 0x15 and 0x16 are used to get the amount of base memory
installed, while 0x17 and 0x18 are used to get the amount of expansion memory
(up to 15360 kilobytes) installed. Expansion memory is memory above the 1-MB
boundary and should not be confused with expanded memory.
The sample C program is located in the
"C:\programfiles\Gerogia SoftWorks\IOBlaster\Dev\Samples\C "directory.
/* CMOS_Mem.c
* You
may want to programmatically determine the amount of physical memory installed in a computer. When the computer
runs under
* an
operating system that has virtual
memory or emulates other operating systems, you may not be able to determine
the amount of
*
installed memory from the APIs that
the particular operating system provides. In the case of 80x86-based
*
machines, you can obtain that information from the CMOS data.
*
*
"Reading" CMOS data isn't as simple as obtaining a pointer to
point to a particular memory location.
You must output values to an
*
I/O port and then read values
from another port. The Georgia SoftWorks Library functions "GS_inpb" and
"GS_outpb" can be
*
used to accomplish the goal under
Windows NT 4.0.
*
* The
procedure is straightforward: write values to I/O port 0x70 and read them from 0x71. The values 0x15 and 0x16 are
used to get
* the amount of base memory installed, while
0x17 and 0x18 are used to get the amount of expansion memory (up to 15360 kilobytes)
* installed. Expansion memory is memory above
the 1-MB boundary and should not be confused with expanded memory.
*/
#include
<windows.h>
#include
<conio.h>
#include
<stdio.h>
#include
"..\..\Interface\c\include\gs_ioman.h"
unsigned
short GetBaseMemC(void);
unsigned
short GetExpMemC(void);
void
main( void )
{
printf( "\nGetBaseMemC() returns
%u.\n", (unsigned int) GetBaseMemC() );
printf( "\nGetExpMemC() returns %u.\n", (unsigned int)
GetExpMemC() );
}
unsigned
short GetBaseMemC(void)
{
unsigned short base;
BOOL bRet;
GS_outpb( 0x70, 0x15 );
base = GS_inpb( 0x71, &bRet); //
retrieve low byte
GS_outpb( 0x70, 0x16 );
base += GS_inpb(0x71, &bRet) <<
8; // retrieve hi-byte,
// shift and add
to base
return base; // return K's of base memory
}
unsigned
short GetExpMemC(void)
{
// using run-time library functions
unsigned short extend;
BOOL bRet;
GS_outpb( 0x70, 0x17 );
extend = GS_inpb( 0x71, &bRet); //
retrieve low byte
GS_outpb( 0x70, 0x18 );
extend += GS_inpb(0x71, &bRet)
<< 8; // retrieve hi-byte,
// shift and add
to extend
return extend; // return K's of expansion
memory
}
A makefile is also contained in this directory.
The sample makefile is located in the
"C:\programfiles\Gerogia SoftWorks\IOBlaster\Dev\Samples\C "directory.
The contents look like:
PROJ
= cmos_mem
all:
$(PROJ).exe
#
Define project specific macros
PROJ_OBJS = $(PROJ).obj
EXTRA_LIBS
= ..\..\Interface\c\lib\gs_ioman.lib
$(PROJ).exe:
$(PROJ).c
cl $(PROJ).c $(EXTRA_LIBS)
To run the makefile type :
nmake
The results should looks something like:
Microsoft (R) Program Maintenance Utility Version
1.62.7022
Copyright (C) Microsoft Corp 1988-1997. All rights
reserverd.
Cl
cmos_mem.c ..\..\Interface\c\lib\gs_ioman.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler
Version 11.00.7022 for 80x86
Copyright (C) Microsoft Corp 1984-1997. All rights
reserved.
cmos_mem.c
Microsoft (R) 32-bit Incremental Linker Version
5.02.7132
Copyright (C) Microsoft Corp 1992-1997 All rights
reserved.
/out:cmos_mem.exe
..\..\Interface\c\lib\gs_ioman.lib
C:\Program Files\Georgia SoftWorks\IO
Blaster\Dev\Samples\C>
At
this point you can run the sample C program by typing
cmos_mem
And
the results should look similar to:
GetBaseMemC()
returns 640.
GetExpMemC()
returns 64512.
Now
you have compiled and ran a program utilizing the IOBlaster C functions.
The interfaces header file is Gs_ioman.txt located in the
C:\programfiles\Georgia SoftWorks\IOBlaster\Dev\Interface\VB directory.
' ------------------------------------------------------------------------
'
' GS_IOMAN.TXT -- I/O Blaster API Declarations for Visual Basic
'
' Copyright (C) 1998 Georgia SoftWorks
'
'
' This file contains Declare statements for I/O Blaster APIs.
'
'
' ------------------------------------------------------------------------
Declare Function GS_inpb Lib "GS_IoMan" (ByVal wPort As Integer, bSuccess As Long) As Byte
Declare Function GS_inpw Lib "GS_IoMan" (ByVal wPort As Integer, bSuccess As Long) As Integer
Declare Function GS_inpd Lib "GS_IoMan" (ByVal wPort As Integer, bSuccess As Long) As Long
Declare Function GS_outpb Lib "GS_IoMan" (ByVal wPort As Integer, ByVal byData As Byte) As Long
Declare Function GS_outpw Lib "GS_IoMan" (ByVal wPort As Integer, ByVal wData As Long) As Long
Declare Function GS_outpd Lib "GS_IoMan" (ByVal wPort As Integer, ByVal dwData As Long) As Long
The Visual Basic sample program creates a graphical interface that allows you to write data to ports and read data from ports. The interface looks like:
The Visual Basic Samples files Ioblast.vbw, Ioblast.vbp, Ioblast.frm are located in the.
C:\programfiles\Gerogia SoftWorks\IOBlaster\Dev\Samples\VB directory.
The Visual Basic sample project is Ioblast.vbp.
This is the code section. The graphical form and controls and should be viewed from the Visual Basic Development Environment.
Private
Declare Function GS_inpb Lib "GS_IoMan" (ByVal wPort As Integer, bSuccess
As Long) As Byte
Private
Declare Function GS_inpw Lib "GS_IoMan" (ByVal wPort As Integer,
bSuccess As Long) As Integer
Private
Declare Function GS_inpd Lib "GS_IoMan" (ByVal wPort As Integer,
bSuccess As Long) As Long
Private
Declare Function GS_outpb Lib "GS_IoMan" (ByVal wPort As Integer,
ByVal byData As Byte) As Long
Private
Declare Function GS_outpw Lib "GS_IoMan" (ByVal wPort As Integer,
ByVal wData As Long) As Long
Private
Declare Function GS_outpd Lib "GS_IoMan" (ByVal wPort As Integer,
ByVal dwData As Long) As Long
Private
Sub CmdGS_inpb_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
byData As Byte
wPort
= Val("&H" + BytePortR)
byData
= GS_inpb(wPort, bSuccess)
ByteResult
= Hex(byData)
If
(bSuccess = 1) Then
ReadStatus = "OK"
Else
ReadStatus = "ERROR"
End
If
End
Sub
Private
Sub CmdGS_inpw_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
wData As Integer
wPort
= Val("&H" + WordPortR)
wData
= GS_inpw(wPort, bSuccess)
WordResult
= Hex(wData)
If
(bSuccess = 1) Then
ReadStatus = "OK"
Else
ReadStatus = "ERROR"
End
If
End
Sub
Private
Sub CmdGS_inpd_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
dwData As Long
wPort
= Val("&H" + DWordPortR)
dwData
= GS_inpd(wPort, bSuccess)
DWordResult
= Hex(dwData)
If
(bSuccess = 1) Then
ReadStatus = "OK"
Else
ReadStatus = "ERROR"
End
If
End
Sub
Private
Sub CmdGS_outpb_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
byData As Byte
wPort
= Val("&H" + BytePortW)
byData
= Val("&H" + ByteData)
bSuccess
= GS_outpb(wPort, byData)
If
(bSuccess = 1) Then
WriteStatus = "OK"
Else
WriteStatus = "ERROR"
End
If
End
Sub
Private
Sub CmdGS_outpw_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
wData As Integer
wPort
= Val("&H" + WordPortW)
wData
= Val("&H" + WordData)
bSuccess
= GS_outpw(wPort, wData)
If
(bSuccess = 1) Then
WriteStatus = "OK"
Else
WriteStatus = "ERROR"
End
If
End
Sub
Private
Sub CmdGS_outpd_Click()
Dim
bSuccess As Long
Dim
wPort As Integer
Dim
dwData As Long
wPort
= Val("&H" + DWordPortW)
dwData
= Val("&H" + DWordData)
bSuccess
= GS_outpd(wPort, dwData)
If
(bSuccess = 1) Then
WriteStatus = "OK"
Else
WriteStatus = "ERROR"
End
If
End
Sub
Synopsis
C language
BYTE _stdcall GS_inpb(WORD
wPort, BOOL *pbSuccess);
Visual Basic
Declare Function GS_inpb Lib
"GS_IoMan" (ByVal wPort
As Integer, bSuccess As Long)
As Byte
Return Value
On success the
function returns data byte read from the port.
Arguments
wPort Port
number
pbSuccess Returns
success or failure
bSuccess Returns
success or failure
Remarks
The GS_inpb function reads a byte from the specified input port.
Synopsis
C language
WORD
_stdcall GS_inpw(WORD
wPort, BOOL *pbSuccess);
Visual Basic
Declare Function GS_inpw Lib
"GS_IoMan" (ByVal wPort As Integer, bSuccess As Long) As Integer
Return Value
On success the
function returns data word read from the port.
Arguments
wPort Port
number
pbSuccess Returns
success or failure
bSuccess Returns
success or failure
Remarks
The GS_inpw function reads a word from the specified input port.
Synopsis
C language
DWORD _stdcall GS_inpd(WORD wPort, BOOL *pbSuccess);
Visual Basic
Declare Function GS_inpd Lib
"GS_IoMan" (ByVal wPort
As Integer, bSuccess As Long) As Long
Return Value
On success the
function returns data double word read from the port.
Arguments
wPort Port
number
pbSuccess Returns
success or failure
bSuccess Returns
success or failure
Remarks
The GS_inpd function reads a double word from the specified input port.
Synopsis
C language
BOOL
_stdcall GS_outpb(WORD
wPort, BYTE byData);
Visual Basic
Declare Function GS_outpb Lib
"GS_IoMan" (ByVal wPort
As Integer, ByVal byData As Byte) As Long
Return Value
The function returns
TRUE if the write operation was successful, FALSE on failure.
Arguments
wPort Port
number
byData Data
byte to be written to the port
Remarks
The GS_outpb
function writes a byte to the
specified port.
Synopsis
C language
BOOL
_stdcall GS_outpw(WORD wPort, WORD wData);
Visual Basic
Declare Function GS_outpw Lib
"GS_IoMan" (ByVal wPort
As Integer, ByVal wData As Long) As Long
Return Value
The function returns
TRUE if the write operation was successful, FALSE on failure.
Arguments
wPort Port
number
wData Data
word to be written to the port
Remarks
The GS_outpw
function writes a word to the
specified port.
Synopsis
C language
BOOL
_stdcall GS_outpd(WORD
wPort, DWORD dwData);
Visual Basic
Declare Function GS_outpd Lib
"GS_IoMan" (ByVal wPort
As Integer, ByVal dwData As Long) As Long
Return Value
The function returns
TRUE if the write operation was successful, FALSE on failure.
Arguments
wPort Port
number
dwData Data
double word to be written to the port
Remarks
The GS_outpd
function writes a double word to
the specified port.
For Technical Support.
In order to keep Technical Support Free please help us to keep our cost down.
· Gather all relevant system information.
· Write your question down. This not only helps us but also helps you in articulating the question.
If the question is not an emergency, please use e-mail at support@georgiasoftworks.com. We try to respond within 24 hours.
Or Call 706.265.1018 EST, M-F 9:00 a.m. to 5:00 p.m. and have your serial number ready.