(Page 23 of 80 in this chapter)
typedef struct
{ /* Describes the fields */
char structname[40]; /* name of the structure */
char fieldname[40]; /* name of the field */
DWORD offset; /* byte offset from the base */
DWORD size; /* size of the field */
DWORD format; /* format type */
DWORD units; /* units type */
} ADI_PARM_INFO;
void myShowParmInfo( char *parmname )
{
ADI_PARM_INFO info;
BYTE temp[100]; /* temp storage for parm value */
union
{
WORD w;
DWORD W;
INT16 i;
INT32 I;
char s[80];
} *pdata =( void* ) temp;
char *punits;
if( adiGetParmInfo( 0, parmname, 0, &info ) != SUCCESS
|| adiGetParmByName( parmname, &temp, sizeof temp ) != SUCCESS )
{
/* display error */
return;
}
switch( info.units )
{
case ADI_UNITS_INTERNAL: punits = "Internal"; break;
case ADI_UNITS_INTEGER : punits = "Integer"; break;
case ADI_UNITS_COUNT : punits = "Count"; break;
case ADI_UNITS_MASK : punits = "Mask"; break;
case ADI_UNITS_HZ : punits = "Hz"; break;
case ADI_UNITS_MS : punits = "ms"; break;
case ADI_UNITS_DB : punits = "dB"; break;
case ADI_UNITS_DBM : punits = "dBm"; break;
case ADI_UNITS_IDU : punits = "Internal DSP"; break;
case ADI_UNITS_STRING : punits = "String"; break;
case ADI_UNITS_PERCENT : punits = "Percent"; break;
default : punits = "Undefined"; break;
}
switch( info.format )
{
case ADI_FMT_WORD:
printf( "%s.%-20s = %5u\t\t# (0x%04x) WORD (%s)\n",
info.structname, info.fieldname, pdata->w, pdata->w, punits );
break;
case ADI_FMT_DWORD:
printf( "%s.%-20s = %5u\t\t# (0x%04x) DWORD (%s)\n",
info.structname, info.fieldname, pdata->W, pdata->W, punits );
break;
case ADI_FMT_INT16:
printf( "%s.%-20s = %5d\t\t# (0x%04x) INT16 (%s)\n",
info.structname, info.fieldname, pdata->i, pdata->i, punits );
break;
case ADI_FMT_INT32:
printf( "%s.%-20s = %5d\t\t# (0x%04x) INT32 (%s)\n",
info.structname, info.fieldname, pdata->I, pdata->I, punits );
break;
case ADI_FMT_STRING:
printf( "%s.%-20s = \"%s\"\t\t# STRING[%d]\n",
info.structname, info.fieldname, pdata->s, info.size );
break;
default:
printf( "Error! Unknown data type: '%c'\n",
info.format );
break;
}
return;
}
(Page 23 of 80 in this chapter)