diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2010-09-29 18:43:56 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2010-11-07 21:36:17 +0100 |
commit | 379608d218e053c4de1502b3c8b0be83f17a277e (patch) | |
tree | ae43444ab90b57685616c501b7ba298ac62b7ac0 /src/target/firmware/calypso/dsp.c | |
parent | da738824a0e84cb273ac873d92ef87e1cd39d42c (diff) |
target/fw/dsp: Create a common function to start running code
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/target/firmware/calypso/dsp.c')
-rw-r--r-- | src/target/firmware/calypso/dsp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/target/firmware/calypso/dsp.c b/src/target/firmware/calypso/dsp.c index 82dcb29e..2ce0bc7d 100644 --- a/src/target/firmware/calypso/dsp.c +++ b/src/target/firmware/calypso/dsp.c @@ -108,6 +108,14 @@ static void dsp_bl_wait_ready(void) while (readw(BL_CMD_STATUS) != BL_STATUS_IDLE); } +static void dsp_bl_start_at(uint16_t addr) +{ + writew(0, BL_ADDR_HI); + writew(addr, BL_ADDR_LO); + writew(0, BL_SIZE); + writew(BL_CMD_COPY_BLOCK, BL_CMD_STATUS); +} + static int dsp_upload_sections_api(const struct dsp_section *sec, uint16_t dsp_base_api) { for (; sec->data; sec++) { @@ -186,9 +194,7 @@ static void dsp_set_params(int16_t *param_tab, int param_size) dsp_dump_version(); dputs("Finishing download phase\n"); - writew(0, BL_SIZE); - writew(DSP_START, BL_ADDR_LO); - writew(BL_CMD_COPY_BLOCK, BL_CMD_STATUS); + dsp_bl_start_at(DSP_START); dsp_dump_version(); } @@ -628,11 +634,7 @@ void dsp_dump(void) /* Load and execute our dump code in the DSP */ dsp_upload_sections_api(dsp_dumpcode, DSP_BASE_API); - - writew(0, BL_ADDR_HI); - writew(DSP_DUMPCODE_START, BL_ADDR_LO); - writew(0, BL_SIZE); - writew(BL_CMD_COPY_BLOCK, BL_CMD_STATUS); + dsp_bl_start_at(DSP_DUMPCODE_START); /* our dump code actually simulates the boot loaded * but with added read commands */ |