📄 camcor.c
字号:
/*============================================================================
*
* TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
*
* Property of Texas Instruments
* For Unrestricted Internal Use Only
* Unauthorized reproduction and/or distribution is strictly prohibited.
* This product is protected under copyright law and trade secret law as an unpublished work.
* Created 2003, (C) Copyright 2003 Texas Instruments. All rights reserved.
*
* Component: CAMCOR -- CAMERA CORE Library Component
*
* Filename: CAMCOR.c
*
* Description: This library components provides functions to control and configure the CAMERA
* CORE module
*
* =============================================================================
*/
/* ============================================================================
* STANDARD INCLUDE FILES
* =============================================================================
*/
#include "global_types.h"
#include "GlobalTypes.h"
#include "result_led.h"
#include "CAMCRegAcM.h"
#include "CAMCOR.h"
#include "RESExt.h"
/* ============================================================================
* PROJECT SPECIFIC INCLUDE FILES
* =============================================================================
*/
/* ============================================================================
* GLOBAL VARIABLES DECLARATIONS
* =============================================================================
*/
/* ============================================================================
* LOCAL TYPES AND DEFINITIONS
* =============================================================================
*/
/* ============================================================================
* LOCAL VARIABLES DECLARATIONS
* =============================================================================
*/
/* ============================================================================
* LOCAL FUNCTIONS PROTOTYPES
* =============================================================================
*/
/* ============================================================================
* FUNCTIONS
* =============================================================================
*/
/*==================== Function Separator ==============================*/
/*
-----------------------------------------------------------------------------
NAME : CAMCOR_SetAutoIdleMode
-----------------------------------------------------------------------------
*/
ReturnCode_t CAMCOR_SetAutoIdleMode(
const UWORD32 baseAddress,
const CAMCOR_AutoIdleMode_t autoIdleMode
)
{
ReturnCode_t returnCode = TEST_OK;
/* Check the input parameters */
CHECK_INPUT_PARAM(baseAddress,0,RET_BAD_NULL_PARAM,RES_CAMCOR_BASE + RES_INVALID_INPUT_PARAM);
/*
values from beach should be used below instead of 'magic numbers'
but they're not defined (CAMCAccInt.h)
*/
switch(autoIdleMode)
{
case CAMCOR_AUTOIDLE_ENABLE:
CAMCCC_SYSCONFIGAutoIdleWrite32(baseAddress, 0x1);
break;
case CAMCOR_AUTOIDLE_DISABLE:
default:
CAMCCC_SYSCONFIGAutoIdleWrite32(baseAddress, 0x0);
break;
}
return returnCode;
}
/*==================== Function Separator =============================*/
/*
-----------------------------------------------------------------------------
NAME : CAMCOR_SetIdleMode
-----------------------------------------------------------------------------
*/
ReturnCode_t CAMCOR_SetIdleMode(
const UWORD32 baseAddress,
const CAMCOR_Idle_t sIdleVal
)
{
ReturnCode_t returnCode = TEST_OK;
/*Check the input Parameters*/
CHECK_INPUT_PARAM(baseAddress,0,RET_BAD_NULL_PARAM,RES_CAMCOR_BASE + RES_INVALID_INPUT_PARAM);
/*
values from beach should be used below instead of 'magic numbers'
but they're not defined (CAMCAccInt.h)
*/
switch(sIdleVal)
{
case CAMCOR_NO_IDLE:
CAMCCC_SYSCONFIGSIdleModeWrite32(baseAddress, 0x1);
break;
case CAMCOR_FORCE_IDLE:
default:
CAMCCC_SYSCONFIGSIdleModeWrite32(baseAddress, 0x0);
break;
}
return returnCode;
}
/*==================== Function Separator =============================*/
/*
-----------------------------------------------------------------------------
NAME : CAMCOR_SoftReset
-----------------------------------------------------------------------------
*/
ReturnCode_t CAMCOR_SoftReset(
const UWORD32 baseAddress
)
{
ReturnCode_t returnCode = TEST_OK;
/*Check the input Parameters*/
CHECK_INPUT_PARAM(baseAddress,0,RET_BAD_NULL_PARAM,RES_CAMCOR_BASE + RES_INVALID_INPUT_PARAM);
/*
values from beach should be used below instead of 'magic numbers'
but they're not defined (CAMCAccInt.h)
*/
CAMCCC_SYSCONFIGSoftResetWrite32(baseAddress, 0x1);
while (!(CAMCCC_SYSSTATUSResetDoneRead32(baseAddress)))
{
}
return returnCode;
}
/*==================== Function Separator =============================*/
/*
-----------------------------------------------------------------------------
NAME : CAMCOR_EnableDisable
-----------------------------------------------------------------------------
*/
ReturnCode_t CAMCOR_EnableDisable(
const UWORD32 baseAddress,
const CAMCOR_SetClear_t enableDisable
)
{
ReturnCode_t returnCode = TEST_OK;
/*Check the input Parameters*/
CHECK_INPUT_PARAM(baseAddress,0,RET_BAD_NULL_PARAM,RES_CAMCOR_BASE + RES_INVALID_INPUT_PARAM);
/*
values from beach should be used below instead of 'magic numbers'
but they're not defined (CAMCAccInt.h)
*/
switch(enableDisable)
{
case CAMCOR_SET:
CAMCCC_CTRLCC_ENWrite32(baseAddress, 0x1);
break;
case CAMCOR_CLEAR:
default:
CAMCCC_CTRLCC_ENWrite32(baseAddress, 0x0);
break;
}
return returnCode;
}
/*==================== Function Separator =============================*/
/*
-------------------------------------------------------------------------
CAMCOR_IrqMaskUnmask
-------------------------------------------------------------------------
*/
ReturnCode_t CAMCOR_IrqMaskUnmask(
const UWORD32 baseAddress,
const CAMCOR_IrqEvent_t intEvent,
const CAMCOR_SetClear_t maskUnmask
)
{
ReturnCode_t returnCode = TEST_OK;
UWORD32 irqEventReg;
/*Check the input Parameters*/
CHECK_INPUT_PARAM(baseAddress,0,RET_BAD_NULL_PARAM,RES_CAMCOR_BASE + RES_INVALID_INPUT_PARAM);
/*
values from beach should be used below instead of 'magic numbers'
but they're not defined (CAMCAccInt.h)
*/
/* read values from register */
irqEventReg = CAMCCC_IRQENABLEReadRegister32(baseAddress);
/* check event is FIFO underflow */
if ( intEvent == CAMCOR_FIFO_UF_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_UF_IRQ_ENSet32(irqEventReg, 1l);
}
else
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_UF_IRQ_ENSet32(irqEventReg, 0l);
}
}
/* check event is FIFO Overflow */
else if( intEvent == CAMCOR_FIFO_OF_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_OF_IRQ_ENSet32(irqEventReg, 1l);
}
else
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_OF_IRQ_ENSet32(irqEventReg, 0l);
}
}
/* check event is FIFO threshold */
else if( intEvent == CAMCOR_FIFO_THR_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_THR_IRQ_ENSet32(irqEventReg, 1l);
}
else
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_THR_IRQ_ENSet32(irqEventReg, 0l);
}
}
/* check event is FIFO Full */
else if( intEvent == CAMCOR_FIFO_FULL_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_FULL_IRQ_ENSet32(irqEventReg, 1l);
}
else
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_FULL_IRQ_ENSet32(irqEventReg, 0l);
}
}
/* check event is FIFO NO Empty */
else if( intEvent == CAMCOR_FIFO_NOEMPTY_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_NOEMPTY_IRQ_ENSet32(irqEventReg, 1l);
}
else
{
irqEventReg =
CAMCCC_IRQENABLEFIFO_NOEMPTY_IRQ_ENSet32(irqEventReg, 0l);
}
}
/* check event is Shifted Synchronization Error */
else if( intEvent == CAMCOR_SSC_ERR_IRQ_EN )
{
/* check Mask OR Unmask */
if ( maskUnmask )
{
irqEventReg =
CAMCCC_IRQENABLESSC_ERR_IRQ_ENSet32(irqEventReg, 1l);
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -