comparison 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
comparison
equal deleted inserted replaced
2632:8efe2e4d41ee 2633:592d727733df
221 cyg_flash_init(cyg_flash_printf *pf) 221 cyg_flash_init(cyg_flash_printf *pf)
222 { 222 {
223 int err; 223 int err;
224 struct cyg_flash_dev * dev; 224 struct cyg_flash_dev * dev;
225 225
226 if (init) return CYG_FLASH_ERR_OK;
227
228 CYG_ASSERT(&(cyg_flashdevtab[CYGHWR_IO_FLASH_DEVICE]) == &cyg_flashdevtab_end, "incorrect number of flash devices"); 226 CYG_ASSERT(&(cyg_flashdevtab[CYGHWR_IO_FLASH_DEVICE]) == &cyg_flashdevtab_end, "incorrect number of flash devices");
229 227
228 if (init) {
229 // In case the printf function has changed.
230 for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) {
231 dev->pf = pf;
232 }
233 return CYG_FLASH_ERR_OK;
234 }
235
230 for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) { 236 for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) {
231 dev->pf = pf; 237 dev->pf = pf;
232 LOCK_INIT(dev); 238 LOCK_INIT(dev);
233 239
234 err = dev->funs->flash_init(dev); 240 err = dev->funs->flash_init(dev);