⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tp.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 C
字号:
/*
 * Copyright (c) 1998, 1999 by TriMedia Technologies. 
 *
 * +------------------------------------------------------------------+
 * | This software is furnished under a license and may only be used  |
 * | and copied in accordance with the terms and conditions of  such  |
 * | a license and with the inclusion of this copyright notice. This  |
 * | software or any other copies of this software may not be provided|
 * | or otherwise made available to any other person.  The ownership  |
 * | and title of this software is not transferred.                   |
 * |                                                                  |
 * | The information in this software is subject  to change without   |
 * | any  prior notice and should not be construed as a commitment by |
 * | TriMedia Technologies.                                           |
 * |                                                                  |
 * | this code and information is provided "as is" without any        |
 * | warranty of any kind, either expressed or implied, including but |
 * | not limited to the implied warranties of merchantability and/or  |
 * | fitness for any particular purpose.                              |
 * +------------------------------------------------------------------+
 *
 *  Module name          : tp.c    1.13
 *
 *  Last update          : 19:05:35 - 00/11/09
 */

#include <tmlib/tmtypes.h>
#include <tm1/tmLibdevErr.h>
#include <tm1/tmAvFormats.h>
#include <tm1/tmTPboard.h>
#include <tm1/tmTPmmio.h>
#include <tm1/tsaComponent.h>
#include <tm1/tmGPIOpins.h>
#include <tm1/tsaReg.h>
#include <tm1/tmBoard.h>
#include <tm1/tmBoardID.h>
#include <tmlib/dprintf.h>

#define TRY(x) \
do { \
tmLibdevErr_t _err = (x); \
if (_err != TMLIBDEV_OK) { \
DP(("Failed at line %d in file %s. Err = %x\n", __LINE__, __FILE__, _err)); \
return _err; \
}} while (0) 

static tmLibdevErr_t tp_Init(void);
static tmLibdevErr_t tp_Term(void);
static tmLibdevErr_t tp_Config(UInt32 address, UInt32 value);

static boardTPConfig_t boardTPConfig1 =
{
    "TP1",
    tp_Init,       /* init */
    tp_Term,       /* term */
    tp_Config,     /* config */
    True,          /* onlySampleDvalidBytes */
    False,         /* sampleOnNegativeEdge */
    intINT_9,      /* interrupt */
    TP1_STATUS,    /* mmioBase */
    GPIO_VI1_CLK,  /* first gpio pin */
    GPIO_VI1_DATA9 /* last  gpio pin */
};

static boardTPConfig_t boardTPConfig2 = 
{
    "TP2",
    tp_Init,       /* init */
    tp_Term,       /* term */
    tp_Config,     /* config */
    True,          /* onlySampleDvalidBytes */
    False,         /* sampleOnNegativeEdge */
    intINT_22,     /* interrupt */
    TP2_STATUS,    /* mmioBase */
    GPIO_VI2_CLK,  /* first gpio pin */
    GPIO_VI2_DATA9 /* last  gpio pin */
};

static tmLibdevErr_t tp_Init(void)
{
    return TMLIBDEV_OK;
}

static tmLibdevErr_t tp_Term(void)
{
    return TMLIBDEV_OK;
}

static tmLibdevErr_t tp_Config(UInt32 address, UInt32 value)
{
    return TMLIBDEV_OK;
}


static tmLibdevErr_t dummyTpViInit(pboardVIParam_t param) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViConfigure(UInt32 subaddr, UInt32 value) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViGetStandard(tmVideoAnalogStandard_t * std) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViSetBrightness(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViSetContrast(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViSetSaturation(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTpViSetHue(UInt val) { return TMLIBDEV_OK; }


static boardVIConfig_t boardVIConfig1 =
{           
    "None",                  /* decoder name */
    dummyTpViInit,           /* decode init */
    Null,                    /* decoder term */
    dummyTpViGetStandard,    /* get standard */
    dummyTpViSetHue,           
    dummyTpViSetSaturation,    
    dummyTpViSetBrightness,    
    dummyTpViSetContrast,      
    dummyTpViConfigure,      /* config */
    vasNone,                 /* supported color standards: these should not be required */
    vaaNone,                 /* supported adapters */
    intVIDEOIN,              /* interrupt number */
    VI1_STATUS,              /* mmioBase */
    GPIO_VI1_CLK,            /* gpio first pin */
    GPIO_VI1_DATA9,          /* gpio last pin */
    vcapNone,                /* capabilities flags */
    vdfNone,                 /* output formats     */
    Null,                    /* returns line number of VSync falling edge */
    Null,                    /* GetSlicedData */
    Null,                    /* GetStatus */
    Null,                    /* GetSupportedDataServices */
    Null,                    /* SetDataServices */
    Null                     /* EnableSlicing */
};                               

static boardVIConfig_t boardVIConfig2 =
{           
    "None",                  /* decoder name */
    dummyTpViInit,           /* decode init */
    Null,                    /* decoder term */
    dummyTpViGetStandard,    /* get standard */
    dummyTpViSetHue,           
    dummyTpViSetSaturation,    
    dummyTpViSetBrightness,    
    dummyTpViSetContrast,      
    dummyTpViConfigure,      /* config */
    vasNone,                 /* supported color standards: these should not be required */
    vaaNone,                 /* supported adapters */
    intVIDEOIN2,             /* interrupt number */
    VI2_STATUS,              /* mmioBase */
    GPIO_VI2_CLK,            /* gpio first pin */
    GPIO_VI2_DATA9,          /* gpio last pin */
    vcapNone,                /* capabilities flags */
    vdfNone,                 /* output formats     */
    Null,                    /* returns line number of VSync falling edge */
    Null,                    /* GetSlicedData */
    Null,                    /* GetStatus */
    Null,                    /* GetSupportedDataServices */
    Null,                    /* SetDataServices */
    Null                     /* EnableSlicing */
};                               


static tmLibdevErr_t tp_activate(pcomponent_t comp)
{
    tsaRegFind_t        findInfo;
    tmLibdevErr_t       rVal;
    UInt32              ID;
    Char               *boardName;
    Bool                tm2DtvBoard;
    Bool                tm2600DtvBoard;
    Bool                tm1DtvBoard;

    DP(("tp_activate:\n"));

    /* probe the hardware */
    TRY(tsaBoardGetBoard(&ID, &boardName));
    tm2DtvBoard    = (ID == BOARD_VERSION_PHILIPS_TM2700_DEBUG_1_0) ||
                     (ID == BOARD_VERSION_PHILIPS_DTV_REF4) ||
                     (ID == BOARD_VERSION_PHILIPS_DTV_REF4_V3);
    tm1DtvBoard    = (ID == BOARD_VERSION_PHILIPS_DTV_REF3);
    tm2600DtvBoard = (ID == BOARD_VERSION_PHILIPS_DTV_REF5);
    if (!tm2DtvBoard && !tm1DtvBoard && !tm2600DtvBoard)
        return BOARD_ERR_UNKNOWN_BOARD;

    DP(("  correct board: %s\n", boardName));
    
    DP(("  registring interface\ntp_activate END.\n"));


    /* Register dummy functions for VI and TP. Don't check return values. The
       registration will only succeed if there is no interface registered up
       to this point. */
    /* register the interface for TM2700 boards */
    if (tm2DtvBoard)
    {
        tsaBoardRegisterTP(1, &boardTPConfig2);
        tsaBoardRegisterVI(1, &boardVIConfig2);
        tsaBoardRegisterTP(0, &boardTPConfig1);
        tsaBoardRegisterVI(0, &boardVIConfig1);
    }
    
    /* register the interface for TM1 boards*/
    if (tm1DtvBoard)
        tsaBoardRegisterVI(0, &boardVIConfig1);

    /* register the interface for TM2600 boards */
    if (tm2600DtvBoard)
    {
        tsaBoardRegisterTP(0, &boardTPConfig1);
        tsaBoardRegisterVI(0, &boardVIConfig1);
    }

    return TMLIBDEV_OK;
}

TSA_COMP_DEF_IO_COMPONENT(dtv_tp, 
                          TSA_COMP_BUILD_ARG_LIST_2_M("bsp/boardID", compInputRequired, "bsp/daughterboard", compInputNotRequired), 
                          TSA_COMP_BUILD_ARG_LIST_1("bsp/tp"), 
                          tp_activate
                          );



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -