/* 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_device_type.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *    This header file contains Device Type definitions, which are exported
 *    to other Middleware components and applications.
 *         
 */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW
 *  @{ 
 */
/*----------------------------------------------------------------------------*/
#ifndef _U_DEVICE_TYPE_H_
#define _U_DEVICE_TYPE_H_

/*---------------------------------------------------------------------------
                    include files
----------------------------------------------------------------------------*/

#include "u_common.h"
#include "u_handle.h"
#include "u_handle_grp.h"

/*--------------------------------------------------------------------------
 Constants, enumerations, and macros
---------------------------------------------------------------------------*/


/*
    A device id is used to identify a specific device object.
    The id consists of the device group name (the upper 8 bits) and device name id
    (the lower 24 bits). 
*/
typedef  UINT32                DEVICE_TYPE_T;    /**< defination of device type      */

/*
   Macro for the device groups.  The device groups are
   logical grouping of source devices.
*/

#define	 DEV_UNKNOWN           ((DEVICE_TYPE_T) 0x00000000)    /**< Unknown device type       */

#define  DEV_1394              ((DEVICE_TYPE_T) 0x01000000) /* 1394 devices group. */    /**<        */
#define  DEV_TUNER             ((DEVICE_TYPE_T) 0x02000000) /* tuner device group. */    /**<        */
#define	 DEV_AVC               ((DEVICE_TYPE_T) 0x03000000) /* AV Connect group. */    /**<        */
#define  DEV_VTRL              ((DEVICE_TYPE_T) 0x04000000) /* virtual connect group. */    /**<        */

/* End marker. */
#define	 DEV_RESERVED          ((DEVICE_TYPE_T) 0x05000000)    /**<   reserved device     */


/* Get DEV group type. */
#define  DEV_GET_GROUP_ID(_dev_)  (_dev_ & 0xFF000000)    /**<    get group id    */

/* Get DEV device id. */
#define  DEV_GET_DEV_ID(_dev_) (_dev_ & 0x00FFFFFF)    /**<   get device id     */

/* Check for valid DEV group */
#define  DEV_IS_VALID_GROUP(_group_name_) \
 (((_group_name_>>24)>DEV_UNKNOWN)&&((_group_name_>>24)<(DEV_RESERVED>>24))?TRUE:FALSE)    /**<    is valid group    */

/*
 	Macros for the device names 
*/

/*   1394 Devices */
#define   DEV_1394_MONITOR          (DEV_1394 |  0x00000001)    /**<  1394 monitor      */
#define	  DEV_1394_AUDIO            (DEV_1394 |  0x00000002)    /**<  1394 audio     */
#define	  DEV_1394_PRINTER          (DEV_1394 |  0x00000003)    /**<  1394 printer     */
#define	  DEV_1394_DISC             (DEV_1394 |  0x00000004)    /**<  1394 disc      */
#define	  DEV_1394_TAPE             (DEV_1394 |  0x00000005)    /**<  1394 tape      */
#define	  DEV_1394_TUNER            (DEV_1394 |  0x00000006)    /**<  1394 tuner      */
#define	  DEV_1394_CA               (DEV_1394 |  0x00000007)    /**<  1394 ca      */
#define	  DEV_1394_CAMERA           (DEV_1394 |  0x00000008)    /**<  1394 camerra      */
#define	  DEV_1394_PANEL            (DEV_1394 |  0x00000009)    /**<  1394 panel      */

#define   DEV_1394_RESERVED		    (DEV_1394 |  0x0000000A)    /**<   reserved     */

/*   AV connector device */
#define   DEV_AVC_COMP_VIDEO        (DEV_AVC  |  0x00000001)    /**<   comp video     */
#define	  DEV_AVC_S_VIDEO           (DEV_AVC  |  0x00000002)    /**<    s video    */
#define	  DEV_AVC_Y_PB_PR           (DEV_AVC  |  0x00000003)    /**<   y pb pr     */
#define	  DEV_AVC_VGA               (DEV_AVC  |  0x00000004)    /**<   vga     */
#define	  DEV_AVC_SCART	            (DEV_AVC  |  0x00000005)    /**<   scart     */
#define	  DEV_AVC_DVI               (DEV_AVC  |  0x00000006)    /**<   dvi     */
#define	  DEV_AVC_HDMI              (DEV_AVC  |  0x00000007)    /**<   hdmi     */
#define	  DEV_AVC_AUDIO_INP         (DEV_AVC  |  0x00000008)    /**<   audio     */
#define	  DEV_AVC_SPDIF             (DEV_AVC  |  0x00000009)    /**<   spdif     */
#define	  DEV_AVC_COMBI             (DEV_AVC  |  0x0000000A)    /**<   combi     */

#define	  DEV_AVC_RESERVED          (DEV_AVC  |  0x0000000B)    /**<   reserved     */

/* Tuner Devices */
#define	  DEV_TUNER_SAT_DIG         (DEV_TUNER |  0x00000001)    /**<  tuner sat digital      */
#define	  DEV_TUNER_CAB_DIG         (DEV_TUNER |  0x00000002)    /**<  tuner cab digital      */
#define	  DEV_TUNER_TER_DIG         (DEV_TUNER |  0x00000003)    /**<  tuner ter digital      */
#define   DEV_TUNER_SAT_ANA         (DEV_TUNER |  0x00000004)    /**<  tuner sat analog     */
#define	  DEV_TUNER_CAB_ANA         (DEV_TUNER |  0x00000005)    /**<  tuner cab analog      */
#define	  DEV_TUNER_TER_ANA         (DEV_TUNER |  0x00000006)    /**<  tuner ter analog      */
#define	  DEV_TUNER_CAB_DIG_OOB_TX  (DEV_TUNER |  0x00000007)    /**<  tuner cab digital oob tx      */
#define	  DEV_TUNER_CAB_DIG_OOB_RX  (DEV_TUNER |  0x00000008)    /**<  tuner cab digital oob rx      */

#define	  DEV_TUNER_RESERVED        (DEV_TUNER |  0x00000009)    /**<   reserved     */

/* Virtual connector devices */
#define	  DEV_VTRL_MMP              (DEV_VTRL |  0x00000001)    /**<  mmp      */
#define	  DEV_VTRL_MMP_PHOTO        (DEV_VTRL |  0x00000002)    /**<   mmp photo     */
#define	  DEV_VTRL_MMP_AUDIO        (DEV_VTRL |  0x00000003)    /**<   mmp audio    */
#define	  DEV_VTRL_MMP_VIDEO        (DEV_VTRL |  0x00000004)    /**<   mmp video    */
#define	  DEV_VTRL_CAST             (DEV_VTRL |  0x00000005)    /**<   Cast TV */

#define	  DEV_VTRL_RESERVED         (DEV_VTRL |  0x00000006)    /**<   reserved     */

#endif /* _U_DEVICE_TYPE_H_ */
/*----------------------------------------------------------------------------*/
/*! @} */                                             /* end of groupMW*/
/*----------------------------------------------------------------------------*/
