int Write_flash( alt_flash_fd* fd, float *Ks_para,int test_offset)
{
int i;
int ret_code = 0;
alt_u8 *ptr_ks=(alt_u8*) Ks_para;
int test_length = sizeof(Ks_para);
// before writing in a sector, we should erase it before
ret_code=alt_erase_flash_block(fd, test_offset,regions->block_size);
if(!ret_code){
for(i=0;i<test_length;i++){
printf( "data_written[%d]= 0x%08x\n\r",i,ptr_ks[i]);
}
//ret_code = alt_epcq_controller_write_block(fd, test_offset, test_offset,ptr_ks, test_length);
ret_code=alt_write_flash_block(fd,test_offset,test_offset,ptr_ks,test_length);
}
if (ret_code)
{
printf( "\nERROR: function alt_write_flash failed. ret_code %d\n",ret_code);
return ret_code;
}
return ret_code;
}