Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int smsc911x_irq_handler(_kernel_swi_regs *r, void *pw)
- {
- // if the private word didnt math then bail out
- if (pw != local_pw)
- {
- // interrup was not for me.
- return 1;
- }
- ws_t *ws = local_pw;
- // read the status and interrupt registers.
- uint32_t intsts = smsc911x_reg_read(ws->dev, INT_STS);
- uint32_t inten = smsc911x_reg_read(ws->dev, INT_EN);
- // if there was no interrupt status bits set then that one wasnt for us
- if (intsts == 0)
- {
- return 1;
- }
- // disable irq interrupts
- smsc911x_reg_write(ws->dev, INT_EN,0);
- ws->irq_count++;
- //int irqs_disabled = _kernel_irqs_disabled();
- // if interrupts are enabled then disable them
- if (!irqs_disabled)
- {
- _kernel_irqs_off();
- }
- // clear all interrupts because we are going to handle them here
- // we already have copies of the status registers so we're good
- smsc911x_reg_write(ws->dev, INT_STS, 0xFFFFFFFF);
- // call the device clear irq delegate if one has been set by the HAL
- if (ws->nic_device->dev.ClearIRQ != NULL)
- {
- ws->nic_device->dev.ClearIRQ();
- }
- // clear the irq request in the HAL. MUST do this or we get a crash
- _swix(OS_Hardware, _IN(0) | _INR(8,9), ws->nic_device->dev.devicenumber\
- &~(1u<<31), 0, EntryNo_HAL_IRQClear);
- // handle the rx case
- if (intsts & inten & INT_STS_RSFL_)
- {
- // for debug reasons count the number of rx interrupts
- ws->irq_count_processed++;
- // call the rx poll routine
- read_packet((void *)local_pw);
- }
- //// if interrupts were on then we should re-enable them
- if (!irqs_disabled)
- {
- _kernel_irqs_on();
- }
- // re-enable interrupts
- smsc911x_reg_write(ws->dev, INT_EN,inten);
- // we handled this so return 0.
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement