diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-11-08 10:08:14 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-11-08 10:08:14 +0000 |
commit | d558bc49bb2fafae239f4f9da53fa18a5b622a91 (patch) | |
tree | d263ca660c45e282cf71a6664ff049d1c0519617 /c/src | |
parent | 2011-11-08 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-d558bc49bb2fafae239f4f9da53fa18a5b622a91.tar.bz2 |
2011-11-08 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/utility.h: Fixed some casts.
* include/irq-generic.h: Define bsp_interrupt_handler_index_type
conditionally.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/shared/ChangeLog | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/shared/include/irq-generic.h | 12 | ||||
-rw-r--r-- | c/src/lib/libbsp/shared/include/utility.h | 31 |
3 files changed, 33 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog index 5e8a659599..d9dbbd9db1 100644 --- a/c/src/lib/libbsp/shared/ChangeLog +++ b/c/src/lib/libbsp/shared/ChangeLog @@ -1,3 +1,9 @@ +2011-11-08 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * include/utility.h: Fixed some casts. + * include/irq-generic.h: Define bsp_interrupt_handler_index_type + conditionally. + 2011-11-07 Sebastian Huber <sebastian.huber@embedded-brains.de> * console_private.h: Removed Console_Port_Minor declaration. diff --git a/c/src/lib/libbsp/shared/include/irq-generic.h b/c/src/lib/libbsp/shared/include/irq-generic.h index 181bc58e2c..5181952e6a 100644 --- a/c/src/lib/libbsp/shared/include/irq-generic.h +++ b/c/src/lib/libbsp/shared/include/irq-generic.h @@ -65,6 +65,13 @@ typedef struct bsp_interrupt_handler_entry bsp_interrupt_handler_entry; extern bsp_interrupt_handler_entry bsp_interrupt_handler_table []; #ifdef BSP_INTERRUPT_USE_INDEX_TABLE + #if BSP_INTERRUPT_HANDLER_TABLE_SIZE < 0x100 + typedef uint8_t bsp_interrupt_handler_index_type; + #elif BSP_INTERRUPT_HANDLER_TABLE_SIZE < 0x10000 + typedef uint16_t bsp_interrupt_handler_index_type; + #else + typedef uint32_t bsp_interrupt_handler_index_type; + #endif extern bsp_interrupt_handler_index_type bsp_interrupt_handler_index_table []; #endif @@ -102,10 +109,7 @@ static inline rtems_vector_number bsp_interrupt_handler_index( * For boards with small memory requirements you can define * @ref BSP_INTERRUPT_USE_INDEX_TABLE. With an enabled index table the handler * table will be accessed via a small index table. You can define the size of - * the handler table with @ref BSP_INTERRUPT_HANDLER_TABLE_SIZE. You must - * provide a data type for the index table - * (@ref bsp_interrupt_handler_index_type). It must be an integer type big - * enough to index the complete handler table. + * the handler table with @ref BSP_INTERRUPT_HANDLER_TABLE_SIZE. * * Normally new list entries are allocated from the heap. You may define * @ref BSP_INTERRUPT_NO_HEAP_USAGE, if you do not want to use the heap. For diff --git a/c/src/lib/libbsp/shared/include/utility.h b/c/src/lib/libbsp/shared/include/utility.h index d3dc819900..88b0e9a11c 100644 --- a/c/src/lib/libbsp/shared/include/utility.h +++ b/c/src/lib/libbsp/shared/include/utility.h @@ -7,16 +7,19 @@ */ /* - * Copyright (c) 2008, 2010 - * embedded brains GmbH - * Obere Lagerstr. 30 - * D-82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. + * + * $Id$ */ #ifndef LIBCPU_SHARED_UTILITY_H @@ -25,13 +28,14 @@ #include <stdint.h> #define BSP_BIT8(bit) \ - ((uint8_t) (((uint8_t) 1) << (bit))) + ((uint8_t) (((unsigned int) 1) << (bit))) #define BSP_MSK8(first_bit, last_bit) \ ((uint8_t) ((BSP_BIT8((last_bit) - (first_bit) + 1) - 1) << (first_bit))) #define BSP_FLD8(val, first_bit, last_bit) \ - ((uint8_t) (((val) << (first_bit)) & BSP_MSK8(first_bit, last_bit))) + ((uint8_t) \ + ((((unsigned int) (val)) << (first_bit)) & BSP_MSK8(first_bit, last_bit))) #define BSP_FLD8GET(reg, first_bit, last_bit) \ ((uint8_t) (((reg) & BSP_MSK8(first_bit, last_bit)) >> (first_bit))) @@ -41,13 +45,14 @@ | BSP_FLD8(val, first_bit, last_bit))) #define BSP_BIT16(bit) \ - ((uint16_t) (((uint16_t) 1) << (bit))) + ((uint16_t) (((unsigned int) 1) << (bit))) #define BSP_MSK16(first_bit, last_bit) \ ((uint16_t) ((BSP_BIT16((last_bit) - (first_bit) + 1) - 1) << (first_bit))) #define BSP_FLD16(val, first_bit, last_bit) \ - ((uint16_t) (((val) << (first_bit)) & BSP_MSK16(first_bit, last_bit))) + ((uint16_t) \ + ((((unsigned int) (val)) << (first_bit)) & BSP_MSK16(first_bit, last_bit))) #define BSP_FLD16GET(reg, first_bit, last_bit) \ ((uint16_t) (((reg) & BSP_MSK16(first_bit, last_bit)) >> (first_bit))) @@ -63,7 +68,8 @@ ((uint32_t) ((BSP_BIT32((last_bit) - (first_bit) + 1) - 1) << (first_bit))) #define BSP_FLD32(val, first_bit, last_bit) \ - ((uint32_t) (((val) << (first_bit)) & BSP_MSK32(first_bit, last_bit))) + ((uint32_t) \ + ((((uint32_t) (val)) << (first_bit)) & BSP_MSK32(first_bit, last_bit))) #define BSP_FLD32GET(reg, first_bit, last_bit) \ ((uint32_t) (((reg) & BSP_MSK32(first_bit, last_bit)) >> (first_bit))) @@ -79,7 +85,8 @@ ((uint64_t) ((BSP_BIT64((last_bit) - (first_bit) + 1) - 1) << (first_bit))) #define BSP_FLD64(val, first_bit, last_bit) \ - ((uint64_t) (((val) << (first_bit)) & BSP_MSK64(first_bit, last_bit))) + ((uint64_t) \ + ((((uint64_t) (val)) << (first_bit)) & BSP_MSK64(first_bit, last_bit))) #define BSP_FLD64GET(reg, first_bit, last_bit) \ ((uint64_t) (((reg) & BSP_MSK64(first_bit, last_bit)) >> (first_bit))) |