mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
arch/sim: Rename bthcitty driver to btuart driver
align with other soc naming style Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Brennan Ashton
parent
28167c14a3
commit
39f96361a3
+1
-1
@@ -541,7 +541,7 @@ config SIM_HCISOCKET
|
|||||||
control of the device, but is abstracted from the
|
control of the device, but is abstracted from the
|
||||||
physical interface which is still handled by Linux.
|
physical interface which is still handled by Linux.
|
||||||
|
|
||||||
config SIM_HCITTY
|
config SIM_BTUART
|
||||||
bool "Attach Host Bluetooth As TTY Device"
|
bool "Attach Host Bluetooth As TTY Device"
|
||||||
default false
|
default false
|
||||||
depends on (DRIVERS_BLUETOOTH && HOST_LINUX && SIM_WALLTIME)
|
depends on (DRIVERS_BLUETOOTH && HOST_LINUX && SIM_WALLTIME)
|
||||||
|
|||||||
@@ -219,9 +219,9 @@ ifeq ($(CONFIG_SIM_HCISOCKET),y)
|
|||||||
CSRCS += up_hcisocket.c
|
CSRCS += up_hcisocket.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SIM_HCITTY),y)
|
ifeq ($(CONFIG_SIM_BTUART),y)
|
||||||
HOSTSRCS += up_hcisocket_host.c
|
HOSTSRCS += up_hcisocket_host.c
|
||||||
CSRCS += up_hcitty.c
|
CSRCS += up_btuart.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_I2C_RESET),y)
|
ifeq ($(CONFIG_I2C_RESET),y)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/sim/src/sim/up_hcitty.c
|
* arch/sim/src/sim/up_btuart.c
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
@@ -57,7 +57,7 @@ union bt_hdr_u
|
|||||||
struct bt_hci_iso_hdr_s iso;
|
struct bt_hci_iso_hdr_s iso;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bthcitty_s
|
struct sim_btuart_s
|
||||||
{
|
{
|
||||||
sq_entry_t link;
|
sq_entry_t link;
|
||||||
uint8_t recvbuf[CONFIG_HCI_RECVBUF_SIZE];
|
uint8_t recvbuf[CONFIG_HCI_RECVBUF_SIZE];
|
||||||
@@ -81,38 +81,38 @@ struct bthcitty_s
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static int bthcitty_open (FAR struct file *filep);
|
static int sim_btuart_open (FAR struct file *filep);
|
||||||
static int bthcitty_close(FAR struct file *filep);
|
static int sim_btuart_close(FAR struct file *filep);
|
||||||
static ssize_t bthcitty_read (FAR struct file *filep,
|
static ssize_t sim_btuart_read (FAR struct file *filep,
|
||||||
FAR char *buffer, size_t buflen);
|
FAR char *buffer, size_t buflen);
|
||||||
static ssize_t bthcitty_write(FAR struct file *filep,
|
static ssize_t sim_btuart_write(FAR struct file *filep,
|
||||||
FAR const char *buffer, size_t buflen);
|
FAR const char *buffer, size_t buflen);
|
||||||
static int bthcitty_ioctl(FAR struct file *filep,
|
static int sim_btuart_ioctl(FAR struct file *filep,
|
||||||
int cmd, unsigned long arg);
|
int cmd, unsigned long arg);
|
||||||
static int bthcitty_poll (FAR struct file *filep,
|
static int sim_btuart_poll (FAR struct file *filep,
|
||||||
FAR struct pollfd *fds, bool setup);
|
FAR struct pollfd *fds, bool setup);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const struct file_operations g_bthcitty_ops =
|
static const struct file_operations g_sim_btuart_ops =
|
||||||
{
|
{
|
||||||
.open = bthcitty_open,
|
.open = sim_btuart_open,
|
||||||
.close = bthcitty_close,
|
.close = sim_btuart_close,
|
||||||
.read = bthcitty_read,
|
.read = sim_btuart_read,
|
||||||
.write = bthcitty_write,
|
.write = sim_btuart_write,
|
||||||
.ioctl = bthcitty_ioctl,
|
.ioctl = sim_btuart_ioctl,
|
||||||
.poll = bthcitty_poll
|
.poll = sim_btuart_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
static sq_queue_t g_bthcitty_list;
|
static sq_queue_t g_sim_btuart_list;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void bthcitty_post(FAR sem_t *sem)
|
static inline void sim_btuart_post(FAR sem_t *sem)
|
||||||
{
|
{
|
||||||
int semcount;
|
int semcount;
|
||||||
|
|
||||||
@@ -123,8 +123,8 @@ static inline void bthcitty_post(FAR sem_t *sem)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bthcitty_pollnotify(FAR struct bthcitty_s *dev,
|
static void sim_btuart_pollnotify(FAR struct sim_btuart_s *dev,
|
||||||
pollevent_t eventset)
|
pollevent_t eventset)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -138,18 +138,18 @@ static void bthcitty_pollnotify(FAR struct bthcitty_s *dev,
|
|||||||
|
|
||||||
if (fds->revents != 0)
|
if (fds->revents != 0)
|
||||||
{
|
{
|
||||||
bthcitty_post(fds->sem);
|
sim_btuart_post(fds->sem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bthcitty_post(&dev->recvsem);
|
sim_btuart_post(&dev->recvsem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bthcitty_open(FAR struct file *filep)
|
static int sim_btuart_open(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct bthcitty_s *dev = inode->i_private;
|
FAR struct sim_btuart_s *dev = inode->i_private;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = bthcisock_host_open(dev->id);
|
fd = bthcisock_host_open(dev->id);
|
||||||
@@ -166,24 +166,24 @@ static int bthcitty_open(FAR struct file *filep)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bthcitty_close(FAR struct file *filep)
|
static int sim_btuart_close(FAR struct file *filep)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct bthcitty_s *dev = inode->i_private;
|
FAR struct sim_btuart_s *dev = inode->i_private;
|
||||||
|
|
||||||
bthcisock_host_close(dev->fd);
|
bthcisock_host_close(dev->fd);
|
||||||
|
|
||||||
dev->fd = -1;
|
dev->fd = -1;
|
||||||
|
|
||||||
bthcitty_pollnotify(dev, POLLIN | POLLOUT);
|
sim_btuart_pollnotify(dev, POLLIN | POLLOUT);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t bthcitty_read(FAR struct file *filep,
|
static ssize_t sim_btuart_read(FAR struct file *filep,
|
||||||
FAR char *buffer, size_t buflen)
|
FAR char *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct bthcitty_s *dev = inode->i_private;
|
FAR struct sim_btuart_s *dev = inode->i_private;
|
||||||
size_t len = dev->recvlen;
|
size_t len = dev->recvlen;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -224,11 +224,11 @@ static ssize_t bthcitty_read(FAR struct file *filep,
|
|||||||
return buflen;
|
return buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t bthcitty_write(FAR struct file *filep,
|
static ssize_t sim_btuart_write(FAR struct file *filep,
|
||||||
FAR const char *buffer, size_t buflen)
|
FAR const char *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct bthcitty_s *dev = inode->i_private;
|
FAR struct sim_btuart_s *dev = inode->i_private;
|
||||||
FAR union bt_hdr_u *hdr;
|
FAR union bt_hdr_u *hdr;
|
||||||
size_t pktlen;
|
size_t pktlen;
|
||||||
size_t hdrlen;
|
size_t hdrlen;
|
||||||
@@ -311,17 +311,17 @@ out:
|
|||||||
return ret < 0 ? ret : buflen;
|
return ret < 0 ? ret : buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bthcitty_ioctl(FAR struct file *filep,
|
static int sim_btuart_ioctl(FAR struct file *filep,
|
||||||
int cmd, unsigned long arg)
|
int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bthcitty_poll(FAR struct file *filep,
|
static int sim_btuart_poll(FAR struct file *filep,
|
||||||
FAR struct pollfd *fds, bool setup)
|
FAR struct pollfd *fds, bool setup)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct bthcitty_s *dev = inode->i_private;
|
FAR struct sim_btuart_s *dev = inode->i_private;
|
||||||
pollevent_t eventset = 0;
|
pollevent_t eventset = 0;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@@ -363,7 +363,7 @@ static int bthcitty_poll(FAR struct file *filep,
|
|||||||
|
|
||||||
if (eventset)
|
if (eventset)
|
||||||
{
|
{
|
||||||
bthcitty_pollnotify(dev, eventset);
|
sim_btuart_pollnotify(dev, eventset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (fds->priv != NULL)
|
else if (fds->priv != NULL)
|
||||||
@@ -387,27 +387,27 @@ static int bthcitty_poll(FAR struct file *filep,
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void bthcitty_loop(void)
|
void sim_btuart_loop(void)
|
||||||
{
|
{
|
||||||
FAR struct bthcitty_s *dev;
|
FAR struct sim_btuart_s *dev;
|
||||||
FAR sq_entry_t *entry;
|
FAR sq_entry_t *entry;
|
||||||
|
|
||||||
for (entry = sq_peek(&g_bthcitty_list); entry; entry = sq_next(entry))
|
for (entry = sq_peek(&g_sim_btuart_list); entry; entry = sq_next(entry))
|
||||||
{
|
{
|
||||||
dev = container_of(entry, struct bthcitty_s, link);
|
dev = container_of(entry, struct sim_btuart_s, link);
|
||||||
if (bthcisock_host_avail(dev->fd))
|
if (bthcisock_host_avail(dev->fd))
|
||||||
{
|
{
|
||||||
bthcitty_pollnotify(dev, POLLIN);
|
sim_btuart_pollnotify(dev, POLLIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int bthcitty_register(const char *name, int id)
|
int sim_btuart_register(const char *name, int id)
|
||||||
{
|
{
|
||||||
FAR struct bthcitty_s *dev;
|
FAR struct sim_btuart_s *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev = (FAR struct bthcitty_s *)kmm_zalloc(sizeof(struct bthcitty_s));
|
dev = (FAR struct sim_btuart_s *)kmm_zalloc(sizeof(struct sim_btuart_s));
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -423,7 +423,7 @@ int bthcitty_register(const char *name, int id)
|
|||||||
|
|
||||||
nxsem_set_protocol(&dev->recvsem, SEM_PRIO_NONE);
|
nxsem_set_protocol(&dev->recvsem, SEM_PRIO_NONE);
|
||||||
|
|
||||||
ret = register_driver(name, &g_bthcitty_ops, 0666, dev);
|
ret = register_driver(name, &g_sim_btuart_ops, 0666, dev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
nxsem_destroy(&dev->recvlock);
|
nxsem_destroy(&dev->recvlock);
|
||||||
@@ -434,6 +434,6 @@ int bthcitty_register(const char *name, int id)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sq_addlast(&dev->link, &g_bthcitty_list);
|
sq_addlast(&dev->link, &g_sim_btuart_list);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ void up_idle(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_HCITTY
|
#ifdef CONFIG_SIM_HCITTY
|
||||||
bthcitty_loop();
|
sim_btuart_loop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_SOUND
|
#ifdef CONFIG_SIM_SOUND
|
||||||
|
|||||||
@@ -404,11 +404,11 @@ int bthcisock_register(int dev_id);
|
|||||||
int bthcisock_loop(void);
|
int bthcisock_loop(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* up_hcitty.c **************************************************************/
|
/* up_btuart.c **************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_HCITTY
|
#ifdef CONFIG_SIM_BTUART
|
||||||
int bthcitty_register(const char *name, int id);
|
int sim_btuart_register(const char *name, int id);
|
||||||
void bthcitty_loop(void);
|
void sim_btuart_loop(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* up_audio.c ***************************************************************/
|
/* up_audio.c ***************************************************************/
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ CONFIG_SCHED_HAVE_PARENT=y
|
|||||||
CONFIG_SCHED_ONEXIT=y
|
CONFIG_SCHED_ONEXIT=y
|
||||||
CONFIG_SCHED_WAITPID=y
|
CONFIG_SCHED_WAITPID=y
|
||||||
CONFIG_SDCLONE_DISABLE=y
|
CONFIG_SDCLONE_DISABLE=y
|
||||||
CONFIG_SIM_HCITTY=y
|
CONFIG_SIM_BTUART=y
|
||||||
CONFIG_START_DAY=3
|
CONFIG_START_DAY=3
|
||||||
CONFIG_START_MONTH=4
|
CONFIG_START_MONTH=4
|
||||||
CONFIG_SYSTEM_NSH=y
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
|||||||
@@ -348,13 +348,13 @@ int sim_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_HCITTY
|
#ifdef CONFIG_SIM_BTUART
|
||||||
/* Register the HCI TTY device via HCI socket */
|
/* Register the HCI TTY device via HCI socket */
|
||||||
|
|
||||||
ret = bthcitty_register("/dev/ttyHCI", 0); /* Use HCI0 */
|
ret = sim_btuart_register("/dev/ttyHCI", 0); /* Use HCI0 */
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
syslog(LOG_ERR, "ERROR: bthcitty_register() failed: %d\n", ret);
|
syslog(LOG_ERR, "ERROR: sim_btuart_register() failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef CONFIG_BLUETOOTH_UART_SHIM
|
# ifdef CONFIG_BLUETOOTH_UART_SHIM
|
||||||
|
|||||||
Reference in New Issue
Block a user