Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
eth_nxp_enet.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__
14#define ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__
15
16/*
17 * This header is for NXP ENET driver development
18 * and has definitions for internal implementations
19 * not to be used by application
20 */
21
22#include <zephyr/device.h>
23#include <zephyr/kernel.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30
31/*
32 * Reasons for callback to a driver:
33 *
34 * Module reset: The ENET module was reset, perhaps because of power management
35 * actions, and subdriver should reinitialize part of the module.
36 * Interrupt: An interrupt of a type relevant to the subdriver occurred.
37 * Interrupt enable: The driver's relevant interrupt was enabled in NVIC
38 */
39enum nxp_enet_callback_reason {
40 NXP_ENET_MODULE_RESET,
41 NXP_ENET_INTERRUPT,
42 NXP_ENET_INTERRUPT_ENABLED,
43};
44
45enum nxp_enet_driver {
46 NXP_ENET_MAC,
47 NXP_ENET_MDIO,
48 NXP_ENET_PTP_CLOCK,
49};
50
51struct nxp_enet_ptp_data {
52 struct k_sem ptp_ts_sem;
53 struct k_mutex *ptp_mutex; /* created in PTP driver */
54 void *enet; /* enet_handle poiniter used by PTP driver */
55 bool ptp_running; /* set by PTP driver once the 1588 timer is started */
56};
57
58#ifdef CONFIG_MDIO_NXP_ENET
59extern void nxp_enet_mdio_callback(const struct device *mdio_dev,
60 enum nxp_enet_callback_reason event,
61 void *data);
62#else
63#define nxp_enet_mdio_callback(...)
64#endif
65
66#ifdef CONFIG_PTP_CLOCK_NXP_ENET
67extern void nxp_enet_ptp_clock_callback(const struct device *dev,
68 enum nxp_enet_callback_reason event,
69 void *data);
70#else
71#define nxp_enet_ptp_clock_callback(...)
72#endif
73
74/*
75 * Internal implementation, inter-driver communication function
76 *
77 * dev: target device to call back
78 * dev_type: which driver to call back
79 * event: reason/cause of callback
80 * data: opaque data, will be interpreted based on reason and target driver
81 */
82extern void nxp_enet_driver_cb(const struct device *dev,
83 enum nxp_enet_driver dev_type,
84 enum nxp_enet_callback_reason event,
85 void *data);
86
88
89#ifdef __cplusplus
90}
91#endif
92
93
94#endif /* ZEPHYR_INCLUDE_DRIVERS_ETH_NXP_ENET_H__ */
APIs and macros for the Zephyr device model.
Public kernel APIs.
Runtime device structure (in ROM) per driver instance.
Definition device.h:543