beautypg.com

Sundance SMT317 User Manual

Page 24

background image

Version 6.1

Page 24 of 24

SMT317 User Manual

//Allocation of a memory space to store the samples

samplestore=(int*)calloc(BUFFER_SIZE,sizeof(int));

if (samplestore!=NULL & samplestore_slave!=NULL)

printf("memory allocation was successful\n");

else

exit(1);

printf("Address of samplestore:%08x \n",samplestore);

/******************FPGA CONFIGURATION*********************/

printf("\nFirst bitstream\n");

Fast_FpgaConf(fpga_count, fpga_data,

COMMPORT1

);

printf("\nEND... \n");

/*******************ACQUISITION***************************/

SDB_init(SDB_CLROF|SDB_CLRIF|SDB_CLK,

SDB_CLROF|SDB_CLRIF|SDB_CLK);

control_word = BURST1K_IntClk_IntTrigger;

link_out_word(control_word,

COMMPORT1

);

sema_init(&internal_filled_b, 0);

thread_new(fill_internal_b, 1000, 0);

sema_wait(&internal_filled_b);

printf("done\n");

}

void fill_internal_b(void *x)

{

SDB_read (BUFFER_SIZE*sizeof(int), samplestore,

SDB_B

);

sema_signal(&internal_filled_b);

}