fix some code check errors

Signed-off-by: zipper1956 <zipper1956@hotmail.com>
This commit is contained in:
peizhu
2022-04-02 18:23:02 +08:00
parent 354524ba17
commit 9b14434227
86 changed files with 517 additions and 1144 deletions
@@ -587,7 +587,7 @@
*
* Uncomment to enable testing of the constant-flow nature of selected code.
*/
//#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
// #define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
/**
* \def MBEDTLS_TEST_NULL_ENTROPY
@@ -865,7 +865,7 @@
*
* Uncomment this macro to disable some counter-measures in ECP.
*/
//#define MBEDTLS_ECP_NO_INTERNAL_RNG
// #define MBEDTLS_ECP_NO_INTERNAL_RNG
/**
* \def MBEDTLS_ECP_RESTARTABLE
@@ -1223,7 +1223,7 @@
*
* Enable functions that use the filesystem.
*/
//#define MBEDTLS_FS_IO
// #define MBEDTLS_FS_IO
/**
* \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
@@ -2991,7 +2991,7 @@
*
* This module is used by the HAVEGE random number generator.
*/
//#define MBEDTLS_TIMING_C
// #define MBEDTLS_TIMING_C
/**
* \def MBEDTLS_VERSION_C
@@ -698,7 +698,6 @@ WifiErrorCode GetLinkedInfo(WifiLinkedInfo *result)
return WIFI_SUCCESS;
}
WifiErrorCode RegisterWifiEvent(WifiEvent *event)
{
if (event == NULL) {
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#include "iot_errno.h"
#include "iot_pwm.h"
#include "duet_pwm.h"
@@ -23,7 +23,6 @@
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
@@ -156,8 +155,6 @@ void apcmdplue_print_command(int argc, char **argv)
}
int atcmdplus_adv(int argc, char **argv)
{
apcmdplue_print_command(argc, argv);
@@ -218,7 +215,6 @@ int atcmdplus_uuid(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_discovery(int argc, char **argv)
{
uint8_t conidx = char2HexValue(argv[PARA_ID_1][0]);
@@ -226,7 +222,6 @@ int atcmdplus_discovery(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_lesend(int argc, char **argv)
{
apcmdplue_print_command(argc, argv);
@@ -238,7 +233,6 @@ int atcmdplus_lesend(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_ntf(int argc, char **argv)
{
apcmdplue_print_command(argc, argv);
@@ -256,7 +250,6 @@ int atcmdplus_ntf(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_ledisc(int argc, char **argv)
{
apcmdplue_print_command(argc, argv);
@@ -265,7 +258,6 @@ int atcmdplus_ledisc(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_chinfo(int argc, char **argv)
{
apcmdplue_print_command(argc, argv);
@@ -292,7 +284,6 @@ int atcmdplus_chinfo(int argc, char **argv)
return CONFIG_OK;
}
int atcmdplus_test(int argc, char **argv)
{
printf("AT CMD PLUS, %s, \r\n", __FUNCTION__);
@@ -325,4 +316,3 @@ void atcmdplus_ble_register(void)
#endif
}
@@ -40,19 +40,15 @@
****************************************************************************************
*/
/*
* VARIABLE DECLARATIONS
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
void atcmdplus_ble_register(void);
#endif //MEDIA_ATCMDPULS_BLE_H
@@ -138,7 +138,6 @@ extern duet_uart_dev_t lega_at_uart;
extern lega_uart_dev_t lega_at_uart;
#endif
/** @brief at register init functin, register all support cmd and user register cmd
*/
void lega_at_cmd_register_all(void);
@@ -159,7 +158,6 @@ extern int printf2(const char *format, ...);
#define printf2 printf
#endif
#define dbg_at(Fmt, ...) do{if(at_dbgflg) printf2(Fmt "\r\n", ## __VA_ARGS__);}while(0)
#define dbg_atnn(Fmt, ...) do{if(at_dbgflg) printf2(Fmt, ## __VA_ARGS__);}while(0)
#define at_rspdata(Fmt, ...) printf2("+" Fmt "\r\n", ## __VA_ARGS__)
@@ -167,8 +165,5 @@ extern int printf2(const char *format, ...);
#define at_rspinfor(Fmt, ...) printf2(Fmt "\r\n", ## __VA_ARGS__)
#define at_rspinfornn(Fmt, ...) printf2(Fmt, ## __VA_ARGS__)
#endif //_LEGA_AT_API_H_
+13 -28
View File
@@ -46,22 +46,16 @@
#include "sonata_gap.h"
#include "sonata_gap_api.h"
/*
* DEFINES
****************************************************************************************
*/
/*
* MACROS
****************************************************************************************
*/
/// debug trace
// debug trace
#define APP_DBG 1
#if APP_DBG
#define APP_TRC printf
@@ -69,7 +63,6 @@
#define APP_TRC(...)
#endif //APP_DBG
#define APP_DBG_ERROR 1
#if APP_DBG_ERROR
#define APP_TRC_ERROR printf
@@ -89,11 +82,10 @@
#define APP_UUID_LEN (16)
#define KEY_LEN 0x10
enum app_connect_state {
///Connection succeeded
APP_STATE_CONNECTED = 0,
/// Link is disconnected
// Link is disconnected
APP_STATE_DISCONNECTED,
};
@@ -104,27 +96,26 @@ typedef enum {
APP_BONDED,
} bound_conn_state;
/*
* TYPE DEFINITIONS
****************************************************************************************
*/
/// Long Term Key information
// Long Term Key information
typedef struct app_sonata_gap_ltk {
/// Long Term Key
// Long Term Key
uint8_t ltk[APP_GAP_KEY_LEN];
/// Encryption Diversifier
// Encryption Diversifier
uint16_t ediv;
/// Random Number
// Random Number
uint8_t randnb[APP_GAP_RAND_NB_LEN];
} app_sonata_gap_ltk_t;
/// Short Term Key information
// Short Term Key information
typedef struct app_sonata_gap_irk {
/// Short Term Key
// Short Term Key
uint8_t irk[APP_GAP_KEY_LEN];
/// irk addr
// irk addr
uint8_t irk_addr[APP_BD_ADDR_LEN];
} app_sonata_gap_irk_t;
@@ -143,15 +134,14 @@ typedef struct bonded_dev_info_list {
} bonded_dev_info_list_t;
typedef struct peer_conn_param {
/// Connection interval maximum
// Connection interval maximum
uint16_t intv_max;
/// Latency
// Latency
uint16_t latency;
/// Supervision timeout
// Supervision timeout
uint16_t time_out;
} peer_conn_param_t;
typedef struct connect_req_info {
uint8_t conidx;
uint8_t bd_addr[APP_BD_ADDR_LEN];
@@ -162,8 +152,6 @@ typedef struct adv_idx_info {
uint8_t adv_id;
} adv_idx_info_t;
typedef struct {
uint8_t advdata[31];
uint8_t advdataLen;
@@ -176,7 +164,6 @@ typedef struct {
} ble_scan_data_set_t;
typedef struct {
int status;
int len;
@@ -228,7 +215,6 @@ typedef int (*app_core_evt_ind_cb)(app_core_evt_ind_t evt, void *p_param);
typedef int (*app_sec_req_cb)(uint8_t *addr);
typedef enum {
USER_INVALID_MODULE_ID,
USER_MIDEA_MODULE_ID,
@@ -312,7 +298,6 @@ void app_ble_set_test_read_uuid(uint8_t *uuid);
void app_ble_start_advertising_with_param(sonata_gap_directed_adv_create_param_t *param, ble_adv_data_set_t *data,
ble_scan_data_set_t *scan_data, uint8_t own_addr_type, uint16_t duration, uint8_t max_adv_evt);
/// @} APP
// @} APP
#endif // APP_H_
+19 -27
View File
@@ -25,7 +25,6 @@
****************************************************************************************
*/
#ifndef _ARCH_H_
#define _ARCH_H_
@@ -35,9 +34,9 @@
*/
#include <stdint.h> // standard integer definition
#include <stdio.h>
#include "compiler.h" // inline functions
#include "sonata_stack_config.h"
/*
* MACRO DEFINES
****************************************************************************************
@@ -49,46 +48,46 @@
#define CRITICAL_FUNC_SEG
#endif //CFG_SEG
/// ARM is a 32-bit CPU
// ARM is a 32-bit CPU
#define CPU_WORD_SIZE 4
/// ARM is little endian
// ARM is little endian
#define CPU_LE 1
/// debug configuration
// debug configuration
#if defined(CFG_DBG)
#define PLF_DEBUG 1
#else //CFG_DBG
#define PLF_DEBUG 0
#endif //CFG_DBG
/// NVDS configuration
// NVDS configuration
#ifdef CFG_NVDS
#define PLF_NVDS 1
#else // CFG_NVDS
#define PLF_NVDS 0
#endif // CFG_NVDS
/// ble rom support
// ble rom support
#if defined(CFG_BLE_ROM)
#define BLE_ROM 1
#else
#define BLE_ROM 0
#endif
/// Possible errors detected by FW
// Possible errors detected by FW
#define RESET_NO_ERROR 0x00000000
#define RESET_MEM_ALLOC_FAIL 0xF2F2F2F2
/// Reset platform and stay in ROM
// Reset platform and stay in ROM
#define RESET_TO_ROM 0xA5A5A5A5
/// Reset platform and reload FW
// Reset platform and reload FW
#define RESET_AND_LOAD_FW 0xC3C3C3C3
/// Exchange memory size limit
// Exchange memory size limit
#define EM_SIZE_LIMIT 0x8000
/// maximum assert number
// maximum assert number
#define ASSERT_ID_LAST 3703s
/*
@@ -160,7 +159,6 @@ void assert_param(uint16_t id, int param0, int param1);
*/
void assert_warn(uint16_t id, int param0, int param1);
/**
****************************************************************************************
* @brief Dump data value into FW.
@@ -171,9 +169,6 @@ void assert_warn(uint16_t id, int param0, int param1);
*/
void dump_data(uint8_t *data, uint16_t length);
/*
* ASSERTION CHECK
****************************************************************************************
@@ -184,7 +179,7 @@ extern void (*pf_sonata_assert_err)(uint16_t id, int cond);
extern void (*pf_sonata_assert_param)(uint16_t id, int param0, int param1);
extern void (*pf_sonata_assert_warn)(uint16_t id, int param0, int param1);
/// Assertions showing a critical error that could require a full system reset
// Assertions showing a critical error that could require a full system reset
#define ASSERT_ERR(id, cond) \
do { \
if (!(cond)) { \
@@ -195,8 +190,7 @@ extern void (*pf_sonata_assert_warn)(uint16_t id, int param0, int param1);
} \
} while(0)
/// Assertions showing a critical error that could require a full system reset
// Assertions showing a critical error that could require a full system reset
#define ASSERT_INFO(id, cond, param0, param1) \
do { \
if (!(cond)) { \
@@ -207,8 +201,7 @@ extern void (*pf_sonata_assert_warn)(uint16_t id, int param0, int param1);
} \
} while(0)
/// Assertions showing a non-critical problem that has to be fixed by the SW
// Assertions showing a non-critical problem that has to be fixed by the SW
#define ASSERT_WARN(id, cond, param0, param1) \
do { \
if (!(cond)) { \
@@ -225,20 +218,19 @@ extern void (*pf_sonata_assert_warn)(uint16_t id, int param0, int param1);
dump_data((uint8_t*)(data), length)
#else
/// Assertions showing a critical error that could require a full system reset
// Assertions showing a critical error that could require a full system reset
#define ASSERT_ERR(id, cond)
/// Assertions showing a critical error that could require a full system reset
// Assertions showing a critical error that could require a full system reset
#define ASSERT_INFO(id, cond, param0, param1)
/// Assertions showing a non-critical problem that has to be fixed by the SW
// Assertions showing a non-critical problem that has to be fixed by the SW
#define ASSERT_WARN(id, cond, param0, param1)
/// DUMP data array present in the SW.
// DUMP data array present in the SW.
#define DUMP_DATA(data, length)
#endif //PLF_DEBUG
// required to define GLOBAL_INT_** macros as inline assembly. This file is included after
// definition of ASSERT macros as they are used inside ll.h
@@ -255,5 +247,5 @@ int rtos_set_semaphore(void **semaphore);
#endif //(SONATA_RTOS_SUPPORT)
/// @} DRIVERS
// @} DRIVERS
#endif // _ARCH_H_
@@ -29,7 +29,6 @@
#include "stdio.h"
#include "sonata_ble_hook.h"
#define SONATA_AT_VERSION "AT-V0.9.1"
#define SONATA_SDK_VERSION "SDK-V1.0.10"
#define SONATA_APP_VERSION "APP-V1.0.10"
@@ -118,7 +117,6 @@ extern char at_dbgflg;
#define at_printf printf
#define dbg_at(Fmt, ...) do{if(at_dbgflg) at_printf(Fmt "\r\n", ## __VA_ARGS__);}while(0)
#define dbg_atnn(Fmt, ...) do{if(at_dbgflg) at_printf(Fmt, ## __VA_ARGS__);}while(0)
@@ -129,4 +127,3 @@ extern char at_dbgflg;
#endif //_AT_API_H_
@@ -22,7 +22,6 @@
#define BLE_APP_FRAME_DATA_MAX_LENGTH 300
/*
* MACRO DEFINITIONS
****************************************************************************************
@@ -152,22 +151,19 @@ typedef struct BLE_ADV_ENABLE_T {
uint8_t advertising_enable;
} ble_adv_enable_t;
typedef enum MS_BLE_STACK_EVENT_T {
MS_BLE_STACK_EVENT_STACK_READY = 0,
MS_BLE_STACK_EVENT_STACK_FAIL,
MS_BLE_STACK_EVENT_ADV_ON, /*!< ???????????г??*/
MS_BLE_STACK_EVENT_ADV_OFF, /*!< ???????????г??*/
MS_BLE_STACK_EVENT_DISCONNECT, /*!< ??????*/
MS_BLE_STACK_EVENT_DISCONNECT, /* !< ?????? */
MS_BLE_STACK_EVENT_CONNECTED, /*!< ??????*/
} ms_ble_stack_event_t;
typedef void (*ble_gatt_service_att_wirte_cb)(uint8_t *data, uint16_t size);
typedef void (*ble_gatt_service_att_read_cb)(uint8_t *data, uint16_t *size);
typedef void (*ble_gatt_service_att_ind_cb)(uint8_t *data, uint16_t size);
typedef struct ble_gatt_att_opr {
ble_gatt_service_att_wirte_cb write_request;
ble_gatt_service_att_read_cb read_request;
@@ -179,11 +175,9 @@ typedef struct ble_gatt_att_reg {
ble_gatt_att_opr_t att_opr;
} ble_gatt_att_reg_t;
typedef void (*cb_fun)(ms_ble_stack_event_t);
typedef void (*app_ble_scan_callback_t)(uint8_t *data, uint16_t len);
extern cb_fun ble_cb_fun;
void ble_set_callback(cb_fun cb);
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_API_TASK_H_
#define _SONATA_API_TASK_H_
@@ -67,8 +66,6 @@ typedef enum {
SONATA_API_TASK_STATE_MAX
} sonata_api_task_state_t;
/// asr api task messages
typedef enum {
SONATA_API_DUMMY_MSG = STACK_TASK_FIRST_MSG(SONATA_TASK_ID_APP),
@@ -78,7 +75,6 @@ typedef enum {
SONATA_API_LAST_MSG,
} sonata_api_task_msg_id;
/*
* Type Definition
****************************************************************************************
@@ -148,7 +148,6 @@
#define SONATA_ATT_BT_UUID_128 {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
/// MAC length
#define SONATA_ATT_SIGN_MAC_LEN (8)
/// SignCounter length
@@ -456,7 +455,6 @@ enum {
////time unit - month
SONATA_ATT_UNIT_MONTH = SONATA_ATT_UUID_16(0x27B4),
/*---------------- DECLARATIONS -----------------*/
/// Primary service Declaration
SONATA_ATT_DECL_PRIMARY_SERVICE = SONATA_ATT_UUID_16(0x2800),
@@ -467,7 +465,6 @@ enum {
/// Characteristic Declaration
SONATA_ATT_DECL_CHARACTERISTIC = SONATA_ATT_UUID_16(0x2803),
/*----------------- DESCRIPTORS -----------------*/
/// Characteristic extended properties
SONATA_ATT_DESC_CHAR_EXT_PROPERTIES = SONATA_ATT_UUID_16(0x2900),
@@ -494,7 +491,6 @@ enum {
/// Environmental Sensing Trigger Setting
SONATA_ATT_DESC_ES_TRIGGER_SETTING = SONATA_ATT_UUID_16(0x290D),
/*--------------- CHARACTERISTICS ---------------*/
/// Device name
SONATA_ATT_CHAR_DEVICE_NAME = SONATA_ATT_UUID_16(0x2A00),
@@ -871,7 +867,6 @@ enum {
SONATA_ATT_FORMAT_LAST
};
/// Client Characteristic Configuration Codes
enum sonata_att_ccc_val {
/// Stop notification/indication
@@ -889,7 +884,6 @@ enum sonata_att_ccc_val {
/// Attribute length type
/// UUID - 128-bit type
struct sonata_att_uuid_128 {
/// 128-bit UUID
@@ -902,8 +896,6 @@ struct sonata_att_uuid_32 {
uint8_t uuid[SONATA_ATT_UUID_32_LEN];
};
/// Characteristic Value Descriptor
struct sonata_att_char_desc {
/// properties
@@ -945,7 +937,6 @@ struct sonata_att_incl128_desc {
uint16_t end_hdl;
};
// --------------------------- Database permissions -----------------------------
/// Macro used to retrieve access permission rights
@@ -967,7 +958,6 @@ struct sonata_att_incl128_desc {
/// Retrieve attribute security level from attribute right and service right
/// Retrieve UUID LEN from UUID Length Permission
#define SONATA_ATT_UUID_LEN(uuid_len_perm) (((uuid_len_perm) == 0) ? ATT_UUID_16_LEN : \
(((uuid_len_perm) == 1) ? ATT_UUID_32_LEN : \
@@ -1072,7 +1062,6 @@ enum sonata_attm_value_perm_mask {
SONATA_PERM_POS_RI = 15,
};
/**
* Service permissions
*
@@ -1109,7 +1098,6 @@ enum sonata_attm_svc_perm_mask {
SONATA_PERM_POS_SVC_SECONDARY = 7,
};
/// Attribute & Service access mode
enum {
/// Disable access
@@ -1153,8 +1141,5 @@ enum {
SONATA_ATT_EXECUTE_ALL_PREPARED_WRITES
};
/// @} ATT
#endif // SONATA_ATT_H_
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_BLE_API_H_
#define _SONATA_BLE_API_H_
@@ -34,6 +33,8 @@
#include "sonata_utils_api.h"
#include "sonata_gatt_api.h"
#include "sonata_gap_api.h"
#include "sonata_prf_diss_api.h"
#include "sonata_log.h"
/*
* MACRO DEFINITIONS
****************************************************************************************
@@ -43,8 +44,7 @@
* @{
*/
/// debug trace
// debug trace
#define SONATA_BLE_API_DBG 1
#if SONATA_BLE_API_DBG
#define SONATA_BLE_API_TRC printf
@@ -52,29 +52,27 @@
#define SONATA_BLE_API_TRC(...)
#endif //SONATA_BLE_API_DBG
#define SONATA_TASK_FIRST_MSG(task) ((uint16_t)((task) << 8))
/*
* ENUM DEFINITIONS
****************************************************************************************
*/
/// App callback status
// App callback status
typedef enum {
CB_DONE = 0, //Done in callback
CB_REJECT = 1, //Do nothing in callback, SDK will do it
CB_MAX = 0xFF,
} CBStatus;
/// Result of sleep state.
// Result of sleep state.
enum sonata_ble_sleep_state {
/// Some activity pending, can not enter in sleep state
// Some activity pending, can not enter in sleep state
SONATA_BLE_ACTIVE = 0,
/// CPU can be put in sleep state
// CPU can be put in sleep state
SONATA_BLE_CPU_SLEEP,
/// IP could enter in deep sleep
// IP could enter in deep sleep
SONATA_BLE_DEEP_SLEEP,
};
@@ -83,7 +81,6 @@ enum sonata_ble_sleep_state {
****************************************************************************************
*/
/*
* GLOBAL VARIABLE DECLARATIONS
****************************************************************************************
@@ -110,7 +107,6 @@ void sonata_ble_init(sonata_ble_hook_t hook);
*/
void sonata_ble_prevent_sleep_set(uint16_t prv_slp_bit);
/*!
* @brief Clears a bit in the prevent sleep bit field, in order to allow the system
* going to sleep
@@ -146,9 +142,7 @@ void sonata_ble_isr(void);
****************************************************************************************
*/
/** @}*/
#endif //_SONATA_BLE_API_H_
@@ -77,7 +77,6 @@ extern PF_GET_STACK_USAGE pf_get_stack_usage;
extern PF_PRINTF pf_printf;
extern PF_APP_PRF_API_INIT pf_app_prf_api_init;
/*
* FUNCTION DECLARATION
*****************************************************************************************
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_BLE_ROM_H_
#define _SONATA_BLE_ROM_H_
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_BLE_TRANSPORT_H_
#define _SONATA_BLE_TRANSPORT_H_
@@ -32,24 +31,16 @@
****************************************************************************************
*/
/*
* MACRO DEFINITIONS
****************************************************************************************
*/
/*
* ENUM DEFINITIONS
****************************************************************************************
*/
/*
* Type Definition
****************************************************************************************
@@ -61,23 +52,18 @@ typedef struct sonata_ble_transport_pad_config {
void (*pf_flow_off_pad_config)(void);
} sonata_ble_transport_pad_config_t;
/*
* GLOBAL VARIABLES DECLARATIONS
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
extern void sonata_ble_transport_init(sonata_ble_transport_pad_config_t *config);
extern void sonata_ble_transport_wkup(void);
#endif //_SONATA_BLE_TRANSPORT_H_
@@ -37,7 +37,6 @@
*/
#define UTIL_BIT(pos) (1UL<<(pos))
#define SONATA_KEY_LEN (0x10)
#define SONATA_RAND_NB_LEN (0x08)
#define SONATA_BD_ADDR_LEN (6)
@@ -123,12 +122,10 @@ enum {
#define STACK_BLE_HOST_PRESENT 0
#endif // defined(CFG_BLE) && defined(CFG_HOST)
#define SONATA_TASK_ID_APP (15)
#define SONATA_TASK_ID_BASS (36)
#define SONATA_TASK_ID_HOGPD (38)
#define SONATA_GAP_MAX_NAME_SIZE (0x20)
#define STACK_TASK_FIRST_MSG(task) ((uint16_t)((task) << 8))
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_ERROR_API_H_
#define _SONATA_ERROR_API_H_
@@ -57,10 +56,8 @@
/// asr ble api error code
/// asr api task error code
/// asr gap api error code
#define SONATA_GAP_ERR_NO_ERROR (0X00 | SONATA_GAP_API_ERR_ID)
#define SONATA_GAP_ERR_INVALID_PARAM (0x40 | SONATA_GAP_API_ERR_ID)
@@ -78,8 +75,6 @@
#define SONATA_GAP_ERR_UNEXPECTED (0x4C | SONATA_GAP_API_ERR_ID)
#define SONATA_GAP_ERR_MISMATCH (0x4D | SONATA_GAP_API_ERR_ID)
/// asr gatt api error code
#define SONATA_GATT_ERR_NO_ERROR (0X00 | SONATA_GATT_API_ERR_ID)
#define SONATA_GATT_ERR_INVALID_PARAM (0x40 | SONATA_GATT_API_ERR_ID)
@@ -105,7 +100,6 @@
/// asr utils api error code
/// debug trace
#ifdef SONATA_UTILS_API_DBG
#define SONATA_UTILS_API_TRC printf
@@ -118,8 +112,6 @@
****************************************************************************************
*/
//C error
#define SONATA_CO_ERROR_NO_ERROR (0x00)
#define SONATA_CO_ERROR_UNKNOWN_HCI_COMMAND (0x01)
@@ -191,7 +183,6 @@
#define SONATA_CO_ERROR_HW_MEM_ALLOC_FAIL (0x01)
//C error end
//hl_err
enum stack_hl_err {
/// No error
@@ -279,7 +270,6 @@ enum stack_hl_err {
/// Unknown PDU
SONATA_HL_L2C_ERR_UNKNOWN_PDU = 0x3F,
// ----------------------------------------------------------------------------------
// -------------------------- GAP Specific Error ------------------------------------
// ----------------------------------------------------------------------------------
+248 -258
View File
@@ -58,68 +58,65 @@
****************************************************************************************
*/
/// BD address length
// BD address length
#define SONATA_GAP_BD_ADDR_LEN (6)
/// LE Channel map length
// LE Channel map length
#define SONATA_GAP_LE_CHNL_MAP_LEN (0x05)
/// LE Feature Flags Length
// LE Feature Flags Length
#define SONATA_GAP_LE_FEATS_LEN (0x08)
/// ADV Data and Scan Response length
// ADV Data and Scan Response length
#define SONATA_GAP_ADV_DATA_LEN (0x1F)
#define SONATA_GAP_SCAN_RSP_DATA_LEN (0x1F)
/// Random number length
// Random number length
#define SONATA_GAP_RAND_NB_LEN (0x08)
/// Key length
// Key length
#define SONATA_GAP_KEY_LEN (16)
/// P256 Key Len
// P256 Key Len
#define SONATA_GAP_P256_KEY_LEN (0x20)
///***** AD Type Flag - Bit set *******/
/// Limited discovery flag - AD Flag
// Limited discovery flag - AD Flag
#define SONATA_GAP_LE_LIM_DISCOVERABLE_FLG 0x01
/// General discovery flag - AD Flag
// General discovery flag - AD Flag
#define SONATA_GAP_LE_GEN_DISCOVERABLE_FLG 0x02
/// Legacy BT not supported - AD Flag
// Legacy BT not supported - AD Flag
#define SONATA_GAP_BR_EDR_NOT_SUPPORTED 0x04
/// Dual mode for controller supported (BR/EDR/LE) - AD Flag
// Dual mode for controller supported (BR/EDR/LE) - AD Flag
#define SONATA_GAP_SIMUL_BR_EDR_LE_CONTROLLER 0x08
/// Dual mode for host supported (BR/EDR/LE) - AD Flag
// Dual mode for host supported (BR/EDR/LE) - AD Flag
#define SONATA_GAP_SIMUL_BR_EDR_LE_HOST 0x10
/*********** GAP Miscellaneous Defines *************/
/// Invalid activity index
// Invalid activity index
#define SONATA_GAP_INVALID_ACTV_IDX 0xFF
/// Invalid connection index
// Invalid connection index
#define SONATA_GAP_INVALID_CONIDX 0xFF
/// Invalid connection handle
// Invalid connection handle
#define SONATA_GAP_INVALID_CONHDL 0xFFFF
/// Connection interval min (N*1.250ms)
// Connection interval min (N*1.250ms)
#define SONATA_GAP_CNX_INTERVAL_MIN 6 //(0x06)
/// Connection interval Max (N*1.250ms)
// Connection interval Max (N*1.250ms)
#define SONATA_GAP_CNX_INTERVAL_MAX 3200 //(0xC80)
/// Connection latency min (N*cnx evt)
// Connection latency min (N*cnx evt)
#define SONATA_GAP_CNX_LATENCY_MIN 0 //(0x00)
/// Connection latency Max (N*cnx evt
// Connection latency Max (N*cnx evt
#define SONATA_GAP_CNX_LATENCY_MAX 499 //(0x1F3)
/// Supervision TO min (N*10ms)
// Supervision TO min (N*10ms)
#define SONATA_GAP_CNX_SUP_TO_MIN 10 //(0x0A)
/// Supervision TO Max (N*10ms)
// Supervision TO Max (N*10ms)
#define SONATA_GAP_CNX_SUP_TO_MAX 3200 //(0xC80)
/// Length of resolvable random address prand part
// Length of resolvable random address prand part
#define SONATA_GAP_ADDR_PRAND_LEN (3)
/// Length of resolvable random address hash part
// Length of resolvable random address hash part
#define SONATA_GAP_ADDR_HASH_LEN (3)
/// Number of bytes needed for a bit field indicated presence of a given Advertising Flag value
/// in the Advertising or the Scan Response data
/// Advertising Flags is a 8-bit value, hence 256 value are possible
/// -> 256 / 8 bytes = 32 bytes are needed
// Number of bytes needed for a bit field indicated presence of a given Advertising Flag value
// in the Advertising or the Scan Response data
// Advertising Flags is a 8-bit value, hence 256 value are possible
// -> 256 / 8 bytes = 32 bytes are needed
#define SONATA_GAP_AD_TYPE_BITFIELD_BYTES (32)
/*
@@ -127,111 +124,111 @@
****************************************************************************************
*/
/// Central idle timer
/// TGAP(conn_pause_central)
/// recommended value: 1 s: (100 for ke timer)
// Central idle timer
// TGAP(conn_pause_central)
// recommended value: 1 s: (100 for ke timer)
#define SONATA_GAP_TMR_CONN_PAUSE_CT 0x0064
/// Minimum time upon connection establishment before the peripheral
/// starts a connection update procedure: TGAP(conn_pause_peripheral)
/// recommended value: 5 s: (500 for ke timer)
// Minimum time upon connection establishment before the peripheral
// starts a connection update procedure: TGAP(conn_pause_peripheral)
// recommended value: 5 s: (500 for ke timer)
#define SONATA_GAP_TMR_CONN_PAUSE_PH 0x01F4
/// Minimum time to perform scanning when user initiated
/// TGAP(scan_fast_period)
/// recommended value: 30.72 s: (3072 for ke timer)
// Minimum time to perform scanning when user initiated
// TGAP(scan_fast_period)
// recommended value: 30.72 s: (3072 for ke timer)
#define SONATA_GAP_TMR_SCAN_FAST_PERIOD 0x0C00
/// Minimum time to perform advertising when user initiated
/// TGAP(adv_fast_period)
/// recommended value: 30 s: (3000 for ke timer)
// Minimum time to perform advertising when user initiated
// TGAP(adv_fast_period)
// recommended value: 30 s: (3000 for ke timer)
#define SONATA_GAP_TMR_ADV_FAST_PERIOD 0x0BB8
/// Scan interval used during Link Layer Scanning State when
/// performing the Limited Discovery procedure
/// TGAP(lim_disc_scan_int)
/// recommended value: 11.25ms; (18 decimal)
// Scan interval used during Link Layer Scanning State when
// performing the Limited Discovery procedure
// TGAP(lim_disc_scan_int)
// recommended value: 11.25ms; (18 decimal)
#define SONATA_GAP_LIM_DISC_SCAN_INT 0x0012
/// Scan interval in any discovery or connection establishment
/// procedure when user initiated: TGAP(scan_fast_interval)
/// recommended value: 30 to 60 ms; N * 0.625
// Scan interval in any discovery or connection establishment
// procedure when user initiated: TGAP(scan_fast_interval)
// recommended value: 30 to 60 ms; N * 0.625
#define SONATA_GAP_SCAN_FAST_INTV 0x0030
/// Scan window in any discovery or connection establishment
/// procedure when user initiated: TGAP(scan_fast_window)
/// recommended value: 30 ms; N * 0.625
// Scan window in any discovery or connection establishment
// procedure when user initiated: TGAP(scan_fast_window)
// recommended value: 30 ms; N * 0.625
#define SONATA_GAP_SCAN_FAST_WIND 0x0030
/// Scan interval in any discovery or connection establishment
/// procedure when background scanning: TGAP(scan_slow_interval1)
/// recommended value: 1.28 s : 0x00CD (205); N * 0.625
// Scan interval in any discovery or connection establishment
// procedure when background scanning: TGAP(scan_slow_interval1)
// recommended value: 1.28 s : 0x00CD (205); N * 0.625
#define SONATA_GAP_SCAN_SLOW_INTV1 0x00CD
/// Scan interval in any discovery or connection establishment
/// procedure when background scanning: TGAP(scan_slow_interval2)
/// recommended value: 2.56 s : 0x019A (410); N * 0.625
// Scan interval in any discovery or connection establishment
// procedure when background scanning: TGAP(scan_slow_interval2)
// recommended value: 2.56 s : 0x019A (410); N * 0.625
#define SONATA_GAP_SCAN_SLOW_INTV2 0x019A
/// Scan window in any discovery or connection establishment
/// procedure when background scanning: TGAP(scan_slow_window1)
/// recommended value: 11.25 ms : 0x0012 (18); N * 0.625
// Scan window in any discovery or connection establishment
// procedure when background scanning: TGAP(scan_slow_window1)
// recommended value: 11.25 ms : 0x0012 (18); N * 0.625
#define SONATA_GAP_SCAN_SLOW_WIND1 0x0012
/// Scan window in any discovery or connection establishment
/// procedure when background scanning: TGAP(scan_slow_window2)
/// recommended value: 22.5 ms : 0x0024 (36); N * 0.625
// Scan window in any discovery or connection establishment
// procedure when background scanning: TGAP(scan_slow_window2)
// recommended value: 22.5 ms : 0x0024 (36); N * 0.625
#define SONATA_GAP_SCAN_SLOW_WIND2 0x0024
/// Minimum to maximum advertisement interval in any discoverable
/// or connectable mode when user initiated: TGAP(adv_fast_interval1)
/// recommended value: 30 to 60 ms; N * 0.625
// Minimum to maximum advertisement interval in any discoverable
// or connectable mode when user initiated: TGAP(adv_fast_interval1)
// recommended value: 30 to 60 ms; N * 0.625
#define SONATA_GAP_ADV_FAST_INTV1 0x0030
/// Minimum to maximum advertisement interval in any discoverable
/// or connectable mode when user initiated: TGAP(adv_fast_interval2)
/// recommended value: 100 to 150 ms; N * 0.625
// Minimum to maximum advertisement interval in any discoverable
// or connectable mode when user initiated: TGAP(adv_fast_interval2)
// recommended value: 100 to 150 ms; N * 0.625
#define SONATA_GAP_ADV_FAST_INTV2 0x0064
/// Minimum to maximum advertisement interval in any discoverable or
/// connectable mode when background advertising: TGAP(adv_slow_interval)
/// recommended value: 1 to 1.2 s : 0x00B0 (176); N * 0.625
// Minimum to maximum advertisement interval in any discoverable or
// connectable mode when background advertising: TGAP(adv_slow_interval)
// recommended value: 1 to 1.2 s : 0x00B0 (176); N * 0.625
#define SONATA_GAP_ADV_SLOW_INTV 0x00B0
/// Minimum to maximum connection interval upon any connection
/// establishment: TGAP(initial_conn_interval)
/// recommended value: 30 to 50 ms ; N * 1.25 ms
// Minimum to maximum connection interval upon any connection
// establishment: TGAP(initial_conn_interval)
// recommended value: 30 to 50 ms ; N * 1.25 ms
#define SONATA_GAP_INIT_CONN_MIN_INTV 0x0018
#define SONATA_GAP_INIT_CONN_MAX_INTV 0x0028
/// RW Defines
// RW Defines
#define SONATA_GAP_INQ_SCAN_INTV 0x0012
#define SONATA_GAP_INQ_SCAN_WIND 0x0012
/// Connection supervision timeout
/// recommended value: 20s
// Connection supervision timeout
// recommended value: 20s
#define SONATA_GAP_CONN_SUPERV_TIMEOUT 0x07D0
/// Minimum connection event
/// default value: 0x0000
// Minimum connection event
// default value: 0x0000
#define SONATA_GAP_CONN_MIN_CE 0x0000
/// Maximum connection event
/// default value: 0xFFFF
// Maximum connection event
// default value: 0xFFFF
#define SONATA_GAP_CONN_MAX_CE 0xFFFF
/// Connection latency
/// default value: 0x0000
// Connection latency
// default value: 0x0000
#define SONATA_GAP_CONN_LATENCY 0x0000
/// GAP Device name Characteristic
/// Default device name
// GAP Device name Characteristic
// Default device name
#define SONATA_GAP_DEV_NAME_DEFAULT "ASR-BLE"
/// GAP Appearance or Icon Characteristic - 2 octets
/// Current appearance value is 0x0000 (unknown appearance)
/// Description:
/// http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
// GAP Appearance or Icon Characteristic - 2 octets
// Current appearance value is 0x0000 (unknown appearance)
// Description:
// http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
#define SONATA_GAP_APPEARANCE 0x0000
///GAP Peripheral Preferred Connection Parameter - 8 octets
@@ -255,86 +252,85 @@
* Enumerations
****************************************************************************************
*/
/// GAP Advertising Flags
// GAP Advertising Flags
enum sonata_gap_ad_type {
/// Flag
SONATA_GAP_AD_TYPE_FLAGS = 0x01,//!< SONATA_GAP_AD_TYPE_FLAGS
/// Use of more than 16 bits UUID
SONATA_GAP_AD_TYPE_MORE_16_BIT_UUID = 0x02,//!< SONATA_GAP_AD_TYPE_MORE_16_BIT_UUID
/// Complete list of 16 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID = 0x03,//!< SONATA_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID
/// Use of more than 32 bit UUD
SONATA_GAP_AD_TYPE_MORE_32_BIT_UUID = 0x04,//!< SONATA_GAP_AD_TYPE_MORE_32_BIT_UUID
/// Complete list of 32 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID = 0x05,//!< SONATA_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID
/// Use of more than 128 bit UUID
SONATA_GAP_AD_TYPE_MORE_128_BIT_UUID = 0x06,//!< SONATA_GAP_AD_TYPE_MORE_128_BIT_UUID
/// Complete list of 128 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID = 0x07,//!< SONATA_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID
/// Shortened device name
SONATA_GAP_AD_TYPE_SHORTENED_NAME = 0x08,//!< SONATA_GAP_AD_TYPE_SHORTENED_NAME
/// Complete device name
SONATA_GAP_AD_TYPE_COMPLETE_NAME = 0x09,//!< SONATA_GAP_AD_TYPE_COMPLETE_NAME
/// Transmit power
SONATA_GAP_AD_TYPE_TRANSMIT_POWER = 0x0A,//!< SONATA_GAP_AD_TYPE_TRANSMIT_POWER
/// Class of device
SONATA_GAP_AD_TYPE_CLASS_OF_DEVICE = 0x0D,//!< SONATA_GAP_AD_TYPE_CLASS_OF_DEVICE
/// Simple Pairing Hash C
SONATA_GAP_AD_TYPE_SP_HASH_C = 0x0E,//!< SONATA_GAP_AD_TYPE_SP_HASH_C
/// Simple Pairing Randomizer
SONATA_GAP_AD_TYPE_SP_RANDOMIZER_R = 0x0F,//!< SONATA_GAP_AD_TYPE_SP_RANDOMIZER_R
/// Temporary key value
SONATA_GAP_AD_TYPE_TK_VALUE = 0x10,//!< SONATA_GAP_AD_TYPE_TK_VALUE
/// Out of Band Flag
SONATA_GAP_AD_TYPE_OOB_FLAGS = 0x11,//!< SONATA_GAP_AD_TYPE_OOB_FLAGS
/// Slave connection interval range
SONATA_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE = 0x12,//!< SONATA_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE
/// Require 16 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID = 0x14,//!< SONATA_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID
/// Require 32 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID = 0x1F,//!< SONATA_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID
/// Require 128 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID = 0x15,//!< SONATA_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID
/// Service data 16-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_16_BIT_DATA = 0x16,//!< SONATA_GAP_AD_TYPE_SERVICE_16_BIT_DATA
/// Service data 32-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_32_BIT_DATA = 0x20,//!< SONATA_GAP_AD_TYPE_SERVICE_32_BIT_DATA
/// Service data 128-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_128_BIT_DATA = 0x21,//!< SONATA_GAP_AD_TYPE_SERVICE_128_BIT_DATA
/// Public Target Address
SONATA_GAP_AD_TYPE_PUB_TGT_ADDR = 0x17,//!< SONATA_GAP_AD_TYPE_PUB_TGT_ADDR
/// Random Target Address
SONATA_GAP_AD_TYPE_RAND_TGT_ADDR = 0x18,//!< SONATA_GAP_AD_TYPE_RAND_TGT_ADDR
/// Appearance
SONATA_GAP_AD_TYPE_APPEARANCE = 0x19,//!< SONATA_GAP_AD_TYPE_APPEARANCE
/// Advertising Interval
SONATA_GAP_AD_TYPE_ADV_INTV = 0x1A,//!< SONATA_GAP_AD_TYPE_ADV_INTV
/// LE Bluetooth Device Address
SONATA_GAP_AD_TYPE_LE_BT_ADDR = 0x1B,//!< SONATA_GAP_AD_TYPE_LE_BT_ADDR
/// LE Role
SONATA_GAP_AD_TYPE_LE_ROLE = 0x1C,//!< SONATA_GAP_AD_TYPE_LE_ROLE
/// Simple Pairing Hash C-256
SONATA_GAP_AD_TYPE_SPAIR_HASH = 0x1D,//!< SONATA_GAP_AD_TYPE_SPAIR_HASH
/// Simple Pairing Randomizer R-256
SONATA_GAP_AD_TYPE_SPAIR_RAND = 0x1E,//!< SONATA_GAP_AD_TYPE_SPAIR_RAND
/// 3D Information Data
SONATA_GAP_AD_TYPE_3D_INFO = 0x3D,//!< SONATA_GAP_AD_TYPE_3D_INFO
// Flag
SONATA_GAP_AD_TYPE_FLAGS = 0x01, // !< SONATA_GAP_AD_TYPE_FLAGS
// Use of more than 16 bits UUID
SONATA_GAP_AD_TYPE_MORE_16_BIT_UUID = 0x02, // !< SONATA_GAP_AD_TYPE_MORE_16_BIT_UUID
// Complete list of 16 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID = 0x03, // !< SONATA_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID
// Use of more than 32 bit UUD
SONATA_GAP_AD_TYPE_MORE_32_BIT_UUID = 0x04, // !< SONATA_GAP_AD_TYPE_MORE_32_BIT_UUID
// Complete list of 32 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID = 0x05, // !< SONATA_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID
// Use of more than 128 bit UUID
SONATA_GAP_AD_TYPE_MORE_128_BIT_UUID = 0x06, // !< SONATA_GAP_AD_TYPE_MORE_128_BIT_UUID
// Complete list of 128 bit UUID
SONATA_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID = 0x07, // !< SONATA_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID
// Shortened device name
SONATA_GAP_AD_TYPE_SHORTENED_NAME = 0x08, // !< SONATA_GAP_AD_TYPE_SHORTENED_NAME
// Complete device name
SONATA_GAP_AD_TYPE_COMPLETE_NAME = 0x09, // !< SONATA_GAP_AD_TYPE_COMPLETE_NAME
// Transmit power
SONATA_GAP_AD_TYPE_TRANSMIT_POWER = 0x0A, // !< SONATA_GAP_AD_TYPE_TRANSMIT_POWER
// Class of device
SONATA_GAP_AD_TYPE_CLASS_OF_DEVICE = 0x0D, // !< SONATA_GAP_AD_TYPE_CLASS_OF_DEVICE
// Simple Pairing Hash C
SONATA_GAP_AD_TYPE_SP_HASH_C = 0x0E, // !< SONATA_GAP_AD_TYPE_SP_HASH_C
// Simple Pairing Randomizer
SONATA_GAP_AD_TYPE_SP_RANDOMIZER_R = 0x0F, // !< SONATA_GAP_AD_TYPE_SP_RANDOMIZER_R
// Temporary key value
SONATA_GAP_AD_TYPE_TK_VALUE = 0x10, // !< SONATA_GAP_AD_TYPE_TK_VALUE
// Out of Band Flag
SONATA_GAP_AD_TYPE_OOB_FLAGS = 0x11, // !< SONATA_GAP_AD_TYPE_OOB_FLAGS
// Slave connection interval range
SONATA_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE = 0x12, // !< SONATA_GAP_AD_TYPE_SLAVE_CONN_INT_RANGE
// Require 16 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID = 0x14, // !< SONATA_GAP_AD_TYPE_RQRD_16_BIT_SVC_UUID
// Require 32 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID = 0x1F, // !< SONATA_GAP_AD_TYPE_RQRD_32_BIT_SVC_UUID
// Require 128 bit service UUID
SONATA_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID = 0x15, // !< SONATA_GAP_AD_TYPE_RQRD_128_BIT_SVC_UUID
// Service data 16-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_16_BIT_DATA = 0x16, // !< SONATA_GAP_AD_TYPE_SERVICE_16_BIT_DATA
// Service data 32-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_32_BIT_DATA = 0x20, // !< SONATA_GAP_AD_TYPE_SERVICE_32_BIT_DATA
// Service data 128-bit UUID
SONATA_GAP_AD_TYPE_SERVICE_128_BIT_DATA = 0x21, // !< SONATA_GAP_AD_TYPE_SERVICE_128_BIT_DATA
// Public Target Address
SONATA_GAP_AD_TYPE_PUB_TGT_ADDR = 0x17, // !< SONATA_GAP_AD_TYPE_PUB_TGT_ADDR
// Random Target Address
SONATA_GAP_AD_TYPE_RAND_TGT_ADDR = 0x18, // !< SONATA_GAP_AD_TYPE_RAND_TGT_ADDR
// Appearance
SONATA_GAP_AD_TYPE_APPEARANCE = 0x19, // !< SONATA_GAP_AD_TYPE_APPEARANCE
// Advertising Interval
SONATA_GAP_AD_TYPE_ADV_INTV = 0x1A, // !< SONATA_GAP_AD_TYPE_ADV_INTV
// LE Bluetooth Device Address
SONATA_GAP_AD_TYPE_LE_BT_ADDR = 0x1B, // !< SONATA_GAP_AD_TYPE_LE_BT_ADDR
// LE Role
SONATA_GAP_AD_TYPE_LE_ROLE = 0x1C, // !< SONATA_GAP_AD_TYPE_LE_ROLE
// Simple Pairing Hash C-256
SONATA_GAP_AD_TYPE_SPAIR_HASH = 0x1D, // !< SONATA_GAP_AD_TYPE_SPAIR_HASH
// Simple Pairing Randomizer R-256
SONATA_GAP_AD_TYPE_SPAIR_RAND = 0x1E, // !< SONATA_GAP_AD_TYPE_SPAIR_RAND
// 3D Information Data
SONATA_GAP_AD_TYPE_3D_INFO = 0x3D, // !< SONATA_GAP_AD_TYPE_3D_INFO
/// Manufacturer specific data
SONATA_GAP_AD_TYPE_MANU_SPECIFIC_DATA = 0xFF,//!< SONATA_GAP_AD_TYPE_MANU_SPECIFIC_DATA
// Manufacturer specific data
SONATA_GAP_AD_TYPE_MANU_SPECIFIC_DATA = 0xFF, // !< SONATA_GAP_AD_TYPE_MANU_SPECIFIC_DATA
};
/// Boolean value set
// Boolean value set
enum {
/// Disable
// Disable
SONATA_GAP_DISABLE = 0x00,
/// Enable
// Enable
SONATA_GAP_ENABLE
};
/// GAP Attribute database handles
/// Generic Access Profile Service
// GAP Attribute database handles
// Generic Access Profile Service
enum {
SONATA_GAP_IDX_PRIM_SVC,
SONATA_GAP_IDX_CHAR_DEVNAME,
@@ -350,195 +346,192 @@ enum {
SONATA_GAP_IDX_NUMBER
};
/// IO Capability Values
// IO Capability Values
enum sonata_gap_io_cap {
/// Display Only
// Display Only
SONATA_GAP_IO_CAP_DISPLAY_ONLY = 0x00,
/// Display Yes No
// Display Yes No
SONATA_GAP_IO_CAP_DISPLAY_YES_NO,
/// Keyboard Only
// Keyboard Only
SONATA_GAP_IO_CAP_KB_ONLY,
/// No Input No Output
// No Input No Output
SONATA_GAP_IO_CAP_NO_INPUT_NO_OUTPUT,
/// Keyboard Display
// Keyboard Display
SONATA_GAP_IO_CAP_KB_DISPLAY,
SONATA_GAP_IO_CAP_LAST
};
/// TK Type
// TK Type
enum sonata_gap_tk_type {
/// TK get from out of band method
// TK get from out of band method
SONATA_GAP_TK_OOB = 0x00,
/// TK generated and shall be displayed by local device
// TK generated and shall be displayed by local device
SONATA_GAP_TK_DISPLAY,
/// TK shall be entered by user using device keyboard
// TK shall be entered by user using device keyboard
SONATA_GAP_TK_KEY_ENTRY
};
/// OOB Data Present Flag Values
// OOB Data Present Flag Values
enum sonata_gap_oob_auth {
/// OOB Data not present
// OOB Data not present
SONATA_GAP_OOB_AUTH_DATA_NOT_PRESENT = 0x00,
/// OOB data present
// OOB data present
SONATA_GAP_OOB_AUTH_DATA_PRESENT,
SONATA_GAP_OOB_AUTH_DATA_LAST
};
/// Authentication mask
// Authentication mask
enum sonata_gap_auth_mask {
/// No Flag set
// No Flag set
SONATA_GAP_AUTH_NONE = 0,
/// Bond authentication
// Bond authentication
SONATA_GAP_AUTH_BOND = (1 << 0),
/// Man In the middle protection
// Man In the middle protection
SONATA_GAP_AUTH_MITM = (1 << 2),
/// Secure Connection
// Secure Connection
SONATA_GAP_AUTH_SEC_CON = (1 << 3),
/// Key Notification
// Key Notification
SONATA_GAP_AUTH_KEY_NOTIF = (1 << 4)
};
/// Security Link Level
// Security Link Level
enum sonata_gap_lk_sec_lvl {
/// No authentication
// No authentication
SONATA_GAP_LK_NO_AUTH = 0,
/// Unauthenticated link
// Unauthenticated link
SONATA_GAP_LK_UNAUTH,
/// Authenticated link
// Authenticated link
SONATA_GAP_LK_AUTH,
/// Secure Connection link
// Secure Connection link
SONATA_GAP_LK_SEC_CON,
};
/// Authentication Requirements
// Authentication Requirements
enum sonata_gap_auth {
/// No MITM No Bonding
// No MITM No Bonding
SONATA_GAP_AUTH_REQ_NO_MITM_NO_BOND = (SONATA_GAP_AUTH_NONE),
/// No MITM Bonding
// No MITM Bonding
SONATA_GAP_AUTH_REQ_NO_MITM_BOND = (SONATA_GAP_AUTH_BOND),
/// MITM No Bonding
// MITM No Bonding
SONATA_GAP_AUTH_REQ_MITM_NO_BOND = (SONATA_GAP_AUTH_MITM),
/// MITM and Bonding
// MITM and Bonding
SONATA_GAP_AUTH_REQ_MITM_BOND = (SONATA_GAP_AUTH_MITM | SONATA_GAP_AUTH_BOND),
/// SEC_CON and No Bonding
// SEC_CON and No Bonding
SONATA_GAP_AUTH_REQ_SEC_CON_NO_BOND = (SONATA_GAP_AUTH_SEC_CON | SONATA_GAP_AUTH_MITM),
/// SEC_CON and Bonding
// SEC_CON and Bonding
SONATA_GAP_AUTH_REQ_SEC_CON_BOND = (SONATA_GAP_AUTH_SEC_CON | SONATA_GAP_AUTH_MITM | SONATA_GAP_AUTH_BOND),
SONATA_GAP_AUTH_REQ_LAST,
/// Mask of authentication features without reserved flag
// Mask of authentication features without reserved flag
SONATA_GAP_AUTH_REQ_MASK = 0x1F,
};
/// Key Distribution Flags
// Key Distribution Flags
enum sonata_gap_kdist {
/// No Keys to distribute
// No Keys to distribute
SONATA_GAP_KDIST_NONE = 0x00,
/// Encryption key in distribution
// Encryption key in distribution
SONATA_GAP_KDIST_ENCKEY = (1 << 0),
/// IRK (ID key)in distribution
// IRK (ID key)in distribution
SONATA_GAP_KDIST_IDKEY = (1 << 1),
/// CSRK(Signature key) in distribution
// CSRK(Signature key) in distribution
SONATA_GAP_KDIST_SIGNKEY = (1 << 2),
/// LTK in distribution
// LTK in distribution
SONATA_GAP_KDIST_LINKKEY = (1 << 3),
SONATA_GAP_KDIST_LAST = (1 << 4)
};
/// Security Defines
// Security Defines
enum sonata_gap_sec_req {
/// No security (no authentication and encryption)
// No security (no authentication and encryption)
SONATA_GAP_NO_SEC = 0x00,
/// Unauthenticated pairing with encryption
// Unauthenticated pairing with encryption
SONATA_GAP_SEC1_NOAUTH_PAIR_ENC,
/// Authenticated pairing with encryption
// Authenticated pairing with encryption
SONATA_GAP_SEC1_AUTH_PAIR_ENC,
/// Unauthenticated pairing with data signing
// Unauthenticated pairing with data signing
SONATA_GAP_SEC2_NOAUTH_DATA_SGN,
/// Authentication pairing with data signing
// Authentication pairing with data signing
SONATA_GAP_SEC2_AUTH_DATA_SGN,
/// Secure Connection pairing with encryption
// Secure Connection pairing with encryption
SONATA_GAP_SEC1_SEC_CON_PAIR_ENC,
};
/// Bit field use to select the preferred TX or RX LE PHY. 0 means no preferences
// Bit field use to select the preferred TX or RX LE PHY. 0 means no preferences
enum sonata_gap_phy {
/// No preferred PHY
// No preferred PHY
SONATA_GAP_PHY_ANY = 0x00,
/// LE 1M PHY preferred for an active link
// LE 1M PHY preferred for an active link
SONATA_GAP_PHY_LE_1MBPS = (1 << 0),
/// LE 2M PHY preferred for an active link
// LE 2M PHY preferred for an active link
SONATA_GAP_PHY_LE_2MBPS = (1 << 1),
/// LE Coded PHY preferred for an active link
// LE Coded PHY preferred for an active link
SONATA_GAP_PHY_LE_CODED = (1 << 2),
};
/// Enumeration of TX/RX PHY values
// Enumeration of TX/RX PHY values
enum sonata_gap_phy_val {
/// LE 1M PHY (TX or RX)
// LE 1M PHY (TX or RX)
SONATA_GAP_PHY_1MBPS = 1,
/// LE 2M PHY (TX or RX)
// LE 2M PHY (TX or RX)
SONATA_GAP_PHY_2MBPS = 2,
/// LE Coded PHY (RX Only)
// LE Coded PHY (RX Only)
SONATA_GAP_PHY_CODED = 3,
/// LE Coded PHY with S=8 data coding (TX Only)
// LE Coded PHY with S=8 data coding (TX Only)
SONATA_GAP_PHY_125KBPS = 3,
/// LE Coded PHY with S=2 data coding (TX Only)
// LE Coded PHY with S=2 data coding (TX Only)
SONATA_GAP_PHY_500KBPS = 4,
};
/// Modulation index
enum sonata_gap_modulation_idx { /// Assume transmitter will have a standard modulation index
// Modulation index
enum sonata_gap_modulation_idx { // Assume transmitter will have a standard modulation index
SONATA_GAP_MODULATION_STANDARD,
/// Assume transmitter will have a stable modulation index
// Assume transmitter will have a stable modulation index
SONATA_GAP_MODULATION_STABLE,
};
/// Packet Payload type for test mode
enum sonata_gap_pkt_pld_type { /// PRBS9 sequence "11111111100000111101..." (in transmission order)
// Packet Payload type for test mode
enum sonata_gap_pkt_pld_type { // PRBS9 sequence "11111111100000111101..." (in transmission order)
SONATA_GAP_PKT_PLD_PRBS9,
/// Repeated "11110000" (in transmission order)
// Repeated "11110000" (in transmission order)
SONATA_GAP_PKT_PLD_REPEATED_11110000,
/// Repeated "10101010" (in transmission order)
// Repeated "10101010" (in transmission order)
SONATA_GAP_PKT_PLD_REPEATED_10101010,
/// PRBS15 sequence
// PRBS15 sequence
SONATA_GAP_PKT_PLD_PRBS15,
/// Repeated "11111111" (in transmission order) sequence
// Repeated "11111111" (in transmission order) sequence
SONATA_GAP_PKT_PLD_REPEATED_11111111,
/// Repeated "00000000" (in transmission order) sequence
// Repeated "00000000" (in transmission order) sequence
SONATA_GAP_PKT_PLD_REPEATED_00000000,
/// Repeated "00001111" (in transmission order) sequence
// Repeated "00001111" (in transmission order) sequence
SONATA_GAP_PKT_PLD_REPEATED_00001111,
/// Repeated "01010101" (in transmission order) sequence
// Repeated "01010101" (in transmission order) sequence
SONATA_GAP_PKT_PLD_REPEATED_01010101,
};
/*************** GAP Structures ********************/
/// Device name
// Device name
/*@TRACE*/
struct sonata_gap_dev_name {
/// name length
// name length
uint16_t length;
/// name value
// name value
uint8_t value[__ARRAY_EMPTY];
};
/// Slave preferred connection parameters
// Slave preferred connection parameters
/*@TRACE*/
struct sonata_gap_slv_pref {
/// Connection interval minimum
// Connection interval minimum
uint16_t con_intv_min;
/// Connection interval maximum
// Connection interval maximum
uint16_t con_intv_max;
/// Slave latency
// Slave latency
uint16_t slave_latency;
/// Connection supervision timeout multiplier
// Connection supervision timeout multiplier
uint16_t conn_timeout;
};
@@ -556,7 +549,6 @@ typedef struct {
uint8_t map[SONATA_GAP_LE_CHNL_MAP_LEN];
} sonata_le_chnl_map_t;
///Random number structure
/*@TRACE*/
typedef struct {
@@ -564,47 +556,45 @@ typedef struct {
uint8_t nb[SONATA_GAP_RAND_NB_LEN];
} sonata_rand_nb_t;
/// Address information about a device address
// Address information about a device address
/*@TRACE*/
struct sonata_gap_bdaddr {
/// BD Address of device
// BD Address of device
sonata_bd_addr_t addr;
/// Address type of the device 0=public/1=private random
// Address type of the device 0=public/1=private random
uint8_t addr_type;
};
/// Resolving list device information
// Resolving list device information
/*@TRACE*/
struct sonata_gap_ral_dev_info {
/// Device identity
// Device identity
struct sonata_gap_bdaddr addr;
/// Privacy Mode
// Privacy Mode
uint8_t priv_mode;
/// Peer IRK
// Peer IRK
uint8_t peer_irk[SONATA_GAP_KEY_LEN];
/// Local IRK
// Local IRK
uint8_t local_irk[SONATA_GAP_KEY_LEN];
};
/// Generic Security key structure
// Generic Security key structure
/*@TRACE*/
struct sonata_gap_sec_key {
/// Key value MSB -> LSB
// Key value MSB -> LSB
uint8_t key[SONATA_GAP_KEY_LEN];
};
/// I/Q sample
// I/Q sample
/*@TRACE*/
struct sonata_gap_iq_sample {
/// I sample
// I sample
int8_t i;
/// Q sample
// Q sample
int8_t q;
};
typedef uint16_t (*sonata_gap_check_pkt_type_t )(uint8_t pkt_type);
/// @} GAP
// @} GAP
#endif // SONATA_SONATA_GAP_H_
@@ -23,12 +23,9 @@
****************************************************************************************
*/
#ifndef _SONATA_GAP_API_H_
#define _SONATA_GAP_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -54,8 +51,6 @@
/// Maximum Encryption Key size
#define SONATA_GAP_SMP_MAX_ENC_SIZE_LEN (16)
/// GAP Manager operation type - application interface
typedef enum {
/* No Operation (if nothing has been requested) */
@@ -252,11 +247,6 @@ typedef enum {
SONATA_GET_DEV_RF_PATH_COMP = 0xAF,
} sonata_gap_local_dev_info;
/// List of device info that should be provided by application,peer device can get it
typedef enum {
/// Device Name
@@ -271,7 +261,6 @@ typedef enum {
SONATA_GAP_DEV_INFO_MAX,
} sonata_gap_dev_info;
///// Option for PHY configuration
typedef enum {
/// No preference for rate used when transmitting on the LE Coded PHY
@@ -413,7 +402,6 @@ typedef enum {
SONATA_GAP_PRIV_CFG_PRIV_EN_BIT = (1 << 2),
} sonata_gap_priv_cfg;
/// Scanning properties bit field bit value
typedef enum {
/// Scan advertisement on the LE 1M PHY
@@ -452,8 +440,6 @@ typedef enum {
SONATA_GAP_PER_SYNC_TYPE_PAST,
} sonata_gap_per_sync_type;
/// Initiating Types
typedef enum {
/// Direct connection establishment, establish a connection with an indicated device
@@ -476,7 +462,6 @@ typedef enum {
SONATA_GAP_INIT_PROP_CODED_BIT = (1 << 2),
} sonata_gap_init_prop;
/// Advertising report information
typedef enum {
/// Report Type
@@ -612,7 +597,6 @@ typedef enum {
SONATA_PRF_ID_AM0 = 240, /**< BLE Audio Mode 0 Task */
SONATA_PRF_ID_AM0_HAS = 241, /**< BLE Audio Mode 0 Hearing Aid Service Task */
SONATA_PRF_ID_THPP = 242, /**< Throughput profile tester used for debugging */
} sonata_ble_profile_id;
@@ -749,7 +733,6 @@ typedef enum {
SONATA_GAP_KEY_NTF_ENTRY_COMPLETED
} sonata_gap_key_ntf_type;
/// Constant Tone Extension type
typedef enum {
/// Allow AoA Constant Tone Extension Response
@@ -868,9 +851,6 @@ typedef struct sonata_gap_peer_version_ind {
} sonata_gap_peer_version_ind_t;
/// Indication of peer features info
/*@TRACE*/
typedef struct sonata_gap_peer_features_ind {
/// 8-byte array for LE features
@@ -907,7 +887,6 @@ typedef struct sonata_gap_le_phy_ind {
uint8_t rx_phy;
} sonata_gap_le_phy_ind_t;
/// Parameters of the @ref SONATA_GAP_CHAN_SEL_ALGO_IND
/*@TRACE*/
typedef struct sonata_gap_chan_sel_algo_ind {
@@ -991,19 +970,16 @@ typedef struct {
// ///
// /// LE Audio Mode Configuration (@see sonata_gap_audio_cfg_flag)
// /// ------------------ LE PHY Management -------------------------
// /// Preferred LE PHY for data transmission (@see enum gap_phy)
// /// Preferred LE PHY for data reception (@see enum gap_phy)
// /// ------------------ Miscellaneous 2 ----------------------------
// /// RF TX Path Compensation value (from -128dB to 128dB, unit is 0.1dB)
// /// RF RX Path Compensation value (from -128dB to 128dB, unit is 0.1dB)
///------------------ Miscellaneou 3 -----------------------------
bool hl_trans_dbg;
///<host layer transport debug
@@ -1012,8 +988,6 @@ typedef struct {
///<pinmux: rxcore->pad12 txcore->pad17
} sonata_gap_set_dev_config_cmd;
/// create directed advertising
typedef struct sonata_gap_directed_adv_create_param {
// /// Advertising type (@see enum sonata_gap_adv_type)
@@ -1375,8 +1349,6 @@ typedef struct sonata_gap_bond_ind {
union sonata_gap_bond_data data;
} sonata_gap_bond_ind_t;
/// List Size indication event
typedef struct sonata_gap_list_size_ind {
/// Operation code, indicate list for which size has been read
@@ -1388,7 +1360,6 @@ typedef struct sonata_gap_list_size_ind {
uint8_t size;
} sonata_gap_list_size_ind_t;
/// Indicates suggested default data length
typedef struct sonata_gap_sugg_dflt_data_len_ind {
///Host's suggested value for the Controller's maximum transmitted number of payload octets
@@ -1397,9 +1368,6 @@ typedef struct sonata_gap_sugg_dflt_data_len_ind {
uint16_t suggted_max_tx_time;
} sonata_gap_sugg_dflt_data_len_ind_t;
/// Indicates maximum data length
typedef struct sonata_gap_max_data_len_ind {
///Maximum number of payload octets that the local Controller supports for transmission
@@ -1412,23 +1380,18 @@ typedef struct sonata_gap_max_data_len_ind {
uint16_t suppted_max_rx_time;
} sonata_gap_max_data_len_ind_t;
/// Number of available advertising sets indication event
typedef struct sonata_gap_nb_adv_sets_ind {
/// Number of available advertising sets
uint8_t nb_adv_sets;
} sonata_gap_nb_adv_sets_ind_t;
/// Maximum advertising data length indication event
typedef struct sonata_gap_max_adv_data_len_ind {
/// Maximum advertising data length supported by controller
uint16_t length;
} sonata_gap_max_adv_data_len_ind_t;
/// Indicate the transmit powers supported by the controller
typedef struct sonata_gap_dev_tx_pwr_ind {
/// Minimum TX power
@@ -1437,7 +1400,6 @@ typedef struct sonata_gap_dev_tx_pwr_ind {
int8_t max_tx_pwr;
} sonata_gap_dev_tx_pwr_ind_t;
/// Indicate the RF path compensation values
typedef struct sonata_gap_dev_rf_path_comp_ind {
/// RF TX path compensation
@@ -1446,7 +1408,6 @@ typedef struct sonata_gap_dev_rf_path_comp_ind {
uint16_t rx_path_comp;
} sonata_gap_dev_rf_path_comp_ind_t;
/// Pairing parameters
typedef struct sonata_gap_pairing {
/// IO capabilities (@see gap_io_cap)
@@ -1468,9 +1429,6 @@ typedef struct sonata_gap_pairing {
uint8_t sec_req;
} sonata_gap_pairing_t;
/// Set specific link data configuration.
typedef struct sonata_gap_connection_cfm {
/// Local CSRK value
@@ -1497,7 +1455,6 @@ typedef struct sonata_gap_connection_cfm {
uint16_t svc_chg_handle;
} sonata_gap_connection_cfm_t;
/// Indicate reception of a IQ Report event over a BLE connection
/*@TRACE*/
typedef struct sonata_gap_cte_iq_report_ind {
@@ -1523,7 +1480,6 @@ typedef struct sonata_gap_cte_iq_report_ind {
struct sonata_gap_iq_sample sample[__ARRAY_EMPTY];
} sonata_gap_cte_iq_report_ind_t;
/// Provide statistic information about ISO exchange
typedef struct sonata_gap_iso_stat_ind {
/// ISO Handle of the isochronous channel (Range 0x0000-0x0EFF)
@@ -1610,7 +1566,6 @@ struct sonata_gap_bond_cfm {
typedef void (*PF_NOTIFY_MESH_PRF_READY)(void);
extern PF_NOTIFY_MESH_PRF_READY pf_notify_mesh_prf_ready;
/// Ble complete event type
typedef enum {
//Sonata event Sonata
@@ -1748,7 +1703,6 @@ typedef enum {
//System event GATTM
//System event GATTC
/// Discover all services
SONATA_GATT_CMP_DISC_ALL_SVC = 0x0402,
@@ -1805,7 +1759,6 @@ typedef struct {
void (*set_white_list_complete)(uint16_t status);
///@deprecated use @see ble_complete_callback
/// Callback for getting device version, BT address, advertising TX power, antenna inf.
uint16_t (*get_local_dev_info)(sonata_gap_local_dev_info info_type,
void *info);//gap_dev_version,gap_dev_bdaddr,gap_dev_adv_tx_power,gap_antenna_inf,gap_dbg_mem_info
@@ -1945,7 +1898,6 @@ typedef struct {
} ble_response_callback;
/*!
* @brief Turn on ble module
* @param param @see sonata_gap_set_dev_config_cmd
@@ -1953,7 +1905,6 @@ typedef struct {
*/
uint16_t sonata_ble_on(sonata_gap_set_dev_config_cmd *param);
/*!
* @brief Register GAP callback functions for ble module
* @param cb @see ble_gap_callback
@@ -1961,7 +1912,6 @@ uint16_t sonata_ble_on(sonata_gap_set_dev_config_cmd *param);
*/
uint16_t sonata_ble_register_gap_callback(ble_gap_callback *cb);
/*!
* @brief Register ble complete event callback functions
* @param cb @see ble_complete_callback
@@ -2007,8 +1957,6 @@ uint16_t sonata_ble_config_scanning(uint8_t own_addr_type);
*/
uint16_t sonata_ble_config_initiating(uint8_t own_addr_type);
/*!
* @brief Set advertising data
* @param length: Data length
@@ -2017,7 +1965,6 @@ uint16_t sonata_ble_config_initiating(uint8_t own_addr_type);
*/
uint16_t sonata_ble_set_advertising_data(uint16_t length, uint8_t *data);
/*!
* @brief Set advertising data
* @param id The advertising id
@@ -2063,7 +2010,6 @@ uint16_t sonata_ble_start_advertising(uint16_t duration, uint8_t max_adv_evt); /
*/
uint16_t sonata_ble_start_advertising_byid(uint8_t id, uint16_t duration, uint8_t max_adv_evt);
/*!
* @brief Stop advertising
* @return API_SUCCESS
@@ -2173,7 +2119,6 @@ uint16_t sonata_ble_gap_send_set_dev_name_cfm(uint8_t conidx, uint8_t status);
*/
uint16_t sonata_ble_gap_send_get_dev_info_cfm_for_ctl_addr_resol(uint8_t conidx, uint8_t ctl_addr_resol);
/*!
* @brief Set white list
* @param size white list size
@@ -2231,7 +2176,6 @@ uint16_t sonata_ble_gap_send_bond_cfm_for_pairing_req(uint8_t conidx, struct son
enum sonata_gap_io_cap iocap, enum sonata_gap_oob_auth oob, enum sonata_gap_auth auth, uint8_t key_size,
enum sonata_gap_kdist ikey_dist, enum sonata_gap_kdist rkey_dist, enum sonata_gap_sec_req sec_req);
/*!
* @brief Send bond confirm message for ltk exchange
* @param conidx connecting index, used for multiple connection. for single connection, set it to 0.
@@ -2401,7 +2345,6 @@ uint16_t sonata_ble_gap_set_le_pkt_size(uint8_t conidx, uint16_t tx_octets, uint
*/
uint16_t sonata_ble_gap_send_param_update_cfm(uint8_t conidx, bool accept, uint16_t ce_len_min, uint16_t ce_len_max);
/*
* FUNCTION DECLARATIONS Connection help function
****************************************************************************************
@@ -2427,11 +2370,9 @@ uint8_t *sonata_ble_get_peer_addr(uint8_t connection_id);
*/
uint16_t sonata_ble_gap_send_connection_cfm(uint8_t conidx, sonata_gap_connection_cfm_t *cfm);
///@hide
void sonata_ble_show_connection_info(void);
struct sonata_gap_bdaddr *sonata_ble_gap_get_bdaddr(uint8_t conidx, uint8_t src);
///@hide
@@ -23,12 +23,9 @@
****************************************************************************************
*/
#ifndef _SONATA_GATT_API_H_
#define _SONATA_GATT_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -85,7 +82,6 @@
#define PWC_NA (SONATA_PERM(WRITE_COMMAND, ENABLE) | SONATA_PERM(WP, NO_AUTH))
/*
* ENUM DEFINITIONS
****************************************************************************************
@@ -225,7 +221,6 @@ typedef struct sonata_gatt_att_desc {
*/
uint16_t perm;
/**
* Maximum length of the attribute
*
@@ -324,7 +319,6 @@ typedef struct {
/*************** GATT Manager ***************/
} ble_gatt_callback;
/*
* FUNCTION DECLARATIONS
****************************************************************************************
@@ -409,7 +403,6 @@ uint16_t sonata_ble_gatt_read_by_handle(uint8_t conidx, uint16_t handle_id);
*/
uint16_t sonata_ble_gatt_send_notify_event(uint8_t conidx, uint16_t handle, uint16_t length, uint8_t *value);
/*!
* @brief Send indicate event
* @param conidx connecting index, used for multiple connection. for single connection, set it to 0.
@@ -453,8 +446,6 @@ uint16_t sonata_ble_gatt_gatt_read_long(uint8_t conidx, uint16_t handle, uint16_
uint16_t sonata_ble_gatt_read_by_uuid(uint8_t conidx, uint16_t seq_num, uint16_t start_hdl, uint16_t end_hdl,
uint8_t uuid_len, uint8_t *uuid);
/*!
* @brief Gatt write
* @param conidx connecting index, used for multiple connection. for single connection, set it to 0.
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_LL_API_H_
#define _SONATA_LL_API_H_
@@ -39,33 +38,21 @@
* @{
*/
/*
* MACRO DEFINITIONS
****************************************************************************************
*/
/*
* ENUM DEFINITIONS
****************************************************************************************
*/
/*
* Type Definition
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
@@ -29,7 +29,7 @@
* INCLUDE FILES
****************************************************************************************
*/
#include <stdarg.h>
/*
* ENUM DEFINITIONS
@@ -57,7 +57,6 @@ typedef enum {
*/
#define LOG_LOCAL_LEVEL SONATA_LOG_VERBOSE
/*!
* @brief vprintf
*/
@@ -126,7 +125,6 @@ typedef int (*vprintf_like_t)(const char *, va_list);
#endif //CFG_SONATA_LOG
/*
* FUNCTION DEFINITIONS
****************************************************************************************
@@ -144,7 +142,6 @@ vprintf_like_t sonata_log_set_vprintf(vprintf_like_t func);
*/
void sonata_log_level_set(sonata_log_level level);
//Internal use
void sonata_logt_write(sonata_log_level level, const char *tag, const char *format, ...);
@@ -36,8 +36,7 @@
****************************************************************************************
*/
//#if (BLE_APP_BATT)
// #if (BLE_APP_BATT)
#include <stdint.h> // Standard Integer Definition
#include "sonata_ble_api.h"
@@ -47,8 +46,6 @@
****************************************************************************************
*/
/*
* Type Definition
****************************************************************************************
@@ -58,25 +55,25 @@
* @brief Callback for diss value
*/
typedef struct prf_bas_callback {
/// Callback for battery level request, if config==1, app should send battery level value use sonata_prf_bas_send_battery_level()
// Callback for battery level request, if config==1, app should send battery level value use sonata_prf_bas_send_battery_level()
uint16_t (*prf_bass_value_req)(uint8_t conidx, uint8_t config);
/// Callback for bass enabled
// Callback for bass enabled
uint16_t (*prf_bass_enable)(uint8_t conidx, uint8_t status);
/// Callback for battery level notifiyed
// Callback for battery level notifiyed
uint16_t (*prf_bass_level_updated)(uint8_t status);
} prf_bas_callback_t;
typedef enum {
/// Start the Battery Server - at connection used to restore bond data
// Start the Battery Server - at connection used to restore bond data
SONATA_PRF_BASS_ENABLE_REQ = SONATA_TASK_FIRST_MSG(SONATA_TASK_ID_BASS),
/// Confirmation of the Battery Server start
// Confirmation of the Battery Server start
SONATA_PRF_BASS_ENABLE_RSP,
/// Battery Level Value Update Request
// Battery Level Value Update Request
SONATA_PRF_BASS_BATT_LEVEL_UPD_REQ,
/// Inform APP if Battery Level value has been notified or not
// Inform APP if Battery Level value has been notified or not
SONATA_PRF_BASS_BATT_LEVEL_UPD_RSP,
/// Inform APP that Battery Level Notification Configuration has been changed - use to update bond data
// Inform APP that Battery Level Notification Configuration has been changed - use to update bond data
SONATA_PRF_BASS_BATT_LEVEL_NTF_CFG_IND,
} sonata_bass_msg_id;
@@ -85,7 +82,6 @@ typedef enum {
****************************************************************************************
*/
/*
* FUNCTIONS DECLARATION
****************************************************************************************
@@ -108,7 +104,6 @@ void sonata_prf_bas_add_bass(uint8_t bas_number, bool support_ntf);
*/
void sonata_prf_bas_enable_bass(uint8_t conidx, uint8_t batt_lvl);
/*!
* @brief Send a Battery level value
* @param batt_id For single battery, batt_id is 0
@@ -124,7 +119,7 @@ int sonata_prf_bas_send_battery_level(uint8_t batt_id, uint8_t batt_lvl);
*/
uint16_t sonata_prf_bas_register_callback(prf_bas_callback_t *cb);
//#endif //(BLE_APP_BATT)
// #endif //(BLE_APP_BATT)
/** @}*/
@@ -23,12 +23,9 @@
****************************************************************************************
*/
#ifndef _SONATA_PRF_DISS_API_H_
#define _SONATA_PRF_DISS_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -51,7 +48,6 @@
#define PRF_DISS_FEATURES (0x01FF)
/*
* ENUM DEFINITIONS
****************************************************************************************
@@ -23,12 +23,9 @@
****************************************************************************************
*/
#ifndef _SONATA_PRF_HOGPD_API_H_
#define _SONATA_PRF_HOGPD_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -75,7 +72,6 @@
#define HID_REPORT_ID_VENDOR_DEFINED_INDEX (4)
#define HID_REPORT_ID_MOUSE_INDEX (1)
#define HID_REPORT_ID_KEYBOARD (1)
#define HID_REPORT_ID_MOUSE (2)
#define HID_REPORT_ID_CONSUMER_CTRL (3)
@@ -342,7 +338,6 @@ typedef enum {
MOTION_ADC = 'A',
} sonata_mouse_motion;
/// Report Char. Configuration Flag Values //Report's read and write property
typedef enum {
/// Input Report
@@ -382,7 +377,6 @@ typedef enum {
SONATA_HOGPD_OP_PROT_UPDATE,
} sonata_hogpd_op;
/// Messages for HID Over GATT Profile Device Role
/*@TRACE*/
enum sonata_hogpd_msg_id {
@@ -396,7 +390,6 @@ enum sonata_hogpd_msg_id {
/// Response sending of a report to the host
SONATA_HOGPD_REPORT_UPD_RSP,
/// Request from peer device to Read or update a report value
SONATA_HOGPD_REPORT_REQ_IND,
/// Confirmation for peer device for Reading or Updating a report value
@@ -434,7 +427,6 @@ typedef enum {
DIR_BROADCAST_ALREADY_SEND,
} directed_broadcast_state;
/// HID Information bit values
typedef enum {
/// Device capable of providing wake-up signal to a HID host
@@ -448,9 +440,6 @@ typedef enum {
****************************************************************************************
*/
/// External Report Reference
typedef struct sonata_hogpd_ext_ref {
/// External Report Reference - Included Service
@@ -494,7 +483,6 @@ typedef struct sonata_hogpd_db_cfg {
struct sonata_hogpd_hids_cfg cfg[SONATA_HOGPD_NB_HIDS_INST_MAX];
} sonata_hogpd_db_cfg_t;
/*!
* @brief Callback for hogpd value
*/
@@ -508,9 +496,6 @@ typedef struct {
uint16_t (*hogpd_ntf_config)(uint8_t conidx, uint8_t ntf_len, uint16_t *ntf_cfg);
} prf_hogpd_callback;
/**
* Botton definition
* --------------------------------------------------------------------------
@@ -524,7 +509,6 @@ typedef struct ps_mouse_report {
int16_t repY; //y-quaddec of the mouse
} ps_mouse_report_t;
/*!
* @brief sonata_get_connection_state
* @param
@@ -557,7 +541,6 @@ int sonata_prf_hogp_send_report_update_request(uint8_t conidx, uint8_t hid_idx,
*/
int sonata_prf_hogp_send_protocol_mode_confirm(uint8_t conidx, uint8_t hid_idx, uint8_t status, uint8_t proto_mode);
/*!
* @brief send report map confirm
* @param hid_idx index of hid, for single HID, set it to 0
@@ -605,7 +588,6 @@ void sonata_prf_hogp_mouse_data_send_report(ps_mouse_report_t report_buff);
*/
void sonata_prf_hogp_send_report_update_request_for_mouse(uint8_t report_idx, ps_mouse_report_t report);
/*!
* @brief sonata_prf_hogp_send_report_update_request_for_keyboard
* @param ps_keyboard_report_t
@@ -614,7 +596,6 @@ void sonata_prf_hogp_send_report_update_request_for_mouse(uint8_t report_idx, ps
void sonata_prf_hogp_send_report_update_request_for_keyboard(uint8_t report_idx, uint8_t *ps_keyboard_report_t,
uint8_t report_len);
/*!
* @brief app_start_hid_keyboard
* @param cb
@@ -622,7 +603,6 @@ void sonata_prf_hogp_send_report_update_request_for_keyboard(uint8_t report_idx,
*/
uint16_t sonata_prf_hogpd_register_callback(prf_hogpd_callback *cb);
/*!
* @brief sonata_prf_hogpd_boot_mouse_input_report
* @param conidx
@@ -23,12 +23,9 @@
****************************************************************************************
*/
#ifndef _SONATA_PRF_HOGPRH_API_H_
#define _SONATA_PRF_HOGPRH_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -50,7 +47,6 @@
****************************************************************************************
*/
/*
* Type Definition
****************************************************************************************
@@ -139,7 +135,6 @@ typedef struct sonata_hogprh_read_info_req {
uint8_t report_idx;
} sonata_hogprh_read_info_req_t;
/// HID Information structure
struct sonata_hids_hid_info {
/// bcdHID
@@ -217,7 +212,6 @@ union sonata_hogprh_data {
struct sonata_hogprh_report_map_ref report_map_ref;
};
///Parameters of the @ref HOGPRH_WRITE_REQ message
typedef struct sonata_hogprh_write_req {
///Characteristic info @see enum hogprh_info
@@ -25,7 +25,6 @@
#ifndef SONATA_PRF_OTAS_API_H_
#define SONATA_PRF_OTAS_API_H_
/*
* INCLUDE FILES
****************************************************************************************
@@ -95,7 +94,6 @@ void sonata_prf_otas_init(void);
*/
void sonata_prf_otas_add_otas(void);
void sonata_prf_otas_disable(bool disable);
/**
****************************************************************************************
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_SEC_API_H_
#define _SONATA_SEC_API_H_
@@ -33,17 +32,11 @@
*/
#include "sonata_utils_api.h"
/*
* MACRO DEFINITIONS
****************************************************************************************
*/
/*
* ENUM DEFINITIONS
****************************************************************************************
@@ -88,9 +81,6 @@ typedef enum {
/** authentication requirements **/
/*
* Type Definition
****************************************************************************************
@@ -100,28 +90,22 @@ typedef struct sonata_sec_api_cb {
struct sonata_sec_api_cb *_next;
} sonata_sec_api_cb_t;
typedef struct sonata_public_key {
uint8_t pub_key_x[32];
uint8_t pub_key_y[32];
} sonata_public_key_t;
typedef void (* sonata_sec_public_key_gen_complete)(sonata_public_key_t *pub_key, uint16_t status) ;
typedef void (*sonata_sec_ecdh_secret_complete) (const uint8_t *p_ecdh_secret, uint16_t status);
typedef void (*sonata_sec_ecdh_session_key_complete) (const uint8_t *p_ecdh_session, uint16_t status);
/*
* GLOBAL VARIABLES DECLARATIONS
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
****************************************************************************************
@@ -129,7 +113,6 @@ typedef void (*sonata_sec_ecdh_session_key_complete) (const uint8_t *p_ecdh_sess
extern void sonata_sec_api_init(void);
extern void sonata_sec_api_cb_register(sonata_sec_api_cb_t *cb);
void sonata_genc_DH_key(uint8_t *secret_key, uint8_t *public_key_x, uint8_t *public_key_y,
sonata_sec_ecdh_secret_complete callback);
@@ -139,6 +122,5 @@ void sonata_genc_secret_key(uint8_t *secret_key256);
void sonata_genc_session_key(uint8_t *secret_key, uint8_t *skd, sonata_sec_ecdh_session_key_complete callback);
#endif //_SONATA_SEC_API_H_
@@ -21,7 +21,6 @@
*/
#include "sonata_stack_user_config.h"
/*
* DEFINES
****************************************************************************************
@@ -16,7 +16,6 @@
#ifndef SONATA_STACK_FIXED_CONFIG_H_
#define SONATA_STACK_FIXED_CONFIG_H_
/*
* DEFINES
****************************************************************************************
@@ -23,7 +23,6 @@
****************************************************************************************
*/
#ifndef _SONATA_UTILS_API_H_
#define _SONATA_UTILS_API_H_
@@ -48,7 +47,6 @@
/// maxium supported messages from application
#define SONATA_API_MAX_APP_MSG 32
/// debug trace
#ifdef SONATA_UTILS_API_DBG
#define SONATA_UTILS_API_TRC printf
@@ -75,7 +73,6 @@
****************************************************************************************
*/
/*!
* @brief app msg operation type
*/
@@ -123,8 +120,6 @@ typedef enum {
SONATA_MAC_USE_NVDS,
} SONATA_MAC_PRIORITY;
/*
* Type Definition
****************************************************************************************
@@ -166,7 +161,6 @@ typedef struct {
*/
typedef void (*aes_func_result_cb) (uint8_t status, const uint8_t *aes_res, uint32_t src_info);
/*
* FUNCTION DECLARATIONS
****************************************************************************************
@@ -203,7 +197,6 @@ void sonata_api_util_gap_status_print(uint8_t status);
///@hide
void sonata_api_util_gatt_status_print(uint8_t operation, uint8_t status);
/**
***************************************************************************************
* @brief asr api create timer
@@ -305,7 +298,6 @@ uint8_t sonata_fs_erase(sonata_fs_tag_t tag);
*/
uint8_t *sonata_get_bt_address(void);
/**
***************************************************************************************
* @brief sonata set bd addr
@@ -392,7 +384,6 @@ bool sonata_get_adv_report_info(uint8_t type, uint8_t *info, uint16_t info_lengt
*/
uint32_t sonata_get_sys_time(void);
/*!
* @brief Reset BLE stack
* @return
@@ -417,11 +408,6 @@ const char *sonata_get_rom_version(void);
*/
void sonata_ble_register_bt_addr_callback(ble_addr_callback_t *cb);
extern int rand (void);
__INLINE uint8_t util_rand_byte(void)
@@ -462,9 +448,6 @@ __INLINE uint32_t util_read32p(void const *ptr32)
void sonata_platform_reset(void);
/** @}*/
#endif //_SONATA_UTILS_API_H_
+34 -98
View File
@@ -77,7 +77,6 @@
#define APP_BLE_INVALID_ADVIDX 0xFF
#define APP_MAX_SERVICE_NUM 5
typedef struct ble_gatt_att_reg_list {
uint16_t start_hdl;
uint8_t nb_att;
@@ -94,7 +93,6 @@ typedef struct ble_gatt_att_manager {
ble_gatt_att_reg_list_t *reg_list[MAX_SERVICE_NUM];
} ble_gatt_att_manager_t;
/*!
* @brief save local handle start index
*/
@@ -116,10 +114,9 @@ static bool app_adv_bonding = false;
static uint8_t app_connection_state = 0;
static peer_conn_param_t app_peer_conn_param = {0};
static bool app_bond = false;
static uint8_t app_loc_irk[KEY_LEN] = {0}; //Get in app_gap_gen_random_number_callback()
//static uint8_t app_loc_irk[KEY_LEN]= {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15,0x16};//Get in app_gap_gen_random_number_callback()
//static uint8_t app_loc_irk[KEY_LEN]= {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x10,0x11,0x12,0x13,0x14,0x15,0x16}; // Get in app_gap_gen_random_number_callback()
static uint8_t app_rand_cnt = 0;
static uint32_t app_passkey_pincode = 0;
@@ -177,27 +174,27 @@ void print_serv_env(void)
* @brief
*/
typedef enum {
/// Peripheral Bonded
// Peripheral Bonded
SONATA_TAG_PERIPH_BONDED = (APP_DATA_SAVE_TAG_FIRST + 0),
/// Mouse NTF Cfg
// Mouse NTF Cfg
SONATA_TAG_MOUSE_NTF_CFG,
/// Mouse Timeout value
// Mouse Timeout value
SONATA_TAG_MOUSE_TIMEOUT,
/// Peer Device BD Address
// Peer Device BD Address
SONATA_TAG_PEER_BD_ADDRESS,
/// EDIV (2bytes), RAND NB (8bytes), LTK (16 bytes), Key Size (1 byte)
// EDIV (2bytes), RAND NB (8bytes), LTK (16 bytes), Key Size (1 byte)
SONATA_TAG_LTK,
/// app_ltk_key_in
// app_ltk_key_in
SONATA_TAG_LTK_IN,
/// app irk addr
// app irk addr
SONATA_TAG_IRK_ADDR,
/// app irk
// app irk
SONATA_TAG_IRK,
/// device address
// device address
SONATA_TAG_BD_ADDRESS,
/// bonded dev info
// bonded dev info
SONATA_TAG_BONDED_DEV_INFO,
/// start pair on boot
// start pair on boot
SONATA_TAG_PAIR_ON_BOOT,
} sonata_app_nvds_tag;
@@ -205,31 +202,30 @@ typedef enum {
* @brief
*/
typedef enum {
/// Peripheral Bonded len
// Peripheral Bonded len
SONATA_LEN_PERIPH_BONDED = 1,
/// Mouse NTF Cfg len
// Mouse NTF Cfg len
SONATA_LEN_MOUSE_NTF_CFG = 2,
/// Mouse Timeout value len
// Mouse Timeout value len
SONATA_LEN_MOUSE_TIMEOUT = 2,
/// Peer Device BD Address len
// Peer Device BD Address len
SONATA_LEN_PEER_BD_ADDRESS = 6,
/// EDIV (2bytes), RAND NB (8bytes), LTK (16 bytes), Key Size (1 byte)
// EDIV (2bytes), RAND NB (8bytes), LTK (16 bytes), Key Size (1 byte)
SONATA_LEN_LTK = 27,
/// app_ltk_key_in len
// app_ltk_key_in len
SONATA_LEN_LTK_IN = 16,
/// app irk addr len
// app irk addr len
SONATA_LEN_IRK_ADDR = 6,
/// app irk len
// app irk len
SONATA_LEN_IRK = 16,
/// device address
// device address
SONATA_LEN_BD_ADDRESS = 6,
/// bonded dev info len
// bonded dev info len
SONATA_LEN_BONDED_DEV_INFO = 218, //218: 3, 290:4,
/// start pair on boot
// start pair on boot
SONATA_LEN_PAIR_ON_BOOT = 1,
} sonata_app_nvds_len;
/*!
* @brief
*/
@@ -255,7 +251,6 @@ static sonata_app_timer_callback_t app_timer_callbacks = {
.timeout = app_timer_handler,
};
static void app_print_hex(uint8_t *hex, uint8_t len )
{
for (int i = 0; i < len; i++) {
@@ -264,7 +259,6 @@ static void app_print_hex(uint8_t *hex, uint8_t len )
APP_TRC("\r\n");
}
void app_data_init(void)
{
memset(connect_req_list, 0xff, sizeof(connect_req_list));
@@ -305,7 +299,6 @@ static uint8_t app_get_conidx_by_addr(uint8_t *addr)
return APP_BLE_INVALID_CONIDX;
}
static uint8_t *app_get_addr_by_conidx(uint8_t conidx)
{
for (int idx = 0; idx < APP_BLE_CONNECT_MAX; idx++) {
@@ -326,7 +319,6 @@ void app_ble_set_device_name(uint8_t *name, uint32_t len)
memmove(local_dev_name, name, len);
}
/*
uint8_t app_adv_idx_list_alloc(void)
{
@@ -392,28 +384,25 @@ void app_ble_config_legacy_advertising(void)
param.phy = SONATA_GAP_PHY_LE_1MBPS;
ble_adv_state = BLE_ADV_STATE_CREATING;
uint16_t ret = sonata_ble_config_legacy_advertising(SONATA_GAP_STATIC_ADDR,
&param);//Next event:SONATA_GAP_CMP_ADVERTISING_CONFIG
&param); // Next event:SONATA_GAP_CMP_ADVERTISING_CONFIG
if (ret != API_SUCCESS) {
APP_TRC("APP: %s ERROR:%02X\r\n", __FUNCTION__, ret);
ble_adv_state = BLE_ADV_STATE_IDLE;
}
}
void app_ble_config_legacy_advertising_with_param(uint8_t own_addr_type, sonata_gap_directed_adv_create_param_t *param)
{
APP_TRC("APP: %s \r\n", __FUNCTION__);
ble_adv_state = BLE_ADV_STATE_CREATING;
uint16_t ret = sonata_ble_config_legacy_advertising(own_addr_type, param);//Next event:SONATA_GAP_CMP_ADVERTISING_CONFIG
uint16_t ret = sonata_ble_config_legacy_advertising(own_addr_type, param); // Next event:SONATA_GAP_CMP_ADVERTISING_CONFIG
if (ret != API_SUCCESS) {
APP_TRC("APP: %s ERROR:%02X\r\n", __FUNCTION__, ret);
ble_adv_state = BLE_ADV_STATE_IDLE;
}
}
void app_ble_start_advertising_with_param(sonata_gap_directed_adv_create_param_t *param, ble_adv_data_set_t *data,
ble_scan_data_set_t *scan_data, uint8_t own_addr_type, uint16_t duration, uint8_t max_adv_evt)
{
@@ -447,7 +436,6 @@ void app_ble_start_advertising_with_param(sonata_gap_directed_adv_create_param_t
}
/*!
* @brief set advertising data
*/
@@ -487,7 +475,6 @@ void app_ble_set_adv_data_default(void)
}
}
static uint16_t app_ble_set_scansponse_data(uint8_t adv_id)
{
APP_TRC("APP: %s \r\n", __FUNCTION__);
@@ -560,7 +547,6 @@ uint16_t app_ble_advertising_stop(uint8_t adv_id)
return ret;
}
uint16_t app_ble_stop_adv(uint8_t adv_id)
{
APP_TRC("APP: %s dv state %d \r\n", __FUNCTION__, ble_adv_state);
@@ -577,13 +563,11 @@ uint16_t app_ble_stop_adv(uint8_t adv_id)
return ret;
}
uint16_t app_ble_stop_adv_without_id(void)
{
return app_ble_stop_adv(current_adv_id);
}
int app_ble_advertising_start(uint8_t *adv_id, ble_adv_data_set_t *data, ble_scan_data_set_t *scan_data)
{
@@ -591,11 +575,9 @@ int app_ble_advertising_start(uint8_t *adv_id, ble_adv_data_set_t *data, ble_sca
app_ble_adv_data.advdataLen = data->advdataLen;
app_ble_scan_data.respdataLen = scan_data->respdataLen;
memmove((void *)app_ble_adv_data.advdata, (void *)data->advdata, data->advdataLen);
memmove((void *)app_ble_scan_data.respdata, (void *)scan_data->respdata, scan_data->respdataLen);
ble_adv_set_state = APP_BLE_ADV_ON;
if ((ble_adv_state != BLE_ADV_STATE_IDLE) &&
@@ -628,7 +610,6 @@ void app_ble_config_scanning(void)
}
}
/*!
* @brief Start scanning
*/
@@ -641,7 +622,7 @@ void app_ble_start_scanning(void)
// For continuous scan, use OBSERVER type, use duration to control scan timeer.
// if duration=0, will scan for ever until sonata_ble_stop_scanning() called
//param.type = SONATA_GAP_SCAN_TYPE_OBSERVER;
param.prop = SONATA_GAP_SCAN_PROP_ACTIVE_1M_BIT | SONATA_GAP_SCAN_PROP_PHY_1M_BIT;//0x05
param.prop = SONATA_GAP_SCAN_PROP_ACTIVE_1M_BIT | SONATA_GAP_SCAN_PROP_PHY_1M_BIT; // 0x05
param.dup_filt_pol = SONATA_GAP_DUP_FILT_EN;
param.scan_param_1m.scan_intv = 0x0140;
param.scan_param_1m.scan_wd = 0x00A0;
@@ -657,13 +638,11 @@ void app_ble_start_scanning(void)
}
void app_ble_stop_scanning(void)
{
sonata_ble_stop_scanning();
}
/*!
* @brief config initiating
*/
@@ -695,7 +674,6 @@ static bool app_ble_check_address(uint8_t *address)
return true;
}
/*!
* @brief Start initiating
*/
@@ -822,7 +800,7 @@ static void app_ble_on(void)
APP_TRC("APP: %s not bonded device info \r\n", __FUNCTION__);
}
uint16_t ret = sonata_ble_on(&cmd);//Next event:SONATA_GAP_CMP_BLE_ON
uint16_t ret = sonata_ble_on(&cmd); // Next event:SONATA_GAP_CMP_BLE_ON
if (ret != API_SUCCESS) {
APP_TRC("APP: %s ERROR:%02X\r\n", __FUNCTION__, ret);
}
@@ -1052,7 +1030,6 @@ static uint16_t app_ble_complete_event_handler(sonata_ble_complete_type opt_id,
return cb_result;
}
static void app_ble_gatt_add_srv_rsp_hand(uint16_t handle)
{
APP_TRC("app_ble_gatt_add_srv_rsp_hand\r\n");
@@ -1081,7 +1058,6 @@ static void app_ble_gatt_add_srv_rsp_hand(uint16_t handle)
}
}
static uint16_t app_ble_rsp_event_handler(uint16_t opt_id, uint8_t status, uint16_t handle, uint16_t perm,
uint16_t ext_perm, uint16_t length, void *param)
{
@@ -1103,7 +1079,6 @@ static uint16_t app_ble_rsp_event_handler(uint16_t opt_id, uint8_t status, uint1
return CB_DONE;
}
/*!
* @brief get devcie informations
* @param info_type @see sonata_gap_local_dev_info
@@ -1124,7 +1099,7 @@ static uint16_t app_get_dev_info_callback(sonata_gap_local_dev_info info_type, v
APP_TRC("APP_CB: %s, manuf_name =0x%04X\r\n", __FUNCTION__, dev_info->manuf_name);
#endif //SONATA_API_TASK_DBG
}
break;
break;
case SONATA_GET_DEV_BDADDR: {
#if APP_DBG
sonata_gap_dev_bdaddr_ind_t *param = (sonata_gap_dev_bdaddr_ind_t *) info;
@@ -1135,7 +1110,7 @@ static uint16_t app_get_dev_info_callback(sonata_gap_local_dev_info info_type, v
APP_TRC("\r\n");
#endif //SONATA_API_TASK_DBG
}
break;
break;
case SONATA_GET_DEV_ADV_TX_POWER: {
#if APP_DBG
@@ -1143,7 +1118,7 @@ static uint16_t app_get_dev_info_callback(sonata_gap_local_dev_info info_type, v
APP_TRC("APP_CB: %s, SONATA_GET_DEV_ADV_TX_POWER power_lvl =0x%02X\r\n", __FUNCTION__, param->power_lvl);
#endif //SONATA_API_TASK_DBG
}
break;
break;
case SONATA_GET_WLIST_SIZE: {
#if APP_DBG
sonata_gap_list_size_ind_t *param = (sonata_gap_list_size_ind_t *) info;
@@ -1159,7 +1134,7 @@ static uint16_t app_get_dev_info_callback(sonata_gap_local_dev_info info_type, v
param->supp_switching_sampl_rates, param->antennae_num, param->max_switching_pattern_len, param->max_cte_len);
#endif //SONATA_API_TASK_DBG
}
break;
break;
case SONATA_GET_SUGGESTED_DFLT_LE_DATA_LEN: {
#if APP_DBG
@@ -1230,7 +1205,6 @@ static uint16_t app_get_dev_info_callback(sonata_gap_local_dev_info info_type, v
return CB_DONE;
}
/*!
* @brief Deal with peer device get local information request.
* @param opt @see asr_gap_dev_info
@@ -1264,7 +1238,6 @@ static uint16_t app_gap_peer_get_local_info_callback(uint8_t conidx, sonata_gap_
return CB_DONE;
}
void app_gap_set_scan_cb(app_ble_scan_callback_t cb)
{
p_scan_cb = cb;
@@ -1335,7 +1308,6 @@ static uint16_t app_gap_disconnect_ind_callback(uint8_t conidx, uint16_t conhdl,
return CB_DONE;
}
void app_ble_gatt_add_srv_rsp(uint16_t handle)
{
APP_TRC("app_ble_gatt_add_srv_rsp\r\n");
@@ -1395,12 +1367,11 @@ void app_user_config_write_cb(uint16_t handle, uint8_t *data, uint16_t size)
}
s_indicateEnable = *(uint16_t *)data;
if (s_indicateEnable == 0x0002) {
int32_t send_status = sonata_ble_gatt_send_indicate_event(0, handle, size, data); //0x0200
int32_t send_status = sonata_ble_gatt_send_indicate_event(0, handle, size, data); // 0x0200
printf("send status %ld\r\n", send_status);
}
}
void app_ble_gatt_write_request_handler(uint16_t handle, uint16_t length, uint8_t *p_value)
{
// printf("[API]ble_gatt_write_request_handler %d\r\n",handle);
@@ -1419,7 +1390,6 @@ void app_ble_gatt_write_request_handler(uint16_t handle, uint16_t length, uint8_
}
}
void app_ble_gatt_get_att_info(uint16_t handle, uint16_t *p_length, uint8_t *p_status)
{
printf("[API]ble_gatt_get_att_info %d\r\n", handle);
@@ -1434,7 +1404,6 @@ void app_ble_gatt_get_att_info(uint16_t handle, uint16_t *p_length, uint8_t *p_s
*p_status = BLE_STATUS_SUCCESS;
}
static uint16_t app_gatt_disc_svc_callback(uint8_t connection_id, uint16_t start_hdl, uint16_t end_hdl,
uint8_t uuid_len, uint8_t *uuid)
{
@@ -1458,7 +1427,6 @@ static uint16_t app_gatt_disc_svc_callback(uint8_t connection_id, uint16_t start
sonata_ble_gatt_disc_all_characteristic(connection_id, start_hdl, end_hdl);
}
return CB_DONE;
}
@@ -1522,7 +1490,6 @@ static uint16_t app_gatt_disc_desc_callback(uint8_t conidx, uint16_t attr_hdl, u
return CB_DONE;
}
static uint16_t app_gatt_event_callback(uint8_t conidx, uint16_t handle, uint16_t type, uint16_t length, uint8_t *value)
{
APP_TRC("APP_CB: %s,handle = %04X, type = %04X,length = %04X", __FUNCTION__,
@@ -1537,7 +1504,6 @@ static uint16_t app_gatt_event_callback(uint8_t conidx, uint16_t handle, uint16_
return CB_DONE;
}
void app_ble_gatt_data_send(uint16_t local_handle, uint16_t idx, uint16_t length, uint8_t *p_value)
{
if (local_handle > service_reg_env.add_nb) {
@@ -1556,7 +1522,6 @@ void app_ble_gatt_data_send(uint16_t local_handle, uint16_t idx, uint16_t length
return;
}
void app_ble_gatt_data_send_notify(uint16_t local_handle, uint16_t idx, uint16_t length, uint8_t *p_value)
{
if (local_handle > service_reg_env.add_nb) {
@@ -1569,20 +1534,17 @@ void app_ble_gatt_data_send_notify(uint16_t local_handle, uint16_t idx, uint16_t
//idx = 5;
uint16_t localhandle = p_list->start_hdl + idx;
int32_t send_status = sonata_ble_gatt_send_notify_event(0, localhandle, length, p_value);
APP_TRC("send status %ld\r\n", send_status);
return;
}
static void app_ble_enable_service(uint16_t start_hdl, uint8_t perm)
{
APP_TRC("app_ble_enable_service,handle =%02X(X) %d", start_hdl, perm);
sonata_ble_gatt_set_service_visibility(start_hdl, true);
}
static void app_ble_disable_service(uint16_t start_hdl, uint8_t perm)
{
APP_TRC("app_ble_disable_service,handle =%02X(X) %d", start_hdl, perm);
@@ -1602,7 +1564,6 @@ int app_ble_disable_service_by_handler(uint16_t start_hdl)
return 0;
}
static uint8_t app_ble_search_svc(uint8_t *service_uuid)
{
for (int idx = 0; idx < service_reg_env.add_nb; idx++) {
@@ -1612,7 +1573,6 @@ static uint8_t app_ble_search_svc(uint8_t *service_uuid)
}
return MAX_SERVICE_NUM;
}
int app_ble_gatt_add_svc_helper(uint16_t *start_hdl, uint8_t nb_att, ble_gatt_att_reg_t *atts)
@@ -1689,7 +1649,6 @@ int app_ble_gatt_add_svc_helper(uint16_t *start_hdl, uint8_t nb_att, ble_gatt_at
return BLE_STATUS_SUCCESS;
}
int app_set_security_io_cap(uint8_t cap)
{
APP_TRC("app_set_security_io_cap,cap=%02X(X)", cap);
@@ -1697,7 +1656,6 @@ int app_set_security_io_cap(uint8_t cap)
return 0;
}
int app_set_security_auth_req(uint8_t auth_req)
{
APP_TRC("app_set_security_auth_req,auth_req=%02X(X)", auth_req);
@@ -1705,7 +1663,6 @@ int app_set_security_auth_req(uint8_t auth_req)
return 0;
}
uint8_t app_get_connection_state(void)
{
return app_connection_state;
@@ -1778,13 +1735,11 @@ static void print_peer_bond_request(struct sonata_gap_bond_req_ind *request)
}
}
void app_gap_notify_pair_request_rsp(uint8_t *bd_addr, uint8_t accept)
{
uint8_t key_size = SONATA_GAP_SMP_MAX_ENC_SIZE_LEN;
enum sonata_gap_oob_auth oob = SONATA_GAP_OOB_AUTH_DATA_NOT_PRESENT;
enum sonata_gap_kdist ikey_dist = SONATA_GAP_KDIST_LINKKEY;//Initiator key distribution
enum sonata_gap_kdist ikey_dist = SONATA_GAP_KDIST_LINKKEY; // Initiator key distribution
enum sonata_gap_kdist rkey_dist = SONATA_GAP_KDIST_NONE; //Responder key distribution
enum sonata_gap_sec_req sec_req = SONATA_GAP_NO_SEC;
//ikey_dist = GAP_KDIST_ENCKEY | GAP_KDIST_IDKEY;
@@ -1812,7 +1767,6 @@ static void app_gap_notify_pair_request(void)
}
}
static uint16_t app_gap_bond_req_callback(uint8_t conidx, struct sonata_gap_bond_req_ind *request)
{
APP_TRC("APP_CB: %s request->request=%d\r\n", __FUNCTION__, request->request);
@@ -1906,7 +1860,6 @@ static uint16_t app_gap_bond_req_callback(uint8_t conidx, struct sonata_gap_bond
}
APP_TRC("\r\n");
}
break;
case SONATA_GAP_NC_EXCH: {
@@ -1933,12 +1886,10 @@ static uint16_t app_gap_bond_req_callback(uint8_t conidx, struct sonata_gap_bond
break;
}
return CB_DONE;
}
static uint16_t app_gap_bond_callback(uint8_t conidx, struct sonata_gap_bond_ind *ind)
{
APP_TRC("APP_CB: %s \r\n", __FUNCTION__);
@@ -2019,7 +1970,6 @@ static uint16_t app_gap_bond_callback(uint8_t conidx, struct sonata_gap_bond_ind
}
APP_TRC("\r\n");
break;
case SONATA_GAP_IRK_EXCH:
APP_TRC("APP_CB: %s SONATA_GAP_IRK_EXCH\r\n", __FUNCTION__);
@@ -2214,7 +2164,6 @@ static uint16_t app_gap_peer_att_info_callback(uint8_t conidx, sonata_gap_peer_a
return CB_DONE;
}
static uint16_t app_gap_peer_info_callback(uint8_t conidx, sonata_gap_peer_info_ind_t *info)
{
APP_TRC("APP_CB: %s conidx=%02X, info_type=%02X\r\n", __FUNCTION__, conidx, info->req);
@@ -2310,13 +2259,11 @@ static uint16_t app_gap_peer_set_local_device_name_callback(uint8_t conidx, uint
return CB_DONE;
}
void app_set_connect_flag(uint8_t vaule)
{
need_connect_confirm = vaule;
}
static void app_gap_send_connection_confirm(uint8_t conidx, uint8_t auth)
{
sonata_gap_connection_cfm_t connectionCfm = {0};
@@ -2335,7 +2282,6 @@ static void app_gap_send_connection_confirm(uint8_t conidx, uint8_t auth)
sonata_ble_gap_send_connection_cfm(conidx, &connectionCfm);
}
void app_gap_connect_confirm(uint8_t *addr, uint8_t auth)
{
uint8_t conidx = app_get_conidx_by_addr(addr);
@@ -2468,7 +2414,6 @@ static uint16_t app_gatt_mtu_changed_callback(uint8_t connection_id, uint16_t mt
return CB_DONE;
}
/*!
* @brief
* @param connection_id
@@ -2490,9 +2435,6 @@ static uint16_t app_gatt_att_info_req_ind_callback(uint8_t connection_id, uint16
return CB_DONE;
}
bool app_ble_master_write_data(uint8_t conidx, uint16_t length, uint8_t *data)
{
if (gAppEnv.targetWriteHandle != 0) {
@@ -2684,7 +2626,6 @@ sonata_api_app_msg_t app_at_cmd_msg = {
****************************************************************************************
*/
/*
* GLOBAL FUNCTION DEFINITIONS
****************************************************************************************
@@ -2854,13 +2795,11 @@ static uint8_t app_timer_handler(uint16_t id)
}
extern int init_ble_task(void);
extern int deinit_ble_task(void);
uint32_t ble_open = 0;
// 连接相关
int app_ble_stack_start(ble_stack_opr_module_id_t module)
{
@@ -2874,7 +2813,6 @@ int app_ble_stack_start(ble_stack_opr_module_id_t module)
return 0;
}
int app_ble_stack_stop(ble_stack_opr_module_id_t module)
{
@@ -2909,7 +2847,6 @@ void app_ble_set_target_address(uint8_t *target)
APP_TRC("\r\n ");
}
void app_ble_set_uuids(uint16_t service, uint16_t read, uint16_t write, uint16_t ntf)
{
APP_TRC("APP: %s service=0x%04X,read=0x%04X,write=0x%04X,ntf=0x%04X\r\n", __FUNCTION__, service, read, write, ntf);
@@ -2920,7 +2857,6 @@ void app_ble_set_uuids(uint16_t service, uint16_t read, uint16_t write, uint16_t
gAppEnv.appUuids.ntf = ntf;
}
app_uuids *app_ble_get_uuids()
{
return &gAppEnv.appUuids;
@@ -2947,4 +2883,4 @@ CRITICAL_FUNC_SEG void BLE_IRQHandler(void)
sonata_ble_isr();
}
/// @} APP
// @} APP
@@ -54,7 +54,6 @@ static void sonata_string_to_array(char *input_str, uint8_t input_length, uint8_
}
}
duet_gpio_dev_t g_duet_gpio11;
duet_gpio_dev_t g_duet_gpio12;
duet_gpio_dev_t g_duet_gpio6;
@@ -212,7 +211,6 @@ static struct cli_command disconnect_cmd = {
};
#endif
void lega_ble_test_mode(char *pwbuf, int blen, int argc, char **argv)
{
int c = 1;
@@ -239,7 +237,6 @@ void lega_ble_test_mode(char *pwbuf, int blen, int argc, char **argv)
duet_gpio_output_low(&g_duet_gpio11);
app_set_ble_test_mode(true);
} else {
app_set_ble_test_mode(false);
@@ -262,7 +259,6 @@ void lega_ble_adv_state(char *pwbuf, int blen, int argc, char **argv)
sonata_api_app_timer_active(5);
}
#ifdef ALIOS_SUPPORT
static struct cli_command adv_state = {
.name = "printf-adv-state",
@@ -282,7 +278,6 @@ void lega_ble_set_uuid(char *pwbuf, int blen, int argc, char **argv)
ble_set_max_mtu(200);
}
#ifdef ALIOS_SUPPORT
static struct cli_command set_test_uuid = {
.name = "test-uuid",
@@ -299,7 +294,6 @@ void lega_ble_add_test_service(char *pwbuf, int blen, int argc, char **argv)
#endif
}
#ifdef ALIOS_SUPPORT
static struct cli_command add_test_service = {
.name = "add-test-service",
@@ -307,7 +301,6 @@ static struct cli_command add_test_service = {
.function = lega_ble_add_test_service,
};
void lega_ble_at_init(void)
{
aos_cli_register_command(&scan_cmd);
@@ -25,7 +25,6 @@
#include "ohos_bt_gatt_server.h"
#include "ohos_bt_gatt_client.h"
static BtGattServerCallbacks gatts_callback = {0};
static BtGattCallbacks bt_gattcallback = {0};
@@ -40,7 +39,6 @@ static BtGattCallbacks bt_gattcallback = {0};
int BleGattsSetEncryption(BdAddr bdAddr, BleSecAct secAct);
int BleGattsSendIndication(int serverId, GattsSendIndParam *param);
static int8_t test_value[5] = {0x2, 0x02, 0x02, 0x04, 0x05};
int test_handle = 0;
@@ -62,7 +60,6 @@ void test_ind(void)
BleGattsSendIndication(0, &indParam);
}
int app_core_evt_ind_cb_h(app_core_evt_ind_t evt, void *p_param)
{
@@ -162,7 +159,6 @@ int BleSetSecurityIoCap(BleIoCapMode mode)
return BT_STATUS_SUCCESS;
}
static uint8_t sec_auth_req_h2a(BleAuthReqMode mode)
{
uint8_t auth_req_temp ;
@@ -215,7 +211,6 @@ int BleGattsDisconnect(int serverId, BdAddr bdAddr, int connId)
return BT_STATUS_SUCCESS;
}
static void perm_2_perm(uint8_t user_perm, uint8_t user_prop, uint16_t *p_perm)
{
if ((user_prop & OHOS_GATT_CHARACTER_PROPERTY_BIT_READ) == OHOS_GATT_CHARACTER_PROPERTY_BIT_READ) {
@@ -264,8 +259,6 @@ static void perm_2_perm(uint8_t user_perm, uint8_t user_prop, uint16_t *p_perm)
print_log("[Harmony]user_perm= %x prop = %x out : %x\r\n", user_perm, user_prop, *p_perm);
}
ble_gatt_att_reg_t *ble_ohos_add_service(ble_gatt_att_reg_t *dst_attr, BleGattAttr *service_attr)
{
if (service_attr->attrType != OHOS_BLE_ATTRIB_TYPE_SERVICE) {
@@ -283,8 +276,6 @@ ble_gatt_att_reg_t *ble_ohos_add_service(ble_gatt_att_reg_t *dst_attr, BleGatt
return dst_attr;
}
ble_gatt_att_reg_t *ble_ohos_add_char(ble_gatt_att_reg_t *dst_attr, BleGattAttr *char_attr, bool isLast)
{
if (char_attr->attrType != OHOS_BLE_ATTRIB_TYPE_CHAR) {
@@ -316,7 +307,6 @@ ble_gatt_att_reg_t *ble_ohos_add_char(ble_gatt_att_reg_t *dst_attr, BleGattAttr
dst_attr->att_desc.ext_perm |= PRI;
dst_attr->att_desc.max_len = 512;
if (((char_attr->properties & OHOS_GATT_CHARACTER_PROPERTY_BIT_INDICATE) == OHOS_GATT_CHARACTER_PROPERTY_BIT_INDICATE
|| (char_attr->properties & OHOS_GATT_CHARACTER_PROPERTY_BIT_NOTIFY) == OHOS_GATT_CHARACTER_PROPERTY_BIT_NOTIFY )
&& isLast) {
@@ -333,7 +323,6 @@ ble_gatt_att_reg_t *ble_ohos_add_char(ble_gatt_att_reg_t *dst_attr, BleGattAttr
return dst_attr;
}
int BleGattServiceRead1(unsigned char *buff, unsigned int *len)
{
print_log("harmony : %s \r\n", __FUNCTION__);
@@ -357,15 +346,12 @@ int BleGattServiceIndicate1(unsigned char *buff, unsigned int len)
return 0;
}
BleGattOperateFunc opr_func = {
.read = BleGattServiceRead1,
.write = BleGattServiceWrite1,
.indicate = BleGattServiceIndicate1,
};
BleGattAttr h_attr1 = {
.attrType = OHOS_BLE_ATTRIB_TYPE_SERVICE,
.permission = OHOS_GATT_PERMISSION_READ,
@@ -393,7 +379,6 @@ BleGattAttr h_attr2 = {
};
BleGattAttr h_attr3 = {
.attrType = OHOS_BLE_ATTRIB_TYPE_SERVICE,
.permission = OHOS_GATT_PERMISSION_READ,
@@ -452,7 +437,6 @@ void test_h_add_service(void)
BleGattsStartServiceEx(&handler, &service_info);
}
void test_h_add_service2(void)
{
static uint8_t flagg = 0;
@@ -480,7 +464,6 @@ static unsigned int get_service_num(unsigned int attrNum, uint8_t indicate_is_ex
return num;
}
int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo)
{
if (NULL == srvcInfo) {
@@ -540,8 +523,6 @@ int BleGattsStartServiceEx(int *srvcHandle, BleGattService *srvcInfo)
return BT_STATUS_SUCCESS;
}
int BleGattsStopServiceEx(int srvcHandle)
{
print_log("harmony : %s %d\r\n", __FUNCTION__, srvcHandle);
@@ -610,7 +591,6 @@ int ReadBtMacAddr(unsigned char *mac, unsigned int len)
}
int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advParam)
{
print_log("harmony : %s %d %d\r\n", __FUNCTION__, rawData.advDataLen, rawData.rspDataLen);
@@ -647,7 +627,6 @@ int BleStartAdvEx(int *advId, const StartAdvRawData rawData, BleAdvParams advPar
return BT_STATUS_SUCCESS;
}
static uint8_t sec_enc_req_h2a(BleSecAct secAct)
{
switch (secAct) {
@@ -676,7 +655,6 @@ int BleGattsSetEncryption(BdAddr bdAddr, BleSecAct secAct)
return BT_STATUS_SUCCESS;
}
int BleStopAdv(int advId)
{
print_log("harmony : %s %d\r\n", __FUNCTION__, advId);
@@ -684,7 +662,6 @@ int BleStopAdv(int advId)
return BT_STATUS_SUCCESS;
}
// not used start!!!
/* gatt client register, callback return clientId */
int BleGattcRegister(BtUuid appUuid)
@@ -713,15 +690,12 @@ int BleStartAdv(int advId, const BleAdvParams *param)
return BT_STATUS_FAIL;
}
int BleGattcRegisterCallbacks(BtGattClientCallbacks *func)
{
print_log("harmony ERROR : %s should not be used\r\n", __FUNCTION__);
return BT_STATUS_FAIL;
}
int BleGattsRegister(BtUuid appUuid)
{
print_log("harmony ERROR : %s should not be used\r\n", __FUNCTION__);
@@ -770,7 +744,6 @@ int BleGattsStopService(int serverId, int srvcHandle)
return BT_STATUS_FAIL;
}
int BleGattsSendResponse(int serverId, GattsSendRspParam *param)
{
print_log("harmony ERROR : %s should not be used\r\n", __FUNCTION__);
@@ -779,13 +752,3 @@ int BleGattsSendResponse(int serverId, GattsSendRspParam *param)
// not used end!!!
@@ -28,14 +28,14 @@ void delay(unsigned int cycles);
int convert_str_to_int(char *str);
void convert_int_to_str(unsigned int val, unsigned int type, char *ch);
/// Macro to read a register
// Macro to read a register
#define REG_RD(addr) (*(volatile uint32_t *)(addr))
/// Macro to write a register
// Macro to write a register
#define REG_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value)
/// Macro to read a register
// Macro to read a register
#define REG_BLE_RD(addr) (*(volatile uint32_t *)(addr))
/// Macro to write a register
// Macro to write a register
#define REG_BLE_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value)
#ifdef DUET_BLE_NO_BLOCK
@@ -48,7 +48,6 @@ void lega_exit_critical_expble(void);
#define lega_exit_critical_expble() lega_rtos_exit_critical()
#endif
void duet_write32_bit(uint32_t reg, uint8_t start_bit, uint8_t len, uint32_t src_val);
uint32_t duet_read32_bit(uint32_t reg, uint8_t start_bit, uint8_t len);
#endif //_LEGA_COMM_H_
@@ -49,7 +49,6 @@
#define LWIP_COMP (D_LWIP)
#define AT_COMP (D_AT)
extern uint32_t GlobalDebugComponents;
extern uint32_t GlobalDebugLevel;
extern uint8_t GlobalDebugEn;
@@ -26,6 +26,7 @@
#define _TYPES_H_
#include <stdint.h>
#include <stdbool.h>
#if 0 // use standard defines
@@ -80,9 +81,9 @@ typedef unsigned char bool;
#define BIT(n) (1<<(n))
#define CO_WF_BIT(pos) (1U<<(pos))
/// structure of a list element header
// structure of a list element header
struct co_wf_list_hdr {
/// Pointer to the next element in the list
// Pointer to the next element in the list
struct co_wf_list_hdr *next;
};
@@ -109,10 +110,7 @@ inline static uint16_t __fswap16(uint16_t x)
#define __be16_to_cpu(x) __swap16(x)
#define wlan_htons(x) __cpu_to_be16(x)
//#define ntohs(x) __be16_to_cpu(x)
// #define ntohs(x) __be16_to_cpu(x)
#endif //_TYPES_H_
+80 -93
View File
@@ -21,8 +21,6 @@
typedef enum { RESET = 0, SET = !RESET} FlagStatus, ITstatus;
typedef enum { DISABLE = 0, ENABLE = !DISABLE } State;
typedef enum IRQn {
/************** Processor Exceptions Numbers ******************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
@@ -61,10 +59,9 @@ typedef enum IRQn {
#include "duet_cm4.h"
#include "core_cm4.h"
/// Macro to read a register
// Macro to read a register
#define REG_RD(addr) (*(volatile uint32_t *)(addr))
/// Macro to write a register
// Macro to write a register
#define REG_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value)
/*
@@ -72,9 +69,7 @@ typedef enum IRQn {
*/
typedef struct Sys_Con_Block {
union {
struct
{
struct {
__IO uint32_t hclk_src_sel: 2;
__IO uint32_t pclk_div_sel: 3;
__IO uint32_t kp_sclk_sel: 1;
@@ -266,7 +261,6 @@ typedef struct __DMACR {
__I uint32_t RESV1[0x3ec]; /* 0x50 - 0xffc */
} DMA_TypeDef;
#define DMA ( (DMA_TypeDef *)DMA_REG_BASE )
#define DMA_ERROR ( *(volatile uint32_t *)(SYS_CON_REG_BASE + 0x70) )
#define DMA_INT_STAT ( *(volatile uint32_t *)(SYS_CON_REG_BASE + 0x74) )
@@ -282,7 +276,6 @@ typedef struct __DMACR {
#define DMA_IRQ_BIT (0X01<<7)
#define DMA_CLK_EN (0X01<<13)
/*
DUET I2S definition
*/
@@ -298,27 +291,27 @@ typedef struct __I2S {
__I uint32_t RESV0; // 0x1c
/* channel-specific registers */
__IO uint32_t LRBR_LTHR; //0x20
__IO uint32_t RRBR_RTHR; //0x24
__IO uint32_t RER; //0x28
__IO uint32_t TER; //0x2c
__IO uint32_t RCR; //0x30
__IO uint32_t TCR; //0x34
__I uint32_t ISR; //0x38
__IO uint32_t IMR; //0x3c
__I uint32_t ROR; //0x40
__I uint32_t TOR; //0x44
__IO uint32_t RFCR; //0x48
__IO uint32_t TFCR; //0x4c
__O uint32_t RFF; //0x50
__O uint32_t TFF; //0x54
__IO uint32_t LRBR_LTHR; // 0x20
__IO uint32_t RRBR_RTHR; // 0x24
__IO uint32_t RER; // 0x28
__IO uint32_t TER; // 0x2c
__IO uint32_t RCR; // 0x30
__IO uint32_t TCR; // 0x34
__I uint32_t ISR; // 0x38
__IO uint32_t IMR; // 0x3c
__I uint32_t ROR; // 0x40
__I uint32_t TOR; // 0x44
__IO uint32_t RFCR; // 0x48
__IO uint32_t TFCR; // 0x4c
__O uint32_t RFF; // 0x50
__O uint32_t TFF; // 0x54
__I uint32_t RESV1[0x5a];
__IO uint32_t RXDMA; //0x1c0
__IO uint32_t RXDMA; // 0x1c0
__O uint32_t RRXDMA;
__IO uint32_t TXDMA;
__O uint32_t RTXDMA; //0x1cc
__O uint32_t RTXDMA; // 0x1cc
__I uint32_t RESV2[8];
__I uint32_t I2S_COMP_PARAM_2; //0x1f0
__I uint32_t I2S_COMP_PARAM_2; // 0x1f0
__I uint32_t I2S_COMP_PARAM_1;
__I uint32_t I2S_COMP_VERSION;
__I uint32_t I2S_COMP_TYPE;
@@ -328,7 +321,6 @@ typedef struct __I2S {
#define REG_I2S_HW_SHIFT_DATAIN ( *(volatile uint32_t *)(SYS_CON_REG_BASE + 0xC4) )
#define REG_I2S_HW_SHIFT_DATAOUT ( *(volatile uint32_t *)(SYS_CON_REG_BASE + 0xC8) )
#define I2S_BASE (0x4008D000)
#define I2S ((I2S_TypeDef *)I2S_BASE)
@@ -350,16 +342,16 @@ typedef struct {
/* SPI register block */
typedef struct __SPI {
__IO uint32_t CR0 ;/* 0x0 */
__IO uint32_t CR1 ;/* 0x4 */
__IO uint32_t DR ;/* 0x8 */
__I uint32_t SR ;/* 0xC */
__IO uint32_t CPSR ;/* 0x10 */
__IO uint32_t IMSC ;/* 0x14 */
__I uint32_t RIS ;/* 0x18 */
__I uint32_t MIS ;/* 0x1C */
__IO uint32_t ICR ;/* 0x20 */
__IO uint32_t DMA_CR ;/* 0x24 */
__IO uint32_t CR0 ; /* 0x0 */
__IO uint32_t CR1 ; /* 0x4 */
__IO uint32_t DR ; /* 0x8 */
__I uint32_t SR ; /* 0xC */
__IO uint32_t CPSR ; /* 0x10 */
__IO uint32_t IMSC ; /* 0x14 */
__I uint32_t RIS ; /* 0x18 */
__I uint32_t MIS ; /* 0x1C */
__IO uint32_t ICR ; /* 0x20 */
__IO uint32_t DMA_CR ; /* 0x24 */
} SPI_TypeDef ;
#define SPI_NUM_PORTS 3
@@ -446,18 +438,18 @@ typedef struct __GPIO {
DUET I2C BEGIN
*/
typedef struct __I2C {
__IO uint32_t CR; //0x00
__IO uint32_t CR; // 0x00
__IO uint32_t SR;
__IO uint32_t SAR; //0x08
__IO uint32_t SAR; // 0x08
__IO uint32_t DBR;
__IO uint32_t LCR;
__IO uint32_t WCR; //0x14
__IO uint32_t RST_CYCL; //0x18
__IO uint32_t RST_CYCL; // 0x18
__I uint32_t BMR; //0x1c
__IO uint32_t WFIFO; //0x20
__IO uint32_t WFIFO_WPTR; //0x24
__IO uint32_t WFIFO_RPTR; //0x28
__IO uint32_t RFIFO; //0x2c
__IO uint32_t WFIFO; // 0x20
__IO uint32_t WFIFO_WPTR; // 0x24
__IO uint32_t WFIFO_RPTR; // 0x28
__IO uint32_t RFIFO; // 0x2c
__IO uint32_t RFIFO_WPTR;
__IO uint32_t RFIFO_RPTR; //0x34
__IO uint32_t RESV[2]; //0x38 0x3C
@@ -465,7 +457,6 @@ typedef struct __I2C {
__I uint32_t RFIFO_STATUS; //0x44
} I2C_TypeDef;
#define I2C0_BASE 0x4008A000
#define I2C1_BASE 0x4008B000
#define I2C0 ((I2C_TypeDef *)I2C0_BASE)
@@ -494,18 +485,18 @@ typedef struct __I2C {
#define I2C0_IRQ_DISABLE (1 << I2C0_IRQ_BIT)
#define I2C1_IRQ_DISABLE (1 << I2C1_IRQ_BIT)
//// set pad2:3 for i2c0 func 4
//#define I2C0_PINMUX_MASK0 0x0000FF00
//#define I2C0_PINMUX_VALUE0 0x00004400
//// set pad20:21 for i2c0 scl/sda func 1
//#define I2C0_PINMUX_MASK1 0x00FF0000
//#define I2C0_PINMUX_VALUE1 0x00110000
//// set pad 8:9 for i2c1 func 3
//#define I2C1_PINMUX_MASK0 0x000000FF
//#define I2C1_PINMUX_VALUE0 0x00000033
//// set pad22:23 for i2c1 scl/sda func 1
//#define I2C1_PINMUX_MASK1 0xFF000000
//#define I2C1_PINMUX_VALUE1 0x11000000
/// set pad2:3 for i2c0 func 4
// #define I2C0_PINMUX_MASK0 0x0000FF00
// #define I2C0_PINMUX_VALUE0 0x00004400
/// set pad20:21 for i2c0 scl/sda func 1
// #define I2C0_PINMUX_MASK1 0x00FF0000
// #define I2C0_PINMUX_VALUE1 0x00110000
/// set pad 8:9 for i2c1 func 3
// #define I2C1_PINMUX_MASK0 0x000000FF
// #define I2C1_PINMUX_VALUE0 0x00000033
/// set pad22:23 for i2c1 scl/sda func 1
// #define I2C1_PINMUX_MASK1 0xFF000000
// #define I2C1_PINMUX_VALUE1 0x11000000
/*
DUET I2C END
@@ -534,12 +525,10 @@ typedef struct __RTC {
#define RTC_REG_BASE 0x40000A20
#define RTC ((RTC_TypeDef *)(RTC_REG_BASE))
#define COUNT_IN_SECOND 32768
#define RTC_IRQ_BIT 0
#define RTC_CNT_CYCLE_ENABLE (1 << 15)
#define RTC_ENABLE (1 << 14)
#define CLK32K_SEL (1 << 12) //A0V1 bug, sel ext XO no function, same as internal RC clk
@@ -591,18 +580,17 @@ struct DUET_RETENTION_SRAM {
#define RETENTION_RAM_ADDR 0x40008000
#define RETENTION_SRAM ((struct DUET_RETENTION_SRAM *)(RETENTION_RAM_ADDR))
#define DUET_RETENTION_SRAM_CUSTOM_SIZE 64
//#define RTC_TIME_RETENTION_RAM_ADDR RETENTION_RAM_ADDR
// #define RTC_TIME_RETENTION_RAM_ADDR RETENTION_RAM_ADDR
/*
RETENTION SRAM END
*/
/*
DUET TIMER BEGIN
*/
///////////// to do ////////////
//////////// to do ////////////
/*
DUET TIMER END
*/
@@ -613,31 +601,30 @@ struct DUET_RETENTION_SRAM {
/* DUET UART register block */
typedef struct __UART {
__IO uint32_t DR ;/* 0x0 */
__IO uint32_t RSC_ECR ;/* 0x4 */
__I uint32_t RSV0[4] ;/* 0x8~0x14 */
__I uint32_t FR ;/* 0x18 */
__I uint32_t RSV1 ;/* 0x1C */
__IO uint32_t ILPR ;/* 0x20 */
__IO uint32_t IBRD ;/* 0x24 */
__IO uint32_t FBRD ;/* 0x28 */
__IO uint32_t LCR_H ;/* 0x2C */
__IO uint32_t CR ;/* 0x30 */
__IO uint32_t IFLS ;/* 0x34 */
__IO uint32_t IMSC ;/* 0x38 */
__I uint32_t RIS ;/* 0x3C */
__I uint32_t MIS ;/* 0x40 */
__O uint32_t ICR ;/* 0x44 */
__IO uint32_t DMACR ;/* 0x48 */
__I uint32_t RSV2[997] ;/* 0x04C~0xFDC */
__I uint32_t ID[8] ;/* 0xFE0~0xFFC*/
__IO uint32_t DR ; /* 0x0 */
__IO uint32_t RSC_ECR ; /* 0x4 */
__I uint32_t RSV0[4] ; /* 0x8~0x14 */
__I uint32_t FR ; /* 0x18 */
__I uint32_t RSV1 ; /* 0x1C */
__IO uint32_t ILPR ; /* 0x20 */
__IO uint32_t IBRD ; /* 0x24 */
__IO uint32_t FBRD ; /* 0x28 */
__IO uint32_t LCR_H ; /* 0x2C */
__IO uint32_t CR ; /* 0x30 */
__IO uint32_t IFLS ; /* 0x34 */
__IO uint32_t IMSC ; /* 0x38 */
__I uint32_t RIS ; /* 0x3C */
__I uint32_t MIS ; /* 0x40 */
__O uint32_t ICR ; /* 0x44 */
__IO uint32_t DMACR ; /* 0x48 */
__I uint32_t RSV2[997] ; /* 0x04C~0xFDC */
__I uint32_t ID[8] ; /* 0xFE0~0xFFC*/
} UART_TypeDef;
#define UART0_BASE (0x40080000+0x1000)
#define UART1_BASE (0x40080000+0x2000)
#define UART2_BASE (0x40080000+0x3000)
#define UART0 ((UART_TypeDef *)UART0_BASE)
#define UART1 ((UART_TypeDef *)UART1_BASE)
#define UART2 ((UART_TypeDef *)UART2_BASE)
@@ -666,14 +653,14 @@ struct DUET_WDOG {
__IO uint32_t CONTROL;
__O uint32_t INTCLR;
__I uint32_t RIS;
__I uint32_t MIS; //0x14
__I uint32_t MIS; // 0x14
__I uint32_t DUMMY0[0x2FA];
__IO uint32_t LOCK; //0xC00
__IO uint32_t LOCK; // 0xC00
__I uint32_t DUMMY1[0xBF];
__IO uint32_t ITCR; //0xF00
__O uint32_t ITOP; //0xF04
__IO uint32_t ITCR; // 0xF00
__O uint32_t ITOP; // 0xF04
__I uint32_t DUMMY2[0x32];
__I uint32_t PERIPHID4; //0xFD0
__I uint32_t PERIPHID4; // 0xFD0
__I uint32_t PERIPHID5;
__I uint32_t PERIPHID6;
__I uint32_t PERIPHID7;
@@ -838,19 +825,19 @@ struct DUET_PWM {
DUET EFUDE BEGIN
*/
struct DUET_EFUSE {
__IO uint32_t CFG_TYPE; //0x00
__IO uint32_t CFG_TYPE; // 0x00
__IO uint32_t WR_TYPE;
__IO uint32_t START;
__IO uint32_t RD_CNT;
__IO uint32_t WR_CNT; //0x10
__IO uint32_t WR_CNT; // 0x10
__IO uint32_t DIV_CNT;
__IO uint32_t B_ADDR;
__IO uint32_t PGM_DATA;
__IO uint32_t RDBK_DATA; //0x20
__IO uint32_t RDBK_DATA; // 0x20
__I uint32_t RSVD;
__IO uint32_t INT_EN;
__IO uint32_t INT_CLR;
__IO uint32_t E_ENABLE; //0x30
__IO uint32_t E_ENABLE; // 0x30
};
#define EFUSE_CTRL_BASE 0x40005000
@@ -866,7 +853,7 @@ struct DUET_EFUSE {
#define EFUSE_REG_B_ADDR *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x018))
#define EFUSE_REG_PGM_DATA *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x01C))
#define EFUSE_REG_RDBK_DATA *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x020))
//#define EFUSE_REG_DONE *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x024))
// #define EFUSE_REG_DONE *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x024))
#define EFUSE_REG_INT_EN *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x028))
#define EFUSE_REG_INT_CLR *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x02C))
#define EFUSE_REG_ENABLE *((volatile uint32_t *)(EFUSE_CTRL_BASE + 0x030))
@@ -918,7 +905,7 @@ struct DUET_EFUSE {
/*
DUET LPUART BEGIN
*/
/////////////////////// to do /////////////////
////////////////////// to do /////////////////
/*
DUET LPUART END
*/
@@ -62,7 +62,6 @@ typedef struct {
/* Modem Config */
#define MDM_CLKGATEFCTRL0_ADDR 0x60C00874
typedef enum {
ADC_CHANNEL_NUM0,
ADC_CHANNEL_NUM1,
@@ -114,7 +114,6 @@ typedef struct {
uint8_t use_pri_only;
} DMA_Init_Struct_Type;
typedef struct {
uint32_t chan_src_end_ptr;
uint32_t chan_dst_end_ptr;
@@ -122,7 +121,6 @@ typedef struct {
uint32_t resv;
} Chan_Cfg_TypeDef;
Chan_Cfg_TypeDef *duet_dma_ctrl_block_init(void);
void duet_dma_init(void);
void duet_dma_interrupt_clear(uint32_t chan_idx);
@@ -47,7 +47,6 @@ typedef volatile unsigned short vu16;
#define READ2 0xBB
#define READ4 0xEB
#define RDID 0x9F
#define WRSR 0x01
#define RDSR 0x05
@@ -57,25 +56,25 @@ typedef volatile unsigned short vu16;
#define OSC_D ((OSC*144)/8)
typedef struct {
vu32 QSPI_CR ; //offset 0x00
vu32 QSPI_DCR ; //offset 0x04
vu32 QSPI_SR ; //offset 0x08
vu32 QSPI_FCR ; //offset 0x0C
vu32 QSPI_DLR ; //offset 0x10
vu32 QSPI_CCR ; //offset 0x14
vu32 QSPI_AR ; //offset 0x18
vu32 QSPI_ABR ; //offset 0x1C
vu32 QSPI_DR ; //offset 0x20
vu32 QSPI_PSMKR ; //offset 0x24
vu32 QSPI_PSMAR ; //offset 0x28
vu32 QSPI_PIR ; //offset 0x2C
vu32 QSPI_TOR ; //offset 0x30
vu32 QSPI_CR ; // offset 0x00
vu32 QSPI_DCR ; // offset 0x04
vu32 QSPI_SR ; // offset 0x08
vu32 QSPI_FCR ; // offset 0x0C
vu32 QSPI_DLR ; // offset 0x10
vu32 QSPI_CCR ; // offset 0x14
vu32 QSPI_AR ; // offset 0x18
vu32 QSPI_ABR ; // offset 0x1C
vu32 QSPI_DR ; // offset 0x20
vu32 QSPI_PSMKR ; // offset 0x24
vu32 QSPI_PSMAR ; // offset 0x28
vu32 QSPI_PIR ; // offset 0x2C
vu32 QSPI_TOR ; // offset 0x30
vu32 RESERVERD[19];
vu32 QSPI_HIT0R ; //offset 0x80
vu32 QSPI_HIT1R ; //offset 0x84
vu32 QSPI_MIR ; //offset 0x88
vu32 QSPI_CFGR ; //offset 0x8C
vu32 SBUS_START ; //offset 0x90
vu32 QSPI_HIT0R ; // offset 0x80
vu32 QSPI_HIT1R ; // offset 0x84
vu32 QSPI_MIR ; // offset 0x88
vu32 QSPI_CFGR ; // offset 0x8C
vu32 SBUS_START ; // offset 0x90
} FLASH_TypeDef;
#define NVM_CTRL_WR_LOCK *((volatile unsigned int *)(0x40000A04))
@@ -109,9 +108,9 @@ typedef struct {
#define PAGE_MAX 65536 // Max Page Size for Programming
#define CLK_FLASH_SEL 0x40000808
#define FLASH_52_CLK 0x0 //flash clk src 52MHz
#define FLASH_120_CLK 0x1 //flash clk src 120MHz
#define FLASH_240_CLK 0x2 //flash clk src 240MHz
#define FLASH_52_CLK 0x0 // flash clk src 52MHz
#define FLASH_120_CLK 0x1 // flash clk src 120MHz
#define FLASH_240_CLK 0x2 // flash clk src 240MHz
#define FLASH_QSPI_DIV4 0x09004801
#define FLASH_QSPI_DIV3 0x89004801
@@ -122,7 +121,6 @@ typedef struct {
#define FLASH_QSPI_DCR_2M 0x00140000
#define FLASH_QSPI_DCR_4M 0x00150000
#define CHIP_ERASE_CMD 0x0000160
#define SECTOR_ERASE_CMD 0x0002520
#define BLOCK32_ERASE_CMD 0x0002552
@@ -53,7 +53,6 @@
#define DUET_GPIO_TOTAL_NUM 24
/*
* Pin configuration
*/
@@ -214,6 +214,4 @@ __STATIC_INLINE void i2c_set_tb(I2C_TypeDef *I2Cx)
I2Cx->CR |= I2C_CR_TB;
}
#endif //_DUET_I2C_H_
@@ -86,7 +86,6 @@ extern "c" {
#define I2S_RX_WORDSIZE_MASK (0x7)
#define I2S_TX_WORDSIZE_MASK (0x7)
#define I2S_ROLE_MASTER (1)
#define I2S_ROLE_SLAVE (0)
@@ -104,8 +103,7 @@ extern "c" {
typedef void (*duet_i2s_callback_func)(uint32_t, uint32_t);
extern duet_i2s_callback_func g_duet_i2s_callback_handler;
typedef struct
{
typedef struct {
uint32_t i2s_sample_rate;
uint32_t i2s_mclk_src;
uint32_t i2s_ws;
@@ -117,7 +115,6 @@ extern "c" {
uint8_t i2s_mode;
} duet_i2s_dev_t;
__STATIC_INLINE ITstatus i2s_get_interrupt_status(I2S_TypeDef * I2Sx, uint32_t i2s_interrupt)
{
return (I2Sx->ISR & i2s_interrupt) ? SET : RESET;
@@ -16,14 +16,13 @@
#ifndef __DUET_PINMUX_H
#define __DUET_PINMUX_H
#include "duet.h"
#ifdef __cplusplus
extern "c" {
#endif
#include "duet.h"
typedef enum
{
typedef enum {
PAD0,
PAD1,
PAD2,
@@ -57,9 +56,7 @@ extern "c" {
PAD30
} Pad_Num_Type;
typedef enum
{
typedef enum {
PF_GPIO0, PF_GPIO1, PF_GPIO2, PF_GPIO3, PF_GPIO4, PF_GPIO5,
PF_GPIO6, PF_GPIO7, PF_GPIO8, PF_GPIO9, PF_GPIO10, PF_GPIO11,
PF_GPIO12, PF_GPIO13, PF_GPIO14, PF_GPIO15, PF_GPIO16, PF_GPIO17,
@@ -74,29 +71,25 @@ extern "c" {
PF_PSRAM
} Pad_Func_Type;
typedef enum
{
typedef enum {
Config_Success,
Config_Fail
} Pad_Config_State;
typedef enum
{
typedef enum {
PULL_DEFAULT = 0x00,
PULL_UP,
PULL_DOWN,
PULL_NONE
} Pad_Pull_Type;
typedef enum
{
typedef enum {
DS1DS0_00 = 0x00,
DS1DS0_01,
DS1DS0_10,
DS1DS0_11
} Pad_DS_Type;
Pad_Config_State duet_pinmux_config(Pad_Num_Type pad_num, Pad_Func_Type pad_func);
void duet_pad_config(Pad_Num_Type pad_num, Pad_Pull_Type pull_type);
@@ -104,8 +97,4 @@ extern "c" {
}
#endif
#endif /*__DUET_PINMUX_H */
#endif /*__DUET_PINMUX_H */
@@ -33,7 +33,6 @@
#define PSRAM_FLASH_B2_BASE PSRAM_FLASH_A1_TOP
#define PSRAM_FLASH_B2_TOP PSRAM_FLASH_A1_TOP
/**
*APS1604-SQR
*/
@@ -77,4 +76,4 @@ int psram_set_channel(duet_psram_channel channel);
*/
int psram_config(duet_psram_mode mode);
#endif //__PSRAM_PSRAM_H
#endif // __PSRAM_PSRAM_H
@@ -72,7 +72,6 @@ typedef struct {
uint32_t duet_ram_layout_init(Tcm_Config_Type tcm_config, Wifi_Ram_Config_Type wifi_config,
Bt_Ram_Config_Type bt_config);
/**
* Get the current ram layout parameters
*
@@ -16,7 +16,6 @@
#ifndef __DUET_RF_SPI_H__
#define __DUET_RF_SPI_H__
#define COMBO_SPI_CTRL_ADDR 0x4000B000
#define TRANS_MODE_OFT 0x0800
#define PRESCALER_OFT 0x0804
@@ -28,7 +27,7 @@
#define SPI_COMMAND COMBO_SPI_CTRL_ADDR
#define SPI_RDATA COMBO_SPI_CTRL_ADDR
void spi_mst_write(uint16_t addr, uint16_t data );
void spi_mst_write(uint16_t addr, uint16_t data);
uint16_t spi_mst_read(uint16_t addr);
uint16_t spi_sw_protect_read(uint16_t addr);
void spi_sw_protect_write(uint16_t addr, uint16_t data);
@@ -55,7 +55,6 @@ int duet_RND_Instantiation(CRYS_RND_Context_t
int duet_RND_UnInstantiation(CRYS_RND_Context_t *rndContext_ptr); /*!< [in/out] Pointer to the RND context
* buffer. */
/*!
@brief This function is used for reseeding the RNG with additional entropy and additional user-provided input.
(additional data should be provided by calling ::CRYS_RND_AddAdditionalInput prior to using this API).
@@ -68,7 +67,6 @@ int duet_RND_Reseeding(CRYS_RND_Context_t *rndContext_ptr, /*!< [in/out] Po
CRYS_RND_WorkBuff_t *rndWorkBuff_ptr /*!< [in/out] Scratchpad for the RND module's work. */
);
/****************************************************************************************/
/*!
@brief Generates a random vector according to the algorithm defined in referenced standard [SP800-90] - 10.2.1.5.2 - CTR-DRBG.
@@ -90,7 +88,6 @@ int duet_RND_GenerateVector(CRYS_RND_State_t
uint8_t *out_ptr /*!< [out] The pointer to output buffer. */
);
/****************************************************************************************/
/*!
@@ -111,7 +108,6 @@ int duet_RND_SetGenerateVectorFunc(CRYS_RND_Context_t
The pointer should point to the ::CRYS_RND_GenerateVector function. */
);
/**********************************************************************************************************/
/*!
@brief Generates a random vector with specific limitations by testing candidates (described and used in FIPS 186-4: B.1.2, B.4.2 etc.).
@@ -136,7 +132,6 @@ int duet_RND_GenerateVectorInRange(
Treated as little-endian byte array. */
);
/*************************************************************************************/
/*!
@brief Used for adding additional input/personalization data provided by the user,
@@ -74,7 +74,6 @@ extern "C" {
#define UART_DMA_TX_EN (1<<1)
#define UART_DMA_RX_EN (1<<0)
#define UART_IRDA_ENABLE (1<<1)
#define UART_IRDA_LP_EN (1<<2)
#define UART_CLK (52000000)
@@ -195,7 +194,6 @@ int32_t duet_uart_finalize(duet_uart_dev_t *uart);
void duet_uart_start(UART_TypeDef *UARTx);
void duet_uart_stop(UART_TypeDef *UARTx);
void duet_uart_set_callback(uint8_t uart_idx, duet_uart_callback_func func);
@@ -215,7 +213,6 @@ ITstatus duet_uart_get_flag_status(UART_TypeDef *UARTx, uint8_t uart_flag);
void UART_SendData(UART_TypeDef *UARTx, unsigned char Data);
uint8_t UART_ReceiveData(UART_TypeDef *UARTx);
#ifdef __cplusplus
}
#endif
@@ -329,4 +329,3 @@ void DMA_IRQHandler(void)
}
}
@@ -71,7 +71,7 @@ void duet_efuse_init(uint8_t ldo25_open)
uint8_t duet_efuse_byte_read(uint16_t addr)
{
EFUSE->B_ADDR = addr;
EFUSE->CFG_TYPE = 0x0;//read type
EFUSE->CFG_TYPE = 0x0; // read type
EFUSE->START = 0x1;
while (EFUSE->START & 0x1);
@@ -102,8 +102,8 @@ void duet_efuse_byte_write(uint16_t addr, uint8_t data)
{
EFUSE->PGM_DATA = data;
EFUSE->B_ADDR = addr;
EFUSE->CFG_TYPE = 0x1;//program type
EFUSE->WR_TYPE = 0x0;//write type: byte
EFUSE->CFG_TYPE = 0x1; // program type
EFUSE->WR_TYPE = 0x0; // write type: byte
EFUSE->START = 0x1;
while (EFUSE->START & 0x1);
}
@@ -117,8 +117,8 @@ void duet_efuse_word_write(uint16_t addr, uint32_t data)
{
EFUSE->PGM_DATA = data;
EFUSE->B_ADDR = addr;
EFUSE->CFG_TYPE = 0x1;//program type
EFUSE->WR_TYPE = 0x1;//write type: word
EFUSE->CFG_TYPE = 0x1; // program type
EFUSE->WR_TYPE = 0x1; // write type: word
EFUSE->START = 0x1;
while (EFUSE->START & 0x1);
}
@@ -269,7 +269,6 @@ int32_t duet_flash_erase(duet_partition_t in_partition, uint32_t off_set, uint32
return 0;
}
/**
* Write data to an area on a flash logical partition without erase
*
@@ -15,9 +15,9 @@
#include <stdlib.h>
#include <string.h>
#include "duet_flash_alg.h" // FlashOS Structures
#include "duet_cm4.h"
#include "duet.h"
#include "duet_flash_alg.h" // FlashOS Structures
FLASH_DRIVER_SEG void duet_flash_alg_cache_flush(void)
{
@@ -86,7 +86,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_check_abort_busy (void)
FLASH_DRIVER_SEG int duet_flash_alg_clr_flg (void)
{
/* Add your Code */
FLASH->QSPI_FCR = 0xF001B;//0x1F;
FLASH->QSPI_FCR = 0xF001B; // 0x1F;
FLASH->QSPI_FCR = 0x0;
return (0); // Finished without Errors
@@ -111,9 +111,9 @@ FLASH_DRIVER_SEG int duet_flash_alg_polling_wip (void)
FLASH->QSPI_CCR = 0x9000105;
var_rdata = FLASH->QSPI_CR;
FLASH->QSPI_CR = (var_rdata & 0xFFBFFFFF) + 0x400000; //QSPI_CR[22],apms= 1'b1;
FLASH->QSPI_DLR = 0x0;//one byte
FLASH->QSPI_PSMKR = 0x1;//mask = 0x1;
FLASH->QSPI_PSMAR = 0x0;//match = 0x0;
FLASH->QSPI_DLR = 0x0; // one byte
FLASH->QSPI_PSMKR = 0x1; // mask = 0x1;
FLASH->QSPI_PSMAR = 0x0; // match = 0x0;
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
duet_flash_alg_check_busy();
@@ -129,9 +129,9 @@ FLASH_DRIVER_SEG int duet_flash_alg_polling_wel (void)
FLASH->QSPI_CCR = 0x9000105;
var_rdata = FLASH->QSPI_CR;
FLASH->QSPI_CR = (var_rdata & 0xFFBFFFFF) + 0x400000; //QSPI_CR[22],apms= 1'b1;
FLASH->QSPI_DLR = 0x0;//one byte
FLASH->QSPI_PSMKR = 0x2;//mask = 0x1;
FLASH->QSPI_PSMAR = 0x2;//match = 0x0;
FLASH->QSPI_DLR = 0x0; // one byte
FLASH->QSPI_PSMKR = 0x2; // mask = 0x1;
FLASH->QSPI_PSMAR = 0x2; // match = 0x0;
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
duet_flash_alg_check_busy();
@@ -149,7 +149,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_setqe (unsigned char quad)
duet_flash_alg_abort_en();
duet_flash_alg_check_abort_busy();
FLASH->QSPI_CCR = 0x106;//IMODE=2'b01,INSTRUCTION=WREN
FLASH->QSPI_CCR = 0x106; // IMODE=2'b01,INSTRUCTION=WREN
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
@@ -157,12 +157,12 @@ FLASH_DRIVER_SEG int duet_flash_alg_setqe (unsigned char quad)
duet_flash_alg_polling_wel();
FLASH->QSPI_CCR =
0x01000101;//dumode=2'b00,fmode=2'b00,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h01;
FLASH->QSPI_DLR = 0x1;//two byte
0x01000101; // dumode=2'b00,fmode=2'b00,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h01;
FLASH->QSPI_DLR = 0x1; // two byte
if (quad == 0x1) {
FLASH->QSPI_DR = 0x200;
} else {
FLASH->QSPI_DR = 0x0; //0x200;
FLASH->QSPI_DR = 0x0; // 0x200;
}
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
@@ -189,7 +189,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_check_setqe (void)
duet_flash_alg_check_busy();
FLASH->QSPI_DLR = 0x0;
FLASH->QSPI_CCR =
0x5000135;//dumode=2'b00,fmode=2'b01,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h35;
0x5000135; // dumode=2'b00,fmode=2'b01,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h35;
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
@@ -284,7 +284,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_erase(unsigned int cmd, unsigned long adr)
duet_flash_alg_abort_en();
duet_flash_alg_check_abort_busy();
FLASH->QSPI_CCR = 0x106;//IMODE=2'b01,INSTRUCTION=WREN
FLASH->QSPI_CCR = 0x106; // IMODE=2'b01,INSTRUCTION=WREN
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
@@ -348,7 +348,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_programpage(unsigned long adr, unsigned long
duet_flash_alg_abort_en();
duet_flash_alg_check_abort_busy();
FLASH->QSPI_CCR = 0x106;//IMODE=2'b01,INSTRUCTION=WREN
FLASH->QSPI_CCR = 0x106; // IMODE=2'b01,INSTRUCTION=WREN
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
duet_flash_alg_f_delay(10);
@@ -356,7 +356,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_programpage(unsigned long adr, unsigned long
duet_flash_alg_polling_wel();
FLASH->QSPI_CCR =
0x1002502;//fmode=2'b00,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b10,admode=2'b01,imode=2'b01,instruction=8'h02;
0x1002502; // fmode=2'b00,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b10,admode=2'b01,imode=2'b01,instruction=8'h02;
FLASH->QSPI_DLR = sz_temp;
FLASH->QSPI_AR = adr;
while ((sz > 0) && (cnt < fthres)) {
@@ -457,7 +457,7 @@ FLASH_DRIVER_SEG int duet_flash_alg_read_id(void)
duet_flash_alg_check_abort_busy();
FLASH->QSPI_CCR =
0x500019F;//fmode=2'b01,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h9F;
0x500019F; // fmode=2'b01,dmode=2'b01,reserved=1'b0,dcyc=5'h0,absize=2'b00,abmode=2'b00,adsize=2'b00,admode=2'b00,imode=2'b01,instruction=8'h9F;
FLASH->QSPI_DLR = 0x2;
duet_flash_alg_clr_flg();
FLASH->SBUS_START = 0x1;
@@ -20,9 +20,9 @@
#define FLASH_CRYPT_EFUSE_KEY_ADDR 124
#define FLASH_CRYPT_EFUSE_ENABLE_ADDR 128
#define FLASH_CRYPT_EFUSE_KEY 0x12345678
#define FLASH_CRYPT_RESET *((volatile unsigned int *)(0x40005038)) //default 0, write 1 reset, HW auto clear
#define FLASH_CRYPT_RESET *((volatile unsigned int *)(0x40005038)) // default 0, write 1 reset, HW auto clear
#define FLASH_CRYPT_BIT_NUM 23 //bit0~bit22
#define FLASH_CRYPT_BIT_NUM 23 // bit0~bit22
int duet_flash_encrypt_status(void)
{
@@ -356,7 +356,7 @@ int32_t duet_gpio_enable_irq(duet_gpio_dev_t *gpio, duet_gpio_irq_trigger_t trig
} else {
return EIO;
}
NVIC_EnableIRQ(GPIO_IRQn); //0x10
NVIC_EnableIRQ(GPIO_IRQn); // 0x10
return 0;
}
@@ -119,8 +119,6 @@ void duet_i2c_interrupt_config(I2C_TypeDef *I2Cx, uint32_t I2C_interrupt_en, int
}
}
/**
* Initialises an I2C interface
* Prepares an I2C hardware interface for communication as a master or slave
@@ -852,6 +850,5 @@ void duet_i2c_master_dma_recv(uint8_t iic_idx, uint32_t *data, uint16_t len)
DMA->CHAN_EN_CLR |= ~(1 << dma_chan); // disable other channels
DMA->CHAN_EN_SET |= (1 << dma_chan); // enable channel
// free(pChan_Cfg);
}
@@ -74,7 +74,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
uint32_t tmp_value;
switch (pwm->port) {
case PWM_OUTPUT_CH0:
PWM->PWMCTL |= PWM_COUNT_MODE; //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= PWM_COUNT_MODE; // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM01LOAD & (~(0x0000FFFF));
tmp_value |= (SYSTEM_CLOCK / pwm->config.freq - 1);
PWM->PWM01LOAD = tmp_value;
@@ -85,7 +85,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM01DB = 0;
break;
case PWM_OUTPUT_CH1:
PWM->PWMCTL |= PWM_COUNT_MODE; //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= PWM_COUNT_MODE; // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM01LOAD & (~(0x0000FFFF));
tmp_value |= (SYSTEM_CLOCK / pwm->config.freq - 1);
PWM->PWM01LOAD = tmp_value;
@@ -96,7 +96,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM01DB = 0;
break;
case PWM_OUTPUT_CH2:
PWM->PWMCTL |= (PWM_COUNT_MODE << 1); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 1); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM01LOAD & (~(0xFFFF0000));
tmp_value |= ((uint16_t)(SYSTEM_CLOCK / pwm->config.freq - 1) << 16);
PWM->PWM01LOAD = tmp_value;
@@ -107,7 +107,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM01DB = 0;
break;
case PWM_OUTPUT_CH3:
PWM->PWMCTL |= (PWM_COUNT_MODE << 1); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 1); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM01LOAD & (~(0xFFFF0000));
tmp_value |= ((uint16_t)(SYSTEM_CLOCK / pwm->config.freq - 1) << 16);
PWM->PWM01LOAD = tmp_value;
@@ -118,7 +118,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM01DB = 0;
break;
case PWM_OUTPUT_CH4:
PWM->PWMCTL |= (PWM_COUNT_MODE << 2); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 2); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM23LOAD & (~(0x0000FFFF));
tmp_value |= (SYSTEM_CLOCK / pwm->config.freq - 1);
PWM->PWM23LOAD = tmp_value;
@@ -129,7 +129,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM23DB = 0;
break;
case PWM_OUTPUT_CH5:
PWM->PWMCTL |= (PWM_COUNT_MODE << 2); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 2); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM23LOAD & (~(0x0000FFFF));
tmp_value |= (SYSTEM_CLOCK / pwm->config.freq - 1);
PWM->PWM23LOAD = tmp_value;
@@ -140,7 +140,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM23DB = 0;
break;
case PWM_OUTPUT_CH6:
PWM->PWMCTL |= (PWM_COUNT_MODE << 3); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 3); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM23LOAD & (~(0xFFFF0000));
tmp_value |= ((uint16_t)(SYSTEM_CLOCK / pwm->config.freq - 1) << 16);
PWM->PWM23LOAD = tmp_value;
@@ -151,7 +151,7 @@ void duet_pwm_cfg(duet_pwm_dev_t *pwm)
PWM->PWM23DB = 0;
break;
case PWM_OUTPUT_CH7:
PWM->PWMCTL |= (PWM_COUNT_MODE << 3); //0: count-up mode, 1: count-up/down mode
PWM->PWMCTL |= (PWM_COUNT_MODE << 3); // 0: count-up mode, 1: count-up/down mode
tmp_value = PWM->PWM23LOAD & (~(0xFFFF0000));
tmp_value |= ((uint16_t)(SYSTEM_CLOCK / pwm->config.freq - 1) << 16);
PWM->PWM23LOAD = tmp_value;
@@ -110,7 +110,7 @@ uint16_t rf_sw_get_reg_bit(uint16_t reg, uint8_t start_bit, uint8_t len)
}
}
//// single wifi run and without PTA init,these api is useful
/// single wifi run and without PTA init,these api is useful
uint8_t hw_spi_pta = 0;
FLASH_COMMON2_SEG void spi_mst_write(uint16_t addr, uint16_t data)
@@ -224,4 +224,3 @@ uint16_t rf_get_reg_bit(uint16_t reg, uint8_t start_bit, uint8_t len)
}
}
@@ -28,7 +28,6 @@
/********************** Public Functions *************************/
/*****************************************************************************/
int duet_RND_Instantiation(CRYS_RND_Context_t *rndContext_ptr, CRYS_RND_WorkBuff_t *rndWorkBuff_ptr)
{
return CRYS_RND_Instantiation(rndContext_ptr, rndWorkBuff_ptr);
@@ -106,11 +106,10 @@ int32_t duet_timer_start(duet_timer_dev_t *tim)
//open TIMER interrupt
reg_value = REG_RD(DUTE_IRQ_EN_REG) & (~TIMER_IRQ_BIT);
REG_WR(DUTE_IRQ_EN_REG, (reg_value | (TIMER_IRQ_BIT)));
NVIC_EnableIRQ(TIMER_IRQn); //0x20
NVIC_EnableIRQ(TIMER_IRQn); // 0x20
return 0;
}
/**
* get hardware timer remain time
*
@@ -111,7 +111,6 @@ void duet_uart_interrupt_config(UART_TypeDef *UARTx, uint32_t uart_int, bool new
}
}
ITstatus duet_uart_get_interrupt_status(UART_TypeDef *UARTx, uint32_t uart_interrupt)
{
if ( UARTx->MIS & uart_interrupt ) {
@@ -424,7 +423,7 @@ static void UARTX_IRQHandler(uint8_t uart_idx)
/* read rx fifo till it's empty */
while ( ! duet_uart_get_flag_status(UARTx, UART_FLAG_RX_FIFO_EMPTY) ) {
tmp = (char)(UARTx->DR);//uart_receive_data(UART );
tmp = (char)(UARTx->DR); // uart_receive_data(UART );
if (g_duet_uart_callback_handler[uart_idx] != NULL) {
g_duet_uart_callback_handler[uart_idx](tmp);
}
@@ -481,7 +480,6 @@ void UART2_IRQHandler(void)
duet_intrpt_exit();
}
void duet_uart_set_callback(uint8_t uart_idx, duet_uart_callback_func func)
{
g_duet_uart_callback_handler[uart_idx] = func;
@@ -40,9 +40,7 @@ typedef enum {
LEGA_HASH_MD5_mode = 5, /*!< MD5 */
LEGA_HASH_NumOfModes,
LEGA_HASH_OperationModeLast = 0x7FFFFFFF,
} LEGA_HASH_OperationMode_t;
/*! Defines the HASH result buffer. */
@@ -22,7 +22,6 @@
void lega_rnd_init(void);
void lega_rnd_deinit(void);
/*!
@brief This function is used for reseeding the RNG with additional entropy and additional user-provided input.
(additional data should be provided by calling ::CRYS_RND_AddAdditionalInput prior to using this API).
@@ -36,7 +35,6 @@ int lega_RND_Reseeding(
uint8_t *rndWorkBuff_ptr /*!< [in/out] Scratchpad for the RND module's work. */
);
/****************************************************************************************/
/*!
@brief Generates a random vector according to the algorithm defined in referenced standard [SP800-90] - 10.2.1.5.2 - CTR-DRBG.
@@ -73,5 +71,4 @@ int lega_RND_AddAdditionalInput(
uint16_t additonalInputSize /*!< [in] The size of the Additional Input buffer. Must be <= 48, and a multiple of 4. */
);
#endif //_LEGA_RND_H_
@@ -177,7 +177,7 @@ typedef struct {
int client_num; /* linked station number */
lega_wlan_client_addr_info_t sta[4]; /* linked station entry, max client number is 4 */
} lega_wlan_ap_client_info_t;
/// start with dataelem struct declaration
// start with dataelem struct declaration
typedef enum {
MS_OK = 0,
MS_ERROR
@@ -268,8 +268,7 @@ MS_STATUS ms_hal_test_start(void);
* @return other : error occurred
*/
MS_STATUS ms_hal_test_report_get(ms_hal_test_report_t *report);
/// end of dataelem struct declaration
// end of dataelem struct declaration
/** @brief wifi init functin, user should call it before use any wifi cmd
* @return 0 : on success.
@@ -356,7 +355,6 @@ int lega_wlan_get_mac_address(uint8_t *mac_addr);
*/
void lega_wlan_set_mac_address(uint8_t *mac_addr);
/** @brief used in station mode, get the ip information
*
* @param void
@@ -365,7 +363,6 @@ void lega_wlan_set_mac_address(uint8_t *mac_addr);
*/
lega_wlan_ip_stat_t *lega_wlan_get_ip_status(void);
/** @brief used in station mode, get link status information
*
* @param link_status : refer to lega_wlan_link_stat_t
@@ -456,7 +453,6 @@ typedef void (*start_adv_cb_t)(lega_start_adv_results_e status);
*/
int lega_wlan_register_start_adv_cb(start_adv_cb_t fn);
/** @brief used in station mode or sniffer mode, call this cmd to send a MPDU constructed by user
*
* @param buf : mac header pointer of the MPDU
@@ -16,6 +16,6 @@
#ifndef __IPERF_PRINTF_H__
#define __IPERF_PRINTF_H__
//#define iperf_printf(...) LWIP_DEBUGF(IPERF_DEBUG,(__VA_ARGS__))
// #define iperf_printf(...) LWIP_DEBUGF(IPERF_DEBUG,(__VA_ARGS__))
#define iperf_printf printf
#endif
@@ -76,7 +76,6 @@ extern volatile IPERF_UDP_CLIENT_STATUS iperf_udp_client_status;
//extern volatile int iperf_tcp_client_running;
//extern volatile int iperf_udp_client_term;
struct lwip_iperf_outputInfo {
int seconds; //start time
u64_t lastByte;
@@ -206,7 +206,6 @@ void do_iperf_output(char *mode, struct lwip_iperf_outputInfo *outputInfo)
outputInfo->lastPacketNum = outputInfo->currentPacketNum;
}
void iperf_output(void *args)
{
printf("\nlalala %s\n", __func__);
@@ -78,6 +78,5 @@ int32_t duet_flash_kv_get(const char *key, void *buffer, int32_t *buffer_len);
*/
int32_t duet_flash_kv_del(const char *key);
#endif /* _DUET_FLASH_KV_H_ */
-53
View File
@@ -51,7 +51,6 @@ extern "C" {
Function-like macros are used to allow more efficient code.
*/
/*******************************************************************************
* CMSIS definitions
******************************************************************************/
@@ -161,7 +160,6 @@ extern "C" {
#include "cmsis_compiler.h" /* CMSIS compiler specific defines */
#ifdef __cplusplus
}
#endif
@@ -243,8 +241,6 @@ extern "C" {
/*@} end of group Cortex_M4 */
/*******************************************************************************
* Register Abstraction
Core Register contain:
@@ -304,7 +300,6 @@ typedef union {
#define APSR_GE_Pos 16U /*!< APSR: GE Position */
#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */
/**
\brief Union type to access the Interrupt Program Status Register (IPSR).
*/
@@ -320,7 +315,6 @@ typedef union {
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
/**
\brief Union type to access the Special-Purpose Program Status Registers (xPSR).
*/
@@ -373,7 +367,6 @@ typedef union {
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
/**
\brief Union type to access the Control Registers (CONTROL).
*/
@@ -399,7 +392,6 @@ typedef union {
/*@} end of group CMSIS_CORE */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
@@ -432,7 +424,6 @@ typedef struct {
/*@} end of group CMSIS_NVIC */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_SCB System Control Block (SCB)
@@ -898,7 +889,6 @@ typedef struct {
#define SCB_ABFSR_ITCM_Msk (1UL /*<< SCB_ABFSR_ITCM_Pos*/) /*!< SCB ABFSR: ITCM Mask */
/*@} end of group CMSIS_SCB */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
@@ -937,7 +927,6 @@ typedef struct {
/*@} end of group CMSIS_SCnotSCB */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_SysTick System Tick Timer (SysTick)
@@ -988,7 +977,6 @@ typedef struct {
/*@} end of group CMSIS_SysTick */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM)
@@ -1074,7 +1062,6 @@ typedef struct {
/*@}*/ /* end of group CMSIS_ITM */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_DWT Data Watchpoint and Trace (DWT)
@@ -1220,7 +1207,6 @@ typedef struct {
/*@}*/ /* end of group CMSIS_DWT */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_TPI Trace Port Interface (TPI)
@@ -1380,7 +1366,6 @@ typedef struct {
/*@}*/ /* end of group CMSIS_TPI */
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
/**
\ingroup CMSIS_core_register
@@ -1476,7 +1461,6 @@ typedef struct {
/*@} end of group CMSIS_MPU */
#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_FPU Floating Point Unit (FPU)
@@ -1587,7 +1571,6 @@ typedef struct {
/*@} end of group CMSIS_FPU */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
@@ -1691,7 +1674,6 @@ typedef struct {
/*@} end of group CMSIS_CoreDebug */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_core_bitfield Core register bit field macros
@@ -1717,7 +1699,6 @@ typedef struct {
/*@} end of group CMSIS_core_bitfield */
/**
\ingroup CMSIS_core_register
\defgroup CMSIS_core_base Core Definitions
@@ -1754,8 +1735,6 @@ typedef struct {
/*@} */
/*******************************************************************************
* Hardware Abstraction Layer
Core Function Interface contains:
@@ -1768,8 +1747,6 @@ typedef struct {
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
*/
/* ########################## NVIC functions #################################### */
/**
\ingroup CMSIS_Core_FunctionInterface
@@ -1810,7 +1787,6 @@ typedef struct {
#define NVIC_USER_IRQ_OFFSET 16
/* The following EXC_RETURN values are saved the LR on exception entry */
#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
@@ -1819,7 +1795,6 @@ typedef struct {
#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */
#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */
/**
\brief Set Priority Grouping
\details Sets the priority grouping field using the required unlock sequence.
@@ -1842,7 +1817,6 @@ __STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
SCB->AIRCR = reg_value;
}
/**
\brief Get Priority Grouping
\details Reads the priority grouping field from the NVIC Interrupt Controller.
@@ -1853,7 +1827,6 @@ __STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void)
return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos));
}
/**
\brief Enable Interrupt
\details Enables a device specific interrupt in the NVIC interrupt controller.
@@ -1869,7 +1842,6 @@ __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
}
}
/**
\brief Get Interrupt Enable status
\details Returns a device specific interrupt enable status from the NVIC interrupt controller.
@@ -1888,7 +1860,6 @@ __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
}
}
/**
\brief Disable Interrupt
\details Disables a device specific interrupt in the NVIC interrupt controller.
@@ -1904,7 +1875,6 @@ __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
}
}
/**
\brief Get Pending Interrupt
\details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
@@ -1923,7 +1893,6 @@ __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
}
}
/**
\brief Set Pending Interrupt
\details Sets the pending bit of a device specific interrupt in the NVIC pending register.
@@ -1937,7 +1906,6 @@ __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
}
}
/**
\brief Clear Pending Interrupt
\details Clears the pending bit of a device specific interrupt in the NVIC pending register.
@@ -1951,7 +1919,6 @@ __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
}
}
/**
\brief Get Active Interrupt
\details Reads the active register in the NVIC and returns the active bit for the device specific interrupt.
@@ -1970,7 +1937,6 @@ __STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn)
}
}
/**
\brief Set Interrupt Priority
\details Sets the priority of a device specific interrupt or a processor exception.
@@ -1989,7 +1955,6 @@ __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
}
}
/**
\brief Get Interrupt Priority
\details Reads the priority of a device specific interrupt or a processor exception.
@@ -2009,7 +1974,6 @@ __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
}
}
/**
\brief Encode Priority
\details Encodes the priority for an interrupt with the given priority group,
@@ -2038,7 +2002,6 @@ __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t P
);
}
/**
\brief Decode Priority
\details Decodes an interrupt priority value with a given priority group to
@@ -2066,7 +2029,6 @@ __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGr
*pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL);
}
/**
\brief Set Interrupt Vector
\details Sets an interrupt vector in SRAM based interrupt vector table.
@@ -2083,7 +2045,6 @@ __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
/* ARM Application Note 321 states that the M4 does not require the architectural barrier */
}
/**
\brief Get Interrupt Vector
\details Reads an interrupt vector from interrupt vector table.
@@ -2098,7 +2059,6 @@ __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
}
/**
\brief System Reset
\details Initiates a system reset request to reset the MCU.
@@ -2119,7 +2079,6 @@ __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
/*@} end of CMSIS_Core_NVICFunctions */
/* ########################## MPU functions #################################### */
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U)
@@ -2128,7 +2087,6 @@ __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
#endif
/* ########################## FPU functions #################################### */
/**
\ingroup CMSIS_Core_FunctionInterface
@@ -2157,11 +2115,8 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
}
}
/*@} end of CMSIS_Core_FpuFunctions */
/* ################################## SysTick function ############################################ */
/**
\ingroup CMSIS_Core_FunctionInterface
@@ -2202,8 +2157,6 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
/*@} end of CMSIS_Core_SysTickFunctions */
/* ##################################### Debug In/Output function ########################################### */
/**
\ingroup CMSIS_Core_FunctionInterface
@@ -2215,7 +2168,6 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */
#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */
/**
\brief ITM Send Character
\details Transmits a character via the ITM channel 0, and
@@ -2236,7 +2188,6 @@ __STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch)
return (ch);
}
/**
\brief ITM Receive Character
\details Inputs a character via the external variable \ref ITM_RxBuffer.
@@ -2255,7 +2206,6 @@ __STATIC_INLINE int32_t ITM_ReceiveChar (void)
return (ch);
}
/**
\brief ITM Check Character
\details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer.
@@ -2274,9 +2224,6 @@ __STATIC_INLINE int32_t ITM_CheckChar (void)
/*@} end of CMSIS_core_DebugFunctions */
#ifdef __cplusplus
}
#endif
+4 -7
View File
@@ -23,7 +23,6 @@
****************************************************************************************
*/
/************************* **************************************/
#ifndef __DUET_CM4_H__
#define __DUET_CM4_H__
@@ -81,10 +80,6 @@ typedef enum IRQn {
RW_BLE_IRQn = 25, /*!< BLE Interrupt */
} IRQn_Type;
#ifdef DUET_CM4
#include "core_cm4.h"
#include "cachel1_armv7.h"
#endif
// ---------------------------------------------------------------------------
typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITstatus;
typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
@@ -244,7 +239,6 @@ typedef struct {
#define MIDEA_INFO_BKUP_START_ADDR 0x101FF000
#define NVDS_FLASH_START_ADDR 0x1037E000
#define OTA_FLASH_START_ADDR 0x10200000 //can't change
#define KV_FLASH_START_ADDR (OTA_FLASH_START_ADDR+OTA_MAX_SIZE)//0x10366000
@@ -322,7 +316,10 @@ typedef struct {
}
#endif /* __cplusplus */
#ifdef DUET_CM4
#include "core_cm4.h"
#include "cachel1_armv7.h"
#endif
#endif // __DUET_CM4_H__
@@ -34,7 +34,6 @@ typedef struct {
unsigned int mair1; /*!< Offset: 0x034 (R/W) MPU Memory Attribute Indirection Register 1 */
} MPU_t;
/* System Handler Control and State register */
#define SHCSR_M ((unsigned int*)0xE000ED24UL)
@@ -131,7 +130,6 @@ typedef struct {
#define REGION_ENABLE (0x1)
#define REGION_DISABLE (0x0)
/* MPU regions size */
#define MPU_REGION_SIZE_32B (0x04U)
@@ -171,7 +169,6 @@ typedef struct {
#define MPU_AP_RO_NA (0x05U)
#define MPU_AP_RO_RO (0x06U)
typedef struct {
unsigned long base_addr;
unsigned char range_no;
@@ -186,7 +183,6 @@ typedef struct {
unsigned char enable;
} MPU_Region_Init_t;
/**
* set mpu region for memory unauthorized access check
*
@@ -219,7 +215,6 @@ typedef struct {
unsigned int rasr_a3;
} MPU_t;
/* System Handler Control and State register */
#define SHCSR_M ((unsigned int*)0xE000ED24UL)
@@ -308,7 +303,6 @@ typedef struct {
#define MPU_RASR_ENABLE_MASK (1UL)
/* MPU regions size */
#define MPU_REGION_SIZE_32B (0x04U)
@@ -348,7 +342,6 @@ typedef struct {
#define MPU_AP_RO_NA (0x05U)
#define MPU_AP_RO_RO (0x06U)
typedef struct {
unsigned long base_addr;
unsigned char range_no;
@@ -80,33 +80,4 @@ uint8_t lega_drv_wakeup_gpio_is_valid(uint8_t wakeup_gpio);
*/
void lega_drv_goto_deepsleep(uint32_t sleep_ms, uint8_t wakeup_gpio);
#endif //__PMU_H
#endif //__PMU_H
@@ -16,9 +16,13 @@
#ifndef __SYSTICK_DELAY_H
#define __SYSTICK_DELAY_H
#include "duet_cm4.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
#ifdef ALIOS_SUPPORT
uint32_t duet_systick_csr_get();
@@ -29,34 +33,11 @@ void delay_us(u32 nus);
void delay_ms(u32 nms);
void delay_xms(u32 nms);
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif //__SYSTICK_DELAY_H
#endif // __SYSTICK_DELAY_H
@@ -102,24 +102,20 @@
#define FLAGS_PRECISION (1U << 10U)
#define FLAGS_ADAPT_EXP (1U << 11U)
// import float.h for DBL_MAX
#if defined(PRINTF_SUPPORT_FLOAT)
#include <float.h>
#endif
// output function type
typedef void (*out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen);
// wrapper (used as buffer) for output function type
typedef struct {
void (*fct)(char character, void *arg);
void *arg;
} out_fct_wrap_type;
// internal buffer output
static inline void _out_buffer(char character, void *buffer, size_t idx, size_t maxlen)
{
@@ -128,7 +124,6 @@ static inline void _out_buffer(char character, void *buffer, size_t idx, size_t
}
}
// internal null output
static inline void _out_null(char character, void *buffer, size_t idx, size_t maxlen)
{
@@ -138,7 +133,6 @@ static inline void _out_null(char character, void *buffer, size_t idx, size_t ma
(void)maxlen;
}
// internal _putchar wrapper
static inline void _out_char(char character, void *buffer, size_t idx, size_t maxlen)
{
@@ -150,7 +144,6 @@ static inline void _out_char(char character, void *buffer, size_t idx, size_t ma
}
}
// internal output function wrapper
static inline void _out_fct(char character, void *buffer, size_t idx, size_t maxlen)
{
@@ -162,7 +155,6 @@ static inline void _out_fct(char character, void *buffer, size_t idx, size_t max
}
}
// internal secure strlen
// \return The length of the string (excluding the terminating 0) limited by 'maxsize'
static inline unsigned int _strnlen_s(const char *str, size_t maxsize)
@@ -172,7 +164,6 @@ static inline unsigned int _strnlen_s(const char *str, size_t maxsize)
return (unsigned int)(s - str);
}
// internal test if char is a digit (0-9)
// \return true if char is a digit
static inline bool _is_digit(char ch)
@@ -180,7 +171,6 @@ static inline bool _is_digit(char ch)
return (ch >= '0') && (ch <= '9');
}
// internal ASCII string to unsigned int conversion
static unsigned int _atoi(const char **str)
{
@@ -191,7 +181,6 @@ static unsigned int _atoi(const char **str)
return i;
}
// output the specified string in reverse, taking care of any zero-padding
static size_t _out_rev(out_fct_type out, char *buffer, size_t idx, size_t maxlen, const char *buf, size_t len,
unsigned int width, unsigned int flags)
@@ -220,7 +209,6 @@ static size_t _out_rev(out_fct_type out, char *buffer, size_t idx, size_t maxlen
return idx;
}
// internal itoa format
static size_t _ntoa_format(out_fct_type out, char *buffer, size_t idx, size_t maxlen, char *buf, size_t len,
bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
@@ -271,7 +259,6 @@ static size_t _ntoa_format(out_fct_type out, char *buffer, size_t idx, size_t ma
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
}
// internal itoa for 'long' type
static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative,
unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
@@ -296,7 +283,6 @@ static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxl
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags);
}
// internal itoa for 'long long' type
#if defined(PRINTF_SUPPORT_LONG_LONG)
static size_t _ntoa_long_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long long value,
@@ -323,7 +309,6 @@ static size_t _ntoa_long_long(out_fct_type out, char *buffer, size_t idx, size_t
}
#endif // PRINTF_SUPPORT_LONG_LONG
#if defined(PRINTF_SUPPORT_FLOAT)
#if defined(PRINTF_SUPPORT_EXPONENTIAL)
@@ -332,7 +317,6 @@ static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, d
unsigned int width, unsigned int flags);
#endif
// internal ftoa for fixed decimal floating point
static size_t _ftoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec,
unsigned int width, unsigned int flags)
@@ -459,7 +443,6 @@ static size_t _ftoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, d
return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
}
#if defined(PRINTF_SUPPORT_EXPONENTIAL)
// internal ftoa variant for exponential floating-point type, contributed by Martijn Jasperse <m.jasperse@gmail.com>
static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, double value, unsigned int prec,
@@ -572,7 +555,6 @@ static size_t _etoa(out_fct_type out, char *buffer, size_t idx, size_t maxlen, d
#endif // PRINTF_SUPPORT_EXPONENTIAL
#endif // PRINTF_SUPPORT_FLOAT
// internal vsnprintf
static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const char *format, va_list va)
{
@@ -879,9 +861,6 @@ static int _vsnprintf(out_fct_type out, char *buffer, const size_t maxlen, const
return (int)idx;
}
///////////////////////////////////////////////////////////////////////////////
int __wrap_printf(const char *format, ...)
{
va_list va;
@@ -892,7 +871,6 @@ int __wrap_printf(const char *format, ...)
return ret;
}
int __wrap_sprintf(char *buffer, const char *format, ...)
{
va_list va;
@@ -902,7 +880,6 @@ int __wrap_sprintf(char *buffer, const char *format, ...)
return ret;
}
int __wrap_snprintf(char *buffer, size_t count, const char *format, ...)
{
va_list va;
@@ -939,7 +916,6 @@ static inline void _out_char_2(char character, void *buffer, size_t idx, size_t
}
}
int printf2(const char *format, ...)
{
va_list va;
@@ -96,7 +96,6 @@ static struct cli_command rfota_ble_cmd = {
.function = lega_enable_rfota_ble_test,
};
void lega_rfota_ble_test_at_init(void)
{
aos_cli_register_command(&rfota_ble_cmd);
@@ -106,7 +106,6 @@ static struct cli_command rfota_wifi_cmd = {
.function = lega_enable_rfota_wifi_test,
};
void lega_rfota_wifi_test_at_init(void)
{
aos_cli_register_command(&rfota_wifi_cmd);
@@ -109,7 +109,6 @@ void lalala_test2(void)
(void)memset_s(&init_param, sizeof(init_param), 0, sizeof(init_param));
}
extern lega_semaphore_t lega_wlan_vendor_close_sta_semaphore;
WifiErrorCode DisableWifi(void)
{
@@ -641,7 +640,6 @@ void wifi_event_cb(lega_wlan_event_e evt, void *info)
}
}
WifiErrorCode RegisterWifiEvent(WifiEvent *event)
{
printf("%s\r\n", __func__);
+1 -6
View File
@@ -145,7 +145,7 @@ OSStatus lega_rtos_delete_thread( lega_thread_t *thread )
}
return kNoErr;
}
////////////////////////////// semaphore //////////////////////////////////////
///////////////////////////// semaphore //////////////////////////////////////
/*******************************************************************
* Name:lega_rtos_init_semaphore
@@ -200,7 +200,6 @@ FLASH_COMMON2_SEG OSStatus lega_rtos_set_semaphore( lega_semaphore_t *semaphore
return kNoErr;
}
OSStatus lega_rtos_deinit_semaphore( lega_semaphore_t *semaphore )
{
osStatus_t ret;
@@ -295,7 +294,6 @@ OSStatus lega_rtos_init_queue( lega_queue_t *queue, const char *name, uint32_t m
return kNoErr;
}
OSStatus lega_rtos_push_to_queue( lega_queue_t *queue, void *message, uint32_t timeout_ms )
{
osStatus_t ret;
@@ -341,8 +339,6 @@ OSStatus lega_rtos_deinit_queue( lega_queue_t *queue )
return kNoErr;
}
OSBool lega_rtos_is_queue_empty( lega_queue_t *queue )
{
OSBool ret;
@@ -449,7 +445,6 @@ OSStatus lega_rtos_init_timer_name( lega_timer_t *timer, uint32_t time_ms, timer
}
#endif
OSStatus lega_rtos_start_timer( lega_timer_t *timer )
{
if (!timer) {
+1 -23
View File
@@ -17,8 +17,8 @@
#define __LEGARTOS_H__
#include <ctype.h>
#include <stdint.h>
#include <stdbool.h>
#include "lega_rtos_port.h"
#include <stdbool.h>
#include "los_interrupt.h"
#define LEGA_NEVER_TIMEOUT (0xFFFFFFFF)
@@ -108,7 +108,6 @@ typedef struct {
typedef uint32_t lega_thread_arg_t;
typedef void (*lega_thread_function_t)( lega_thread_arg_t arg );
/** @defgroup LEGA_RTOS_Thread LEGA RTOS Thread Management Functions
* @brief Provide thread creation, delete, suspend, resume, and other RTOS management API
* @verbatim
@@ -182,9 +181,6 @@ OSStatus lega_rtos_create_thread( lega_thread_t *thread, uint8_t priority, const
*/
OSStatus lega_rtos_delete_thread( lega_thread_t *thread );
/** @defgroup LEGA_RTOS_SEM LEGA RTOS Semaphore Functions
* @brief Provide management APIs for semaphore such as init,set,get and dinit.
* @{
@@ -200,7 +196,6 @@ OSStatus lega_rtos_delete_thread( lega_thread_t *thread );
*/
OSStatus lega_rtos_init_semaphore( lega_semaphore_t *semaphore, int count );
/** @brief Set (post/put/increment) a semaphore
*
* @param semaphore : a pointer to the semaphore handle to be set
@@ -210,7 +205,6 @@ OSStatus lega_rtos_init_semaphore( lega_semaphore_t *semaphore, int count );
*/
OSStatus lega_rtos_set_semaphore( lega_semaphore_t *semaphore );
/** @brief Get (wait/decrement) a semaphore
*
* @Details Attempts to get (wait/decrement) a semaphore. If semaphore is at zero already,
@@ -225,7 +219,6 @@ OSStatus lega_rtos_set_semaphore( lega_semaphore_t *semaphore );
*/
OSStatus lega_rtos_get_semaphore( lega_semaphore_t *semaphore, uint32_t timeout_ms );
/** @brief De-initialise a semaphore
*
* @Details Deletes a semaphore created with @ref lega_rtos_init_semaphore
@@ -237,8 +230,6 @@ OSStatus lega_rtos_get_semaphore( lega_semaphore_t *semaphore, uint32_t timeout_
*/
OSStatus lega_rtos_deinit_semaphore( lega_semaphore_t *semaphore );
/** @brief if the task num pending by this semaphore is 0
*
* @Details if the task num pending by this semaphore is 0
@@ -272,7 +263,6 @@ OSBool lega_rtos_semaphore_pending_task_null( lega_semaphore_t *semaphore );
*/
OSStatus lega_rtos_init_mutex( lega_mutex_t *mutex );
/** @brief Obtains the lock on a mutex
*
* @Details Attempts to obtain the lock on a mutex. If the lock is already held
@@ -286,7 +276,6 @@ OSStatus lega_rtos_init_mutex( lega_mutex_t *mutex );
*/
OSStatus lega_rtos_lock_mutex( lega_mutex_t *mutex, uint32_t timeout_ms );
/** @brief Releases the lock on a mutex
*
* @Details Releases a currently held lock on a mutex. If another thread
@@ -299,7 +288,6 @@ OSStatus lega_rtos_lock_mutex( lega_mutex_t *mutex, uint32_t timeout_ms );
*/
OSStatus lega_rtos_unlock_mutex( lega_mutex_t *mutex );
/** @brief De-initialise a mutex
*
* @Details Deletes a mutex created with @ref lega_rtos_init_mutex
@@ -332,7 +320,6 @@ OSStatus lega_rtos_deinit_mutex( lega_mutex_t *mutex );
OSStatus lega_rtos_init_queue( lega_queue_t *queue, const char *name, uint32_t message_size,
uint32_t number_of_messages );
/** @brief Pushes an object onto a queue
*
* @param queue : a pointer to the queue handle
@@ -345,7 +332,6 @@ OSStatus lega_rtos_init_queue( lega_queue_t *queue, const char *name, uint32_t m
*/
OSStatus lega_rtos_push_to_queue( lega_queue_t *queue, void *message, uint32_t timeout_ms );
/** @brief Pops an object off a queue
*
* @param queue : a pointer to the queue handle
@@ -361,7 +347,6 @@ OSStatus lega_rtos_push_to_queue( lega_queue_t *queue, void *message, uint32_t t
*/
OSStatus lega_rtos_pop_from_queue( lega_queue_t *queue, void *message, uint32_t timeout_ms );
/** @brief De-initialise a queue created with @ref lega_rtos_init_queue
*
* @param queue : a pointer to the queue handle
@@ -371,7 +356,6 @@ OSStatus lega_rtos_pop_from_queue( lega_queue_t *queue, void *message, uint32_t
*/
OSStatus lega_rtos_deinit_queue( lega_queue_t *queue );
/** @brief Check if a queue is empty
*
* @param queue : a pointer to the queue handle
@@ -381,7 +365,6 @@ OSStatus lega_rtos_deinit_queue( lega_queue_t *queue );
*/
OSBool lega_rtos_is_queue_empty( lega_queue_t *queue );
/** @brief Check if a queue is full
*
* @param queue : a pointer to the queue handle
@@ -434,7 +417,6 @@ OSStatus lega_rtos_init_timer( lega_timer_t *timer, uint32_t time_ms, timer_hand
*/
OSStatus lega_rtos_start_timer( lega_timer_t *timer );
/** @brief Stops a running RTOS timer
*
* @note Timer must have been previously started with @ref lega_rtos_init_timer
@@ -446,7 +428,6 @@ OSStatus lega_rtos_start_timer( lega_timer_t *timer );
*/
OSStatus lega_rtos_stop_timer( lega_timer_t *timer );
/** @brief Reloads a RTOS timer that has expired
*
* @note This is usually called in the timer callback handler, to
@@ -459,7 +440,6 @@ OSStatus lega_rtos_stop_timer( lega_timer_t *timer );
*/
OSStatus lega_rtos_reload_timer( lega_timer_t *timer );
/** @brief De-initialise a RTOS timer
*
* @note Deletes a RTOS timer created with @ref lega_rtos_init_timer
@@ -471,7 +451,6 @@ OSStatus lega_rtos_reload_timer( lega_timer_t *timer );
*/
OSStatus lega_rtos_deinit_timer( lega_timer_t *timer );
/** @brief Check if an RTOS timer is running
*
* @param timer : a pointer to the RTOS timer handle
@@ -503,7 +482,6 @@ uint32_t lega_rtos_get_time(void);
OSStatus lega_rtos_delay_milliseconds( uint32_t num_ms );
#endif
#define lega_rtos_malloc(s) _lega_rtos_malloc(s,__FUNCTION__,__LINE__)
void *_lega_rtos_malloc(uint32_t xWantedSize, const char *function, uint32_t line);
void lega_rtos_free(void *mem);
@@ -16,7 +16,6 @@
#ifndef __LEGA_RTOS_PORT_H__
#define __LEGA_RTOS_PORT_H__
#include "los_arch_context.h"
#endif //__LEGA_RTOS_PORT_H__
+1 -2
View File
@@ -21,7 +21,6 @@
#include "duet_pinmux.h"
#include "lega_at_api.h"
#include "arch.h"
#include "board.h"
#ifdef _SPI_FLASH_ENABLE_
#include "duet_flash_alg.h"
#include "duet_flash.h"
@@ -33,6 +32,7 @@
#include "los_interrupt.h"
#include "target_config.h"
#include "uart.h"
#include "board.h"
#include "los_arch_interrupt.h"
#include "lega_rtos.h"
@@ -110,7 +110,6 @@ void NVIC_deinit(void)
NVIC_DisableIRQ(RW_BLE_IRQn);
}
void os_post_init_hook(void)
{
lega_rtos_declare_critical();
+1 -3
View File
@@ -35,7 +35,7 @@ defined in linker script */
/* start address for the .func section. defined in linker script */
.word _sfunc
/* end address for the .func section. defined in linker script */
.word _efunc
.word _efunc
/* start address for the .bss section. defined in linker script */
.word _sbss
/* end address for the .bss section. defined in linker script */
@@ -136,7 +136,6 @@ Infinite_Loop:
.type g_pfnVectors, %object
.size g_pfnVectors, .-g_pfnVectors
g_pfnVectors:
.word _estack
.word Reset_Handler
@@ -183,7 +182,6 @@ g_pfnVectors:
.word I2S_IRQHandler /* I2S */
.word BLE_IRQHandler /* BLE Interrupt */
/*******************************************************************************
*
* Provide weak aliases for each Exception handler to the Default_Handler.
-1
View File
@@ -151,5 +151,4 @@ extern unsigned char __los_heap_addr_end__[];
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* _TARGET_CONFIG_H */
@@ -16,7 +16,6 @@ import sys
import struct
import binascii
def crc32(data):
return (binascii.crc32(data) & 0xffffffff)