Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Using the BF Device Read and Write VIs (Blackfin, Embedded Module)

The BF Device Read VI and the BF Device Write VI provide buffers to a device. The BF Device Read VI queues reception buffers to the Blackfin device for inbound data. The BF Device Write VI queues transmission buffers for outbound data.

Use the device open VIs to obtain the device reference in input. Use the BF Device Initialize Buffer VI to obtain the buffer reference in input. Use the BF Device Get Buffer VI to transfer data from a device buffer to an array.

Note Note  Except for the UART driver, the BF Device Read VI and the BF Device Write VI do not actually read or write device data. The BF Device Read VI and the BF Device Write VI associate a buffer with a device. For the UART driver, the BF Device Read VI actually reads from the UART and returns a string. The BF Device Write VI actually writes data to the UART from a string.

Configuring the Buffer for the BF Device Read VI and the BF Device Write VI

You can configure buffering as one-dimensional, two-dimensional, circular, or sequential one-dimensional using the BF Device Initialize Buffer VI. A Blackfin application can provide both one-dimensional and two-dimensional buffers to the same device and these buffers can be different sizes.

With one- or two-dimensional buffering, the application can provide one or more buffers to the device driver at the same time or sequentially. The application can send multiple buffers to the BF Device Read VI or BF Device Write VI. The application also can provide the device driver with additional buffers at any time before or after you enable the device with the BF Device Enable VI.

If you configure the device driver to run in asynchronous mode, you can flag the individual buffers to generate a callback when the device driver finishes processing the buffer. Set the set callback param? input for the BF Device Initialize Buffer VI to TRUE to flag a buffer to generate a callback. You can flag any combination of buffers to generate or not generate a callback.

With circular buffering, the application provides the device driver with one and only one buffer for inbound data. The application also can provide one and only one buffer for outbound data. These buffers point to a contiguous piece of memory that all the sub-buffers in the application use. After the device driver receives the buffer, the application never needs to send the device driver another buffer because the device driver uses that same buffer indefinitely.

Creating a Chained Buffer with Loopback

Use the BF Device Chain Buffers VI to concatenate two buffers. To create a chained buffer with loopback, pass the same buffer reference into both buffer reference inputs of the BF Device Chain Buffers VI.

Note Note  You must create the chained buffer with loopback before you enable the device with the BF Device Enable VI.

Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit