This is an automated email from Gerrit.

Uwe Bonnes ([email protected]) just uploaded a new patch 
set to Gerrit, which you can find at http://openocd.zylin.com/2457

-- gerrit

commit a4c4951d0a55bc59b300eda855c8532d2c9312cf
Author: Uwe Bonnes <[email protected]>
Date:   Fri Jan 9 11:21:10 2015 +0100

    stm32f0x: Remove duplicate code for revision string.
    
    As of RM0091, Rev. 7, all F0 have the same revisioning scheme.
    
    Change-Id: I0b344a1d3ca3f61f48fa151e83c549ca5333ae47
    Signed-off-by: Uwe Bonnes <[email protected]>

diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 6b5aafc..e4fcca0 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -1040,6 +1040,21 @@ COMMAND_HANDLER(stm32x_handle_part_id_command)
 }
 #endif
 
+static const char *get_stm32f0_revision(uint16_t rev_id)
+{
+       const char *rev_str = NULL;
+
+       switch (rev_id) {
+       case 0x1000:
+               rev_str = "1.0";
+               break;
+       case 0x2000:
+               rev_str = "2.0";
+               break;
+       }
+       return rev_str;
+}
+
 static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
 {
        uint32_t dbgmcu_idcode;
@@ -1219,72 +1234,27 @@ static int get_stm32x_info(struct flash_bank *bank, 
char *buf, int buf_size)
 
        case 0x444:
                device_str = "STM32F03x";
-
-               switch (rev_id) {
-               case 0x1000:
-                       rev_str = "1.0";
-                       break;
-
-               case 0x2000:
-                       rev_str = "2.0";
-                       break;
-               }
+               rev_str = get_stm32f0_revision(rev_id);
                break;
 
        case 0x440:
                device_str = "STM32F05x";
-
-               switch (rev_id) {
-               case 0x1000:
-                       rev_str = "1.0";
-                       break;
-
-               case 0x2000:
-                       rev_str = "2.0";
-                       break;
-               }
+               rev_str = get_stm32f0_revision(rev_id);
                break;
 
        case 0x445:
                device_str = "STM32F04x";
-
-               switch (rev_id) {
-               case 0x1000:
-                       rev_str = "1.0";
-                       break;
-
-               case 0x2000:
-                       rev_str = "2.0";
-                       break;
-               }
+               rev_str = get_stm32f0_revision(rev_id);
                break;
 
        case 0x448:
                device_str = "STM32F07x";
-
-               switch (rev_id) {
-               case 0x1000:
-                       rev_str = "1.0";
-                       break;
-
-               case 0x2000:
-                       rev_str = "2.0";
-                       break;
-               }
+               rev_str = get_stm32f0_revision(rev_id);
                break;
 
        case 0x442:
                device_str = "STM32F09x";
-
-               switch (rev_id) {
-               case 0x1000:
-                       rev_str = "1.0";
-                       break;
-
-               case 0x2000:
-                       rev_str = "2.0";
-                       break;
-               }
+               rev_str = get_stm32f0_revision(rev_id);
                break;
 
        default:

-- 

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to