
Description | Example | Example
Name: |
int glHWDetect ( glSystem *glSys, glBoardSystem *glBdSys, int reserve2) | |
Inputs: |
glSystem *glSys |
|
|
glBoardSystem *glBdSys |
|
int reserve2 |
| |
Outputs: |
glSystem *glSys |
|
glBoardSystem *glBdSys |
| |
Returns: |
GL_HWCONFIG_SUCCESS |
|
GL_HWDETECT_IN_PROGRESS |
| |
GL_SERVICE_RUNNING |
| |
GL_SYSTEM_NULL_PTR |
| |
GL_SYSTEM_CHANNEL_ |
| |
GL_HWDRIVER_FAIL |
| |
GL_HWDETECT_FAIL |
| |
|
GL_SYSTEM_MALLOCFAILED |
|
Includes: |
gfdboard.h |
|
The glHWDetect( ) function provides information about the CP Fax hardware installed in the system. This function blocks while checking a limited area of I/O space for the presence of CP Fax channels. Upon completion, the GDK System Service dependency list is updated to depend on the bus types detected in the system.
If the GDK service is not installed, glHWDetect will not return an error.
The glSystem data structure, unchanged from GDK 3.0, provides information about all working channels in the system. If this information is not desired, the first parameter may be NULL.
The glBoardSystem data structure, provides board-level resources and additional channel attributes. If this information is not desired, the second parameter may be NULL.
The following are examples of valid calling conventions:
... glSystem glSys; glBoardSystem glBoard; int retVal; retVal = glHWDetect( &glSys, NULL, 0 ); // unchanged retVal = glHWDetect( NULL, &glBoard, 0 ); // new usage retVal = glHWDetect( &glSys, &glBoard, 0 ); // new usage ...
The glSystem and glBoardSystem data structures are defined in the include file gfdboard.h. More information about these structures follow:
glSystem
This structure contains identification information about the CP Fax Isa and Pci fax channels installed in the system.
struct _channel {
union {
int PortAddress; //ISA only
int BoardNumber; //PCI only
}parm1;
union {
int PhysicalChannel; //ISA only
int ChannelOffset; //PCI only
}parm2;
enum _bustype BusType;
int BoardType; //type of fax channel
};
typedef struct _channel CHAN;
struct system {
CHAN Channel_ID[MAX_CHANNELS]; //length is numchan + numBRI
int numchan;
int numBRI;
};
typedef struct system glSystem;
The glSystem structure has three fields; numchan, numBRI, and Channel_ID. The total of numchan and numBRI describe the number of valid elements in the Channel_ID array. The Channel_ID array elements contains channel specific information for each fax channel detected in the system.
Channel_ID elements [0 to numchan-1] describe fax channels; and elements [numchan to (numchan + numBRI) - 1] describe BRI controller cells.
Each Channel_ID element, CHAN, contains two union fields: parm1 and parm2. The valid fields within parm1 and parm2 are determined by the value of the BusType field as shown in the following chart.
BusType Value |
Valid Parm Fields |
gl_ISA |
parm1.PortAddress |
parm2.PhysicalChannel | |
gl_PCI |
parm1.BoardNumber |
parm2.ChannelOffset |
The CHAN.BoardType member describes the model of the fax channel. This value is usually the same as the board model.
glBoardSystem
This structure contains detailed identification information about the CP Fax ISA and PCI fax boards and channels installed in the system.
typedef struct {
unsigned char BoardType : 4;
unsigned char : 1;
unsigned char BoardRevision : 2;
unsigned char HasPollingBit : 1;
} BoardInfo_t;
typedef struct {
unsigned short CountryCode : 10;
unsigned short : 6;
} BoardModel_t;
typedef struct {
unsigned char ModemType : 4;
unsigned char NetworkIf : 4;
} ModemInfo_t;
typedef struct {
unsigned short Minor : 8;
unsigned short Major : 8;
} RomVersion_t;
typedef struct {
BoardInfo_t BoardInfo;
ModemInfo_t ModemInfo;
unsigned short OemStamp;
unsigned char CpuSpeed;
unsigned char Spare;
BoardModel_t BoardModel;
RomVersion_t RomVersion;
char RomVersionString[21];
unsigned char RomPersonality;
} RomId_t;
typedef enum _channelstate { gl_NotPresent, gl_Present };
typedef struct _channelex {
int glSystemChanIndex;
union {
struct {
int PortAddress; // ISA only
int PhysicalChannel; // ISA only
} isa;
struct {
int BoardNumber; // PCI only
int ChannelOffset; // PCI only
} pci;
} bus;
int BoardType;
RomId_t RomId;
enum _channelstate State;
} Channel_t;
typedef struct _glResource {
union {
struct {
int SHPortAddress;
int BRIPortAddress;
int BRIPhysicalChannel;
} isa;
} bus;
} GLResource_t;
typedef struct _board {
int BoardModel;
int CountryModel;
Channel_t ChanList[MAX_CHANNELS_PER_BOARD];
int NumChanCount;
int BadChanCount;
GLResource_t Resource;
enum _bustype BusType;
} Board_t;
typedef struct _boardsystem {
int numBoard;
Board_t BoardID[MAX_BOARDS];
} glBoardSystem;
The glBoardSystem structure contains two data members, numBoard and BoardID. The value of numBoard describes the number of valid elements in the BoardID array. Each CP Fax physical hardware entity is represented by a BoardID element. For example, the CP4/LSI, a 4-channel analog board, is represented by one BoardID element.
The fields in BoardID represent board level information.
Board_t Fields |
Description |
BoardModel |
Descriptive name of board. This value is usually the same as the value for Channel_t.BoardType, with the exception of CPD/220. |
CountryModel |
Country code retrieved from ROM that the board was certified for. If ROM does not contain this information, this value is zero. |
ChanList |
List of fax channels associated with physical board. |
NumChanCount |
The number of valid ChanList elements. It represents the total number of fax channels expected for BoardModel, i.e. a CP4/LSI is always exected to have four fax channels. |
BadChanCount |
The number of undetectable fax channels for BoardModel. The range of this value is [0..NumChanCount]. |
Resource |
Shared resource used by fax channels. |
BusType |
PC Bus interface type of BoardModel. Supported values are gl_ISA or gl_PCI. |
The fields in BoardID.Resource represent board level resources, shared by the associated fax channels specified in the ChanList array.
Resource_t Fields |
Description |
bus.isa.SHPortAddress |
I/O address of SC2000 resource, -1 if the resource does not exist. |
bus.isa.BRIPortAddress |
I/O address of BRI controller resource, -1 if the resource does not exist. |
bus.isa.BRIPhysicalChannel |
Physical channel of BRI controller resource, -1 if the resource does not exist. |
The fields in BoardID.ChanList represent a fax channel.
Channel_t fields |
Description |
glSystemChanIndex |
Zero-based index to glSystem structure. Value is -1 if the channel is not detected, i.e. State is gl_NotPresent. |
bus.isa.PortAddress |
For BoardID.BusType equal to gl_ISA, I/O address of ISA fax channel. |
bus.isa.PhysicalChannel |
For BoardID.BusType equal to gl_ISA, physical channel of ISA fax channel. |
bus.pci.BoardNumber |
For BoardID.BusType equal to gl_PCI, board id of PCI fax channel. |
bus.pci.ChannelOffset |
For BoardID.BusType equal to gl_PCI, PCI channel associated with board id. |
BoardType |
Name of fax channel; it may be different from BoardID.BoardModel |
RomId |
Raw identification information retrieved from fax channel's EPROM. |
State |
Indicates the fax channel's physical status. If the channel was detectable, the State is gl_Present, if not, the State is gl_NotPresent. |
The fields in BoardID.ChanList.RomId represent the electronic signature of a fax channel.
RomId_t fields |
Description |
BoardInfo |
Name of channel's board family and revision level. |
ModemInfo |
Identifies modem speed (i.e. 9600, 14400, etc.) and network interface type (i.e. digital or analog). |
OemStamp |
Value is always zero. |
CpuSpeed |
Speed of on-board processor. |
Spare |
Reserved. |
BoardModel |
Country code that board was certified for. |
RomVersion |
Version of Rom. |
RomVersionString |
Descriptive string containing version of Rom. |
RomPersonality |
Designates programmability of channel (i.e. toolkit vs. standard). |
#include <gfdboard.h>
void main( void )
{
glSystem glSys = { 0 };
glBoardSystem glBdSys = { 0 };
int board = 0, chan = 0;
int maxchan = 0;
int retVal = 0;
retVal = glHWDetect( &glSys, &glBdSys, 0 );
if ( retVal == GL_HWCONFIG_SUCCESS )
{
// GLSYSTEM
printf( "From glSystem structure:\n" );
printf( "Detected %d fax channels and %d BRI resources.\n",
glSys.numchan, glSys.numBRI );
maxchan = glSys.numchan + glSys.numBRI;
for ( chan = 0; chan < maxchan; ++chan )
{
if ( gl_ISA == glSys.Channel_ID[chan].BusType )
{
printf( "Found Isa channel at PortAddress 0x%03x
(%d)\n", glSys.Channel_ID[chan].parm1.PortAddress,
glSys.Channel_ID[chan].parm2.PhysicalChannel );
}
else if ( gl_PCI == glSys.Channel_ID[chan].BusType )
{
printf( "Found Pci channel at Board:%X Channel:%d\n",
glSys.Channel_ID[chan].parm1.BoardNumber,
glSys.Channel_ID[chan].parm2.ChannelOffset );
}
else
printf( "Unknown BusType %d\n", glSys.Channel_ID[chan].BusType );
}// end glSys channel loop
// GLBOARDSYSTEM
printf( "\nFrom glBoardSystem structure:\n" );
printf( "Detected %d boards.\n", glBdSys.numBoard );
// loop for board information
for ( board = 0; board < glBdSys.numBoard; ++board )
{
printf( "\nBoard %d - CountryModel is %d\n",
board + 1, glBdSys.BoardID[board].CountryModel );
// loop for channel information
for ( chan = 0; chan < glBdSys.BoardID[board].NumChanCount; ++chan )
{
if ( gl_ISA == glBdSys.BoardID[board].BusType )
{
printf( "Channel at PortAddress 0x%03x (%d) is %s.\n", glBdSys.BoardID[board].ChanList[chan].bus.isa.PortAddress,
glBdSys.BoardID[board].ChanList[chan].bus.isa.PhysicalChannel,
( gl_Present == glBdSys.BoardID[board].ChanList[chan].State
? "Present" : "Not Present" ) );
}
else if ( gl_PCI == glBdSys.BoardID[board].BusType )
{
printf( "Channel at Board:%X Channel:%d is %s.\n",
glBdSys.BoardID[board].ChanList[chan].bus.pci.BoardNumber,
glBdSys.BoardID[board].ChanList[chan].bus.pci.ChannelOffset,
( gl_Present == glBdSys.BoardID[board].ChanList[chan].State
? "Present" : "Not Present" ) );
}
else
printf( "Unknown BusType %d\n",
glBdSys.BoardID[board].BusType );
}// end glBdSys channel loop
}// end glBdSys board loop
}// end if glHWDetect successful
else {
printf( "glHWDetect failed, error %d\n", retVal );
}
}
Click here to contact Dialogic Customer Engineering
Copyright 2000, Dialogic Corporation