drivers/nble: Introduce basic skeleton
Introduce the basic skeleton for NBLE, which is the Bluetooth LE API implementation targeting a custom firmware running on Nordic Semiconductor nRF51 chips. Change-Id: I1ce69d6ee0205e71f6bd8d256d9233c93d2cde41 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
76079bc53a
commit
fd975d27fb
7 changed files with 340 additions and 0 deletions
|
@ -63,4 +63,6 @@ source "drivers/aio/Kconfig"
|
||||||
|
|
||||||
source "drivers/qmsi/Kconfig"
|
source "drivers/qmsi/Kconfig"
|
||||||
|
|
||||||
|
source "drivers/nble/Kconfig"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -19,4 +19,5 @@ obj-$(CONFIG_WATCHDOG) += watchdog/
|
||||||
obj-$(CONFIG_RTC) += rtc/
|
obj-$(CONFIG_RTC) += rtc/
|
||||||
obj-$(CONFIG_CLOCK_CONTROL) += clock_control/
|
obj-$(CONFIG_CLOCK_CONTROL) += clock_control/
|
||||||
obj-$(CONFIG_IPM) += ipm/
|
obj-$(CONFIG_IPM) += ipm/
|
||||||
|
obj-$(CONFIG_NBLE) += nble/
|
||||||
obj-y += aio/
|
obj-y += aio/
|
||||||
|
|
50
drivers/nble/Kconfig
Normal file
50
drivers/nble/Kconfig
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# Kconfig - NBLE configuration options
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016 Intel Corporation
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# These BLUETOOTH_* dependencies are redefined here since we can't use
|
||||||
|
# net/bluetooth/KConfig (which depend on CONFIG_BLUETOOTH)
|
||||||
|
#
|
||||||
|
config BLUETOOTH_PERIPHERAL
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BLUETOOTH_CENTRAL
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BLUETOOTH_GATT_CLIENT
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BLUETOOTH_SMP
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
|
config NBLE
|
||||||
|
bool "Support for custom Nordic Semiconductor BLE protocol"
|
||||||
|
default n
|
||||||
|
depends on !BLUETOOTH
|
||||||
|
select BLUETOOTH_PERIPHERAL
|
||||||
|
select BLUETOOTH_CENTRAL
|
||||||
|
select BLUETOOTH_GATT_CLIENT
|
||||||
|
select BLUETOOTH_SMP
|
||||||
|
help
|
||||||
|
Enables support for using Nordic Semicondutor nRF51 Bluetooth
|
||||||
|
LE chips with a custom firmware. The API for this is a subset of
|
||||||
|
the normal Bluetooth API (include/bluetooth/*.h). This driver can
|
||||||
|
only be enabled if CONFIG_BLUETOOTH has not been enabled.
|
1
drivers/nble/Makefile
Normal file
1
drivers/nble/Makefile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
obj-$(CONFIG_NBLE) += gap.o conn.o gatt.o
|
69
drivers/nble/conn.c
Normal file
69
drivers/nble/conn.c
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel Corporation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/conn.h>
|
||||||
|
|
||||||
|
struct bt_conn *bt_conn_ref(struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_conn_unref(struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
struct bt_conn *bt_conn_lookup_addr_le(const bt_addr_le_t *peer)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bt_addr_le_t *bt_conn_get_dst(const struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_conn_get_info(const struct bt_conn *conn, struct bt_conn_info *info)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_conn_disconnect(struct bt_conn *conn, uint8_t reason)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct bt_conn *bt_conn_create_le(const bt_addr_le_t *peer,
|
||||||
|
const struct bt_le_conn_param *param)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_conn_security(struct bt_conn *conn, bt_security_t sec)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t bt_conn_enc_key_size(struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_conn_cb_register(struct bt_conn_cb *cb)
|
||||||
|
{
|
||||||
|
}
|
68
drivers/nble/gap.c
Normal file
68
drivers/nble/gap.c
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel Corporation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
|
||||||
|
int bt_enable(bt_ready_cb_t cb)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_le_adv_start(const struct bt_le_adv_param *param,
|
||||||
|
const struct bt_eir *ad, const struct bt_eir *sd)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_le_adv_stop(void)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_le_scan_start(const struct bt_le_scan_param *param, bt_le_scan_cb_t cb)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_le_scan_stop(void)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_le_set_auto_conn(bt_addr_le_t *addr,
|
||||||
|
const struct bt_le_conn_param *param)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_auth_cb_register(const struct bt_auth_cb *cb)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_auth_passkey_entry(struct bt_conn *conn, unsigned int passkey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_auth_cancel(struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_auth_passkey_confirm(struct bt_conn *conn, bool match)
|
||||||
|
{
|
||||||
|
}
|
149
drivers/nble/gatt.c
Normal file
149
drivers/nble/gatt.c
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel Corporation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <bluetooth/gatt.h>
|
||||||
|
|
||||||
|
int bt_gatt_register(struct bt_gatt_attr *attrs, size_t count)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle,
|
||||||
|
bt_gatt_attr_func_t func, void *user_data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||||
|
void *buf, uint16_t buf_len, uint16_t offset,
|
||||||
|
const void *value, uint16_t value_len)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_service(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr,
|
||||||
|
void *buf, uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_included(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr,
|
||||||
|
void *buf, uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_chrc(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_ccc(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, const void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_cud(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_attr_read_cpf(struct bt_conn *conn,
|
||||||
|
const struct bt_gatt_attr *attr, void *buf,
|
||||||
|
uint16_t len, uint16_t offset)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_notify(struct bt_conn *conn, uint16_t handle, const void *data,
|
||||||
|
uint16_t len)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_exchange_mtu(struct bt_conn *conn, bt_gatt_rsp_func_t func)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_discover(struct bt_conn *conn,
|
||||||
|
struct bt_gatt_discover_params *params)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_write(struct bt_conn *conn, uint16_t handle, uint16_t offset,
|
||||||
|
const void *data, uint16_t length, bt_gatt_rsp_func_t func)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_write_without_response(struct bt_conn *conn, uint16_t handle,
|
||||||
|
const void *data, uint16_t length,
|
||||||
|
bool sign)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_subscribe(struct bt_conn *conn,
|
||||||
|
struct bt_gatt_subscribe_params *params)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_unsubscribe(struct bt_conn *conn,
|
||||||
|
struct bt_gatt_subscribe_params *params)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bt_gatt_cancel(struct bt_conn *conn)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int bt_gatt_read_multiple(struct bt_conn *conn, const uint16_t *handles,
|
||||||
|
size_t count, bt_gatt_read_func_t func)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue