software/drivers/sd8887/src/wlan/mlan/mlan_cmdevt.c
/**
 *  @brief This function sends sleep confirm command to firmware.
 *
 *  @param pmadapter  A pointer to mlan_adapter structure
 *
 *  @return           MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function sends sleep confirm command to firmware.
@param pmadapter  A pointer to mlan_adapter structure


@brief This function sends sleep confirm command to firmware . @param pmadapter A pointer to mlan_adapter structure
static mlan_status
wlan_dnld_sleep_confirm_cmd(mlan_adapter *pmadapter)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	static t_u32 i;
	t_u16 cmd_len = 0;
	opt_sleep_confirm_buffer *sleep_cfm_buf =
		(opt_sleep_confirm_buffer *)(pmadapter->psleep_cfm->pbuf +
					     pmadapter->psleep_cfm->
					     data_offset);
	mlan_private *pmpriv = MNULL;
	ENTER();
	pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
	if (!pmpriv) {
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	cmd_len = sizeof(OPT_Confirm_Sleep);
	pmadapter->seq_num++;
	sleep_cfm_buf->ps_cfm_sleep.seq_num =
		wlan_cpu_to_le16(HostCmd_SET_SEQ_NO_BSS_INFO
				 (pmadapter->seq_num, pmpriv->bss_num,
				  pmpriv->bss_type));
	DBG_HEXDUMP(MCMD_D, "SLEEP_CFM", &sleep_cfm_buf->ps_cfm_sleep,
		    sizeof(OPT_Confirm_Sleep));
	pmadapter->psleep_cfm->data_len = cmd_len + INTF_HEADER_LEN;
	ret = wlan_sdio_host_to_card(pmadapter, MLAN_TYPE_CMD,
				     pmadapter->psleep_cfm, MNULL);
	if (ret == MLAN_STATUS_FAILURE) {
		PRINTM(MERROR, "SLEEP_CFM: failed\n");
		pmadapter->dbg.num_cmd_sleep_cfm_host_to_card_failure++;
		goto done;
	} else {
		if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_UAP)
			pmadapter->ps_state = PS_STATE_SLEEP_CFM;
#ifdef STA_SUPPORT
		if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) {
			if (!sleep_cfm_buf->ps_cfm_sleep.sleep_cfm.resp_ctrl) {
				pmadapter->ps_state = PS_STATE_SLEEP;
			} else {
				pmadapter->ps_state = PS_STATE_SLEEP_CFM;
			}
			if (!sleep_cfm_buf->ps_cfm_sleep.sleep_cfm.resp_ctrl
			    && (pmadapter->is_hs_configured &&
				!pmadapter->sleep_period.period)) {
				pmadapter->pm_wakeup_card_req = MTRUE;
				wlan_host_sleep_activated_event(wlan_get_priv
								(pmadapter,
								 MLAN_BSS_ROLE_STA),
								MTRUE);
			}
		}
#endif 
#define NUM_SC_PER_LINE         16
		if (++i % NUM_SC_PER_LINE == 0)
			PRINTM(MEVENT, "+\n");
		else
			PRINTM(MEVENT, "+");
	}
done:
	LEAVE();
	return ret;
}
static mlan_status wlan_dnld_sleep_confirm_cmd ( mlan_adapter * pmadapter ) { mlan_status ret = MLAN_STATUS_SUCCESS ; static t_u32 i ; t_u16 cmd_len = 0 ; opt_sleep_confirm_buffer * sleep_cfm_buf = ( opt_sleep_confirm_buffer * ) ( pmadapter -> psleep_cfm -> pbuf + pmadapter -> psleep_cfm -> data_offset ) ; mlan_private * pmpriv = MNULL ; ENTER ( ) ; pmpriv = wlan_get_priv ( pmadapter , MLAN_BSS_ROLE_ANY ) ; if ( ! pmpriv ) { LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } cmd_len = sizeof ( OPT_Confirm_Sleep ) ; pmadapter -> seq_num ++ ; sleep_cfm_buf -> ps_cfm_sleep . seq_num = wlan_cpu_to_le16 ( HostCmd_SET_SEQ_NO_BSS_INFO ( pmadapter -> seq_num , pmpriv -> bss_num , pmpriv -> bss_type ) ) ; DBG_HEXDUMP ( MCMD_D , " " , & sleep_cfm_buf -> ps_cfm_sleep , sizeof ( OPT_Confirm_Sleep ) ) ; pmadapter -> psleep_cfm -> data_len = cmd_len + INTF_HEADER_LEN ; ret = wlan_sdio_host_to_card ( pmadapter , MLAN_TYPE_CMD , pmadapter -> psleep_cfm , MNULL ) ; if ( ret == MLAN_STATUS_FAILURE ) { PRINTM ( MERROR , " \n " ) ; pmadapter -> dbg . num_cmd_sleep_cfm_host_to_card_failure ++ ; goto done ; } else { if ( GET_BSS_ROLE ( pmpriv ) == MLAN_BSS_ROLE_UAP ) pmadapter -> ps_state = PS_STATE_SLEEP_CFM ; #ifdef STA_SUPPORT if ( GET_BSS_ROLE ( pmpriv ) == MLAN_BSS_ROLE_STA ) { if ( ! sleep_cfm_buf -> ps_cfm_sleep . sleep_cfm . resp_ctrl ) { pmadapter -> ps_state = PS_STATE_SLEEP ; } else { pmadapter -> ps_state = PS_STATE_SLEEP_CFM ; } if ( ! sleep_cfm_buf -> ps_cfm_sleep . sleep_cfm . resp_ctrl && ( pmadapter -> is_hs_configured && ! pmadapter -> sleep_period . period ) ) { pmadapter -> pm_wakeup_card_req = MTRUE ; wlan_host_sleep_activated_event ( wlan_get_priv ( pmadapter , MLAN_BSS_ROLE_STA ) , MTRUE ) ; } } #endif #define NUM_SC_PER_LINE          16 if ( ++ i % NUM_SC_PER_LINE == 0 ) PRINTM ( MEVENT , " \n " ) ; else PRINTM ( MEVENT , " " ) ; } done : LEAVE ( ) ; return ret ; }
@brief This function sends sleep confirm command to firmware.
@brief This function sends sleep confirm command to firmware .
/* Send sleep confirm command to firmware */ /* Response is not needed for sleep confirm command */ /* STA_SUPPORT */