#include #include "ti_dsp.h" /* ---------------------------------------------------------------------- To load the DSP code and data to the DP RAM. The input is a file in extended Tektronix ASCII file format. ---------------------------------------------------------------------- */ int ti_dpsend_xfile(ti_dsp_p dsp, const char *chfile) { unsigned int addr, data[8]; char line[256]; int nw, size = 0; FILE *fd = fopen(chfile, "r"); if (fd == NULL){ perror(chfile); exit(1); } /* -- Read input file and send DSP data */ while (fgets(line, sizeof(line), fd) && 1 < (nw = sscanf(line, "%%%*5x8%8x%8x%8x%8x%8x%8x%8x%8x%8x", &addr, data+0, data+1, data+2, data+3, data+4, data+5, data+6, data+7))){ if (addr & 3){ fputs("ti_dpsend_xfile: Read unaligned data.\n", stderr); exit(1); } ti_dpcpy(dsp, addr>>2, data, nw-1); size += nw - 1; } fclose(fd); fprintf(stderr, "ti_dpsend_xfile: DSP data file %s loaded (%d words)\n", chfile, size); vme_check(); return size; }