diff options
author | Tim Newsome <tim@sifive.com> | 2017-12-21 16:23:46 -0800 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2017-12-21 16:23:46 -0800 |
commit | fadf2c1b48789d6f84129875afa7fefae130add2 (patch) | |
tree | e131dd7a32337eb4e3ba14a74dec8fcff59337d0 /src | |
parent | 33ef457c6aebdf47cb02857c8150110a62d1afc1 (diff) | |
download | riscv-openocd-fadf2c1b48789d6f84129875afa7fefae130add2.zip riscv-openocd-fadf2c1b48789d6f84129875afa7fefae130add2.tar.gz riscv-openocd-fadf2c1b48789d6f84129875afa7fefae130add2.tar.bz2 |
Make functions static. Free memory.
Change-Id: Iadf7b2a926d6d5abc4c8daa2f5620886bcb09b31
Diffstat (limited to 'src')
-rw-r--r-- | src/flash/nor/fespi.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index 9b53d2d..04f037d 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -598,7 +598,7 @@ struct algorithm_steps { uint8_t **steps; }; -struct algorithm_steps *as_new(unsigned size) +static struct algorithm_steps *as_new(unsigned size) { struct algorithm_steps *as = calloc(1, sizeof(struct algorithm_steps)); as->size = size; @@ -606,7 +606,7 @@ struct algorithm_steps *as_new(unsigned size) return as; } -struct algorithm_steps *as_delete(struct algorithm_steps *as) +static struct algorithm_steps *as_delete(struct algorithm_steps *as) { for (unsigned step = 0; step < as->used; step++) { free(as->steps[step]); @@ -616,7 +616,7 @@ struct algorithm_steps *as_delete(struct algorithm_steps *as) return NULL; } -int as_empty(struct algorithm_steps *as) +static int as_empty(struct algorithm_steps *as) { for (unsigned s = 0; s < as->used; s++) { if (as->steps[s][0] != STEP_NOP) @@ -626,7 +626,7 @@ int as_empty(struct algorithm_steps *as) } // Return size of compiled program. -unsigned as_compile(struct algorithm_steps *as, uint8_t *target, +static unsigned as_compile(struct algorithm_steps *as, uint8_t *target, unsigned target_size) { unsigned offset = 0; @@ -693,7 +693,7 @@ unsigned as_compile(struct algorithm_steps *as, uint8_t *target, return offset; } -void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data) +static void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data) { LOG_DEBUG("count=%d", count); while (count > 0) { @@ -709,14 +709,14 @@ void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data) } } -void as_add_tx1(struct algorithm_steps *as, uint8_t byte) +static void as_add_tx1(struct algorithm_steps *as, uint8_t byte) { uint8_t data[1]; data[0] = byte; as_add_tx(as, 1, data); } -void as_add_write_reg(struct algorithm_steps *as, uint8_t offset, uint8_t data) +static void as_add_write_reg(struct algorithm_steps *as, uint8_t offset, uint8_t data) { assert(as->used < as->size); as->steps[as->used] = malloc(3); @@ -726,7 +726,7 @@ void as_add_write_reg(struct algorithm_steps *as, uint8_t offset, uint8_t data) as->used++; } -void as_add_txwm_wait(struct algorithm_steps *as) +static void as_add_txwm_wait(struct algorithm_steps *as) { assert(as->used < as->size); as->steps[as->used] = malloc(1); @@ -734,7 +734,7 @@ void as_add_txwm_wait(struct algorithm_steps *as) as->used++; } -void as_add_wip_wait(struct algorithm_steps *as) +static void as_add_wip_wait(struct algorithm_steps *as) { assert(as->used < as->size); as->steps[as->used] = malloc(1); @@ -742,7 +742,7 @@ void as_add_wip_wait(struct algorithm_steps *as) as->used++; } -void as_add_set_dir(struct algorithm_steps *as, bool dir) +static void as_add_set_dir(struct algorithm_steps *as, bool dir) { assert(as->used < as->size); as->steps[as->used] = malloc(2); @@ -964,6 +964,8 @@ err: target_free_working_area(target, algorithm_wa); } + as_delete(as); + /* Switch to HW mode before return to prompt */ FESPI_ENABLE_HW_MODE(); return retval; |