This commit is contained in:
moyuhai
2026-06-11 13:00:46 +08:00
commit e8074162f3
2017 changed files with 507042 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+90
View File
@@ -0,0 +1,90 @@
/**
****************************************************************************************
*
* @file lc_lmppdu.h
*
* @brief LM LMP PDU packing and unpacking utilities header file.
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef LM_LMPPDU_H_
#define LM_LMPPDU_H_
/**
****************************************************************************************
* @defgroup LMLMPPDU LMP PDUs
* @ingroup LM
* @brief LM module for LMP PDU packing and unpacking.
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
/*
* FUNCTION DECLARATIONS
* ***************************************************************************************
*/
/**
******************************************************************************************
* @brief Function called to pack and send an LMP PDU.
*
* @param param Pointer to the param part of the ke_msg used to create the PDU structure
* and packet.
*
* @return Length of PDU.
******************************************************************************************
*/
void lc_send_lmp(uint8_t link_id, void *param);
//Functions dedicated to send a LMP
void lc_send_pdu_acc(uint8_t lid,uint8_t opcode,uint8_t tr_id);
void lc_send_pdu_acc_ext4(uint8_t lid,uint8_t opcode,uint8_t tr_id);
void lc_send_pdu_not_acc(uint8_t lid,uint8_t opcode,uint8_t reason,uint8_t tr_id);
void lc_send_pdu_not_acc_ext4(uint8_t lid,uint8_t opcode,uint8_t reason,uint8_t tr_id);
void lc_send_pdu_au_rand(uint8_t lid,struct ltk* random,uint8_t tr_id);
void lc_send_pdu_in_rand(uint8_t lid,struct ltk* random,uint8_t tr_id);
void lc_send_pdu_comb_key(uint8_t lid,struct ltk* random,uint8_t tr_id);
void lc_send_pdu_max_slot(uint8_t lid,uint8_t max_slot,uint8_t tr_id);
void lc_send_pdu_max_slot_req(uint8_t lid,uint8_t max_slot,uint8_t tr_id);
void lc_send_pdu_encaps_payl(uint8_t lid,struct byte16* data,uint8_t tr_id);
void lc_send_pdu_encaps_head(uint8_t idx, uint8_t tr_id, uint8_t maj_type, uint8_t min_type, uint8_t payl_len);
void lc_send_pdu_clk_adj_ack(uint8_t idx, uint8_t clk_adj_id, uint8_t tr_id);
void lc_send_pdu_clk_adj_req(uint8_t idx, uint16_t clk_adj_us, uint8_t clk_adj_slots, uint8_t clk_adj_period, uint8_t tr_id);
void lc_send_pdu_sam_define_map(uint8_t idx, uint8_t sam_index, uint8_t t_sam_sm, uint8_t n_sam_sm, const uint8_t* p_submaps, uint8_t tr_id);
void lc_send_pdu_sam_set_type0(uint8_t idx, uint8_t update_mode, const uint8_t* p_submap, uint8_t tr_id);
void lc_send_pdu_sam_switch(uint8_t idx, uint8_t sam_index, uint8_t flags, uint8_t d_sam, uint32_t instant, uint8_t tr_id);
void lc_send_pdu_ptt_req(uint8_t lid,uint8_t ptt,uint8_t tr_id);
void lc_send_pdu_sp_nb(uint8_t lid,struct byte16* data,uint8_t tr_id);
void lc_send_pdu_sp_cfm(uint8_t lid,struct byte16* data,uint8_t tr_id);
void lc_send_pdu_sres(uint8_t lid,struct sres_nb* data,uint8_t tr_id);
void lc_send_pdu_sco_lk_req(uint8_t lid);
void lc_send_pdu_sco_lk_rem_req(uint8_t lid, uint8_t handle, uint8_t reason,uint8_t tr_id);
void lc_send_pdu_esco_lk_req(uint8_t lid);
void lc_send_pdu_esco_lk_rem_req(uint8_t lid, uint8_t handle, uint8_t reason,uint8_t tr_id);
void lc_send_pdu_auto_rate(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_lsto(uint8_t lid,uint16_t timeout,uint8_t role);
void lc_send_pdu_enc_key_sz_req(uint8_t lid,uint8_t key_size,uint8_t tr_id);
void lc_send_pdu_feats_ext_req(uint8_t lid, uint8_t page, uint8_t tr_id);
void lc_send_pdu_io_cap_res(uint8_t lid);
void lc_send_pdu_num_comp_fail(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_pause_enc_aes_req(uint8_t idx, uint8_t tr_id, struct byte16* random);
void lc_send_pdu_paus_enc_req(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_resu_enc_req(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_setup_cmp(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_qos_req(uint8_t lid,uint8_t nb_bcst, uint16_t poll_int,uint8_t tr_id);
void lc_send_pdu_slot_off(uint8_t lid, uint16_t slot_off,uint8_t tr_id);
void lc_send_pdu_vers_req(uint8_t lid, uint8_t role);
void lc_send_pdu_dhkey_chk(uint8_t lid,struct ltk* dhkey,uint8_t tr_id);
void lc_send_pdu_feats_res(uint8_t lid,uint8_t tr_id);
void lc_send_pdu_set_afh(uint8_t lid,uint32_t instant,uint8_t mode,uint8_t tr_id);
void lc_send_pdu_tim_acc(uint8_t idx,uint8_t tr_id);
/// @} LMLMPPDU
#endif //LM_LMPPDU_H_
+194
View File
@@ -0,0 +1,194 @@
/**
****************************************************************************************
*
* @file lc_sco.h
*
* @brief Definitions for LC SCO procedures
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef LC_SCO_H_
#define LC_SCO_H_
/**
****************************************************************************************
* @defgroup LCSCO Synchronous Connection Oriented connection
* @ingroup LC
* @brief Responsible for handling SCO procedures.
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#if (MAX_NB_SYNC > 0)
#include <stdint.h> // integer
#include <stdbool.h> // boolean
#include "ke_task.h" // kernel task
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
/*
* STRUCTURE DEFINITIONS
****************************************************************************************
*/
/// Structure for (e)SCO parameters
struct lc_sco_air_params_tag
{
///Transaction ID
uint8_t tr_id;
/// eSCO handle
uint8_t esco_hdl;
/// eSCo LT Address
uint8_t esco_lt_addr;
/// Timing control flags
uint8_t flags;
/// Dsco or Desco (in slots)
uint8_t d_esco;
/// Interval (in slots)
uint8_t t_esco;
/// Retransmission window size (in slots)
uint8_t w_esco;
/// Packet M->S type
uint8_t m2s_pkt_type;
/// Packet S->M type
uint8_t s2m_pkt_type;
/// Packet M->S length for eSCO link (in bytes)
uint16_t m2s_pkt_len;
/// Packet S->M length for eSCO link (in bytes)
uint16_t s2m_pkt_len;
/// Air Mode
uint8_t air_mode;
/// Negotiation state
uint8_t nego_state;
};
/// Structure for Host synchronous parameters
struct lc_sco_host_params_tag
{
uint32_t tx_bw; // Transmit Bandwidth (in B/sec)
uint32_t rx_bw; // Receive Bandwidth (in B/sec)
uint8_t tx_cod_fmt[5]; // Transmit Coding Format
uint8_t rx_cod_fmt[5]; // Receive Coding Format
uint16_t tx_cod_fr_sz; // Transmit Codec Frame Size (in B)
uint16_t rx_cod_fr_sz; // Receive Codec Frame Size (in B)
uint32_t in_bw; // Input Bandwidth (in B/sec)
uint32_t out_bw; // Output Bandwidth (in B/sec)
uint8_t in_cod_fmt[5]; // Input Coding Format
uint8_t out_cod_fmt[5]; // Output Coding Format
uint16_t in_cod_data_sz; // Input Coded Data Size (in bits)
uint16_t out_cod_data_sz; // Output Coded Data Size (in bits)
uint8_t in_data_fmt; // Input PCM Data Format
uint8_t out_data_fmt; // Output PCM Data Format
uint8_t in_msb_pos; // Input PCM Sample Payload MSB Position (in bits)
uint8_t out_msb_pos; // Output PCM Sample Payload MSB Position (in bits)
uint8_t in_data_path; // Input Data Path (VoHCI / PCM / Other ...)
uint8_t out_data_path; // Output Data Path
uint8_t in_tr_unit_sz; // Input Transport Unit Size (in bits)
uint8_t out_tr_unit_sz; // Output Transport Unit Size (in bits)
uint16_t max_lat; // Max Latency (in ms)
uint16_t packet_type; // Packet Type (HV1 / HV2 / HV3 / EV3 / EV4 / EV5 / 2EV3 / 3EV3 / 2EV5 / 3EV5)
uint8_t retx_eff; // Retransmission Effort (No, opt power, opt quality, don't care)
};
/*
* FUNCTIONS DECLARATION
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Initialize the LC_SCO module
****************************************************************************************
*/
void lc_sco_init(void);
/**
****************************************************************************************
* @brief Reset LC_SCO module
****************************************************************************************
*/
void lc_sco_reset(void);
/**
****************************************************************************************
* @brief Detach all SCO connections on a ACL link
*
* This function starts the disconnection of all SCO links on a ACL connection.
*
* When the full disconnection procedure is requested, each disconnection procedure
* loops to this function to restart the next disconnection until no more SCO on the ACL
* is present.
*
* Host is NOT notified for each SCO link disconnection.
*
* param[in] pid Process identifier (task / instance)
* param[in] reason Detach reason (error code)
*
* return status
****************************************************************************************
*/
uint8_t lc_sco_detach(ke_task_id_t pid, uint8_t reason);
/**
****************************************************************************************
* @brief Release all SCO connections on a ACL link
*
* This function releases all SCO links on a ACL connection, without notification to the
* peer device. However, Host is notified for each SCO link disconnection.
*
* param[in] pid Process identifier (task / instance)
* param[in] reason Detach reason (error code)
****************************************************************************************
*/
void lc_sco_release(ke_task_id_t pid, uint8_t reason);
uint8_t lc_sco_host_request(ke_task_id_t pid, bool old_style, bool host_initiated, uint16_t conhdl, struct lc_sco_host_params_tag * p_host_params);
uint8_t lc_sco_host_accept(ke_task_id_t pid, bool old_style, bool very_old_style, struct lc_sco_host_params_tag * p_host_params);
void lc_sco_host_reject(ke_task_id_t pid, bool very_old_style, uint8_t status);
uint8_t lc_sco_host_request_disc(ke_task_id_t pid, uint16_t conhdl, uint8_t reason);
void lc_sco_peer_request(ke_task_id_t pid, uint8_t req_type, struct lc_sco_air_params_tag * p_peer_params);
void lc_sco_peer_accept(ke_task_id_t pid);
void lc_sco_peer_reject(ke_task_id_t pid, uint8_t reason);
void lc_sco_peer_request_disc(ke_task_id_t pid, uint8_t req_type, uint8_t scohdl, uint8_t reason);
void lc_sco_peer_accept_disc(ke_task_id_t pid);
void lc_sco_peer_reject_disc(ke_task_id_t pid, uint8_t reason);
void lc_sco_baseband_ack(ke_task_id_t pid, uint8_t lmp_opcode);
void lc_sco_timeout(ke_task_id_t pid);
/**
****************************************************************************************
* @brief This function is used to update the SCO offset.
*
* @param[in] sync_linkid SCO link ID
* @param[in] sco_offset SCO offset in slots
*
* @return True if SCO link present
****************************************************************************************
*/
void lc_sco_offset_update(uint8_t sync_linkid, uint16_t sco_offset);
#endif // (MAX_NB_SYNC > 0)
/// @} LCSCO
#endif // LC_SCO_H_
+111
View File
@@ -0,0 +1,111 @@
/**
****************************************************************************************
*
* @file lm_lowpow.h
*
* @brief Link Manager Utilities functions
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef LM_LOWPOW_H_
#define LM_LOWPOW_H_
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#include <stdint.h> // integer
#include <stdbool.h> // boolean
/**
****************************************************************************************
* @defgroup LMLOWPOW Low Power Functions
* @ingroup LM
* @brief LM module for low power mode management (sniff, hold, park).
* @{
****************************************************************************************
*/
/// Commands for Sniff
#define SNIFF_HL_REQ 0
#define SNIFF_PEER_REQ 1
/*
* FUNCTION DECLARATIONS
****************************************************************************************
*/
/**
****************************************************************************************
* @brief Initializes Sniff block.
****************************************************************************************
*/
void lc_sniff_init(bool reset);
/**
****************************************************************************************
* @brief Clear sniff parameters of a specific link
****************************************************************************************
*/
void lc_sniff_clear(uint8_t link_id);
/**
****************************************************************************************
* @brief Get sniff interval and subrate
* @param[in] link_id Link identifier
* @param[out] interval Sniff interval (in slots)
* @param[out] max_subrate Maximum sniff subrate (in number of sniff events, 0 if no subrating)
****************************************************************************************
*/
void lc_sniff_interval_get(uint8_t link_id, uint16_t * interval, uint8_t * max_subrate);
/**
****************************************************************************************
* @brief This function is used to update the sniff offset
*
* @param[in] link_id Link identifier
* @param[in] sniff_offset Sniff offset in half-slots
****************************************************************************************
*/
void lc_sniff_offset_update(uint8_t link_id, uint16_t sniff_offset);
void lc_sniff_host_request(ke_task_id_t pid, uint16_t max_int, uint16_t min_int, uint16_t attempt, uint16_t timeout);
void lc_sniff_peer_request(ke_task_id_t pid, uint8_t flags, uint16_t d_sniff, uint16_t t_sniff, uint16_t sniff_attempt, uint16_t sniff_to);
void lc_sniff_peer_accept(ke_task_id_t pid);
void lc_sniff_peer_reject(ke_task_id_t pid, uint8_t reason);
void lc_sniff_baseband_ack(ke_task_id_t pid, uint8_t lmp_opcode);
void lc_sniff_timeout(ke_task_id_t pid);
/**
****************************************************************************************
* @brief Unsniff link
*
* This function initiating an unsniff LMP procedure.
*
* param[in] pid Process identifier (task / instance)
****************************************************************************************
*/
void lc_sniff_unsniff(ke_task_id_t pid);
void lc_sniff_unsniff_peer_request(ke_task_id_t pid);
void lc_sniff_unsniff_peer_accept(ke_task_id_t pid);
void lc_sniff_unsniff_peer_reject(ke_task_id_t pid, uint8_t reason);
void lc_sniff_ssr_nego(ke_task_id_t pid);
void lc_sniff_ssr_host_request(ke_task_id_t pid, uint16_t max_lat, uint16_t min_rem_to, uint16_t min_loc_to);
void lc_sniff_ssr_peer_request(ke_task_id_t pid, uint8_t max_subrate, uint16_t min_to, uint32_t instant);
void lc_sniff_ssr_peer_response(ke_task_id_t pid, uint8_t max_subrate, uint16_t min_to, uint32_t instant);
void lc_sniff_ssr_peer_reject(ke_task_id_t pid, uint8_t reason);
void lc_sniff_ssr_baseband_ack(ke_task_id_t pid);
void lc_sniff_ssr_instant(ke_task_id_t pid);
///@} LMLOWPOW
#endif // LM_LMLOWPOW_H_
+229
View File
@@ -0,0 +1,229 @@
/**
****************************************************************************************
*
* @file lc_util.h
*
* @brief LC Util API
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef LC_UTIL_H_
#define LC_UTIL_H_
/**
****************************************************************************************
* @addtogroup LCUTIL Link Controller
* @ingroup CONTROLLER
* @brief Link Layer Controller utility
*
* Declaration of the API functions to be called by other layers
*
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include <stdint.h> // integer
#include <stdbool.h> // bool
#include "co_bt.h"
#include "ke_msg.h" // kernel timer definition
/*
* DEFINES
****************************************************************************************
*/
/*
* CONSTANT DEFINITIONS
****************************************************************************************
*/
#define QOS_HL_REQ 0
#define QOS_PEER_REQ 1
#define QOS_PEER_FORCE 2
#define QOS_PEER_REJECT 3
/*
* MACRO DEFINITIONS
****************************************************************************************
*/
/*
* STRUCTURE DEFINITIONS
****************************************************************************************
*/
/*
* FUNCTIONS DECLARATION
****************************************************************************************
*/
/**
****************************************************************************************
* @brief This function is used to compute the resulting ACL packet types.
*
* @param[in] PreferredPacketType Preferred packet type
* @param[in] CurrentPacketType Current packet type in use
* @param[in] KeepCurrent Boolean to keep the current packet type
*
* @return PacketType
****************************************************************************************
*/
uint16_t LM_ComputePacketType(uint16_t PreferredPacketType, uint16_t CurrentPacketType, bool KeepCurrent);
/**
****************************************************************************************
* @brief This function is used to check which ACL packet types are allowed.
*
* @param[in] PacketType ACL packet type
* @param[in] RemoteCapability Remote device capability
*
* @return PacketType
****************************************************************************************
*/
uint16_t LM_UpdateAclPacketType(uint16_t PacketType, uint8_t RemoteCapability);
/**
****************************************************************************************
* @brief This function is used to check which EDR ACL packet types are allowed.
*
* @param[in] PacketType Requested Packet type
* @param[in] RemoteCapabilityByte3 Capability of Remote device
* @param[in] RemoteCapabilityByte4 Capability of Remote device
* @param[in] RemoteCapabilityByte5 Capability of Remote device
*
* @return PossiblePacketType
****************************************************************************************
*/
uint16_t LM_UpdateAclEdrPacketType(uint16_t PacketType,
uint8_t RemoteCapabilityByte3,
uint8_t RemoteCapabilityByte4,
uint8_t RemoteCapabilityByte5);
/**
****************************************************************************************
* @brief This function is used to removed ACL packet type.
*
* @param[out] ReqPacketType Possible packet type
* @param[in] Slot Packet slot (1, 3, 5)
****************************************************************************************
*/
void LM_SuppressAclPacket(uint16_t *ReqPacketType, uint8_t Slot);
/**
****************************************************************************************
* @brief This function is used to retrieve the Quality of Service information
* linked with the connection handle.
*
* @param[in] Role Device role connection
* @param[out] ServiceType Type of service
* @param[out] TokenRate Token rate
* @param[out] PeakBandwidth Bandwidth peak
* @param[out] Latency Latency
* @param[out] DelayVariation Variation
* @param[out] PollInterval Polling interval. Should be even value.
* @param[in] PacketType Type of packet
* @param[in] Request Request type (HL, PEER, FORCE, REJECT)
*
* @return Status
****************************************************************************************
*/
uint8_t LM_GetQoSParam(uint8_t Role, uint8_t *ServiceType,
uint32_t *TokenRate, uint32_t *PeakBandwidth, uint32_t *Latency,
uint32_t *DelayVariation, uint16_t *PollInterval,
uint16_t PacketType, uint8_t Request);
/**
****************************************************************************************
* @brief This function make a COF from a BD_ADDR.
*
* @param[in] BdAddr BD Address
* @param[out] Aco ACO value
****************************************************************************************
*/
void LM_MakeCof(struct bd_addr BdAddr, struct aco *Aco);
/**
****************************************************************************************
* @brief This function is used to check all the EDR features available.
*
* @param[in] RequestFeatures Feature table
*
* @return True if found, False otherwise.
****************************************************************************************
*/
bool LM_CheckEdrFeatureRequest(uint16_t RequestFeatures);
/**
****************************************************************************************
* @brief This function is used to get a feature.
*
* @param[in] FeaturesPtr Feature table
* @param[in] Feature Feature to extract
*
* @return 0 (not found) or 1 (found)
****************************************************************************************
*/
uint16_t LM_GetFeature(struct features *FeaturesPtr, uint8_t Feature);
/**
****************************************************************************************
* @brief This function is used to check if a link key is stored.
*
* @param[in] p_bd_addr BD Address to search
* @param[out] Key Link key
*
* @return Boolean, True if key found, False otherwise
****************************************************************************************
*/
bool lm_look_for_stored_link_key(struct bd_addr *p_bd_addr, struct ltk *Key);
/**
****************************************************************************************
* @brief Converts the Preferred Rate into TX packet type for
* the corresponding link ID.
*
* @param[in] PreferredRate Preferred Rate for the link
* @param[in] pkt_type_table 0: 1MBPS / 1: 2-3MBPS
*
* @return Preferred Packet types
****************************************************************************************
*/
uint16_t lc_util_convert_pref_rate_to_packet_type(uint8_t PreferredRate, uint8_t pkt_type_table);
/**
****************************************************************************************
* @brief Converts the maxslot into TX packet type
*
* @param[in] maxslot Maximum number of slots
*
* @return Possible Packet types
****************************************************************************************
*/
uint16_t lc_util_convert_maxslot_to_packet_type(uint8_t maxslot);
#if MAX_NB_SYNC
/**
****************************************************************************************
* @brief This function is used to get the common packet types
*
* @param[in] SyncPacketType Original packets type (SCO and/or eSCO)
* @param[in] *RemoteFeaturesPtr Pointer on Remote features
*
* @return Common packet types (bit mask)
****************************************************************************************
*/
uint16_t lm_get_common_pkt_types(uint16_t SyncPacketType, struct features *RemoteFeaturesPtr);
#endif // MAX_NB_SYNC
/// @} LC
#endif // LC_UTIL_H_
+194
View File
@@ -0,0 +1,194 @@
/**
****************************************************************************************
*
* @file lm_sco.h
*
* @brief Link Manager synchronous link functions
*
* Copyright (C) RivieraWaves 2009-2015
*
*
****************************************************************************************
*/
#ifndef LM_SCO_H_
#define LM_SCO_H_
/**
****************************************************************************************
* @defgroup LMSCO SCO Functions
* @ingroup LM
* @brief LM module for synchronous functions.
* @{
****************************************************************************************
*/
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h" // stack configuration
#if (MAX_NB_SYNC > 0)
#include "lc_sco.h"
/*
* DEFINITION
* ***************************************************************************************
*/
/// Commands for synchronous link
#define SYNC_HL_REQ 0
#define SYNC_PEER_REQ 1
#define SYNC_HL_RSP 2
#define SYNC_PEER_RSP 3
#define SYNC_HL_MODIF 4
#define SYNC_PEER_MODIF 5
#define SYNC_UPDATE 6
/*
* FUNCTION DECLARATIONS
* ***************************************************************************************
*/
/**
****************************************************************************************
* @brief This function is used to initialize LM Sco Data.
****************************************************************************************
*/
void lm_init_sync(void);
/**
****************************************************************************************
* @brief This function is used to reset LM Sco Data.
****************************************************************************************
*/
void lm_reset_sync(void);
/**
****************************************************************************************
* @brief This function is used to check and store informations about a SCO link.
*
* @param[in] sco_link_id Synchronous link ID
* @param[in] RemoteFeatures Remote device features
* @param[in] Role Master or Slave
* @param[in] SyncType SCO or eSCO
* @param[in] SyncLtAddr Synchronous link LT address
* @param[out] *SyncHdl Synchronous link handle
* @param[in] SyncTxBw TX bandwidth
* @param[in] SyncRxBw RX bandwidth
* @param[in] SyncLat Maximum allowed Latency
* @param[in] SyncVoice Voice settings
* @param[in] SyncAirMode Air Mode
* @param[in] SyncReTx Retransmission effort
* @param[in] SyncPacketType Allowed packet types
* @param[out] sco_params SCO parameters
* @param[in] Request Request originator
*
* @return Status
****************************************************************************************
*/
uint8_t lm_add_sync(uint8_t sco_link_id, struct features *RemoteFeatures,
uint8_t LinkId, uint8_t Role, uint8_t *SyncType,
uint32_t SyncTxBw, uint32_t SyncRxBw, uint16_t SyncLat, uint16_t VoiceSetting,
uint8_t SyncReTx, uint16_t SyncPacketType,
struct lc_sco_air_params_tag * sco_params, uint8_t Request);
/**
****************************************************************************************
* @brief This function is used to check if a Sync link can be modified.
*
* @param[in] sco_link_id Synchronous link ID
* @param[in] SyncType SCO or eSCO
* @param[in] SyncTxBw TX bandwidth
* @param[in] SyncRxBw RX bandwidth
* @param[in] SyncLat Maximum allowed Latency
* @param[in] SyncVoice Voice settings
* @param[in] SyncReTx Retransmission effort
* @param[in] SyncPacketType Allowed packet types
* @param[out] sco_params SCO parameters
* @param[in] Request Request type
*
* @return Status
*
****************************************************************************************
*/
uint8_t lm_modif_sync(uint8_t sco_link_id, uint8_t SyncType,
uint32_t SyncTxBw, uint32_t SyncRxBw, uint16_t SyncLat,
uint16_t SyncVoice, uint8_t SyncReTx, uint16_t SyncPacketType,
struct lc_sco_air_params_tag * sco_params, uint8_t Request);
/**
****************************************************************************************
* @brief This function is used to check the Accept Sync connection parameters.
*
* @param[in] sco_link_id Synchronous link ID
* @param[in] SyncTxBw TX bandwidth
* @param[in] SyncRxBw RX bandwidth
* @param[in] SyncLat Maximum allowed Latency
* @param[in] SyncVoice Voice settings
* @param[in] SyncReTx Retransmission effort
* @param[in] SyncPacketType Allowed packet types
* @param[out] sco_params SCO parameters
*
* @return Status
*
****************************************************************************************
*/
uint8_t lm_check_sync_hl_rsp(uint8_t sco_link_id, uint32_t SyncTxBw, uint32_t SyncRxBw,
uint16_t SyncLat, uint16_t SyncVoice, uint8_t SyncReTx, uint16_t SyncPacketType,
struct lc_sco_air_params_tag * sco_params);
/**
****************************************************************************************
* @brief This function is used to remove stored synchronous link information.
*
* @param[in] sco_link_id Synchronous link ID
****************************************************************************************
*/
void lm_remove_sync(uint8_t sco_link_id);
/**
****************************************************************************************
* @brief This function is used to Restore parameters for a synchronous link.
*
* @param[in] sco_link_id Synchronous link ID
* @param[out] sco_params SCO parameters
* @param[in] Request Request type
*
* @return Status
****************************************************************************************
*/
uint8_t lm_get_sync_param(uint8_t sco_link_id, struct lc_sco_air_params_tag * sco_params, uint8_t Request);
/**
****************************************************************************************
* @brief This function is used to get the Sync Handle of a Sync link.
*
* @param[in] sco_link_id Synchronous link ID
*
* @return Synchronous link handle
****************************************************************************************
*/
uint8_t lm_get_synchdl(uint8_t sco_link_id);
/**
****************************************************************************************
* @brief This function is used to check if an ACL link has at least 1 synchronous link.
*
* @param[in] sco_link_id Synchronous link ID
* @param[in] type Check SCO or eSCO specifically (ACL_TYPE if the type does not matter)
*
* @return True if SCO link present
****************************************************************************************
*/
bool lm_look_for_sync(uint8_t link_id, uint8_t type);
/**************************************************************************************
* @brief Indicate the end of a SCO negotiation
**************************************************************************************/
void lm_sco_nego_end(void);
#endif //(MAX_NB_SYNC > 0)
///@} LMSCO
#endif // LM_SCO_H_