William H. wrote:
Would it be feasible to simply pass the desired transmit data (1?s and
0?s) to the HDLC block (which you mentioned) by just having another
method in the block, say “tx_data(char[#]),” which would take in an
array of bytes; and then, after tagging on the CRC, SOF, EOF etc, go
through the array stuffing ones and zeros into the FIFO buffer? This
tx_data() function would be called in Python, in some kind of control loop.
In other words, could I do it just by calling a method to pass desired
data from the Python code?
Certainly, as long as your Python code could keep up with the datarate.
Otherwise, you’ll have to call the method from C++.
Also, I am not familiar with TUN/TAP devices do you have any examples
about how this works on both ends? Or any references?
The TUN/TAP device is a pseudo ethernet device driver. To the network
stack in the kernel, it looks just like any other ethernet device. But
instead of delivering its packets to some ethernet hardware, it
instead delivers them to an application program running in user space.
Similarly, for reception, it accepts packets from a user space program
instead of from some ethernet hardware.
It can operate in one of two different modes. The a “TAP” device
deals with the raw ethernet packets. The full packet, including
all header and trailer bytes, is delivered to the application program.
Similarly, in the other direction, it is the application program’s
responsibility to fabricate a complete and correct ethernet packet.
The “TUN” device takes care of the ethernet portion of the packet
and only delivers it’s payload to the application program. Similarly,
in the other direction, the application only needs to provide the
payload. The “TUN” device driver takes care of encapsulating it in
an ethernet packet.
Start with http://en.wikipedia.org/wiki/TUN/TAP and follow the