Beispiel #1
0
/*----------------------------------------------------------------------------*/
VOID
mboxSendMsg(IN P_ADAPTER_T prAdapter,
	    IN ENUM_MBOX_ID_T eMboxId, IN P_MSG_HDR_T prMsg, IN EUNM_MSG_SEND_METHOD_T eMethod)
{
	P_MBOX_T prMbox;
	KAL_SPIN_LOCK_DECLARATION();

	ASSERT(eMboxId < MBOX_ID_TOTAL_NUM);
	ASSERT(prMsg);
	ASSERT(prAdapter);

	prMbox = &(prAdapter->arMbox[eMboxId]);

	switch (eMethod) {
	case MSG_SEND_METHOD_BUF:
		KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
		LINK_INSERT_TAIL(&prMbox->rLinkHead, &prMsg->rLinkEntry);
		KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);

		/* to wake up main service thread */
		GLUE_SET_EVENT(prAdapter->prGlueInfo);

		break;

	case MSG_SEND_METHOD_UNBUF:
		MBOX_HNDL_MSG(prAdapter, prMsg);
		break;

	default:
		ASSERT(0);
		break;
	}
}
Beispiel #2
0
/*----------------------------------------------------------------------------*/
VOID
staRecInitialize (
    IN P_ADAPTER_T prAdapter
    )
{
    P_STA_INFO_T prStaInfo;
    PUINT_8 pucMemHandle;
    P_STA_RECORD_T prStaRec;
    UINT_32 i;


    ASSERT(prAdapter);
    prStaInfo = &prAdapter->rStaInfo;

    //4 <0> Clear allocated memory.
    kalMemZero((PVOID) prStaInfo->pucStaRecCached, prStaInfo->u4StaRecCachedSize);

    ASSERT(IS_ALIGN_4((UINT_32)prStaInfo->pucStaRecCached));

    pucMemHandle = prStaInfo->pucStaRecCached;

    LINK_INITIALIZE(&prStaInfo->rFreeStaRecList);

    for (i = 0; i < CFG_MAX_NUM_STA_RECORD; i++) {

        prStaRec = (P_STA_RECORD_T)pucMemHandle;

        STA_RECORD_SET_GUID(prStaRec);

        LINK_INSERT_TAIL(&prStaInfo->rFreeStaRecList, &prStaRec->rLinkEntry);

        pucMemHandle += ALIGN_4(sizeof(STA_RECORD_T));
    }

    /* Check if the memory allocation consist with this initialization function */
    ASSERT((UINT_32)(pucMemHandle - prStaInfo->pucStaRecCached) == prStaInfo->u4StaRecCachedSize);

    for (i = 0; i < STA_RECORD_HASH_NUM; i++) {
        LINK_INITIALIZE(&prStaInfo->arValidStaRecList[i]);
    }

    prStaInfo->ucValidStaRecNum = 0;

    return;
} /* end of staRecInitialize() */
Beispiel #3
0
/*----------------------------------------------------------------------------*/
VOID
timerStartTimer (
    IN P_ADAPTER_T              prAdapter,
    IN P_TIMER_T                prTimer,
    IN UINT_32                  u4TimeoutMs
    )
{
    P_LINK_T prTimerList;
    OS_SYSTIME rExpiredSysTime;

    ASSERT(prAdapter);
    ASSERT(prTimer);

    prTimerList= &prAdapter->rTimerList;

    /* To avoid infinite loop in function wlanDoTimeOutCheck(),
     * zero interval is not permitted.
     */
    if (u4TimeoutMs == 0) {
        u4TimeoutMs = 1;
    }

    rExpiredSysTime = kalGetTimeTick() + MSEC_TO_SYSTIME(u4TimeoutMs);

    /* If no timer pending or the fast time interval is used. */
    if (prTimerList->prNext == (P_LINK_ENTRY_T)prTimerList ||
        TIME_BEFORE(rExpiredSysTime, prAdapter->rNextExpiredSysTime)) {
        if (timerSetTimer(prAdapter, MSEC_TO_SYSTIME(u4TimeoutMs))) {
            prAdapter->rNextExpiredSysTime = rExpiredSysTime;
        }
    }

    /* Add this timer to checking list */
    prTimer->rExpiredSysTime = rExpiredSysTime;

    if (!timerPendingTimer(prTimer)) {
        LINK_INSERT_TAIL(prTimerList, &prTimer->rLinkEntry);
    }

    return;
} /* timerStartTimer */