mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 02:48:37 +08:00
Compare commits
4 commits
aad38b735a
...
85eb63dd4e
Author | SHA1 | Date | |
---|---|---|---|
|
85eb63dd4e | ||
|
39780fdae1 | ||
|
ee2f3df2ff | ||
|
58e38a91c3 |
3 changed files with 18 additions and 4 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/spinlock.h>
|
||||||
#include <nuttx/vhost/vhost.h>
|
#include <nuttx/vhost/vhost.h>
|
||||||
#include <nuttx/wqueue.h>
|
#include <nuttx/wqueue.h>
|
||||||
|
|
||||||
|
@ -151,7 +152,7 @@ static int vhost_rng_probe(FAR struct vhost_device *hdev)
|
||||||
|
|
||||||
vqnames[0] = "virtio_rng";
|
vqnames[0] = "virtio_rng";
|
||||||
callback[0] = vhost_rng_handler;
|
callback[0] = vhost_rng_handler;
|
||||||
ret = vhost_create_virtqueues(hdev, 0, 1, vqnames, callback);
|
ret = vhost_create_virtqueues(hdev, 0, 1, vqnames, callback, NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
vhosterr("virtio_device_create_virtqueue failed, ret=%d\n", ret);
|
vhosterr("virtio_device_create_virtqueue failed, ret=%d\n", ret);
|
||||||
|
|
|
@ -83,8 +83,15 @@ static struct vhost_bus_s g_vhost_bus =
|
||||||
|
|
||||||
static bool vhost_status_driver_ok(FAR struct vhost_device *hdev)
|
static bool vhost_status_driver_ok(FAR struct vhost_device *hdev)
|
||||||
{
|
{
|
||||||
uint8_t status = vhost_get_status(hdev);
|
|
||||||
bool driver_ok = false;
|
bool driver_ok = false;
|
||||||
|
uint8_t status;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = vhost_get_status(hdev, &status);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
return driver_ok;
|
||||||
|
}
|
||||||
|
|
||||||
/* Busy wait until the remote is ready */
|
/* Busy wait until the remote is ready */
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
static struct wdog_s g_adjtime_wdog;
|
static struct wdog_s g_adjtime_wdog;
|
||||||
static long g_adjtime_ppb;
|
static long g_adjtime_ppb;
|
||||||
|
static spinlock_t g_adjtime_lock = SP_UNLOCKED;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
|
@ -58,8 +59,12 @@ static long g_adjtime_ppb;
|
||||||
|
|
||||||
static void adjtime_wdog_callback(wdparm_t arg)
|
static void adjtime_wdog_callback(wdparm_t arg)
|
||||||
{
|
{
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
|
|
||||||
|
flags = spin_lock_irqsave(&g_adjtime_lock);
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_HAVE_ADJTIME
|
#ifdef CONFIG_ARCH_HAVE_ADJTIME
|
||||||
up_adjtime(0);
|
up_adjtime(0);
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,6 +74,7 @@ static void adjtime_wdog_callback(wdparm_t arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_adjtime_ppb = 0;
|
g_adjtime_ppb = 0;
|
||||||
|
spin_unlock_irqrestore(&g_adjtime_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Query remaining adjustment in microseconds */
|
/* Query remaining adjustment in microseconds */
|
||||||
|
@ -108,7 +114,7 @@ static int adjtime_start(long long adjust_usec)
|
||||||
ppb = -ppb_limit;
|
ppb = -ppb_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = spin_lock_irqsave(&g_adjtime_lock);
|
||||||
|
|
||||||
/* Set new adjustment */
|
/* Set new adjustment */
|
||||||
|
|
||||||
|
@ -134,7 +140,7 @@ static int adjtime_start(long long adjust_usec)
|
||||||
wd_cancel(&g_adjtime_wdog);
|
wd_cancel(&g_adjtime_wdog);
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
spin_unlock_irqrestore(&g_adjtime_lock, flags);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue