bluetooth: Forward ioctl to btuart lowerhalf driver
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
fab8b081c0
commit
6ec74d8d36
@ -306,3 +306,23 @@ void btuart_close(FAR struct bt_driver_s *dev)
|
||||
|
||||
lower->rxattach(lower, NULL, NULL);
|
||||
}
|
||||
|
||||
int btuart_ioctl(FAR struct bt_driver_s *dev,
|
||||
int cmd, unsigned long arg)
|
||||
{
|
||||
FAR struct btuart_upperhalf_s *upper;
|
||||
FAR const struct btuart_lowerhalf_s *lower;
|
||||
|
||||
upper = (FAR struct btuart_upperhalf_s *)dev;
|
||||
DEBUGASSERT(upper != NULL && upper->lower != NULL);
|
||||
lower = upper->lower;
|
||||
|
||||
if (lower->ioctl)
|
||||
{
|
||||
return lower->ioctl(lower, cmd, arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
@ -92,5 +92,7 @@ int btuart_send(FAR struct bt_driver_s *dev,
|
||||
FAR void *data, size_t len);
|
||||
int btuart_open(FAR struct bt_driver_s *dev);
|
||||
void btuart_close(FAR struct bt_driver_s *dev);
|
||||
int btuart_ioctl(FAR struct bt_driver_s *dev,
|
||||
int cmd, unsigned long arg);
|
||||
|
||||
#endif /* __DRIVER_WIRELESS_BLUETOOTH_BT_UART_H */
|
||||
|
@ -424,6 +424,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
upper->dev.open = btuart_open;
|
||||
upper->dev.send = btuart_send;
|
||||
upper->dev.close = btuart_close;
|
||||
upper->dev.ioctl = btuart_ioctl;
|
||||
upper->lower = lower;
|
||||
|
||||
/* Load firmware */
|
||||
|
@ -190,6 +190,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
upper->dev.open = btuart_open;
|
||||
upper->dev.send = btuart_send;
|
||||
upper->dev.close = btuart_close;
|
||||
upper->dev.ioctl = btuart_ioctl;
|
||||
upper->lower = lower;
|
||||
|
||||
/* Load firmware */
|
||||
|
@ -84,6 +84,7 @@ int btuart_register(FAR const struct btuart_lowerhalf_s *lower)
|
||||
upper->dev.open = btuart_open;
|
||||
upper->dev.send = btuart_send;
|
||||
upper->dev.close = btuart_close;
|
||||
upper->dev.ioctl = btuart_ioctl;
|
||||
upper->lower = lower;
|
||||
|
||||
/* And register the driver with the network and the Bluetooth stack. */
|
||||
|
@ -137,6 +137,11 @@ struct btuart_lowerhalf_s
|
||||
/* Flush/drain all buffered RX data */
|
||||
|
||||
CODE ssize_t (*rxdrain)(FAR const struct btuart_lowerhalf_s *lower);
|
||||
|
||||
/* Lower-half logic may support platform-specific ioctl commands */
|
||||
|
||||
CODE int (*ioctl)(FAR const struct btuart_lowerhalf_s *lower,
|
||||
int cmd, unsigned long arg);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user