コード例 #1
0
ファイル: GUITimer.c プロジェクト: HackLinux/jz4725
/*********************************************************************
*
*       GUI_TIMER_SetDelay
*/
void GUI_TIMER_SetDelay(GUI_TIMER_HANDLE hObj, GUI_TIMER_TIME Delay) {
  GUI_LOCK(); {
   	GUI_TIMER_Obj* pObj = GUI_TIMER_H2P(hObj);
    pObj->t0 = Delay;
		_Unlink(hObj);
		_Link(hObj);
  } GUI_UNLOCK(); 
}
コード例 #2
0
ファイル: shader.cpp プロジェクト: BWStearns/riftty
bool Shader::compileAndLinkFromFiles(const std::string& vertShaderFilename,
                                     const std::string& fragShaderFilename)
{
    char* vertShaderSource;
    int vertShaderSize = _LoadFileToMemory(vertShaderFilename.c_str(), &vertShaderSource);
    if (vertShaderSize <= 0)
    {
        fprintf(stderr, "Shader::compileAndLinkFromFiles() Failed to load vertex shader \"%s\"\n", vertShaderFilename.c_str());
        return false;
    }

    char* fragShaderSource;
    int fragShaderSize = _LoadFileToMemory(fragShaderFilename.c_str(), &fragShaderSource);
    if (fragShaderSize <= 0)
    {
        fprintf(stderr, "Shader::compileAndLinkFromFiles() Failed to load fragment shader \"%s\"\n", fragShaderFilename.c_str());
        delete [] vertShaderSource;
        return false;
    }

    if (!_CompileShader(&m_vertShader, GL_VERTEX_SHADER, vertShaderSource, vertShaderSize))
    {
        fprintf(stderr, "Shader::compileAndLinkFromFiles() Failed to compile vertex shader \"%s\"\n", vertShaderFilename.c_str());
        _DumpShaderInfoLog(m_vertShader);
        glDeleteShader(m_vertShader);
        m_vertShader = 0;
        return false;
    }

    if (!_CompileShader(&m_fragShader, GL_FRAGMENT_SHADER, fragShaderSource, fragShaderSize))
    {
        fprintf(stderr, "Shader::compileAndLinkFromFiles() Failed to compile fragment shader \"%s\"\n", fragShaderFilename.c_str());
        _DumpShaderInfoLog(m_fragShader);
        glDeleteShader(m_fragShader);
        m_fragShader = 0;
        return false;
    }

    if (!_Link(&m_program, m_vertShader, m_fragShader))
    {
        fprintf(stderr, "Shader::compileAndLinkFromFiles() Failed to link shaders \"%s\" and \"%s\"\n", vertShaderFilename.c_str(), fragShaderFilename.c_str());
        _DumpProgramInfoLog(m_program);
        glDeleteProgram(m_program);
        m_program = 0;
        return false;
    }

    m_vertShaderFilename = vertShaderFilename;
    m_fragShaderFilename = fragShaderFilename;

    buildVarMaps();
    return true;
}
コード例 #3
0
ファイル: GUITimer.c プロジェクト: HackLinux/jz4725
/*********************************************************************
*
*       GUI_TIMER_Restart
*/
void GUI_TIMER_Restart(GUI_TIMER_HANDLE hObj) {
  GUI_TIMER_Obj* pObj;
  GUI_LOCK();
  {
    if (hObj == 0) {
      hObj = _hActiveTimer;
    }
   	pObj = GUI_TIMER_H2P(hObj);
    pObj->t0 = GUI_GetTime() +pObj->Period;
		_Unlink(hObj);
		_Link(hObj);
  } GUI_UNLOCK(); 
}
コード例 #4
0
ファイル: main.c プロジェクト: wynro/proyecto-hardware
/*********************************************************************************************
* name:		main
* func:		c code entry
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
int Main(void)
{
    sys_init();        /* Initial 44B0X's Interrupt,Port and UART */
    _Link();           /* Print Misc info */
	
	/******************/
	/* user interface */
	/******************/
	Uart_Printf("\n\rEmbest 44B0X Evaluation Board(S3CEV40)");
	Uart_Printf("\n\rFlash(SST39VF160-90) Program Test\n");
	Test_Flash();
    
    return;
}
コード例 #5
0
ファイル: main.c プロジェクト: wynro/proyecto-hardware
/*********************************************************************************************
* name:		main
* func:		c code entry
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
void Main(void)
{
	char input_char;				/* user input char 			*/
	
    sys_init();        /* Initial 44B0X's Interrupt,Port and UART */
    _Link();           /* Print Misc info */
		
    while(1)
     {
	   Uart_Printf("\n > Embest S3CEV40 board. < ");
       Uart_Printf("\n <<Extenal Interrupt>> Test. Y/y to continue,any key skip it.\n");
       input_char = Uart_Getch();
       if(input_char == 'Y' || input_char == 'y')
         Test_Eint();
     }
}
コード例 #6
0
ファイル: main.c プロジェクト: wynro/proyecto-hardware
/*********************************************************************************************
* name:		main
* func:		c code entry
* para:		none
* ret:		none
* modify:
* comment:		
*********************************************************************************************/
int Main(void)
{
    sys_init();        /* Initial 44B0X's Interrupt,Port and UART */
    _Link();           /* Print Misc info */
	
	/******************/
	/* user interface */
	/******************/
	Uart_Printf("\n\rEmbest 44B0X Evaluation Board(S3CEV40)");
	Uart_Printf("\n\rKeyboard Test Example\n");
	Test_Keyboard();
    
    while(1);
    
    return;
}
コード例 #7
0
ファイル: GUITimer.c プロジェクト: HackLinux/jz4725
/*********************************************************************
*
*       GUI_TIMER_Create
*/
GUI_TIMER_HANDLE GUI_TIMER_Create(GUI_TIMER_CALLBACK* cb, int Time, U32 Context, int Flags) {
  GUI_TIMER_HANDLE hObj;
  GUI_TIMER_Obj* pObj;
  GUI_LOCK();
  GUI_USE_PARA(Flags);
  GUI_USE_PARA(Time);
  GUI_pfTimerExec = GUI_TIMER_Exec;
	{
    /* Alloc memory for obj */
    hObj = GUI_ALLOC_AllocZero(sizeof(GUI_TIMER_Obj));
    pObj = GUI_TIMER_H2P(hObj);
    /* init member variables */
    pObj->cb = cb;
		pObj->Context = Context;
    /* Link it */
		_Link(hObj);
	} GUI_UNLOCK();
  return hObj;
}
コード例 #8
0
ファイル: HeapBlock.cpp プロジェクト: JoeAltmaier/Odyssey
// Free -- Free Memory ---------------------------------------------CHeapBlock-
//
// When a block is freed it is merged with previous and next block
// if they are free.  If merged with next block then next block is
// removed from list.  If not merged with either block then this 
// block is added to free list.
//
// NULL pointers and invalid block pointers are ignored.
//
// NOTE: Must be re-entrant
//
U32 CHeapBlock::Free(void *pData)
{
	BLKHEAD *pBlk,*pPrevBlk,*pNextBlk;
	U32 cbRet=0;
	
	if (pData != NULL) {
		pBlk = GetBlk(pData);

		// Check if allocated block
		if (pBlk->tThis == TYPEALLOC) {
			Critical section;

			cbRet=pBlk->sThis;

			FREE(cbRet, pBlk->raAlloc);

			// Merge with next block if it is free
			pNextBlk = GetNext(pBlk);
			if (pNextBlk->tThis == TYPEFREE) {
				_Unlink(pNextBlk);
				pBlk->sThis += pNextBlk->sThis + sizeof(BLKHEAD);
				GetNext(pBlk)->sPrev = pBlk->sThis;
			}

			// Merge with previous block if it is free
			pPrevBlk = GetPrev(pBlk);
			if (pPrevBlk->tThis != TYPEFREE) {
				pBlk->tThis = TYPEFREE;
				_Link(pBlk);
			}
			else {
				pPrevBlk->sThis += pBlk->sThis + sizeof(BLKHEAD);
				GetNext(pPrevBlk)->sPrev = pPrevBlk->sThis;
			}
		}
	}

	return cbRet;
}
コード例 #9
0
ファイル: HeapBlock.cpp プロジェクト: JoeAltmaier/Odyssey
// _SplitBlk -- Split free block -----------------------------------CHeapBlock-
//
// Splits specified block and links second half to the beginning
// of the free list.  Specified block links are not effected.
//
void CHeapBlock::_SplitBlk(BLKHEAD *pBlk,U32 nBytes)
{
	BLKHEAD *pNew;
	U32 sNew;

	// Resize current
	Critical section;

	sNew = pBlk->sThis - nBytes - sizeof(BLKHEAD);
	pBlk->sThis = nBytes;

	// Initialize new block size
	pNew = GetNext(pBlk);
	pNew->sPrev = pBlk->sThis;

	pNew->sThis = sNew;
	pNew->tThis = TYPEFREE;
	pNew->pThis = this;
	GetNext(pNew)->sPrev = pNew->sThis;

	section.Leave();

	_Link(pNew);
}
コード例 #10
0
ファイル: dijkstra2.cpp プロジェクト: 151706061/vistasoft
void FibHeap::_Consolidate()
{
FibHeapNode *x, *y, *w;
FibHeapNode *A[1+8*sizeof(long)]; // 1+lg(n)
int  I=0, Dn = 1+8*sizeof(long);
short d;

// Initialize the consolidation detection array

     for (I=0; I < Dn; I++)
          A[I] = NULL;

// We need to loop through all elements on root list.
// When a collision of degree is found, the two trees
// are consolidated in favor of the one with the lesser
// element key value.  We first need to break the circle
// so that we can have a stopping condition (we can't go
// around until we reach the tree we started with
// because all root trees are subject to becoming a
// child during the consolidation).

     MinRoot->Left->Right = NULL;
     MinRoot->Left = NULL;
     w = MinRoot;

     do {
//cout << "Top of Consolidate's loop\n";
//Print(w);

	x = w;
        d = x->Degree;
        w = w->Right;

// We need another loop here because the consolidated result
// may collide with another large tree on the root list.

        while (A[d] != NULL)
        {
             y = A[d];
	     if (*y < *x)
		 _Exchange(x, y);
             if (w == y) w = y->Right;
             _Link(y, x);
             A[d] = NULL;
             d++;
//cout << "After a round of Linking\n";
//Print(x);
	}
	A[d] = x;

     } while (w != NULL);

// Now we rebuild the root list, find the new minimum,
// set all root list nodes' parent pointers to NULL and
// count the number of subtrees.

     MinRoot = NULL;
     NumTrees = 0;
     for (I = 0; I < Dn; I++)
          if (A[I] != NULL)
              _AddToRootList(A[I]);
}