source: rtems/c/src/lib/libbsp/arm/tms570/include/ti_herc/reg_emac.h @ bea49c9

4.11
Last change on this file since bea49c9 was bea49c9, checked in by Premysl Houdek <kom541000@…>, on Jul 16, 2015 at 2:26:09 PM

bsp/tms570: New/generated header files for TMS570 SoC peripherals registers.

The header files are generated by script make_header.py.
Current script's version can be found at:

https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python

Registers offsets and fields have been extracted from reference manual.

Signed-off-by: Premysl Houdek <kom541000@…>

  • Property mode set to 100644
File size: 10.7 KB
Line 
1/* The header file is generated by make_header.py from EMAC.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_EMAC
40#define LIBBSP_ARM_tms570_EMAC
41
42#include <bsp/utility.h>
43
44typedef 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*/
61} tms570_emac_t;
62
63
64/*----------------------TMS570_EMACREVID----------------------*/
65/* field: REV - Identifies the MDIO Module revision. */
66#define TMS570_EMAC_REVID_REV(val) BSP_FLD32(val,0, 31)
67#define TMS570_EMAC_REVID_REV_GET(reg) BSP_FLD32GET(reg,0, 31)
68#define TMS570_EMAC_REVID_REV_SET(reg,val) BSP_FLD32SET(reg, val,0, 31)
69
70
71/*---------------------TMS570_EMACCONTROL---------------------*/
72/* field: IDLE - State machine IDLE status bit. */
73#define TMS570_EMAC_CONTROL_IDLE BSP_FLD32(31)
74
75/* field: ENABLE - State machine enable control bit. */
76#define TMS570_EMAC_CONTROL_ENABLE BSP_FLD32(30)
77
78/* field: HIGHEST_USER_CHANNEL - Highest user channel that is available in the module. It is currently set to 1. */
79#define TMS570_EMAC_CONTROL_HIGHEST_USER_CHANNEL(val) BSP_FLD32(val,24, 28)
80#define TMS570_EMAC_CONTROL_HIGHEST_USER_CHANNEL_GET(reg) BSP_FLD32GET(reg,24, 28)
81#define TMS570_EMAC_CONTROL_HIGHEST_USER_CHANNEL_SET(reg,val) BSP_FLD32SET(reg, val,24, 28)
82
83/* field: PREAMBLE - Preamble disable */
84#define TMS570_EMAC_CONTROL_PREAMBLE BSP_FLD32(20)
85
86/* field: FAULT - Fault indicator. */
87#define TMS570_EMAC_CONTROL_FAULT BSP_FLD32(19)
88
89/* field: FAULTENB - Fault detect enable. */
90#define TMS570_EMAC_CONTROL_FAULTENB BSP_FLD32(18)
91
92/* field: CLKDIV - Clock Divider bits. */
93#define TMS570_EMAC_CONTROL_CLKDIV(val) BSP_FLD32(val,0, 15)
94#define TMS570_EMAC_CONTROL_CLKDIV_GET(reg) BSP_FLD32GET(reg,0, 15)
95#define TMS570_EMAC_CONTROL_CLKDIV_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
96
97
98/*----------------------TMS570_EMACALIVE----------------------*/
99/* field: ALIVE - MDIO Alive bits. */
100#define TMS570_EMAC_ALIVE_ALIVE(val) BSP_FLD32(val,0, 31)
101#define TMS570_EMAC_ALIVE_ALIVE_GET(reg) BSP_FLD32GET(reg,0, 31)
102#define TMS570_EMAC_ALIVE_ALIVE_SET(reg,val) BSP_FLD32SET(reg, val,0, 31)
103
104
105/*----------------------TMS570_EMACLINK----------------------*/
106/* field: LINK - MDIO Link state bits. This register is updated after a read of the generic status register of a PHY. */
107#define TMS570_EMAC_LINK_LINK(val) BSP_FLD32(val,0, 31)
108#define TMS570_EMAC_LINK_LINK_GET(reg) BSP_FLD32GET(reg,0, 31)
109#define TMS570_EMAC_LINK_LINK_SET(reg,val) BSP_FLD32SET(reg, val,0, 31)
110
111
112/*-------------------TMS570_EMACLINKINTRAW-------------------*/
113/* field: USERPHY1 - MDIO Link change event, raw value. */
114#define TMS570_EMAC_LINKINTRAW_USERPHY1 BSP_FLD32(1)
115
116/* field: USERPHY0 - MDIO Link change event, raw value. */
117#define TMS570_EMAC_LINKINTRAW_USERPHY0 BSP_FLD32(0)
118
119
120/*------------------TMS570_EMACLINKINTMASKED------------------*/
121/* field: USERPHY1 - MDIO Link change interrupt, masked value. */
122#define TMS570_EMAC_LINKINTMASKED_USERPHY1 BSP_FLD32(1)
123
124/* field: USERPHY0 - MDIO Link change interrupt, masked value. */
125#define TMS570_EMAC_LINKINTMASKED_USERPHY0 BSP_FLD32(0)
126
127
128/*-------------------TMS570_EMACUSERINTRAW-------------------*/
129/* field: USERACCESS1 - MDIO User command complete event bit. */
130#define TMS570_EMAC_USERINTRAW_USERACCESS1 BSP_FLD32(1)
131
132/* field: USERACCESS0 - MDIO User command complete event bit. */
133#define TMS570_EMAC_USERINTRAW_USERACCESS0 BSP_FLD32(0)
134
135
136/*------------------TMS570_EMACUSERINTMASKED------------------*/
137/* field: USERACCESS1 - Masked value of MDIO User command complete interrupt. */
138#define TMS570_EMAC_USERINTMASKED_USERACCESS1 BSP_FLD32(1)
139
140/* field: USERACCESS0 - Masked value of MDIO User command complete interrupt. */
141#define TMS570_EMAC_USERINTMASKED_USERACCESS0 BSP_FLD32(0)
142
143
144/*-----------------TMS570_EMACUSERINTMASKSET-----------------*/
145/* field: USERACCESS1 - MDIO user interrupt mask set for USERINTMASKED[1]. */
146#define TMS570_EMAC_USERINTMASKSET_USERACCESS1 BSP_FLD32(1)
147
148/* field: USERACCESS0 - MDIO user interrupt mask set for USERINTMASKED[0]. */
149#define TMS570_EMAC_USERINTMASKSET_USERACCESS0 BSP_FLD32(0)
150
151
152/*----------------TMS570_EMACUSERINTMASKCLEAR----------------*/
153/* field: USERACCESS1 - MDIO user command complete interrupt mask clear for USERINTMASKED[1]. */
154#define TMS570_EMAC_USERINTMASKCLEAR_USERACCESS1 BSP_FLD32(1)
155
156/* field: USERACCESS0 - MDIO user command complete interrupt mask clear for USERINTMASKED[0]. */
157#define TMS570_EMAC_USERINTMASKCLEAR_USERACCESS0 BSP_FLD32(0)
158
159
160/*-------------------TMS570_EMACUSERACCESS0-------------------*/
161/* field: GO - Go bit. */
162#define TMS570_EMAC_USERACCESS0_GO BSP_FLD32(31)
163
164/* field: WRITE - Write enable bit. */
165#define TMS570_EMAC_USERACCESS0_WRITE BSP_FLD32(30)
166
167/* field: ACK - Acknowledge bit. This bit is set if the PHY acknowledged the read transaction. */
168#define TMS570_EMAC_USERACCESS0_ACK BSP_FLD32(29)
169
170/* field: REGADR - Register address bits. */
171#define TMS570_EMAC_USERACCESS0_REGADR(val) BSP_FLD32(val,21, 25)
172#define TMS570_EMAC_USERACCESS0_REGADR_GET(reg) BSP_FLD32GET(reg,21, 25)
173#define TMS570_EMAC_USERACCESS0_REGADR_SET(reg,val) BSP_FLD32SET(reg, val,21, 25)
174
175/* field: PHYADR - PHY address bits. This field specifies the PHY to be accessed for this transaction. */
176#define TMS570_EMAC_USERACCESS0_PHYADR(val) BSP_FLD32(val,16, 20)
177#define TMS570_EMAC_USERACCESS0_PHYADR_GET(reg) BSP_FLD32GET(reg,16, 20)
178#define TMS570_EMAC_USERACCESS0_PHYADR_SET(reg,val) BSP_FLD32SET(reg, val,16, 20)
179
180/* field: DATA - User data bits. */
181#define TMS570_EMAC_USERACCESS0_DATA(val) BSP_FLD32(val,0, 15)
182#define TMS570_EMAC_USERACCESS0_DATA_GET(reg) BSP_FLD32GET(reg,0, 15)
183#define TMS570_EMAC_USERACCESS0_DATA_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
184
185
186/*-------------------TMS570_EMACUSERPHYSEL0-------------------*/
187/* field: LINKSEL - Link status determination select bit. */
188#define TMS570_EMAC_USERPHYSEL0_LINKSEL BSP_FLD32(7)
189
190/* field: LINKINTENB - Link change interrupt enable. */
191#define TMS570_EMAC_USERPHYSEL0_LINKINTENB BSP_FLD32(6)
192
193/* field: PHYADRMON - PHY address whose link status is to be monitored. */
194#define TMS570_EMAC_USERPHYSEL0_PHYADRMON(val) BSP_FLD32(val,0, 4)
195#define TMS570_EMAC_USERPHYSEL0_PHYADRMON_GET(reg) BSP_FLD32GET(reg,0, 4)
196#define TMS570_EMAC_USERPHYSEL0_PHYADRMON_SET(reg,val) BSP_FLD32SET(reg, val,0, 4)
197
198
199/*-------------------TMS570_EMACUSERACCESS1-------------------*/
200/* field: GO - Go bit. */
201#define TMS570_EMAC_USERACCESS1_GO BSP_FLD32(31)
202
203/* field: WRITE - Write enable bit. */
204#define TMS570_EMAC_USERACCESS1_WRITE BSP_FLD32(30)
205
206/* field: ACK - Acknowledge bit. This bit is set if the PHY acknowledged the read transaction. */
207#define TMS570_EMAC_USERACCESS1_ACK BSP_FLD32(29)
208
209/* field: REGADR - Register address bits. */
210#define TMS570_EMAC_USERACCESS1_REGADR(val) BSP_FLD32(val,21, 25)
211#define TMS570_EMAC_USERACCESS1_REGADR_GET(reg) BSP_FLD32GET(reg,21, 25)
212#define TMS570_EMAC_USERACCESS1_REGADR_SET(reg,val) BSP_FLD32SET(reg, val,21, 25)
213
214/* field: PHYADR - PHY address bits. This field specifies the PHY to be accessed for this transaction. */
215#define TMS570_EMAC_USERACCESS1_PHYADR(val) BSP_FLD32(val,16, 20)
216#define TMS570_EMAC_USERACCESS1_PHYADR_GET(reg) BSP_FLD32GET(reg,16, 20)
217#define TMS570_EMAC_USERACCESS1_PHYADR_SET(reg,val) BSP_FLD32SET(reg, val,16, 20)
218
219/* field: DATA - User data bits. */
220#define TMS570_EMAC_USERACCESS1_DATA(val) BSP_FLD32(val,0, 15)
221#define TMS570_EMAC_USERACCESS1_DATA_GET(reg) BSP_FLD32GET(reg,0, 15)
222#define TMS570_EMAC_USERACCESS1_DATA_SET(reg,val) BSP_FLD32SET(reg, val,0, 15)
223
224
225/*-------------------TMS570_EMACUSERPHYSEL1-------------------*/
226/* field: LINKSEL - Link status determination select bit. */
227#define TMS570_EMAC_USERPHYSEL1_LINKSEL BSP_FLD32(7)
228
229/* field: LINKINTENB - Link change interrupt enable. */
230#define TMS570_EMAC_USERPHYSEL1_LINKINTENB BSP_FLD32(6)
231
232/* field: PHYADRMON - PHY address whose link status is to be monitored. */
233#define TMS570_EMAC_USERPHYSEL1_PHYADRMON(val) BSP_FLD32(val,0, 4)
234#define TMS570_EMAC_USERPHYSEL1_PHYADRMON_GET(reg) BSP_FLD32GET(reg,0, 4)
235#define TMS570_EMAC_USERPHYSEL1_PHYADRMON_SET(reg,val) BSP_FLD32SET(reg, val,0, 4)
236
237
238
239#endif /* LIBBSP_ARM_tms570_EMAC */
Note: See TracBrowser for help on using the repository browser.