build: W600-SDK importiert, Firmware-Build und Hello am EVK
Docker-Build mit gcc-arm-none-eabi 4.9-2014q4 (statt Homebrew-Cask) verwendet, Dockerfile/tools/docker.sh dafür aus Task 13 vorgezogen. cmake/sdk.cmake schont gcc 4.9 (kennt -fcommon/-Wno-error=... nicht). Zwei zusätzliche SDK-Stubs (EarlyInit, pre_gpio_config) in src/sys/sdk_stubs.c ergänzt, siehe sdk/PATCHES.md.
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
|
||||
#ifndef BITOPS_H
|
||||
#define BITOPS_H
|
||||
|
||||
#include "wm_osal.h"
|
||||
|
||||
/*
|
||||
* These functions are the basis of our bit ops.
|
||||
*
|
||||
* First, the atomic bitops. These use native endian.
|
||||
*/
|
||||
static __inline void set_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p |= mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline void clear_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p &= ~mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline void change_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
*p ^= mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_set_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res | mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res & ~mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
static __inline int
|
||||
test_and_change_bit(unsigned int bit, volatile unsigned long *p)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
unsigned int res;
|
||||
unsigned long mask = 1 << (bit & 31);
|
||||
|
||||
p += bit >> 5;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
res = *p;
|
||||
*p = res ^ mask;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return res & mask;
|
||||
}
|
||||
|
||||
|
||||
#endif /* BITOPS_H */
|
||||
@@ -0,0 +1,192 @@
|
||||
#ifndef __LIBTOMMATH_H__
|
||||
#define __LIBTOMMATH_H__
|
||||
|
||||
typedef signed short int16;
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#define BN_MP_INVMOD_C
|
||||
#define BN_S_MP_EXPTMOD_C /* Note: #undef in tommath_superclass.h; this would
|
||||
* require BN_MP_EXPTMOD_FAST_C instead */
|
||||
#define BN_S_MP_MUL_DIGS_C
|
||||
#define BN_MP_INVMOD_SLOW_C
|
||||
#define BN_S_MP_SQR_C
|
||||
#define BN_S_MP_MUL_HIGH_DIGS_C /* Note: #undef in tommath_superclass.h; this
|
||||
* would require other than mp_reduce */
|
||||
|
||||
#ifdef LTM_FAST
|
||||
|
||||
/* Use faster div at the cost of about 1 kB */
|
||||
#define BN_MP_MUL_D_C
|
||||
|
||||
/* Include faster exptmod (Montgomery) at the cost of about 2.5 kB in code */
|
||||
#define BN_MP_EXPTMOD_FAST_C
|
||||
#define BN_MP_MONTGOMERY_SETUP_C
|
||||
#define BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
|
||||
#define BN_MP_MUL_2_C
|
||||
|
||||
/* Include faster sqr at the cost of about 0.5 kB in code */
|
||||
#define BN_FAST_S_MP_SQR_C
|
||||
|
||||
#else /* LTM_FAST */
|
||||
|
||||
#define BN_MP_DIV_SMALL
|
||||
#define BN_MP_INIT_MULTI_C
|
||||
#define BN_MP_CLEAR_MULTI_C
|
||||
#define BN_MP_ABS_C
|
||||
#endif /* LTM_FAST */
|
||||
|
||||
/* Current uses do not require support for negative exponent in exptmod, so we
|
||||
* can save about 1.5 kB in leaving out invmod. */
|
||||
#define LTM_NO_NEG_EXP
|
||||
|
||||
/* from tommath.h */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
||||
#endif
|
||||
|
||||
#define OPT_CAST(x)
|
||||
|
||||
typedef unsigned int mp_digit;
|
||||
//typedef u64 mp_word;
|
||||
typedef unsigned long long mp_word;
|
||||
|
||||
#define XMALLOC tls_mem_alloc
|
||||
#define XFREE tls_mem_free
|
||||
#define XREALLOC os_realloc
|
||||
|
||||
|
||||
#define MP_MASK ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
|
||||
|
||||
#define MP_LT -1 /* less than */
|
||||
#define MP_EQ 0 /* equal to */
|
||||
#define MP_GT 1 /* greater than */
|
||||
|
||||
#define MP_ZPOS 0 /* positive integer */
|
||||
#define MP_NEG 1 /* negative */
|
||||
|
||||
#define MP_OKAY 0 /* ok result */
|
||||
#define MP_MEM -2 /* out of mem */
|
||||
#define MP_VAL -3 /* invalid input */
|
||||
|
||||
#define MP_YES 1 /* yes response */
|
||||
#define MP_NO 0 /* no response */
|
||||
|
||||
typedef int mp_err;
|
||||
|
||||
/* define this to use lower memory usage routines (exptmods mostly) */
|
||||
#define MP_LOW_MEM
|
||||
|
||||
/* default precision */
|
||||
#ifndef MP_PREC
|
||||
#ifndef MP_LOW_MEM
|
||||
#define MP_PREC 32 /* default digits of precision */
|
||||
#else
|
||||
#define MP_PREC 8 /* default digits of precision */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
|
||||
#define MP_WARRAY (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
|
||||
|
||||
/* the infamous mp_int structure */
|
||||
typedef struct {
|
||||
int16 used, alloc, sign;
|
||||
mp_digit *dp;
|
||||
} mp_int;
|
||||
|
||||
|
||||
/* ---> Basic Manipulations <--- */
|
||||
#define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
|
||||
#define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
|
||||
#define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
|
||||
|
||||
void mp_reverse (unsigned char *s, int len);
|
||||
#ifdef BN_MP_INIT_MULTI_C
|
||||
int mp_init_multi(mp_int *mp, ...);
|
||||
#endif
|
||||
#ifdef BN_MP_CLEAR_MULTI_C
|
||||
void mp_clear_multi(mp_int *mp, ...);
|
||||
#endif
|
||||
int mp_lshd(mp_int * a, int b);
|
||||
void mp_set(mp_int * a, mp_digit b);
|
||||
void mp_clamp(mp_int * a);
|
||||
void mp_exch(mp_int * a, mp_int * b);
|
||||
void mp_rshd(mp_int * a, int b);
|
||||
void mp_zero(mp_int * a);
|
||||
int mp_mod_2d(mp_int * a, int b, mp_int * c);
|
||||
int mp_div_2d(mp_int * a, int b, mp_int * c, mp_int * d);
|
||||
int mp_init_copy(mp_int * a, mp_int * b);
|
||||
int mp_mul_2d(mp_int * a, int b, mp_int * c);
|
||||
#ifndef LTM_NO_NEG_EXP
|
||||
int mp_div_2(mp_int * a, mp_int * b);
|
||||
int mp_invmod(mp_int * a, mp_int * b, mp_int * c);
|
||||
int mp_invmod_slow(mp_int * a, mp_int * b, mp_int * c);
|
||||
#endif /* LTM_NO_NEG_EXP */
|
||||
int mp_copy(mp_int * a, mp_int * b);
|
||||
int mp_count_bits(mp_int * a);
|
||||
int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d);
|
||||
int mp_mod(mp_int * a, mp_int * b, mp_int * c);
|
||||
int mp_grow(mp_int * a, int size);
|
||||
int mp_cmp_mag(mp_int * a, mp_int * b);
|
||||
#ifdef BN_MP_ABS_C
|
||||
int mp_abs(mp_int * a, mp_int * b);
|
||||
#endif
|
||||
int mp_sqr(mp_int * a, mp_int * b);
|
||||
int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d);
|
||||
int mp_reduce_2k_setup_l(mp_int *a, mp_int *d);
|
||||
int mp_2expt(mp_int * a, int b);
|
||||
int mp_reduce_setup(mp_int * a, mp_int * b);
|
||||
int mp_reduce(mp_int * x, mp_int * m, mp_int * mu);
|
||||
int mp_init_size(mp_int * a, int size);
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode);
|
||||
#endif /* BN_MP_EXPTMOD_FAST_C */
|
||||
#ifdef BN_FAST_S_MP_SQR_C
|
||||
int fast_s_mp_sqr (mp_int * a, mp_int * b);
|
||||
#endif /* BN_FAST_S_MP_SQR_C */
|
||||
#ifdef BN_MP_MUL_D_C
|
||||
int mp_mul_d (mp_int * a, mp_digit b, mp_int * c);
|
||||
#endif /* BN_MP_MUL_D_C */
|
||||
#ifdef BN_MP_MUL_2_C
|
||||
/* b = a*2 */
|
||||
int mp_mul_2(mp_int * a, mp_int * b);
|
||||
#endif
|
||||
int mp_init_for_read_unsigned_bin(mp_int *a, mp_digit len);
|
||||
void mp_clear (mp_int * a);
|
||||
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y);
|
||||
int wpa_mp_init (mp_int * a);
|
||||
int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c);
|
||||
int mp_to_unsigned_bin_nr (mp_int * a, unsigned char *b);
|
||||
int mp_to_unsigned_bin (mp_int * a, unsigned char *b);
|
||||
int mp_unsigned_bin_size (mp_int * a);
|
||||
int mp_add (mp_int * a, mp_int * b, mp_int * c);
|
||||
int mp_cmp (mp_int * a, mp_int * b);
|
||||
int mp_sub (mp_int * a, mp_int * b, mp_int * c);
|
||||
int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d);
|
||||
int mp_cmp_d(mp_int * a, mp_digit b);
|
||||
|
||||
#ifdef BN_MP_MONTGOMERY_SETUP_C
|
||||
int mp_montgomery_setup (mp_int * n, mp_digit * rho);
|
||||
#endif
|
||||
#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C
|
||||
int mp_montgomery_calc_normalization (mp_int * a, mp_int * b);
|
||||
#endif
|
||||
#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C
|
||||
int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho);
|
||||
#endif
|
||||
|
||||
#endif //__LIBTOMMATH_H__
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* MD5 hash implementation and interface functions
|
||||
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#include "wm_type_def.h"
|
||||
//typedef unsigned int size_t;
|
||||
#define MD5_MAC_LEN 16
|
||||
|
||||
struct MD5Context {
|
||||
u32 buf[4];
|
||||
u32 bits[2];
|
||||
u8 in[64];
|
||||
};
|
||||
|
||||
void MD5Init(struct MD5Context *context);
|
||||
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
||||
unsigned len);
|
||||
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
||||
|
||||
int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
const u8 *addr[], const size_t *len, u8 *mac);
|
||||
int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
|
||||
u8 *mac);
|
||||
int md5_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
|
||||
int md5(const u8 *addr, int len, u8 *mac);
|
||||
|
||||
#ifdef CONFIG_FIPS
|
||||
int hmac_md5_vector_non_fips_allow(const u8 *key, size_t key_len,
|
||||
size_t num_elem, const u8 *addr[],
|
||||
const size_t *len, u8 *mac);
|
||||
int hmac_md5_non_fips_allow(const u8 *key, size_t key_len, const u8 *data,
|
||||
size_t data_len, u8 *mac);
|
||||
#else /* CONFIG_FIPS */
|
||||
#define hmac_md5_vector_non_fips_allow hmac_md5_vector
|
||||
#define hmac_md5_non_fips_allow hmac_md5
|
||||
#endif /* CONFIG_FIPS */
|
||||
|
||||
#endif /* MD5_H */
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file misc.h
|
||||
* @author MCD Application Team
|
||||
* @version V3.6.1
|
||||
* @date 05-March-2012
|
||||
* @brief This file contains all the functions prototypes for the miscellaneous
|
||||
* firmware library functions (add-on to CMSIS functions).
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MISC_H
|
||||
#define __MISC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "wm_regs.h"
|
||||
|
||||
/** @addtogroup W600_Driver
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup MISC
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup MISC_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief NVIC Init Structure definition
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
|
||||
This parameter can be a value of @ref IRQn_Type */
|
||||
|
||||
uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
|
||||
specified in NVIC_IRQChannel. This parameter can be a value
|
||||
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
|
||||
|
||||
uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
|
||||
in NVIC_IRQChannel. This parameter can be a value
|
||||
between 0 and 15 as described in the table @ref NVIC_Priority_Table */
|
||||
|
||||
FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
|
||||
will be enabled or disabled.
|
||||
This parameter can be set either to ENABLE or DISABLE */
|
||||
} NVIC_InitTypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup NVIC_Priority_Table
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
@code
|
||||
The table below gives the allowed values of the pre-emption priority and subpriority according
|
||||
to the Priority Grouping configuration performed by NVIC_PriorityGroupConfig function
|
||||
============================================================================================================================
|
||||
NVIC_PriorityGroup | NVIC_IRQChannelPreemptionPriority | NVIC_IRQChannelSubPriority | Description
|
||||
============================================================================================================================
|
||||
NVIC_PriorityGroup_0 | 0 | 0-15 | 0 bits for pre-emption priority
|
||||
| | | 4 bits for subpriority
|
||||
----------------------------------------------------------------------------------------------------------------------------
|
||||
NVIC_PriorityGroup_1 | 0-1 | 0-7 | 1 bits for pre-emption priority
|
||||
| | | 3 bits for subpriority
|
||||
----------------------------------------------------------------------------------------------------------------------------
|
||||
NVIC_PriorityGroup_2 | 0-3 | 0-3 | 2 bits for pre-emption priority
|
||||
| | | 2 bits for subpriority
|
||||
----------------------------------------------------------------------------------------------------------------------------
|
||||
NVIC_PriorityGroup_3 | 0-7 | 0-1 | 3 bits for pre-emption priority
|
||||
| | | 1 bits for subpriority
|
||||
----------------------------------------------------------------------------------------------------------------------------
|
||||
NVIC_PriorityGroup_4 | 0-15 | 0 | 4 bits for pre-emption priority
|
||||
| | | 0 bits for subpriority
|
||||
============================================================================================================================
|
||||
@endcode
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MISC_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup Vector_Table_Base
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define NVIC_VectTab_RAM ((uint32_t)0x20000000)
|
||||
#define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
|
||||
#define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
|
||||
((VECTTAB) == NVIC_VectTab_FLASH))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup System_Low_Power
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define NVIC_LP_SEVONPEND ((uint8_t)0x10)
|
||||
#define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
|
||||
#define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
|
||||
#define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
|
||||
((LP) == NVIC_LP_SLEEPDEEP) || \
|
||||
((LP) == NVIC_LP_SLEEPONEXIT))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup Preemption_Priority_Group
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
|
||||
4 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
|
||||
3 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
|
||||
2 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
|
||||
1 bits for subpriority */
|
||||
#define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
|
||||
0 bits for subpriority */
|
||||
|
||||
#define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
|
||||
((GROUP) == NVIC_PriorityGroup_1) || \
|
||||
((GROUP) == NVIC_PriorityGroup_2) || \
|
||||
((GROUP) == NVIC_PriorityGroup_3) || \
|
||||
((GROUP) == NVIC_PriorityGroup_4))
|
||||
|
||||
#define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
|
||||
|
||||
#define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
|
||||
|
||||
#define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup SysTick_clock_source
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
|
||||
#define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
|
||||
#define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
|
||||
((SOURCE) == SysTick_CLKSource_HCLK_Div8))
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MISC_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup MISC_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
|
||||
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
|
||||
void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
|
||||
void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
|
||||
void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MISC_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT 2014 Winner Microelectronics Co., Ltd. *****END OF FILE****/
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#ifndef OS_H
|
||||
#define OS_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "wm_mem.h"
|
||||
|
||||
#ifndef os_strlen
|
||||
#define os_strlen(s) strlen(s)
|
||||
#endif
|
||||
|
||||
void * os_zalloc(u32 size);
|
||||
void * os_realloc(void *ptr, size_t size);
|
||||
char * os_strdup(const char *s);
|
||||
|
||||
#define os_time_after(a, b) ((long)(b) - (long)(a) < 0)
|
||||
|
||||
#ifndef os_memcpy
|
||||
#define os_memcpy(d, s, n) MEMCPY((d), (s), (n))
|
||||
#endif
|
||||
#ifndef os_memmove
|
||||
#define os_memmove(d, s, n) memmove((d), (s), (n))
|
||||
#endif
|
||||
#ifndef os_memset
|
||||
#define os_memset(s, c, n) memset(s, c, n)
|
||||
#endif
|
||||
#ifndef os_memcmp
|
||||
#define os_memcmp(s1, s2, n) memcmp((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef os_strstr
|
||||
#define os_strstr(h, n) strstr((h), (n))
|
||||
#endif
|
||||
#ifndef os_strcmp
|
||||
#define os_strcmp(s1, s2) strcmp((s1), (s2))
|
||||
#endif
|
||||
#ifndef os_strncmp
|
||||
#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef os_strchr
|
||||
#define os_strchr(s, c) strchr((s), (c))
|
||||
#endif
|
||||
#ifndef os_strcpy
|
||||
#define os_strcpy(s1,s2) strcpy((s1),(s2))
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef RC4_H
|
||||
#define RC4_H
|
||||
#include "wm_crypto_hard.h"
|
||||
|
||||
void Arc4Init(psCipherContext_t *ctx, unsigned char *key, uint32 keylen);
|
||||
int32 Arc4_skip(psCipherContext_t *ctx, unsigned char *in,
|
||||
unsigned char *out, size_t skip, uint32 len);
|
||||
/**
|
||||
* rc4_skip - XOR RC4 stream to given data with skip-stream-start
|
||||
* @key: RC4 key
|
||||
* @keylen: RC4 key length
|
||||
* @skip: number of bytes to skip from the beginning of the RC4 stream
|
||||
* @data: data to be XOR'ed with RC4 stream
|
||||
* @data_len: buf length
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Generate RC4 pseudo random stream for the given key, skip beginning of the
|
||||
* stream, and XOR the end result with the data buffer to perform RC4
|
||||
* encryption/decryption.
|
||||
*/
|
||||
int rc4_skip(const u8 *key, size_t keylen, size_t skip,
|
||||
u8 *data, size_t data_len);
|
||||
/**
|
||||
* rc4 - XOR RC4 stream to given data with skip-stream-start
|
||||
* @key: RC4 key
|
||||
* @keylen: RC4 key length
|
||||
* @data: data to be XOR'ed with RC4 stream
|
||||
* @data_len: buf length
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Generate RC4 pseudo random stream for the given key, skip beginning of the
|
||||
* stream, and XOR the end result with the data buffer to perform RC4
|
||||
* encryption/decryption.
|
||||
*/
|
||||
|
||||
int rc4(const u8 *key, size_t keylen, u8 *data, size_t data_len);
|
||||
|
||||
#endif /* end of RC4_H */
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* SHA1 hash implementation and interface functions
|
||||
* Copyright (c) 2003-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef SHA1_H
|
||||
#define SHA1_H
|
||||
|
||||
#include "tls_common.h"
|
||||
#define SHA1_HASH_SIZE 20
|
||||
|
||||
#define SHA1_MAC_LEN 20
|
||||
|
||||
struct SHA1Context {
|
||||
u32 state[5];
|
||||
u32 count[2];
|
||||
unsigned char buffer[64];
|
||||
};
|
||||
|
||||
void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
|
||||
int hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
const u8 *addr[], const size_t *len, u8 *mac);
|
||||
int hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
|
||||
u8 *mac);
|
||||
int sha1_prf(const u8 *key, size_t key_len, const char *label,
|
||||
const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
|
||||
int sha1_t_prf(const u8 *key, size_t key_len, const char *label,
|
||||
const u8 *seed, size_t seed_len, u8 *buf, size_t buf_len);
|
||||
int pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
|
||||
int iterations, u8 *buf, size_t buflen);
|
||||
int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
|
||||
void SHA1Init(struct SHA1Context* context);
|
||||
void SHA1Update(struct SHA1Context* context, const void *_data, u32 len);
|
||||
void SHA1Final(unsigned char digest[20], struct SHA1Context* context);
|
||||
int sha1(const u8 *addr, int len, u8 *mac);
|
||||
|
||||
#endif /* SHA1_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* SHA256 hash implementation and interface functions
|
||||
* Copyright (c) 2003-2006, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of BSD
|
||||
* license.
|
||||
*
|
||||
* See README and COPYING for more details.
|
||||
*/
|
||||
|
||||
#ifndef SHA256_H
|
||||
#define SHA256_H
|
||||
#include "common.h"
|
||||
#include "os.h"
|
||||
|
||||
#define SHA256_MAC_LEN 32
|
||||
|
||||
#define SHA256_BLOCK_SIZE 64
|
||||
|
||||
struct sha256_state {
|
||||
u64 length;
|
||||
u32 state[8], curlen;
|
||||
u8 buf[SHA256_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
void wpa_sha256_init(struct sha256_state *md);
|
||||
int sha256_process(struct sha256_state *md, const unsigned char *in,
|
||||
unsigned long inlen);
|
||||
int sha256_done(struct sha256_state *md, unsigned char *out);
|
||||
|
||||
/**
|
||||
* sha256_vector - SHA256 hash for data vector
|
||||
* @num_elem: Number of elements in the data vector
|
||||
* @addr: Pointers to the data areas
|
||||
* @len: Lengths of the data blocks
|
||||
* @mac: Buffer for the hash
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int sha256_vector(size_t num_elem, const u8 *addr[], const size_t *len,
|
||||
u8 *mac);
|
||||
|
||||
void hmac_sha256_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
const u8 *addr[], const size_t *len, u8 *mac);
|
||||
void hmac_sha256(const u8 *key, size_t key_len, const u8 *data,
|
||||
size_t data_len, u8 *mac);
|
||||
void sha256_prf(const u8 *key, size_t key_len, const char *label,
|
||||
const u8 *data, size_t data_len, u8 *buf, size_t buf_len);
|
||||
|
||||
#endif /* SHA256_H */
|
||||
@@ -0,0 +1,253 @@
|
||||
#ifndef TLS_COMMON_H
|
||||
#define TLS_COMMON_H
|
||||
|
||||
#include "wm_osal.h"
|
||||
#include "wm_config.h"
|
||||
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
|
||||
#define BIT(x) (1UL << (x))
|
||||
|
||||
#define time_after(a, b) ((long)(b) - (long)(a) < 0)
|
||||
#define time_before(a,b) time_after(b,a)
|
||||
|
||||
/*
|
||||
* These are the defined Ethernet Protocol ID's.
|
||||
*/
|
||||
|
||||
#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
|
||||
#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
|
||||
#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
|
||||
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
|
||||
#define ETH_P_X25 0x0805 /* CCITT X.25 */
|
||||
#define ETH_P_ARP 0x0806 /* Address Resolution packet */
|
||||
#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
|
||||
#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
|
||||
#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
|
||||
#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
|
||||
#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
|
||||
#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
|
||||
#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
|
||||
#define ETH_P_LAT 0x6004 /* DEC LAT */
|
||||
#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
|
||||
#define ETH_P_CUST 0x6006 /* DEC Customer use */
|
||||
#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
|
||||
#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
|
||||
#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
|
||||
#define ETH_P_ATALK 0x809B /* Appletalk DDP */
|
||||
#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
|
||||
#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
|
||||
#define ETH_P_IPX 0x8137 /* IPX over DIX */
|
||||
#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
|
||||
#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
|
||||
#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
|
||||
#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
|
||||
* defined in draft-wilson-wrec-wccp-v2-00.txt */
|
||||
#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
|
||||
#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
|
||||
#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
|
||||
#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
|
||||
#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
|
||||
#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
|
||||
* over Ethernet
|
||||
*/
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#define ETH_P_WAPI 0x88B4 /* WAPI authentication */
|
||||
#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
|
||||
#define ETH_P_TIPC 0x88CA /* TIPC */
|
||||
#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
|
||||
#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
|
||||
|
||||
#define ETH_HLEN 14 /* Total octets in header. */
|
||||
|
||||
#ifndef ETH_ALEN
|
||||
#define ETH_ALEN 6
|
||||
#endif
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
#ifndef ETH_P_ALL
|
||||
#define ETH_P_ALL 0x0003
|
||||
#endif
|
||||
#ifndef ETH_P_80211_ENCAP
|
||||
#define ETH_P_80211_ENCAP 0x890d /* TDLS comes under this category */
|
||||
#endif
|
||||
#ifndef ETH_P_PAE
|
||||
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
|
||||
#endif /* ETH_P_PAE */
|
||||
#ifndef ETH_P_EAPOL
|
||||
#define ETH_P_EAPOL ETH_P_PAE
|
||||
#endif /* ETH_P_EAPOL */
|
||||
#ifndef ETH_P_RSN_PREAUTH
|
||||
#define ETH_P_RSN_PREAUTH 0x88c7
|
||||
#endif /* ETH_P_RSN_PREAUTH */
|
||||
#ifndef ETH_P_RRB
|
||||
#define ETH_P_RRB 0x890D
|
||||
#endif /* ETH_P_RRB */
|
||||
|
||||
#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
|
||||
#define STRUCT_PACKED __attribute__ ((packed))
|
||||
|
||||
#define broadcast_ether_addr (const u8 *) "\xff\xff\xff\xff\xff\xff"
|
||||
|
||||
/**
|
||||
* compare_ether_addr - Compare two Ethernet addresses
|
||||
* @addr1: Pointer to a six-byte array containing the Ethernet address
|
||||
* @addr2: Pointer other six-byte array containing the Ethernet address
|
||||
*
|
||||
* Compare two ethernet addresses, returns 0 if equal
|
||||
*/
|
||||
static __inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
|
||||
{
|
||||
return !((addr1[0] == addr2[0]) && (addr1[1] == addr2[1]) && (addr1[2] == addr2[2]) && \
|
||||
(addr1[3] == addr2[3]) && (addr1[4] == addr2[4]) && (addr1[5] == addr2[5]));
|
||||
}
|
||||
|
||||
static __inline int is_zero_ether_addr(const u8 *a)
|
||||
{
|
||||
return !(a[0] | a[1] | a[2] | a[3] | a[4] | a[5]);
|
||||
}
|
||||
|
||||
static __inline int is_broadcast_ether_addr(const u8 *a)
|
||||
{
|
||||
return (a[0] & a[1] & a[2] & a[3] & a[4] & a[5]) == 0xff;
|
||||
}
|
||||
|
||||
static __inline int is_multicast_ether_addr(const u8 *addr)
|
||||
{
|
||||
return (0x01 & addr[0]);
|
||||
}
|
||||
|
||||
static __inline unsigned short swap_16(unsigned short v)
|
||||
{
|
||||
return ((v & 0xff) << 8) | (v >> 8);
|
||||
}
|
||||
|
||||
static __inline unsigned int swap_32(unsigned int v)
|
||||
{
|
||||
return ((v & 0xff) << 24) | ((v & 0xff00) << 8) |
|
||||
((v & 0xff0000) >> 8) | (v >> 24);
|
||||
}
|
||||
|
||||
#define le_to_host16(n) (n)
|
||||
#define host_to_le16(n) (n)
|
||||
#define be_to_host16(n) swap_16(n)
|
||||
#define host_to_be16(n) swap_16(n)
|
||||
#define le_to_host32(n) (n)
|
||||
#define le_to_host64(n) (n)
|
||||
#define be_to_host32(n) swap_32(n)
|
||||
#define host_to_be32(n) swap_32(n)
|
||||
|
||||
static __inline u16 get_unaligned_le16(const u8 *p)
|
||||
{
|
||||
return p[0] | p[1] << 8;
|
||||
}
|
||||
|
||||
static __inline u32 get_unaligned_le32(const u8 *p)
|
||||
{
|
||||
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
|
||||
}
|
||||
|
||||
static __inline void put_unaligned_le16(u16 val, u8 *p)
|
||||
{
|
||||
*p++ = val;
|
||||
*p++ = val >> 8;
|
||||
}
|
||||
|
||||
static __inline void put_unaligned_le32(u32 val, u8 *p)
|
||||
{
|
||||
put_unaligned_le16(val >> 16, p + 2);
|
||||
put_unaligned_le16(val, p);
|
||||
}
|
||||
|
||||
static __inline u16 get_unaligned_be16(const u8 *p)
|
||||
{
|
||||
return be_to_host16(get_unaligned_le16(p));
|
||||
}
|
||||
|
||||
static __inline u32 get_unaligned_be32(const u8 *p)
|
||||
{
|
||||
return be_to_host32(get_unaligned_le32(p));
|
||||
}
|
||||
|
||||
static __inline void put_unaligned_be16(u16 val, u8 *p)
|
||||
{
|
||||
*p++ = val >> 8;
|
||||
*p++ = val;
|
||||
}
|
||||
|
||||
static __inline void put_unaligned_be32(u32 val, u8 *p)
|
||||
{
|
||||
put_unaligned_be16(val >> 16, p);
|
||||
put_unaligned_be16(val, p + 2);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __force __attribute__((force))
|
||||
#define __bitwise __attribute__((bitwise))
|
||||
#else
|
||||
#define __force
|
||||
#define __bitwise
|
||||
#endif
|
||||
|
||||
typedef u16 __bitwise be16;
|
||||
typedef u16 __bitwise le16;
|
||||
typedef u32 __bitwise be32;
|
||||
typedef u32 __bitwise le32;
|
||||
typedef u64 __bitwise be64;
|
||||
typedef u64 __bitwise le64;
|
||||
|
||||
/*
|
||||
* This is an Ethernet frame header.
|
||||
*/
|
||||
struct ethhdr {
|
||||
unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
|
||||
unsigned char h_source[ETH_ALEN]; /* source ether addr */
|
||||
unsigned short h_proto; /* packet type ID field */
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
volatile int counter;
|
||||
} atomic_t;
|
||||
|
||||
struct kref {
|
||||
atomic_t refcount;
|
||||
};
|
||||
|
||||
static __inline int atomic_sub_return(int i, atomic_t *v)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
int val;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
val = v->counter;
|
||||
v->counter = val -= i;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
static __inline int atomic_add_return(int i, atomic_t *v)
|
||||
{
|
||||
u32 cpu_sr;
|
||||
int val;
|
||||
|
||||
cpu_sr = tls_os_set_critical();
|
||||
val = v->counter;
|
||||
v->counter = val += i;
|
||||
tls_os_release_critical(cpu_sr);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
#define atomic_set(v,i) (((v)->counter) = (i))
|
||||
#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
|
||||
#define atomic_inc(v) (void) atomic_add_return(1, v)
|
||||
#define atomic_dec(v) (void) atomic_sub_return(1, v)
|
||||
|
||||
#endif /* end of TLS_COMMON_H */
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
#ifndef TLS_IEEE80211_H
|
||||
#define TLS_IEEE80211_H
|
||||
|
||||
#include "tls_common.h"
|
||||
#if (GCC_COMPILE==1)
|
||||
#include "wm_ieee80211_gcc.h"
|
||||
#else
|
||||
#include "wm_ieee80211.h"
|
||||
#endif
|
||||
#endif /* end of TLS_IEEE80211_H */
|
||||
@@ -0,0 +1,434 @@
|
||||
#ifndef TLS_WIRELESS_H
|
||||
#define TLS_WIRELESS_H
|
||||
|
||||
#include "tls_common.h"
|
||||
#include "wm_osal.h"
|
||||
#include "list.h"
|
||||
//#include "netif.h"
|
||||
|
||||
struct tls_wif;
|
||||
struct wpa_supplicant;
|
||||
|
||||
/* Maximum size of the SSID */
|
||||
#define IW_SSID_MAX_SIZE 32
|
||||
#if 0
|
||||
#define IEEE80211_MODE_INFRA 0
|
||||
#define IEEE80211_MODE_IBSS 1
|
||||
#define IEEE80211_MODE_AP 2
|
||||
#endif
|
||||
//#define IEEE80211_RATE_MODE_B BIT(0)
|
||||
//#define IEEE80211_RATE_MODE_G BIT(1)
|
||||
//#define IEEE80211_RATE_MODE_BG BIT(2)
|
||||
//#define IEEE80211_RATE_MODE_N BIT(3)
|
||||
//#define IEEE80211_RATE_MODE_BGN BIT(4)
|
||||
|
||||
enum ieee80211_wireless_mode {
|
||||
IEEE80211_MODE_11B = 0,
|
||||
IEEE80211_MODE_11G,
|
||||
IEEE80211_MODE_11NG_HT20,
|
||||
IEEE80211_MODE_11NG_HT40PLUS,
|
||||
IEEE80211_MODE_11NG_HT40MINUS,
|
||||
IEEE80211_MODE_MAX,
|
||||
};
|
||||
|
||||
#define IW_AUTH_INDEX 0x0FFF
|
||||
#define IW_AUTH_FLAGS 0xF000
|
||||
|
||||
#define IW_AUTH_WPA_VERSION 0
|
||||
#define IW_AUTH_CIPHER_PAIRWISE 1
|
||||
#define IW_AUTH_CIPHER_GROUP 2
|
||||
#define IW_AUTH_KEY_MGMT 3
|
||||
#define IW_AUTH_TKIP_COUNTERMEASURES 4
|
||||
#define IW_AUTH_DROP_UNENCRYPTED 5
|
||||
#define IW_AUTH_80211_AUTH_ALG 6
|
||||
#define IW_AUTH_WPA_ENABLED 7
|
||||
#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
|
||||
#define IW_AUTH_ROAMING_CONTROL 9
|
||||
#define IW_AUTH_PRIVACY_INVOKED 10
|
||||
#define IW_AUTH_CIPHER_GROUP_MGMT 11
|
||||
#define IW_AUTH_MFP 12
|
||||
|
||||
/* IW_AUTH_WPA_VERSION values (bit field) */
|
||||
#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
|
||||
#define IW_AUTH_WPA_VERSION_WPA 0x00000002
|
||||
#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
|
||||
|
||||
/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
|
||||
* values (bit field) */
|
||||
#define IW_AUTH_CIPHER_NONE 0x00000001
|
||||
#define IW_AUTH_CIPHER_WEP40 0x00000002
|
||||
#define IW_AUTH_CIPHER_TKIP 0x00000004
|
||||
#define IW_AUTH_CIPHER_CCMP 0x00000008
|
||||
#define IW_AUTH_CIPHER_WEP104 0x00000010
|
||||
#define IW_AUTH_CIPHER_AES_CMAC 0x00000020
|
||||
|
||||
/* IW_AUTH_KEY_MGMT values (bit field) */
|
||||
#define IW_AUTH_KEY_MGMT_802_1X 1
|
||||
#define IW_AUTH_KEY_MGMT_PSK 2
|
||||
|
||||
/* IW_AUTH_80211_AUTH_ALG values (bit field) */
|
||||
#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
|
||||
#define IW_AUTH_ALG_SHARED_KEY 0x00000002
|
||||
#define IW_AUTH_ALG_LEAP 0x00000004
|
||||
|
||||
#define IW_ENCODE_ALG_NONE 0
|
||||
#define IW_ENCODE_ALG_WEP 1
|
||||
#define IW_ENCODE_ALG_TKIP 2
|
||||
#define IW_ENCODE_ALG_CCMP 3
|
||||
#define IW_ENCODE_ALG_PMK 4
|
||||
#define IW_ENCODE_ALG_AES_CMAC 5
|
||||
|
||||
#define IW_MAX_FREQUENCIES 32
|
||||
|
||||
#define IW_SCAN_TYPE_ACTIVE 0
|
||||
#define IW_SCAN_TYPE_PASSIVE 1
|
||||
|
||||
struct iw_scan_req {
|
||||
u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
|
||||
u8 ssid_len;
|
||||
u8 num_channels; /* num entries in channel_list;
|
||||
* 0 = scan all allowed channels */
|
||||
u8 bssid[ETH_ALEN]; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
|
||||
* individual address of a specific BSS */
|
||||
|
||||
u8 ssid[IW_SSID_MAX_SIZE];
|
||||
u32 extra_ies_len;
|
||||
u8 extra_ies[0];
|
||||
|
||||
//struct iw_freq channel_list[IW_MAX_FREQUENCIES];
|
||||
};
|
||||
|
||||
#if 0
|
||||
struct iw_bssid_ex {
|
||||
u32 length;
|
||||
u8 bssid[ETH_ALEN];
|
||||
u16 freq;
|
||||
u32 ssid_len;
|
||||
u8 ssid[IW_SSID_MAX_SIZE];
|
||||
u32 privacy;
|
||||
int rssi;
|
||||
u8 tsf[8];
|
||||
u16 beacon_int;
|
||||
u16 capabilities;
|
||||
u32 ie_len;
|
||||
u8 ies[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct iw_bss_info {
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 mode;
|
||||
u8 channel;
|
||||
u8 privacy;
|
||||
u8 ssid_len;
|
||||
u8 rssi;
|
||||
u8 ssid[32];
|
||||
};
|
||||
|
||||
struct iw_scan_results {
|
||||
u32 count;
|
||||
struct iw_bssid_ex bssid[1];
|
||||
};
|
||||
|
||||
struct iw_scan_bss {
|
||||
u32 count;
|
||||
u32 length; /* bss info total length */
|
||||
struct iw_bss_info bss[1];
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct beacon_parameters - beacon parameters
|
||||
*
|
||||
* Used to configure the beacon for an interface.
|
||||
*
|
||||
* @head: head portion of beacon (before TIM IE)
|
||||
* or %NULL if not changed
|
||||
* @tail: tail portion of beacon (after TIM IE)
|
||||
* or %NULL if not changed
|
||||
* @interval: beacon interval or zero if not changed
|
||||
* @dtim_period: DTIM period or zero if not changed
|
||||
* @head_len: length of @head
|
||||
* @tail_len: length of @tail
|
||||
*/
|
||||
struct iw_beacon_parameters {
|
||||
u8 *head, *tail;
|
||||
int interval, dtim_period;
|
||||
int head_len, tail_len;
|
||||
};
|
||||
|
||||
|
||||
struct iw_ssid_params {
|
||||
u8 ssid[IW_SSID_MAX_SIZE];
|
||||
u8 ssid_len;
|
||||
u32 ie_len;
|
||||
u8 *ie;
|
||||
};
|
||||
|
||||
struct iw_key_params {
|
||||
u8 key[32];
|
||||
u8 tsc[32];
|
||||
u32 key_len;
|
||||
u32 tsc_len;
|
||||
u16 cipher;
|
||||
bool pairwise;
|
||||
bool default_key;
|
||||
u32 key_idx;
|
||||
u8 addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct iw_sta_add_params {
|
||||
const u8 *addr;
|
||||
u16 aid;
|
||||
u16 capability;
|
||||
u16 listen_interval;
|
||||
u8 mode;
|
||||
const u8 *supp_rates;
|
||||
u32 supp_rates_len;
|
||||
u32 flags; /* bitmask of WPA_STA_* flags */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct beacon_parameters - beacon parameters
|
||||
*
|
||||
* Used to configure the beacon for an interface.
|
||||
*
|
||||
* @head: head portion of beacon (before TIM IE)
|
||||
* or %NULL if not changed
|
||||
* @tail: tail portion of beacon (after TIM IE)
|
||||
* or %NULL if not changed
|
||||
* @interval: beacon interval or zero if not changed
|
||||
* @dtim_period: DTIM period or zero if not changed
|
||||
* @head_len: length of @head
|
||||
* @tail_len: length of @tail
|
||||
*/
|
||||
struct beacon_parameters {
|
||||
u8 *head, *tail;
|
||||
int interval, dtim_period;
|
||||
int head_len, tail_len;
|
||||
};
|
||||
|
||||
struct wl_event_reload {
|
||||
bool reload;
|
||||
};
|
||||
|
||||
struct wl_event_join_ibss_info {
|
||||
u8 bssid[ETH_ALEN];
|
||||
u32 freq;
|
||||
};
|
||||
|
||||
struct wl_event_mic_err {
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 addr[ETH_ALEN];
|
||||
bool group_mic_err; /* TRUE: group, FALSE: pairwise */
|
||||
};
|
||||
|
||||
struct wl_event_rx_eapol {
|
||||
u8 *src_addr;
|
||||
u8 *eapol_body;
|
||||
u32 eapol_body_len;
|
||||
#if TLS_CONFIG_AP
|
||||
u8 mode;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct wl_event_rx_mgmt {
|
||||
u8 *mgmt;
|
||||
u32 mgmt_len;
|
||||
};
|
||||
|
||||
struct wl_event_rx_from_unknown {
|
||||
u8 addr[ETH_ALEN];
|
||||
};
|
||||
|
||||
struct wl_event_assoc_info {
|
||||
/**
|
||||
* reassoc - Flag to indicate association or reassociation
|
||||
*/
|
||||
int reassoc;
|
||||
|
||||
/**
|
||||
* req_ies - (Re)Association Request IEs
|
||||
*
|
||||
* If the driver generates WPA/RSN IE, this event data must be
|
||||
* returned for WPA handshake to have needed information. If
|
||||
* wpa_supplicant-generated WPA/RSN IE is used, this
|
||||
* information event is optional.
|
||||
*
|
||||
* This should start with the first IE (fixed fields before IEs
|
||||
* are not included).
|
||||
*/
|
||||
const u8 *req_ies;
|
||||
|
||||
/**
|
||||
* req_ies_len - Length of req_ies in bytes
|
||||
*/
|
||||
u32 req_ies_len;
|
||||
|
||||
/**
|
||||
* resp_ies - (Re)Association Response IEs
|
||||
*
|
||||
* Optional association data from the driver. This data is not
|
||||
* required WPA, but may be useful for some protocols and as
|
||||
* such, should be reported if this is available to the driver
|
||||
* interface.
|
||||
*
|
||||
* This should start with the first IE (fixed fields before IEs
|
||||
* are not included).
|
||||
*/
|
||||
u8 *resp_ies;
|
||||
|
||||
/**
|
||||
* resp_ies_len - Length of resp_ies in bytes
|
||||
*/
|
||||
u32 resp_ies_len;
|
||||
|
||||
/**
|
||||
* addr - Station address (for AP mode)
|
||||
*/
|
||||
u8 *addr;
|
||||
|
||||
u8 *bssid;
|
||||
|
||||
/**
|
||||
* freq - Frequency of the operational channel in MHz
|
||||
*/
|
||||
unsigned int freq;
|
||||
};
|
||||
|
||||
struct tls_wl_event_ops {
|
||||
int (*ibss_joined)(struct tls_wif *wif,
|
||||
struct wl_event_join_ibss_info *info);
|
||||
int (*assoc)(struct tls_wif *wif,
|
||||
struct wl_event_assoc_info *info);
|
||||
int (*disassoc)(struct tls_wif *wif);
|
||||
int (*scan_completed)(struct tls_wif *wif);
|
||||
int (*mic_err)(struct tls_wif *wif,
|
||||
struct wl_event_mic_err *info);
|
||||
int (*rx_eapol)(struct tls_wif *wif,
|
||||
struct wl_event_rx_eapol *eapol);
|
||||
int (*rx_mgmt)(struct tls_wif *wif,
|
||||
struct wl_event_rx_mgmt *mgmt);
|
||||
int (*mac_wdg)(struct tls_wif *wif);
|
||||
#if TLS_CONFIG_AP_OPT_PS
|
||||
int (*beacon_done)(struct tls_wif *wif);
|
||||
int (*rx_ps)(struct tls_wif *wif,
|
||||
struct wl_event_rx_mgmt *mgmt);
|
||||
int (*rx_pspoll)(struct tls_wif *wif,
|
||||
struct wl_event_rx_from_unknown *rx_pspoll);
|
||||
int (*sta_active)(struct tls_wif *wif,
|
||||
struct wl_event_rx_from_unknown *rx_pspoll);
|
||||
#endif
|
||||
int (*rx_from_unknown_sta)(struct tls_wif *wif,
|
||||
struct wl_event_rx_from_unknown *rx_from_unknown);
|
||||
int (*net_down)(struct tls_wif *wif);
|
||||
int (*net_fail)(struct tls_wif *wif);
|
||||
int (*net_up)(struct tls_wif *wif);
|
||||
int (*update_stat)(struct tls_wif *wif, void *cur_bss);/* struct ieee80211_bss *cur_bss */
|
||||
};
|
||||
|
||||
/* sk_buff allocated by wlan driver */
|
||||
struct sk_buff {
|
||||
struct dl_list list;
|
||||
u8 *buf;
|
||||
u32 buf_len;
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
struct tls_wif {
|
||||
//void *priv;
|
||||
struct ieee80211_if_data *priv;
|
||||
struct wpa_supplicant *wpa_s;
|
||||
struct tls_wl_event_ops *ops;
|
||||
#if TLS_CONFIG_SOFTAP_11N
|
||||
struct hostapd_iface *apif;
|
||||
#endif
|
||||
|
||||
//struct netif *ethif;
|
||||
//bool net_up;
|
||||
bool wlan_create;
|
||||
int (*rx_data_cb)(const u8 *bssid, u8 *buf, u32 buf_len);
|
||||
#if TLS_CONFIG_AP
|
||||
bool wmm_set;
|
||||
void *client_event_callback;
|
||||
#if TLS_CONFIG_AP_OPT_FWD
|
||||
int (*rx_ip_cb)(const u8 *bssid, u8 *buf, u32 buf_len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int (*send)(struct tls_wif *wif, struct sk_buff *skb);
|
||||
int (*rx_data_cb)(struct tls_wif *wif, struct sk_buff *skb);
|
||||
int (*tx_mgmt)(struct tls_wif *wif, struct sk_buff *skb);
|
||||
int (*send_eapol)(struct tls_wif *wif, struct sk_buff *skb);
|
||||
int (*send_beacon)(struct tls_wif *wif, struct sk_buff *skb);
|
||||
#endif
|
||||
};
|
||||
|
||||
void tls_wl_print_stats(struct tls_wif *wif);
|
||||
|
||||
int tls_wl_if_scan(struct tls_wif *wif,
|
||||
struct iw_scan_req *scan_req, u16 size);
|
||||
int tls_wl_if_scan_result2(struct tls_wif *wif,
|
||||
u8 *ssid, u32 ssid_len, u8 *buf, u32 buf_size);
|
||||
int tls_wl_if_scan_result(struct tls_wif *wif, u8 *buf, u32 buf_size);
|
||||
void tls_wl_if_sta_flush(struct tls_wif *wif, u8 mode);
|
||||
int tls_wl_if_sta_deauth(struct tls_wif *wif, u8 *own_addr,
|
||||
const u8 *addr, int reason);
|
||||
int tls_wl_if_sta_disassoc(struct tls_wif *wif, u8 *own_addr,
|
||||
const u8 *addr, int reason);
|
||||
#if TLS_CONFIG_AP
|
||||
int tls_wl_if_set_tx_queue_params(struct tls_wif *wif, int queue,
|
||||
int aifs, int cw_min, int cw_max, int burst_time);
|
||||
void tls_wl_if_set_sta_flags(struct tls_wif *wif, u8 *addr, u32 flags);
|
||||
int tls_wl_if_send_channel_switch(struct tls_wif *wif, u8 *ownaddr, u8 newch);
|
||||
void tls_wl_if_switch_channel_width(struct tls_wif *wif, u8 *ownaddr);
|
||||
void tls_wl_if_channel_info_updata(struct tls_wif *wif);
|
||||
#if TLS_CONFIG_SOFTAP_11N
|
||||
void tls_wl_if_get_ht_param(struct tls_wif *wif, u16 *cap, u8 *mcs, u8 *mpdu);
|
||||
void tls_wl_if_set_sta_ht_param(struct tls_wif *wif, u8 *mac, u8 *ht);
|
||||
#endif
|
||||
#endif
|
||||
int tls_wl_if_set_mode(struct tls_wif *wif, u16 mode);
|
||||
int tls_wl_if_clear_mode(struct tls_wif *wif, u16 mode);
|
||||
int tls_wl_if_set_bssid(struct tls_wif *wif, const u8 *addr, u32 mode);
|
||||
int tls_wl_if_set_ssid(struct tls_wif *wif, struct iw_ssid_params *params);
|
||||
int tls_wl_if_set_auth(struct tls_wif *wif, u16 flag, u32 value, u8 mode);
|
||||
int tls_wl_if_set_ps_mode(struct tls_wif *wif, int powersave);
|
||||
int tls_wl_if_set_freq(struct tls_wif *wif,
|
||||
int freq);
|
||||
int tls_wl_if_send_eapol(struct tls_wif *wif,
|
||||
u8 *buf, u32 len, bool is_apsta);
|
||||
int tls_wl_if_xmit(struct tls_wif *wif, void *buf, int len, bool is_apsta, bool not_delay);
|
||||
int tls_wl_if_add_key(struct tls_wif *wif,
|
||||
struct iw_key_params *params);
|
||||
int tls_wl_if_remove_key(struct tls_wif *wif,
|
||||
u32 cipher,
|
||||
u32 key_idx,
|
||||
bool pairwise,
|
||||
u8 *addr);
|
||||
int tls_wl_if_send_mlme(struct tls_wif *wif,
|
||||
u8 *buf, u32 len);
|
||||
int tls_wl_if_set_rate_mode(struct tls_wif *wif,
|
||||
u32 rate_mode);
|
||||
int tls_wl_if_set_beacon(struct tls_wif *wif,
|
||||
struct iw_beacon_parameters *params);
|
||||
int tls_wl_if_del_beacon(struct tls_wif *wif);
|
||||
int tls_wl_if_sta_add(struct tls_wif *wif,
|
||||
struct iw_sta_add_params *params);
|
||||
int tls_wl_if_sta_remove(struct tls_wif *wif, u8 *addr);
|
||||
int tls_wl_if_get_inact_sec(struct tls_wif *wif, const u8 *addr);
|
||||
int tls_wl_if_get_scan_res(struct tls_wif *wif, u8 *buf, u32 buf_size);
|
||||
int tls_wl_if_disconnect(struct tls_wif *wif);
|
||||
int tls_wl_if_tx(struct tls_wif *wif,
|
||||
u8 *buf, u32 buflen, bool last_packet, bool is_apsta, bool not_delay);
|
||||
int tls_wl_if_set_max_rate(struct tls_wif *wif, u8 max_rate_idx);
|
||||
int tls_wl_if_get_max_rate(struct tls_wif *wif, u8 *max_rate_idx);
|
||||
int tls_wl_if_set_adhoc(struct tls_wif *wif, int adhoc_automode);
|
||||
int tls_wl_if_ps(int wake_up);
|
||||
int tls_wl_if_standby(int type, int delay, int wake_time);
|
||||
int tls_wl_if_sleep(int type, int delay, int wake_time);
|
||||
void tls_wl_if_set_errno(int eno);
|
||||
int tls_wl_if_get_errno(void);
|
||||
void tls_wl_if_perror(const char *info);
|
||||
const char *tls_wl_if_get_errinfo(int eno);
|
||||
#endif /* end of TLS_WIRELESS_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
/**************************************************************************
|
||||
* File Name : utils.h
|
||||
* Author :
|
||||
* Version : 1.0
|
||||
* Date :
|
||||
* Description :
|
||||
*
|
||||
* Copyright (c) 2014 Winner Microelectronics Co., Ltd.
|
||||
* All rights reserved.
|
||||
*
|
||||
***************************************************************************/
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
int chk_crc8(u8 *ptr, u32 len);
|
||||
u8 get_crc8(u8 *ptr, u32 len);
|
||||
u8 calculate_crc8(u8 crc8, u8 *ptr, u32 len);
|
||||
u32 get_crc32(u8 *data, u32 data_size);
|
||||
u32 checksum(u32 *data, u32 length, u32 init);
|
||||
int atodec(char ch);
|
||||
int strtodec(int *dec, char *str);
|
||||
int atohex(char ch);
|
||||
int strtohex(u32 *hex, char *str);
|
||||
int strtohexarray(u8 array[], int cnt, char *str);
|
||||
int strtoip(u32 *ipadr, char * str);
|
||||
void iptostr(u32 ip, char *str);
|
||||
void mactostr(u8 mac[], char *str);
|
||||
|
||||
int hex_to_digit(int c);
|
||||
int digit_to_hex(int c);
|
||||
int hexstr_to_unit(char *buf, u32 *d);
|
||||
int string_to_uint(char *buf, u32 *d);
|
||||
int string_to_ipaddr(const char *buf, u8 *addr);
|
||||
char * strdup(const char *s);
|
||||
char * strndup(const char *s, size_t len);
|
||||
|
||||
int sendchar(int ch);
|
||||
|
||||
#endif /* UTILS_H */
|
||||
@@ -0,0 +1,93 @@
|
||||
#ifndef __WM_DBG_H__
|
||||
#define __WM_DBG_H__
|
||||
|
||||
#include "wm_debug.h"
|
||||
|
||||
/* Define the module switcher */
|
||||
#define TLS_FLASH_DBG TLS_DBG_OFF
|
||||
#define TLS_SPI_DBG TLS_DBG_OFF
|
||||
#define TLS_IO_DBG TLS_DBG_OFF
|
||||
#define TLS_DMA_DBG TLS_DBG_OFF
|
||||
#define TLS_WL_DBG TLS_DBG_OFF
|
||||
#define TLS_WPA_DBG TLS_DBG_OFF
|
||||
|
||||
/* flash info */
|
||||
#if (TLS_FLASH_DBG && TLS_DBG_LEVEL_INFO)
|
||||
#define TLS_DBGPRT_FLASH_INFO(f, a...) __TLS_DBGPRT_INFO(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_FLASH_INFO(f, a...)
|
||||
#endif
|
||||
|
||||
/* flash warnning */
|
||||
#if (TLS_FLASH_DBG && TLS_DBG_LEVEL_WARNING)
|
||||
#define TLS_DBGPRT_FLASH_WARNING(f, a...) __TLS_DBGPRT_WARNING(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_FLASH_WARNING(f, a...)
|
||||
#endif
|
||||
|
||||
/* flash error */
|
||||
#if (TLS_FLASH_DBG && TLS_DBG_LEVEL_ERR)
|
||||
#define TLS_DBGPRT_FLASH_ERR(f, a...) __TLS_DBGPRT_ERR(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_FLASH_ERR(f, a...)
|
||||
#endif
|
||||
|
||||
|
||||
#if (TLS_SPI_DBG && TLS_DBG_LEVEL_INFO)
|
||||
#define TLS_DBGPRT_SPI_INFO(f, a...) __TLS_DBGPRT_INFO(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_SPI_INFO(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_SPI_DBG && TLS_DBG_LEVEL_WARNING)
|
||||
#define TLS_DBGPRT_SPI_WARNING(f, a...) __TLS_DBGPRT_WARNING(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_SPI_WARNING(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_SPI_DBG && TLS_DBG_LEVEL_ERR)
|
||||
#define TLS_DBGPRT_SPI_ERR(f, a...) __TLS_DBGPRT_ERR(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_SPI_ERR(f, a...)
|
||||
#endif
|
||||
|
||||
|
||||
#if (TLS_IO_DBG && TLS_DBG_LEVEL_INFO)
|
||||
#define TLS_DBGPRT_IO_INFO(f, a...) __TLS_DBGPRT_INFO(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_IO_INFO(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_IO_DBG && TLS_DBG_LEVEL_WARNING)
|
||||
#define TLS_DBGPRT_IO_WARNING(f, a...) __TLS_DBGPRT_WARNING(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_IO_WARNING(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_IO_DBG && TLS_DBG_LEVEL_ERR)
|
||||
#define TLS_DBGPRT_IO_ERR(f, a...) __TLS_DBGPRT_ERR(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_IO_ERR(f, a...)
|
||||
#endif
|
||||
|
||||
|
||||
#if (TLS_DMA_DBG && TLS_DBG_LEVEL_INFO)
|
||||
#define TLS_DBGPRT_DMA_INFO(f, a...) __TLS_DBGPRT_INFO(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_DMA_INFO(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_DMA_DBG && TLS_DBG_LEVEL_WARNING)
|
||||
#define TLS_DBGPRT_DMA_WARNING(f, a...) __TLS_DBGPRT_WARNING(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_DMA_WARNING(f, a...)
|
||||
#endif
|
||||
|
||||
#if (TLS_DMA_DBG && TLS_DBG_LEVEL_ERR)
|
||||
#define TLS_DBGPRT_DMA_ERR(f, a...) __TLS_DBGPRT_ERR(f, ##a)
|
||||
#else
|
||||
#define TLS_DBGPRT_DMA_ERR(f, a...)
|
||||
#endif
|
||||
|
||||
#endif /* __DBG_H__ */
|
||||
|
||||
Reference in New Issue
Block a user