Go to the documentation of this file.
31 #ifndef _TJA1103_DRIVER_H
32 #define _TJA1103_DRIVER_H
38 #ifndef TJA1103_PHY_ADDR
39 #define TJA1103_PHY_ADDR 0
40 #elif (TJA1103_PHY_ADDR < 0 || TJA1103_PHY_ADDR > 31)
41 #error TJA1103_PHY_ADDR parameter is not valid
45 #define TJA1103_PHY_ID1 0x02
46 #define TJA1103_PHY_ID2 0x03
47 #define TJA1103_MMDCTRL 0x0D
48 #define TJA1103_MMDAD 0x0E
51 #define TJA1103_B100T1_PMAPMD_CTL 0x01, 0x0834
52 #define TJA1103_DEVICE_CTRL 0x1E, 0x0040
53 #define TJA1103_DEVICE_CONFIG 0x1E, 0x0048
54 #define TJA1103_ALWAYS_ACCESSIBLE 0x1E, 0x801F
55 #define TJA1103_PORT_CTRL 0x1E, 0x8040
56 #define TJA1103_PORT_ABILITIES 0x1E, 0x8046
57 #define TJA1103_PORT_FUNC_IRQ_EN 0x1E, 0x807A
58 #define TJA1103_PHY_IRQ_ACK 0x1E, 0x80A0
59 #define TJA1103_PHY_IRQ_EN 0x1E, 0x80A1
60 #define TJA1103_PHY_IRQ_STATUS 0x1E, 0x80A2
61 #define TJA1103_PHY_CTRL 0x1E, 0x8100
62 #define TJA1103_PHY_STAT 0x1E, 0x8102
63 #define TJA1103_PHY_CONFIG 0x1E, 0x8108
64 #define TJA1103_SIGNAL_QUALITY 0x1E, 0x8320
65 #define TJA1103_CABLE_TEST 0x1E, 0x8330
66 #define TJA1103_SYM_ERR_COUNTER 0x1E, 0x8350
67 #define TJA1103_SYM_ERR_COUNTER_EXTENDED 0x1E, 0x8351
68 #define TJA1103_LINK_DROP_COUNTER 0x1E, 0x8352
69 #define TJA1103_LINK_LOSSES_AND_FAILURES 0x1E, 0x8353
70 #define TJA1103_PTP_IRQ_ACK 0x1E, 0x9008
71 #define TJA1103_RX_GOOD_FRAME_COUNTER 0x1E, 0xA950
72 #define TJA1103_RX_BAD_FRAME_COUNTER 0x1E, 0xA952
73 #define TJA1103_RX_ERR_FRAME_COUNTER 0x1E, 0xA954
74 #define TJA1103_INFRA_CTRL 0x1E, 0xAC00
75 #define TJA1103_MONITOR_STATUS 0x1E, 0xAC80
76 #define TJA1103_MONITOR_CONFIG 0x1E, 0xAC86
77 #define TJA1103_ABILITIES 0x1E, 0xAFC4
78 #define TJA1103_MII_BASIC_CONFIG 0x1E, 0xAFC6
79 #define TJA1103_RXID 0x1E, 0xAFCC
80 #define TJA1103_TXID 0x1E, 0xAFCD
81 #define TJA1103_RX_PREAMBLE_COUNTER 0x1E, 0xAFCE
82 #define TJA1103_TX_PREAMBLE_COUNTER 0x1E, 0xAFCF
83 #define TJA1103_RX_IPG_LENGTH 0x1E, 0xAFD0
84 #define TJA1103_TX_IPG_LENGTH 0x1E, 0xAFD1
87 #define TJA1103_PHY_ID1_OUI_MSB 0xFFFF
88 #define TJA1103_PHY_ID1_OUI_MSB_DEFAULT 0x001B
91 #define TJA1103_PHY_ID2_OUI_LSB 0xFC00
92 #define TJA1103_PHY_ID2_OUI_LSB_DEFAULT 0xB000
93 #define TJA1103_PHY_ID2_TYPE_NO 0x03F0
94 #define TJA1103_PHY_ID2_TYPE_NO_DEFAULT 0x0010
95 #define TJA1103_PHY_ID2_REVISION_NO 0x000F
98 #define TJA1103_MMDCTRL_FNCTN 0xC000
99 #define TJA1103_MMDCTRL_FNCTN_ADDR 0x0000
100 #define TJA1103_MMDCTRL_FNCTN_DATA_NO_POST_INC 0x4000
101 #define TJA1103_MMDCTRL_FNCTN_DATA_POST_INC_RW 0x8000
102 #define TJA1103_MMDCTRL_FNCTN_DATA_POST_INC_W 0xC000
103 #define TJA1103_MMDCTRL_DEVAD 0x001F
106 #define TJA1103_B100T1_PMAPMD_CTL_CONFIG_EN 0x8000
107 #define TJA1103_B100T1_PMAPMD_CTL_MASTER 0x4000
110 #define TJA1103_DEVICE_CTRL_RESET 0x8000
111 #define TJA1103_DEVICE_CTRL_CONFIG_GLOBAL_EN 0x4000
112 #define TJA1103_DEVICE_CTRL_CONFIG_ALL_EN 0x2000
115 #define TJA1103_ALWAYS_ACCESSIBLE_FUSA_PASS 0x0010
118 #define TJA1103_PORT_CTRL_EN 0x4000
121 #define TJA1103_PORT_ABILITIES_PTP 0x0010
124 #define TJA1103_PORT_FUNC_IRQ_EN_PTP_IRQS 0x0008
127 #define TJA1103_PHY_IRQ_ACK_LINK_EVENT 0x0002
130 #define TJA1103_PHY_IRQ_EN_LINK_AVAIL 0x0004
131 #define TJA1103_PHY_IRQ_EN_LINK_EVENT 0x0002
134 #define TJA1103_PHY_IRQ_STATUS_LINK_AVAIL 0x0004
135 #define TJA1103_PHY_IRQ_STATUS_LINK_EVENT 0x0002
138 #define TJA1103_PHY_CTRL_CONFIG_EN 0x4000
139 #define TJA1103_PHY_CTRL_START_OP 0x0001
142 #define TJA1103_PHY_STAT_LINK_STATUS 0x0004
145 #define TJA1103_PHY_CONFIG_AUTO 0x0001
148 #define TJA1103_SIGNAL_QUALITY_SQI_VALID 0x4000
149 #define TJA1103_SIGNAL_QUALITY_SQI_MASK 0x0007
152 #define TJA1103_CABLE_TEST_EN 0x8000
153 #define TJA1103_CABLE_TEST_START 0x4000
154 #define TJA1103_CABLE_TEST_VALID 0x2000
155 #define TJA1103_CABLE_TEST_RESULT 0x0007
156 #define TJA1103_CABLE_TEST_RESULT_OK 0x0000
157 #define TJA1103_CABLE_TEST_RESULT_SHORTED 0x0001
158 #define TJA1103_CABLE_TEST_RESULT_OPEN 0x0002
159 #define TJA1103_CABLE_TEST_RESULT_UNKNOWN 0x0007
162 #define TJA1103_INFRA_CTRL_EN 0x4000
165 #define TJA1103_ABILITIES_RGMII_ID 0x8000
166 #define TJA1103_ABILITIES_RGMII 0x4000
167 #define TJA1103_ABILITIES_RMII 0x0400
168 #define TJA1103_ABILITIES_REVMII 0x0200
169 #define TJA1103_ABILITIES_MII 0x0100
170 #define TJA1103_ABILITIES_SGMII 0x0001
173 #define TJA1103_MII_BASIC_CONFIG_REV 0x0100
174 #define TJA1103_MII_BASIC_CONFIG_MODE 0x000F
175 #define TJA1103_MII_BASIC_CONFIG_MODE_MII 0x0004
176 #define TJA1103_MII_BASIC_CONFIG_MODE_RMII 0x0005
177 #define TJA1103_MII_BASIC_CONFIG_MODE_RGMII 0x0007
178 #define TJA1103_MII_BASIC_CONFIG_MODE_SGMII 0x0009
181 #define TJA1103_RXID_EN 0x8000
184 #define TJA1103_TXID_EN 0x8000
187 #define TJA1103_SYM_ERR_COUNTER_EN 0x8000
190 #define TJA1103_SYM_ERR_COUNTER_EXTENDED_EN 0x8000
193 #define TJA1103_LINK_DROP_COUNTER_EN 0x8000
196 #define TJA1103_LINK_LOSSES_AND_FAILURES_EN 0x8000
199 #define TJA1103_RX_GOOD_FRAME_COUNTER_EN 0x8000
202 #define TJA1103_RX_BAD_FRAME_COUNTER_EN 0x8000
205 #define TJA1103_RX_ERR_FRAME_COUNTER_EN 0x8000
208 #define TJA1103_RX_PREAMBLE_COUNTER_EN 0x8000
211 #define TJA1103_TX_PREAMBLE_COUNTER_EN 0x8000
214 #define TJA1103_MONITOR_STATUS_RESET 0x8000
217 #define TJA1103_MONITOR_CONFIG_LOST_FRAMES_CNT_EN 0x0200
218 #define TJA1103_MONITOR_CONFIG_ALL_FRAMES_CNT_EN 0x0100
uint16_t tja1103ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
const PhyDriver tja1103PhyDriver
TJA1103 Ethernet PHY driver.
void tja1103InitHook(NetInterface *interface)
TJA1103 custom configuration.
void tja1103EventHandler(NetInterface *interface)
TJA1103 event handler.
error_t tja1103Init(NetInterface *interface)
TJA1103 PHY transceiver initialization.
void tja1103EnableIrq(NetInterface *interface)
Enable interrupts.
void tja1103Tick(NetInterface *interface)
TJA1103 timer handler.
Network interface controller abstraction layer.
void tja1103DisableIrq(NetInterface *interface)
Disable interrupts.
void tja1103WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
void tja1103DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint16_t tja1103ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
void tja1103WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.