This is an automated email from Gerrit.

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

-- gerrit

commit 7d6c58a659d13f04785c58c8d332a02d672cabd7
Author: Antonio Borneo <[email protected]>
Date:   Thu Oct 1 14:19:16 2020 +0200

    drivers/jlink: fix (again) calculate_swo_prescaler formula
    
    The prescaler computation should round at the nearest integer
    value, not to the next integer value.
    
    Change-Id: I957e0774421211f3c4ba4b312738b1c67b87c4a2
    Signed-off-by: Antonio Borneo <[email protected]>
    Fixes: 051e80812b1b ("drivers/jlink: fix calculate_swo_prescaler formula")

diff --git a/src/jtag/drivers/jlink.c b/src/jtag/drivers/jlink.c
index 910799c..ae8ce49 100644
--- a/src/jtag/drivers/jlink.c
+++ b/src/jtag/drivers/jlink.c
@@ -1269,8 +1269,7 @@ static uint32_t calculate_trace_buffer_size(void)
 static bool calculate_swo_prescaler(unsigned int traceclkin_freq,
                uint32_t trace_freq, uint16_t *prescaler)
 {
-       unsigned int presc;
-       presc = DIV_ROUND_UP(traceclkin_freq, trace_freq);
+       unsigned int presc = (traceclkin_freq + trace_freq / 2) / trace_freq;
        if (presc > TPIU_ACPR_MAX_SWOSCALER)
                return false;
 

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to