Changeset 374 for asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZA1XX/ethernet_api.c
- Timestamp:
- Apr 5, 2019, 9:26:53 PM (5 years ago)
- Location:
- asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZA1XX
- Files:
-
- 1 added
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZA1XX/ethernet_api.c
r373 r374 20 20 #include "mbed_toolchain.h" 21 21 #include "mbed_error.h" 22 #include " ether_iodefine.h"22 #include "iodefine.h" 23 23 #include "ethernetext_api.h" 24 25 #if DEVICE_ETHERNET 24 26 25 27 /* Descriptor info */ … … 135 137 static uint32_t phy_id = 0; 136 138 static uint32_t start_stop = 1; /* 0:stop 1:start */ 139 static uint32_t tsu_ten_tmp = 0; 140 141 volatile struct st_ether_from_tsu_adrh0* ETHER_FROM_TSU_ADRH0_ARRAY[ ETHER_FROM_TSU_ADRH0_ARRAY_COUNT ] = 142 /* ->MISRA 11.3 */ /* ->SEC R2.7.1 */ 143 ETHER_FROM_TSU_ADRH0_ARRAY_ADDRESS_LIST; 144 /* <-MISRA 11.3 */ /* <-SEC R2.7.1 */ 137 145 138 146 /* function */ … … 276 284 } 277 285 286 void ethernetext_add_multicast_group(const uint8_t *addr) { 287 uint32_t cnt; 288 uint32_t tmp_data_h; 289 uint32_t tmp_data_l; 290 291 if (tsu_ten_tmp == 0xFFFFFFFF) { 292 ethernetext_set_all_multicast(1); 293 } else { 294 tmp_data_h = ((uint32_t)addr[0] << 24) | ((uint32_t)addr[1] << 16) | ((uint32_t)addr[2] << 8) | ((uint32_t)addr[3]); 295 tmp_data_l = ((uint32_t)addr[4] << 8) | ((uint32_t)addr[5]); 296 297 for (cnt = 0; cnt < 32; cnt++) { 298 if ((tsu_ten_tmp & (0x80000000 >> cnt)) == 0) { 299 while ((ETHERTSU_ADSBSY & 0x00000001) != 0) { 300 ; 301 } 302 ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRH0 = tmp_data_h; 303 while ((ETHERTSU_ADSBSY & 0x00000001) != 0) { 304 ; 305 } 306 ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRL0 = tmp_data_l; 307 if ((ETHERECMR0 & 0x00002000) != 0) { 308 ETHERTSU_TEN |= (0x80000000 >> cnt); 309 } 310 tsu_ten_tmp |= (0x80000000 >> cnt); 311 break; 312 } 313 } 314 } 315 } 316 317 void ethernetext_remove_multicast_group(const uint8_t *addr) { 318 uint32_t cnt; 319 uint32_t tmp_data_h; 320 uint32_t tmp_data_l; 321 322 tmp_data_h = ((uint32_t)addr[0] << 24) | ((uint32_t)addr[1] << 16) | ((uint32_t)addr[2] << 8) | ((uint32_t)addr[3]); 323 tmp_data_l = ((uint32_t)addr[4] << 8) | ((uint32_t)addr[5]); 324 325 for (cnt = 0; cnt< 32; cnt++) { 326 if ((ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRH0 == tmp_data_h) && 327 (ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRL0 == tmp_data_l)) { 328 while ((ETHERTSU_ADSBSY & 0x00000001) != 0) { 329 ; 330 } 331 ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRH0 = 0; 332 while ((ETHERTSU_ADSBSY & 0x00000001) != 0) { 333 ; 334 } 335 ETHER_FROM_TSU_ADRH0_ARRAY[cnt]->TSU_ADRL0 = 0; 336 337 ETHERTSU_TEN &= ~(0x80000000 >> cnt); 338 tsu_ten_tmp &= ~(0x80000000 >> cnt); 339 break; 340 } 341 } 342 } 343 344 void ethernetext_set_all_multicast(int all) { 345 if (all != 0) { 346 ETHERECMR0 &= ~(0x00002000); 347 ETHERTSU_TEN = 0x00000000; 348 } else { 349 ETHERECMR0 |= 0x00002000; 350 ETHERTSU_TEN = tsu_ten_tmp; 351 } 352 } 353 354 278 355 int ethernet_init() { 279 356 ethernet_cfg_t ethcfg; … … 575 652 ETHERECMR0 &= ~0x00000002; /* Set to half-duplex mode */ 576 653 } 654 ETHERECMR0 |= 0x00002000; /* MCT = 1 */ 577 655 578 656 /* Interrupt-related */ … … 584 662 /*InterruptHandlerRegister(ETHERI_IRQn, INT_Ether); /* Ethernet interrupt handler registration */ 585 663 GIC_SetPriority(ETHERI_IRQn, Interrupt_priority); /* Ethernet interrupt priority */ 664 GIC_SetConfiguration(ETHERI_IRQn, 1); 586 665 GIC_EnableIRQ(ETHERI_IRQn); /* Enables the E-DMAC interrupt */ 587 666 } … … 713 792 } 714 793 } 794 #endif /* DEVICE_ETHERNET */
Note:
See TracChangeset
for help on using the changeset viewer.