Ejemplo n.º 1
0
/*---------------------------------------------------------------------------
   wpalGetNumRxFreePacket   Query available RX Free buffer count
   param:
       numRxResource  pointer of queried value

   return:
       WPT_STATUS
---------------------------------------------------------------------------*/
wpt_status wpalGetNumRxFreePacket(wpt_uint32 *numRxResource)
{
   VOS_STATUS status;

   status = vos_pkt_get_available_buffer_pool(VOS_PKT_TYPE_RX_RAW,
                                              (v_SIZE_t *)numRxResource);

   return WPAL_VOS_TO_WPAL_STATUS(status);
}
/*---------------------------------------------------------------------------
    \brief wpalTimerStop - stop a wpt_timer object. Stop doesn't guarantee the
            timer handler is not called if it is already timeout.

    \param pTimer - a pointer to caller allocated wpt_timer object

    \return
        eWLAN_PAL_STATUS_SUCCESS - success. Fail otherwise.
---------------------------------------------------------------------------*/
wpt_status wpalTimerStop(wpt_timer * pTimer)
{
   /* Sanity Checks */
   if( pTimer == NULL )
   {
      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
         __func__, (wpt_uint32)pTimer );
      return eWLAN_PAL_STATUS_E_INVAL;
   }
   return (WPAL_VOS_TO_WPAL_STATUS( vos_timer_stop( &pTimer->timer.timerObj )));
}/*wpalTimerStop*/
wpt_status wpalTimerStart(wpt_timer * pTimer, wpt_uint32 timeout)
{
   
   if( pTimer == NULL )
   {
      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
         __func__, (wpt_uint32)pTimer );
      return eWLAN_PAL_STATUS_E_INVAL;
   }
   return ( WPAL_VOS_TO_WPAL_STATUS( vos_timer_start( &pTimer->timer.timerObj,
                                                     timeout ) ) );
}
wpt_status wpalEventWait(wpt_event *pEvent, wpt_uint32 timeout)
{
   

   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
   VOS_STATUS  vos_status = VOS_STATUS_E_FAILURE;

   
   timeout = ( timeout == WLAN_PAL_WAIT_INFINITE ? 0 : timeout );

   vos_status = vos_wait_single_event( (vos_event_t*)pEvent, timeout );

   status = WPAL_VOS_TO_WPAL_STATUS( vos_status );

   return status;
}
/*---------------------------------------------------------------------------
    @brief wpalEventWait – Wait on an event object

    \param
        pEvent – a pointer to caller allocated object of wpt_event
        timeout - timeout value at unit of milli-seconds. 
                  0xffffffff means infinite wait

     \return eWLAN_PAL_STATUS_SUCCESS - the wait was satisifed by one of the events
             in the event array being set.  The index into the event arry 
             that satisfied the wait can be found at *pEventIndex.
                                  
             eWLAN_PALSTATUS_E_TIMEOUT - the timeout interval elapsed before any of 
             the events were set.
                                    
             eWLAN_PAL_STATUS_E_INVAL - At least one of the values specified in
             the event array refers to an uninitialized event object.  The
             invalid event is identified by the index in *pEventIndex.  Note
             that only the first uninitialized event is detected when this error
             is returned.
             
             eWLAN_PAL_STATUS_E_EMPTY - the events array is empty.  This condition
             is detected by numEvents being 0 on input.
              
             eWLAN_PAL_STATUS_E_FAULT - event or pEventIndex is an invalid pointer.
---------------------------------------------------------------------------*/
wpt_status wpalEventWait(wpt_event *pEvent, wpt_uint32 timeout)
{
   /* Not doing sanity checks since VOS does them anyways */

   wpt_status status = eWLAN_PAL_STATUS_E_FAILURE;
   VOS_STATUS  vos_status = VOS_STATUS_E_FAILURE;

   /* In VOS timeout = 0 corresponds to infinite wait */
   timeout = ( timeout == WLAN_PAL_WAIT_INFINITE ? 0 : timeout );

   vos_status = vos_wait_single_event( (vos_event_t*)pEvent, timeout );

   status = WPAL_VOS_TO_WPAL_STATUS( vos_status );

   return status;
}
/*---------------------------------------------------------------------------
    \brief wpalTimerDelete - invalidate a wpt_timer object

    \param pTimer a pointer to caller allocated wpt_timer object

    \return eWLAN_PAL_STATUS_SUCCESS ?? success. Fail otherwise.
---------------------------------------------------------------------------*/
wpt_status wpalTimerDelete(wpt_timer *pTimer)
{
   wpt_status status;

   /* Sanity Checks */
   if( pTimer == NULL )
   {
      WPAL_TRACE( eWLAN_MODULE_PAL, eWLAN_PAL_TRACE_LEVEL_ERROR, " %s Wrong param pTimer(%d)\n",
         __func__, (wpt_uint32)pTimer );
      return eWLAN_PAL_STATUS_E_INVAL;
   }

   status = WPAL_VOS_TO_WPAL_STATUS( vos_timer_destroy(&pTimer->timer.timerObj));

   if( status == eWLAN_PAL_STATUS_SUCCESS )
   {
      pTimer->callback = NULL;
      pTimer->pUserData = NULL;
   }

   return status;
}/*wpalTimerDelete*/
wpt_status wpalEventReset(wpt_event *pEvent)
{
   

   return ( WPAL_VOS_TO_WPAL_STATUS(vos_event_reset( (vos_event_t*)pEvent )) );
}
/*---------------------------------------------------------------------------
    wpalEventReset – Set an event object to non-signaled state
    Param:
        pEvent – a pointer to caller allocated object of wpt_event
    Return:
        eWLAN_PAL_STATUS_SUCCESS – success. Fail otherwise.
---------------------------------------------------------------------------*/
wpt_status wpalEventReset(wpt_event *pEvent)
{
   /* Not doing sanity checks since VOS does them anyways */

   return ( WPAL_VOS_TO_WPAL_STATUS(vos_event_reset( (vos_event_t*)pEvent )) );
}