Stair56E UART project

This commit is contained in:
2026-08-05 19:07:52 +08:00
parent 7ca1af130d
commit f5654b70cc
2500 changed files with 619007 additions and 282610 deletions
+92 -92
View File
@@ -1,92 +1,92 @@
/**
****************************************************************************************
*
* @file dbg.h
*
* @brief Debug function
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef DBG_H_
#define DBG_H_
/**
****************************************************************************************
* @addtogroup DBG
* @ingroup CONTROLLER
* @brief Debug
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#include "dbg_swdiag.h" // sw profiling definitions
#include "dbg_trc.h" // debug tracer definition
/*
* FUNCTION DECLARATION
****************************************************************************************
*/
#define _DEBUG_ 0
#if CMD_TEST
#define TEST_LOGI(...) DEBUG(__VA_ARGS__)
#else
#define TEST_LOGI(...)
#endif
#if _DEBUG_
#define LOGI(...) DEBUG(__VA_ARGS__)
#define DUMP_DATA_PRINTF(data, length) printf_hexdump((uint8_t *)data, length)
#define LOGI_ERR(...) \
do { \
DEBUG("[%s] [%d]: ", __FILE__, __LINE__); \
DEBUG(__VA_ARGS__); \
} while (0)
#else
#define LOGI(...)
#define DUMP_DATA_PRINTF(data, length)
#define LOGI_ERR(...)
#endif
#define _TOSTRING(s) #s
#define TOSTRING(s) _TOSTRING(s)
/**
****************************************************************************************
* @brief Initialization of the BT Debug task
*
* This function initializes the the DBG task
*
* @param[in] init_type Type of initialization (@see enum rwip_init_type)
****************************************************************************************
*/
void dbg_init(uint8_t init_type);
/**
****************************************************************************************
* @brief Send back to host status of platform reset request.
*
* @param status Reset error code
*
****************************************************************************************
*/
void dbg_platform_reset_complete(uint32_t error);
void printf_hexdump(const void *data, int length);
///@} DBG
#endif // DBG_H_
/**
****************************************************************************************
*
* @file dbg.h
*
* @brief Debug function
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef DBG_H_
#define DBG_H_
/**
****************************************************************************************
* @addtogroup DBG
* @ingroup CONTROLLER
* @brief Debug
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#include "dbg_swdiag.h" // sw profiling definitions
#include "dbg_trc.h" // debug tracer definition
/*
* FUNCTION DECLARATION
****************************************************************************************
*/
#define _DEBUG_ 1
#if CMD_TEST
#define TEST_LOGI(...) DEBUG(__VA_ARGS__)
#else
#define TEST_LOGI(...)
#endif
#if _DEBUG_
#define LOGI(...) DEBUG(__VA_ARGS__)
#define DUMP_DATA_PRINTF(data, length) printf_hexdump((uint8_t *)data, length)
#define LOGI_ERR(...) \
do { \
DEBUG("[%s] [%d]: ", __FILE__, __LINE__); \
DEBUG(__VA_ARGS__); \
} while (0)
#else
#define LOGI(...)
#define DUMP_DATA_PRINTF(data, length)
#define LOGI_ERR(...)
#endif
#define _TOSTRING(s) #s
#define TOSTRING(s) _TOSTRING(s)
/**
****************************************************************************************
* @brief Initialization of the BT Debug task
*
* This function initializes the the DBG task
*
* @param[in] init_type Type of initialization (@see enum rwip_init_type)
****************************************************************************************
*/
void dbg_init(uint8_t init_type);
/**
****************************************************************************************
* @brief Send back to host status of platform reset request.
*
* @param status Reset error code
*
****************************************************************************************
*/
void dbg_platform_reset_complete(uint32_t error);
void printf_hexdump(const void *data, int length);
///@} DBG
#endif // DBG_H_
+153 -153
View File
@@ -1,153 +1,153 @@
/**
****************************************************************************************
*
* @file dbg_iqgen.h
*
* @brief I&Q Samples Generator API.
*
* Copyright (C) RivieraWaves 2018
*
*
****************************************************************************************
*/
#ifndef DBG_IQGEN_H_
#define DBG_IQGEN_H_
/**
****************************************************************************************
* @addtogroup DBGIQGEN
* @ingroup IQ
* @brief Debug SW - I&Q samples Generator.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h"
#if BLE_IQ_GEN
#include "reg_iqgen.h" // I&Q sample generator register functions
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
/// Maximum number of supported antenna patterns
#define DBG_IQGEN_MAX_ANTENNA (8)
/// bit defintitions for debug configuration
#define DBG_IQGEN_PATTERN_MODE_BIT (1<<0)
#define DBG_IQGEN_TIMING_MODE_BIT (1<<1)
#define DBG_IQGEN_ANT_ID_MODE_BIT (2<<1)
/// I&Q samples generation control
enum dbg_iqgen_ctnl
{
/// I&Q samples up count
DBG_IQGEN_UPCOUNT = 0,
/// I&Q samples down count
DBG_IQGEN_DOWNCOUNT = 1,
/// I&Q samples fixed value
DBG_IQGEN_FIXEDVAL = 2,
/// I&Q samples PRBS
DBG_IQGEN_PRBSPATTERN = 3,
};
/// I&Q samples generation antenna sweep pattern
enum dbg_iqgen_antenna_pattern
{
/// antenna up-sweep
DBG_IQGEN_ANT_UPSWEEP = 0,
/// antenna up-down sweep
DBG_IQGEN_ANT_UPDNSWEEP = 1,
};
/// I&Q samples generation timing mode
enum dbg_iqgen_timing_mode
{
/// 1us switching/sampling interval
DBG_IQGEN_1US_INTV = 0,
/// 2us switching/sampling interval
DBG_IQGEN_2US_INTV = 1,
};
/// antenna switch enable mode
enum dbg_iqgen_antenna_switch_mode
{
/// Accepts antenna ID switching inputs from baseband
DBG_IQGEN_BASEBAND_SWITCHING = 0,
/// Antenna switching is internally enabled
DBG_IQGEN_INTERNAL_SWITCHING = 1,
};
/*
* VARIABLE DECLARATION
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Enable I&Q sample generator
*
* @param[in] nb_antenna Number of antenna (valid range 1-8)
* @param[in] pattern_mode Antenna sweep pattern (@see enum dbg_iqgen_antenna_pattern)
* @param[in] timing_mode Timing interval mode (@see enum dbg_iqgen_timing_mode)
* @param[in] ant_switch_mode Antenna switching mode (@see enum dbg_iqgen_antenna_switch_mode)
*
****************************************************************************************
*/
void dbg_iqgen_config_enable(uint8_t nb_antenna, uint8_t pattern_mode, uint8_t timing_mode, uint8_t ant_switch_mode);
/**
****************************************************************************************
* @brief Disable I&Q sample generator
*
****************************************************************************************
*/
void dbg_iqgen_disable();
/**
****************************************************************************************
* @brief Configure I&Q samples for a specific antenna
*
* @param[in] antenna ID antenna id (valid range 0-7)
* @param[in] i_cntl configuration mode for I-samples (@see enum dbg_iqgen_cntl)
* @param[in] q_cntl configuration mode for Q-samples (@see enum dbg_iqgen_cntl)
* @param[in] i_val I-samples initial value
* @param[in] q_val Q-samples initial value
*
****************************************************************************************
*/
void dbg_iqgen_antenna_config(uint8_t antenna_id, uint8_t i_cntl, uint8_t q_cntl, uint8_t i_val, uint8_t q_val);
/**
****************************************************************************************
* @brief I&Q Generator configure
*
* @param[in] param configuration structure (@see hci_dbg_iqgen_cfg_cmd)
****************************************************************************************
*/
uint8_t dbg_iqgen_config(struct hci_dbg_iqgen_cfg_cmd const *cfg);
#endif //BLE_IQ_GEN
/// @} DBGIQGEN
#endif // DBG_IQGEN_H_
/**
****************************************************************************************
*
* @file dbg_iqgen.h
*
* @brief I&Q Samples Generator API.
*
* Copyright (C) RivieraWaves 2018
*
*
****************************************************************************************
*/
#ifndef DBG_IQGEN_H_
#define DBG_IQGEN_H_
/**
****************************************************************************************
* @addtogroup DBGIQGEN
* @ingroup IQ
* @brief Debug SW - I&Q samples Generator.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h"
#if BLE_IQ_GEN
#include "reg_iqgen.h" // I&Q sample generator register functions
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
/// Maximum number of supported antenna patterns
#define DBG_IQGEN_MAX_ANTENNA (8)
/// bit defintitions for debug configuration
#define DBG_IQGEN_PATTERN_MODE_BIT (1<<0)
#define DBG_IQGEN_TIMING_MODE_BIT (1<<1)
#define DBG_IQGEN_ANT_ID_MODE_BIT (2<<1)
/// I&Q samples generation control
enum dbg_iqgen_ctnl
{
/// I&Q samples up count
DBG_IQGEN_UPCOUNT = 0,
/// I&Q samples down count
DBG_IQGEN_DOWNCOUNT = 1,
/// I&Q samples fixed value
DBG_IQGEN_FIXEDVAL = 2,
/// I&Q samples PRBS
DBG_IQGEN_PRBSPATTERN = 3,
};
/// I&Q samples generation antenna sweep pattern
enum dbg_iqgen_antenna_pattern
{
/// antenna up-sweep
DBG_IQGEN_ANT_UPSWEEP = 0,
/// antenna up-down sweep
DBG_IQGEN_ANT_UPDNSWEEP = 1,
};
/// I&Q samples generation timing mode
enum dbg_iqgen_timing_mode
{
/// 1us switching/sampling interval
DBG_IQGEN_1US_INTV = 0,
/// 2us switching/sampling interval
DBG_IQGEN_2US_INTV = 1,
};
/// antenna switch enable mode
enum dbg_iqgen_antenna_switch_mode
{
/// Accepts antenna ID switching inputs from baseband
DBG_IQGEN_BASEBAND_SWITCHING = 0,
/// Antenna switching is internally enabled
DBG_IQGEN_INTERNAL_SWITCHING = 1,
};
/*
* VARIABLE DECLARATION
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Enable I&Q sample generator
*
* @param[in] nb_antenna Number of antenna (valid range 1-8)
* @param[in] pattern_mode Antenna sweep pattern (@see enum dbg_iqgen_antenna_pattern)
* @param[in] timing_mode Timing interval mode (@see enum dbg_iqgen_timing_mode)
* @param[in] ant_switch_mode Antenna switching mode (@see enum dbg_iqgen_antenna_switch_mode)
*
****************************************************************************************
*/
void dbg_iqgen_config_enable(uint8_t nb_antenna, uint8_t pattern_mode, uint8_t timing_mode, uint8_t ant_switch_mode);
/**
****************************************************************************************
* @brief Disable I&Q sample generator
*
****************************************************************************************
*/
void dbg_iqgen_disable();
/**
****************************************************************************************
* @brief Configure I&Q samples for a specific antenna
*
* @param[in] antenna ID antenna id (valid range 0-7)
* @param[in] i_cntl configuration mode for I-samples (@see enum dbg_iqgen_cntl)
* @param[in] q_cntl configuration mode for Q-samples (@see enum dbg_iqgen_cntl)
* @param[in] i_val I-samples initial value
* @param[in] q_val Q-samples initial value
*
****************************************************************************************
*/
void dbg_iqgen_antenna_config(uint8_t antenna_id, uint8_t i_cntl, uint8_t q_cntl, uint8_t i_val, uint8_t q_val);
/**
****************************************************************************************
* @brief I&Q Generator configure
*
* @param[in] param configuration structure (@see hci_dbg_iqgen_cfg_cmd)
****************************************************************************************
*/
uint8_t dbg_iqgen_config(struct hci_dbg_iqgen_cfg_cmd const *cfg);
#endif //BLE_IQ_GEN
/// @} DBGIQGEN
#endif // DBG_IQGEN_H_
+212 -212
View File
@@ -1,212 +1,212 @@
/**
****************************************************************************************
*
* @file dbg_mwsgen.h
*
* @brief MWS/WLAN Generator API.
*
* Copyright (C) RivieraWaves 2015
*
*
****************************************************************************************
*/
#ifndef DBG_MWSGEN_H_
#define DBG_MWSGEN_H_
/**
****************************************************************************************
* @addtogroup DBGMWSGEN
* @ingroup DBG
* @brief Debug SW - MWS/WLAN Generator.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h"
#if (RW_WLAN_COEX_TEST) || (RW_MWS_COEX_TEST)
#include "reg_mwsgen.h" // MWS Event Generator register functions
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
#if (RW_WLAN_COEX)
/// WLAN coexistence disabled
#define DBG_COEX_WLAN_DISABLED 0
/// WLAN coexistence enabled
#define DBG_COEX_WLAN_ENABLED 1
#endif
#if (RW_MWS_COEX)
/// MWS coexistence disabled
#define DBG_COEX_MWS_DISABLED 0
/// MWS coexistence enabled
#define DBG_COEX_MWS_ENABLED 1
#endif
/*
* VARIABLE DECLARATION
****************************************************************************************
*/
#if (RW_WLAN_COEX_TEST)
extern uint32_t dbg_coex_scenario;
#endif // RW_WLAN_COEX_TEST
#if (RW_MWS_COEX_TEST)
extern uint32_t dbg_coex_scenario;
#endif // RW_MWS_COEX_TEST
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
#if (RW_MWS_COEX_TEST)
/**
****************************************************************************************
* @brief Set the scenario for the unitary testing.
*
* @param[in] scenario Scenario type
*
* @return none
*
****************************************************************************************
*/
uint8_t dbg_mwscoex_scen_set(uint32_t scenario);
/**
****************************************************************************************
* @brief Initialize and configure MWS event generator registers to be in MWS mode.
****************************************************************************************
*/
void dbg_mwsgen_init(void);
/**
****************************************************************************************
* @brief Configure MWS generator
*
* @param[in] period Period of the mws signal (us)
* @param[in] duty_cycle Duration of the high level (us)
* @param[in] tx_act Duration of the tx activity (us)
* @param[in] rx_act Duration of the rx activity (us)
*
****************************************************************************************
*/
void dbg_mwsgen_config(uint32_t period, uint32_t duty_cycle, uint32_t tx_act, uint32_t rx_act);
/**
****************************************************************************************
* @brief Configure the WLAN COEX mode for BT.
*
* @param[in] txmode
* @param[in] rxmode
* @param[in] txmsk
* @param[in] rxmsk
* @param[in] txfmsk
* @param[in] rxfmsk
* @param[in] scanfmsk
* @param[in] knudge
*
****************************************************************************************
*/
void dbg_mws_config(uint8_t txmode, uint8_t rxmode, uint8_t txmsk, uint8_t rxmsk, uint8_t txfms, uint8_t rxfmsk, uint8_t scanfmsk, uint8_t knudge);
/**
****************************************************************************************
* @brief Start the MWS signal generator.
*
****************************************************************************************
*/
void dbg_mwsgen_start(void);
/**
****************************************************************************************
* @brief Stop the MWS signal generator.
*
****************************************************************************************
*/
void dbg_mwsgen_stop(void);
#endif // RW_MWS_COEX_TEST
#if (RW_WLAN_COEX_TEST)
/**
****************************************************************************************
* @brief Set the scenario for the unitary testing.
*
* @param[in] scenario Scenario type
*
* @return none
*
****************************************************************************************
*/
uint8_t dbg_wlcoex_scen_set(uint32_t scenario);
/**
****************************************************************************************
* @brief Initialize and configure MWS event generator registers to be in WLAN mode.
****************************************************************************************
*/
void dbg_wlangen_init(void);
/**
****************************************************************************************
* @brief Set the period and duty cycle for the wlrxbsy signal.
*
* @param[in] period Period of the wlrxbsy signal (us)
* @param[in] duty_cycle Duration of the high level (us)
* @param[in] tx_act Duration of the tx activity (us)
* @param[in] rx_act Duration of the rx activity (us)
*
****************************************************************************************
*/
void dbg_wlangen_config(uint32_t period, uint32_t duty_cycle, uint32_t tx_act, uint32_t rx_act);
/**
****************************************************************************************
* @brief Configure the WLAN COEX mode for BT.
*
* @param[in] txmode
* @param[in] rxmode
* @param[in] txmsk
* @param[in] rxmsk
* @param[in] txthr
* @param[in] rxthr
* @param[in] pduration
* @param[in] pdelay
*
****************************************************************************************
*/
void dbg_wlan_config(uint8_t txmode, uint8_t rxmode, uint8_t txmsk, uint8_t rxmsk, uint8_t txthr, uint8_t rxthr, uint8_t pduration, uint8_t pdelay);
/**
****************************************************************************************
* @brief Start the wlrxbs signal generator.
*
****************************************************************************************
*/
void dbg_wlangen_start(void);
/**
****************************************************************************************
* @brief Stop the wlrxbs signal generator.
*
****************************************************************************************
*/
void dbg_wlangen_stop(void);
#endif // RW_WLAN_COEX_TEST
#endif // (RW_WLAN_COEX_TEST) || (RW_MWS_COEX_TEST)
/// @} DBGMWSGEN
#endif // DBG_MWSGEN_H_
/**
****************************************************************************************
*
* @file dbg_mwsgen.h
*
* @brief MWS/WLAN Generator API.
*
* Copyright (C) RivieraWaves 2015
*
*
****************************************************************************************
*/
#ifndef DBG_MWSGEN_H_
#define DBG_MWSGEN_H_
/**
****************************************************************************************
* @addtogroup DBGMWSGEN
* @ingroup DBG
* @brief Debug SW - MWS/WLAN Generator.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h"
#if (RW_WLAN_COEX_TEST) || (RW_MWS_COEX_TEST)
#include "reg_mwsgen.h" // MWS Event Generator register functions
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
#if (RW_WLAN_COEX)
/// WLAN coexistence disabled
#define DBG_COEX_WLAN_DISABLED 0
/// WLAN coexistence enabled
#define DBG_COEX_WLAN_ENABLED 1
#endif
#if (RW_MWS_COEX)
/// MWS coexistence disabled
#define DBG_COEX_MWS_DISABLED 0
/// MWS coexistence enabled
#define DBG_COEX_MWS_ENABLED 1
#endif
/*
* VARIABLE DECLARATION
****************************************************************************************
*/
#if (RW_WLAN_COEX_TEST)
extern uint32_t dbg_coex_scenario;
#endif // RW_WLAN_COEX_TEST
#if (RW_MWS_COEX_TEST)
extern uint32_t dbg_coex_scenario;
#endif // RW_MWS_COEX_TEST
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
#if (RW_MWS_COEX_TEST)
/**
****************************************************************************************
* @brief Set the scenario for the unitary testing.
*
* @param[in] scenario Scenario type
*
* @return none
*
****************************************************************************************
*/
uint8_t dbg_mwscoex_scen_set(uint32_t scenario);
/**
****************************************************************************************
* @brief Initialize and configure MWS event generator registers to be in MWS mode.
****************************************************************************************
*/
void dbg_mwsgen_init(void);
/**
****************************************************************************************
* @brief Configure MWS generator
*
* @param[in] period Period of the mws signal (us)
* @param[in] duty_cycle Duration of the high level (us)
* @param[in] tx_act Duration of the tx activity (us)
* @param[in] rx_act Duration of the rx activity (us)
*
****************************************************************************************
*/
void dbg_mwsgen_config(uint32_t period, uint32_t duty_cycle, uint32_t tx_act, uint32_t rx_act);
/**
****************************************************************************************
* @brief Configure the WLAN COEX mode for BT.
*
* @param[in] txmode
* @param[in] rxmode
* @param[in] txmsk
* @param[in] rxmsk
* @param[in] txfmsk
* @param[in] rxfmsk
* @param[in] scanfmsk
* @param[in] knudge
*
****************************************************************************************
*/
void dbg_mws_config(uint8_t txmode, uint8_t rxmode, uint8_t txmsk, uint8_t rxmsk, uint8_t txfms, uint8_t rxfmsk, uint8_t scanfmsk, uint8_t knudge);
/**
****************************************************************************************
* @brief Start the MWS signal generator.
*
****************************************************************************************
*/
void dbg_mwsgen_start(void);
/**
****************************************************************************************
* @brief Stop the MWS signal generator.
*
****************************************************************************************
*/
void dbg_mwsgen_stop(void);
#endif // RW_MWS_COEX_TEST
#if (RW_WLAN_COEX_TEST)
/**
****************************************************************************************
* @brief Set the scenario for the unitary testing.
*
* @param[in] scenario Scenario type
*
* @return none
*
****************************************************************************************
*/
uint8_t dbg_wlcoex_scen_set(uint32_t scenario);
/**
****************************************************************************************
* @brief Initialize and configure MWS event generator registers to be in WLAN mode.
****************************************************************************************
*/
void dbg_wlangen_init(void);
/**
****************************************************************************************
* @brief Set the period and duty cycle for the wlrxbsy signal.
*
* @param[in] period Period of the wlrxbsy signal (us)
* @param[in] duty_cycle Duration of the high level (us)
* @param[in] tx_act Duration of the tx activity (us)
* @param[in] rx_act Duration of the rx activity (us)
*
****************************************************************************************
*/
void dbg_wlangen_config(uint32_t period, uint32_t duty_cycle, uint32_t tx_act, uint32_t rx_act);
/**
****************************************************************************************
* @brief Configure the WLAN COEX mode for BT.
*
* @param[in] txmode
* @param[in] rxmode
* @param[in] txmsk
* @param[in] rxmsk
* @param[in] txthr
* @param[in] rxthr
* @param[in] pduration
* @param[in] pdelay
*
****************************************************************************************
*/
void dbg_wlan_config(uint8_t txmode, uint8_t rxmode, uint8_t txmsk, uint8_t rxmsk, uint8_t txthr, uint8_t rxthr, uint8_t pduration, uint8_t pdelay);
/**
****************************************************************************************
* @brief Start the wlrxbs signal generator.
*
****************************************************************************************
*/
void dbg_wlangen_start(void);
/**
****************************************************************************************
* @brief Stop the wlrxbs signal generator.
*
****************************************************************************************
*/
void dbg_wlangen_stop(void);
#endif // RW_WLAN_COEX_TEST
#endif // (RW_WLAN_COEX_TEST) || (RW_MWS_COEX_TEST)
/// @} DBGMWSGEN
#endif // DBG_MWSGEN_H_
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+237 -237
View File
@@ -1,237 +1,237 @@
/**
****************************************************************************************
*
* @file dbg_trc_config.h
*
* @brief Configuration of the Tracer module
*
* Copyright (C) RivieraWaves 2009-2016
*
****************************************************************************************
*/
#ifndef DBG_TRC_CONFIG_H_
#define DBG_TRC_CONFIG_H_
/**
****************************************************************************************
* @addtogroup TRACER
* @{
* @name Tracer module configuration
* @{
****************************************************************************************
*/
#if defined CFG_TRC_ALL
#define TRC_KE_MSG 1
#define TRC_KE_TMR 1
#define TRC_KE_EVT 1
#define TRC_MEM 1
#define TRC_SW_ASS 1
#define TRC_CUSTOM 1
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#define TRC_ARB 1
#define TRC_PROG 1
#define TRC_SLEEP 1
#else // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#define TRC_ARB 0
#define TRC_PROG 0
#define TRC_SLEEP 0
#endif // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#if (BLE_EMB_PRESENT)
#define TRC_CS_BLE 1
#define TRC_LLCP 1
#define TRC_LLC_STATE_TRANS 1
#define TRC_RX_DESC 1
#define TRC_ADV 1
#define TRC_ACL 1
#else /*(BLE_EMB_PRESENT)*/
#define TRC_CS_BLE 0
#define TRC_LLCP 0
#define TRC_LLC_STATE_TRANS 0
#define TRC_RX_DESC 0
#define TRC_ADV 0
#define TRC_ACL 0
#endif /*(BLE_EMB_PRESENT)*/
#if (BLE_EMB_PRESENT && BLE_HOST_PRESENT)
#define TRC_HCI 1
#else /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#define TRC_HCI 0
#endif /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#if (BLE_HOST_PRESENT)
#define TRC_L2CAP 1
#else
#define TRC_L2CAP 0
#endif /*(BLE_HOST_PRESENT)*/
#if (BT_EMB_PRESENT)
#define TRC_CS_BT 1
#define TRC_LMP 1
#define TRC_LC_STATE_TRANS 1
#else
#define TRC_CS_BT 0
#define TRC_LMP 0
#define TRC_LC_STATE_TRANS 0
#endif /*(BT_EMB_PRESENT)*/
#else /*(CFG_TRC_ALL)*/
#if defined CFG_TRC_KE_MSG
#define TRC_KE_MSG 1
#else
#define TRC_KE_MSG 0
#endif /*(CFG_TRC_KE_MSG)*/
#if defined CFG_TRC_KE_TMR
#define TRC_KE_TMR 1
#else
#define TRC_KE_TMR 0
#endif /*CFG_TRC_KE_TMR*/
#if defined CFG_TRC_KE_EVT
#define TRC_KE_EVT 1
#else
#define TRC_KE_EVT 0
#endif /*CFG_TRC_KE_EVT*/
#if defined CFG_TRC_MEM
#define TRC_MEM 1
#else
#define TRC_MEM 0
#endif /*CFG_TRC_MEM*/
#if defined CFG_TRC_SW_ASS
#define TRC_SW_ASS 1
#else
#define TRC_SW_ASS 0
#endif /*CFG_TRC_SW_ASS*/
#if defined CFG_TRC_CUSTOM
#define TRC_CUSTOM 1
#else
#define TRC_CUSTOM 0
#endif /*CFG_TRC_CUSTOM*/
#if (BLE_EMB_PRESENT)
#if defined CFG_TRC_CS_BLE
#define TRC_CS_BLE 1
#else
#define TRC_CS_BLE 0
#endif /*(CFG_TRC_CS_BLE)*/
#if defined CFG_TRC_LLCP
#define TRC_LLCP 1
#else
#define TRC_LLCP 0
#endif /*(CFG_TRC_LLCP)*/
#if defined CFG_TRC_LLC_STATE_TRANS
#define TRC_LLC_STATE_TRANS 1
#else
#define TRC_LLC_STATE_TRANS 0
#endif /*(CFG_TRC_LLC_STATE_TRANS)*/
#if defined CFG_TRC_ARB
#define TRC_ARB 1
#else
#define TRC_ARB 0
#endif /*CFG_TRC_ARB*/
#if defined CFG_TRC_RX_DESC
#define TRC_RX_DESC 1
#else
#define TRC_RX_DESC 0
#endif /*CFG_TRC_RX_DESC*/
#if defined CFG_TRC_PROG
#define TRC_PROG 1
#else
#define TRC_PROG 0
#endif /*CFG_TRC_PROG*/
#if defined CFG_TRC_SLEEP
#define TRC_SLEEP 1
#else
#define TRC_SLEEP 0
#endif /*CFG_TRC_SLEEP*/
#if defined CFG_TRC_ADV
#define TRC_ADV 1
#else
#define TRC_ADV 0
#endif /*(CFG_TRC_ADV)*/
#if defined CFG_TRC_ACL
#define TRC_ACL 1
#else
#define TRC_ACL 0
#endif /*(CFG_TRC_ACL)*/
#else /*(BLE_EMB_PRESENT)*/
#define TRC_CS_BLE 0
#define TRC_LLCP 0
#define TRC_LLC_STATE_TRANS 0
#define TRC_ARB 0
#define TRC_RX_DESC 0
#define TRC_PROG 0
#define TRC_SLEEP 0
#define TRC_ADV 0
#define TRC_ACL 0
#endif /*(BLE_EMB_PRESENT)*/
#if (BLE_EMB_PRESENT && BLE_HOST_PRESENT)
#if defined CFG_TRC_HCI
#define TRC_HCI 1
#else
#define TRC_HCI 0
#endif /*CFG_TRC_HCI*/
#else /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#define TRC_HCI 0
#endif /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#if (BLE_HOST_PRESENT)
#if defined CFG_TRC_L2CAP
#define TRC_L2CAP 1
#else
#define TRC_L2CAP 0
#endif /*CFG_TRC_L2CAP*/
#else /*BLE_HOST_PRESENT*/
#define TRC_L2CAP 0
#endif /*BLE_HOST_PRESENT*/
#if (BT_EMB_PRESENT)
#if defined CFG_TRC_CS_BT
#define TRC_CS_BT 1
#else
#define TRC_CS_BT 0
#endif /*CFG_TRC_CS_BT*/
#if defined CFG_TRC_LMP
#define TRC_LMP 1
#else
#define TRC_LMP 0
#endif /*CFG_TRC_LMP*/
#if defined CFG_TRC_LC_STATE_TRANS
#define TRC_LC_STATE_TRANS 1
#else
#define TRC_LC_STATE_TRANS 0
#endif /*CFG_TRC_LC_STATE_TRANS*/
#else /*BT_EMB_PRESENT*/
#define TRC_CS_BT 0
#define TRC_LMP 0
#define TRC_LC_STATE_TRANS 0
#endif /*BT_EMB_PRESENT*/
#endif /* CFG_TRC_ALL */
/// @} TRACER
#endif /* DBG_TRC_CONFIG_H_ */
/**
****************************************************************************************
*
* @file dbg_trc_config.h
*
* @brief Configuration of the Tracer module
*
* Copyright (C) RivieraWaves 2009-2016
*
****************************************************************************************
*/
#ifndef DBG_TRC_CONFIG_H_
#define DBG_TRC_CONFIG_H_
/**
****************************************************************************************
* @addtogroup TRACER
* @{
* @name Tracer module configuration
* @{
****************************************************************************************
*/
#if defined CFG_TRC_ALL
#define TRC_KE_MSG 1
#define TRC_KE_TMR 1
#define TRC_KE_EVT 1
#define TRC_MEM 1
#define TRC_SW_ASS 1
#define TRC_CUSTOM 1
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#define TRC_ARB 1
#define TRC_PROG 1
#define TRC_SLEEP 1
#else // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#define TRC_ARB 0
#define TRC_PROG 0
#define TRC_SLEEP 0
#endif // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
#if (BLE_EMB_PRESENT)
#define TRC_CS_BLE 1
#define TRC_LLCP 1
#define TRC_LLC_STATE_TRANS 1
#define TRC_RX_DESC 1
#define TRC_ADV 1
#define TRC_ACL 1
#else /*(BLE_EMB_PRESENT)*/
#define TRC_CS_BLE 0
#define TRC_LLCP 0
#define TRC_LLC_STATE_TRANS 0
#define TRC_RX_DESC 0
#define TRC_ADV 0
#define TRC_ACL 0
#endif /*(BLE_EMB_PRESENT)*/
#if (BLE_EMB_PRESENT && BLE_HOST_PRESENT)
#define TRC_HCI 1
#else /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#define TRC_HCI 0
#endif /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#if (BLE_HOST_PRESENT)
#define TRC_L2CAP 1
#else
#define TRC_L2CAP 0
#endif /*(BLE_HOST_PRESENT)*/
#if (BT_EMB_PRESENT)
#define TRC_CS_BT 1
#define TRC_LMP 1
#define TRC_LC_STATE_TRANS 1
#else
#define TRC_CS_BT 0
#define TRC_LMP 0
#define TRC_LC_STATE_TRANS 0
#endif /*(BT_EMB_PRESENT)*/
#else /*(CFG_TRC_ALL)*/
#if defined CFG_TRC_KE_MSG
#define TRC_KE_MSG 1
#else
#define TRC_KE_MSG 0
#endif /*(CFG_TRC_KE_MSG)*/
#if defined CFG_TRC_KE_TMR
#define TRC_KE_TMR 1
#else
#define TRC_KE_TMR 0
#endif /*CFG_TRC_KE_TMR*/
#if defined CFG_TRC_KE_EVT
#define TRC_KE_EVT 1
#else
#define TRC_KE_EVT 0
#endif /*CFG_TRC_KE_EVT*/
#if defined CFG_TRC_MEM
#define TRC_MEM 1
#else
#define TRC_MEM 0
#endif /*CFG_TRC_MEM*/
#if defined CFG_TRC_SW_ASS
#define TRC_SW_ASS 1
#else
#define TRC_SW_ASS 0
#endif /*CFG_TRC_SW_ASS*/
#if defined CFG_TRC_CUSTOM
#define TRC_CUSTOM 1
#else
#define TRC_CUSTOM 0
#endif /*CFG_TRC_CUSTOM*/
#if (BLE_EMB_PRESENT)
#if defined CFG_TRC_CS_BLE
#define TRC_CS_BLE 1
#else
#define TRC_CS_BLE 0
#endif /*(CFG_TRC_CS_BLE)*/
#if defined CFG_TRC_LLCP
#define TRC_LLCP 1
#else
#define TRC_LLCP 0
#endif /*(CFG_TRC_LLCP)*/
#if defined CFG_TRC_LLC_STATE_TRANS
#define TRC_LLC_STATE_TRANS 1
#else
#define TRC_LLC_STATE_TRANS 0
#endif /*(CFG_TRC_LLC_STATE_TRANS)*/
#if defined CFG_TRC_ARB
#define TRC_ARB 1
#else
#define TRC_ARB 0
#endif /*CFG_TRC_ARB*/
#if defined CFG_TRC_RX_DESC
#define TRC_RX_DESC 1
#else
#define TRC_RX_DESC 0
#endif /*CFG_TRC_RX_DESC*/
#if defined CFG_TRC_PROG
#define TRC_PROG 1
#else
#define TRC_PROG 0
#endif /*CFG_TRC_PROG*/
#if defined CFG_TRC_SLEEP
#define TRC_SLEEP 1
#else
#define TRC_SLEEP 0
#endif /*CFG_TRC_SLEEP*/
#if defined CFG_TRC_ADV
#define TRC_ADV 1
#else
#define TRC_ADV 0
#endif /*(CFG_TRC_ADV)*/
#if defined CFG_TRC_ACL
#define TRC_ACL 1
#else
#define TRC_ACL 0
#endif /*(CFG_TRC_ACL)*/
#else /*(BLE_EMB_PRESENT)*/
#define TRC_CS_BLE 0
#define TRC_LLCP 0
#define TRC_LLC_STATE_TRANS 0
#define TRC_ARB 0
#define TRC_RX_DESC 0
#define TRC_PROG 0
#define TRC_SLEEP 0
#define TRC_ADV 0
#define TRC_ACL 0
#endif /*(BLE_EMB_PRESENT)*/
#if (BLE_EMB_PRESENT && BLE_HOST_PRESENT)
#if defined CFG_TRC_HCI
#define TRC_HCI 1
#else
#define TRC_HCI 0
#endif /*CFG_TRC_HCI*/
#else /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#define TRC_HCI 0
#endif /*(BLE_EMB_PRESENT && BLE_HOST_PRESENT)*/
#if (BLE_HOST_PRESENT)
#if defined CFG_TRC_L2CAP
#define TRC_L2CAP 1
#else
#define TRC_L2CAP 0
#endif /*CFG_TRC_L2CAP*/
#else /*BLE_HOST_PRESENT*/
#define TRC_L2CAP 0
#endif /*BLE_HOST_PRESENT*/
#if (BT_EMB_PRESENT)
#if defined CFG_TRC_CS_BT
#define TRC_CS_BT 1
#else
#define TRC_CS_BT 0
#endif /*CFG_TRC_CS_BT*/
#if defined CFG_TRC_LMP
#define TRC_LMP 1
#else
#define TRC_LMP 0
#endif /*CFG_TRC_LMP*/
#if defined CFG_TRC_LC_STATE_TRANS
#define TRC_LC_STATE_TRANS 1
#else
#define TRC_LC_STATE_TRANS 0
#endif /*CFG_TRC_LC_STATE_TRANS*/
#else /*BT_EMB_PRESENT*/
#define TRC_CS_BT 0
#define TRC_LMP 0
#define TRC_LC_STATE_TRANS 0
#endif /*BT_EMB_PRESENT*/
#endif /* CFG_TRC_ALL */
/// @} TRACER
#endif /* DBG_TRC_CONFIG_H_ */
+159 -159
View File
@@ -1,159 +1,159 @@
/**
****************************************************************************************
*
* @file dbg_trc_int.h
*
* @brief This file contains definitions related to the Tracer module.
*
* Copyright (C) RivieraWaves 2009-2015
*
****************************************************************************************
*/
#ifndef DBG_TRC_INT_H_
#define DBG_TRC_INT_H_
/**
****************************************************************************************
* @addtogroup TRACER
* @{
****************************************************************************************
*/
#include "rwip_config.h"
#if (TRACER_PRESENT)
#include <stdint.h> // standard definitions
#include <stdbool.h> // boolean
/*
* DEFINES
****************************************************************************************
*/
///Channel index length
#define CHANNEL_ID_LEN 1
///lengths of trace packet fields
#define SEQ_NUM_LEN 2
#define TIMESTAMP_LEN 4
#define TRC_CODE_LEN 1
#define TRC_FIX_LEN \
CHANNEL_ID_LEN +\
TRC_MSG_HDR_LEN +\
SEQ_NUM_LEN +\
TIMESTAMP_LEN +\
TRC_CODE_LEN
/**
****************************************************************************************
* @brief Convenient wrapper to trc_mem_alloc()
*
* This macro calls trc_mem_alloc() passing as parameter the length of the trace packet
*
* @param[in] trace_pay Trace payload length
*
* @return Pointer to trace code field(or NULL if the trace cannot be written)
****************************************************************************************
*/
#define TRC_MEM_ALLOC(trace_pay) \
dbg_trc_mem_alloc(TRC_FIX_LEN + trace_pay)
typedef uint8_t trc_id_t;
typedef uint8_t trc_opcode_t;
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
///Tracer Environment context structure
struct dbg_trc_env_tag
{
/// Current tracer configuration word
uint32_t curr_cw;
/// Compiled tracer configuration word
uint32_t compiled_cw;
};
/*
* GLOBAL VARIABLE DEFINITIONS
****************************************************************************************
*/
///Tracer environment context
extern struct dbg_trc_env_tag dbg_trc_env;
/*
* TRANSPORT LAYER FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief initialize tracer TL
****************************************************************************************
*/
void dbg_trc_tl_init();
/**
****************************************************************************************
* @brief trigger the transmission of tracer packets
****************************************************************************************
*/
void dbg_trc_tx_trigger(void);
/*
* MEMORY FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Initialize tracer memory
****************************************************************************************
*/
void dbg_trc_mem_init();
/**
****************************************************************************************
* @brief Try to write a trace in memory.
* @param[in] trace_len Trace packet length (expressed in bytes)
*
* @return Pointer to trace code field(or NULL if the trace cannot be written)
****************************************************************************************
*/
uint8_t *dbg_trc_mem_alloc(uint16_t const trace_len);
/**
****************************************************************************************
* @brief Try to read a trace from the memory.
*
* @return Pointer to the total size of the trace (or NULL if the trace cannot be read)
****************************************************************************************
*/
uint8_t *dbg_trc_mem_read();
/**
****************************************************************************************
* @brief Deallocate a trace from the memory.
*
* This function marks the trace block pointed by the reading pointer as invalid and moves
* it to the next trace block
*
****************************************************************************************
*/
void dbg_trc_mem_dealloc();
/**
****************************************************************************************
* @brief Initialization of the tracer
*
* This function initializes the tracer
*
* @param[in] init_type Type of initialization (@see enum rwip_init_type)
****************************************************************************************
*/
void dbg_trc_init(uint8_t init_type);
#endif /* TRACER_PRESENT */
/// @} TRACER
#endif /* DBG_TRC_INT_H_ */
/**
****************************************************************************************
*
* @file dbg_trc_int.h
*
* @brief This file contains definitions related to the Tracer module.
*
* Copyright (C) RivieraWaves 2009-2015
*
****************************************************************************************
*/
#ifndef DBG_TRC_INT_H_
#define DBG_TRC_INT_H_
/**
****************************************************************************************
* @addtogroup TRACER
* @{
****************************************************************************************
*/
#include "rwip_config.h"
#if (TRACER_PRESENT)
#include <stdint.h> // standard definitions
#include <stdbool.h> // boolean
/*
* DEFINES
****************************************************************************************
*/
///Channel index length
#define CHANNEL_ID_LEN 1
///lengths of trace packet fields
#define SEQ_NUM_LEN 2
#define TIMESTAMP_LEN 4
#define TRC_CODE_LEN 1
#define TRC_FIX_LEN \
CHANNEL_ID_LEN +\
TRC_MSG_HDR_LEN +\
SEQ_NUM_LEN +\
TIMESTAMP_LEN +\
TRC_CODE_LEN
/**
****************************************************************************************
* @brief Convenient wrapper to trc_mem_alloc()
*
* This macro calls trc_mem_alloc() passing as parameter the length of the trace packet
*
* @param[in] trace_pay Trace payload length
*
* @return Pointer to trace code field(or NULL if the trace cannot be written)
****************************************************************************************
*/
#define TRC_MEM_ALLOC(trace_pay) \
dbg_trc_mem_alloc(TRC_FIX_LEN + trace_pay)
typedef uint8_t trc_id_t;
typedef uint8_t trc_opcode_t;
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
///Tracer Environment context structure
struct dbg_trc_env_tag
{
/// Current tracer configuration word
uint32_t curr_cw;
/// Compiled tracer configuration word
uint32_t compiled_cw;
};
/*
* GLOBAL VARIABLE DEFINITIONS
****************************************************************************************
*/
///Tracer environment context
extern struct dbg_trc_env_tag dbg_trc_env;
/*
* TRANSPORT LAYER FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief initialize tracer TL
****************************************************************************************
*/
void dbg_trc_tl_init();
/**
****************************************************************************************
* @brief trigger the transmission of tracer packets
****************************************************************************************
*/
void dbg_trc_tx_trigger(void);
/*
* MEMORY FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Initialize tracer memory
****************************************************************************************
*/
void dbg_trc_mem_init();
/**
****************************************************************************************
* @brief Try to write a trace in memory.
* @param[in] trace_len Trace packet length (expressed in bytes)
*
* @return Pointer to trace code field(or NULL if the trace cannot be written)
****************************************************************************************
*/
uint8_t *dbg_trc_mem_alloc(uint16_t const trace_len);
/**
****************************************************************************************
* @brief Try to read a trace from the memory.
*
* @return Pointer to the total size of the trace (or NULL if the trace cannot be read)
****************************************************************************************
*/
uint8_t *dbg_trc_mem_read();
/**
****************************************************************************************
* @brief Deallocate a trace from the memory.
*
* This function marks the trace block pointed by the reading pointer as invalid and moves
* it to the next trace block
*
****************************************************************************************
*/
void dbg_trc_mem_dealloc();
/**
****************************************************************************************
* @brief Initialization of the tracer
*
* This function initializes the tracer
*
* @param[in] init_type Type of initialization (@see enum rwip_init_type)
****************************************************************************************
*/
void dbg_trc_init(uint8_t init_type);
#endif /* TRACER_PRESENT */
/// @} TRACER
#endif /* DBG_TRC_INT_H_ */