示例#1
0
/*==========================================================================
  FUNCTION    WDA_DS_StartXmit

  DESCRIPTION 
    Serialize TX transmit reques to TX thread. 

  TODO This sends TX transmit request to TL. It should send to WDI for
         abstraction.

    For NON integrated SOC, this function calls WLANBAL_StartXmit

  DEPENDENCIES 
     
  PARAMETERS 

   IN
        pvosGCtx    VOS context
   
  RETURN VALUE
    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
    VOS_STATUS_SUCCESS:  Everything is good :)

  SIDE EFFECTS 
  
============================================================================*/
VOS_STATUS
WDA_DS_StartXmit
(
  v_PVOID_t pvosGCtx
)
{
#if defined( FEATURE_WLAN_INTEGRATED_SOC )
  vos_msg_t                    sMessage;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  if ( NULL == pvosGCtx )
  {
    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "WLAN WDA:Invalid pointers on WDA_DS_StartXmit" );
    return VOS_STATUS_E_FAULT;
  }

  /* Serialize our event  */
  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
             "Serializing WDA TX Start Xmit event" );

  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );

  sMessage.bodyptr = NULL;
  sMessage.type    = WDA_DS_TX_START_XMIT;

  return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
#else  /* FEATURE_WLAN_INTEGRATED_SOC */
  return WLANBAL_StartXmit( pvosGCtx );
#endif /* FEATURE_WLAN_INTEGRATED_SOC */
}
示例#2
0
/*---------------------------------------------------------------------------
     wpalPostTxMsg - Post a message to TX context so it can be processed in that context.
    Param: 
        pPalContext - A PAL context PAL
        pMsg - a pointer to called allocated opaque object;
---------------------------------------------------------------------------*/
wpt_status wpalPostTxMsg(void *pPalContext, wpt_msg *pMsg)
{
   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
   vos_msg_t msg;

   if (NULL == pMsg)
   {
      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR,
                 "%s: NULL message pointer", __FUNCTION__);
      WPAL_ASSERT(0);
      return status;
   }

   msg.type = 0; //This field is not used because VOSS doesn't check it.
   msg.reserved = 0;
   msg.bodyval = 0;
   msg.bodyptr = pMsg;
   if(VOS_IS_STATUS_SUCCESS(vos_tx_mq_serialize(VOS_MQ_ID_WDI, &msg)))
   {
      status = eWLAN_PAL_STATUS_SUCCESS;
   }
   else
   {
      WPAL_TRACE(eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, "%s fail to post msg %d\n",
                  __FUNCTION__, pMsg->type);
   }

   return status;
}
static VOS_STATUS sys_PostTxThreadProbeMsg( v_CONTEXT_t pVosContext, sysResponseCback userCallback,
        v_VOID_t *pUserData, SYS_MSG_ID sysMsgId )
{
    VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
    vos_msg_t sysMsg;
    tSirRetStatus sirStatus = eSIR_SUCCESS;
    /*----------------------------------------------------------------------------------------*/

    sysBuildMessageHeader( sysMsgId, &sysMsg );


    // Save the user callback and user data to callback in the body pointer
    // and body data portion of the message.
    sysMsg.bodyptr = (void *)userCallback;
    sysMsg.bodyval = (v_U32_t)pUserData;

    // Post the message...
    vosStatus = vos_tx_mq_serialize( VOS_MQ_ID_SYS, &sysMsg );

    if ( eSIR_SUCCESS != sirStatus )
    {
        vosStatus = VOS_STATUS_E_BADMSG;
    }

    return( vosStatus );
}
示例#4
0
/*==========================================================================
  FUNCTION    WDA_DS_StartXmit

  DESCRIPTION 
    Serialize TX transmit reques to TX thread. 

  TODO This sends TX transmit request to TL. It should send to WDI for
         abstraction.

    For NON integrated SOC, this function calls WLANBAL_StartXmit

  DEPENDENCIES 
     
  PARAMETERS 

   IN
        pvosGCtx    VOS context
   
  RETURN VALUE
    VOS_STATUS_E_FAULT:  pointer is NULL and other errors 
    VOS_STATUS_SUCCESS:  Everything is good :)

  SIDE EFFECTS 
  
============================================================================*/
VOS_STATUS
WDA_DS_StartXmit
(
  v_PVOID_t pvosGCtx
)
{
#if defined( FEATURE_WLAN_INTEGRATED_SOC )
  vos_msg_t                    sMessage;
  VOS_STATUS                   status;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  if ( NULL == pvosGCtx )
  {
    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR,
               "WLAN WDA:Invalid pointers on WDA_DS_StartXmit" );
    return VOS_STATUS_E_FAULT;
  }

  if(WDA_TL_IS_TX_XMIT_PENDING( pvosGCtx ))
  {  
    /*Already WDA_DS_TX_START_XMIT msg is pending in TL msg queue */
    return VOS_STATUS_SUCCESS;
  }
  /* Serialize our event  */
  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
             "Serializing WDA TX Start Xmit event" );

  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );

  sMessage.bodyptr = NULL;
  sMessage.type    = WDA_DS_TX_START_XMIT;

  WDA_TL_SET_TX_XMIT_PENDING(pvosGCtx);

  status = vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);

  if(status != VOS_STATUS_SUCCESS)
  {
    VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_FATAL,
             "Serializing WDA TX Start Xmit event FAILED" );
    WDA_TL_CLEAR_TX_XMIT_PENDING(pvosGCtx);
  }
  return status;
#else  /* FEATURE_WLAN_INTEGRATED_SOC */
  return WLANBAL_StartXmit( pvosGCtx );
#endif /* FEATURE_WLAN_INTEGRATED_SOC */
}
/*==========================================================================
  FUNCTION    WDA_DS_FinishULA

  DESCRIPTION 
    Serialize Finish Upper Level Authentication reques to TX thread. 

  DEPENDENCIES 
     
  PARAMETERS 

   IN
        callbackRoutine    routine to be called in TX thread
        callbackContext    user data for the above routine 
   
  RETURN VALUE
    please see vos_tx_mq_serialize

  SIDE EFFECTS 
  
============================================================================*/
VOS_STATUS
WDA_DS_FinishULA
(
 void (*callbackRoutine) (void *callbackContext),
 void  *callbackContext
)
{
  vos_msg_t                    sMessage;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  /* Serialize our event  */
  VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_HIGH,
             "Serializing WDA_DS_FinishULA event" );

  vos_mem_zero( &sMessage, sizeof(vos_msg_t) );
  sMessage.bodyptr  = callbackContext;
  sMessage.callback = callbackRoutine;
  sMessage.bodyval  = 0;
  sMessage.type     = WDA_DS_FINISH_ULA;

  return vos_tx_mq_serialize(VOS_MQ_ID_TL, &sMessage);
}/*WDA_DS_FinishULA*/
static void vos_linux_timer_callback ( v_U32_t data ) 
{
   vos_timer_t *timer = ( vos_timer_t *)data; 
   vos_msg_t msg;
   VOS_STATUS vStatus;
   unsigned long flags;
   
   vos_timer_callback_t callback=NULL;
   v_PVOID_t userData=NULL;
   int threadId;
   VOS_TIMER_TYPE type=VOS_TIMER_TYPE_SW;
   
   VOS_ASSERT(timer);

   if (timer == NULL)
   {
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s Null pointer passed in!",__func__);
     return;
   }

   threadId = timer->platformInfo.threadID;
   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
   
   switch ( timer->state )
   {
   case VOS_TIMER_STATE_STARTING:
      // we are in this state because someone just started the timer, MM timer
      // got started and expired, but the time content have not bee updated
      // this is a rare race condition!
      timer->state = VOS_TIMER_STATE_STOPPED;
      vStatus = VOS_STATUS_E_ALREADY;
      break;
   case VOS_TIMER_STATE_STOPPED:
      vStatus = VOS_STATUS_E_ALREADY;
      break;
   case VOS_TIMER_STATE_UNUSED:
      vStatus = VOS_STATUS_E_EXISTS;
      break;
   case VOS_TIMER_STATE_RUNNING:
      // need to go to stop state here because the call-back function may restart 
      // timer (to emulate periodic timer)
      timer->state = VOS_TIMER_STATE_STOPPED;
      // copy the relevant timer information to local variables;
      // once we exist from this critical section, the timer content may be modified
      // by other tasks
      callback = timer->callback;
      userData = timer->userData;
      threadId = timer->platformInfo.threadID;
      type = timer->type;
      vStatus = VOS_STATUS_SUCCESS;
      break;
   default:
      VOS_ASSERT(0);
      vStatus = VOS_STATUS_E_FAULT;
      break;
   }
   
   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
   
   if ( VOS_STATUS_SUCCESS != vStatus )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
                "TIMER callback called in a wrong state=%d", timer->state);
      return;
   }

   tryAllowingSleep( type );

   if (callback == NULL)
   {
       VOS_ASSERT(0);
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                 "%s: No TIMER callback, Could not enqueue timer to any queue",
                 __func__);
       return;
   }

   // If timer has expired then call vos_client specific callback 
   if ( vos_sched_is_tx_thread( threadId ) )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
          "TIMER callback: running on TX thread");
         
      //Serialize to the Tx thread
      sysBuildMessageHeader( SYS_MSG_ID_TX_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_tx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
         return;
   }
   else if ( vos_sched_is_rx_thread( threadId ) )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
          "TIMER callback: running on RX thread");
         
      //Serialize to the Rx thread
      sysBuildMessageHeader( SYS_MSG_ID_RX_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_rx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
         return;
   }
   else 
   {
      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
          "TIMER callback: running on MC thread");
                    
      // Serialize to the MC thread
      sysBuildMessageHeader( SYS_MSG_ID_MC_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_mq_post_message( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
        return;
   }     

   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
             "%s: Could not enqueue timer to any queue", __func__);
   VOS_ASSERT(0);
}
static void vos_linux_timer_callback ( v_U32_t data ) 
{
   vos_timer_t *timer = ( vos_timer_t *)data; 
   vos_msg_t msg;
   VOS_STATUS vStatus;
   unsigned long flags;
   
   vos_timer_callback_t callback=NULL;
   v_PVOID_t userData=NULL;
   int threadId;
   VOS_TIMER_TYPE type=VOS_TIMER_TYPE_SW;
   
   VOS_ASSERT(timer);

   if (timer == NULL)
   {
     VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s Null pointer passed in!",__func__);
     return;
   }

   threadId = timer->platformInfo.threadID;
   spin_lock_irqsave( &timer->platformInfo.spinlock,flags );
   
   switch ( timer->state )
   {
   case VOS_TIMER_STATE_STARTING:
      //                                                                      
      //                                                                   
      //                               
      timer->state = VOS_TIMER_STATE_STOPPED;
      vStatus = VOS_STATUS_E_ALREADY;
      break;
   case VOS_TIMER_STATE_STOPPED:
      vStatus = VOS_STATUS_E_ALREADY;
      break;
   case VOS_TIMER_STATE_UNUSED:
      vStatus = VOS_STATUS_E_EXISTS;
      break;
   case VOS_TIMER_STATE_RUNNING:
      //                                                                          
      //                                  
      timer->state = VOS_TIMER_STATE_STOPPED;
      //                                                        
      //                                                                            
      //               
      callback = timer->callback;
      userData = timer->userData;
      threadId = timer->platformInfo.threadID;
      type = timer->type;
      vStatus = VOS_STATUS_SUCCESS;
      break;
   default:
      VOS_ASSERT(0);
      vStatus = VOS_STATUS_E_FAULT;
      break;
   }
   
   spin_unlock_irqrestore( &timer->platformInfo.spinlock,flags );
   
   if ( VOS_STATUS_SUCCESS != vStatus )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
                "TIMER callback called in a wrong state=%d", timer->state);
      return;
   }

   tryAllowingSleep( type );

   if (callback == NULL)
   {
       VOS_ASSERT(0);
       VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
                 "%s: No TIMER callback, Could not enqueue timer to any queue",
                 __func__);
       return;
   }

   //                                                             
   if ( vos_sched_is_tx_thread( threadId ) )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
          "TIMER callback: running on TX thread");
         
      //                          
      sysBuildMessageHeader( SYS_MSG_ID_TX_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_tx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
         return;
   }
   else if ( vos_sched_is_rx_thread( threadId ) )
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, 
          "TIMER callback: running on RX thread");
         
      //                          
      sysBuildMessageHeader( SYS_MSG_ID_RX_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_rx_mq_serialize( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
         return;
   }
   else 
   {
      VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
          "TIMER callback: running on MC thread");
                    
      //                           
      sysBuildMessageHeader( SYS_MSG_ID_MC_TIMER, &msg );
      msg.bodyptr  = callback;
      msg.bodyval  = (v_U32_t)userData; 
       
      if(vos_mq_post_message( VOS_MQ_ID_SYS, &msg ) == VOS_STATUS_SUCCESS)
        return;
   }     

   VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, 
             "%s: Could not enqueue timer to any queue", __func__);
   VOS_ASSERT(0);
}