include/types.h: Provide BIT() macro

This macro is controversial for arches where the bits are numbered
MSb first, though we don't support such an arch. We've seen this macro
creep into our tree in different places, so provide it in one place.

Change-Id: I86cd8a16420f34ef31b615aec4e0f7bd3191ca35
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-on: http://review.coreboot.org/8280
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@gmail.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Alexandru Gagniuc 2015-01-25 21:08:42 -06:00
parent da8fcf0afe
commit a4d784eeab
4 changed files with 8 additions and 2 deletions

View File

@ -22,6 +22,13 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
/*
* This may mean something else on architectures where the bits are numbered
* from the MSB (e.g. PowerPC), but until we cross that bridge, this macro is
* perfectly fine.
*/
#define BIT(x) (1ul << (x))
/** /**
* Coreboot error codes * Coreboot error codes
* *

View File

@ -367,7 +367,6 @@ struct display_controller {
}; };
check_member(display_controller, winbuf, 0x800 * 4); check_member(display_controller, winbuf, 0x800 * 4);
#define BIT(pos) (1U << pos)
/* DC_CMD_DISPLAY_COMMAND 0x032 */ /* DC_CMD_DISPLAY_COMMAND 0x032 */
#define DISP_COMMAND_RAISE (1 << 0) #define DISP_COMMAND_RAISE (1 << 0)

View File

@ -3,6 +3,7 @@
*/ */
#include <delay.h> #include <delay.h>
#include <types.h>
#include <clock.h> #include <clock.h>
/** /**

View File

@ -40,7 +40,6 @@
/* UART specific definitions */ /* UART specific definitions */
#define BIT(s) (1<<s)
#define Uart_ns_val NS(BIT_POS_31,BIT_POS_16,N_VALUE,M_VALUE, 5, 4, 3, 1, 2, 0,3) #define Uart_ns_val NS(BIT_POS_31,BIT_POS_16,N_VALUE,M_VALUE, 5, 4, 3, 1, 2, 0,3)
#define Uart_clk_ns_mask (BM(BIT_POS_31, BIT_POS_16) | BM(BIT_POS_6, BIT_POS_0)) #define Uart_clk_ns_mask (BM(BIT_POS_31, BIT_POS_16) | BM(BIT_POS_6, BIT_POS_0))
#define Uart_mnd_en_mask BIT(8) * !!(625) #define Uart_mnd_en_mask BIT(8) * !!(625)