Example #1
0
void ant_io_rx_event_handler(ant_evt_t * p_ant_evt)
{
    ANT_MESSAGE * p_message = (ANT_MESSAGE*) p_ant_evt->msg.evt_buffer;

    switch(p_ant_evt->event)
    {
        case EVENT_RX:
           if(p_message->ANT_MESSAGE_aucPayload[0] == DIGITALIO_DATA_PID)
           {
               //Set LEDs according to Received Digital IO Data Page
               m_rx_input_pin_state = p_message->ANT_MESSAGE_aucPayload[7];
               set_led_state();
           }

           // Transmit the current state of the digital pins on the reverse direction
           handle_transmit();
           break;

        case EVENT_TX:
          // Transmit data on the reverse direction every channel period
          handle_transmit();
          break;

        default:
          break;
    }
}
Example #2
0
/*
 * UART Interrupt handler.
 */
static irqreturn_t tilegx_interrupt(int irq, void *dev_id)
{
	unsigned long flags;
	UART_INTERRUPT_STATUS_t intr_stat;
	struct tile_uart_port *tile_uart;
	gxio_uart_context_t *context;
	struct uart_port *port = dev_id;
	irqreturn_t ret = IRQ_NONE;

	spin_lock_irqsave(&port->lock, flags);

	tile_uart = container_of(port, struct tile_uart_port, uart);
	context = &tile_uart->context;
	intr_stat.word = gxio_uart_read(context, UART_INTERRUPT_STATUS);

	if (intr_stat.rfifo_we) {
		handle_receive(tile_uart);
		ret = IRQ_HANDLED;
	}
	if (intr_stat.wfifo_re) {
		handle_transmit(tile_uart);
		ret = IRQ_HANDLED;
	}

	spin_unlock_irqrestore(&port->lock, flags);
	return ret;
}