NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
ble_hw.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef H_BLE_HW_
21#define H_BLE_HW_
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "nimble/porting/nimble/include/syscfg/syscfg.h"
28
29#if defined(ARCH_sim)
30#define BLE_USES_HW_WHITELIST (0)
31#else
32#define BLE_USES_HW_WHITELIST MYNEWT_VAL(BLE_HW_WHITELIST_ENABLE)
33#endif
34
35/* Returns the number of hw whitelist elements */
36uint8_t ble_hw_whitelist_size(void);
37
38/* Clear the whitelist */
39void ble_hw_whitelist_clear(void);
40
41/* Remove a device from the hw whitelist */
42void ble_hw_whitelist_rmv(const uint8_t *addr, uint8_t addr_type);
43
44/* Add a device to the hw whitelist */
45int ble_hw_whitelist_add(const uint8_t *addr, uint8_t addr_type);
46
47/* Enable hw whitelisting */
48void ble_hw_whitelist_enable(void);
49
50/* Enable hw whitelisting */
51void ble_hw_whitelist_disable(void);
52
53/* Boolean function returning true if address matches a whitelist entry */
54int ble_hw_whitelist_match(void);
55
56/* Encrypt data */
57struct ble_encryption_block;
58int ble_hw_encrypt_block(struct ble_encryption_block *ecb);
59
60/* Random number generation */
61typedef void (*ble_rng_isr_cb_t)(uint8_t rnum);
62int ble_hw_rng_init(ble_rng_isr_cb_t cb, int bias);
63
69int ble_hw_rng_start(void);
70
76int ble_hw_rng_stop(void);
77
83uint8_t ble_hw_rng_read(void);
84
85/* Clear the resolving list*/
86void ble_hw_resolv_list_clear(void);
87
88/* Add a device to the hw resolving list */
89int ble_hw_resolv_list_add(uint8_t *irk);
90
91/* Remove a device from the hw resolving list */
92void ble_hw_resolv_list_rmv(int index);
93
94/* Returns the size of the whitelist in HW */
95uint8_t ble_hw_resolv_list_size(void);
96
97/* Returns index of resolved address; -1 if not resolved */
98int ble_hw_resolv_list_match(void);
99
100/* Returns public device address or -1 if not present */
101int ble_hw_get_public_addr(ble_addr_t *addr);
102
103/* Returns random static address or -1 if not present */
104int ble_hw_get_static_addr(ble_addr_t *addr);
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif /* H_BLE_HW_ */