📄 _csl_vpsscalcrdexp.c
字号:
/** @file _csl_vpssCalcRdExp.c
*
* @brief File for functional layer of CSL API @a CSL_vpssCalcRdExp()
*
* Description
* - The @a CSL_vpssCalcRdExp() function definition & it's associated
* functions
*
* @date 2nd June, 2005
* @author Jesse Villarreal
*/
#include <csl_vpss_aux.h>
#include <csl_prev.h>
#include <csl_resz.h>
#include <csl_hist.h>
#pragma CODE_SECTION (CSL_vpssCalcRdExp, ".text:csl_section:vpss");
/** @brief Calculates the DMA read request expansion parameter and number of DMA requests
*/
CSL_Status CSL_vpssCalcRdExp(
/** Pointer to the object that holds reference to the
* instance of RESZ requested after the call
*/
CSL_VpssHandle hVpss,
/** Calculates the DMA read request expansion parameter and number of DMA requests
*/
CSL_VpssRdExpInfo *data
){
Uint32 addr, offset, bytesPerLn, numLines;
CSL_Status status=CSL_SOK;
if(data == NULL) return (CSL_ESYS_INVPARAMS);
switch (data->module) {
case CSL_VPSS_PREV:
{
CSL_PrevObj prevObj;
CSL_PrevHandle hPrev;
CSL_Status status = CSL_SOK;
Uint16 fail = 0;
if((status = CSL_prevInit()) != CSL_SOK)
fail |= 1;
hPrev = CSL_prevOpen( &prevObj,
CSL_PREV_0,
CSL_EXCLUSIVE,
&status);
if(status != CSL_SOK)
fail |= (1<<1);
addr = CSL_FEXT(hPrev->regs->RSDR_ADDR, PREV_RSDR_ADDR_RADR);
offset = CSL_FEXT(hPrev->regs->RADR_OFFSET, PREV_RADR_OFFSET_OFFSET);
bytesPerLn =((CSL_FEXT(hPrev->regs->HORZ_INFO, PREV_HORZ_INFO_EPH) + 1)*2);
numLines = CSL_FEXT(hPrev->regs->VERT_INFO, PREV_VERT_INFO_ELV) + 1;
CSL_prevClose(hPrev);
}
break;
case CSL_VPSS_RESZ:
{
CSL_ReszObj reszObj;
CSL_ReszHandle hResz;
CSL_Status status = CSL_SOK;
Uint16 fail = 0;
if((status = CSL_reszInit()) != CSL_SOK)
fail |= 1;
hResz = CSL_reszOpen( &reszObj,
CSL_RESZ_0,
CSL_EXCLUSIVE,
&status);
if(status != CSL_SOK)
fail |= (1<<1);
addr = CSL_FEXT(hResz->regs->SDR_INADD, RESZ_SDR_INADD_SDR_INADD);
offset = CSL_FEXT(hResz->regs->SDR_INOFF, RESZ_SDR_INOFF_OFFSET);
bytesPerLn =(CSL_FEXT(hResz->regs->IN_SIZE, RESZ_IN_SIZE_HORZ)*2);
numLines = CSL_FEXT(hResz->regs->IN_SIZE, RESZ_IN_SIZE_VERT);
CSL_reszClose(hResz);
}
break;
case CSL_VPSS_HIST:
{
CSL_HistObj histObj;
CSL_HistHandle hHist;
CSL_Status status = CSL_SOK;
Uint16 fail = 0;
if((status = CSL_histInit()) != CSL_SOK)
fail |= 1;
hHist = CSL_histOpen( &histObj,
CSL_HIST_0,
CSL_EXCLUSIVE,
&status);
if(status != CSL_SOK)
fail |= (1<<1);
addr = CSL_FEXT(hHist->regs->RADD, HIST_RADD_RADD);
offset = CSL_FEXT(hHist->regs->RADD_OFF, HIST_RADD_OFF_OFFSET);
bytesPerLn =(CSL_FEXT(hHist->regs->H_V_INFO, HIST_H_V_INFO_HSIZE)*2);
numLines = CSL_FEXT(hHist->regs->H_V_INFO, HIST_H_V_INFO_VSIZE);
CSL_histClose(hHist);
}
break;
default:
return (CSL_ESYS_INVPARAMS);
}
{
Uint8 divider, back = 0;
Uint32 bytesPerLnPlusFront, totalRequestsPerLine, totalRequests, temp;
Int32 exp;
bytesPerLnPlusFront = bytesPerLn + (addr%256);
if(bytesPerLnPlusFront%256)
back = 1;
totalRequestsPerLine = (bytesPerLnPlusFront/256) + back;
if(!(offset%256))
{
totalRequests = totalRequestsPerLine * numLines;
}
else
{
temp = (offset/32)%8;
if(temp%2){ // if odd
divider = 8; // divide by 8;
}
else if(temp == 4){
divider = 2; // divide by 2;
}
else{
divider = 4; // divide by 4;
}
// Case of 1st line every [divider] lines +
// Estimate worst case for all other lines
totalRequests = (totalRequestsPerLine * numLines / divider) +
(bytesPerLn/256 + 2) * (numLines - (numLines / divider));
}
data->numRdRequests = totalRequests;
if(exp = (Int32)((data->totalDmaCycles / totalRequests) - 40) < 0)
exp = 0;
data->valRdExpand = (Uint16)exp;
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -