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 _NIMBLE_PORT_H 21 #define _NIMBLE_PORT_H 22 23 #include "esp_err.h" 24 #include "nimble/nimble_npl.h" 25 26 #define NIMBLE_CORE (CONFIG_BT_NIMBLE_PINNED_TO_CORE < portNUM_PROCESSORS ? CONFIG_BT_NIMBLE_PINNED_TO_CORE : tskNO_AFFINITY) 27 28 #define NIMBLE_HS_STACK_SIZE CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE 29 30 #if SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED 31 #define NIMBLE_LL_STACK_SIZE CONFIG_BT_LE_CONTROLLER_TASK_STACK_SIZE 32 #endif 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /** 39 * @brief nimble_port_init - Initialize controller and NimBLE host stack 40 * 41 * @return esp_err_t - ESP_OK ( if success) 42 * Error code in case of failure 43 */ 44 esp_err_t nimble_port_init(void); 45 46 /** 47 * @brief nimble_port_deinit - Deinitialize controller and NimBLE host stack 48 * 49 * @return esp_err_t - ESP_OK ( if success) 50 * Error code in case of failure 51 */ 52 esp_err_t nimble_port_deinit(void); 53 54 void nimble_port_run(void); 55 int nimble_port_stop(void); 56 57 /** 58 * @brief esp_nimble_init - Initialize the NimBLE host stack 59 * 60 * @return esp_err_t 61 */ 62 esp_err_t esp_nimble_init(void); 63 64 /** 65 * @brief esp_nimble_deinit - Deinitialize the NimBLE host stack 66 * 67 * @return esp_err_t 68 */ 69 esp_err_t esp_nimble_deinit(void); 70 71 struct ble_npl_eventq *nimble_port_get_dflt_eventq(void); 72 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /* _NIMBLE_PORT_H */ 79