📄 philips_dtv_ttr.c
字号:
/*
* Copyright (c) 1995,1996,1997 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_dtv_ttr.c 1.14
*
* Last update : 19:06:56 - 00/11/09
*
* Description :
*
* Board Support Package for Trimedia peripherals. This particular file supports
* the Philips dtv board. The purpose of this file is to define
* philips_dtv_ttr_config. This board config structure will be included in a
* table in boardcfg.c
*
* This file also defines many of the functions and structures which are
* referenced in the board config structure.
*
* Revision :
*
*
*/
/* includes of system H files */
#include <tm1/tmBoardID.h>
#include <tmlib/dprintf.h>
#include <tm1/tmBoard.h>
#include <tm1/mmio.h>
#include <tm1/tmProcessor.h>
#include <tm1/tmAvFormats.h>
#include <tm1/tmAssert.h>
#include <tm1/tsaComponent.h>
#include <tm1/tmVImmio.h>
#include <tm1/tmVOmmio.h>
#include <tm1/tsaFlash.h>
#include "philips_dtv_ttr.h"
#include "saa7111.h" /* defines for video in decoder */
#include "saa7125.h" /* defines for video out encoder */
#include "st7545.h"
#include "dtv_ttr_audio.h"
#include "pc16552D.h"
#include "voSupport.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)
/* address of boot eeprom: Define in C because it might be different on another board. */
#define IIC_EEPROM_ADDRESS 0xA1
/* forward declarations of functions defined in this module */
static tmLibdevErr_t dtv_ttr_board_init(void);
static tmLibdevErr_t dtv_ttr_board_detect(void);
static tmLibdevErr_t dtv_ttr_board_register(pcomponent_t comp);
static tmLibdevErr_t dtv_ttr_board_activate(pcomponent_t comp);
static tmLibdevErr_t boardVOInit(pboardVOParam_t param);
/* forward declarations of flash functions defined in this module */
static tmLibdevErr_t ttrFlashInit(void);
static tmLibdevErr_t ttrFlashReadWord(UInt32 address, UInt32 * data);
static tmLibdevErr_t ttrFlashWriteWord(UInt32 address, UInt32 data);
static tmLibdevErr_t ttrFlashReadBlock(UInt32 address, UInt32 * data, UInt32 numberOfWords);
static tmLibdevErr_t ttrFlashWriteBlock(UInt32 address, UInt32 * data, UInt32 numberOfWords);
static tmLibdevErr_t ttrFlashEraseSector(UInt32 sector);
static tmLibdevErr_t ttrFlashEraseAll(void);
/* functions to read and write registers of the PC16552D */
static UInt8 ttrReadUartRegister(unitSelect_t portID, Int addr);
static void ttrWriteUartRegister(unitSelect_t portID, Int addr,UInt8 data);
/* PIC support */
#define DTV_TTR_PIC_NUM_SUPPORTED_INTS 1
#define DTV_TTR_PIC_NUM_SRCS 2
static tmLibdevErr_t ttrPICInit(UInt32 source);
static tmLibdevErr_t ttrPICTerm(UInt32 source);
static tmLibdevErr_t ttrPICStart(UInt32 source);
static tmLibdevErr_t ttrPICStop(UInt32 source);
static tmLibdevErr_t ttrPICAck(UInt32 source);
static tsaPICSource_t ttrPICSrcTable[DTV_TTR_PIC_NUM_SRCS] =
{picSourceComm1, picSourceComm2};
static boardPICIntCaps_t ttrPICIntCaps[DTV_TTR_PIC_NUM_SUPPORTED_INTS] =
{
{
inPCI_PINB, /* interrupt */
True, /* levelTriggered */
intPRIO_2, /* interrupt priority */
DTV_TTR_PIC_NUM_SRCS, /* numSources */
ttrPICSrcTable,
ttrPICInit, /* initFunc */
ttrPICTerm, /* termFunc */
pc16552DPICSourceDetect, /* sourceDetectFunc */
ttrPICStart, /* startFunc */
ttrPICStop, /* stopFunc */
ttrPICAck, /* ackFunc */
}
};
static boardPICConfig_t ttrPIC =
{
"TTR PIC",
DTV_TTR_PIC_NUM_SUPPORTED_INTS,
ttrPICIntCaps
};
/* UART support */
static boardUartConfig_t ttrUart1 =
{
"PC16552D com1",
pc16552DInitPort,
pc16552DTermPort,
pc16552DReadData,
pc16552DSetTxInt,
pc16552DWriteData,
pc16552DSetRxInt,
pc16552DGetEvent,
pc16552DUartConfig,
PC16552D_BAUD_RATES_1_8432
};
static boardUartConfig_t ttrUart2 =
{
"PC16552D com2",
pc16552DInitPort,
pc16552DTermPort,
pc16552DReadData,
pc16552DSetTxInt,
pc16552DWriteData,
pc16552DSetRxInt,
pc16552DGetEvent,
pc16552DUartConfig,
PC16552D_BAUD_RATES_1_8432
};
/* flash support */
static boardFlashConfig_t ttrFlash =
{
"Am29F016",
ttrFlashInit,
ttrFlashReadWord,
ttrFlashWriteWord,
ttrFlashReadBlock,
ttrFlashWriteBlock,
ttrFlashEraseSector,
ttrFlashEraseAll,
DTV_TTR_FLASH_SIZE,
DTV_TTR_FLASH_SECTOR_NR,
DTV_TTR_FLASH_SECTOR_SIZE,
0xffffffff
};
/* Describe audio in. */
static boardAIConfig_t dtv_ai =
{
"DTV audio input",
dtv_ttr_AI_Init, /* init */
dtv_ttr_AI_Term, /* term */
dtv_ttr_AI_Start, /* start */
dtv_ttr_AI_Stop, /* stop */
dtv_ttr_AI_SetSrate, /* set srate */
dtv_ttr_AI_GetSrate, /* get srate */
Null, /* set volume */
Null, /* get volume */
dtv_ttr_AI_SetInput, /* set input */
dtv_ttr_AI_GetInput, /* get input */
dtv_ttr_AI_Config, /* config */
dtv_ttr_AI_GetFormat, /* getFormat */
DTV_TTR_SUPPORTED_AUDIO_IN_TYPES, /* Types supported */
DTV_TTR_SUPPORTED_AUDIO_IN_SUBTYPES, /* subtypes supported */
DTV_TTR_INPUT_AUDIO_ADAPTERS, /* audioAdapters */
intAUDIOIN, /* interrupt */
AI_STATUS, /* mmioBase */
50000,
20000,
0, /* gpio first pin */
0 /* gpio last pin */
};
/* Describe audio out. */
static boardAOConfig_t dtv_ao =
{
"DTV audio output",
dtv_ttr_AO_Init, /* init */
dtv_ttr_AO_Term, /* term */
dtv_ttr_AO_Start, /* start */
dtv_ttr_AO_Stop, /* stop */
dtv_ttr_AO_SetSRate, /* set srate */
dtv_ttr_AO_GetSRate, /* get srate */
Null, /* set volume */
Null, /* get volume */
Null, /* set output */
Null, /* get output */
dtv_ttr_AO_Config, /* config */
DTV_TTR_SUPPORTED_AUDIO_OUT_TYPES, /* Types supported */
DTV_TTR_SUPPORTED_AUDIO_OUT_SUBTYPES, /* subtypes supported */
DTV_TTR_OUTPUT_AUDIO_ADAPTERS, /* audioAdapters */
intAUDIOOUT, /* interrupt */
AO_STATUS, /* mmioBase */
50000, /* max sRate */
20000, /* min sRate */
0, /* gpio first pin */
0 /* gpio last pin */
};
/* place holders for VI */
static tmLibdevErr_t dummyTtrViInit(pboardVIParam_t param) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViConfigure(UInt32 subaddr, UInt32 value) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViGetStandard(tmVideoAnalogStandard_t * std) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViSetBrightness(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViSetContrast(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViSetSaturation(UInt val) { return TMLIBDEV_OK; }
static tmLibdevErr_t dummyTtrViSetHue(UInt val) { return TMLIBDEV_OK; }
/* Describe video in. */
static boardVIConfig_t dtv_vi =
{
"None", /* decoder name */
dummyTtrViInit, /* decode init */
Null, /* decoder term */
dummyTtrViGetStandard, /* get standard */
dummyTtrViSetHue,
dummyTtrViSetSaturation,
dummyTtrViSetBrightness,
dummyTtrViSetContrast,
dummyTtrViConfigure, /* config */
vasNone, /* supported color standards */
vaaNone, /* supported adapters */
intVIDEOIN, /* interrupt number */
VI_STATUS, /* mmioBase */
0, /* gpio first pin */
0, /* 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 */
};
/* Describe video out. */
static boardVOConfig_t dtv_vo =
{
"DTV VO ", /* encoder name */
boardVOInit, /* init */
Null, /* term */
Null, /* Hue */
Null, /* Saturation */
Null, /* Brightness */
Null, /* Contrast */
Null, /* config */
DTV_TTR_VO_SUPPORTED_STANDARDS, /* supported color standards */
DTV_TTR_VO_SUPPORTED_ADAPTERS, /* supported adapters */
intVIDEOOUT, /* interrupt number */
VO_STATUS, /* mmioBase */
0, /* gpio first pin */
0 /* gpio last pin */
};
/* describe telecom's Analog Front End (AFE) */
static boardSSIConfig_t dtv_afe =
{
"none",
Null, /* setup */
Null, /* term */
Null, /* hook */
Null, /* config */
sacNoConnection, /* connection flags */
Null, /* reserved */
intINT_15,
0, /* gpio first pin */
0 /* gpio last pin */
};
/*********************************** PIC Support ************************************/
static tmLibdevErr_t ttrPICInit(UInt32 source)
{
return TMLIBDEV_OK;
}
static tmLibdevErr_t ttrPICTerm(UInt32 source)
{
return TMLIBDEV_OK;
}
static tmLibdevErr_t ttrPICStart(UInt32 source)
{
return TMLIBDEV_OK;
}
static tmLibdevErr_t ttrPICStop(UInt32 source)
{
return TMLIBDEV_OK;
}
static tmLibdevErr_t ttrPICAck(UInt32 source)
{
return TMLIBDEV_OK;
}
/*********************************** UART Support ************************************/
#define Uart_COMM1_IOBASE_ADDR 0xff200100 /* Uart COMM1 I/O base address */
#define Uart_COMM2_IOBASE_ADDR 0xff200000 /* Uart COMM2 I/O base address */
static UInt8 ttrReadUartRegister(unitSelect_t portID, Int addr)
{
UInt8 Result;
UInt8* pCommPtr;
if (portID == unit0)
pCommPtr = (UInt8* ) Uart_COMM1_IOBASE_ADDR;
else
pCommPtr = (UInt8* ) Uart_COMM2_IOBASE_ADDR;
Result= *(pCommPtr + (addr*4) ) & 0xff;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -