software/drivers/sd8887/src/wlan/mlan/mlan_sdio.c
/**
 *  @brief This function gets available SDIO port for writing 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 writing 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 writing 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_wr_port_data(mlan_adapter *pmadapter, t_u8 *pport)
{
	t_u32 wr_bitmap = pmadapter->mp_wr_bitmap;
	ENTER();
	PRINTM(MIF_D, "wlan_get_wr_port_data: mp_wr_bitmap=0x%08x\n",
	       wr_bitmap);
	if (!(wr_bitmap & pmadapter->mp_data_port_mask)) {
		pmadapter->data_sent = MTRUE;
		LEAVE();
		return MLAN_STATUS_RESOURCE;
	}
	if (pmadapter->mp_wr_bitmap & (1 << pmadapter->curr_wr_port)) {
		pmadapter->mp_wr_bitmap &=
			(t_u32)(~(1 << pmadapter->curr_wr_port));
		*pport = pmadapter->curr_wr_port;
		if (++pmadapter->curr_wr_port == pmadapter->mp_end_port)
			pmadapter->curr_wr_port = 0;
	} else {
		pmadapter->data_sent = MTRUE;
		LEAVE();
		return MLAN_STATUS_RESOURCE;
	}
	PRINTM(MIF_D, "port=%d mp_wr_bitmap=0x%08x -> 0x%08x\n",
	       *pport, wr_bitmap, pmadapter->mp_wr_bitmap);
	LEAVE();
	return MLAN_STATUS_SUCCESS;
}
static mlan_status wlan_get_wr_port_data ( mlan_adapter * pmadapter , t_u8 * pport ) { t_u32 wr_bitmap = pmadapter -> mp_wr_bitmap ; ENTER ( ) ; PRINTM ( MIF_D , " \n " , wr_bitmap ) ; if ( ! ( wr_bitmap & pmadapter -> mp_data_port_mask ) ) { pmadapter -> data_sent = MTRUE ; LEAVE ( ) ; return MLAN_STATUS_RESOURCE ; } if ( pmadapter -> mp_wr_bitmap & ( 1 << pmadapter -> curr_wr_port ) ) { pmadapter -> mp_wr_bitmap &= ( t_u32 ) ( ~ ( 1 << pmadapter -> curr_wr_port ) ) ; * pport = pmadapter -> curr_wr_port ; if ( ++ pmadapter -> curr_wr_port == pmadapter -> mp_end_port ) pmadapter -> curr_wr_port = 0 ; } else { pmadapter -> data_sent = MTRUE ; LEAVE ( ) ; return MLAN_STATUS_RESOURCE ; } PRINTM ( MIF_D , " \n " , * pport , wr_bitmap , pmadapter -> mp_wr_bitmap ) ; LEAVE ( ) ; return MLAN_STATUS_SUCCESS ; }
@brief This function gets available SDIO port for writing 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 writing data @param pmadapter A pointer to mlan_adapter structure @param pport A pointer to port number @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE