Download C/C++ Communication API - Electronic Systems Group

Transcript
FUSE C/C++ API Developers Guide
#include <dimesdl.h> //This is held in the include directory
within FUSE.
#include <stdio.h>
int main(int argc, char* argv[])
{
LOCATE_HANDLE hLocate;
DWORD NumOfCards,LoopCntr;
//Locate the Cards on the PCI interface
hLocate=DIME_LocateCard(dlPCI,mbtALL,NULL,dldrDEFAULT,dlDEFAULT);
//Determine how many Nallatech cards have been found.
NumOfCards = DIME_LocateStatus(hLocate,0,dlNUMCARDS);
printf("%d Nallatech card(s) found.\n", NumOfCards);
//Get the details for each card detected.
for (LoopCntr=1; LoopCntr<=NumOfCards; LoopCntr++){
printf("Details of card number %d, of %d:\n",LoopCntr,NumOfCards);
printf("\tThe card driver for this card is a%s.\n",
(char*)DIME_LocateStatusPtr(hLocate,LoopCntr,
dlDESCRIPTION));
printf("\tThe cards motherboard type is %d.\n",
DIME_LocateStatus(hLocate,LoopCntr,dlMBTYPE));
}
//Finally close the locate down.
DIME_CloseLocate(hLocate);
return 0;
}
Figure 7: Getting information on the located cards
7.47
DIME_LocateStatusPtr
Syntax
void* DIME_LocateStatusPtr(LOCATE_HANDLE handle, DWORD CardNumber,
DWORD CmdMode)
Arguments
handle is a valid locate handle.
CardNumber is the selected cards index. This can be NULL for certain command
modes.
CmdMode is the command mode for the status function. This is used to specify what
particular piece of information is required. The table below gives details for the
CmdMode argument.
CmdMode
Description
dlDESCRIPTION
This returns a pointer of type CHAR to a string that is a short description
of the software driver for the chosen card.
Table 30: DIME_LocateStatusPtr CmdMode argument options
62
Return
See table above since the return dependant on CmdMode.
Description
This function is used by the developer upon a successful return from a
DIME_LocateCard function call to gather information on what has been located. This
is normally required for systems that contain multiple cards over various interfaces.
This information is then used to ensure that the desired card is opened and interfaced
with.
Notes
Copy the string into your own programs memory space immediately after the function
returns since the pointer may only be valid until the next call into the library.
Example
See Figure 7: Getting information on the located cards
www.nallatech.com
NT107-0068 Issue 4 19-05-2003