Ejemplo n.º 1
0
wiced_result_t wiced_rtos_start_timer( wiced_timer_t* timer )
{
    if ( tx_timer_change( timer, timer->tx_timer_internal.tx_timer_internal_re_initialize_ticks, timer->tx_timer_internal.tx_timer_internal_re_initialize_ticks ) != TX_SUCCESS )
    {
        return WICED_ERROR;
    }

    if ( tx_timer_activate( timer ) != WICED_SUCCESS )
    {
        return WICED_ERROR;
    }

    return WICED_SUCCESS;
}
Ejemplo n.º 2
0
int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg)
{

    /* CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE - Currently removed the special optimization when a concurrent session
     * exists with operating channel same as P2P listen channel since it was causing issues in P2P search. The reason was
     * STA-AP link entering BMPS when returning to home channel causing P2P search to miss Probe Reqs and hence not
     * respond with Probe Rsp causing peer device to NOT find us.
     * If we need this optimization, we need to find a way to keep the STA-AP link awake (no BMPS) on home channel when in listen state
     */
#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
    tANI_U8 i;
    tpPESession psessionEntry;
#endif
#ifdef WLAN_FEATURE_P2P_INTERNAL
    tpPESession pP2pSession;
#endif

    tSirRemainOnChnReq *MsgBuff = (tSirRemainOnChnReq *)pMsg;
    pMac->lim.gpLimRemainOnChanReq = MsgBuff;

#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
    for (i =0; i < pMac->lim.maxBssId;i++)
    {
        psessionEntry = peFindSessionBySessionId(pMac,i);

        if ( (psessionEntry != NULL) )
        {
            if (psessionEntry->currentOperChannel == MsgBuff->chnNum)
            {
                tANI_U32 val;
                tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

                pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time();
                pMac->lim.gTotalScanDuration = MsgBuff->duration;

                /* get the duration from the request */
                val = SYS_MS_TO_TICKS(MsgBuff->duration);

                limLog( pMac, LOG2, "Start listen duration = %d", val);
                if (tx_timer_change(
                        &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0)
                                          != TX_SUCCESS)
                {
                    limLog(pMac, LOGP,
                          FL("Unable to change remain on channel Timer val"));
                    goto error;
                }
                else if(TX_SUCCESS != tx_timer_activate(
                                &pMac->lim.limTimers.gLimRemainOnChannelTimer))
                {
                    limLog(pMac, LOGP,
                    FL("Unable to activate remain on channel Timer"));
                    limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER);
                    goto error;
                }

#ifdef WLAN_FEATURE_P2P_INTERNAL
                //Session is needed to send probe rsp
                if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &pP2pSession))
                {
                    limLog( pMac, LOGE, "Unable to create session");
                    goto error;
                }
#endif

                if ((limSetLinkState(pMac, eSIR_LINK_LISTEN_STATE,
                    nullBssid, pMac->lim.gSelfMacAddr, 
                    limSetLinkStateP2PCallback, NULL)) != eSIR_SUCCESS)
                {
                    limLog( pMac, LOGE, "Unable to change link state");
                    goto error;
                }
                return FALSE;
            }
        }
    }
#endif
    pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState;
    pMac->lim.gLimMlmState     = eLIM_MLM_P2P_LISTEN_STATE;

    pMac->lim.gTotalScanDuration = MsgBuff->duration;

    /* 1st we need to suspend link with callback to initiate change channel */
    limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN,
                   limRemainOnChnlSuspendLinkHdlr, NULL);
    return FALSE;

#ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE
error:
    limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
    /* pMsg is freed by the caller */
    return FALSE;
#endif
}
Ejemplo n.º 3
0
STATUS Do_Device_IO(
	U32 device,
	UNSIGNED offset, // offset in file 
	void *p_buffer, // pointer to data 
	UNSIGNED num_bytes, // number of bytes 
	Callback_Context *p_callback_context, // context to run when I/O is complete
	Device_IO_Type device_IO_type
	)
{
	char *p_data = p_mem_file + (device * Flash_Address::Pages_Per_Device() 
		* Flash_Address::Bytes_Per_Page()) + offset;
	char *p_data_last = p_data + num_bytes;
	CT_ASSERT((p_data_last <= p_mem_file_last), Do_Device_IO);

	// Save context to run when timer goes off.
	CT_ASSERT((timer_context[device] == 0), Do_Device_IO);
	timer_context[device] = p_callback_context;
	U32 timer_ticks;
	U32 num_words = num_bytes/4;
	U32 *p_word_buffer = (U32 *)p_buffer;
	U32 *p_word_data = (U32 *)p_data;
	U32 index;
	STATUS verify_status = OK;

	switch(device_IO_type)
	{
	case WRITE_CELL:
		// Simulate flash write by ANDing words into buffer.
		// If the memory was not erased, it will not work correctly.
		for (index = 0; index < num_words; index++)
			*(p_word_data + index) &= *(p_word_buffer + index);
		timer_ticks = FF_WRITE_TIMER_TICKS;
 		break;

	case READ_CELL:
		memcpy(p_buffer, p_data, num_bytes);
		timer_ticks = FF_READ_TIMER_TICKS;
		break;

	case ERASE_CELL:
		memset(p_data, 0XFF, num_bytes);
		timer_ticks = FF_WRITE_TIMER_TICKS;
		break;

	case VERIFY_CELL:
		for (index = 0; index < num_words; index++)
			if (*(p_word_data + index) != *(p_word_buffer + index))
				verify_status = FF_ERROR(VERIFY);
		timer_ticks = FF_READ_TIMER_TICKS;

		// Save verify status in context.
		p_callback_context->Set_Status(verify_status);

		break;
		
	}

	STATUS status;
#if 1 // Don't use timer -- it's too slow when we read the whole file.
		// Start the timer to simulate the time for I/O.
#ifdef THREADX
 	status = tx_timer_change(&timer[device],
 		timer_ticks,
 		0); // timer only expires once
	if (status == OK)
		status = tx_timer_activate(&timer[device]);
#else
 	status = NU_Reset_Timer(&timer[device],
 		&Device_Timer_Expiration_Routine,
 		timer_ticks,
 		0, // timer only expires once
 		NU_ENABLE_TIMER);
#endif

#else // instead of the timer.
	timer_context[device] = 0;
	p_callback_context->Make_Ready();
#endif


	return status;
}