add counting total size of received file

pull/32/head
rtlaka 2017-10-25 13:58:55 +02:00
parent 036fb47dc3
commit 7e380b671c
2 changed files with 7 additions and 2 deletions

View File

@ -78,6 +78,7 @@ int FOE_fopen (char *name, uint8_t num_chars, uint32_t pass, uint8_t op)
{
foe_file = &foe_files[i];
foe_file->address_offset = 0;
foe_file->total_size = 0;
switch (op)
{
case FOE_OP_RRQ:
@ -157,6 +158,8 @@ uint16_t FOE_fwrite (uint8_t *data, uint16_t length)
ncopied++;
}
foe_file->total_size += ncopied;
DPRINT("FOE_fwrite END with : %d\n",ncopied);
return ncopied;
}

View File

@ -27,9 +27,11 @@ struct foe_writefile_cfg
uint32_t dest_start_address;
/** Current address during write of file */
uint32_t address_offset;
/* FoE password */
/** Calculated size of file received */
uint32_t total_size;
/** FoE password */
uint32_t filepass;
/* Pointer to application foe write function */
/** Pointer to application foe write function */
uint32_t (*write_function) (foe_writefile_cfg_t * self, uint8_t * data);
};