WXK
2024-12-16 78e84fcf264afd731cd66c807d9fcb690fe12126
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
 *******************************************************************************
 * @FileName  : lhci_api.h
 * @Author    : GaoQiu
 * @CreateDate: 2020-02-18
 * @Copyright : Copyright(C) GaoQiu
 *              All Rights Reserved.
 *******************************************************************************
 *
 * The information contained herein is confidential and proprietary property of
 * GaoQiu and is available under the terms of Commercial License Agreement
 * between GaoQiu and the licensee in separate contract or the terms described
 * here-in.
 *
 * This heading MUST NOT be removed from this file.
 *
 * Licensees are granted free, non-transferable use of the information in this
 * file under Mutual Non-Disclosure Agreement. NO WARRENTY of ANY KIND is provided.
 *
 *******************************************************************************
 */
 
#ifndef LHCI_API_H_
#define LHCI_API_H_
 
#include "stack/ble_types.h"
#include "utils/fifo.h"
 
#define LHCI_LE_DTM_EN         1
 
//#define LHCI_CMD_PLD_MAX     65
//#define LHCI_EVT_PLD_MAX     65
 
#define LHCI_BUF_SIZE_ALIGN4(payload)       MEM_ALIGNED_SIZE(HCI_ACL_HDR_LEN + payload, 4)
 
/*! LHCI Tx call-back */
typedef void (*LHci_TxHciPktCback_t)(uint8_t *pBuf, uint32_t len);
 
/*! LHCI Config type. */
typedef struct{
    uint16_t  maxAclLen;  /*!< max acl parameter length. */
    uint16_t  maxCmdLen;  /*!< max cmd parameter length. */
    uint16_t  maxEvtLen;  /*!< max evt parameter length. */
 
    uint8_t   numCmdBufs; /*!< max cmd buffer number. */
    uint8_t   numAclBufs; /*!< max acl buffer number. */
    uint8_t   numEvtBufs; /*!< max evt buffer number. */
}LhciConfig_t;
 
/*! LHCI config control block. */
extern const LhciConfig_t *pLhciConfig;
 
/**
 * @brief  : LHCI initialization.
 * @param  : pLhciCfg      Pointer point to LhciConfig_t struct;
 * @return : none.
 */
void LHCI_Init(const LhciConfig_t *pLhciCfg);
 
/**
 * @brief  : Notify LHCI to Handle Received HCI Packet.
 * @param  : none.
 * @return : none.
 */
void LHCI_NotifyRxHciPkt(void);
 
/**
 * @brief  : Register ACL/EVT Tx cback.
 * @param  : aclCback
 * @param  : evtCback
 * @return : none.
 */
void LHCI_RegisterHciTxCback(LHci_TxHciPktCback_t aclCback, LHci_TxHciPktCback_t evtCback);
 
/**
 * @brief  : LHCI Rx handler.
 * @param  : none.
 * @return : none.
 */
void LHCI_RxHandler(void);
 
/**
 * @brief  : Get HCI RX Cmd FIFO
 * @param  : none.
 * @return : return pointer point to HCI RX CMD FIFO
 */
fifo_t *LHCI_GetRxCmdFifo(void);
 
/**
 * @brief  : Get HCI RX ACL FIFO
 * @param  : none.
 * @return : return pointer point to HCI RX ACL FIFO
 */
fifo_t *LHCI_GetRxAclFifo(void);
 
/**
 * @brief  : Get HCI TX ACL/EVT FIFO
 * @param  : none.
 * @return : return pointer point to HCI TX ACL/EVT FIFO
 */
fifo_t *LHCI_GetTxFifo(void);
 
/**
 * @brief  : Get HCI TX low priority EVT FIFO
 * @param  : none.
 * @return : return pointer point to HCI TX EVT FIFO
 */
fifo_t *LHCI_GetLowPrioTxFifo(void);
 
#endif /* LHCI_API_H_ */