Changes between Version 64 and Version 65 of Developer/Simulators/QEMU/CANEmulation


Ignore:
Timestamp:
Sep 12, 2013, 12:15:42 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

    v64 v65  
    412412==  Add writing routine  ==
    413413
    414 The writing routine is simple. We add the can_chr_write() function as writing routine.
    415 
     414The writing routine is simple. We use the can_chr_write() function as a writing routine, we also should assign this function to CharDriverState.chr_write If we want to call the writing routine in PCI-CAN device, the function qemu_chr_fe_write() should be called instead of calling the can_chr_write() function directly.
     415
     416The source code is just like the following, details in qemu-char.c file.
     417  static int can_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
     418  {
     419    ......
     420  }
     421  static CharDriverState *qemu_chr_open_can(QemuOpts *opts)
     422  {
     423    CharDriverState *chr;
     424    ......
     425    chr->chr_write = can_chr_write;
     426    ......
     427  }
     428This is same with the ioctl funciton.
     429==  Add reading routine  ==
    416430
    417431