wireless/bluetooth: add RPMSG HCI controller support

This commit is contained in:
raiden00pl
2023-03-14 09:51:13 +08:00
committed by Xiang Xiao
parent fef4871b01
commit a6c1ef3c52
6 changed files with 1270 additions and 0 deletions
+10
View File
@@ -75,4 +75,14 @@ config BLUETOOTH_NULL
loop" and nothing more: It is a just a bit-bucket for outgoing
packets; it generates no incoming packets.
config BLUETOOTH_RPMSG_SERVER
bool "RPMSG Bluetooth HCI server support"
depends on EXPERIMENTAL
default n
config BLUETOOTH_RPMSG
bool "RPMSG Bluetooth HCI client support"
depends on EXPERIMENTAL
default n
endif # DRIVERS_BLUETOOTH
+8
View File
@@ -48,6 +48,14 @@ ifeq ($(CONFIG_BLUETOOTH_NULL),y)
CSRCS += bt_null.c
endif
ifeq ($(CONFIG_BLUETOOTH_RPMSG_SERVER),y)
CSRCS += bt_rpmsghci_server.c
endif
ifeq ($(CONFIG_BLUETOOTH_RPMSG),y)
CSRCS += bt_rpmsghci.c
endif
# Include common Bluetooth driver build support
DEPPATH += --dep-path wireless$(DELIM)bluetooth
File diff suppressed because it is too large Load Diff
+96
View File
@@ -0,0 +1,96 @@
/****************************************************************************
* drivers/wireless/bluetooth/bt_rpmsghci.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
#ifndef __DRIVERS_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H
#define __DRIVERS_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <nuttx/compiler.h>
#include <nuttx/semaphore.h>
/****************************************************************************
* Pre-processor definitions
****************************************************************************/
#define RPMSGHCI_NAME_PREFIX "rpmsghci-"
#define RPMSGHCI_NAME_PREFIX_LEN 9
#define RPMSGHCI_OPEN 0 /* Device open */
#define RPMSGHCI_CLOSE 1 /* Device close */
#define RPMSGHCI_SEND 2 /* Data to a HCI controller */
#define RPMSGHCI_IOCTL 3 /* Device ioctl */
#define RPMSGHCI_RECV 4 /* Data from a HCI controller */
/****************************************************************************
* Public Types
****************************************************************************/
/* Rpmsg device cookie used to handle the response from the remote cpu */
struct rpmsghci_cookie_s
{
sem_t sem;
};
begin_packed_struct struct rpmsghci_header_s
{
uint32_t command;
int32_t result;
uint64_t cookie;
} end_packed_struct;
begin_packed_struct struct rpmsghci_open_s
{
struct rpmsghci_header_s header;
} end_packed_struct;
#define rpmsghci_close_s rpmsghci_open_s
begin_packed_struct struct rpmsghci_data_s
{
struct rpmsghci_header_s header;
uint8_t type;
char data[1];
} end_packed_struct;
begin_packed_struct struct rpmsghci_ioctl_s
{
struct rpmsghci_header_s header;
uint64_t filep;
uint64_t arg;
uint32_t arglen;
int32_t request;
char buf[1];
} end_packed_struct;
/****************************************************************************
* Internal function prototypes
****************************************************************************/
/****************************************************************************
* Internal data
****************************************************************************/
#endif /* __DRIVERS_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,88 @@
/****************************************************************************
* include/nuttx/wireless/bluetooth/bt_rpmsghci.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H
#define __INCLUDE_NUTTX_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/wireless/bluetooth/bt_driver.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef CONFIG_BLUETOOTH_RPMSG_SERVER
/****************************************************************************
* Name: rpmsghci_server_init
*
* Description:
* Rpmsg-HCI server initialize function, the server cpu should call
* this function.
*
* Parameters:
* name - RPMSG-HCI server name
* bt - BT device handler
*
* Returned Values:
* OK on success; A negated errno value is returned on any failure.
*
****************************************************************************/
int rpmshci_server_init(FAR const char *name, FAR struct bt_driver_s *dev);
#endif
#ifdef CONFIG_BLUETOOTH_RPMSG
/****************************************************************************
* Name: rpmsghci_register
*
* Description:
* Rpmsg-HCI client initialize function, the client cpu should call
* this function in the board initialize process.
*
* Parameters:
* cpuname - the server cpu name
* name - the HCI device you want to access in the remote cpu
*
* Returned Values:
* A non-NULL handle is returned on success;
* A NULL is returned on any failure.
*
****************************************************************************/
FAR struct bt_driver_s *rpmsghci_register(FAR const char *remotecpu,
FAR const char *name);
#endif
#endif /* __INCLUDE_NUTTX_WIRELESS_BLUETOOTH_BT_RPMSGHCI_H */