Пример #1
0
/***********************************************************
 * Name:
 *	main	
 * Description:
 * 	Start Function of the Kernel	
 * Parameter:
 * ReturnValue:
 *	EXIT_SUCCESS	
 *
 **********************************************************/
void main() {

	/* Global Descriptor Table setup */
	gdt_setup();

	/* Interrupt Descriptor Table setup */
	idt_setup();

	/* Setup Interrupts */
	irq_setup();

	/* Setup Empty Devices */
	device_setup();

	/* Initialize Video Device -> Device does not send Interrupts */
	initializeDevice(0,(char *)0xB8000,DEVICE_VIDEO,NULL,IRQ_EMPTY);

	/* Initialize Keyboard Handler */
	initializeDevice(1,NULL,DEVICE_KEYBOARD,irq_keyboard_handler,IRQ_KEYBOARD);

	/* set Video Device for Console */
	setVideoDevice(getDevice(0,DEVICE_VIDEO));

	/* Initialize the Character Buffer */
	initLineBuffer();

	/* Clear Screen on Video Device */
	clear_screen();

	/* Printing OS Headers */
	printf("\t\t-------------------------\n", C437_GREEN);
	printf("\t\tWELLCOME TO "OS_NAME"\n", C437_GREEN);
	printf("\t\t-------------------------\n", C437_GREEN);

        printf("\t\t"OS_NAME" version "OS_VERSION", Copyright (C) 2012 Simon Sommer\n", C437_CYAN); 
    	printf("\t\t"OS_NAME" comes with ABSOLUTELY NO WARRANTY.\n", C437_CYAN);
    	printf("\t\tThis is free software, and you are\n", C437_CYAN); 
	printf("\t\twelcome to redistribute it under certain conditions.\n", C437_CYAN);

	/* Enable Full 4GB Memory */
	enableA20();
	printf("\t\tA20 GATE ACTIVATED\n", C437_GREEN);

	/* Gives Feedback of previus done Tasks */
	printf("\t\tGDT SETUP DONE\n", C437_GREEN);
	printf("\t\tIDT SETUP DONE\n", C437_GREEN);
	printf("\t\tIRQ SETUP DONE\n", C437_GREEN);

	/* Enable Iterrupts */
	__asm__ __volatile__ ("sti");
	printf("\t\tINTERRUPTS ENABLED\n", C437_GREEN);

	while(1);

	/* TODO: Malloc and Free Debug and Final Test */
}
Пример #2
0
 void
 BasicDeviceDriver::onActivation(void)
 {
   initializeDevice();
   setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_ACTIVE);
   debug("activation took %0.2f s", m_wdog.getElapsed());
 }
Пример #3
0
BOOLEAN openDevice(Device device) {
   fprintf(stdout, "- Opening device in %p\n", device);

   /* open the video device */
   device->fd = EINTR_RETRY(open(device->deviceName, O_RDWR));
   if (device->fd < 0) {
      perror(device->deviceName);
      return FALSE;
   }
   fprintf(stdout, "    - Opened %s with fd=%d\n", device->deviceName, device->fd);


   /* try to lock the device */
   if (EINTR_RETRY(flock(device->fd, LOCK_EX | LOCK_NB)) < 0) {
      perror("FLOCK");
      fprintf(stdout, "    * Can't lock device\n");
      return FALSE;
   }

   /* check for a valid device */
   if (EINTR_RETRY(xioctl(device->fd, VIDIOCGCAP, &device->vcapability)) < 0) {
      perror("VIDIOCGCAP");
      return FALSE;
   }

   initializeDevice(device);

   showDeviceInformation(device);

   return setupDevice(device);
}
Пример #4
0
bool Display::resetDevice()
{
    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();

    HRESULT result = D3D_OK;
    bool lost = testDeviceLost();
    int attempts = 3;

    while (lost && attempts > 0)
    {
        if (mDeviceEx)
        {
            Sleep(500);   // Give the graphics driver some CPU time
            result = mDeviceEx->ResetEx(&presentParameters, NULL);
        }
        else
        {
            result = mDevice->TestCooperativeLevel();

            while (result == D3DERR_DEVICELOST)
            {
                Sleep(100);   // Give the graphics driver some CPU time
                result = mDevice->TestCooperativeLevel();
            }

            if (result == D3DERR_DEVICENOTRESET)
            {
                result = mDevice->Reset(&presentParameters);
            }
        }

        lost = testDeviceLost();
        attempts --;
    }

    if (FAILED(result))
    {
        ERR("Reset/ResetEx failed multiple times: 0x%08X", result);
        return error(EGL_BAD_ALLOC, false);
    }

    // reset device defaults
    initializeDevice();

    return true;
}
Пример #5
0
/* Called when the control is Shown*/
void CColosseumCtrl::OnShowWindow(BOOL bShow, UINT nStatus)
{
	/* This method is called the instance the control is show to the user
	 * What happens here is that we get the file name from m_server and convert it from
	 * CString to char* and send it to the CIFCEngineInteract object to retrieve information 
	 * from the file and initialize the CIFCEngineInteract object.
	 * We then initialize the m_width and m_height with the width and height of the control
	 * sent with <OBJECT> tag in the html file.
	 * After that we assign to m_hwndRenderWindow the handle of the window that we are going to draw
	 * in because we are going to use to initialize the DirectX device module and initialize the device buffer .
	 * Lastly we render the changes.
	 */
	
	/*if ( 0 == m_engineInteract->retrieveObjectGroups("C:\\temp1.ifc"))//(m_server.GetBuffer(0))))
		m_engineInteract->enrichObjectGroups();
	else	
		ASSERT(1==0);*/
	
	CObjectTransferer::getSingleton().setCtrl(this);
	CObjectTransferer::getSingleton().setEndpoint(m_server.GetBuffer(0));
	

	CRect rc;
	GetWindowRect(&rc);
	m_width = rc.Width();
	m_height = rc.Height();
	m_hwndRenderWindow = this->m_hWnd;
	initializeDevice();
	initializeDeviceBuffer();
	
	
	
	initializeGUI();
	m_objectVector.push_back(IFC_WINDOW);
	m_objectVector.push_back(IFC_DOOR);
	if(m_initialized)
			render();		
	CObjectTransfererThread *t = new CObjectTransfererThread(m_endpointModelVector);
	t->CreateThread();
				
}
Пример #6
0
void main(void)
{
	calibrateClock();
	initializeDevice();

	while(1) {
		if( pendingCommand ) {
		
			if( pendingCommand == LONG_COMMAND ) {
				// error
			} else {
				parseInput(inputBuffer, INPUT_BUF_SIZE);
			}
			
			if( getErrors() ) {
				printErrors();
				clearErrors();
			}
			
		}
	}
}
TEST_F(CameraModuleTest, LoadModule) {

    TEST_EXTENSION_FORKING_INIT;

    status_t stat;
    for (int i = 0; i < mNumberOfCameras; ++i) {
        if (isDeviceVersionHal2(i, &stat) && stat == OK) {
            CreateCamera(i, &mDevice);
            ASSERT_EQ(OK, initializeDevice(i))
                << "Failed to initialize device " << i;
            mDevice.clear();
        } else {
            const ::testing::TestInfo* const test_info =
                ::testing::UnitTest::GetInstance()->current_test_info();
            std::cerr << "Skipping test "
                      << test_info->test_case_name() << "."
                      << test_info->name()
                      << " because HAL device version is V1"
                      << std::endl;
        }
    }

}
Пример #8
0
bool Display::createDevice()
{
    if (!isInitialized())
    {
        return error(EGL_NOT_INITIALIZED, false);
    }
    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
    DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES;

    HRESULT result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &presentParameters, &mDevice);

    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
    {
        return error(EGL_BAD_ALLOC, false);
    }

    if (FAILED(result))
    {
        result = mD3d9->CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParameters, &mDevice);

        if (FAILED(result))
        {
            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
            return error(EGL_BAD_ALLOC, false);
        }
    }

    if (mD3d9Ex)
    {
        result = mDevice->QueryInterface(IID_IDirect3DDevice9Ex, (void**) &mDeviceEx);
        ASSERT(SUCCEEDED(result));
    }

    initializeDevice();

    return true;
}
Пример #9
0
    virtual void setMarker(const std::wstring &markerName)
    {
        initializeDevice();

        mUserDefinedAnnotation->SetMarker(markerName.c_str());
    }
Пример #10
0
    virtual void endEvent()
    {
        initializeDevice();

        mUserDefinedAnnotation->EndEvent();
    }
Пример #11
0
    virtual void beginEvent(const std::wstring &eventName)
    {
        initializeDevice();

        mUserDefinedAnnotation->BeginEvent(eventName.c_str());
    }
Пример #12
0
LRESULT CColosseumCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	int		iMouseX = LOWORD(lParam),
			iMouseY = HIWORD(lParam);

	switch (message)
	{
		case WM_LBUTTONDOWN:
		case WM_MBUTTONDOWN:
		case WM_RBUTTONDOWN:
			iZoomMouseX = iMouseX;
			iZoomMouseY = iMouseY;
			break;
		case WM_MOUSEMOVE:
			/*
			 *	Mouse moved
			 */
			
			if(MK_LBUTTON&wParam)
			{
				
				SetCapture();
				SetCursor(NULL);
				
				m_camera->rotateCamera((float)(iMouseY-iZoomMouseY), (float)(iMouseX-iZoomMouseX)); 

				if (m_initialized) {
					render();
				}
				ReleaseCapture();
				iZoomMouseX = iMouseX;
				iZoomMouseY = iMouseY;
			}
			
			break;
	
		case WM_KEYDOWN: //If a Key is down
			switch(wParam)
			{
			case 0x57: //W KEY
				
				m_camera->moveForward(MULTIPLY_RATIO);
								
				if  (m_initialized) {
					render();
				}
				break;
			case 0x53: // S KEY
				m_camera->moveForward(-1.0f * MULTIPLY_RATIO);
				if  (m_initialized) {
					render();
				}
				break;
			case 0x41:// A KEY
				m_camera->moveRight(-1.0f * MULTIPLY_RATIO);
				if(m_initialized)
					render();
				break;
			
			case 0x44: // D KEY
				m_camera->moveRight( MULTIPLY_RATIO );
				if(m_initialized)
					render();
				break;
			}
			break;

		case WM_SHOWWINDOW:
			switch	(m_engineInteract->retrieveObjectGroups((m_server.GetBuffer(0)))) {
			case 0:
				m_engineInteract->enrichObjectGroups();
				break;
			default:
				ASSERT(1==0);
				break;
			}
			CRect rc;
			this->GetWindowRect(&rc);
			m_width = rc.Width();
			m_height = rc.Height();

			m_hwndRenderWindow = this->m_hWnd;
			initializeDevice();
			initializeDeviceBuffer();
			
			
			break;
	}
	if(m_initialized)
			render();
	return COleControl::WindowProc(message, wParam, lParam);
	
}
Пример #13
0
bool DXManager::Initialize(
	int screenWidth,
	int screenHeight,
	bool vsync,
	HWND HWnd,
	bool fullscreen,
	float screenDepth,
	float screenNear
	)
{
	HRESULT hr = S_OK;
	m_vsync_enabled = vsync;
	mHWnd = HWnd;
	m_ScreenWidth = screenWidth;
	m_ScreenHeight = screenHeight;
	m_ScreenNear = screenNear;
	m_ScreenDepth = screenDepth;


	hr = initializeDevice(fullscreen);
	if (FAILED(hr))
		return false;

	hr = setupMatrix();
	if (FAILED(hr))
		return false;

	hr = getVideoCardInfo();
	if (FAILED(hr))
		return false;

	hr = initializeDepthBufferDesc();
	if (FAILED(hr))
		return false;

	hr = initializeDepthStencilDesc();
	if (FAILED(hr))
		return false;
	
	hr = initializeAlphaBlendStateDesc();
	if (FAILED(hr))
		return false;
	
	hr = initializeRenderTarget();
	if (FAILED(hr))
		return false;

	hr = initializeRasterState();
	if (FAILED(hr))
		return false;

	// Setta il viewport
	vp.Width = static_cast<float>(m_ScreenWidth);
	vp.Height = static_cast<float>(m_ScreenHeight);
	vp.MinDepth = 0.0f;
	vp.MaxDepth = 1.0f;
	vp.TopLeftX = 0;
	vp.TopLeftY = 0;
	mPd3dDeviceContext->RSSetViewports(1, &vp);

	return true;
}
Пример #14
0
void DebugAnnotator11::setMarker(const wchar_t *markerName)
{
    initializeDevice();

    mUserDefinedAnnotation->SetMarker(markerName);
}
Пример #15
0
void DebugAnnotator11::endEvent()
{
    initializeDevice();

    mUserDefinedAnnotation->EndEvent();
}
Пример #16
0
void DebugAnnotator11::beginEvent(const wchar_t *eventName)
{
    initializeDevice();

    mUserDefinedAnnotation->BeginEvent(eventName);
}