software/drivers/sd8887/src/wlan/mlan/mlan_cmdevt.c
/**
 *  @brief This function handles events generated by firmware
 *
 *  @param pmadapter    A pointer to mlan_adapter structure
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function handles events generated by firmware
@param pmadapter    A pointer to mlan_adapter structure


@brief This function handles events generated by firmware @param pmadapter A pointer to mlan_adapter structure
mlan_status
wlan_process_event(pmlan_adapter pmadapter)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	pmlan_private priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
	pmlan_buffer pmbuf = pmadapter->pmlan_buffer_event;
	t_u32 eventcause = pmadapter->event_cause;
#ifdef DEBUG_LEVEL1
	t_u32 in_ts_sec = 0, in_ts_usec = 0;
#endif
	ENTER();
	pmadapter->dbg.last_event_index =
		(pmadapter->dbg.last_event_index + 1) % DBG_CMD_NUM;
	pmadapter->dbg.last_event[pmadapter->dbg.last_event_index] =
		(t_u16)eventcause;
	if ((eventcause & EVENT_ID_MASK) == EVENT_RADAR_DETECTED) {
		if (wlan_11h_dfs_event_preprocessing(pmadapter) ==
		    MLAN_STATUS_SUCCESS) {
			memcpy(pmadapter, (t_u8 *)&eventcause,
			       pmbuf->pbuf + pmbuf->data_offset,
			       sizeof(eventcause));
		} else {
			PRINTM(MERROR, "Error processing DFS Event: 0x%x\n",
			       eventcause);
			goto done;
		}
	}
	priv = wlan_get_priv_by_id(pmadapter, EVENT_GET_BSS_NUM(eventcause),
				   EVENT_GET_BSS_TYPE(eventcause));
	if (!priv)
		priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
	if (!priv) {
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	eventcause &= EVENT_ID_MASK;
	pmadapter->event_cause = eventcause;
	if (pmbuf) {
		pmbuf->bss_index = priv->bss_index;
		memcpy(pmadapter,
		       pmbuf->pbuf + pmbuf->data_offset,
		       (t_u8 *)&eventcause, sizeof(eventcause));
	}
	if (MTRUE
	    && (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE)
		) {
		PRINTM_GET_SYS_TIME(MEVENT, &in_ts_sec, &in_ts_usec);
		PRINTM_NETINTF(MEVENT, priv);
		PRINTM(MEVENT, "%lu.%06lu : Event: 0x%x\n", in_ts_sec,
		       in_ts_usec, eventcause);
	}
	ret = priv->ops.process_event(priv);
done:
	pmadapter->event_cause = 0;
	pmadapter->pmlan_buffer_event = MNULL;
	if (pmbuf)
		wlan_free_mlan_buffer(pmadapter, pmbuf);
	LEAVE();
	return ret;
}
mlan_status wlan_process_event ( pmlan_adapter pmadapter ) { mlan_status ret = MLAN_STATUS_SUCCESS ; pmlan_private priv = wlan_get_priv ( pmadapter , MLAN_BSS_ROLE_ANY ) ; pmlan_buffer pmbuf = pmadapter -> pmlan_buffer_event ; t_u32 eventcause = pmadapter -> event_cause ; #ifdef DEBUG_LEVEL1 t_u32 in_ts_sec = 0 , in_ts_usec = 0 ; #endif ENTER ( ) ; pmadapter -> dbg . last_event_index = ( pmadapter -> dbg . last_event_index + 1 ) % DBG_CMD_NUM ; pmadapter -> dbg . last_event [ pmadapter -> dbg . last_event_index ] = ( t_u16 ) eventcause ; if ( ( eventcause & EVENT_ID_MASK ) == EVENT_RADAR_DETECTED ) { if ( wlan_11h_dfs_event_preprocessing ( pmadapter ) == MLAN_STATUS_SUCCESS ) { memcpy ( pmadapter , ( t_u8 * ) & eventcause , pmbuf -> pbuf + pmbuf -> data_offset , sizeof ( eventcause ) ) ; } else { PRINTM ( MERROR , " \n " , eventcause ) ; goto done ; } } priv = wlan_get_priv_by_id ( pmadapter , EVENT_GET_BSS_NUM ( eventcause ) , EVENT_GET_BSS_TYPE ( eventcause ) ) ; if ( ! priv ) priv = wlan_get_priv ( pmadapter , MLAN_BSS_ROLE_ANY ) ; if ( ! priv ) { ret = MLAN_STATUS_FAILURE ; goto done ; } eventcause &= EVENT_ID_MASK ; pmadapter -> event_cause = eventcause ; if ( pmbuf ) { pmbuf -> bss_index = priv -> bss_index ; memcpy ( pmadapter , pmbuf -> pbuf + pmbuf -> data_offset , ( t_u8 * ) & eventcause , sizeof ( eventcause ) ) ; } if ( MTRUE && ( eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE ) ) { PRINTM_GET_SYS_TIME ( MEVENT , & in_ts_sec , & in_ts_usec ) ; PRINTM_NETINTF ( MEVENT , priv ) ; PRINTM ( MEVENT , " \n " , in_ts_sec , in_ts_usec , eventcause ) ; } ret = priv -> ops . process_event ( priv ) ; done : pmadapter -> event_cause = 0 ; pmadapter -> pmlan_buffer_event = MNULL ; if ( pmbuf ) wlan_free_mlan_buffer ( pmadapter , pmbuf ) ; LEAVE ( ) ; return ret ; }
@brief This function handles events generated by firmware
  @param pmadapter    A pointer to mlan_adapter structure
@brief This function handles events generated by firmware @param pmadapter A pointer to mlan_adapter structure
/* Save the last event to debug log */ /* Get BSS number and corresponding priv */ /* Clear BSS_NO_BITS from event */