Packaged Services

Top  Previous  Next

Faster Standard I/O

 

At any time, a task on the root can make a single function call that  switch the host link away from the host comport to the HSC. From then on, all host references  use the HSC. In particular, all the standard library calls (fopen, fread, fwrite,…)  continue to work as before, but at a potentially greater rate. Once the HSC has been selected in this way it  not be possible to switch back to the host comport and you  not be able to use the HSC for any other purpose. This service requires the Diamond server to be running on the host.

 

select_fast_host_io

#include <SMT_FHIO.h>

int select_fast_host_io ( void);

 stand-alone

This function switches the host link from a comport to the high-speed channel. It should be called only once from any host task. It is only worthwhile doing this if you transfer large amounts of data between the host and the root processor.

 

The return value is zero for success. Failure is indicated by a non-zero return code, and is most commonly the result of using old or inappropriate firmware.

 

Once the host link has been switched to the HSC it cannot be switched back to the comport.

 

For example:

 

// Examples\General\FhostIO.C

#include <stdio.h>

#include <SMT_FHIO.h>

 

main() {

   int n;

   char *where = "comport";

   for (n=0; n<200; n++) {

      printf("This goes across the %s: %d\n", where, n);

      if (n==99) {

         int e = select_fast_host_io();

         if (e==0) {

            where = "HSC";

         } else {

            printf("Cannot switch to HSC. Error=%d\n", e);

         }

      }

   }

}

 

 

File Transfers

 

There is an HscFile library, available from Sundance, that implements file transfers across the HSC. Its functionality is similar to fread and fwrite, but is sacrifices the flexibility of those functions to gain increased performance.

 

Performance

 

Although the HSC can transfer data quickly, there is a considerable overhead in setting up and starting each individual transfer. This is not significant when you are moving large volumes of data, but can dominate the time taken to handle small transfers.