📄 encregdrv3.c
字号:
/*------------------------------------------------------------------------------
-- --
-- This software is confidential and proprietary and may be used --
-- only as expressly authorized by a licensing agreement from --
-- --
-- Hantro Products Oy. --
-- --
-- In the event of publication, the following notice is applicable: --
-- --
-- (C) COPYRIGHT 2003 HANTRO PRODUCTS OY --
-- ALL RIGHTS RESERVED --
-- --
-- The entire notice above must be reproduced on all copies. --
-- --
--------------------------------------------------------------------------------
--
-- Abstract : Encoder HW register access functions
--
-------------------------------------------------------------------------------*/
#include "ewl.h"
#include "basetype.h"
#include "encregdrv.h"
#include "EncSim.h"
/* 1. (AMBAIFE) Encoder Register Offsets */
#define ENCREG(nr) (nr<<2)
/* 2. Mask fields */
#define mask_11b (u32)0x000007FF
#define mask_16b (u32)0x0000FFFF
/* 3. Encoder register access drivers */
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x28) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncVopHdrLastBits
Description : Set the last 32 bit word of the vop header data
Return type : void
Argument : u32 value
*******************************************************************************/
void SetEncVopHdrLastBits(u32 value)
{
EWL_WriteReg(0x28, value);
}
/*******************************************************************************
Function name : GetEncVopHdrLastBits
Description : Get the last 32 bit word of the vop header data
Return type : u32
*******************************************************************************/
u32 GetEncVopHdrLastBits()
{
u32 val;
val = EWL_ReadReg(0x28);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x2C) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncStrmBuf1Base
Description : Set the base of the first stream buffer
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncStrmBuf1Base(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x2C, bus_address);
}
/*******************************************************************************
Function name : GetEncStrmBuf1Base
Description : Get the base of the first stream buffer
ASIC stores here the last address where stream is written
Return type : u32
*******************************************************************************/
u32 GetEncStrmBuf1Base()
{
u32 val;
val = EWL_ReadReg(0x2C);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x30) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncStrmBuf2Base
Description : Set the base of the second stream buffer
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncStrmBuf2Base(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x30, bus_address);
}
/*******************************************************************************
Function name : GetEncStrmBuf2Base
Description : Get the base of the second stream buffer
Return type : u32
*******************************************************************************/
u32 GetEncStrmBuf2Base()
{
u32 val;
val = EWL_ReadReg(0x30);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x34) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncStrmBuf3Base
Description : Set the base of the third stream buffer
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncStrmBuf3Base(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x34, bus_address);
}
/*******************************************************************************
Function name : GetEncBuf3Base
Description : Get the base of the third stream buffer
Return type : u32
*******************************************************************************/
u32 GetEncStrmBuf3Base()
{
u32 val;
val = EWL_ReadReg(0x34);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x38) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncRefLumBase
Description : Set the base address for the luminance component of the
reference image
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncRefLumBase(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x38, bus_address);
}
/*******************************************************************************
Function name : GetEncRefLumBase
Description : Get the base address for the luminance component of the
reference image
Return type : u32
*******************************************************************************/
u32 GetEncRefLumBase()
{
u32 val;
val = EWL_ReadReg(0x38);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x3C) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncRefChromaBase
Description : Set the base address for the chrominance components of the
reference image.
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncRefChromaBase(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x3C, bus_address);
}
/*******************************************************************************
Function name : GetEncRefChromaBase
Description : Get the base address for the chrominance components of the
reference image.
Return type : u32
*******************************************************************************/
u32 GetEncRefChromaBase()
{
u32 val;
val = EWL_ReadReg(0x3C);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x40) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncInternalChromaBase
Description : Set the base address for the chrominance components
of the internal image
Return type : void
Argument : u32 bus_address
*******************************************************************************/
void SetEncInternalChromaBase(u32 bus_address)
{
ASSERT((bus_address & 0x03) == 0); /* word aligned address */
EWL_WriteReg(0x40, bus_address);
}
/*******************************************************************************
Function name : GetEncInternalChromaBase
Description : Get the base address for the chrominance components
of the internal image
Return type : u32
*******************************************************************************/
u32 GetEncInternalChromaBase()
{
u32 val;
val = EWL_ReadReg(0x40);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x44) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncCirStart
Description : Set the CIR start value; the first INTRA MB number
Return type : void
Argument : u32 start_nr
*******************************************************************************/
void SetEncCirStart(u32 start_nr)
{
u32 val;
ASSERT(start_nr <= 1201); /* 1201 => CIR disabled */
val = EWL_ReadReg(0x44);
val = (val & ~(mask_11b << 11)) | (start_nr << 11);
EWL_WriteReg(0x44, val);
}
/*******************************************************************************
Function name : GetEncCirStart
Description : Get the CIR start value; the first INTRA MB number
Return type : u32
*******************************************************************************/
u32 GetEncCirStart()
{
u32 val;
val = EWL_ReadReg(0x44);
val = (mask_11b & (val >> 11));
return val;
}
/*******************************************************************************
Function name : SetEncCirStep
Description : Set the CIR step value; the frequency INTRA MB number
Return type : void
Argument : u32 mbs
*******************************************************************************/
void SetEncCirStep(u32 mbs)
{
u32 val;
ASSERT(mbs <= 1201); /* 1201 => CIR disabled */
val = EWL_ReadReg(0x44);
val = (val & ~mask_11b) | mbs;
EWL_WriteReg(0x44, val);
}
/*******************************************************************************
Function name : GetEncCirStep
Description : Get the CIR step value; the frequency INTRA MB number
Return type : u32
*******************************************************************************/
u32 GetEncCirStep()
{
u32 val;
val = EWL_ReadReg(0x44);
val = (mask_11b & val);
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x48) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP1MbNr
Description : Set the MB number for checkpoint 1
Return type : void
Argument : u32 mb_nr
*******************************************************************************/
void SetEncChkP1MbNr(u32 mb_nr)
{
u32 val;
ASSERT(mb_nr <= 1201); /* 1201 => no checking */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -