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