net: ptp: Add usermode support to net_eth_get_ptp_clock_by_index()
Make net_eth_get_ptp_clock_by_index() clock API to work with user space. Create also unit test for testing this user mode support. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
11b06fab76
commit
95e8498c27
4 changed files with 77 additions and 14 deletions
|
@ -19,6 +19,8 @@ LOG_MODULE_REGISTER(net_ethernet, CONFIG_NET_L2_ETHERNET_LOG_LEVEL);
|
|||
#include <net/lldp.h>
|
||||
#endif
|
||||
|
||||
#include <syscall_handler.h>
|
||||
|
||||
#include "arp.h"
|
||||
#include "eth_stats.h"
|
||||
#include "net_private.h"
|
||||
|
@ -988,7 +990,7 @@ struct device *net_eth_get_ptp_clock(struct net_if *iface)
|
|||
#endif /* CONFIG_PTP_CLOCK */
|
||||
|
||||
#if defined(CONFIG_PTP_CLOCK)
|
||||
struct device *net_eth_get_ptp_clock_by_index(int index)
|
||||
struct device *z_impl_net_eth_get_ptp_clock_by_index(int index)
|
||||
{
|
||||
struct net_if *iface;
|
||||
|
||||
|
@ -999,7 +1001,21 @@ struct device *net_eth_get_ptp_clock_by_index(int index)
|
|||
|
||||
return net_eth_get_ptp_clock(iface);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
Z_SYSCALL_HANDLER(net_eth_get_ptp_clock_by_index, index)
|
||||
{
|
||||
return (u32_t)z_impl_net_eth_get_ptp_clock_by_index(index);
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
#else /* CONFIG_PTP_CLOCK */
|
||||
struct device *z_impl_net_eth_get_ptp_clock_by_index(int index)
|
||||
{
|
||||
ARG_UNUSED(index);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_PTP_CLOCK */
|
||||
|
||||
#if defined(CONFIG_NET_GPTP)
|
||||
int net_eth_get_ptp_port(struct net_if *iface)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue