4 static void read_int_callback(struct urb *urb/*, struct pt_regs *regs*/)
6 int status = urb->status;
7 PS_INTERFACE_ADAPTER psIntfAdapter = (PS_INTERFACE_ADAPTER)urb->context;
8 PMINI_ADAPTER Adapter = psIntfAdapter->psAdapter ;
10 if(Adapter->device_removed == TRUE)
12 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Device has Got Removed.");
16 if(((Adapter->bPreparingForLowPowerMode == TRUE) && (Adapter->bDoSuspend == TRUE)) ||
17 psIntfAdapter->bSuspended ||
18 psIntfAdapter->bPreparingForBusSuspend)
20 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Interrupt call back is called while suspending the device");
24 //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, "interrupt urb status %d", status);
28 if ( urb->actual_length )
31 if(psIntfAdapter->ulInterruptData[1] & 0xFF)
33 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "Got USIM interrupt");
36 if(psIntfAdapter->ulInterruptData[1] & 0xFF00)
38 atomic_set(&Adapter->CurrNumFreeTxDesc,
39 (psIntfAdapter->ulInterruptData[1] & 0xFF00) >> 8);
40 atomic_set (&Adapter->uiMBupdate, TRUE);
41 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL, "TX mailbox contains %d",
42 atomic_read(&Adapter->CurrNumFreeTxDesc));
44 if(psIntfAdapter->ulInterruptData[1] >> 16)
46 Adapter->CurrNumRecvDescs=
47 (psIntfAdapter->ulInterruptData[1] >> 16);
48 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"RX mailbox contains %d",
49 Adapter->CurrNumRecvDescs);
50 InterfaceRx(psIntfAdapter);
52 if(Adapter->fw_download_done &&
53 !Adapter->downloadDDR &&
54 atomic_read(&Adapter->CurrNumFreeTxDesc))
56 psIntfAdapter->psAdapter->downloadDDR +=1;
57 wake_up(&Adapter->tx_packet_wait_queue);
59 if(FALSE == Adapter->waiting_to_fw_download_done)
61 Adapter->waiting_to_fw_download_done = TRUE;
62 wake_up(&Adapter->ioctl_fw_dnld_wait_queue);
64 if(!atomic_read(&Adapter->TxPktAvail))
66 atomic_set(&Adapter->TxPktAvail, 1);
67 wake_up(&Adapter->tx_packet_wait_queue);
69 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Firing interrupt in URB");
74 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"URB has got disconnected ....");
79 //This situation may happend when URBunlink is used. for detail check usb_unlink_urb documentation.
80 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Impossibe condition has occured... something very bad is going on");
86 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Interrupt IN endPoint has got halted/stalled...need to clear this");
87 Adapter->bEndPointHalted = TRUE ;
88 wake_up(&Adapter->tx_packet_wait_queue);
89 urb->status = STATUS_SUCCESS ;;
92 /* software-driven interface shutdown */
93 case -ECONNRESET: //URB got unlinked.
94 case -ESHUTDOWN: // hardware gone. this is the serious problem.
95 //Occurs only when something happens with the host controller device
96 case -ENODEV : //Device got removed
97 case -EINVAL : //Some thing very bad happened with the URB. No description is available.
98 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"interrupt urb error %d", status);
99 urb->status = STATUS_SUCCESS ;
103 //This is required to check what is the defaults conditions when it occurs..
104 BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,"GOT DEFAULT INTERRUPT URB STATUS :%d..Please Analyze it...", status);
108 StartInterruptUrb(psIntfAdapter);
113 int CreateInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter)
115 psIntfAdapter->psInterruptUrb = usb_alloc_urb(0, GFP_KERNEL);
116 if (!psIntfAdapter->psInterruptUrb)
118 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Cannot allocate interrupt urb");
121 psIntfAdapter->psInterruptUrb->transfer_buffer =
122 psIntfAdapter->ulInterruptData;
123 psIntfAdapter->psInterruptUrb->transfer_buffer_length =
124 sizeof(psIntfAdapter->ulInterruptData);
126 psIntfAdapter->sIntrIn.int_in_pipe = usb_rcvintpipe(psIntfAdapter->udev,
127 psIntfAdapter->sIntrIn.int_in_endpointAddr);
129 usb_fill_int_urb(psIntfAdapter->psInterruptUrb, psIntfAdapter->udev,
130 psIntfAdapter->sIntrIn.int_in_pipe,
131 psIntfAdapter->psInterruptUrb->transfer_buffer,
132 psIntfAdapter->psInterruptUrb->transfer_buffer_length,
133 read_int_callback, psIntfAdapter,
134 psIntfAdapter->sIntrIn.int_in_interval);
136 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Interrupt Interval: %d\n",
137 psIntfAdapter->sIntrIn.int_in_interval);
142 INT StartInterruptUrb(PS_INTERFACE_ADAPTER psIntfAdapter)
146 if( FALSE == psIntfAdapter->psAdapter->device_removed &&
147 FALSE == psIntfAdapter->psAdapter->bEndPointHalted &&
148 FALSE == psIntfAdapter->bSuspended &&
149 FALSE == psIntfAdapter->bPreparingForBusSuspend &&
150 FALSE == psIntfAdapter->psAdapter->StopAllXaction)
152 status = usb_submit_urb(psIntfAdapter->psInterruptUrb, GFP_ATOMIC);
155 BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_OTHERS, INTF_INIT, DBG_LVL_ALL,"Cannot send int urb %d\n", status);
158 psIntfAdapter->psAdapter->bEndPointHalted = TRUE ;
159 wake_up(&psIntfAdapter->psAdapter->tx_packet_wait_queue);
167 Function: InterfaceEnableInterrupt
169 Description: This is the hardware specific Function for configuring
170 and enabling the interrupts on the device.
172 Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
175 Return: BCM_STATUS_SUCCESS - If configuring the interrupts was successful.
176 Other - If an error occured.
179 void InterfaceEnableInterrupt(PMINI_ADAPTER Adapter)
185 Function: InterfaceDisableInterrupt
187 Description: This is the hardware specific Function for disabling the interrupts on the device.
189 Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context
192 Return: BCM_STATUS_SUCCESS - If disabling the interrupts was successful.
193 Other - If an error occured.
196 void InterfaceDisableInterrupt(PMINI_ADAPTER Adapter)