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

📄 philips_debug_tm1300.c

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的设备库的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * Copyright (c) 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              : philips_debug_tm1300.c    1.15
 *
 *  Last update              : 18:47:23 - 00/11/09
 *
 * Description              :
 *
 * Board Support Package for Trimedia peripherals. This particular file supports
 * the Philips TM1300 DEBUG board (Debug board and High Speed Debug Board)
 *
 *
 */


#include <tm1/mmio.h>
#include <tm1/tmBoardID.h>
#include <tm1/tmBoard.h>
#include <tm1/tmProcessor.h>
#include <tm1/tmVImmio.h>
#include <tm1/tmVOmmio.h>
#include <tm1/tmAssert.h>
#include <tm1/tmAvFormats.h>
#include <tmlib/dprintf.h>
#include <tm1/tsaComponent.h>

/* includes of local H files */
#include "philips_debug_tm1300.h"
#include "tm1300Debug_audio.h"
#include "voSupport.h"
#include "saa7125.h"  /* VO  */
#include "saa7113.h"  /* VI  */
#include "st7545.h"   /* AFE */

#define IIC_EEPROM_ADDRESS  0xA1        /* address of boot eeprom */

#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)

/* forward declarations of functions defined in this module */
static tmLibdevErr_t tm1300Debug_board_activate(pcomponent_t comp);
static tmLibdevErr_t tm1300Debug_board_init(void);
static tmLibdevErr_t tm1300Debug_board_detect(void);
static tmLibdevErr_t tm1300Debug_board_register(pcomponent_t comp);

static tmLibdevErr_t tm1300Debug_VI_Init (pboardVIParam_t param); 
static tmLibdevErr_t tm1300Debug_VI_Configure(UInt32 subaddr, UInt32 value);
static tmLibdevErr_t tm1300Debug_VI_GetStandard(tmVideoAnalogStandard_t *standard);
static tmLibdevErr_t tm1300Debug_VI_GetAdapterStandard(pboardVIDec_t pVD, tmVideoAnalogAdapter_t adapter, UInt adapterNum, tmVideoAnalogStandard_t *standard);
static tmLibdevErr_t tm1300Debug_VI_SetBrightness(UInt val);
static tmLibdevErr_t tm1300Debug_VI_SetContrast(UInt val);
static tmLibdevErr_t tm1300Debug_VI_SetSaturation(UInt val);
static tmLibdevErr_t tm1300Debug_VI_SetHue(UInt val);

static Bool Is7113Initialized = False;

/* Describe audio out. */
static boardAOConfig_t tm1300Debug_ao =
{
    "TM1300 Debug AO",        /* determined in init */
    tm1300Debug_AO_Init,       /* init */
    tm1300Debug_AO_Term,       /* term */
    tm1300Debug_AO_Start,      /* start */
    tm1300Debug_AO_Stop,       /* stop */
    tm1300Debug_AO_SetSRate,   /* set srate */
    tm1300Debug_AO_GetSRate,   /* get srate */
    Null,                      /* set volume */
    Null,                      /* get volume */
    Null,                      /* set output */
    Null,                      /* get output */
    tm1300Debug_AO_Config,     /* config */
    TM1300DEBUG_SUPPORTED_AUDIO_OUT_TYPES,    /* audioTypeFormats */
    TM1300DEBUG_SUPPORTED_AUDIO_OUT_SUBTYPES, /* audioSubtypeFormats*/
    TM1300_DEBUG_OUTPUT_AUDIO_ADAPTERS,       /* audioAdapters */
    intAUDIOOUT,               /* interrupt number */
    AO1_STATUS,                /* mmioBase */
    50000,                     /* max sample rate */
    20000,                     /* min sample rate */
    0,                         /* gpio first pin */
    0                          /* gpio last pin */
};

/* Describe audio in. */
static boardAIConfig_t tm1300Debug_ai =
{
    "TM1300 Debug AI",        /* determined in init */
    tm1300Debug_AI_Init,       /* init */
    tm1300Debug_AI_Term,       /* term */
    tm1300Debug_AI_Start,      /* start */
    tm1300Debug_AI_Stop,       /* stop */
    tm1300Debug_AI_SetSRate,   /* set srate */
    tm1300Debug_AI_GetSRate,   /* get srate */
    Null,                      /* set volume */
    Null,                      /* get volume */
    Null,                      /* set input */
    Null,                      /* get input */
    Null,                      /* config */
    Null,                      /* get format */
    TM1300DEBUG_SUPPORTED_AI_TYPES,    /* audioTypeFormats */
    TM1300DEBUG_SUPPORTED_AI_SUBTYPES, /* audioSubtypeFormats*/
    TM1300DEBUG_INPUT_AI_ADAPTERS,     /* audioAdapters */
    intAUDIOIN,                /* interrupt number */
    AI_STATUS,                 /* mmioBase */
    50000,                     /* max sample rate */
    20000,                     /* min sample rate */
    0,                         /* gpio first pin */
    0                          /* gpio last pin */
};

static boardSPDOConfig_t tm1300Debug_spdo =
{
    "TM1300 deb SPDO",         /* determined in init */
    tm1300Debug_SPDO_Init,     /* init */
    tm1300Debug_SPDO_Term,     /* term */
    tm1300Debug_SPDO_Start,    /* start */
    tm1300Debug_SPDO_Stop,     /* stop */
    tm1300Debug_SPDO_SetSRate, /* set srate */
    tm1300Debug_SPDO_GetSRate, /* get srate */
    Null,                      /* config */
    TM1300DEBUG_SUPPORTED_SPDO_TYPES,    /* audioTypeFormats */
    TM1300DEBUG_SUPPORTED_SPDO_SUBTYPES, /* audioSubtypeFormats*/
    TM1300DEBUG_OUTPUT_SPDO_ADAPTERS,    /* audioAdapters */
    intSPDIFOUT,               /* interrupt number */
    SPDO_STATUS,               /* mmioBase */
    50000,                     /* max sample rate */
    20000,                     /* min sample rate */
    0,                         /* gpio first pin */
    0                          /* gpio last pin */
};

/* VO + SAA 7125 init */
static tmLibdevErr_t boardVOInit(pboardVOParam_t param)
{
    tmLibdevErr_t       rval;

    rval = saa7125Init(param);
    
    voSetFREQUENCY__CHECK(param->ddsFrequency);
    voSetPLL_S__CHECK(1);
    voSetPLL_T__CHECK(1);
    voSetCLKOUT__CHECK(1);
    voSetSYNC_MASTER__CHECK(1);

    switch (param->videoStandard)
    {
    case vasNTSC:
        voSupportNTSC();
        break;
    case vasPAL:
        voSupportPAL();
        break;
    case vas720x480p: /* NTSC progressive */
        voSetPLL_T__CHECK(3);   /* this double the VO CLK; freq 54 MHz */
        voSupport720x480p();
        break;
    case vasNone:
        break;    
    default:
        return BOARD_ERR_UNSUPPORTED_STANDARD;
    }
    
    return rval;
}

/* Describe video out. */
static boardVOConfig_t tm1300Debug_vo =
{
    "SAA 7125",                     /* encoder name */
    boardVOInit,                    /* init */
    Null,                           /* term */
    Null,                           /* Hue  */
    Null,                           /* Saturation   */
    saa7125SetBrightness,
    Null,                           /* Contrast */
    saa7125Configure,               /* config */
    SAA7125_SUPPORTED_STANDARDS,    /* supported color standards */
    SAA7125_SUPPORTED_ADAPTERS,     /* supported adapters */
    intVIDEOOUT,                    /* interrupt number */
    VO_STATUS,                      /* mmioBase */
    0,                              /* gpio first pin */
    0                               /* gpio last pin */
};

/* Describe video input adapters */
#define NO_OF_VIDEO_ADAPTERS 2 
static boardVIAdapterEntry_t tm1300Debug_vi_adapters [NO_OF_VIDEO_ADAPTERS] =
{
    /* The first adapter will be used as default in case vaaNone is seleted */
    { vaaSvideo, 0, 9 },            /* S-Video adapter 0 at input mode 9 */
    { vaaCVBS,   0, 1 }             /* CVBS via S-Video adapter input mode 1 */
};

/* Describe video in. */
static boardVIConfig_t tm1300Debug_vi =
{
    "SAA 7113H",                    /* decoder name */
    tm1300Debug_VI_Init,            /* decode init */
    Null,                           /* decoder term */
    tm1300Debug_VI_GetStandard,     /* get standard */
    tm1300Debug_VI_SetHue,
    tm1300Debug_VI_SetSaturation,
    tm1300Debug_VI_SetBrightness,
    tm1300Debug_VI_SetContrast,
    tm1300Debug_VI_Configure,       /* config */

    SAA7113_SUPPORTED_STANDARDS,    /* supported color standards */
    SAA7113_SUPPORTED_ADAPTERS,     /* supported adapters */
    intVIDEOIN,                     /* interrupt number */
    VI_STATUS,                      /* mmioBase */
    0,                              /* gpio first pin */
    0,                              /* gpio last pin */
    SAA7113_CAPABILITIES_FLAGS,     /* saa7113 capabilities */
    SAA7113_OUTPUT_FORMATS,         /* saa7113 output formats */
    saa7113GetVSyncFallingEdge,     /* returns line number of VSync falling edge */
    saa7113GetSlicedData,           /* returns sliced Closed Caption data */
    saa7113GetStatus,               /* gives information if CC data have been available */
    saa7113GetSupportedDataServices,/* returns supported services for each VBI line */
    saa7113SetDataServices,         /* sets data services to be sliced */
    saa7113EnableSlicing,           /* enables HW slicing */
    saa7113SetSlicerVideoStandard,  /* set video standard for slicer */
    saa7113GetSlicerVideoStandard,  /* get slicer's video standard */
    saa7113ToggleFieldID,           /* toggle slicer's field ID */
    Null,          /* set input of slicer */
    Null,          /* get slicer's input */
    saa7113SetVideoColor,           /* set BCSH for active video */
    saa7113GetVideoColor,           /* get BCSH for active video */
    Null,          /* set video input mode */
    Null,          /* get video input mode */
    saa7113SetStandard,             /* set video standard */
    saa7113SetSourceType,           /* set video source type */
    saa7113GetSourceType,           /* get video source type */
    saa7113SetOutputFormat,         /* set the video's output format */
    saa7113GetOutputFormat,         /* get the video's output format */
    saa7113SetAcquisitionWnd,       /* set video acquisition window */
    saa7113GetAcquisitionWnd,       /* get video acquisition window */
    saa7113GetDefaultAcquisitionWnd,/* get the default acquisition window */
    saa7113SetOutputSize,           /* set video output size */
    saa7113SetInterlaceMode,        /* set interlaced mode */

⌨️ 快捷键说明

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