Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
eefd04b6
Unverified
Commit
eefd04b6
authored
Jan 30, 2018
by
davidcunado-arm
Committed by
GitHub
Jan 30, 2018
Browse files
Merge pull request #1235 from jwerner-chromium/JW_udelay
Fix udelay issues that can make duration slightly too short
parents
e47541ac
e2aec918
Changes
2
Hide whitespace changes
Inline
Side-by-side
drivers/delay_timer/delay_timer.c
View file @
eefd04b6
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <assert.h>
#include <assert.h>
#include <delay_timer.h>
#include <delay_timer.h>
#include <platform_def.h>
#include <platform_def.h>
#include <utils_def.h>
/***********************************************************
/***********************************************************
* The delay timer implementation
* The delay timer implementation
...
@@ -30,7 +31,8 @@ void udelay(uint32_t usec)
...
@@ -30,7 +31,8 @@ void udelay(uint32_t usec)
start
=
ops
->
get_timer_value
();
start
=
ops
->
get_timer_value
();
total_delta
=
(
usec
*
ops
->
clk_div
)
/
ops
->
clk_mult
;
/* Add an extra tick to avoid delaying less than requested. */
total_delta
=
div_round_up
(
usec
*
ops
->
clk_div
,
ops
->
clk_mult
)
+
1
;
do
{
do
{
/*
/*
...
...
include/lib/utils_def.h
View file @
eefd04b6
...
@@ -24,6 +24,11 @@
...
@@ -24,6 +24,11 @@
*/
*/
#define DIV_ROUND_UP_2EVAL(n, d) (((n) + (d) - 1) / (d))
#define DIV_ROUND_UP_2EVAL(n, d) (((n) + (d) - 1) / (d))
#define div_round_up(val, div) __extension__ ({ \
__typeof__(div) _div = (div); \
((val) + _div - 1) / _div; \
})
#define MIN(x, y) __extension__ ({ \
#define MIN(x, y) __extension__ ({ \
__typeof__(x) _x = (x); \
__typeof__(x) _x = (x); \
__typeof__(y) _y = (y); \
__typeof__(y) _y = (y); \
...
@@ -55,11 +60,6 @@
...
@@ -55,11 +60,6 @@
#define round_down(value, boundary) \
#define round_down(value, boundary) \
((value) & ~round_boundary(value, boundary))
((value) & ~round_boundary(value, boundary))
#define div_round_up(val, div) __extension__ ({ \
__typeof__(div) _div = (div); \
round_up((val), _div)/_div; \
})
/*
/*
* Evaluates to 1 if (ptr + inc) overflows, 0 otherwise.
* Evaluates to 1 if (ptr + inc) overflows, 0 otherwise.
* Both arguments must be unsigned pointer values (i.e. uintptr_t).
* Both arguments must be unsigned pointer values (i.e. uintptr_t).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment