Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move fbuffer and buffer_size from foe_file_cfg to foe_cfg #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions soes/esc_foe.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static uint32_t FOE_fread (uint8_t * data, uint32_t maxlength)
while (maxlength && (FOEvar.fend - FOEvar.fposition))
{
maxlength--;
*(data++) = foe_cfg->fbuffer[FOEvar.fposition++];
*(data++) = foe_file->fbuffer[FOEvar.fposition++];
ncopied++;
}

Expand Down Expand Up @@ -154,12 +154,12 @@ static uint32_t FOE_fwrite (uint8_t *data, uint32_t length)
while (length && (FOEvar.fend - FOEvar.fposition) && !failed)
{
length--;
foe_cfg->fbuffer[FOEvar.fbufposition++] = *(data++);
if(FOEvar.fbufposition >= foe_cfg->buffer_size)
foe_file->fbuffer[FOEvar.fbufposition++] = *(data++);
if(FOEvar.fbufposition >= foe_file->buffer_size)
{
failed = foe_file->write_function (foe_file, foe_cfg->fbuffer, FOEvar.fbufposition);
failed = foe_file->write_function (foe_file, foe_file->fbuffer, FOEvar.fbufposition);
FOEvar.fbufposition = 0;
foe_file->address_offset += foe_cfg->buffer_size;
foe_file->address_offset += foe_file->buffer_size;
}
FOEvar.fposition++;
if(failed)
Expand Down Expand Up @@ -190,7 +190,7 @@ static uint32_t FOE_fclose (void)

DPRINT("FOE_fclose\n");

failed = foe_file->write_function (foe_file, foe_cfg->fbuffer, FOEvar.fbufposition);
failed = foe_file->write_function (foe_file, foe_file->fbuffer, FOEvar.fbufposition);
foe_file->address_offset += FOEvar.fbufposition;
FOEvar.fbufposition = 0;

Expand Down
8 changes: 4 additions & 4 deletions soes/esc_foe.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ struct foe_file_cfg
const char * name;
/** Size of file,sizeof data we can recv */
uint32_t max_data;
/** Allocate static in caller func to fit buffer_size */
uint8_t * fbuffer;
/** Buffer size before we flush to destination */
uint32_t buffer_size;
/** Where to store the data initially */
uint32_t dest_start_address;
/** Current address during write of file */
Expand All @@ -41,10 +45,6 @@ struct foe_file_cfg

typedef struct foe_cfg
{
/** Allocate static in caller func to fit buffer_size */
uint8_t * fbuffer;
/** Buffer size before we flush to destination */
uint32_t buffer_size;
/** Number of files used in firmware update */
uint32_t n_files;
/** Pointer to files configured to be used by FoE */
Expand Down
Loading