software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief This function gets interrupt status.
 *
 *  @param pmadapter    A pointer to mlan_adapter structure
 *  @return             MLAN_STATUS_SUCCESS
 */
@brief This function gets interrupt status.
@param pmadapter    A pointer to mlan_adapter structure
@return             MLAN_STATUS_SUCCESS
@brief This function gets interrupt status . @param pmadapter A pointer to mlan_adapter structure @return MLAN_STATUS_SUCCESS
mlan_status
wlan_interrupt(pmlan_adapter pmadapter)
{
	pmlan_callbacks pcb = &pmadapter->callbacks;
	mlan_buffer mbuf;
	t_u8 offset = 0;
	t_u32 sdio_ireg = 0;
	t_u8 max_mp_regs = MAX_MP_REGS;
	t_u8 host_int_status_reg = HOST_INT_STATUS_REG;
	ENTER();
	while (max_mp_regs) {
		memset(pmadapter, &mbuf, 0, sizeof(mlan_buffer));
		mbuf.pbuf = pmadapter->mp_regs + offset;
		mbuf.data_len = MIN(max_mp_regs, MLAN_SDIO_BLOCK_SIZE);
		if (MLAN_STATUS_SUCCESS !=
		    pcb->moal_read_data_sync(pmadapter->pmoal_handle, &mbuf,
					     (REG_PORT +
					      offset) |
					     MLAN_SDIO_BYTE_MODE_MASK, 0)) {
			PRINTM(MERROR,
			       "moal_read_data_sync: read registers failed\n");
			pmadapter->dbg.num_int_read_failure++;
			goto done;
		}
		offset += mbuf.data_len;
		max_mp_regs -= mbuf.data_len;
	}
	DBG_HEXDUMP(MIF_D, "SDIO MP Registers", pmadapter->mp_regs,
		    max_mp_regs);
	sdio_ireg = pmadapter->mp_regs[host_int_status_reg];
	pmadapter->dbg.last_int_status = pmadapter->sdio_ireg | sdio_ireg;
	if (sdio_ireg) {
		PRINTM(MINTR, "wlan_interrupt: sdio_ireg = 0x%x\n", sdio_ireg);
		pmadapter->num_of_irq++;
		pcb->moal_spin_lock(pmadapter->pmoal_handle,
				    pmadapter->pint_lock);
		pmadapter->sdio_ireg |= sdio_ireg;
		pcb->moal_spin_unlock(pmadapter->pmoal_handle,
				      pmadapter->pint_lock);
		if (!pmadapter->pps_uapsd_mode &&
		    pmadapter->ps_state == PS_STATE_SLEEP) {
			pmadapter->pm_wakeup_fw_try = MFALSE;
			pmadapter->ps_state = PS_STATE_AWAKE;
			pmadapter->pm_wakeup_card_req = MFALSE;
		}
	} else {
		PRINTM(MMSG, "wlan_interrupt: sdio_ireg = 0x%x\n", sdio_ireg);
	}
done:
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
mlan_status wlan_interrupt ( pmlan_adapter pmadapter ) { pmlan_callbacks pcb = & pmadapter -> callbacks ; mlan_buffer mbuf ; t_u8 offset = 0 ; t_u32 sdio_ireg = 0 ; t_u8 max_mp_regs = MAX_MP_REGS ; t_u8 host_int_status_reg = HOST_INT_STATUS_REG ; ENTER ( ) ; while ( max_mp_regs ) { memset ( pmadapter , & mbuf , 0 , sizeof ( mlan_buffer ) ) ; mbuf . pbuf = pmadapter -> mp_regs + offset ; mbuf . data_len = MIN ( max_mp_regs , MLAN_SDIO_BLOCK_SIZE ) ; if ( MLAN_STATUS_SUCCESS != pcb -> moal_read_data_sync ( pmadapter -> pmoal_handle , & mbuf , ( REG_PORT + offset ) | MLAN_SDIO_BYTE_MODE_MASK , 0 ) ) { PRINTM ( MERROR , " \n " ) ; pmadapter -> dbg . num_int_read_failure ++ ; goto done ; } offset += mbuf . data_len ; max_mp_regs -= mbuf . data_len ; } DBG_HEXDUMP ( MIF_D , " " , pmadapter -> mp_regs , max_mp_regs ) ; sdio_ireg = pmadapter -> mp_regs [ host_int_status_reg ] ; pmadapter -> dbg . last_int_status = pmadapter -> sdio_ireg | sdio_ireg ; if ( sdio_ireg ) { PRINTM ( MINTR , " \n " , sdio_ireg ) ; pmadapter -> num_of_irq ++ ; pcb -> moal_spin_lock ( pmadapter -> pmoal_handle , pmadapter -> pint_lock ) ; pmadapter -> sdio_ireg |= sdio_ireg ; pcb -> moal_spin_unlock ( pmadapter -> pmoal_handle , pmadapter -> pint_lock ) ; if ( ! pmadapter -> pps_uapsd_mode && pmadapter -> ps_state == PS_STATE_SLEEP ) { pmadapter -> pm_wakeup_fw_try = MFALSE ; pmadapter -> ps_state = PS_STATE_AWAKE ; pmadapter -> pm_wakeup_card_req = MFALSE ; } } else { PRINTM ( MMSG , " \n " , sdio_ireg ) ; } done : LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; }
@brief This function gets interrupt status.
@brief This function gets interrupt status .
/*
		 * DN_LD_HOST_INT_STATUS and/or UP_LD_HOST_INT_STATUS
		 * DN_LD_CMD_PORT_HOST_INT_STATUS and/or
		 * UP_LD_CMD_PORT_HOST_INT_STATUS
		 * Clear the interrupt status register
		 */