void CTestPage::StartRecord( void ) ///////////////////////////////////////////////////////////////////////////// { ULONG ulBytesRequested, ulCircularBufferSize; PHALWAVEDEVICE pHD; PWAVEFORMATEX pFormatEx; if( m_nRecordMode != MODE_STOP ) return; m_nRecordDevice = m_RecordDevice.GetCurSel(); DPF(("Starting Record Device %d\n", m_nRecordDevice )); pHD = m_pHalAdapter->GetWaveInDevice( m_nRecordDevice ); // change the button to stop SetDlgItemText( IDC_RECORD, "Stop" ); if( !m_WaveRecordFile.Open( m_szFileName, MMIO_CREATE | MMIO_READWRITE ) ) { DPF(("CTestPage::StartRecord Open Failed!\n")); return; } m_WaveRecordFile.SetFormat( WAVE_FORMAT_PCM, 24, 44100, 2 ); pFormatEx = m_WaveRecordFile.GetFormat(); if( !m_WaveRecordFile.WriteHeader() ) { DPF(("CTestPage::StartRecord WriteHeader Failed!\n")); } //DPF(("SetFormat\n")); pHD->SetFormat( pFormatEx->wFormatTag, pFormatEx->nChannels, pFormatEx->nSamplesPerSec, pFormatEx->wBitsPerSample, pFormatEx->nBlockAlign ); m_lSampleRate = pFormatEx->nSamplesPerSec; // Get the amount of free space on device //DPF(("GetTransferSize\n")); pHD->GetTransferSize( &ulBytesRequested, &ulCircularBufferSize ); ulCircularBufferSize += sizeof(DWORD); m_pRecordBuffer = malloc( ulCircularBufferSize ); pHD->SetInterruptSamples( (ulCircularBufferSize / sizeof( DWORD )) / 2 ); // put the device in MODE_RUN //DPF(("Start\n")); if( pHD->Start() ) { DPF(("Start Failed!\n")); } // advance the hardware pointer so the first interrupt will actually transfer something pHD->TransferComplete( TRUE ); // set the mode to Recording m_nRecordMode = MODE_RUN; }
bk3d::Bone* CPhConstraint::build(TTransformPool *transformPool, const MapMayaCVPtrs &CVPtrs, MapTransform2bk3d &transform2bk3d, bk3d::Bone * pTr, int &childrenOffset, int &effectorOffset) { DPF(("--------------\n")); size_t nodeByteSize = Bk3dPool::cur_bk3dPool->getUsedSize(); // first time initialization: if 0, it means we must set it to the first constraint //if(transformPool->offsetConstraints == 0) // transformPool->offsetConstraints = transformPool->nBones; // // create and copy data // m_bk3dConstraint = new TConstraint; bk3d::Bone * ttr = CBone::build(transformPool, CVPtrs, transform2bk3d, m_bk3dConstraint, childrenOffset, effectorOffset); m_bk3dConstraint->pRigidBody1 = NULL; // filled in antoher pass later m_bk3dConstraint->pRigidBody2 = NULL; memcpy(m_bk3dConstraint->translation_limit_min, m_translation_limit_min, sizeof(float)*3); memcpy(m_bk3dConstraint->translation_limit_max, m_translation_limit_max, sizeof(float)*3); memcpy(m_bk3dConstraint->rotation_limit_min, m_rotation_limit_min, sizeof(float)*3); memcpy(m_bk3dConstraint->rotation_limit_max, m_rotation_limit_max, sizeof(float)*3); memcpy(m_bk3dConstraint->spring_constant_translation, m_spring_constant_translation, sizeof(float)*3); memcpy(m_bk3dConstraint->spring_constant_rotation, m_spring_constant_rotation, sizeof(float)*3); nodeByteSize = Bk3dPool::cur_bk3dPool->getUsedSize() - nodeByteSize; m_bk3dConstraint->nodeByteSize = (unsigned int)nodeByteSize; m_bk3dConstraint->nextNode = (bk3d::Node*)Bk3dPool::cur_bk3dPool->getAvailablePtr(); // next available ptr... not allocated, yet ! DPF(("CPhConstraint sz : %d\n", nodeByteSize)); return m_bk3dConstraint; }
/*===========================================================================*/ extern "C" void DrawPrimitiveHAL( PMESAD3DSHARED pShared, D3DPRIMITIVETYPE dptPrimitiveType, D3DTLVERTEX *pVertices, DWORD dwCount ) { PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; #ifdef D3D_DEBUG HRESULT rc; DPF(( DBG_FUNC, "DrawPrimitveHAL();" )); /* Make sure we have enough info. */ if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) ) return; DPF(( DBG_PRIM_INFO, "DP( %d )", dwCount )); rc = pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType, D3DFVF_TLVERTEX, (LPVOID)pVertices, dwCount, (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); if ( FAILED(rc) ) { RIP( pHAL, "DrawPrimitive ->", ErrorStringD3D(rc) ); } #else pHAL->lpD3DDevice->DrawPrimitive( dptPrimitiveType, D3DFVF_TLVERTEX, (LPVOID)pVertices, dwCount, (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) ); #endif }
/* * linVidMemInit - initialize video memory manager */ static BOOL linVidMemInit( LPVMEMHEAP pvmh, FLATPTR start, FLATPTR end ) { DWORD size; DPF( 2, "linVidMemInit(%08lx,%08lx)", start, end ); /* * get the size of the heap (and verify its alignment for debug builds) */ size = end - start + 1; #ifdef DEBUG if( (size & (BLOCK_BOUNDARY-1)) != 0 ) { DPF( 1, "Invalid size: %08lx (%ld)\n", size, size ); return FALSE; } #endif /* * set up a free list with the whole chunk of memory on the block */ pvmh->freeList = MemAlloc( sizeof( VMEML ) ); if( pvmh->freeList == NULL ) { return FALSE; } ((LPVMEML)pvmh->freeList)->next = NULL; ((LPVMEML)pvmh->freeList)->ptr = start; ((LPVMEML)pvmh->freeList)->size = size; pvmh->allocList = NULL; return TRUE; } /* linVidMemInit */
void CTestPage::StopPlayback( void ) ///////////////////////////////////////////////////////////////////////////// { PHALWAVEDEVICE pHD; if( m_nPlayMode != MODE_RUN ) return; DPF(("Stopping Play Device %d\n", m_nPlayDevice )); pHD = m_pHalAdapter->GetWaveOutDevice( m_nPlayDevice ); //DPF(("Stop\n")); if( pHD->Stop() ) { DPF(("Stop Failed!\n")); } m_nPlayMode = MODE_STOP; m_WavePlayFile.Close(); free( m_pPlayBuffer ); ReleasePhysicalPages( m_pPlayBuffer, m_ulPlayBufferSize, m_ulPlayBufferPages ); // change the button to play SetDlgItemText( IDC_PLAY, "Play" ); SetDlgItemText( IDC_PLAY_SAMPLECOUNT, "" ); if( m_bRepeat ) StartPlayback(); }
void CTestPage::StopRecord( void ) ///////////////////////////////////////////////////////////////////////////// { PHALWAVEDEVICE pHD; if( m_nRecordMode != MODE_RUN ) return; DPF(("Stopping Record Device %d\n", m_nRecordDevice )); pHD = m_pHalAdapter->GetWaveInDevice( m_nRecordDevice ); //DPF(("Stop\n")); if( pHD->Stop() ) { DPF(("Stop Failed!\n")); } m_nRecordMode = MODE_STOP; m_WaveRecordFile.UpdateHeader(); m_WaveRecordFile.Close(); free( m_pRecordBuffer ); // change the button to Record SetDlgItemText( IDC_RECORD, "Record" ); SetDlgItemText( IDC_RECORD_SAMPLECOUNT, "" ); }
int main(int argc, char *argv[]) #endif { struct lock_msg message_buf; daemonaddr_t from; int addrlen; int rc; int x = 1; /* kludge to stop warnings from compiler */ init(argc, argv); CRIT_BEGIN(); while (x) { CRIT_END(); addrlen = sizeof (from); DPF((stderr, "begin recvfrom\n")); rc = recvfrom(lock_soc, &message_buf, sizeof (message_buf), 0, (struct sockaddr *)&from, &addrlen); DPF((stderr, "end recvfrom rc = %d\n", rc)); CRIT_BEGIN(); if (rc == sizeof (message_buf)) dispatch(&message_buf, &from); else check_for_write_lock(); /* if we own the lock, check to see if the process died */ if (the_lock.type != LOCK_NOTLOCKED && the_lock.remote_daemon == NULL) check_for_dead(); } CRIT_END(); return (0); }
int emu10k1_mpuin_start(struct emu10k1_card *card) { struct emu10k1_mpuin *card_mpuin = card->mpuin; u8 dummy; DPF(2, "emu10k1_mpuin_start()\n"); /* Set timestamp if not set */ if (card_mpuin->status & FLAGS_MIDM_STARTED) { DPF(2, "Time Stamp not changed\n"); } else { while (!emu10k1_mpu_read_data(card, &dummy)); card_mpuin->status |= FLAGS_MIDM_STARTED; /* set */ /* Set new time stamp */ card_mpuin->timestart = (jiffies * 1000) / HZ; DPD(2, "New Time Stamp = %d\n", card_mpuin->timestart); card_mpuin->qhead = 0; card_mpuin->qtail = 0; emu10k1_irq_enable(card, card->is_audigy ? A_INTE_MIDIRXENABLE : INTE_MIDIRXENABLE); } return 0; }
// returns the size (number of bytes) in an X64 function ULONG Getx64FunctionSize ( PVOID Function ) { PIMAGE_RUNTIME_FUNCTION_ENTRY RuntimeFunction; ULONGLONG ImageBase = 0; ULONG FunctionSize = 0; // RtlLookupFunctionEntry() locates the start and end of the function // using the X64 exception table information in the PE file // RtlLookupFunctionEntry() is only available on X64 systems // using it makes this this module incompatible with x86 systems RuntimeFunction = (PIMAGE_RUNTIME_FUNCTION_ENTRY)RtlLookupFunctionEntry( (ULONGLONG)Function, &ImageBase, NULL ); // if there is no valid runtime entry structure then the extents of // the functions cannot be determined if ( ! RuntimeFunction ) { DPF(("%s!%s RtlLookupFunctionEntry(%p)\n", __MODULE__, __FUNCTION__, Function )); goto Exit; } // compute the number of functions in the function body based on the // functions extents, note this logic will not work for BBT'd functions FunctionSize = RuntimeFunction->EndAddress - RuntimeFunction->BeginAddress; DPF(("%s!%s PRUNTIME_FUNCTION(BeginAddress=0x%08x EndAddress=0x%08x) Size=%u\n", __MODULE__, __FUNCTION__, RuntimeFunction->BeginAddress, RuntimeFunction->EndAddress, FunctionSize )); Exit : return FunctionSize; } // Getx64FunctionSize()
NDIS_STATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) { NDIS_FILTER_DRIVER_CHARACTERISTICS FilterCharacteristics; NDIS_STATUS NdisStatus; DPF(("%s!%s DriverObject=%p RegistryPath=%wZ\n", __MODULE__, __FUNCTION__, DriverObject, RegistryPath )); DriverObject->DriverUnload = DriverUnload; GlobalNDISLWF.FilterDriverHandle = NULL; // Setup the FilterCharacteristics structure // Handlers implemented by the driver are : // AttachHandler, DetachHandler, RestartHandler, PauseHandler, StatusHandler // ReceiveNetBufferListsHandler, ReturnNetBufferListsHandler NdisZeroMemory(&FilterCharacteristics, sizeof(NDIS_FILTER_DRIVER_CHARACTERISTICS)); FilterCharacteristics.Header.Type = NDIS_OBJECT_TYPE_FILTER_DRIVER_CHARACTERISTICS; FilterCharacteristics.Header.Size = sizeof(NDIS_FILTER_DRIVER_CHARACTERISTICS); FilterCharacteristics.Header.Revision = NDIS_FILTER_CHARACTERISTICS_REVISION_1; FilterCharacteristics.MajorNdisVersion = NDISLWF_NDIS_MAJOR_VERSION; FilterCharacteristics.MinorNdisVersion = NDISLWF_NDIS_MINOR_VERSION; FilterCharacteristics.MajorDriverVersion = NDISLWF_DRIVER_MAJOR_VERSION; FilterCharacteristics.MinorDriverVersion = NDISLWF_DRIVER_MINOR_VERSION; FilterCharacteristics.Flags = 0; NdisInitUnicodeString ( &FilterCharacteristics.FriendlyName, NDISLWF_FRIENDLY_NAME ); NdisInitUnicodeString ( &FilterCharacteristics.UniqueName, NDISLWF_UNIQUE_NAME); NdisInitUnicodeString ( &FilterCharacteristics.ServiceName, NDISLWF_SERVICE_NAME); FilterCharacteristics.AttachHandler = NDISLWF_AttachHandler; FilterCharacteristics.DetachHandler = NDISLWF_DetachHandler; FilterCharacteristics.RestartHandler = NDISLWF_RestartHandler; FilterCharacteristics.PauseHandler = NDISLWF_PauseHandler; FilterCharacteristics.StatusHandler = NDISLWF_StatusHandler; FilterCharacteristics.ReceiveNetBufferListsHandler = NDISLWF_ReceiveNetBufferListsHandler; FilterCharacteristics.ReturnNetBufferListsHandler = NDISLWF_ReturnNetBufferListsHandler; // Register the filter driver using the FilterCharacteristics structure // NdisFRegisterFilterDriver()) NdisStatus = NdisFRegisterFilterDriver( DriverObject, (NDIS_HANDLE)DriverObject, // no driver-wide context &FilterCharacteristics, &GlobalNDISLWF.FilterDriverHandle); if (NdisStatus != NDIS_STATUS_SUCCESS) { DPF(("%s!%s NdisFRegisterFilterDriver() FAIL=%08x\n", __MODULE__, __FUNCTION__, NdisStatus)); goto Exit1; } DPF(("%s!%s NdisFRegisterFilterDriver() FilterDriverHandle=%p\n", __MODULE__, __FUNCTION__, GlobalNDISLWF.FilterDriverHandle )); Exit1 : return NdisStatus; }
static int cmp_addr(daemonaddr_t *a, daemonaddr_t *b) { int rc; rc = memcmp(&(a->sin_addr), &(b->sin_addr), sizeof (a->sin_addr)); DPF((stderr, "compare %s %hu with", dp_addr(a), a->sin_port)); DPF((stderr, " %s %hu = %d\n", dp_addr(b), b->sin_port, rc)); return (rc); }
/*===========================================================================*/ extern "C" void SwapBuffersHAL( PMESAD3DSHARED pShared ) { PMESAD3DHAL pHAL = (PMESAD3DHAL)pShared; #ifdef D3D_DEBUG HRESULT rc; DPF(( DBG_FUNC, "SwapBuffersHAL();" )); DPF(( DBG_ALL_PROFILE, "=================SWAP===================" )); /* Make sure we have enough info. */ if ( (pHAL == NULL) || (pHAL->lpD3DDevice == NULL) ) return; /* Make sure we have enough info. */ if ( pHAL->lpDDSPrimary != NULL ) { rc = pHAL->lpD3DDevice->EndScene(); if ( FAILED(rc) ) { RIP( pHAL, "EndScene ->", ErrorStringD3D(rc) ); } if ( pShared->bFlipable ) { DPF(( DBG_CNTX_PROFILE, "Swap->FLIP" )); rc = pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT ); } else { DPF(( DBG_CNTX_PROFILE, "Swap->Blt" )); rc = pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL ); } if ( FAILED(rc) ) { RIP( pHAL, "Blt (RENDER/PRIMARY) ->", ErrorStringD3D(rc) ); } rc = pHAL->lpD3DDevice->BeginScene(); if ( FAILED(rc) ) { RIP( pHAL, "BeginScene ->", ErrorStringD3D(rc) ); } } #else pHAL->lpD3DDevice->EndScene(); if ( pShared->bFlipable ) pHAL->lpDDSPrimary->Flip( NULL, DDFLIP_WAIT ); else pHAL->lpDDSPrimary->Blt( &pShared->rectW, pHAL->lpDDSRender, NULL, DDBLT_WAIT, NULL ); pHAL->lpD3DDevice->BeginScene(); #endif }
/*! ************************************************ @function SGXUT_decode_build_options @description Describe the build options returned from microkernel (SGXGetMiscInfo) query @input IMG_UINT32 : build options @input IMG_UINT32 : mask @output none ************************************************ */ static IMG_VOID SGXUT_decode_build_option(IMG_UINT32 ui32In, IMG_UINT32 ui32Mask) { if ( (ui32In & ui32Mask) != 0) { DPF("enabled\n"); } else { DPF("disabled\n"); } }
VOID DriverUnload ( PDRIVER_OBJECT DriverObject ) { DPF(("%s!%s DriverObject=%p\n", __MODULE__, __FUNCTION__, DriverObject )); // Deregister the filter driver (NdisFDeregisterFilterDriver()) NdisFDeregisterFilterDriver(GlobalNDISLWF.FilterDriverHandle); DPF(("***** DRIVER UNLOADED *****\n")); }
/*! ****************************************************************************** @Function print_sgx_info @Description Print info about the passed PVRSRV_SGX_CLIENT_INFO structure to stdout @Input *psSGXInfo : @Return void : ******************************************************************************/ static void print_sgx_info(PVRSRV_SGX_CLIENT_INFO *psSGXInfo) { /* Add anything interesting from the SGX info structure here. */ DPF(".... ui32ProcessID:%u\n", psSGXInfo->ui32ProcessID); }
int emu10k1_mpuin_open(struct emu10k1_card *card, struct midi_openinfo *openinfo) { struct emu10k1_mpuin *card_mpuin = card->mpuin; DPF(2, "emu10k1_mpuin_open\n"); if (!(card_mpuin->status & FLAGS_AVAILABLE)) return -1; /* Copy open info and mark channel as in use */ card_mpuin->openinfo = *openinfo; card_mpuin->status &= ~FLAGS_AVAILABLE; /* clear */ card_mpuin->status |= FLAGS_READY; /* set */ card_mpuin->status &= ~FLAGS_MIDM_STARTED; /* clear */ card_mpuin->firstmidiq = NULL; card_mpuin->lastmidiq = NULL; card_mpuin->qhead = 0; card_mpuin->qtail = 0; sblive_miStateInit(card_mpuin); emu10k1_mpu_reset(card); emu10k1_mpu_acquire(card); return 0; }
void emu10k1_wavein_close(struct emu10k1_wavedevice *wave_dev) { struct emu10k1_card *card = wave_dev->card; struct wiinst *wiinst = wave_dev->wiinst; unsigned long flags; DPF(2, "emu10k1_wavein_close()\n"); emu10k1_wavein_stop(wave_dev); emu10k1_timer_uninstall(card, &wiinst->timer); free_buffer(card, &wiinst->buffer); spin_lock_irqsave(&card->lock, flags); switch (wave_dev->wiinst->recsrc) { case WAVERECORD_AC97: card->wavein.ac97 = NULL; break; case WAVERECORD_MIC: card->wavein.mic = NULL; break; case WAVERECORD_FX: card->wavein.fx = NULL; break; default: BUG(); break; } spin_unlock_irqrestore(&card->lock, flags); wiinst->state = WAVE_STATE_CLOSED; }
static int sblive_miState2ByteKey(struct emu10k1_mpuin *card_mpuin, u8 data) /* byte 1 */ { unsigned long tmp; if (data > 0x7f) { /* Real-time messages check */ if (data > 0xf7) return midistatefn[STIN_SYS_REAL].Fn(card_mpuin, data); /* Invalid data! */ DPF(2, "Invalid data!\n"); card_mpuin->curstate = STIN_PARSE; tmp = (unsigned long) data; tmp = tmp << 8; tmp |= (unsigned long) card_mpuin->status; emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INDATAERROR, tmp, 0); return -1; } card_mpuin->curstate = STIN_2BYTE; tmp = (unsigned long) data; tmp = tmp << 8; tmp |= (unsigned long) card_mpuin->status; emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INDATA, tmp, 2); return 0; }
static int sblive_miStateSysCommon3Key(struct emu10k1_mpuin *card_mpuin, u8 data) /* byte 1 */ { unsigned long tmp; if (data > 0x7f) { /* Real-time messages check */ if (data > 0xf7) return midistatefn[STIN_SYS_REAL].Fn(card_mpuin, data); /* Invalid data! */ DPF(2, "Invalid data!\n"); card_mpuin->curstate = card_mpuin->laststate; tmp = (unsigned long) data; tmp = tmp << 8; tmp |= (unsigned long) card_mpuin->fstatus; emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INDATAERROR, tmp, 0); return -1; } card_mpuin->data = data; card_mpuin->curstate = STIN_SYS_COMMON_3_VEL; return CTSTATUS_NEXT_BYTE; }
void emu10k1_voices_stop(struct emu_voice *first_voice, int num_voices) { struct emu10k1_card *card = first_voice->card; struct emu_voice *voice; unsigned int voice_num; int j; DPF(2, "emu10k1_voice_stop()\n"); for (voice_num = 0; voice_num < num_voices; voice_num++) { voice = first_voice + voice_num; for (j = 0; j < (voice->flags & VOICE_FLAGS_STEREO ? 2 : 1); j++) { sblive_writeptr_tag(card, voice->num + j, PTRX_PITCHTARGET, 0, CPF_CURRENTPITCH, 0, IFATN, 0xffff, VTFT, 0x0000ffff, CVCF, 0x0000ffff, IP, 0, TAGLIST_END); } } }
/* exist, send it up to IMIDI level. */ int emu10k1_mpuin_reset(struct emu10k1_card *card) { struct emu10k1_mpuin *card_mpuin = card->mpuin; struct midi_queue *midiq; DPF(2, "emu10k1_mpuin_reset()\n"); emu10k1_irq_disable(card, card->is_audigy ? A_INTE_MIDIRXENABLE : INTE_MIDIRXENABLE); while (card_mpuin->firstmidiq) { midiq = card_mpuin->firstmidiq; card_mpuin->firstmidiq = midiq->next; if (midiq->sizeLeft == midiq->length) emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INLONGDATA, (unsigned long) midiq, 0); else emu10k1_mpuin_callback(card_mpuin, ICARDMIDI_INLONGERROR, (unsigned long) midiq, 0); kfree(midiq); } card_mpuin->lastmidiq = NULL; card_mpuin->status &= ~FLAGS_MIDM_STARTED; return 0; }
void emu10k1_voice_free(struct emu_voice *voice) { struct emu10k1_card *card = voice->card; int i; unsigned long flags; DPF(2, "emu10k1_voice_free()\n"); if (voice->usage == VOICE_USAGE_FREE) return; for (i = 0; i < (voice->flags & VOICE_FLAGS_STEREO ? 2 : 1); i++) { DPD(2, " voice released -> %d\n", voice->num + i); sblive_writeptr_tag(card, voice->num + i, DCYSUSV, 0, VTFT, 0x0000ffff, PTRX_PITCHTARGET, 0, CVCF, 0x0000ffff, //CPF, 0, TAGLIST_END); sblive_writeptr(card, CPF, voice->num + i, 0); } voice->usage = VOICE_USAGE_FREE; spin_lock_irqsave(&card->lock, flags); card->voicetable[voice->num] = VOICE_USAGE_FREE; if (voice->flags & VOICE_FLAGS_STEREO) card->voicetable[voice->num + 1] = VOICE_USAGE_FREE; spin_unlock_irqrestore(&card->lock, flags); }
static void check_for_write_lock() { struct lockdaemon *ldp; int i; int wait = 0; DPF((stderr, "check for lock\n")); if (lock_wanted.state != STATE_ASKED) return; for (i = 0, ldp = daemon_list; i < MAX_DAEMONS; i++, ldp++) { if (ldp->inuse == 0) break; if (ldp->up && ldp->state != STATE_OKAYED) { wait = 1; break; } } if (wait == 0 && lock_wanted.type == LOCK_WRITE) { the_lock.type = LOCK_WRITE; the_lock.holding_pid[0] = lock_wanted.pid; the_lock.nholders = 1; the_lock.state = STATE_CLEAR; take_lock(LOCK_LOCKED); } }
/* * GetPtr16 */ LPVOID GetPtr16( LPVOID ptr ) { DWORD diff; DWORD p16; LPSELLIST psel; LPBYTE lptr; lptr = ptr; psel = lpSelList; while( psel != NULL ) { if( psel->base <= lptr ) { diff = lptr - psel->base; if( diff <= 0xf000 ) { p16 = ((DWORD)psel->sel << 16l) + diff; return (LPVOID) p16; } } psel = psel->link; } DPF( 1, "ERROR: NO 16:16 PTR for %08lx", lptr ); return NULL; } /* GetPtr16 */
CMiniportWaveCyclicStreamMSVAD::SetBufferSize ( IN ULONG BufferSize ) /*++ Routine Description: The SetBufferSize function sets the current buffer size. This value is set to the allocated buffer size when AllocateBuffer is called. The DMA object does not actually use this value internally. This value is maintained by the object to allow its various clients to communicate the intended size of the buffer. Callers of SetBufferSize can run at any IRQL. Arguments: BufferSize - Current size in bytes. Return Value: void --*/ { DPF_ENTER(("[CMiniportWaveCyclicStreamMSVAD::SetBufferSize]")); if ( BufferSize <= m_ulDmaBufferSize ) { m_ulDmaBufferSize = BufferSize; } else { DPF(D_ERROR, ("Tried to enlarge dma buffer size")); } } // SetBufferSize
USHORT CHalWaveDevice::SetFormat( USHORT wFormatTag, LONG lChannels, LONG lSampleRate, LONG lBitsPerSample, LONG lBlockAlign ) // This doesn't actually touch the hardware - all format changes are done // when the device goes into RUN mode. ///////////////////////////////////////////////////////////////////////////// { USHORT usStatus; //DPF(("CHalWaveDevice::SetFormat\n")); // must check to see if device is idle first if( m_usMode != MODE_STOP ) { DPF(("CHalWaveDevice::SetFormat: Device Not IDLE!\n")); return( HSTATUS_INVALID_MODE ); } // make sure this is a valid format usStatus = ValidateFormat( wFormatTag, lChannels, lSampleRate, lBitsPerSample, lBlockAlign ); if( usStatus ) return( usStatus ); // remember the format for our device m_wFormatTag = wFormatTag; m_lNumChannels = lChannels; m_lSampleRate = lSampleRate; m_lBitsPerSample = lBitsPerSample; m_lBytesPerBlock = lBlockAlign; return( HSTATUS_OK ); }
USHORT FindAdapter( PVOID pContext, PPCI_CONFIGURATION pPCI ) // Called from the Hal ///////////////////////////////////////////////////////////////////////////// { #ifdef USEHARDWARE // Start with the LynxTWO-A pPCI->usDeviceID = PCIDEVICE_LYNXTWO_A; if( !FindPCIDevice( pPCI ) ) { pPCI->usDeviceID = PCIDEVICE_LYNXTWO_B; if( !FindPCIDevice( pPCI ) ) { pPCI->usDeviceID = PCIDEVICE_LYNXTWO_C; if( !FindPCIDevice( pPCI ) ) { pPCI->usDeviceID = PCIDEVICE_LYNX_L22; if( !FindPCIDevice( pPCI ) ) { DPF(("FindPCIDevice Failed!")); return( HSTATUS_CANNOT_FIND_ADAPTER ); } } } } #endif return( HSTATUS_OK ); }
/* * InsertIUnknown * * Insert a new IUnknown with its associated IID into the IUnknown list of the * given surface. */ static LPIUNKNOWN_LIST InsertIUnknown( LPDDRAWI_DDRAWSURFACE_LCL pThisLCL, REFIID riid, IUnknown FAR *lpIUnknown) { LPIUNKNOWN_LIST lpIUnknownNode; DPF( 4, "Adding aggregated IUnknown %x", lpIUnknown ); lpIUnknownNode = ( LPIUNKNOWN_LIST ) MemAlloc( sizeof( IUNKNOWN_LIST ) ); if( lpIUnknownNode == NULL ) return NULL; lpIUnknownNode->lpGuid = ( GUID FAR * ) MemAlloc( sizeof( GUID ) ); if( lpIUnknownNode->lpGuid == NULL ) { MemFree( lpIUnknownNode ); return NULL; } memcpy( lpIUnknownNode->lpGuid, riid, sizeof( GUID ) ); lpIUnknownNode->lpLink = pThisLCL->lpSurfMore->lpIUnknowns; lpIUnknownNode->lpIUnknown = lpIUnknown; pThisLCL->lpSurfMore->lpIUnknowns = lpIUnknownNode; return lpIUnknownNode; }
static int pt_putblock(struct emu10k1_wavedevice *wave_dev, u16 *block, int nonblock) { struct woinst *woinst = wave_dev->woinst; struct emu10k1_card *card = wave_dev->card; struct pt_data *pt = &card->pt; u16 *ptr = (u16 *) card->tankmem.addr; int i = 0, r; unsigned long flags; r = pt_wait_for_write(wave_dev, nonblock); if (r < 0) return r; spin_lock_irqsave(&card->pt.lock, flags); while (i < PT_BLOCKSAMPLES) { pt_putsamples(pt, ptr, block[2*i], block[2*i+1]); if (pt->copyptr == 0) pt->copyptr = PT_SAMPLES; pt->copyptr--; i++; } woinst->total_copied += PT_BLOCKSIZE; pt->blocks_copied++; if (pt->blocks_copied >= 4 && pt->state != PT_STATE_PLAYING) { DPF(2, "activating digital pass-through playback\n"); sblive_writeptr(card, GPR_BASE + pt->enable_gpr, 0, 1); pt->state = PT_STATE_PLAYING; } spin_unlock_irqrestore(&card->pt.lock, flags); return 0; }
/*------------------------------------------------------------------ Transforms ------------------------------------------------------------------*/ size_t CPhConstraint::getTotalSize(int &relocationSlots) { relocationSlots += getNumRelocationSlots(); size_t sz = sizeof(bk3d::Constraint); DPF(("Constraint : %d\n", sz)); return sz; }