This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[trunk+v3] Reinstate cyg_flash_init arg


After further discussion on ecos-maintainers, after all I'm reinstating the printf argument to cyg_flash_init. However a non-NULL setting (while still in practice working for the moment) will officially be deprecated. Instead cyg_flash_set_global_printf should be used and will be the only supported method of setting the printf function for eCos v3 onwards.

Checked in trunk and v3 branch.

Jifl
--
------["The best things in life aren't things."]------      Opinions==mine
Index: devs/flash/spi/m25pxx/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/spi/m25pxx/current/ChangeLog,v
retrieving revision 1.2
diff -u -5 -p -r1.2 ChangeLog
--- devs/flash/spi/m25pxx/current/ChangeLog	19 Feb 2009 00:10:21 -0000	1.2
+++ devs/flash/spi/m25pxx/current/ChangeLog	20 Feb 2009 21:50:35 -0000
@@ -1,5 +1,10 @@
+2009-02-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* test/m25pxx_test.c (cyg_user_start): Call cyg_flash_init() with
+	NULL argument.
+
 2009-02-18  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* test/m25pxx_test.c (cyg_user_start): Update for minor flash API
 	mod to call cyg_flash_set_global_printf() to set printf
 	function.
Index: devs/flash/spi/m25pxx/current/test/m25pxx_test.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/spi/m25pxx/current/test/m25pxx_test.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 m25pxx_test.c
--- devs/flash/spi/m25pxx/current/test/m25pxx_test.c	19 Feb 2009 00:10:21 -0000	1.2
+++ devs/flash/spi/m25pxx/current/test/m25pxx_test.c	20 Feb 2009 21:50:37 -0000
@@ -375,11 +375,11 @@ void cyg_user_start
     (void)
 {
     do_version();
     diag_printf ("----\nChecking for M25Pxx compatible devices.\n");
     cyg_flash_set_global_printf((cyg_flash_printf *)&diag_printf);
-    cyg_flash_init();
+    cyg_flash_init(NULL);
     CYG_TEST_INIT();
     cyg_thread_create(
         10,                                   // Arbitrary priority
         (cyg_thread_entry_t*) run_tests,      // Thread entry point
         0,                                    // 
Index: devs/flash/synth/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synth/current/ChangeLog,v
retrieving revision 1.13
diff -u -5 -p -r1.13 ChangeLog
--- devs/flash/synth/current/ChangeLog	19 Feb 2009 00:11:07 -0000	1.13
+++ devs/flash/synth/current/ChangeLog	20 Feb 2009 21:50:39 -0000
@@ -1,5 +1,10 @@
+2009-02-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/flash2.c (cyg_user_start): Call cyg_flash_init with
+	NULL arg.
+
 2009-02-18  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* tests/flash2.c (cyg_user_start): Update for minor flash API
 	mod to call cyg_flash_set_global_printf() to set printf
 	function.
Index: devs/flash/synth/current/tests/flash2.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synth/current/tests/flash2.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 flash2.c
--- devs/flash/synth/current/tests/flash2.c	19 Feb 2009 00:11:07 -0000	1.5
+++ devs/flash/synth/current/tests/flash2.c	20 Feb 2009 21:50:39 -0000
@@ -88,11 +88,11 @@ void cyg_user_start(void)
     cyg_uint32 j;
     
     CYG_TEST_INIT();
   
     cyg_flash_set_global_printf((cyg_flash_printf *)&diag_printf);
-    ret=cyg_flash_init();
+    ret=cyg_flash_init(NULL);
   
     CYG_TEST_PASS_FAIL((ret == CYG_FLASH_ERR_OK),"flash_init");
 
     do {
       ret = cyg_flash_get_info(i, &info);
Index: devs/flash/synthv2/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synthv2/current/ChangeLog,v
retrieving revision 1.8
diff -u -5 -p -r1.8 ChangeLog
--- devs/flash/synthv2/current/ChangeLog	19 Feb 2009 00:13:34 -0000	1.8
+++ devs/flash/synthv2/current/ChangeLog	20 Feb 2009 21:50:39 -0000
@@ -1,5 +1,11 @@
+2009-02-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/flash2.c (cyg_user_start): Call cyg_flash_init() with
+	NULL argument.
+	* tests/flash3.c (cyg_user_start): Ditto.
+
 2009-02-18  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* tests/flash2.c (cyg_user_start): Update for minor flash API
 	mod to call cyg_flash_set_global_printf() to set printf
 	function.
Index: devs/flash/synthv2/current/tests/flash2.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synthv2/current/tests/flash2.c,v
retrieving revision 1.6
diff -u -5 -p -r1.6 flash2.c
--- devs/flash/synthv2/current/tests/flash2.c	19 Feb 2009 00:13:34 -0000	1.6
+++ devs/flash/synthv2/current/tests/flash2.c	20 Feb 2009 21:50:39 -0000
@@ -94,11 +94,11 @@ void cyg_user_start(void)
     unsigned char * ptr;
 
     CYG_TEST_INIT();
   
     cyg_flash_set_global_printf((cyg_flash_printf *)&diag_printf);
-    ret=cyg_flash_init();
+    ret=cyg_flash_init(NULL);
     
     CYG_TEST_PASS_FAIL((ret == CYG_FLASH_ERR_OK),"flash_init");
 
     do {
       ret = cyg_flash_get_info(i, &info);
Index: devs/flash/synthv2/current/tests/flash3.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/flash/synthv2/current/tests/flash3.c,v
retrieving revision 1.6
diff -u -5 -p -r1.6 flash3.c
--- devs/flash/synthv2/current/tests/flash3.c	19 Feb 2009 00:13:34 -0000	1.6
+++ devs/flash/synthv2/current/tests/flash3.c	20 Feb 2009 21:50:39 -0000
@@ -118,11 +118,11 @@ void cyg_user_start(void)
 
     // Reference the flash dev so the linker does not throw it away
     CYG_REFERENCE_OBJECT(cyg_flash_synth_flashdev_flash3);  
 
     cyg_flash_set_global_printf((cyg_flash_printf *)&diag_printf);
-    ret=cyg_flash_init();
+    ret=cyg_flash_init(NULL);
     
     CYG_TEST_PASS_FAIL((ret == CYG_FLASH_ERR_OK),"flash_init");
 
     do {
       ret = cyg_flash_get_info(i, &info);
Index: io/flash/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/ChangeLog,v
retrieving revision 1.50
diff -u -5 -p -r1.50 ChangeLog
--- io/flash/current/ChangeLog	19 Feb 2009 00:14:26 -0000	1.50
+++ io/flash/current/ChangeLog	20 Feb 2009 21:51:17 -0000
@@ -1,5 +1,17 @@
+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
 	takes a printf function argument. Instead two new API functions
 	are available: cyg_flash_set_printf() and
Index: io/flash/current/doc/flash.sgml
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/doc/flash.sgml,v
retrieving revision 1.7
diff -u -5 -p -r1.7 flash.sgml
--- io/flash/current/doc/flash.sgml	19 Feb 2009 00:14:26 -0000	1.7
+++ io/flash/current/doc/flash.sgml	20 Feb 2009 21:51:18 -0000
@@ -116,11 +116,21 @@ the FLASH library should include.</PARA>
 <PARA>The FLASH library needs to be initialized before other FLASH
 operations can be performed. This only needs to be done once. The
 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>
 <TITLE>Retrieving information about FLASH devices</TITLE> 
 
@@ -251,11 +261,11 @@ __externC int cyg_flash_unlock(const cyg
 </PROGRAMLISTING>
 
 </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
 FLASH operations. This makes the API defined here thread safe. However
 applications may wish to directly access the contents of the FLASH. In
@@ -269,11 +279,11 @@ __externC int cyg_flash_mutex_lock(const
 __externC int cyg_flash_mutex_unlock(const cyg_flashaddr_t from, size_t len);
 </PROGRAMLISTING>
 
 </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
 called to perform diagnostic output. The function to be used can
 be configured with the following functions: </PARA>
Index: io/flash/current/include/flash.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/include/flash.h,v
retrieving revision 1.21
diff -u -5 -p -r1.21 flash.h
--- io/flash/current/include/flash.h	19 Feb 2009 00:14:26 -0000	1.21
+++ io/flash/current/include/flash.h	20 Feb 2009 21:51:18 -0000
@@ -78,11 +78,11 @@ typedef struct {
   cyg_uint32                    num_block_infos;    // Number of entries
   const cyg_flash_block_info_t* block_info;         // Info about block sizes
 } 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);
 __externC int cyg_flash_get_info(cyg_uint32 devno, 
                                  cyg_flash_info_t * info);
Index: io/flash/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flash.c,v
retrieving revision 1.31
diff -u -5 -p -r1.31 flash.c
--- io/flash/current/src/flash.c	19 Feb 2009 00:14:26 -0000	1.31
+++ io/flash/current/src/flash.c	20 Feb 2009 21:51:21 -0000
@@ -218,17 +218,21 @@ find_dev(cyg_flashaddr_t addr, int* stat
 // Initialise all registered device. Any device that fails to
 // initialise we leave dev->init as false. Then sort the devices into
 // 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;
   }
 
   for (dev = &cyg_flashdevtab[0]; dev != &cyg_flashdevtab_end; dev++) {
Index: io/flash/current/src/flashiodev.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flashiodev.c,v
retrieving revision 1.11
diff -u -5 -p -r1.11 flashiodev.c
--- io/flash/current/src/flashiodev.c	19 Feb 2009 00:14:26 -0000	1.11
+++ io/flash/current/src/flashiodev.c	20 Feb 2009 21:51:22 -0000
@@ -124,11 +124,11 @@ BLOCK_DEVTAB_ENTRY( cyg_io_flashdev,
 // FUNCTIONS
 
 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)
   {
       for (i=0; i<CYGNUM_IO_FLASH_BLOCK_DEVICES; i++)
Index: io/flash/current/src/flashiodevlegacy.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/flashiodevlegacy.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 flashiodevlegacy.c
--- io/flash/current/src/flashiodevlegacy.c	19 Feb 2009 00:14:26 -0000	1.3
+++ io/flash/current/src/flashiodevlegacy.c	20 Feb 2009 21:51:25 -0000
@@ -75,11 +75,11 @@ 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()
 
 static Cyg_ErrNo
Index: io/flash/current/src/legacy_api.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/flash/current/src/legacy_api.c,v
retrieving revision 1.4
diff -u -5 -p -r1.4 legacy_api.c
--- io/flash/current/src/legacy_api.c	19 Feb 2009 00:14:26 -0000	1.4
+++ io/flash/current/src/legacy_api.c	20 Feb 2009 21:51:25 -0000
@@ -56,11 +56,11 @@
 
 int
 flash_init(_printf *pf)
 {
   cyg_flash_set_global_printf(pf);
-  return cyg_flash_init();
+  return cyg_flash_init(NULL);
 }
 
 int
 flash_verify_addr(void *target)
 {
Index: redboot/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.264
diff -u -5 -p -r1.264 ChangeLog
--- redboot/current/ChangeLog	19 Feb 2009 00:16:37 -0000	1.264
+++ redboot/current/ChangeLog	20 Feb 2009 21:51:48 -0000
@@ -1,5 +1,10 @@
+2009-02-20  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* src/flash.c (do_flash_init): Call cyg_flash_init() with
+	NULL argument.
+
 2009-02-19  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/flash.c (do_flash_init): Update for minor flash API
         mod to call cyg_flash_set_global_printf() to set printf
         function.
Index: redboot/current/src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.87
diff -u -5 -p -r1.87 flash.c
--- redboot/current/src/flash.c	19 Feb 2009 00:16:37 -0000	1.87
+++ redboot/current/src/flash.c	20 Feb 2009 21:51:54 -0000
@@ -1861,11 +1861,11 @@ do_flash_init(void)
 
     if (!__flash_init) {
         __flash_init = 1;
 
         cyg_flash_set_global_printf((cyg_flash_printf *)&diag_printf);
-        if ((stat = cyg_flash_init()) != 0) {
+        if ((stat = cyg_flash_init(NULL)) != 0) {
             diag_printf("FLASH: driver init failed: %s\n", cyg_flash_errmsg(stat));
             return -1;
         }
 
 #ifdef CYGNUM_REDBOOT_FLASH_BASE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]