(Page 3 of 14 in this chapter)


agmCheckConfig

Description

Checks the configuration file for internal consistency, and for consistency with the hardware present.

Prototype

DWORD agmCheckConfig ( AGMHD agmhd,
DWORD *boardmask,
AGM_FILE_INFO *fileinfo)

agmhd Handle returned by agmOpen.

boardmask Pointer to a returned bitmask.

fileinfo Pointer to a structure to receive information about the files used in the configuration. AGM_FILE_INFO is defined as:


typedef struct
{
int count ;
struct AGM_FILE_STATS
{
BOOL found ;
char spec[AGM_MAX_FILESPEC] ;
DWORD size ;
char date[50] ;
} file[AGM_MAX_FILES] ;
} AGM_FILE_INFO ;

Return Values

Details

This function checks the configuration file information against the hardware present on the system. agmCheckConfig probes the hardware and makes additions to the configuration information in the context, if necessary.

agmCheckConfig can only be called after the AG device driver has been loaded and opened by agmLoadDriver and agmOpenDriver.

The boardmask argument is a pointer to a returned bitmask used to indicate which boards have valid configurations. The nth bit (i.e. (*boardmask & (1<<n))) is set if a valid configuration was found for board n.

The AGM_FILE_INFO structure has the following fields:

Field

Description

count

The number of files.

file[]

A data structure for each file.

The AGM_FILE_STATS structure has the following fields:

Field

Description

found

TRUE if the file was found.

spec

The pathname of the file.

size

The size of the file in bytes.

date

The file's timestamp, in text form.

See Also

agmLoadDriver, agmOpen, agmOpenDriver

Example


int main (int argc, char **argv)
{
AGMHD agmhd;
DWORD boardmask;
AGM_FILE_INFO fileinfo;
DWORD ret;
int n;

/* Open AGM Handle */
...

/* Load AG Device Drivers, Open AG Device Drivers */
...

/* Check AG configuration file against installed hardware */
ret = agmCheckConfig (agmhd, &boardmask, &fileinfo);

for (n=0; n<AGM_MAX_BOARDS; n++)
if (boardmask & (1<<n))
printf ("Board %d checked out.\n", n);

for (n=0; n<fileinfo.count; n++)
{
if (fileinfo.file[n].found)
printf ("File found: %s\n", fileinfo.file[n].spec);
else
printf ("File not found: %s\n", fileinfo.file[n].spec);
}

if (ret != SUCCESS)
{
puts ("agmCheckConfig failed.");
exit (-1);
}

/* Boot and download boards, etc. */
...
}


(Page 3 of 14 in this chapter)


tech_support@nmss.com
Copyright © 1998, Natural MicroSystems, Inc. All rights reserved.