/** **************************************************************************************** * * @file bt_util_sp.h * * @brief Link Manager simple pairing * * Copyright (C) RivieraWaves 2009-2015 * **************************************************************************************** */ #ifndef BT_UTIL_SP_H_ #define BT_UTIL_SP_H_ /** **************************************************************************************** * @defgroup BTUTILSP SP Computation * @ingroup LM * @brief LM module for simple pairing algorithms and mathematical computations. * @{ **************************************************************************************** */ #include #include "co_bt.h" /* * DEFINES **************************************************************************************** */ #define LM_OPER_SUCCESS 0x00 #define LM_OPER_PENDING 0x01 #define LM_OPER_FAILED 0x02 #define LM_SP_WORD_BITS4 16 #define LM_SP_WORD_MASK2 0xffffffff #define LM_SP_WORD_MASK2l 0x0000ffff #define LM_SP_WORD_MASK2h1 0xffff8000 #define LM_SP_WORD_MASK2h 0xffff0000 #define LM_SP_WORD_TBIT 0x80000000 #define LM_SPLBITS(a) ((a) & LM_SP_WORD_MASK2l) #define LM_SPHBITS(a) (((a) >> LM_SP_WORD_BITS4)& LM_SP_WORD_MASK2l) #define LM_SPL2HBITS(a) (((a) << LM_SP_WORD_BITS4)& LM_SP_WORD_MASK2) #define LM_SP_NUM_192_SIGN_BIT 0x80000000 #define LM_SP_NUM_192_BYTES 0x06 #define LM_SP_NUM_192_BITS 32 #define LM_SP_TYPE_NUM_192 1 #define LM_SP_TYPE_NUM_384 2 #define LM_SP_WNAF_WINDOW 0x03 #define LM_SP_WNAF_MSB_BIT (1<