WXK
2025-01-21 8f1a91a8ec98e430cfe4357bda099d495917198e
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
/**
 *******************************************************************************
 * @file     nimble_glue_spark.h
 * @create   2023-08-01    
 * @author   Panchip BLE GROUP
 * @note
 * Copyright (c) 2022 Shanghai Panchip Microelectronics Co.,Ltd.
 *
 *******************************************************************************
 */
#ifndef _NIMBLE_GLUE_H_
#define _NIMBLE_GLUE_H_
 
#include "PanSeries.h"
#include "stack/ble_types.h"
#include "pan_ble_stack.h"
#include "pan_svc_call.h"
 
/* Here we borrow NVIC ADC IRQ as BLE event for LL interrupt offloading */
#define BLE_EVENT_PROC_IRQ    ADC_IRQHandler
#define BLE_EVENT_PROC_IRQn   ADC_IRQn
 
/**@brief ble stack pre init call-back. */
typedef void ble_stack_pre_init_cb_t(void);
 
/**@brief ble stack init complete call-back. */
typedef void ble_stack_enabled_cb_t(void);
 
/**
 * @brief : initialize ble stack
 * @brief : ble_stack_pre_init_cb_t   ble stack prev init call-back
 * @param : ble_stack_enabled_cb      ble stack enabled call-back
 * @return: none.
 */
void pan_ble_stack_init(ble_stack_pre_init_cb_t ble_stack_pre_init_cb, ble_stack_enabled_cb_t *ble_stack_enabled_cb);
 
/**
 * @brief : create ble stack thread
 * @param : none.
 * @return: none.
 */
void pan_ble_thread_create(void);
 
/**
 * @brief: ble stack execute entry. 
 *         !!!Note: user need place this API to a thread.
 * @param : none.
 * @return: none.
 */
void pan_ble_stack_start(void);
 
 
/* Misc API */
extern uint8_t rf_check_sleep_state(void);
 
 
 
/* !!! Only Internal use API. */
extern uint32_t pan_ble_hci_acl_nimble_handle(uint8_t *p_data, uint16_t data_len);
typedef int (*host_copydata_t)(void *from, void *dst, uint16_t len);
extern void pan_ll_register_hostcopy_cb(host_copydata_t func);
int host_copydata(void *from, void *dst, uint16_t len);
void ble_hci_evt_ll_to_host_cbk(uint8_t *p_evt, uint16_t evt_len);
void ble_hci_acl_ll_to_host_cbk(uint8_t *p_acl, uint16_t acl_len);
 
#endif  /* _NIMBLE_GLUE_H_ */