(Page 6 of 15 in this chapter) Version


briGetBoardSlots

Description

Returns the MVIP timeslots configured for the given board.

Prototype

DWORD briGetBoardSlots ( CTAHD ctahd,
unsigned board,
unsigned mode,
unsigned maxslot,
BRI_TIMESLOT *slotlist,
unsigned *numslots )

ctahd CTA context handle returned by ctaCreateContext.

board BX 2000 board number.

mode Must be zero (0).

maxslot Maximum number of entries in slotlist array.

slotlist Pointer to the BRI_TIMESLOT array, defined as:

typedef struct
{
       BYTE  stream ;
       BYTE  slot ;
} BRI_TIMESLOT ;

 

numslots Returned number of entries.

Return Values

Events

None.

Details

This function queries the available MVIP stream:slot pairs configured for a given board.

The ctahd argument is used to access the CTA context on which the BRI service was opened.

The slots returned are the addresses that correspond to the actual BRI ports. For details concerning MVIP addressing, refer to the Switching Service Developer's Reference Manual and Getting Started With MVIP.

The maxslot argument is the number of BRI_TIMESLOTs in the application supplied slotlist array. The BRI service returns the number of BRI_TIMESLOTs written to the slotlist in the numslots variable. This value will be in the range zero to maxslot inclusive.

Note: If maxslot is zero and slotlist is NULL, numslots returns the actual number of slots without copying any data.

briGetBoardSlots can be used in conjunction with briGetBoardInfo to dynamically configure an application's contexts. ctaOpenServices is called with a board number and MVIP stream:slot to open the BRI service. The application can retrieve a complete list of configured stream:slot pairs for a BX 2000 board with briGetBoardSlots.

Example


#define MAX_SLOTS 256
void myShowBoardSlots( CTAHD ctahd, unsigned board )
{
    BRI_TIMESLOT slotlist [MAX_SLOTS];  /* Returned array of timeslots */
    int ret;
    unsigned stream, slot1, slot2, prevslot, numslots;

    /* Read the MVIP configuration for the board. */
    ret = briGetBoardSlots( ctahd, board, 0,
                            MAX_SLOTS, slotlist, &numslots );
    if( ret == SUCCESS )
    {
        /* The BRI_TIMESLOT information contains 'stream:slot' pairs.
         * Print the information as 'stream:slot0..slotN' ranges.
   */
        unsigned i = 0;
        while( i < numslots )
        {
            /* store stream and starting slot */
            stream = slotlist[i].stream;
            slot1  = slotlist[i].slot;
            prevslot = slot1;

            while( ++i < numslots &&             /* find ending slot */
                   slotlist[i].stream == stream &&
                   slotlist[i].slot   == prevslot+1 )
                prevslot++;
            slot2 = slotlist[i-1].slot;          /* store ending slot */

            printf( "%2d:%d", stream, slot1 );
            if( slot2 != slot1 ) printf("..%d", slot2 );
            puts( "" );
        }
    }
    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 6 of 15 in this chapter) Version


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