Example #1
0
NTSTATUS StartDevice( IN PUSBKBD_DEVICE_EXTENSION dx, IN PCM_RESOURCE_LIST AllocatedResourcesTranslated)
{
	if( dx->GotResources)
		return STATUS_SUCCESS;

	NTSTATUS status = RetrieveResources(dx,AllocatedResourcesTranslated);
	if( !NT_SUCCESS(status))
		return status;
/*
	// Map memory
	if( dx->PortNeedsMapping)
	{
		dx->PortBase = (PUCHAR)MmMapIoSpace( dx->PortStartAddress, dx->PortLength, MmNonCached);
		if( !dx->PortBase)
			return STATUS_NO_MEMORY;
	}
	else
		dx->PortBase = (PUCHAR)dx->PortStartAddress.LowPart;

	// Disable device
	if( !KeSynchronizeExecution( dx->InterruptObject, (PKSYNCHRONIZE_ROUTINE)DisableDeviceInterrupts, (PVOID)dx))
	{
		if( dx->PortNeedsMapping)
			MmUnmapIoSpace( dx->PortBase, dx->PortLength);
		return STATUS_INVALID_DEVICE_STATE;
	}

	// Connect to interrupts
	if( dx->GotInterrupt)
	{
		status = IoConnectInterrupt( &dx->InterruptObject, (PKSERVICE_ROUTINE)InterruptHandler,
							(PVOID)dx, NULL, dx->Vector, dx->Irql, dx->Irql, dx->Mode, FALSE, dx->Affinity, FALSE);
		if( !NT_SUCCESS(status))
		{
			if( dx->PortNeedsMapping)
				MmUnmapIoSpace( dx->PortBase, dx->PortLength);
			return status;
		}
	}

	// Enable device
	if( !KeSynchronizeExecution( dx->InterruptObject, (PKSYNCHRONIZE_ROUTINE)EnableDeviceInterrupts, (PVOID)dx))
	{
		if( dx->GotInterrupt)
			IoDisconnectInterrupt(dx->InterruptObject);
		if( dx->PortNeedsMapping)
			MmUnmapIoSpace( dx->PortBase, dx->PortLength);
		return STATUS_INVALID_DEVICE_STATE;
	}
*/

	// Device is now started
	dx->GotResources = true;
	
	return STATUS_SUCCESS;
}
Example #2
0
void ShowTitle( void )
{
    SDL_FillRect( g_frontSurface, &g_frontSurface->clip_rect, SDL_MapRGB( g_frontSurface->format, 0, 0, 0 ) );
    SDLU_Present();

    RetrieveResources( );

    int time = MTickCount() + 120;

	while( time > MTickCount() && !SDLU_Button() )
	{
        DrawPICTInSurface( g_frontSurface, picTitle );
        SDLU_Present();
		SDLU_Yield();
	}
	
	WaitForRelease();
		
	QuickFadeOut( NULL );
	
	SDL_FillRect( g_frontSurface, &g_frontSurface->clip_rect, SDL_MapRGB( g_frontSurface->format, 0, 0, 0 ) );
    SDLU_Present();
}