# adiGetBoardSlots32

Returns the MVIP timeslots
configured for the given board.

#### Supported board types

- AG

- CG

#### Prototype

DWORD adiGetBoardSlots32 ( CTAHD ctahd, unsigned board, unsigned mode, unsigned maxslot, ADI_TIMESLOT32 *slotlist, unsigned *numslots)

Argument | Description
ctahd | Context handle returned by ctaCreateContext or ctaAttachContext.
board | Board number as specified in the board keyword file.
mode | 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_TIMESLOT32 ;
numslots | Returned number of entries.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | slotlist is NULL but maxslot is not 0 (zero), or maxslot is 0 (zero) but slotlist is not NULL, or numslots is NULL, or invalid mode.
CTAERR_INVALID_BOARD | board does not exist.
CTAERR_INVALID_CTAHD | Context handle is invalid.
CTAERR_SVR_COMM | Server communication error.

#### Details

Use adiGetBoardSlots32 to query the available MVIP stream:slot pairs configured for a given board.

The ctahd argument is used to access the context on which the ADI service was opened. The ADI service can be opened in driver-only mode if desired. In this case, no actual board resources are reserved. Set the board field in the MVIP_ADDR structure passed to ctaOpenServices to ADI_AG_DRIVER_ONLY. This function also works with a context that has the ADI service opened on actual MVIP streams and timeslots.

If mode is 0 (zero), the slots returned are the DSP
addresses that correspond to actual trunks, whether or not they are actually connected.

For example, if an AG 2000 board is partially populated, only the slots that contain line interfaces are returned.

Note: The DSPs are automatically connected to the trunk if the telephony bus is not enabled.

If mode is not 0 (zero), the function returns only those streams capable of supporting the given mode. The base stream for the given mode is returned in the ADI_TIMESLOT32 stream field.

Examples:

- For an AG 2000 board, stream 18 is voice and stream 19 is signaling. If adiGetBoardSlots32 is invoked with mode set to ADI_FULL_DUPLEX, the function returns an array of eight ADI_TIMESLOT32 structures, each with the stream field set to 18 (18:0..7).

- For an AG 2000 board, stream 18 is voice and stream 19 is signaling. If adiGetBoardSlots32 is invoked with mode set to ADI_VOICE_DUPLEX, the function returns an array of 16 ADI_TIMESLOT32 structures, each with the stream field set to 18 or 19 (18:0..7, 19:0..7).

For details on MVIP addressing, refer to the Switching Service Developer's Reference Manual.

The maxslot argument is the number of ADI_TIMESLOT32 instances in the application supplied slotlist array. The ADI service returns the number of ADI_TIMESLOT32 instances written to the slotlist in the numslots variable. This value is in the range 0 (zero) to maxslot inclusive.

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

adiGetBoardSlots32 can be used with adiGetBoardInfo to dynamically configure an application's contexts. ctaOpenServices is called with a board number and MVIP stream:slot to open the ADI service. The application can retrieve a complete list of configured stream:slot pairs for any board with adiGetBoardSlots32.

#### Example

#define MAX_SLOTS 480
void myShowBoardSlots( CTAHD ctahd, unsigned board )
{
ADI_TIMESLOT32 slotlist [MAX_SLOTS]; /* Returned array of timeslots */
int ret;
unsigned stream, slot1, slot2, prevslot, numslots;
/* Read the MVIP configuration for the board. */
ret = adiGetBoardSlots32( ctahd, board, ADI_VOICE_DUPLEX, MAX_SLOTS, slotlist, &numslots );
if( ret == SUCCESS )
{
/* The ADI_TIMESLOT32 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 );
}