|
|
SVR5 MDI drivers define parameters that can be modified by users through CUSTOM variables coded in their bcfg(DSP/4dsp) files rather than in their Space.c(DSP/4dsp) and space.h files. Drivers should be coded to access this information according to the following guidelines:
CUSTOM_NUM=1The foo driver's _load(D2mdi) entry point routine should include code such as the following:CUSTOM[1]=' CABLE_TYPE 1 0 0 AUI BNC TP Cable Type ...
char cable_str[64]; struct cm_args cm_args; unsigned int foo_nunit;foo_nunit = cm_getnbrd("foo"); if (foo_nunit == 0) { cmn_err(CE_WARN, "fooinit: can't find foo in resmgr"); return(ENODEV); }
for (i = 0; i < foo_nunit; i++) { cm_args.cm_key = cm_getbrdkey("foo", i); cm_args.cm_n = 0; cm_args.cm_param = "CABLE_TYPE"; cm_args.cm_val = cable_str; cm_args.cm_vallen = sizeof(cable_str); if (ret = cm_getval(&cm_args)) { if (ret != ENOENT) cmn_err(CE_CONT, "fooinit: cm_getval(CABLE_TYPE) failed\n"); continue; } else { switch(cable_str[0]) { case '0': foodev[i].xcvr = 0; break; case '1': foodev[i].xcvr = 1; break; default: cmn_err (CE_CONT, "fooinit: board %d has unknown CABLE_TYPE %s in resmgr\n", i, cable_str); continue; } } ...retrieve other parameters... }