
Description | Cautions | Example | Errors
Name: |
int scx_gtbdattr(devh, pbrdst) | |
Inputs: |
int devh |
|
tSCX_BRDST *pbrdst |
| |
Returns: |
0 on success | |
Includes: |
scxlib.h | |
Category: |
Attribute | |
Mode: |
synchronous | |
The scx_gtbdattr( ) function gets board attributes of hardware and firmware information for a specific SCX160 SCxbus Adapter. The returned information is contained in the tSCX_BRDST data structure:
typedef struct {
unsigned char board_status;
unsigned char self_test_code;
unsigned char board_type;
} tSCX_BRDST;
Valid values for each member of this structure are defined in the scxlib.h header. The board status field contains a bitmap of the current status of the SCX160 SCxbus Adapter.
Parameter |
Description |
devh: |
Specifies the SCX160 SCxbus Adapter device handle |
pbrdst: |
Points to where the board attributes information is stored in the tSCX_BRDST data structure |
The possible values of the fields in the tSCX_BRDST data structure can be any combination of the following:
Parameter |
Description |
Bit(s) |
Possible Values |
SCXBS_SELF_TEST |
SCX160 Board Self Test Results |
1 |
|
SCXBS_DOWNLOAD |
SCX160 Board Download State |
2 |
|
SCXBS_RUN_STATE |
SCX160 Firmware Run State |
3 |
|
SCXBS_SCX_CLOCK_STATE |
SCxbus Clock State |
4 - 6 |
|
SCXBS_SC_CLOCK_STATE |
SCbus Clock State |
7 - 8 |
|
This function will fail if an invalid device handle is specified.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <srllib.h>
#include <scxlib.h>
const char *sc_state[] = {
"SC_MASTER",
"SC_WAIT_MASTER",
"SC_SLAVE",
"SC_FB_MASTER"
};
const char *scx_state[] = {
"SCX_MASTER",
"SCX_WAIT_SLAVE",
"SCX_SLAVE",
"SCX_WAIT_FB_MASTER",
"SCX_FB_MASTER",
"SCX_WAIT_MASTER",
"SCX_WAIT_FB_SLAVE"
};
int devh; /* SCX160 device handle */
tSCX_BRDST brdst; /* SCX160 Board Attribute Block */
/* Open SCX160 board */
if ((devh = scx_open("scxB1", 0)) == -1) {
printf("Cannot open board scxB1. errno = %d \n ", errno);
exit(1);
}
/* Get the SCX160 board attributes */
if (scx_gtbdattr(devh, &brdst) == -1) {
printf("ERROR: scx_gtbdattr( ) failed, %s \n", ATDV_ERRMSGP(devh));
exit(1);
}
printf("SCX Clock State is %s \n",
scx_state[((brdst.board_status & SCXBS_SCX_CLOCK_STATE) >> 3)]);
printf("SC Clock State is %s \n",
sc_state[((brdst.board_status & SCXBS_SC_CLOCK_STATE) >> 6)]);
/* Close the SCX160 Board */
scx_close(devh);
If the function returns -1, use the SRL Standard Attribute function ATDV_LASTERR( ) to obtain the error code, or you can use the ATDV_ERRMSGP( ) function to obtain a descriptive error message. The error codes returned by ATDV_LASTERR( ) function are listed in Chapter 7. Errors.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation