ms_getbrdparm( )
Cautions | Errors | Example | See Also
Name: int ms_getbrdparm (devh, param, valuep) Inputs:
Returns: Includes: Category: Mode: Platform: Description
The ms_getbrdparm( ) function returns board parameters. Each parameter has a symbolic name that is defined in dtilib.h and msilib.h.
devh valid device handle returned by a call to ms_open( ) param parameter to be examined; see the ms_setbrdparm( ) function description for details. Note: On DM3 boards, only MSG_RNG is supported for this function. valuep pointer to the variable where the parameter value will be returned Cautions
- The value of the parameter returned by this function is an integer. valuep is the address of an integer, but should be cast as a void pointer when passed in the value field.
- This function fails when:
Errors
If this function returns -1 to indicate failure, obtain the reason for the error by calling the SRL standard attribute function ATDV_LASTERR( ) or ATDV_ERRMSGP( ) to retrieve either the error code or a pointer to the error description, respectively.
Refer to the error type tables found in Chapter 5, "Error Codes". Error defines can be found in dtilib.h or msilib.h.
Example
#include <windows.h> /* For Windows applications only */ #include <errno.h> #include "srllib.h" #include "dtilib.h" #include "msilib.h" main() { int devh; /* MSI/SC board device descriptor */ int value; /* Parameter value */ int cadence[8]; /* Ring cadence length and pattern */ int cadence_len; /* Cadence active period length (in bytes) */ if ((devh = ms_open("msiB1", 0)) == -1) { printf("Error opening msiB1 : errno = %d\n", errno); exit(1); } /* Determine board type : Ringing or Non-ringing */ if (ms_getbrdparm(devh, MSG_RING, (void *)&value)) == -1) { printf("Error retrieving board parameter : %s\n ", ATDV_ERRMSGP(devh)); exit(1); } if (value == MS_RNGBRD){ printf("You have a ringing MSI/SC board\n"); } else printf("You have a non-ringing MSI/SC board\n"); /* Retrieve the board's ring-cadence pattern */ if (ms_getbrdparm(devh, MSG_RNGCAD, (void *)&cadence[0]))== -1) { printf("Error retrieving board parameter : %s\n ", ATDV_ERRMSGP(devh)); exit(1); } printf("The ring cadence is %d x 250ms long\n", cadence[0]); cadence_len = (cadence[0]+7)/8; for (index = 1; index <= cadence_len; index++) { printf("Active period cadence pattern is 0x%x\n", cadence[index]); } if (ms_close(devh) == -1) { printf("Error Closing msiB1 : errno = %d\n", errno); exit(1); } return; }See Also
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation