diff options
Diffstat (limited to 'src/mempool.c')
| -rw-r--r-- | src/mempool.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mempool.c b/src/mempool.c index 34b4d4c51c..53f1162802 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -14,6 +14,7 @@ * 2006-06-30 Bernard fix the allocate/free block bug * 2006-08-04 Bernard add hook support * 2006-08-10 Bernard fix interrupt bug in rt_mp_alloc + * 2010-07-13 Bernard fix RT_ALIGN issue found by kuronca */ #include <rthw.h> @@ -88,7 +89,7 @@ rt_err_t rt_mp_init(struct rt_mempool* mp, const char* name, void *start, rt_siz /* init memory pool */ mp->start_address = start; - mp->size = RT_ALIGN(size, RT_ALIGN_SIZE); + mp->size = RT_ALIGN_DOWN(size, RT_ALIGN_SIZE); mp->block_size = block_size; @@ -294,11 +295,11 @@ void *rt_mp_alloc (rt_mp_t mp, rt_int32_t time) else { /* memory block is unavailable. */ - if (time == 0)
- {
+ if (time == 0) + { /* enable interrupt */ rt_hw_interrupt_enable(level); - return RT_NULL;
+ return RT_NULL; } else { |
