コード例 #1
0
tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb)
{
    tSirMsgQ msg;
    tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal;


    tSirMbMsg* pMbLocal;
    msg.type = pMb->type;
    msg.bodyval = 0;

    WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
                   pMb->type, pMb->msgLen));

    // copy the message from host buffer to firmware buffer
    // this will make sure that firmware allocates, uses and frees
    // it's own buffers for mailbox message instead of working on
    // host buffer

    // second parameter, 'wait option', to palAllocateMemory is ignored on Windows
    if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen))
    {
        WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
        return eSIR_FAILURE;
    }

    palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen);
    msg.bodyptr = pMbLocal;

    switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
    {
    case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
        wdaPostCtrlMsg(pMac, &msg);
        break;

    case SIR_LIM_MSG_TYPES_BEGIN:    // Posts a message to the LIM MsgQ
        limPostMsgApi(pMac, &msg);
        break;

    case SIR_CFG_MSG_TYPES_BEGIN:    // Posts a message to the CFG MsgQ
        wdaPostCfgMsg(pMac, &msg);
        break;

    case SIR_PMM_MSG_TYPES_BEGIN:    // Posts a message to the PMM MsgQ
        pmmPostMessage(pMac, &msg);
        break;

    case SIR_PTT_MSG_TYPES_BEGIN:
        WDALOGW( wdaLog(pMac, LOGW, FL("%s:%d: message type = 0x%X"),
                        __func__, __LINE__, msg.type));
        vos_mem_free(msg.bodyptr);
        break;


    default:
        WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = "
                                       "0x%X\n"),
                        msg.type));

        // Release the memory.
        if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr))
                != eHAL_STATUS_SUCCESS)
        {
            WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
            return eSIR_FAILURE;
        }
        break;
    }

    return eSIR_SUCCESS;

} // uMacPostCtrlMsg()
コード例 #2
0
tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb)
{
   tSirMsgQ msg;
   tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal;

#ifdef ANI_OS_TYPE_RTAI_LINUX

   msg.type = pMb->type;
   msg.bodyptr = pMb;
   msg.bodyval = 0;
   WDALOG3( wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
        pMb->type, pMb->msgLen));
#else

   tSirMbMsg* pMbLocal;
   msg.type = pMb->type;
   msg.bodyval = 0;

   WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ),
        pMb->type, pMb->msgLen));

   // copy the message from host buffer to firmware buffer
   // this will make sure that firmware allocates, uses and frees
   // it's own buffers for mailbox message instead of working on
   // host buffer

   // second parameter, 'wait option', to palAllocateMemory is ignored on Windows
   if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen))
   {
      WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
      return eSIR_FAILURE;
   }

   palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen);
   msg.bodyptr = pMbLocal;
#endif

   switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK)
   {
   case WDA_MSG_TYPES_BEGIN:    // Posts a message to the HAL MsgQ
      wdaPostCtrlMsg(pMac, &msg);
      break;

   case SIR_LIM_MSG_TYPES_BEGIN:    // Posts a message to the LIM MsgQ
      limPostMsgApi(pMac, &msg);
      break;

   case SIR_CFG_MSG_TYPES_BEGIN:    // Posts a message to the CFG MsgQ
      wdaPostCfgMsg(pMac, &msg);
      break;

   case SIR_PMM_MSG_TYPES_BEGIN:    // Posts a message to the PMM MsgQ
      pmmPostMessage(pMac, &msg);
      break;

#if defined(ANI_MANF_DIAG) || defined(ANI_PHY_DEBUG)
   case SIR_PTT_MSG_TYPES_BEGIN:
#ifndef FEATURE_WLAN_INTEGRATED_SOC
      halNimPTTPostMsgApi(pMac, &msg); // Posts a message to the NIM PTT MsgQ
#endif /* FEATURE_WLAN_INTEGRATED_SOC */
      break;

#endif

   default:
      WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = "
             "0x%X\n"),
             msg.type));

      // Release the memory.
      if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr))
            != eHAL_STATUS_SUCCESS)
      {
         WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n")));
         return eSIR_FAILURE;
      }
      break;
   }

   return eSIR_SUCCESS;

} // uMacPostCtrlMsg()