changeset 2826:ccce4b32433a

* include/flash.h: Reinstate printf arg to cyg_flash_init, but it will now be officially required to be set to NULL. * src/flash.c (cyg_flash_init): Act on printf arg again (even though it's not meant to be non-NULL). * src/flashiodev.c (flashiodev_init): Call cyg_flash_init with NULL. * src/flashiodevlegacy.c (flashiodev_init): Ditto. * src/legacy_api.c (flash_init): Ditto. * doc/flash.sgml: Update cyg_flash_init as above, deprecating use of non-NULL parameter.
author jlarmour
date Fri, 20 Feb 2009 22:06:15 +0000
parents df9bb4e77d5f
children 16bd2526e63f
files packages/io/flash/current/ChangeLog packages/io/flash/current/doc/flash.sgml packages/io/flash/current/include/flash.h packages/io/flash/current/src/flash.c packages/io/flash/current/src/flashiodev.c packages/io/flash/current/src/flashiodevlegacy.c packages/io/flash/current/src/legacy_api.c
diffstat 7 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/flash/current/ChangeLog
+++ b/packages/io/flash/current/ChangeLog
@@ -1,3 +1,15 @@
+2009-02-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* include/flash.h: Reinstate printf arg to cyg_flash_init, but it
+	will now be officially required to be set to NULL.
+	* src/flash.c (cyg_flash_init): Act on printf arg again (even though
+	it's not meant to be non-NULL).
+	* src/flashiodev.c (flashiodev_init): Call cyg_flash_init with NULL.
+	* src/flashiodevlegacy.c (flashiodev_init): Ditto.
+	* src/legacy_api.c (flash_init): Ditto.
+	* doc/flash.sgml: Update cyg_flash_init as above, deprecating use of
+	non-NULL parameter.
+
 2009-02-18  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* include/flash.h: Modest API change: cyg_flash_init() no longer
--- a/packages/io/flash/current/doc/flash.sgml
+++ b/packages/io/flash/current/doc/flash.sgml
@@ -118,7 +118,17 @@ operations can be performed. This only n
 following function will only do the initialization once so it's safe
 to call multiple times: </PARA>
 
-<PROGRAMLISTING>__externC int cyg_flash_init(void); </PROGRAMLISTING>
+<PROGRAMLISTING>__externC int cyg_flash_init(cyg_flash_printf *pf); </PROGRAMLISTING>
+
+<PARA>
+The parameter <parameter>pf</parameter> must always be set to NULL. It
+exists solely for backward compatibility and other settings are deprecated
+and obsolete. Past use of this parameter has now been replaced with use of
+the <link
+linkend="ecos-flash-v2-api-config-diag-output"><function>cyg_flash_set_global_printf</function></link>
+function.
+</PARA>
+
 </SECT2>
 
 <SECT2>
@@ -253,7 +263,7 @@ two functions are available:</PARA>
 </SECT2>
 
 <SECT2>
-<TITLE>Locking FLASH Mutex's</TITLE>
+<TITLE>Locking FLASH mutexes</TITLE>
 
 <PARA>When the eCos kernel package is included in the eCos
 configuration, the FLASH IO library will perform mutex locking on
@@ -271,7 +281,7 @@ blocked.</PARA>
 
 </SECT2>
 
-<SECT2>
+<SECT2 id="ecos-flash-v2-api-config-diag-output">
 <TITLE>Configuring diagnostic output</TITLE>
 
 <PARA> Each FLASH device can have an associated function which is
--- a/packages/io/flash/current/include/flash.h
+++ b/packages/io/flash/current/include/flash.h
@@ -80,7 +80,7 @@ typedef struct {
 } cyg_flash_info_t;
 
 typedef int cyg_flash_printf(const char *fmt, ...);
-__externC int cyg_flash_init(void);
+__externC int cyg_flash_init( cyg_flash_printf *pf );
 __externC int cyg_flash_set_printf(const cyg_flashaddr_t flash_base,
                                    cyg_flash_printf *pf);
 __externC void cyg_flash_set_global_printf(cyg_flash_printf *pf);
--- a/packages/io/flash/current/src/flash.c
+++ b/packages/io/flash/current/src/flash.c
@@ -220,13 +220,17 @@ find_dev(cyg_flashaddr_t addr, int* stat
 // ascending order of address and put them into a linked list. Lastly
 // check if we have any overlap of the addresses.
 __externC int 
-cyg_flash_init(void) 
+cyg_flash_init(cyg_flash_printf *pf)
 {
   int err;
   struct cyg_flash_dev * dev;
   
   CYG_ASSERT(&(cyg_flashdevtab[CYGHWR_IO_FLASH_DEVICE]) == &cyg_flashdevtab_end, "incorrect number of flash devices");
   
+  // In case the printf function has changed.
+  if (NULL != pf)
+      cyg_flash_set_global_printf(pf);
+
   if (init) {
       return CYG_FLASH_ERR_OK;
   }
--- a/packages/io/flash/current/src/flashiodev.c
+++ b/packages/io/flash/current/src/flashiodev.c
@@ -126,7 +126,7 @@ BLOCK_DEVTAB_ENTRY( cyg_io_flashdev,
 static bool
 flashiodev_init( struct cyg_devtab_entry *tab )
 {
-  int stat = cyg_flash_init();
+  int stat = cyg_flash_init(NULL);
   cyg_ucount32 i;
 
   if (stat == CYG_FLASH_ERR_OK)
--- a/packages/io/flash/current/src/flashiodevlegacy.c
+++ b/packages/io/flash/current/src/flashiodevlegacy.c
@@ -77,7 +77,7 @@ struct flashiodev_priv_t{
 static bool
 flashiodev_init( struct cyg_devtab_entry *tab )
 {
-  int stat = cyg_flash_init();
+  int stat = cyg_flash_init(NULL);
 
   return (stat == CYG_FLASH_ERR_OK);
 } // flashiodev_init()
--- a/packages/io/flash/current/src/legacy_api.c
+++ b/packages/io/flash/current/src/legacy_api.c
@@ -58,7 +58,7 @@ int
 flash_init(_printf *pf)
 {
   cyg_flash_set_global_printf(pf);
-  return cyg_flash_init();
+  return cyg_flash_init(NULL);
 }
 
 int