Mercurial > ecos
diff packages/io/flash/current/src/flash.c @ 2633:592d727733df
* src/flash.c (cyg_flash_init): Allow repeated calls to
change the printf function for all devices. There are
times you don't any output, eg you are downloading an
image over the serial port.
| author | jlarmour |
|---|---|
| date | Tue, 18 Nov 2008 01:57:58 +0000 |
| parents | a2f5434df2cb |
| children | 74dbf4c3f2e1 |
line wrap: on
line diff
--- a/packages/io/flash/current/src/flash.c +++ b/packages/io/flash/current/src/flash.c @@ -223,10 +223,16 @@ cyg_flash_init(cyg_flash_printf *pf) int err; struct cyg_flash_dev * dev; - if (init) return CYG_FLASH_ERR_OK; - CYG_ASSERT(&(cyg_flashdevtab[CYGHWR_IO_FLASH_DEVICE]) == &cyg_flashdevtab_end, "incorrect number of flash devices"); + if (init) { + // In case the printf function has changed. + for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) { + dev->pf = pf; + } + return CYG_FLASH_ERR_OK; + } + for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) { dev->pf = pf; LOCK_INIT(dev);
