@@ -93,20 +93,20 @@ static int eth_tx(const struct device *dev, struct net_pkt *pkt)
93
93
len = net_pkt_get_len (pkt );
94
94
net_pkt_read (pkt , context -> tx_buf [context -> txslot ], len );
95
95
96
- sys_write8 (context -> txslot , LITEETH_TX_SLOT );
97
- sys_write8 (len >> 8 , LITEETH_TX_LENGTH );
98
- sys_write8 (len & 0xFF , LITEETH_TX_LENGTH + 4 );
96
+ litex_write8 (context -> txslot , LITEETH_TX_SLOT );
97
+ litex_write8 (len >> 8 , LITEETH_TX_LENGTH );
98
+ litex_write8 (len & 0xFF , LITEETH_TX_LENGTH + 4 );
99
99
100
100
/* wait for the device to be ready to transmit */
101
- while (sys_read8 (LITEETH_TX_READY ) == 0 ) {
101
+ while (litex_read8 (LITEETH_TX_READY ) == 0 ) {
102
102
if (attempts ++ == MAX_TX_FAILURE ) {
103
103
goto error ;
104
104
}
105
105
k_sleep (K_MSEC (1 ));
106
106
}
107
107
108
108
/* start transmitting */
109
- sys_write8 (1 , LITEETH_TX_START );
109
+ litex_write8 (1 , LITEETH_TX_START );
110
110
111
111
/* change slot */
112
112
context -> txslot = (context -> txslot + 1 ) % 2 ;
@@ -134,11 +134,11 @@ static void eth_rx(const struct device *port)
134
134
/* get frame's length */
135
135
for (int i = 0 ; i < 4 ; i ++ ) {
136
136
len <<= 8 ;
137
- len |= sys_read8 (LITEETH_RX_LENGTH + i * 0x4 );
137
+ len |= litex_read8 (LITEETH_RX_LENGTH + i * 0x4 );
138
138
}
139
139
140
140
/* which slot is the frame in */
141
- context -> rxslot = sys_read8 (LITEETH_RX_SLOT );
141
+ context -> rxslot = litex_read8 (LITEETH_RX_SLOT );
142
142
143
143
/* obtain rx buffer */
144
144
pkt = net_pkt_rx_alloc_with_buffer (context -> iface , len , AF_UNSPEC , 0 ,
@@ -169,19 +169,19 @@ static void eth_rx(const struct device *port)
169
169
static void eth_irq_handler (const struct device * port )
170
170
{
171
171
/* check sram reader events (tx) */
172
- if (sys_read8 (LITEETH_TX_EV_PENDING ) & LITEETH_EV_TX ) {
172
+ if (litex_read8 (LITEETH_TX_EV_PENDING ) & LITEETH_EV_TX ) {
173
173
/* TX event is not enabled nor used by this driver; ack just
174
174
* in case if some rogue TX event appeared
175
175
*/
176
- sys_write8 (LITEETH_EV_TX , LITEETH_TX_EV_PENDING );
176
+ litex_write8 (LITEETH_EV_TX , LITEETH_TX_EV_PENDING );
177
177
}
178
178
179
179
/* check sram writer events (rx) */
180
- if (sys_read8 (LITEETH_RX_EV_PENDING ) & LITEETH_EV_RX ) {
180
+ if (litex_read8 (LITEETH_RX_EV_PENDING ) & LITEETH_EV_RX ) {
181
181
eth_rx (port );
182
182
183
183
/* ack writer irq */
184
- sys_write8 (LITEETH_EV_RX , LITEETH_RX_EV_PENDING );
184
+ litex_write8 (LITEETH_EV_RX , LITEETH_RX_EV_PENDING );
185
185
}
186
186
}
187
187
@@ -226,8 +226,8 @@ static void eth_iface_init(struct net_if *iface)
226
226
}
227
227
228
228
/* clear pending events */
229
- sys_write8 (LITEETH_EV_TX , LITEETH_TX_EV_PENDING );
230
- sys_write8 (LITEETH_EV_RX , LITEETH_RX_EV_PENDING );
229
+ litex_write8 (LITEETH_EV_TX , LITEETH_TX_EV_PENDING );
230
+ litex_write8 (LITEETH_EV_RX , LITEETH_RX_EV_PENDING );
231
231
232
232
/* setup tx slots */
233
233
context -> txslot = 0 ;
@@ -264,7 +264,7 @@ static void eth_irq_config(void)
264
264
IRQ_CONNECT (LITEETH_IRQ , LITEETH_IRQ_PRIORITY , eth_irq_handler ,
265
265
DEVICE_DT_INST_GET (0 ), 0 );
266
266
irq_enable (LITEETH_IRQ );
267
- sys_write8 (1 , LITEETH_RX_EV_ENABLE );
267
+ litex_write8 (1 , LITEETH_RX_EV_ENABLE );
268
268
}
269
269
270
270
#endif /* CONFIG_ETH_LITEETH_0 */
0 commit comments