Changeset 548 for GPL/branches/uniaud32-2.1.x/drv32/rmhelp.cpp
- Timestamp:
- Mar 16, 2011, 11:54:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-2.1.x/drv32/rmhelp.cpp
r546 r548 40 40 ULONG RMFlags; 41 41 42 static HDRIVER DriverHandle = (HDRIVER)-1; 43 static ULONG ctResHandles = 0; 44 static HRESOURCE arResHandles[MAX_RESHANDLES]; 42 static HDRIVER DriverHandle = (HDRIVER)-1; 43 static HDEVICE DeviceHandle = 0; 44 static HADAPTER AdapterHandle = 0; 45 static ULONG ctResHandles = 0; 46 static HRESOURCE arResHandles[MAX_RESHANDLES]; 45 47 46 48 … … 80 82 rc = RMCreateDriver( FlatToSel((ULONG)&DriverStruct), FlatToSel((ULONG)&hDriver) ); 81 83 82 dprintf(("RMCreateDriver rc = %d\n", rc));83 84 84 if( rc == RMRC_SUCCESS ) DriverHandle = hDriver; 85 dprintf(("RMCreateDriver rc=%d DriverHandle=%x", rc, DriverHandle)); 85 86 } 86 87 … … 113 114 } 114 115 115 dprintf(("RMAllocResource[%d] IO rc = %d \n", ctResHandles, rc));116 dprintf(("RMAllocResource[%d] IO rc = %d", ctResHandles, rc)); 116 117 117 118 return FALSE; … … 141 142 } 142 143 143 dprintf(("RMAllocResource[%d] MEM rc = %d \n", ctResHandles, rc));144 dprintf(("RMAllocResource[%d] MEM rc = %d", ctResHandles, rc)); 144 145 145 146 return rc == 0; … … 152 153 { 153 154 RESOURCESTRUCT Resource; 154 HRESOURCE h res;155 HRESOURCE hRes; 155 156 APIRET rc; 156 157 … … 161 162 162 163 rc = RMAllocResource(DriverHandle, // Handle to driver. 163 FlatToSel((ULONG)&h res), // OUT: "allocated" resource node handle164 FlatToSel((ULONG)&hRes), // OUT: "allocated" resource node handle 164 165 FlatToSel((ULONG)&Resource)); // Resource to allocate. 165 166 167 166 168 if (rc == 0) { 167 if (ctResHandles < MAX_RESHANDLES ) arResHandles[ctResHandles++] = hres; 168 *phRes = hres; 169 *phRes = hRes; 170 if (DeviceHandle) { 171 dprintf(("RMRequestIRQ: DriverHandle=%x DeviceHandle=%x hRes=%x", DriverHandle, DeviceHandle, hRes)); 172 rc = RMModifyResources(DriverHandle, DeviceHandle, RM_MODIFY_ADD, hRes); 173 } else { 174 if (ctResHandles < MAX_RESHANDLES ) arResHandles[ctResHandles++] = hRes; 175 } 169 176 } 170 177 171 dprintf(("RMAllocResource[%d] IRQ rc = %d\n", ctResHandles, rc));178 dprintf(("RMAllocResource[%d] IRQ=%d rc=%d", ctResHandles, ulIrq, rc)); 172 179 173 180 return rc == 0; … … 178 185 BOOL RMDeallocateIRQ(HRESOURCE hRes) 179 186 { 180 ULONG ulI; 181 182 RMDeallocResource(DriverHandle, hRes); 183 184 for (ulI=0; ulI<ctResHandles; ulI++) { 185 if (arResHandles[ulI] == hRes) { 186 arResHandles[ulI] = 0; 187 break; 188 } 189 } 190 191 return 0; 192 } 193 194 195 //****************************************************************************** 196 //****************************************************************************** 197 VOID RMDone(ULONG DevID) 187 APIRET rc; 188 189 dprintf(("RMDeallocateIRQ: DriverHandle=%x DeviceHandle=%x hRes=%x", DriverHandle, DeviceHandle, hRes)); 190 rc = RMModifyResources(DriverHandle, DeviceHandle, RM_MODIFY_DELETE, hRes); 191 192 return rc == 0; 193 } 194 195 196 //****************************************************************************** 197 //****************************************************************************** 198 VOID RMDone(ULONG DevID, PHADAPTER phAdapter, PHDEVICE phDevice) 198 199 { 199 200 APIRET rc; … … 205 206 char szDeviceName[128]; 206 207 char szMixerName[64]; 207 struct 208 { 208 struct { 209 209 ULONG NumResource; 210 210 HRESOURCE hResource[MAX_RESHANDLES]; … … 214 214 215 215 if( DevID && OSS32_QueryNames(OSS32_DEFAULT_DEVICE, 216 217 216 szDeviceName, sizeof(szDeviceName), 217 szMixerName, sizeof(szMixerName), FALSE) == OSSERR_SUCCESS ) 218 218 { 219 219 switch(DevID) { … … 285 285 break; 286 286 */ 287 } 287 } /* switch */ 288 288 289 289 … … 317 317 NULL); // Allocated resources. 318 318 319 dprintf(("RMCreateAdapter rc = %d\n", rc));319 dprintf(("RMCreateAdapter rc=%d", rc)); 320 320 321 321 if( rc == 0 ) 322 322 { 323 if( !szDeviceName[0] ) strcpy(szDeviceName, "Unknown"); 324 325 //NOTE: Assumes szDeviceName is a stack pointer!! 326 memset( (PVOID) &DeviceStruct, 0, sizeof(DeviceStruct) ); 327 DeviceStruct.DevDescriptName = FlatToSel((ULONG)szDeviceName); 328 DeviceStruct.DevFlags = DS_FIXED_LOGICALNAME; 329 DeviceStruct.DevType = DS_TYPE_AUDIO; 330 DeviceStruct.pAdjunctList = NULL; 331 332 rc = RMCreateDevice(DriverHandle, // Handle to driver 323 AdapterHandle = hAdapter; 324 if (phAdapter) *phAdapter = hAdapter; 325 if( !szDeviceName[0] ) strcpy(szDeviceName, "Unknown"); 326 327 //NOTE: Assumes szDeviceName is a stack pointer!! 328 memset( (PVOID) &DeviceStruct, 0, sizeof(DeviceStruct) ); 329 DeviceStruct.DevDescriptName = FlatToSel((ULONG)szDeviceName); 330 DeviceStruct.DevFlags = DS_FIXED_LOGICALNAME; 331 DeviceStruct.DevType = DS_TYPE_AUDIO; 332 DeviceStruct.pAdjunctList = NULL; 333 334 rc = RMCreateDevice(DriverHandle, // Handle to driver 333 335 FlatToSel((ULONG)&hDevice), // (OUT) Handle to device, unused. 334 336 FlatToSel((ULONG)&DeviceStruct), // Device structure … … 336 338 FlatToSel((ULONG)&ahResource)); // Allocated resources 337 339 338 dprintf(("RMCreateDevice rc = %d\n", rc)); 339 340 if( rc == 0 ) 341 { 342 // no resource handles to be freed 343 ctResHandles = 0; return; 344 } 345 346 // !!! Not implemented in startup.asm 347 // RMDestroyAdapter(DriverHandle, hAdapter); 348 } 349 } 350 else dprintf(("No resources allocated !!!\n")); 351 } 340 dprintf(("RMCreateDevice rc=%d", rc)); 341 342 if( rc == 0 ) 343 { 344 DeviceHandle = hDevice; 345 if (phDevice) *phDevice = hDevice; 346 ctResHandles = 0; // no resource handles to be freed 347 dprintf(("RMDone: DriverHandle=%x DeviceHandle=%x", DriverHandle, DeviceHandle)); 348 return; 349 } 350 351 // !!! Not implemented in startup.asm 352 // RMDestroyAdapter(DriverHandle, hAdapter); 353 } /* if rc == 0 */ 354 } /* ctResHandles */ 355 else dprintf(("No resources allocated !!!")); 356 } /* if DevID */ 352 357 353 358 … … 358 363 359 364 360 365 /* DAZ - dirty hack so that resource manager is updated correctly 366 * when using APIC and multiple adapters */ 367 VOID RMSetHandles(HADAPTER hAdapter, HDEVICE hDevice) 368 { 369 AdapterHandle = hAdapter; 370 DeviceHandle = hDevice; 371 } 372
Note:
See TracChangeset
for help on using the changeset viewer.