software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief This function gets available SDIO port for reading cmd/data
 *
 *  @param pmadapter  A pointer to mlan_adapter structure
 *  @param pport      A pointer to port number
 *  @return           MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function gets available SDIO port for reading cmd/data
@param pmadapter  A pointer to mlan_adapter structure
@param pport      A pointer to port number
@return           MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function gets available SDIO port for reading cmd / data @param pmadapter A pointer to mlan_adapter structure @param pport A pointer to port number @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
static mlan_status
wlan_get_rd_port(mlan_adapter *pmadapter, t_u8 *pport)
{
	t_u32 rd_bitmap = pmadapter->mp_rd_bitmap;
	t_u8 max_ports = MAX_PORT;
	ENTER();
	PRINTM(MIF_D, "wlan_get_rd_port: mp_rd_bitmap=0x%08x\n", rd_bitmap);
	if (!(rd_bitmap & (DATA_PORT_MASK))) {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	if (pmadapter->mp_rd_bitmap & (1 << pmadapter->curr_rd_port)) {
		pmadapter->mp_rd_bitmap &=
			(t_u32)(~(1 << pmadapter->curr_rd_port));
		*pport = pmadapter->curr_rd_port;
		if (++pmadapter->curr_rd_port == max_ports)
			pmadapter->curr_rd_port = 0;
	} else {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	PRINTM(MIF_D, "port=%d mp_rd_bitmap=0x%08x -> 0x%08x\n",
	       *pport, rd_bitmap, pmadapter->mp_rd_bitmap);
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
static mlan_status wlan_get_rd_port ( mlan_adapter * pmadapter , t_u8 * pport ) { t_u32 rd_bitmap = pmadapter -> mp_rd_bitmap ; t_u8 max_ports = MAX_PORT ; ENTER ( ) ; PRINTM ( MIF_D , " \n " , rd_bitmap ) ; if ( ! ( rd_bitmap & ( DATA_PORT_MASK ) ) ) { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } if ( pmadapter -> mp_rd_bitmap & ( 1 << pmadapter -> curr_rd_port ) ) { pmadapter -> mp_rd_bitmap &= ( t_u32 ) ( ~ ( 1 << pmadapter -> curr_rd_port ) ) ; * pport = pmadapter -> curr_rd_port ; if ( ++ pmadapter -> curr_rd_port == max_ports ) pmadapter -> curr_rd_port = 0 ; } else { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } PRINTM ( MIF_D , " \n " , * pport , rd_bitmap , pmadapter -> mp_rd_bitmap ) ; LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; }
@brief This function gets available SDIO port for reading cmd/data
  @param pmadapter  A pointer to mlan_adapter structure
  @param pport      A pointer to port number
  @return           MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
@brief This function gets available SDIO port for reading cmd / data @param pmadapter A pointer to mlan_adapter structure @param pport A pointer to port number @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
/* hw rx wraps round only after port (MAX_PORT-1) */ /* port 0 is not reserved for cmd port */