Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Handle a network device’s interrupts on a specific interface.

Files

net_bsp.c

Prototype

Note that since NetDev_ISR_Handler() is accessed only by function pointer usually via an interrupt vector table, it doesn’t need to be globally available and should therefore be declared as ‘static’.

Arguments

None.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

Each network device’s interrupt, or set of device interrupts, must be handled by a unique BSP-level interrupt service routine (ISR) handler, NetDev_ISR_Handler(), which maps each specific device interrupt to its corresponding network interface ISR handler, NetIF_ISR_Handler(). For some CPUs this may be a first- or second-level interrupt handler. Generally, the application must configure the interrupt controller to call every network device’s unique NetDev_ISR_Handler() when the device’s interrupt occurs (see function NetDev_CfgIntCtrl()). Every unique NetDev_ISR_Handler() must then perform the following actions:

  1. Call NetIF_ISR_Handler() with the device’s unique network interface number and appropriate interrupt type. The device’s network interface number should be available after configuration in the device’s NetDev_CfgIntCtrl() function (see function NetDev_CfgIntCtrl()). NetIF_ISR_Handler() in turn calls the appropriate device driver’s interrupt handler.

    In most cases, each device requires only a single NetDev_ISR_Handler() which calls NetIF_ISR_Handler() with interrupt type code NET_DEV_ISR_TYPE_UNKNOWN. This is possible when the device’s driver can determine the device’s interrupt type to via internal device registers or the interrupt controller. However, some devices cannot generically determine the interrupt type when an interrupt occurs and may therefore require multiple, unique NetDev_ISR_Handler()’s each of which calls NetIF_ISR_Handler() with the appropriate interrupt type code.

    Ethernet Physical layer (Phy) interrupts should call NetIF_ISR_Handler() with interrupt type code NET_DEV_ISR_TYPE_PHY.

    See also function NetIF_ISR_Handler().

  2. Clear the device’s interrupt source, possibly via an external or CPU-integrated interrupt controller source.

Since each network device requires a unique NetDev_ISR_Handler() for each device interrupt, it is recommended that each device’s NetDev_ISR_Handler() function be named using the following convention:

NetDev_[Device]ISR_Handler[Type][Number]()

[Device]

Network device name or type, e.g., MACB (optional if the development board does not support multiple devices)

[Type]

Network device interrupt type, e.g., receive interrupt (optional if interrupt type is generic or unknown)

[Number]

Network device number for each specific instance of device (optional if the development board does not support multiple instances of the specific device)

For example, the receive ISR handler for the #2 MACB Ethernet controller on an Atmel AT91SAM9263-EK should be named NetDev_MACB_ISR_HandlerRx2().

See also Network Board Support Package.

Examples

  • No labels