Example code, Configure virtex – Sundance SMT356 User Manual

Page 18

Advertising
background image

Version 2.1

Page 18 of 26

SMT356356 User Manual

Example Code

Configure Virtex

(included in file scope356.c)

Open Virtex configuration file

if (!( fp = fopen("smt356.mcs","rb") )) {

printf("Could not open smt356.mcs file.\n");

exit(0);

}

Read configuration file until the end

while (not_end) {

// read start character ':'

ch=fgetcc(fp);

// read byte count

byte_count =hex2dec(fgetcc(fp))<<4;

byte_count+=hex2dec(fgetcc(fp));

// read address

address =hex2dec(fgetcc(fp))<<12;

address+=hex2dec(fgetcc(fp))<<8;

address+=hex2dec(fgetcc(fp))<<4;

address+=hex2dec(fgetcc(fp));

// read record type

record_type =hex2dec(fgetcc(fp))<<4;

record_type+=hex2dec(fgetcc(fp));

record_decoded=0;

Advertising