Ejemplo n.º 1
0
static rstatus_t
dmsg_to_gossip(struct ring_msg *rmsg)
{
        CBUF_Push(C2G_InQ, rmsg);

        return DN_OK;
}
Ejemplo n.º 2
0
int32_t uart5_putchar(char c)
{
  CBUF_Push(uart5_putbuf, c);               //push the byte into circular buffer
  
  UART5->CR1 |= _BV(TXEIE5);               //re-enable interrupt (or just enable)
  
  return c;
}
Ejemplo n.º 3
0
int32_t uart5_putstr(char *str)
{
  char * str2 = str;
  while(*str != 0)
    CBUF_Push(uart5_putbuf, *str++);

  UART5->CR1 |= _BV(TXEIE5);               //re-enable interrupt (or just enable)
  return (str-str2);
}
Ejemplo n.º 4
0
static rstatus_t
gossip_ring_msg_to_core(struct server_pool *sp, struct ring_msg *msg, void *cb)
{
	msg->cb = cb;
	msg->sp = sp;
	CBUF_Push(C2G_OutQ, msg);

	return DN_OK;
}
Ejemplo n.º 5
0
int32_t uart5_putdata(char *data, int32_t size)
{
  int32_t size2 = size;
  while(size--)
    CBUF_Push(uart5_putbuf, *data++);

  UART5->CR1 |= _BV(TXEIE5);              //re-enable interrupt (or just enable)
    
  return size2;
}
Ejemplo n.º 6
0
static rstatus_t
stats_msg_to_core(stats_cmd_t cmd, void *cb, void *post_cb)
{
    struct stat_msg *msg = dn_alloc(sizeof(*msg));
    msg->cmd = cmd;
    msg->data = NULL;
    msg->cb = cb;
    msg->post_cb = post_cb;
    CBUF_Push(C2S_OutQ, msg);
	return DN_OK;
}
Ejemplo n.º 7
0
static rstatus_t
gossip_msg_to_core(struct server_pool *sp, struct node *node, void *cb)
{
	struct ring_msg *msg = create_ring_msg();
	struct node *rnode = (struct node *) array_get(&msg->nodes, 0);
	node_copy(node, rnode);

	msg->cb = cb;
	msg->sp = sp;
	CBUF_Push(C2G_OutQ, msg);

	return DN_OK;
}
Ejemplo n.º 8
0
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
  }
}