1
- /* mbed Microcontroller Library
2
- * Copyright (c) 2006-2013 ARM Limited
1
+ /* Copyright (c) 2020 Renesas Electronics Corporation.
2
+ * SPDX-License-Identifier: Apache-2.0
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
14
14
* limitations under the License.
15
15
*/
16
16
#include <string.h>
17
- #include "ethernet_api .h"
17
+ #include "rza1_eth .h"
18
18
#include "cmsis.h"
19
19
#include "mbed_interface.h"
20
20
#include "mbed_toolchain.h"
21
21
#include "mbed_error.h"
22
22
#include "iodefine.h"
23
- #include "ethernetext_api .h"
23
+ #include "rza1_eth_ext .h"
24
24
25
25
#if DEVICE_ETHERNET
26
26
89
89
/* 0x00000001 : Receive frame CRC error */
90
90
#define EDMAC_EESIPR_INI_EtherC (0x00400000) /* 0x00400000 : E-MAC status register */
91
91
92
- void ethernet_address (char * );
93
- void ethernet_set_link (int , int );
92
+ void rza1_ethernet_address (char * );
93
+ void rza1_ethernet_set_link (int , int );
94
94
95
95
96
96
/* Send descriptor */
@@ -114,13 +114,13 @@ typedef struct tag_edmac_recv_desc {
114
114
/* Transmit/receive buffers (must be allocated in 16-byte boundaries) */
115
115
#if defined(__ICCARM__ )
116
116
#pragma data_alignment=16
117
- static uint8_t ethernet_nc_memory [(sizeof (edmac_send_desc_t ) * NUM_OF_TX_DESCRIPTOR ) +
117
+ static uint8_t rza1_ethernet_nc_memory [(sizeof (edmac_send_desc_t ) * NUM_OF_TX_DESCRIPTOR ) +
118
118
(sizeof (edmac_recv_desc_t ) * NUM_OF_RX_DESCRIPTOR ) +
119
119
(NUM_OF_TX_DESCRIPTOR * SIZE_OF_BUFFER ) +
120
120
(NUM_OF_RX_DESCRIPTOR * SIZE_OF_BUFFER )] //16 bytes aligned!
121
121
@ ".mirrorram ";
122
122
#else
123
- static uint8_t ethernet_nc_memory [(sizeof (edmac_send_desc_t ) * NUM_OF_TX_DESCRIPTOR ) +
123
+ static uint8_t rza1_ethernet_nc_memory [(sizeof (edmac_send_desc_t ) * NUM_OF_TX_DESCRIPTOR ) +
124
124
(sizeof (edmac_recv_desc_t ) * NUM_OF_RX_DESCRIPTOR ) +
125
125
(NUM_OF_TX_DESCRIPTOR * SIZE_OF_BUFFER ) +
126
126
(NUM_OF_RX_DESCRIPTOR * SIZE_OF_BUFFER )]
@@ -162,7 +162,7 @@ static void set_ether_pir(uint32_t set_data);
162
162
static void wait_100us (int32_t wait_cnt );
163
163
164
164
165
- int ethernetext_init (ethernet_cfg_t * p_ethcfg ) {
165
+ int ethernetext_init (rza1_ethernet_cfg_t * p_ethcfg ) {
166
166
int32_t i ;
167
167
uint16_t val ;
168
168
@@ -210,38 +210,6 @@ int ethernetext_init(ethernet_cfg_t *p_ethcfg) {
210
210
wait_100us (250 ); /* 25msec */
211
211
GPIOP4 |= 0x0004 ; /* P4_2 Outputs high level */
212
212
wait_100us (100 ); /* 10msec */
213
- #elif defined(TARGET_VK_RZ_A1H )
214
- /* -->4F<-- P1_14(ET_COL) */
215
- GPIOPMC1 |= 0x4000 ;
216
- GPIOPFCAE1 &= ~0x4000 ;
217
- GPIOPFCE1 |= 0x4000 ;
218
- GPIOPFC1 |= 0x4000 ;
219
- GPIOPIPC1 |= 0x4000 ;
220
-
221
- /* -->2F<-- P2_0(ET_TXCLK), P2_1(ET_TXER), P2_2(ET_TXEN), P2_3(ET_CRS), P2_4(ET_TXD0),
222
- P2_5(ET_TXD1), P2_6(ET_TXD2), P2_7(ET_TXD3), P2_8(ET_RXD0), P2_9(ET_RXD1), P2_10(ET_RXD2) P2_11(ET_RXD3) */
223
- GPIOPMC2 |= 0x0FFF ;
224
- GPIOPFCAE2 &= ~0x0FFF ;
225
- GPIOPFCE2 &= ~0x0FFF ;
226
- GPIOPFC2 |= 0x0FFF ;
227
- GPIOPIPC2 |= 0x0FFF ;
228
-
229
- /* -->3F<-- P3_3(ET_MDIO), P3_4(ET_RXCLK), P3_5(ET_RXER), P3_6(ET_RXDV) */
230
- GPIOPMC3 |= 0x0078 ;
231
- GPIOPFCAE3 &= ~0x0078 ;
232
- GPIOPFCE3 &= ~0x0078 ;
233
- GPIOPFC3 |= 0x0078 ;
234
- GPIOPIPC3 |= 0x0078 ;
235
-
236
- /* -->3F<-- P7_0(ET_MDC) */
237
- GPIOPMC7 |= 0x0001 ;
238
- GPIOPFCAE7 &= ~0x0001 ;
239
- GPIOPFCE7 |= 0x0001 ;
240
- GPIOPFC7 &= ~0x0001 ;
241
- GPIOPIPC7 |= 0x0001 ;
242
-
243
- /* Resets the E-MAC,E-DMAC */
244
- lan_reg_reset ();
245
213
#else
246
214
#error "There is no initialization processing."
247
215
#endif
@@ -265,7 +233,7 @@ int ethernetext_init(ethernet_cfg_t *p_ethcfg) {
265
233
if (p_ethcfg -> ether_mac != NULL ) {
266
234
(void )memcpy (mac_addr , p_ethcfg -> ether_mac , sizeof (mac_addr ));
267
235
} else {
268
- ethernet_address (mac_addr ); /* Get MAC Address */
236
+ rza1_ethernet_address (mac_addr ); /* Get MAC Address */
269
237
}
270
238
271
239
return 0 ;
@@ -390,24 +358,24 @@ void ethernetext_set_all_multicast(int all) {
390
358
}
391
359
392
360
393
- int ethernet_init () {
394
- ethernet_cfg_t ethcfg ;
361
+ int rza1_ethernet_init () {
362
+ rza1_ethernet_cfg_t ethcfg ;
395
363
396
364
ethcfg .int_priority = 5 ;
397
365
ethcfg .recv_cb = NULL ;
398
366
ethcfg .ether_mac = NULL ;
399
367
ethernetext_init (& ethcfg );
400
- ethernet_set_link (-1 , 0 ); /* Auto-Negotiation */
368
+ rza1_ethernet_set_link (-1 , 0 ); /* Auto-Negotiation */
401
369
402
370
return 0 ;
403
371
}
404
372
405
- void ethernet_free () {
373
+ void rza1_ethernet_free () {
406
374
ETHERARSTR |= 0x00000001 ; /* ETHER software reset */
407
375
CPGSTBCR7 |= CPG_STBCR7_BIT_MSTP74 ; /* disable ETHER clock */
408
376
}
409
377
410
- int ethernet_write (const char * data , int slen ) {
378
+ int rza1_ethernet_write (const char * data , int slen ) {
411
379
edmac_send_desc_t * p_send_desc ;
412
380
int32_t copy_size ;
413
381
@@ -431,7 +399,7 @@ int ethernet_write(const char *data, int slen) {
431
399
return copy_size ;
432
400
}
433
401
434
- int ethernet_send () {
402
+ int rza1_ethernet_send () {
435
403
edmac_send_desc_t * p_send_desc ;
436
404
int32_t ret ;
437
405
@@ -463,7 +431,7 @@ int ethernet_send() {
463
431
return ret ;
464
432
}
465
433
466
- int ethernet_receive () {
434
+ int rza1_ethernet_receive () {
467
435
edmac_recv_desc_t * p_recv_desc ;
468
436
int32_t receive_size = 0 ;
469
437
@@ -507,7 +475,7 @@ int ethernet_receive() {
507
475
return receive_size ;
508
476
}
509
477
510
- int ethernet_read (char * data , int dlen ) {
478
+ int rza1_ethernet_read (char * data , int dlen ) {
511
479
edmac_recv_desc_t * p_recv_desc = p_recv_end_desc ; /* Read top descriptor */
512
480
int32_t copy_size ;
513
481
@@ -525,13 +493,13 @@ int ethernet_read(char *data, int dlen) {
525
493
return copy_size ;
526
494
}
527
495
528
- void ethernet_address (char * mac ) {
496
+ void rza1_ethernet_address (char * mac ) {
529
497
if (mac != NULL ) {
530
498
mbed_mac_address (mac ); /* Get MAC Address */
531
499
}
532
500
}
533
501
534
- int ethernet_link (void ) {
502
+ int rza1_ethernet_link (void ) {
535
503
int32_t ret ;
536
504
uint16_t data ;
537
505
@@ -545,7 +513,7 @@ int ethernet_link(void) {
545
513
return ret ;
546
514
}
547
515
548
- void ethernet_set_link (int speed , int duplex ) {
516
+ void rza1_ethernet_set_link (int speed , int duplex ) {
549
517
uint16_t data ;
550
518
int32_t i ;
551
519
int32_t link ;
@@ -612,8 +580,8 @@ static void lan_desc_create(void) {
612
580
int32_t i ;
613
581
uint8_t * p_memory_top ;
614
582
615
- (void )memset ((void * )ethernet_nc_memory , 0 , sizeof (ethernet_nc_memory ));
616
- p_memory_top = ethernet_nc_memory ;
583
+ (void )memset ((void * )rza1_ethernet_nc_memory , 0 , sizeof (rza1_ethernet_nc_memory ));
584
+ p_memory_top = rza1_ethernet_nc_memory ;
617
585
618
586
/* Descriptor area configuration */
619
587
p_eth_desc_dsend = (edmac_send_desc_t * )p_memory_top ;
0 commit comments