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 <borneo.antonio@gmail.com>
Fixes: 051e80812b
("drivers/jlink: fix calculate_swo_prescaler formula")
Reviewed-on: http://openocd.zylin.com/5846
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
This commit is contained in:
parent
87d2651edc
commit
9a877a83a1
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue