(Page 14 of 80 in this chapter)
adiGetBoardSlots
Description
- Returns the MVIP timeslots configured for the given board.
Prototype
- DWORD adiGetBoardSlots( unsigned drvid,
unsigned board,
unsigned mode,
unsigned maxslot,
ADI_TIMESLOT *slotlist,
unsigned *numslots )
- drvid Driver ID returned from adiOpenDriver
- board AG board number as configured by agmon.
- mode Specifies stream capability, which can be either ADI_FULL_DUPLEX (both voice and signaling streams) or ADI_VOICE_DUPLEX (voice only).
- maxslot Maximum number of entries in slotlist array.
- slotlist Pointer to the ADI_TIMESLOT array, defined as:
typedef struct
{
BYTE stream ;
BYTE slot ;
} ADI_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 drvid argument is used to access the AG driver.
- The function returns only those streams capable of supporting the given mode. The base stream for the given mode is returned in the ADI_TIMESLOT stream field.
- Examples:
- For the AG-8, stream 18 is voice and stream 19 is
signaling. If adiGetBoardSlots is invoked with mode set
to ADI_VOICE_DUPLEX, the function returns an array of
16 ADI_TIMESLOT structures each with the stream field
set to 18 or 19 (18:0..7, 19:0..7).
- An AG-30 can be configured such that only streams 2
and 6 are nailed-up to the MVIP bus. If
adiGetBoardSlots is invoked with mode set to
ADI_FULL_DUPLEX, the function returns an array of
zero ADI_TIMESLOT structures. This is because the full
duplex mode requires that two adjacent streams be active
for ADI_FULL_DUPLEX mapping.
- For details concerning MVIP addressing, refer to the AG Access Developer's Manual.
- The maxslot argument is the number of ADI_TIMESLOTs in the application supplied slotlist array. AG Access returns the number of ADI_TIMESLOTs written to the slotlist in the numslots variable. This value will be in the range zero to maxslot inclusive.
Note: adiGetBoardSlots can be used in conjunction with adiGetBoardInfo to dynamically configure an application's contexts. adiOpenPort is called with a board number and MVIP stream:slot. The application can retrieve a complete list of configured stream:slot pairs for any AG board with the adiGetBoardSlots function.
See Also
- adiOpenPort
Example
#define MAX_SLOTS 256
void myShowBoardSlots( unsigned drvid, unsigned board )
{
ADI_TIMESLOT slotlist [MAX_SLOTS]; /* Returned array of timeslots */
int ret;
unsigned stream, slot1, slot2, prevslot, numslots;
/* Read the MVIP configuration for the board. */
ret = adiGetBoardSlots( drvid, board, ADI_VOICE_DUPLEX,
MAX_SLOTS, slotlist, &numslots );
if( ret == SUCCESS )
{
/* The ADI_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 14 of 80 in this chapter)
Tech_Support@nmss.com
Copyright © 1996, Natural MicroSystems, Inc. All rights
reserved.