void* core_dump_start(int objId, int errCode, int expected_size)
{
    struct dump_s *s = &dump_state;

    DE_MEMSET(s,0,sizeof(struct dump_s));

    s->objId = objId;
    s->errCode = errCode;
    s->expected_size = expected_size;
    s->written = 0;

    s->file = prep_new_core_file(s);
    if(!de_f_is_open(s->file))
    {
       DE_TRACE_INT2(TR_ALL, "max count of coredump with, objId; %d, errCode %d reatched\n"
            , objId, errCode);
       return NULL;
    }

#if (DE_COREDUMP_CACHE_SIZE > 0)
    s->cache = DriverEnvironment_Malloc(DE_COREDUMP_CACHE_SIZE);
    if(!s->cache)
    {
       return NULL;
    }
#endif

    DE_TRACE_INT3(TR_ALL, "coredump started, objId; %d, errCode %d, nr %d\n",
                     objId, errCode, s->nr);
    return s;
}
/*!
 * @brief Requests to release the hic interface resource.
 *
 * @param id Identifies the user that requests the release.
 *
 * @return nothing.
 */
void wei_release_resource_hic(int id)
{
   int users;
   int thisUser;
   DE_TRACE_STATIC(TR_PS, "===========> wei_release_resource_hic\n"); 
   DE_TRACE_STRING(TR_PS_DEBUG,"State is: %s \n",state_name[state]);   
   WIFI_RESOURCE_HIC_LOCK(); 
   
   if((wifiEngineState.users & id) == 0)
   {
      /* nothing to release */
      WIFI_RESOURCE_HIC_UNLOCK();
      return;
   }
   thisUser = id;
   users = wifiEngineState.users;

   wifiEngineState.users &= ~id;

   /* trace this only while ps_enabled==TRUE */
   DE_TRACE_INT3(TR_PS, "id: %d users: %d=>%d \n",id, users,wifiEngineState.users);      

   if((id == RESOURCE_DISABLE_PS)&&(state == INTERFACE_PS_DISABLED))
   {
      /* The resource to disable power save mechansim for hic
         interface is released */
      state = INTERFACE_PS_OPEN; 
      we_ind_send(WE_IND_HIC_PS_INTERFACE_ENABLED, NULL );
   }

   if (wifiEngineState.users != 0)
   {
      /* There is someone that has requested to use the interface*/
      WIFI_RESOURCE_HIC_UNLOCK();
      return;
   }

   /* None is using the interface */
   switch(state)
   {
      case INTERFACE_PS_DISABLED:
      {;
         /* Interface has been disabled now it is time to enable it again */       
         state = INTERFACE_PS_CLOSED_WAIT;
         /* Inform firmware that ps hic interface is not used anymore */
         WiFiEngine_PsSendInterface_Down();
         state = INTERFACE_PS_CLOSED;  
      }
      break; 

      case INTERFACE_PS_OPEN:
      {
         rPowerManagementProperties *powerManagementProperties = NULL; 
         powerManagementProperties = (rPowerManagementProperties *)Registry_GetProperty(ID_powerManagement);
         
         /* Interface is temporary open - close it */   
         if(isLegacyPsNoPsPoll() && (thisUser == RESOURCE_USER_DATA_PATH) && (powerManagementProperties->psTxTrafficTimeout > 0))

         {
            /* Start a tx traffic timeout that will hold firware
               awake if more data is about to be sent */
            if(WES_TEST_FLAG(WES_FLAG_PS_TRAFFIC_TIMEOUT_RUNNING))
            {
               /* Cancel the timer so we can restart it */
               DriverEnvironment_CancelTimer(wifiEngineState.ps_traffic_timeout_timer_id);
               WES_CLEAR_FLAG(WES_FLAG_PS_TRAFFIC_TIMEOUT_RUNNING);
            }

            WIFI_RESOURCE_HIC_UNLOCK();
            wei_request_resource_hic(RESOURCE_USER_TX_TRAFFIC_TMO);
            WIFI_RESOURCE_HIC_LOCK();            
            
            if (DriverEnvironment_RegisterTimerCallback(powerManagementProperties->psTxTrafficTimeout, 
                     wifiEngineState.ps_traffic_timeout_timer_id,ps_traffic_timeout_cb,0) != 1)
            {
                DE_TRACE_STATIC(TR_SEVERE,"Failed to register timer callback\n");
                /* Skip timer and go to sleep */
                wifiEngineState.users = 0;
                wifiEngineState.dataPathState = DATA_PATH_CLOSED;
                state = INTERFACE_PS_CLOSED_WAIT;
                /* Inform firmware that ps hic interface is not used anymore */
                WiFiEngine_PsSendInterface_Down();
                state = INTERFACE_PS_CLOSED; 
            }
            else
            {
               WES_SET_FLAG(WES_FLAG_PS_TRAFFIC_TIMEOUT_RUNNING);
            }          

         }
         else
         { 
            wifiEngineState.dataPathState = DATA_PATH_CLOSED;
            state = INTERFACE_PS_CLOSED_WAIT;
            /* Inform firmware that ps hic interface is not used anymore */
            WiFiEngine_PsSendInterface_Down();
            state = INTERFACE_PS_CLOSED;
         }
      }      
      break;

      case INTERFACE_PS_CLOSED:
         DE_TRACE_STATIC(TR_PS, "State is closed no action\n"); 
      break;

      case INTERFACE_PS_OPEN_WAIT:
         DE_TRACE_STATIC(TR_PS, "Transit to OPEN state no action\n"); 
      break;         
      case INTERFACE_PS_CLOSED_WAIT:
         DE_TRACE_STATIC(TR_PS, "Transit to CLOSE state no action\n");          
      break;

      default:
         DE_TRACE_INT(TR_PS,"Unknown state is: %d \n",state);
         DE_ASSERT(FALSE);
      break;

   }

   WIFI_RESOURCE_HIC_UNLOCK();
   DE_TRACE_STRING(TR_PS_DEBUG,"State is: %s \n",state_name[state]);
   DE_TRACE_STATIC(TR_PS, "<=========== wei_release_resource_hic\n");    
}