コード例 #1
0
ファイル: dyn_gossip.c プロジェクト: amimimor/dynomite
static rstatus_t
gossip_process_msgs(void)
{
	//TODOs: fix this to process an array of nodes
	while (!CBUF_IsEmpty(C2G_InQ)) {
		struct ring_msg *msg = (struct ring_msg *) CBUF_Pop(C2G_InQ);
		msg->cb(msg);
		ring_msg_deinit(msg);
	}

	return DN_OK;
}
コード例 #2
0
ファイル: dyn_core.c プロジェクト: Applied-Duality/dynomite
static rstatus_t
core_process_messages(void)
{
	//loga("Leng of C2G_OutQ ::: %d", CBUF_Len( C2G_OutQ ));
	while (!CBUF_IsEmpty(C2G_OutQ)) {
		struct ring_msg *msg = (struct ring_msg *) CBUF_Pop(C2G_OutQ);
		if (msg != NULL && msg->cb != NULL) {
			msg->cb(msg);
			core_debug(msg->sp->ctx);
			ring_msg_deinit(msg);
		}
	}

	return DN_OK;
}
コード例 #3
0
ファイル: Log.c プロジェクト: AutonomyLab/autolab-rapi
void LogBufDump( void )
{
    while ( !CBUF_IsEmpty( LOG_gBuffer ))
    {
        volatile LOG_Entry_t *entry = CBUF_GetPopEntryPtr( LOG_gBuffer );

#if CFG_LOG_EXTRA_PARAMS
        Log( entry->fmt, entry->param1, entry->param2, entry->param3, entry->param4 );
#else
        Log( entry->fmt, entry->param1, entry->param2 );
#endif

        CBUF_AdvancePopIdx( LOG_gBuffer );
    }

} // LogBufDump
コード例 #4
0
ファイル: uart5.c プロジェクト: magic-upenn/magic2010
void UART5_IRQHandler(void)
{
  char c;

  //figure out which flag triggered the interrupt
  uint32_t status = UART5->SR;

  if (status & _BV(RXNE5))                    //received a byte
  {
    c = UART5->DR;
    CBUF_Push(uart5_getbuf, c);
  }
  else if (status & _BV(ORE5))               //this is a weird condition when another byte came in
    c = UART5->DR;                           //at exact moment of reading DR, causing ORE, but not RXNE

  if (status & _BV(TXE5))                    //transmit buffer is empty
  {
    if (!CBUF_IsEmpty(uart5_putbuf)) 
      UART5->DR = CBUF_Pop(uart5_putbuf);   //push next character
    else 
      UART5->CR1 &= ~(_BV(TXEIE5));         // Disable interrupt
  }
}
コード例 #5
0
ファイル: uart5.c プロジェクト: magic-upenn/magic2010
int32_t uart5_getchar()
{
  return ( CBUF_IsEmpty(uart5_getbuf) ? EOF : CBUF_Pop(uart5_getbuf) );
}