RTEMS 6.1-rc4
Loading...
Searching...
No Matches
reg_mdio.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/* The header file is generated by make_header.py from MDIO.json */
12/* Current script's version can be found at: */
13/* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */
14
15/*
16 * Copyright (c) 2014-2015, Premysl Houdek <kom541000@gmail.com>
17 *
18 * Czech Technical University in Prague
19 * Zikova 1903/4
20 * 166 36 Praha 6
21 * Czech Republic
22 *
23 * All rights reserved.
24 *
25 * Redistribution and use in source and binary forms, with or without
26 * modification, are permitted provided that the following conditions are met:
27 *
28 * 1. Redistributions of source code must retain the above copyright notice, this
29 * list of conditions and the following disclaimer.
30 * 2. Redistributions in binary form must reproduce the above copyright notice,
31 * this list of conditions and the following disclaimer in the documentation
32 * and/or other materials provided with the distribution.
33 *
34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
35 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
38 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
41 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 *
45 * The views and conclusions contained in the software and documentation are those
46 * of the authors and should not be interpreted as representing official policies,
47 * either expressed or implied, of the FreeBSD Project.
48*/
49#ifndef LIBBSP_ARM_TMS570_MDIO
50#define LIBBSP_ARM_TMS570_MDIO
51
52#include <bsp/utility.h>
53
54typedef struct{
55 uint32_t REVID; /*MDIO Revision ID Register*/
56 uint32_t CONTROL; /*MDIO Control Register*/
57 uint32_t ALIVE; /*PHY Alive Status register*/
58 uint32_t LINK; /*PHY Link Status Register*/
59 uint32_t LINKINTRAW; /*MDIO Link Status Change Interrupt (Unmasked) Register*/
60 uint32_t LINKINTMASKED; /*MDIO Link Status Change Interrupt (Masked) Register*/
61 uint8_t reserved1 [8];
62 uint32_t USERINTRAW; /*MDIO User Command Complete Interrupt (Unmasked) Register*/
63 uint32_t USERINTMASKED; /*MDIO User Command Complete Interrupt (Masked) Register*/
64 uint32_t USERINTMASKSET; /*MDIO User Command Complete Interrupt Mask Set Register*/
65 uint32_t USERINTMASKCLEAR; /*MDIO User Command Complete Interrupt Mask Clear Register*/
66 uint8_t reserved2 [80];
67 uint32_t USERACCESS0; /*MDIO User Access Register 0*/
68 uint32_t USERPHYSEL0; /*MDIO User PHY Select Register 0*/
69 uint32_t USERACCESS1; /*MDIO User Access Register 1*/
70 uint32_t USERPHYSEL1; /*MDIO User PHY Select Register 1*/
72
73
74/*---------------------TMS570_MDIO_REVID---------------------*/
75/* field: REV - Identifies the MDIO Module revision. */
76/* Whole 32 bits */
77
78/*--------------------TMS570_MDIO_CONTROL--------------------*/
79/* field: IDLE - State machine IDLE status bit. */
80#define TMS570_MDIO_CONTROL_IDLE BSP_BIT32(31)
81
82/* field: ENABLE - State machine enable control bit. */
83#define TMS570_MDIO_CONTROL_ENABLE BSP_BIT32(30)
84
85/* field: HIGHEST_USER_CHANNEL - Highest user channel that is available in the module. It is currently set to 1. */
86#define TMS570_MDIO_CONTROL_HIGHEST_USER_CHANNEL(val) BSP_FLD32(val,24, 28)
87#define TMS570_MDIO_CONTROL_HIGHEST_USER_CHANNEL_GET(reg) BSP_FLD32GET(reg,24, 28)
88#define TMS570_MDIO_CONTROL_HIGHEST_USER_CHANNEL_SET(reg,val) BSP_FLD32SET(reg, val,24, 28)
89
90/* field: PREAMBLE - Preamble disable */
91#define TMS570_MDIO_CONTROL_PREAMBLE BSP_BIT32(20)
92
93/* field: FAULT - Fault indicator. */
94#define TMS570_MDIO_CONTROL_FAULT BSP_BIT32(19)
95
96/* field: FAULTENB - Fault detect enable. */
97#define TMS570_MDIO_CONTROL_FAULTENB BSP_BIT32(18)
98
99/* field: CLKDIV - Clock Divider bits. */
100#define TMS570_MDIO_CONTROL_CLKDIV(val) BSP_FLD32(val,0, 15)
101#define TMS570_MDIO_CONTROL_CLKDIV_GET(reg) BSP_FLD32GET(reg,0, 15)
102#define TMS570_MDIO_CONTROL_CLKDIV_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
103
104
105/*---------------------TMS570_MDIO_ALIVE---------------------*/
106/* field: ALIVE - MDIO Alive bits. */
107/* Whole 32 bits */
108
109/*----------------------TMS570_MDIO_LINK----------------------*/
110/* field: LINK - MDIO Link state bits. This register is updated after a read of the generic status register of a PHY. */
111/* Whole 32 bits */
112
113/*-------------------TMS570_MDIO_LINKINTRAW-------------------*/
114/* field: USERPHY1 - MDIO Link change event, raw value. */
115#define TMS570_MDIO_LINKINTRAW_USERPHY1 BSP_BIT32(1)
116
117/* field: USERPHY0 - MDIO Link change event, raw value. */
118#define TMS570_MDIO_LINKINTRAW_USERPHY0 BSP_BIT32(0)
119
120
121/*-----------------TMS570_MDIO_LINKINTMASKED-----------------*/
122/* field: USERPHY1 - MDIO Link change interrupt, masked value. */
123#define TMS570_MDIO_LINKINTMASKED_USERPHY1 BSP_BIT32(1)
124
125/* field: USERPHY0 - MDIO Link change interrupt, masked value. */
126#define TMS570_MDIO_LINKINTMASKED_USERPHY0 BSP_BIT32(0)
127
128
129/*-------------------TMS570_MDIO_USERINTRAW-------------------*/
130/* field: USERACCESS1 - MDIO User command complete event bit. */
131#define TMS570_MDIO_USERINTRAW_USERACCESS1 BSP_BIT32(1)
132
133/* field: USERACCESS0 - MDIO User command complete event bit. */
134#define TMS570_MDIO_USERINTRAW_USERACCESS0 BSP_BIT32(0)
135
136
137/*-----------------TMS570_MDIO_USERINTMASKED-----------------*/
138/* field: USERACCESS1 - Masked value of MDIO User command complete interrupt. */
139#define TMS570_MDIO_USERINTMASKED_USERACCESS1 BSP_BIT32(1)
140
141/* field: USERACCESS0 - Masked value of MDIO User command complete interrupt. */
142#define TMS570_MDIO_USERINTMASKED_USERACCESS0 BSP_BIT32(0)
143
144
145/*-----------------TMS570_MDIO_USERINTMASKSET-----------------*/
146/* field: USERACCESS1 - MDIO user interrupt mask set for USERINTMASKED[1]. */
147#define TMS570_MDIO_USERINTMASKSET_USERACCESS1 BSP_BIT32(1)
148
149/* field: USERACCESS0 - MDIO user interrupt mask set for USERINTMASKED[0]. */
150#define TMS570_MDIO_USERINTMASKSET_USERACCESS0 BSP_BIT32(0)
151
152
153/*----------------TMS570_MDIO_USERINTMASKCLEAR----------------*/
154/* field: USERACCESS1 - MDIO user command complete interrupt mask clear for USERINTMASKED[1]. */
155#define TMS570_MDIO_USERINTMASKCLEAR_USERACCESS1 BSP_BIT32(1)
156
157/* field: USERACCESS0 - MDIO user command complete interrupt mask clear for USERINTMASKED[0]. */
158#define TMS570_MDIO_USERINTMASKCLEAR_USERACCESS0 BSP_BIT32(0)
159
160
161/*------------------TMS570_MDIO_USERACCESS0------------------*/
162/* field: GO - Go bit. */
163#define TMS570_MDIO_USERACCESS0_GO BSP_BIT32(31)
164
165/* field: WRITE - Write enable bit. */
166#define TMS570_MDIO_USERACCESS0_WRITE BSP_BIT32(30)
167
168/* field: ACK - Acknowledge bit. This bit is set if the PHY acknowledged the read transaction. */
169#define TMS570_MDIO_USERACCESS0_ACK BSP_BIT32(29)
170
171/* field: REGADR - Register address bits. */
172#define TMS570_MDIO_USERACCESS0_REGADR(val) BSP_FLD32(val,21, 25)
173#define TMS570_MDIO_USERACCESS0_REGADR_GET(reg) BSP_FLD32GET(reg,21, 25)
174#define TMS570_MDIO_USERACCESS0_REGADR_SET(reg,val) BSP_FLD32SET(reg, val,21, 25)
175
176/* field: PHYADR - PHY address bits. This field specifies the PHY to be accessed for this transaction. */
177#define TMS570_MDIO_USERACCESS0_PHYADR(val) BSP_FLD32(val,16, 20)
178#define TMS570_MDIO_USERACCESS0_PHYADR_GET(reg) BSP_FLD32GET(reg,16, 20)
179#define TMS570_MDIO_USERACCESS0_PHYADR_SET(reg,val) BSP_FLD32SET(reg, val,16, 20)
180
181/* field: DATA - User data bits. */
182#define TMS570_MDIO_USERACCESS0_DATA(val) BSP_FLD32(val,0, 15)
183#define TMS570_MDIO_USERACCESS0_DATA_GET(reg) BSP_FLD32GET(reg,0, 15)
184#define TMS570_MDIO_USERACCESS0_DATA_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
185
186
187/*------------------TMS570_MDIO_USERPHYSEL0------------------*/
188/* field: LINKSEL - Link status determination select bit. */
189#define TMS570_MDIO_USERPHYSEL0_LINKSEL BSP_BIT32(7)
190
191/* field: LINKINTENB - Link change interrupt enable. */
192#define TMS570_MDIO_USERPHYSEL0_LINKINTENB BSP_BIT32(6)
193
194/* field: PHYADRMON - PHY address whose link status is to be monitored. */
195#define TMS570_MDIO_USERPHYSEL0_PHYADRMON(val) BSP_FLD32(val,0, 4)
196#define TMS570_MDIO_USERPHYSEL0_PHYADRMON_GET(reg) BSP_FLD32GET(reg,0, 4)
197#define TMS570_MDIO_USERPHYSEL0_PHYADRMON_SET(reg,val) BSP_FLD32SET(reg, val,0, 4)
198
199
200/*------------------TMS570_MDIO_USERACCESS1------------------*/
201/* field: GO - Go bit. */
202#define TMS570_MDIO_USERACCESS1_GO BSP_BIT32(31)
203
204/* field: WRITE - Write enable bit. */
205#define TMS570_MDIO_USERACCESS1_WRITE BSP_BIT32(30)
206
207/* field: ACK - Acknowledge bit. This bit is set if the PHY acknowledged the read transaction. */
208#define TMS570_MDIO_USERACCESS1_ACK BSP_BIT32(29)
209
210/* field: REGADR - Register address bits. */
211#define TMS570_MDIO_USERACCESS1_REGADR(val) BSP_FLD32(val,21, 25)
212#define TMS570_MDIO_USERACCESS1_REGADR_GET(reg) BSP_FLD32GET(reg,21, 25)
213#define TMS570_MDIO_USERACCESS1_REGADR_SET(reg,val) BSP_FLD32SET(reg, val,21, 25)
214
215/* field: PHYADR - PHY address bits. This field specifies the PHY to be accessed for this transaction. */
216#define TMS570_MDIO_USERACCESS1_PHYADR(val) BSP_FLD32(val,16, 20)
217#define TMS570_MDIO_USERACCESS1_PHYADR_GET(reg) BSP_FLD32GET(reg,16, 20)
218#define TMS570_MDIO_USERACCESS1_PHYADR_SET(reg,val) BSP_FLD32SET(reg, val,16, 20)
219
220/* field: DATA - User data bits. */
221#define TMS570_MDIO_USERACCESS1_DATA(val) BSP_FLD32(val,0, 15)
222#define TMS570_MDIO_USERACCESS1_DATA_GET(reg) BSP_FLD32GET(reg,0, 15)
223#define TMS570_MDIO_USERACCESS1_DATA_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
224
225
226/*------------------TMS570_MDIO_USERPHYSEL1------------------*/
227/* field: LINKSEL - Link status determination select bit. */
228#define TMS570_MDIO_USERPHYSEL1_LINKSEL BSP_BIT32(7)
229
230/* field: LINKINTENB - Link change interrupt enable. */
231#define TMS570_MDIO_USERPHYSEL1_LINKINTENB BSP_BIT32(6)
232
233/* field: PHYADRMON - PHY address whose link status is to be monitored. */
234#define TMS570_MDIO_USERPHYSEL1_PHYADRMON(val) BSP_FLD32(val,0, 4)
235#define TMS570_MDIO_USERPHYSEL1_PHYADRMON_GET(reg) BSP_FLD32GET(reg,0, 4)
236#define TMS570_MDIO_USERPHYSEL1_PHYADRMON_SET(reg,val) BSP_FLD32SET(reg, val,0, 4)
237
238
239
240#endif /* LIBBSP_ARM_TMS570_MDIO */
This header file provides utility macros for BSPs.
Definition: reg_mdio.h:54