23.11.2014 Views

CompuScope SDK Manua.. - Egmont Instruments

CompuScope SDK Manua.. - Egmont Instruments

CompuScope SDK Manua.. - Egmont Instruments

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

offset += transfer_depth;<br />

position += transfer_depth;<br />

Note: At the end of this routine buffer will hold all the data. The 4 Kilosample transfer size limitation only<br />

applies for the gage_trigger_view_transfer routine using ISA bus <strong>CompuScope</strong>s.<br />

For PCI <strong>CompuScope</strong>s that support PCI busmastering, the gage_transfer_buffer_2 and<br />

gage_trigger_view_transfer_2 routines execute a PCI bus-mastering data transfer from on-board<br />

<strong>CompuScope</strong> memory to host memory (PC RAM). In bus-mastering mode, data are transferred directly<br />

from <strong>CompuScope</strong> memory to host memory with no CPU mediation required. PCI bus-mastering is the<br />

fastest available PCI data transfer method and can achieve sustained data transfer rates of 100<br />

MegaBytes/second.<br />

The difference between the gage_transfer_buffer_2 and gage_trigger_view_transfer_2 routines is<br />

exactly the same as the difference between gage_transfer_buffer and gage_trigger_view_transfer. That<br />

is, gage_transfer_buffer accepts absolute <strong>CompuScope</strong> on-board memory addresses, while<br />

gage_trigger_view_transfer downloads data starting at the address specified by the trigger_view_offset<br />

global driver variable.<br />

Internally using PCI bus-mastering, PCI, PCI <strong>CompuScope</strong> hardware can only transfer data from a d-word<br />

(4 byte) boundary in <strong>CompuScope</strong> on-board memory. For instance, data can be downloaded starting from<br />

hexadecimal addresses 0x3000 or 3004, but not starting from hexadecimal addresses 0x3001. Because the<br />

gage_transfer_buffer and gage_trigger_view_transfer routines use CPU mediated data transfer, these<br />

details are handled by the drivers and the user need be concerned with data alignment issues. Since<br />

gage_transfer_buffer_2 and gage_trigger_view_transfer_2 do PCI bus-mastering with no CPU<br />

mediation, however, the user must deal with these data alignment issues.<br />

Both gage_transfer_buffer_2 and gage_trigger_view_transfer_2 return a pointer that gives the byte<br />

address location in host memory of the start of the data requested by the call. For instance, let us assume<br />

that the user requested transfer of data starting from <strong>CompuScope</strong> on-board memory address hex 0x3002.<br />

Let us suppose also that the user allocated a buffer whose starting address is hex 0x10000. Due to its<br />

hardware architecture, the <strong>CompuScope</strong> would be forced to download data from hexadecimal addresses<br />

0x3000. gage_transfer_buffer_2 and gage_trigger_view_transfer_2 would then return a pointer with<br />

the value of 0x3002 – 0x3000 + 0x10000= 0x10002. So the user application should start looking at the<br />

data starting at pointer value 0x10002 and not at 0x10000.<br />

Because the <strong>CompuScope</strong> is forced to download data from a d-word boundary, the drivers may need to<br />

download more data than is requested by the users. Consequently, the target host memory buffer must be<br />

slightly larger than the requested amount of data to be transferred. The required amount of padding is<br />

different for different <strong>CompuScope</strong> models. The best padding method is to use the variable<br />

user_buffer_padding, which is returned by the drivers and is the amount of target buffer padding in Bytes<br />

required for the current <strong>CompuScope</strong> model. Simply add user_buffer_padding to the amount of memory<br />

to be allocated for the target host memory buffer.<br />

gage_transfer_buffer_3 and gage_trigger_view_transfer_3 are two routines that are similar to<br />

gage_transfer_buffer_2 and gage_trigger_view_transfer_2 routines, except for two very important<br />

differences:<br />

1. Both gage_transfer_buffer_2 and gage_trigger_view_transfer_2 return a pointer that gives the<br />

byte address location in host memory of the start of the data requested by the call. By contrast,<br />

the return value of gage_transfer_buffer_3 is an offset in bytes that specifies the location within<br />

the user allocated buffer to the start of the requested data. For gage_trigger_view_transfer_3,<br />

the return value is an offset in Bytes that specifies the location within the user allocated buffer to<br />

<strong>CompuScope</strong> API Reference <strong>Manua</strong>l<br />

95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!