コード例 #1
0
ファイル: hem_mbox.c プロジェクト: Scorpio92/mediatek
/*----------------------------------------------------------------------------*/
VOID
mboxRcvAllMsg (
    IN P_ADAPTER_T prAdapter,
    ENUM_MBOX_ID_T eMboxId
    )
{
    P_MBOX_T        prMbox;
    P_MSG_HDR_T     prMsg;
    KAL_SPIN_LOCK_DECLARATION();

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

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

    while (!LINK_IS_EMPTY(&prMbox->rLinkHead) ) {
        KAL_ACQUIRE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);
        LINK_REMOVE_HEAD(&prMbox->rLinkHead, prMsg, P_MSG_HDR_T);
        KAL_RELEASE_SPIN_LOCK(prAdapter, SPIN_LOCK_MAILBOX);

        ASSERT(prMsg);
        MBOX_HNDL_MSG(prAdapter, prMsg);
    }

}
コード例 #2
0
ファイル: hem_mbox.c プロジェクト: John677/Kernal_k3note
/*----------------------------------------------------------------------------*/
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;
	}
}