hpw421初始版本

This commit is contained in:
xushaoxiang
2026-06-06 16:49:48 +08:00
commit 2339bbfd1f
3283 changed files with 860261 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+190
View File
@@ -0,0 +1,190 @@
/**
****************************************************************************************
*
* @file rwip_task.h
*
* @brief Task Identifier description for the RW IP
*
* Copyright (C) RivieraWaves 2009-2016
*
****************************************************************************************
*/
#ifndef RWIP_TASK_H_
#define RWIP_TASK_H_
/**
****************************************************************************************
* @addtogroup ROOT
* @{
*
* Information about RW SW TASK
*
* @name RW TASK Configuration
* @{
****************************************************************************************
*/
#include <stdint.h>
/*
* DEFINES
****************************************************************************************
*/
/// Build the first message ID of a task. (in fact a ke_msg_id_t)
#define TASK_FIRST_MSG(task) ((uint16_t)((task) << 8))
/// Builds the task identifier from the type and the index of that task.
#define TASK_BUILD(type, index) ((uint16_t)(((index) << 8)|(type)) )
/// Retrieves task type from task id.
#define TASK_TYPE_GET(ke_task_id) (((uint16_t)ke_task_id) & 0xFF)
/// Retrieves task index number from task id.
#define TASK_IDX_GET(ke_task_id) ((((uint16_t)ke_task_id) >> 8) & 0xFF)
/// Message identifier index
#define MSG_ID(task, idx) (TASK_FIRST_MSG((TASK_ID_ ## task)) + idx)
/// Tasks types definition, this value shall be in [0-254] range
/*@TRACE*/
enum TASK_API_ID
{
// -----------------------------------------------------------------------------------
// ---------------------- Controller Task identifer ----------------------------------
// -----------------------------------------------------------------------------------
// Link Layer Tasks
TASK_ID_LLM = 0, // BLE Link manager
TASK_ID_LLC = 1, // BLE Link controller
TASK_ID_LLD = 2, // BLE Link driver
TASK_ID_LLI = 3, // BLE Link ISO
TASK_ID_DBG = 4, // Debug task
// BT Controller Tasks
TASK_ID_LM = 5, // BT Link manager
TASK_ID_LC = 6, // BT Link controller
TASK_ID_LB = 7, // BT Broadcast
TASK_ID_LD = 8, // BT Link driver
// -----------------------------------------------------------------------------------
// --------------------- BLE HL TASK API Identifiers ---------------------------------
// --------------------- SHALL NOT BE CHANGED ---------------------------------
// -----------------------------------------------------------------------------------
TASK_ID_L2CAP = 10, // L2CAP Task
TASK_ID_GATT = 11, // Generic Attribute Profile Task
TASK_ID_GAPM = 13, // Generic Access Profile Manager
TASK_ID_GAPC = 14, // Generic Access Profile Controller
TASK_ID_APP = 15, // Application API
// -----------------------------------------------------------------------------------
// --------------------- TRANSPORT AND PLATFORM TASKS --------------------------------
// -----------------------------------------------------------------------------------
TASK_ID_AHI = 16, // Application Host Interface
TASK_ID_HCI = 17, // Host to Control Interface
TASK_ID_DISPLAY = 19, // LCD/Display task
// -----------------------------------------------------------------------------------
// --------------------- BLE Profile TASK API Identifiers ----------------------------
// --------------------- SHALL NOT BE CHANGED ---------------------------------
// -----------------------------------------------------------------------------------
TASK_ID_DISS = 20, // Device Information Service Server Task
TASK_ID_DISC = 21, // Device Information Service Client Task
TASK_ID_PROXM = 22, // Proximity Monitor Task
TASK_ID_PROXR = 23, // Proximity Reporter Task
TASK_ID_FINDL = 24, // Find Me Locator Task
TASK_ID_FINDT = 25, // Find Me Target Task
TASK_ID_HTPC = 26, // Health Thermometer Collector Task
TASK_ID_HTPT = 27, // Health Thermometer Sensor Task
TASK_ID_BLPS = 28, // Blood Pressure Sensor Task
TASK_ID_BLPC = 29, // Blood Pressure Collector Task
TASK_ID_HRPS = 30, // Heart Rate Sensor Task
TASK_ID_HRPC = 31, // Heart Rate Collector Task
TASK_ID_TIPS = 32, // Time Server Task
TASK_ID_TIPC = 33, // Time Client Task
TASK_ID_SCPPS = 34, // Scan Parameter Profile Server Task
TASK_ID_SCPPC = 35, // Scan Parameter Profile Client Task
TASK_ID_BASS = 36, // Battery Service Server Task
TASK_ID_BASC = 37, // Battery Service Client Task
TASK_ID_HOGPD = 38, // HID Device Task
TASK_ID_HOGPBH = 39, // HID Boot Host Task
TASK_ID_HOGPRH = 40, // HID Report Host Task
TASK_ID_GLPS = 41, // Glucose Profile Sensor Task
TASK_ID_GLPC = 42, // Glucose Profile Collector Task
TASK_ID_RSCPS = 43, // Running Speed and Cadence Profile Server Task
TASK_ID_RSCPC = 44, // Running Speed and Cadence Profile Collector Task
TASK_ID_CSCPS = 45, // Cycling Speed and Cadence Profile Server Task
TASK_ID_CSCPC = 46, // Cycling Speed and Cadence Profile Client Task
TASK_ID_ANPS = 47, // Alert Notification Profile Server Task
TASK_ID_ANPC = 48, // Alert Notification Profile Client Task
TASK_ID_PASPS = 49, // Phone Alert Status Profile Server Task
TASK_ID_PASPC = 50, // Phone Alert Status Profile Client Task
TASK_ID_CPPS = 51, // Cycling Power Profile Server Task
TASK_ID_CPPC = 52, // Cycling Power Profile Client Task
TASK_ID_LANS = 53, // Location and Navigation Profile Server Task
TASK_ID_LANC = 54, // Location and Navigation Profile Client Task
TASK_ID_IPSS = 55, // Internet Protocol Support Profile Server Task
TASK_ID_IPSC = 56, // Internet Protocol Support Profile Client Task
TASK_ID_ENVS = 57, // Environmental Sensing Profile Server Task
TASK_ID_ENVC = 58, // Environmental Sensing Profile Client Task
TASK_ID_WSCS = 59, // Weight Scale Profile Server Task
TASK_ID_WSCC = 60, // Weight Scale Profile Client Task
TASK_ID_UDSS = 61, // User Data Service Server Task
TASK_ID_UDSC = 62, // User Data Service Client Task
TASK_ID_BCSS = 63, // Body Composition Server Task
TASK_ID_BCSC = 64, // Body Composition Client Task
TASK_ID_WPTS = 65, // Wireless Power Transfer Profile Server Task
TASK_ID_WPTC = 66, // Wireless Power Transfer Profile Client Task
TASK_ID_PLXS = 67, // Pulse Oximeter Profile Server Task
TASK_ID_PLXC = 68, // Pulse Oximeter Profile Client Task
TASK_ID_CGMS = 69, // Continuous Glucose Monitoring Server Task
TASK_ID_CGMC = 70, // Continuous Glucose Monitoring Client Task
TASK_ID_CSISM = 71, // Coordinated Set Identification Profile Set Member Task
TASK_ID_CSISC = 72, // Coordinated Set Identification Profile Set Coordinator Task
TASK_ID_OTS = 73, // Object Transfer Profile Server Task
TASK_ID_OTC = 74, // Object Transfer Profile Client Task
TASK_ID_MESH = 200, // Mesh Task
TASK_ID_GAF = 210, // Generic Audio Framework
TASK_ID_AM0 = 240, // BLE Audio Mode 0
TASK_ID_THPP = 242, // Throughput profile tester used for debugging
TASK_ID_INVALID = 0xFF, // Invalid Task Identifier
};
/// @} BT Stack Configuration
/// @} ROOT
#endif //RWIP_CONFIG_H_
+127
View File
@@ -0,0 +1,127 @@
/**
****************************************************************************************
*
* @file rwip_int.h
*
* @brief RW IP internal SW main module
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef _RWIP_INT_H_
#define _RWIP_INT_H_
/**
****************************************************************************************
* @addtogroup ROOT
* @brief Entry points of the RW IP stacks/modules
*
* This module contains the primitives that allow an application accessing and running the
* RW IP protocol stacks / modules.
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#include <stdint.h> // standard integer definitions
#include <stdbool.h> // standard boolean definitions
/*
* DEFINES
****************************************************************************************
*/
/*
* STRUCTURE DEFINITIONS
****************************************************************************************
*/
#if (BLE_EMB_PRESENT && BLE_ISO_PRESENT)
/// structure that represents ISO timer
typedef struct rwip_iso_timer_
{
/// Target BTS time (in us)
uint32_t tgt_bts[RWIP_ISO_TIMER_FIFO_DEPTH];
/// Current ISO timer index
uint8_t curr_idx;
/// Next ISO timer index
uint8_t next_idx;
/// Number of ISO timers programmed
uint8_t prog_nb;
} rwip_iso_timer_t;
#endif // (BLE_EMB_PRESENT && BLE_ISO_PRESENT)
/// RWIP Environment structure
struct rwip_env_tag
{
#if (BLE_EMB_PRESENT && BLE_ISO_PRESENT)
rwip_iso_timer_t iso_timer;
#endif // (BLE_EMB_PRESENT && BLE_ISO_PRESENT)
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
/// Arbiter target timer (integer part, in half slots)
uint32_t timer_arb_target;
/// Alarm target timer (integer part, in half slots)
uint32_t timer_alarm_target;
#endif // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
/// Common target timer (in half slots)
uint32_t timer_co_target;
/// Last Sampled time (used for time conversion)
rwip_time_t last_samp_time;
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
/// Contains sleep duration accumulated timing error (32kHz: 1/2 half us | 32.768kHz: 1/256 half-us)
uint32_t sleep_acc_error;
/// Power_up delay (in LP clock cycle unit, depends on Low power clock frequency)
uint32_t lp_cycle_wakeup_delay;
/// Duration of sleep and wake-up algorithm (depends on CPU speed) expressed in half us.
uint16_t sleep_algo_dur;
#endif // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
/// Prevent sleep bit field
uint16_t prevent_sleep;
#if (BLE_EMB_PRESENT || BT_EMB_PRESENT)
/// External wake-up support
bool ext_wakeup_enable;
#if (!BLE_EMB_PRESENT)
/// BTS sampling clock half microseconds residual (0 or 1)
uint8_t samp_hus_residual;
#endif // (!BLE_EMB_PRESENT)
#endif // (BLE_EMB_PRESENT || BT_EMB_PRESENT)
};
/*
* GLOBAL DEFINITIONS
****************************************************************************************
*/
/// RW SW environment
extern struct rwip_env_tag rwip_env;
/*
* FUNCTION DEFINITIONS
****************************************************************************************
*/
/**
* Initialization of the RW IP Common core driver
*
* @param[in] init_type Type of initialization (@see enum rwip_init_type)
*/
void rwip_driver_init(uint8_t init_type);
///@} ROOT
#endif // _RWIP_INT_H_