Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Committer:
vcoubard
Date:
Thu Apr 07 17:37:40 2016 +0100
Revision:
19:47192cb9def7
Parent:
10:233fefd8162b
Child:
20:a90c48eb1d30
Synchronized with git rev 9251259f
Author: Liyou Zhou
Copy over coresponding files from nordic-sdk 9.0.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 19:47192cb9def7 1 /* Copyright (c) 2008 Nordic Semiconductor. All Rights Reserved.
vcoubard 19:47192cb9def7 2 *
vcoubard 19:47192cb9def7 3 * The information contained herein is property of Nordic Semiconductor ASA.
vcoubard 19:47192cb9def7 4 * Terms and conditions of usage are described in detail in NORDIC
vcoubard 19:47192cb9def7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
vcoubard 19:47192cb9def7 6 *
vcoubard 19:47192cb9def7 7 * Licensees are granted free, non-transferable use of the information. NO
vcoubard 19:47192cb9def7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
vcoubard 19:47192cb9def7 9 * the file.
vcoubard 1:ebc0e0ef0a11 10 */
Vincent Coubard 0:f2542974c862 11
Vincent Coubard 0:f2542974c862 12 /** @file
Vincent Coubard 0:f2542974c862 13 * @brief Common defines and macros for firmware developed by Nordic Semiconductor.
Vincent Coubard 0:f2542974c862 14 */
Vincent Coubard 0:f2542974c862 15
Vincent Coubard 0:f2542974c862 16 #ifndef NORDIC_COMMON_H__
Vincent Coubard 0:f2542974c862 17 #define NORDIC_COMMON_H__
Vincent Coubard 0:f2542974c862 18
Vincent Coubard 0:f2542974c862 19 /** Swaps the upper byte with the lower byte in a 16 bit variable */
Vincent Coubard 0:f2542974c862 20 //lint -emacro((572),SWAP) // Suppress warning 572 "Excessive shift value"
Vincent Coubard 0:f2542974c862 21 #define SWAP(x) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
Vincent Coubard 0:f2542974c862 22
Vincent Coubard 0:f2542974c862 23 /** The upper 8 bits of a 16 bit value */
Vincent Coubard 0:f2542974c862 24 //lint -emacro(572,MSB) // Suppress warning 572 "Excessive shift value"
Vincent Coubard 0:f2542974c862 25 #define MSB(a) (((a) & 0xFF00) >> 8)
Vincent Coubard 0:f2542974c862 26 /** The lower 8 bits (of a 16 bit value) */
Vincent Coubard 0:f2542974c862 27 #define LSB(a) ((a) & 0xFF)
Vincent Coubard 0:f2542974c862 28
Vincent Coubard 0:f2542974c862 29 /** Leaves the minimum of the two arguments */
Vincent Coubard 0:f2542974c862 30 /*lint -emacro(506, MIN) */ /* Suppress "Constant value Boolean */
Vincent Coubard 0:f2542974c862 31 #define MIN(a, b) ((a) < (b) ? (a) : (b))
Vincent Coubard 0:f2542974c862 32 /** Leaves the maximum of the two arguments */
Vincent Coubard 0:f2542974c862 33 /*lint -emacro(506, MAX) */ /* Suppress "Constant value Boolean */
Vincent Coubard 0:f2542974c862 34 #define MAX(a, b) ((a) < (b) ? (b) : (a))
Vincent Coubard 0:f2542974c862 35
Vincent Coubard 0:f2542974c862 36 #define BIT_0 0x01 /**< The value of bit 0 */
Vincent Coubard 0:f2542974c862 37 #define BIT_1 0x02 /**< The value of bit 1 */
Vincent Coubard 0:f2542974c862 38 #define BIT_2 0x04 /**< The value of bit 2 */
Vincent Coubard 0:f2542974c862 39 #define BIT_3 0x08 /**< The value of bit 3 */
Vincent Coubard 0:f2542974c862 40 #define BIT_4 0x10 /**< The value of bit 4 */
Vincent Coubard 0:f2542974c862 41 #define BIT_5 0x20 /**< The value of bit 5 */
Vincent Coubard 0:f2542974c862 42 #define BIT_6 0x40 /**< The value of bit 6 */
Vincent Coubard 0:f2542974c862 43 #define BIT_7 0x80 /**< The value of bit 7 */
Vincent Coubard 0:f2542974c862 44 #define BIT_8 0x0100 /**< The value of bit 8 */
Vincent Coubard 0:f2542974c862 45 #define BIT_9 0x0200 /**< The value of bit 9 */
Vincent Coubard 0:f2542974c862 46 #define BIT_10 0x0400 /**< The value of bit 10 */
Vincent Coubard 0:f2542974c862 47 #define BIT_11 0x0800 /**< The value of bit 11 */
Vincent Coubard 0:f2542974c862 48 #define BIT_12 0x1000 /**< The value of bit 12 */
Vincent Coubard 0:f2542974c862 49 #define BIT_13 0x2000 /**< The value of bit 13 */
Vincent Coubard 0:f2542974c862 50 #define BIT_14 0x4000 /**< The value of bit 14 */
Vincent Coubard 0:f2542974c862 51 #define BIT_15 0x8000 /**< The value of bit 15 */
Vincent Coubard 0:f2542974c862 52 #define BIT_16 0x00010000 /**< The value of bit 16 */
Vincent Coubard 0:f2542974c862 53 #define BIT_17 0x00020000 /**< The value of bit 17 */
Vincent Coubard 0:f2542974c862 54 #define BIT_18 0x00040000 /**< The value of bit 18 */
Vincent Coubard 0:f2542974c862 55 #define BIT_19 0x00080000 /**< The value of bit 19 */
Vincent Coubard 0:f2542974c862 56 #define BIT_20 0x00100000 /**< The value of bit 20 */
Vincent Coubard 0:f2542974c862 57 #define BIT_21 0x00200000 /**< The value of bit 21 */
Vincent Coubard 0:f2542974c862 58 #define BIT_22 0x00400000 /**< The value of bit 22 */
Vincent Coubard 0:f2542974c862 59 #define BIT_23 0x00800000 /**< The value of bit 23 */
Vincent Coubard 0:f2542974c862 60 #define BIT_24 0x01000000 /**< The value of bit 24 */
Vincent Coubard 0:f2542974c862 61 #define BIT_25 0x02000000 /**< The value of bit 25 */
Vincent Coubard 0:f2542974c862 62 #define BIT_26 0x04000000 /**< The value of bit 26 */
Vincent Coubard 0:f2542974c862 63 #define BIT_27 0x08000000 /**< The value of bit 27 */
Vincent Coubard 0:f2542974c862 64 #define BIT_28 0x10000000 /**< The value of bit 28 */
Vincent Coubard 0:f2542974c862 65 #define BIT_29 0x20000000 /**< The value of bit 29 */
Vincent Coubard 0:f2542974c862 66 #define BIT_30 0x40000000 /**< The value of bit 30 */
Vincent Coubard 0:f2542974c862 67 #define BIT_31 0x80000000 /**< The value of bit 31 */
Vincent Coubard 0:f2542974c862 68
Vincent Coubard 0:f2542974c862 69 #define UNUSED_VARIABLE(X) ((void)(X))
Vincent Coubard 0:f2542974c862 70 #define UNUSED_PARAMETER(X) UNUSED_VARIABLE(X)
Vincent Coubard 0:f2542974c862 71
vcoubard 1:ebc0e0ef0a11 72 #endif // NORDIC_COMMON_H__