/ * @brief * Interrupt handler of Ethernet device * * @details * * @note * * @param[in] dev * Pointer to device descriptor ******************************************************************************/
| 355 | * Pointer to device descriptor |
| 356 | ******************************************************************************/ |
| 357 | void efm_eth_isr(rt_device_t dev) |
| 358 | { |
| 359 | rt_uint8_t reg_eir, data; |
| 360 | volatile rt_uint8_t cnt; |
| 361 | |
| 362 | /* Disable RX and other interrutps */ |
| 363 | data = EIE_PKTIE | EIE_INTIE; |
| 364 | efm_eth_sendCmd(ENC28J60_BIT_FIELD_CLR, EIE, &data); |
| 365 | |
| 366 | /* Get interrupt flag */ |
| 367 | efm_eth_sendCmd(ENC28J60_READ_CTRL_REG, EIR, ®_eir); |
| 368 | |
| 369 | data = 0; |
| 370 | /* DMA completed */ |
| 371 | if (reg_eir & EIR_DMAIF) |
| 372 | { |
| 373 | data |= (rt_uint8_t)EIR_DMAIF; |
| 374 | } |
| 375 | /* Link Changed */ |
| 376 | if (reg_eir & EIR_LINKIF) |
| 377 | { |
| 378 | /* Read PHIR to clear the flag */ |
| 379 | efm_eth_readPhy(PHIR); |
| 380 | } |
| 381 | /* TX done */ |
| 382 | if (reg_eir & EIR_TXIF) |
| 383 | { |
| 384 | data |= (rt_uint8_t)EIR_TXIF; |
| 385 | } |
| 386 | /* TX error */ |
| 387 | if (reg_eir & EIR_TXERIF) |
| 388 | { |
| 389 | data |= (rt_uint8_t)EIR_TXERIF; |
| 390 | } |
| 391 | /* RX error */ |
| 392 | if (reg_eir & EIR_RXERIF) |
| 393 | { |
| 394 | data |= (rt_uint8_t)EIR_RXERIF; |
| 395 | } |
| 396 | /* Clear flags */ |
| 397 | efm_eth_sendCmd(ENC28J60_BIT_FIELD_CLR, EIR, &data); |
| 398 | |
| 399 | /* Get packet counter (Errata 6) */ |
| 400 | efm_eth_sendCmd(ENC28J60_READ_CTRL_REG, EPKTCNT, (rt_uint8_t *)&cnt); |
| 401 | if (cnt) |
| 402 | { |
| 403 | /* Inform Ethernet thread */ |
| 404 | eth_device_ready(ð_dev); |
| 405 | } |
| 406 | |
| 407 | /* Enable other interrupts */ |
| 408 | data = EIE_INTIE; |
| 409 | efm_eth_sendCmd(ENC28J60_BIT_FIELD_SET, EIE, &data); |
| 410 | } |
| 411 | |
| 412 | /***************************************************************************//** |
| 413 | * @brief |
nothing calls this directly
no test coverage detected