示例#1
0
int DSL_DRV_Open(void)
{
   DSL_OpenContext_t *pOpenCtx;

   DSL_DEBUG(DSL_DBG_MSG, (DSL_NULL, "Device will be opened..."DSL_DRV_CRLF));

   if ( DSL_DRV_HandleInit(0, &pOpenCtx) != DSL_SUCCESS )
   {
      DSL_DEBUG(DSL_DBG_ERR, (DSL_NULL, "Cannot initialize device..."DSL_DRV_CRLF));
      return -1;
   }

   // Store the context. Used by DSL_DRV_Ioctls
   gv_drv_dsl_pOpenCtx = pOpenCtx;

   DSL_DEBUG(DSL_DBG_MSG, (DSL_NULL, "Open successfull..."DSL_DRV_CRLF));

   return 0;
}
DSL_DRV_STATIC int DSL_DRV_Open(DSL_DRV_DevHeader_t *pDrvHdr, IFX_uint8_t *pAnnex, IFX_int_t flags)
{
   DSL_OpenContext_t *pOpenCtx=DSL_NULL;

   DSL_DEBUG(DSL_DBG_MSG, (DSL_NULL, SYS_DBG_MSG"Device will be opened..."DSL_DRV_CRLF));

   if ( DSL_DRV_HandleInit(pDrvHdr->deviceNum, &pOpenCtx) != DSL_SUCCESS )
   {
      DSL_DEBUG(DSL_DBG_ERR,
         (DSL_NULL, SYS_DBG_ERR"Cannot initialize device..."DSL_DRV_CRLF));
      return ERROR;
   }

   pDrvHdr->pOpenCtx = pOpenCtx;

   DSL_DEBUG(DSL_DBG_MSG, (DSL_NULL, SYS_DBG_MSG"Open successfull..."DSL_DRV_CRLF));

   return (int)pDrvHdr;
}