risc-v/bl602: BLE firmware adapts to the new framework
Signed-off-by: Virus.V <virusv@live.com>
This commit is contained in:
parent
cd50650583
commit
8452c571ec
@ -30,6 +30,7 @@
|
|||||||
#include <nuttx/init.h>
|
#include <nuttx/init.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
|
||||||
#ifdef CONFIG_STACK_OVERFLOW_CHECK
|
#ifdef CONFIG_STACK_OVERFLOW_CHECK
|
||||||
# include "sched/sched.h"
|
# include "sched/sched.h"
|
||||||
|
@ -44,6 +44,7 @@ CONFIG_INTELHEX_BINARY=y
|
|||||||
CONFIG_LIBC_PERROR_STDOUT=y
|
CONFIG_LIBC_PERROR_STDOUT=y
|
||||||
CONFIG_LIBC_STRERROR=y
|
CONFIG_LIBC_STRERROR=y
|
||||||
CONFIG_MAX_TASKS=16
|
CONFIG_MAX_TASKS=16
|
||||||
|
CONFIG_MM_CIRCBUF=y
|
||||||
CONFIG_MQ_MAXMSGSIZE=1024
|
CONFIG_MQ_MAXMSGSIZE=1024
|
||||||
CONFIG_NET=y
|
CONFIG_NET=y
|
||||||
CONFIG_NETDB_DNSCLIENT=y
|
CONFIG_NETDB_DNSCLIENT=y
|
||||||
|
@ -70,25 +70,10 @@
|
|||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
|
||||||
static void bl602_net_poll_work(FAR void *arg);
|
|
||||||
static void ble_hci_rx_poll_expiry(wdparm_t arg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
|
||||||
/* BLE HCI timer */
|
|
||||||
|
|
||||||
static struct wdog_s g_ble_hci_rx_poll;
|
|
||||||
|
|
||||||
/* For deferring poll work to the work queue */
|
|
||||||
|
|
||||||
static struct work_s g_ble_hci_rx_work;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -99,7 +84,6 @@ extern int bl602_net_initialize(void);
|
|||||||
|
|
||||||
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
||||||
extern void bl602_hci_uart_init(uint8_t uartid);
|
extern void bl602_hci_uart_init(uint8_t uartid);
|
||||||
extern int ble_hci_do_rx(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -306,11 +290,6 @@ int bl602_bringup(void)
|
|||||||
|
|
||||||
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
||||||
bl602_hci_uart_init(0);
|
bl602_hci_uart_init(0);
|
||||||
|
|
||||||
/* 50ms interval */
|
|
||||||
|
|
||||||
wd_start(&g_ble_hci_rx_poll,
|
|
||||||
1 * CLOCKS_PER_SEC / 20, ble_hci_rx_poll_expiry, (wdparm_t)NULL);
|
|
||||||
#endif /* CONFIG_BL602_BLE_CONTROLLER */
|
#endif /* CONFIG_BL602_BLE_CONTROLLER */
|
||||||
|
|
||||||
#ifdef CONFIG_FS_ROMFS
|
#ifdef CONFIG_FS_ROMFS
|
||||||
@ -341,29 +320,3 @@ int bl602_bringup(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_BL602_BLE_CONTROLLER)
|
|
||||||
static void bl602_net_poll_work(FAR void *arg)
|
|
||||||
{
|
|
||||||
ble_hci_do_rx();
|
|
||||||
|
|
||||||
/* 50ms interval */
|
|
||||||
|
|
||||||
wd_start(&g_ble_hci_rx_poll,
|
|
||||||
1 * CLOCKS_PER_SEC / 20, ble_hci_rx_poll_expiry, (wdparm_t)NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ble_hci_rx_poll_expiry(wdparm_t arg)
|
|
||||||
{
|
|
||||||
UNUSED(arg);
|
|
||||||
|
|
||||||
if (work_available(&g_ble_hci_rx_work))
|
|
||||||
{
|
|
||||||
work_queue(LPWORK, &g_ble_hci_rx_work, bl602_net_poll_work, NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user