/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file u_rm.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *         This header file contains Resource Manager specific definitions,
 *         which are exported.
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_RM_H_
#define _U_RM_H_


/*-----------------------------------------------------------------------------
                    include files
-----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_RES_MNGR
 *  @{
 */
/*----------------------------------------------------------------------------*/

#include "u_common.h"


/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/

/* Resource Manager API return values */
#define RMR_ARBITRATION                ((INT32)    2)    /**<need arbitration        */
#define RMR_ASYNC_NFY                  ((INT32)    1)    /**<asysn notify        */
#define RMR_OK                         ((INT32)    0)    /**<ok        */
#define RMR_NOT_INIT                   ((INT32)   -1)    /**<resource manager is not init        */
#define RMR_ALREADY_INIT               ((INT32)   -2)    /**<resource manager already inited        */
#define RMR_INV_ARG                    ((INT32)   -3)    /**<invalid argument       */
#define RMR_INV_HANDLE                 ((INT32)   -4)    /**<invalid handle        */
#define RMR_INV_NAME                   ((INT32)   -5)    /**<invalid name        */
#define RMR_OUT_OF_HANDLES             ((INT32)   -6)    /**<out of handle        */
#define RMR_NO_COMP_FOUND              ((INT32)   -7)    /**<component not found        */
#define RMR_INV_CONNECT                ((INT32)   -8)    /**<can't connect        */
#define RMR_INV_DISCONNECT             ((INT32)   -9)    /**<can't disconnect        */
#define RMR_INV_COND                   ((INT32)  -10)    /**<invalid condtion        */
#define RMR_DUPLICATE_COMP_ID          ((INT32)  -11)    /**<duplicate component id        */
#define RMR_DUPLICATE_NAME             ((INT32)  -12)    /**<duplicate group/comp name        */
#define RMR_INV_COMP_ID                ((INT32)  -13)    /**<invalid component id        */
#define RMR_INV_LIST_ENTRY             ((INT32)  -14)    /**<invalid list entry        */
#define RMR_NOT_ENOUGH_SPACE           ((INT32)  -15)    /**<not enough space        */
#define RMR_DRV_ERROR                  ((INT32)  -16)    /**<driver error        */
#define RMR_NO_RIGHTS                  ((INT32)  -17)    /**<no right for this operation        */
#define RMR_NOT_ENOUGH_MEM             ((INT32)  -18)    /**<not enough memory        */
#define RMR_OUT_OF_RESOURCES           ((INT32)  -19)    /**<out of resource        */
#define RMR_HARD_WIRED_CONFLICT        ((INT32)  -20)    /**<the component is hard wired        */
#define RMR_SUPPORT_COMP_CONFLICT      ((INT32)  -21)    /**<support component conflict        */
#define RMR_INV_PORT_NUMBER            ((INT32)  -22)    /**<invalid port number        */
#define RMR_INV_OBJ_TO_COMP_REL        ((INT32)  -23)    /**<invalid component         */
#define RMR_INV_CTRL_TYPE              ((INT32)  -24)    /**<invalid control type        */
#define RMR_PIPE_IS_CLOSING            ((INT32)  -25)    /**<the pipe is closing        */
#define RMR_SINGLE_INP_PORT_COMP       ((INT32)  -26)    /**<single input port        */
#define RMR_MULTI_INP_PORT_COMP        ((INT32)  -27)    /**<mulit input port        */
#define RMR_DUPLICATE_PORT             ((INT32)  -28)    /**<duplicate port        */
#define RMR_COMP_IS_CLOSING            ((INT32)  -29)    /**<the component is closing        */
#define RMR_COMP_NOT_CONNECTED         ((INT32)  -30)    /**<the component is not connected        */
#define RMR_HARD_WIRED                 ((INT32)  -31)    /**<the component is hard wired        */
#define RMR_CONN_CONFLICT              ((INT32)  -32)    /**<connection conflict        */
#define RMR_CONNECT_FAILED             ((INT32)  -33)    /**<connection failed        */
#define RMR_DISCONNECT_FAILED          ((INT32)  -34)    /**<disconnect failed        */
#define RMR_INV_SET                    ((INT32)  -35)    /**<invalid set operation        */
#define RMR_INV_GET                    ((INT32)  -36)    /**<invalide get operation        */
#define RMR_COMP_EXCL_NFY_SET          ((INT32)  -37)    /**<internel use        */
#define RMR_NO_GET_INFO                ((INT32)  -38)    /**<internel use        */
#define RMR_DUPLICATE_MC_NFY_FCT_TBL   ((INT32)  -39)    /**<internel use        */
#define RMR_DUPLICATE_MC_NFY_DEV_ID    ((INT32)  -40)    /**<internel use        */
#define RMR_UNKNOWN_MC_NFY_DEV_ID      ((INT32)  -41)    /**<internel use        */
#define RMR_DUPLICATE_MC_NFY_INSTANCE  ((INT32)  -40)    /**<internel use        */

/* Driver type */
typedef UINT16 DRV_TYPE_T;    /**<internel use        */

/* Operation types. */
typedef UINT32 DRV_CONN_TYPE_T;    /**<internel use        */
typedef UINT32 DRV_DISC_TYPE_T;    /**<internel use        */
typedef UINT32 DRV_GET_TYPE_T;    /**<internel use        */
typedef UINT32 DRV_SET_TYPE_T;    /**<internel use        */

/* Connect reasons */
#define RM_CONN_REASON_LAST_ENTRY  ((UINT32) 256)    /**<internel use        */

/* Disconnect reasons */
#define RM_DISC_REASON_LAST_ENTRY  ((UINT32) 256)    /**<internel use        */

/* Connection types */
#define RM_CONN_TYPE_LAST_ENTRY  ((DRV_CONN_TYPE_T) 256)    /**<internel use        */

/* Disconnect types */
#define RM_DISC_TYPE_LAST_ENTRY  ((DRV_DISC_TYPE_T) 256)    /**<internel use        */

/* Get types */
#define RM_GET_TYPE_LAST_ENTRY  ((DRV_GET_TYPE_T) 256)    /**<internel use        */

/* Set types */
#define RM_SET_TYPE_LAST_ENTRY  ((DRV_SET_TYPE_T) 256)    /**<internel use        */

/* Ports */
#define ALL_PORTS     ((UINT8) 0xff)    /**<internel use        */
#define SUPPORT_PORT  ((UINT8) 0xfe)  /* Indicates support port. */    /**<internel use       */
#define ANY_PORT_NUM  ALL_PORTS    /**<internel use        */

/*----------------------------------------------------------------------------*/
/*! @} */                                          /* end of groupMW_RES_MNGR */
/*----------------------------------------------------------------------------*/

#endif /* _U_RM_H */

