Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
mdio.h
Go to the documentation of this file.
1
7
/*
8
* Copyright (c) 2021 IP-Logix Inc.
9
*
10
* SPDX-License-Identifier: Apache-2.0
11
*/
12
#ifndef ZEPHYR_INCLUDE_DRIVERS_MDIO_H_
13
#define ZEPHYR_INCLUDE_DRIVERS_MDIO_H_
14
21
#include <
zephyr/types.h
>
22
#include <device.h>
23
24
#ifdef __cplusplus
25
extern
"C"
{
26
#endif
27
36
enum
MDIO_PROTOCOL {
37
CLAUSE_22 = 0,
38
CLAUSE_45 = 1,
39
MICREL_SMI = 2,
40
};
41
42
__subsystem
struct
mdio_driver_api {
44
void
(*bus_enable)(
const
struct
device
*dev);
45
47
void
(*bus_disable)(
const
struct
device
*dev);
48
50
int (*read)(
const
struct
device
*dev,
uint8_t
prtad,
uint8_t
devad,
51
uint16_t
*
data
);
52
54
int (*write)(
const
struct
device
*dev,
uint8_t
prtad,
uint8_t
devad,
55
uint16_t
data
);
56
};
67
__syscall
void
mdio_bus_enable
(
const
struct
device
*dev);
68
69
static
inline
void
z_impl_mdio_bus_enable(
const
struct
device
*dev)
70
{
71
const
struct
mdio_driver_api *api =
72
(
const
struct
mdio_driver_api *)dev->
api
;
73
74
return
api->bus_enable(dev);
75
}
76
83
__syscall
void
mdio_bus_disable
(
const
struct
device
*dev);
84
85
static
inline
void
z_impl_mdio_bus_disable(
const
struct
device
*dev)
86
{
87
const
struct
mdio_driver_api *api =
88
(
const
struct
mdio_driver_api *)dev->
api
;
89
90
return
api->bus_disable(dev);
91
}
92
108
__syscall
int
mdio_read
(
const
struct
device
*dev,
uint8_t
prtad,
uint8_t
devad,
109
uint16_t
*
data
);
110
111
static
inline
int
z_impl_mdio_read(
const
struct
device
*dev,
uint8_t
prtad,
112
uint8_t
devad,
uint16_t
*
data
)
113
{
114
const
struct
mdio_driver_api *api =
115
(
const
struct
mdio_driver_api *)dev->
api
;
116
117
return
api->read(dev, prtad, devad,
data
);
118
}
119
120
136
__syscall
int
mdio_write
(
const
struct
device
*dev,
uint8_t
prtad,
uint8_t
devad,
137
uint16_t
data
);
138
139
static
inline
int
z_impl_mdio_write(
const
struct
device
*dev,
uint8_t
prtad,
140
uint8_t
devad,
uint16_t
data
)
141
{
142
const
struct
mdio_driver_api *api =
143
(
const
struct
mdio_driver_api *)dev->
api
;
144
145
return
api->write(dev, prtad, devad,
data
);
146
}
147
148
#ifdef __cplusplus
149
}
150
#endif
151
156
#include <syscalls/mdio.h>
157
158
#endif
/* ZEPHYR_INCLUDE_DRIVERS_MDIO_H_ */
void
void
Definition:
eswifi_shell.c:15
mdio_bus_enable
void mdio_bus_enable(const struct device *dev)
Enable MDIO bus.
mdio_bus_disable
void mdio_bus_disable(const struct device *dev)
Disable MDIO bus and tri-state drivers.
mdio_write
int mdio_write(const struct device *dev, uint8_t prtad, uint8_t devad, uint16_t data)
Write to MDIO bus.
mdio_read
int mdio_read(const struct device *dev, uint8_t prtad, uint8_t devad, uint16_t *data)
Read from MDIO Bus.
types.h
uint8_t
__UINT8_TYPE__ uint8_t
Definition:
stdint.h:58
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:59
device
Runtime device structure (in ROM) per driver instance.
Definition:
device.h:367
device::api
const void * api
Definition:
device.h:373
data
static fdata_t data[2]
Definition:
test_fifo_contexts.c:15
include
drivers
mdio.h
Generated on Sun Oct 9 2022 09:21:56 for Zephyr API Documentation by
1.9.4