Changes between Version 67 and Version 68 of Developer/Simulators/QEMU/CANEmulation


Ignore:
Timestamp:
Sep 12, 2013, 4:14:31 PM (6 years ago)
Author:
Jinyang
Comment:

/* Step 3: Build a Basic PCI-CAN device in qemu */

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Simulators/QEMU/CANEmulation

    v67 v68  
    447447 *  qemu_iohandler_poll()-iohandler.c is called to write the data to pci-can device.
    448448
     449  static void can_chr_update_read_handler(CharDriverState *chr)
     450  {
     451    ......
     452    qemu_set_fd_handler2(d->fd, can_chr_read_poll, can_chr_read, NULL, chr);
     453    ......
     454  }
     455  static CharDriverState *qemu_chr_open_can(QemuOpts *opts)
     456  {
     457    ......
     458    chr->chr_update_read_handler = can_chr_update_read_handler;
     459    ......
     460  }
     461
     462In can_chr_update_read_handler(), we would call qemu_set_fd_handler2() function to register the reading routine function. The 2nd argument is called to figure out if we need to read from the real device, if need the reture value should bigger than 0 or equal to 0. The 3rd argument is called when we should to read the data.
     463
     464
     465So in can_chr_read_poll() function we will figure out if we need to get some data from the device and in can_chr_read() function we will wirte the data to the pci-can device.
     466
     467
     468
     469
     470
     471
     472
     473
    449474
    450475