/************************ END OF SPECIFICATIONS ***********************/ static BOOL RegisterUSBD(void) { APIRET rc=RMRC_SUCCESS; UCHAR ResourceBuf[ 12 ]; ADJUNCT AdjAdaptNum; PAHRESOURCE pResourceList = (PAHRESOURCE)ResourceBuf; rc=RMCreateDriver( &gDriverStruct, &ghDriver); if (rc==RMRC_SUCCESS) { pResourceList->NumResource = 0; gAdapterStruct.HostBusType = AS_HOSTBUS_PCI; AdjAdaptNum.pNextAdj = NULL; AdjAdaptNum.AdjLength = sizeof(ADJUNCT); AdjAdaptNum.AdjType = ADJ_ADAPTER_NUMBER; AdjAdaptNum.Adapter_Number = 0; gAdapterStruct.pAdjunctList = &AdjAdaptNum; rc=RMCreateAdapter(ghDriver, &ghAdapter, &gAdapterStruct, NULL, pResourceList); } return (rc==RMRC_SUCCESS); }
/**@internal _rmCreateAdapter * Create the "adapter" node. The "adapter" node belongs to this driver's * "driver" node. Also as part of this operation, the "resource" nodes * associated with this driver will be moved to the "adapter" node. * @param None. * @notes Changes state of the RM object to 'rmAdapterCreated'. * @return APIRET rc - 0 iff good creation. Returns non-zero and logs a soft * error on failure. */ APIRET ResourceManager::_rmCreateAdapter() { APIRET rc; ADAPTERSTRUCT AdapterStruct; if (_state != rmAdapterCreated) { _fmemset( (PVOID) &AdapterStruct, 0, sizeof(AdapterStruct) ); AdapterStruct.AdaptDescriptName = (PSZ) "SoundBlaster Live!" ; /* ### IHV */ AdapterStruct.AdaptFlags = AS_16MB_ADDRESS_LIMIT; // AdaptFlags /* ### IHV */ AdapterStruct.BaseType = AS_BASE_MMEDIA; // BaseType AdapterStruct.SubType = AS_SUB_MM_AUDIO; // SubType AdapterStruct.InterfaceType = AS_INTF_GENERIC; // InterfaceType AdapterStruct.HostBusType = AS_HOSTBUS_PCI; // HostBusType /* ### IHV */ AdapterStruct.HostBusWidth = AS_BUSWIDTH_32BIT; // HostBusWidth /* ### IHV */ AdapterStruct.pAdjunctList = NULL; // pAdjunctList /* ### IHV */ //--- Register adapter. We'll record any error code, but won't fail // the driver initialization and won't return resources. rc = RMCreateAdapter( _hDriver, // Handle to driver &_hAdapter, // (OUT) Handle to adapter &AdapterStruct, // Adapter structure NULL, // Parent device (defaults OK) NULL ); // Allocated resources. We assign ownership // of the IO, IRQ, etc. resources to the // device (via RMCreateDevice()), not to the // adapter (as done in disk DD sample). if (rc == RMRC_SUCCESS) _state = rmAdapterCreated; } return rc; }