📄 ddc_previewer.c
字号:
/*******************************************************************************
**+--------------------------------------------------------------------------+**
**| **** |**
**| **** |**
**| ******o*** |**
**| ********_///_**** |**
**| ***** /_//_/ **** |**
**| ** ** (__/ **** |**
**| ********* |**
**| **** |**
**| *** |**
**| |**
**| Copyright (c) 2006-2010 Texas Instruments Incorporated |**
**| ALL RIGHTS RESERVED |**
**| |**
**| Permission is hereby granted to licensees of Texas Instruments |**
**| Incorporated (TI) products to use this computer program for the sole |**
**| purpose of implementing a licensee product based on TI products. |**
**| No other rights to reproduce, use, or disseminate this computer |**
**| program, whether in part or in whole, are granted. |**
**| |**
**| TI makes no representation or warranties with respect to the |**
**| performance of this computer program, and specifically disclaims |**
**| any responsibility for any damages, special or consequential, |**
**| connected with the use of this program. |**
**| |**
**+--------------------------------------------------------------------------+**
*******************************************************************************/
/**
* \file ddc_previewer.c
*
* \brief previewer implementaion of DDC layer
*
* This file contains the implementation of DDC layer of the previewer driver.
*
* (C) Copyright 2010, Texas Instruments, Inc
*
*
* \author EI2
*
* \version 0.1 Created
* 1.0 First Release
*/
/******************************************************************************
Header File Inclusion
******************************************************************************/
#include <tistdtypes.h>
#include <std.h>
#ifdef PREVIEWER_DEBUG
#ifdef DDC_PREVIEWER_DEBUG_PRINTF
#include "psputils.h"
#endif /* DDC_PREVIEWER_DEBUG_PRINTF */
#endif /* PREVIEWER_DEBUG */
#include <psp_common.h>
#include <pal_os.h>
#include <pal_osmem.h>
#include <pal_ossem.h>
#include <csl_error.h>
#include <soc.h>
#include <cslr_prev.h>
#include <cslr_vpss.h>
#include "psp_previewer.h"
#include "ddc_previewer.h"
#include "llc_previewer.h"
#ifdef PREV_INSTRUMENTATION_ENABLED
#include <psp_log.h>
#endif /* PREV_INSTRUMENTATION_ENABLED */
/******************************************************************************
Macros
******************************************************************************/
/* Debug Macros */
#ifdef PREVIEWER_DEBUG
/* macro to indicate DDC file */
#define DDC_PREVIEWER_DEBUG_FILE 3
#define PREVIEWER_DEBUG_ERROR_TRACE_SIZE 16
Uint32 prevDebugErrorTraceIndex = 0;
Uint32 prevDebugErrorTraceArray[PREVIEWER_DEBUG_ERROR_TRACE_SIZE];
#define PREVIEWER_DEBUG_ERR_TRACE(LINENO) \
{\
prevDebugErrorTraceArray[prevDebugErrorTraceIndex] = (Uint32)(\
(DDC_PREVIEWER_DEBUG_FILE << 24) | (LINENO));\
prevDebugErrorTraceIndex++;\
prevDebugErrorTraceIndex %= PREVIEWER_DEBUG_ERROR_TRACE_SIZE;\
}
#ifdef DDC_PREVIEWER_DEBUG_ALL_TRACE
#define PREVIEWER_DEBUG_TRACE_SIZE 128
Uint32 prevDebugTraceIndex = 0;
Uint32 prevDebugTraceArray[PREVIEWER_DEBUG_TRACE_SIZE];
#define DDC_PREVIEWER_DEBUG_REG_TRACE(LINENO) \
{\
prevDebugTraceArray[prevDebugTraceIndex] = (Uint32)(\
(DDC_PREVIEWER_DEBUG_FILE << 24) | (LINENO));\
prevDebugTraceIndex++;\
prevDebugTraceIndex %= PREVIEWER_DEBUG_TRACE_SIZE;\
}
#else /* DDC_PREVIEWER_DEBUG_ALL_TRACE */
#define DDC_PREVIEWER_DEBUG_REG_TRACE(LINENO)
#endif /* DDC_PREVIEWER_DEBUG_ALL_TRACE */
#ifdef DDC_PREVIEWER_DEBUG_PRINTF
#define DDC_PREVIEWER_DEBUG_PRINT(STR) PSP_DEBUG1("DDC%s", (STR));
#else /* DDC_PREVIEWER_DEBUG_PRINTF */
#define DDC_PREVIEWER_DEBUG_PRINT(STR)
#endif /* DDC_PREVIEWER_DEBUG_PRINTF */
#else /* PREVIEWER_DEBUG */
#define DDC_PREVIEWER_DEBUG_REG_TRACE(LINENO)
#define PREVIEWER_DEBUG_ERR_TRACE(LINENO)
#define DDC_PREVIEWER_DEBUG_PRINT(STR)
#endif /* PREVIEWER_DEBUG */
/******************************************************************************
Internal Function declaration
******************************************************************************/
/**
* \brief DDC_prevPerformRegOverlaying
*
* This is previewer register overlaying function.
* It will Perform register overlaying.
*
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevPerformRegOverlaying();
/**
* \brief DDC_prevSetParameters
*
* It will set parameters in previewer register.
*
* \param ddcChannelHandle [IN] channel handle
* \param DDC_prevParams [IN] parameter structure passed by
* application, according to that
* values will be set in registers.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevSetParameters(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerParams *DDC_prevParams
);
/**
* \brief DDC_prevGetParameters
*
* It will get parameters from previewer register.
*
* \param ddcChannelHandle [IN] channel handle
* \param DDC_prevParams [OUT] parameter structure passed by
* application, in which values will be
* stored.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevGetParameters(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerParams *DDC_prevParams
);
/**
* \brief DDC_prevValidateParameters
*
* It will validate previewer parameters.
*
* \param ddcChannelHandle [IN] channel handle
* \param DDC_prevParams [IN] parameter structure passed by
* application, which will be validated.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevValidateParameters(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerParams *DDC_prevParams
);
/**
* \brief DDC_prevGetStatus
*
* It will get status of previewer by reading status from PCR register.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevStatus [OUT] parameter structure passed by
* application, in which previewer status
* value will be stored.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevGetStatus(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerStatus *prevStatus
);
/**
* \brief DDC_prevGetDarkFrameStatus
*
* It will get status of dark frame subtract failure status by reading status
* from PCR register.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevDarkFrameStatus [OUT] parameter structure passed by
* application, in which dark frame
* status value will be stored.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevGetDarkFrameStatus(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerDarkFrameStatus *prevDarkFrameStatus
);
/**
* \brief Trigger previewing operation
*
* It will trigger previewing operation by writing source desti address and
* then will set enable bit. is used in one shot mode.
*
* \param ddcChannelHandle [IN] channel handle
*
* \param prevPreview [IN] parameter structure passed by
* application, according to parameter in this
* previewer will be triggered.
*
* \return success DDC_PREV_SOK
* failure DDC error
*
*/
static DDC_prevResult DDC_prevPreview(
DDC_prevChannelHandle ddcChannelHandle,
PSP_preview *prevPreview
);
/**
* \brief DDC_prevGetCropSize
*
* It will calculates crop size as per previewer parameters.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevCropSize [OUT] parameter structure passed by
* application, in which crop size will be
* filled.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevGetCropSize(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerCropSize *prevCropSize
);
/**
* \brief DDC_prevSetReadReqExpand
*
* It will set read request expand field.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevReadReqExp [IN] parameter structure passed by
* application, from which read request expand
* field will be taken.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevSetReadReqExpand(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerReadReqExp *prevReadReqExp
);
/**
* \brief DDC_prevSetDFC
*
* It will set dark frame capture parameter.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevSetDFC [IN] parameter structure passed by
* application, according to that dark frame
* capture feature will be enabled or disabled.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevSetDFC(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerDarkFrameCapture *prevSetDFC
);
/**
* \brief DDC_prevGetDFC
*
* It will set dark frame capture parameter.
*
* \param ddcChannelHandle [IN] channel handle
* \param prevGetDFC [OUT] parameter structure passed by
* application, according to that dark frame
* capture feature will be enabled or disabled.
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevGetDFC(
DDC_prevChannelHandle ddcChannelHandle,
PSP_previewerDarkFrameCapture *prevGetDFC
);
/**
* \brief DDC_prevValidateInputParams
*
* It will validate input image parameters for previewer.
*
* \param ddcChannelHandle [IN] channel handle
* \param inBufSize [IN] input buffer size as specified by
* applicaion
* \return success DDC_PREV_SOK
* failure DDC error
*/
static DDC_prevResult DDC_prevValidateInputParams(
DDC_prevChannelHandle ddcChannelHandle,
Int32 inBufSize
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -