(Page 13 of 80 in this chapter)


adiGetBoardInfo

Description

Obtains information about an AG board.

Prototype

DWORD adiGetBoardInfo( unsigned drvid ,
unsigned board,
unsigned size,
ADI_BOARD_INFO *boardinfo )

drvid Driver ID returned from adiOpenDriver

board AG board number as configured by agmon.

size Size of boardinfo structure.

boardinfo Pointer to the ADI_BOARD_INFO structure, as shown:

typedef struct
{
DWORD size; /* Size of this structure */
DWORD boardtype; /* Physical board type ADI_BOARDTYPE_xxx */
DWORD serial; /* Serial number */
DWORD ioaddr; /* Base IO address */
DWORD intnum; /* Interrupt number */
DWORD bufsize; /* Buffer size */
DWORD freemem; /* Available memory */
BYTE daughterboardid[4] ; /* Daughterboard IDs 0 = none */
} ADI_BOARD_INFO;

Return Values

Events

None.

Details

This function retrieves hardware configuration data for the specified AG board.

The board argument identifies a particular AG board. This identifier must correlate to a board ID in the AG configuration file. Refer to the AG configuration file keyword "Board" in the AG Access Installation Manual.

The valid ADI_BOARD_INFO boardtype values are listed in the adidef.h file and include:

The drvid argument is used to access the AG driver.

The size argument indicates how much memory to write at boardinfo address. AG Access stores the actual number of bytes written in the ADI_BOARD_INFO size field.

Example


void myShowBoardType( unsigned drvid, unsigned board )
{
    ADI_BOARD_INFO boardinfo;
    char          *type;
    unsigned       b_ports;
    int            ret;

    ret = adiGetBoardInfo( drvid, board, sizeof boardinfo, &boardinfo );

    if( ret == SUCCESS )
    {
        switch( boardinfo.boardtype )
        {
            case ADI_BOARDTYPE_AG24    : type="AG-24";   b_ports=24; break;
            case ADI_BOARDTYPE_AG24PLUS: type="AG-24+";  b_ports=24; break;
            case ADI_BOARDTYPE_AG30    : type="AG-30";   b_ports=30; break;
            case ADI_BOARDTYPE_AG48    : type="AG-48";   b_ports=48; break;
            case ADI_BOARDTYPE_AG60    : type="AG-60";   b_ports=60; break;
            case ADI_BOARDTYPE_AG8     : type="AG-8";    b_ports= 8; break;
            case ADI_BOARDTYPE_AG8_80  : type="AG-8 80"; b_ports= 8; break;
            case ADI_BOARDTYPE_T1      : type="AG-T1";   b_ports=24; break;
            case ADI_BOARDTYPE_E1      : type="AG-E1";   b_ports=30; break;
            default:
            case ADI_BOARDTYPE_UNKNOWN : type="Unknown"; b_ports=0;  break;
        }
        printf( "board:%2d at addr:%4x is an %-7s with %3d ports.\n",
                board, boardinfo.ioaddr, type, b_ports );
    }
    else if( ret == CTAERR_INVALID_BOARD )
        printf( "There is no board # %d.\n", board );
    else
        /* unexpected error */
        printf( "Error %x  getting board # %d information.\n", ret, board );
}




(Page 13 of 80 in this chapter)


Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights reserved.