FreeBSD/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c
/******************************************************************************
agtiapi_CheckCB()

Purpose:
  Check call back function returned event for process completion
Parameters: 
  struct agtiapi_softc *pCard  Pointer to card data structure
  U32 milisec (IN)       Waiting time for expected event
  U32 flag (IN)          Flag of the event to check
  U32 *pStatus (IN)      Pointer to status of the card or port to check
Return:
  AGTIAPI_SUCCESS - event comes as expected
  AGTIAPI_FAIL    - event not coming
Note:
  Currently, not used    
******************************************************************************/
agtiapi_CheckCB()
Purpose:
Check call back function returned event for process completion
Parameters:
struct agtiapi_softc *pCard  Pointer to card data structure
U32 milisec (IN)       Waiting time for expected event
U32 flag (IN)          Flag of the event to check
U32 *pStatus (IN)      Pointer to status of the card or port to check
Return:
AGTIAPI_SUCCESS - event comes as expected
AGTIAPI_FAIL    - event not coming
Note:
Currently, not used
agtiapi_CheckCB () Purpose : Check call back function returned event for process completion Parameters : struct agtiapi_softc * pCard Pointer to card data structure U32 milisec ( IN ) Waiting time for expected event U32 flag ( IN ) Flag of the event to check U32 * pStatus ( IN ) Pointer to status of the card or port to check Return : AGTIAPI_SUCCESS - event comes as expected AGTIAPI_FAIL - event not coming Note : Currently not used
agBOOLEAN agtiapi_CheckCB( struct agtiapi_softc *pCard,
                           U32 milisec,
                           U32 flag,
                           volatile U32 *pStatus )
{
  U32    msecsPerTick = pCard->pCardInfo->tiRscInfo.tiInitiatorResource.
                        initiatorOption.usecsPerTick / 1000;
  S32    i = milisec/msecsPerTick;
  AG_GLOBAL_ARG( _flags );
  AGTIAPI_PRINTK( "agtiapi_CheckCB: start\n" );
  AGTIAPI_FLOW(   "agtiapi_CheckCB: start\n" );
  if( i <= 0 )
    i = 1;
  while (i > 0)
  {
    if (*pStatus & TASK_MANAGEMENT)
    {
      if (*pStatus & AGTIAPI_CB_DONE) 
      {
        if( flag == 0 || *pStatus & flag )
          return AGTIAPI_SUCCESS;
        else
          return AGTIAPI_FAIL;
      }
    }
    else if (pCard->flags & AGTIAPI_CB_DONE) 
    {
      if( flag == 0 || *pStatus & flag )
        return AGTIAPI_SUCCESS;
      else
        return AGTIAPI_FAIL;
    }
    agtiapi_DelayMSec( msecsPerTick );
    AG_SPIN_LOCK_IRQ( agtiapi_host_lock, _flags );
    tiCOMTimerTick( &pCard->tiRoot );
    agtiapi_CheckAllVectors( pCard, tiNonInterruptContext );
    AG_SPIN_UNLOCK_IRQ( agtiapi_host_lock, _flags );
    i--;
  }
  if( *pStatus & TASK_MANAGEMENT )
    *pStatus |= TASK_TIMEOUT;
  return AGTIAPI_FAIL;
}
agBOOLEAN agtiapi_CheckCB ( struct agtiapi_softc * pCard , U32 milisec , U32 flag , volatile U32 * pStatus ) { U32 msecsPerTick = pCard -> pCardInfo -> tiRscInfo . tiInitiatorResource . initiatorOption . usecsPerTick / 1000 ; S32 i = milisec / msecsPerTick ; AG_GLOBAL_ARG ( _flags ) ; AGTIAPI_PRINTK ( " \n " ) ; AGTIAPI_FLOW ( " \n " ) ; if ( i <= 0 ) i = 1 ; while ( i > 0 ) { if ( * pStatus & TASK_MANAGEMENT ) { if ( * pStatus & AGTIAPI_CB_DONE ) { if ( flag == 0 || * pStatus & flag ) return AGTIAPI_SUCCESS ; else return AGTIAPI_FAIL ; } } else if ( pCard -> flags & AGTIAPI_CB_DONE ) { if ( flag == 0 || * pStatus & flag ) return AGTIAPI_SUCCESS ; else return AGTIAPI_FAIL ; } agtiapi_DelayMSec ( msecsPerTick ) ; AG_SPIN_LOCK_IRQ ( agtiapi_host_lock , _flags ) ; tiCOMTimerTick ( & pCard -> tiRoot ) ; agtiapi_CheckAllVectors ( pCard , tiNonInterruptContext ) ; AG_SPIN_UNLOCK_IRQ ( agtiapi_host_lock , _flags ) ; i -- ; } if ( * pStatus & TASK_MANAGEMENT ) * pStatus |= TASK_TIMEOUT ; return AGTIAPI_FAIL ; }
agtiapi_CheckCB()
Purpose:
Check call back function returned event for process completion
Parameters:
struct agtiapi_softc *pCard  Pointer to card data structure
U32 milisec (IN)       Waiting time for expected event
U32 flag (IN)          Flag of the event to check
U32 *pStatus (IN)      Pointer to status of the card or port to check
Return:
AGTIAPI_SUCCESS - event comes as expected
AGTIAPI_FAIL    - event not coming
Note:
Currently, not used
agtiapi_CheckCB () Purpose : Check call back function returned event for process completion Parameters : struct agtiapi_softc * pCard Pointer to card data structure U32 milisec ( IN ) Waiting time for expected event U32 flag ( IN ) Flag of the event to check U32 * pStatus ( IN ) Pointer to status of the card or port to check Return : AGTIAPI_SUCCESS - event comes as expected AGTIAPI_FAIL - event not coming Note : Currently not used