コード例 #1
0
ファイル: uart-bridge-master.c プロジェクト: rtemss/rtems
static void transmit_task(rtems_task_argument arg)
{
  rtems_status_code sc = RTEMS_SUCCESSFUL;
  uart_bridge_master_control *control = (uart_bridge_master_control *) arg;
  rtems_chain_control *fifo = &control->transmit_fifo;

  int fd = open(control->device_path, O_WRONLY);
  assert(fd >= 0);

  serial_settings(fd);

  while (true) {
    intercom_packet *packet = NULL;
    sc = rtems_chain_get_with_wait(
      fifo,
      TRANSMIT_EVENT,
      RTEMS_NO_TIMEOUT,
      (rtems_chain_node **) &packet
    );
    assert(sc == RTEMS_SUCCESSFUL);
    write(fd, packet->data, packet->size);
    qoriq_intercom_free_packet(packet);
  }
}
コード例 #2
0
ファイル: uart-bridge-master.c プロジェクト: rtemss/rtems
static void receive_task(rtems_task_argument arg)
{
  uart_bridge_master_control *control = (uart_bridge_master_control *) arg;
  intercom_type type = control->type;

  int fd = open(control->device_path, O_RDONLY);
  assert(fd >= 0);

  serial_settings(fd);

  while (true) {
    intercom_packet *packet = qoriq_intercom_allocate_packet(
      type,
      INTERCOM_SIZE_64
    );
    ssize_t in = read(fd, packet->data, packet->size - 1);
    if (in > 0) {
      packet->size = (size_t) in;
      qoriq_intercom_send_packet(QORIQ_UART_BRIDGE_SLAVE_CORE, packet);
    } else {
      qoriq_intercom_free_packet(packet);
    }
  }
}
コード例 #3
0
ファイル: intercom-mpci.c プロジェクト: AlexShiLucky/rtems
static void mpci_return_packet(rtems_packet_prefix *prefix)
{
	intercom_packet *packet = packet_of_prefix(prefix);

	qoriq_intercom_free_packet(packet);
}