| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
- *
- * The information contained herein is property of Nordic Semiconductor ASA.
- * Terms and conditions of usage are described in detail in NORDIC
- * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
- *
- * Licensees are granted free, non-transferable use of the information. NO
- * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
- * the file.
- *
- */
- /** @cond */
- /**@file
- *
- * @ingroup experimental_api
- * @defgroup sdk_common SDK Common Header
- * @breif All common headers needed for SDK examples will be included here so that application
- * developer does not have to include headers on him/herself.
- * @{
- */
- #ifndef SDK_COMMON_H__
- #define SDK_COMMON_H__
- #include <stdint.h>
- #include <stdbool.h>
- #include <string.h>
- #include "nordic_common.h"
- #include "compiler_abstraction.h"
- #include "sdk_os.h"
- #include "sdk_errors.h"
- #include "app_util.h"
- /**@brief Macro for verifying that the module is initialized. It will cause the function to return
- * if not.
- *
- * @param[in] param The variable to check if is NULL.
- */
- #ifndef DISABLE_PARAM_CHECK
- #define VERIFY_PARAM_NOT_NULL(param) \
- do \
- { \
- if (param == NULL) \
- { \
- return NRF_ERROR_NULL; \
- } \
- } while(0)
- #else
- #define VERIFY_PARAM_NOT_NULL()
- #endif /* DISABLE_PARAM_CHECK */
- /**@brief Macro for verifying that the module is initialized. It will cause the function to return
- * if not.
- *
- * @param[in] param The variable to check if is NULL.
- */
- #ifndef DISABLE_PARAM_CHECK
- #define VERIFY_PARAM_NOT_NULL_VOID(param) \
- do \
- { \
- if (param == NULL) \
- { \
- return; \
- } \
- } while(0)
- #else
- #define VERIFY_PARAM_NOT_NULL_VOID()
- #endif /* DISABLE_PARAM_CHECK */
- /**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return the err code
- * if not.
- *
- * @param[in] err_code The error code to check.
- */
- #ifndef DISABLE_PARAM_CHECK
- #define VERIFY_SUCCESS(err_code) \
- do \
- { \
- if (err_code != NRF_SUCCESS) \
- { \
- return err_code; \
- } \
- } while(0)
- #else
- #define VERIFY_SUCCESS()
- #endif /* DISABLE_PARAM_CHECK */
- /**@brief Macro for verifying that a function returned NRF_SUCCESS. Will return if not.
- *
- * @param[in] err_code The error code to check.
- */
- #ifndef DISABLE_PARAM_CHECK
- #define VERIFY_SUCCESS_VOID(err_code) \
- do \
- { \
- if (err_code != NRF_SUCCESS) \
- { \
- return; \
- } \
- } while(0)
- #else
- #define VERIFY_SUCCESS_VOID()
- #endif /* DISABLE_PARAM_CHECK */
- /**@brief Macro for verifying statement to be true. Will return err_code if not.
- *
- * @param[in] statement Statement to test.
- * @param[in] err_code Error value to return if test was invalid.
- *
- * @retval err_code if test fails.
- */
- #define VERIFY_TRUE(statement, err_code) \
- do \
- { \
- if (!(statement)) \
- { \
- return err_code; \
- } \
- } while(0)
- /**@brief Macro for verifying statement to be true. Will return if not.
- *
- * @param[in] statement Statement to test.
- */
- #define VERIFY_TRUE_VOID(statement) \
- do \
- { \
- if (!(statement)) \
- { \
- return; \
- } \
- } while(0)
- /**@brief Macro for verifying statement to be false. Will return err_code if not.
- *
- * @param[in] statement Statement to test.
- * @param[in] err_code Error value to return if test was invalid.
- *
- * @retval err_code if test fails.
- */
- #define VERIFY_FALSE(statement, err_code) \
- do \
- { \
- if ((statement)) \
- { \
- return err_code; \
- } \
- } while(0)
- /**@brief Macro for verifying statement to be false. Will return if not.
- *
- * @param[in] statement Statement to test.
- */
- #define VERIFY_FALSE_VOID(statement) \
- do \
- { \
- if ((statement)) \
- { \
- return; \
- } \
- } while(0)
- /** @} */
- /** @endcond */
- #endif // SDK_COMMON_H__
|