/******************************************************************************
 *
 *   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright(c) 2007-2026 Intel Corporation
 * 
 *   These contents may have been developed with support from one or more
 *   Intel-operated generative artificial intelligence solutions.
 *
 *****************************************************************************/

/**
 ***************************************************************************
 * @file sal_service_state.c     Service state checks
 *
 * @ingroup SalServiceState
 *
 ***************************************************************************/

/*
*******************************************************************************
* Include public/global header files
*******************************************************************************
*/

#include "cpa.h"
#include "lac_list.h"
#include "icp_accel_devices.h"
#include "icp_adf_debug.h"
#include "lac_sal_types.h"
#include "sal_service_state.h"

CpaBoolean Sal_ServiceIsRunning(CpaInstanceHandle instanceHandle)
{
    sal_service_t *pService = (sal_service_t *)instanceHandle;

    if (SAL_SERVICE_STATE_RUNNING == pService->state)
    {
        return CPA_TRUE;
    }
    return CPA_FALSE;
}

CpaBoolean Sal_ServiceIsRestarting(CpaInstanceHandle instanceHandle)
{
    sal_service_t *pService = (sal_service_t *)instanceHandle;

    if (SAL_SERVICE_STATE_RESTARTING == pService->state)
    {
        return CPA_TRUE;
    }
    return CPA_FALSE;
}

CpaBoolean Sal_ServiceIsInError(CpaInstanceHandle instanceHandle)
{
    sal_service_t *pService = (sal_service_t *)instanceHandle;

    if (SAL_SERVICE_STATE_ERROR == pService->state)
    {
        return CPA_TRUE;
    }
    return CPA_FALSE;
}
