⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cameraosdepend.c

📁 Xcale270Bsp包,wince平台
💻 C
字号:
/****************************************************************************** 
** INTEL CONFIDENTIAL
** Copyright 2000-2003 Intel Corporation All Rights Reserved.
**
** The source code contained or described herein and all documents
** related to the source code (Material) are owned by Intel Corporation
** or its suppliers or licensors.  Title to the Material remains with
** Intel Corporation or its suppliers and licensors. The Material contains
** trade secrets and proprietary and confidential information of Intel
** or its suppliers and licensors. The Material is protected by worldwide
** copyright and trade secret laws and treaty provisions. No part of the
** Material may be used, copied, reproduced, modified, published, uploaded,
** posted, transmitted, distributed, or disclosed in any way without Intel抯
** prior express written permission.

** No license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise. Any license under such intellectual property rights
** must be express and approved by Intel in writing.
********************************************************************************/
#include <windows.h>
#include <types.h>
#include <string.h>
#include <stdio.h>
#include <tchar.h>

#include "bvd1.h"
#include "bvd1bd.h"
#include "drv_glob.h"

#include "xllp_defs.h"
#include "xllp_serialization.h"
#include "xllp_camera.h"
#include "xllp_bcr.h"
#include "xllp_ost.h"
#include "xllp_dmac.h"
#include "xllp_i2c.h"

extern void msWait(unsigned int);

XLLP_OST_T *pOSTRegs;
XLLP_UINT8_T slaveAddr;

P_XLLP_I2C_T I2C_regs;

void InitRegs(XLLP_OST_T *pOST, XLLP_I2C_T *pI2C)
{
	pOSTRegs = pOST;
	I2C_regs = pI2C;
}

void OS_Delay(int ms)
{
	msWait(ms);
}

int OS_I2CMasterWriteData(XLLP_UINT8_T slaveAddr, const XLLP_UINT8_T * bytesBuf, int bytesCount)
{
	int status;
	XLLP_BOOL_T bSENDSTOP = XLLP_TRUE;

	status = XllpI2CWrite(I2C_regs, pOSTRegs, slaveAddr, bytesBuf, bytesCount, bSENDSTOP);

	return status;
}

int OS_I2CMasterReadData(XLLP_UINT8_T slaveAddr, XLLP_UINT8_T * bytesBuf, int bufLen)
{
	int status;

	XLLP_BOOL_T bSENDSTOP = XLLP_TRUE;

	status = XllpI2CRead(I2C_regs, pOSTRegs, slaveAddr, bytesBuf, bufLen, bSENDSTOP);

	return status;
}

// Allocate one DMA channel with desired priority
XLLP_STATUS_T OS_DmaAllocChannel(P_XLLP_DMAC_CHANNEL_T pChannel, XLLP_DMAC_CHANNEL_PRIORITY_T aChannelPriority)
{
/*
	static DMA_CHANNEL = 0;

	*pChannel = DMA_CHANNEL + XLLP_DMAC_CHANNEL_17;

	DMA_CHANNEL = (DMA_CHANNEL + 1) % 3;
*/

	// Once the XllpDMA services are available, we will be able to call XllpDmacAllocChannel
	// For now, statically allocate three high-priority channels, 17,18,19.
	// Cycle DMA_CHANNEL between 0 and 2, add 17, yields 17,18,19.

	return XllpDmacAllocChannel(pChannel, aChannelPriority);	
//	return XLLP_FALSE;
}

// Free the channel and the request to channel mapping
void OS_DmaFreeChannel(XLLP_DMAC_CHANNEL_T aChannel, XLLP_DMAC_DEVICE_T aDevice)
{
    XllpDmacFreeChannel(aChannel, aDevice);
}

// Fill the channel dma register with the descriptor, Set up device request to channel mapping, Set up proper alignment
void OS_DmaCfgChannelDescTransfer(  P_XLLP_DMAC_DESCRIPTOR_T pDescVir, P_XLLP_DMAC_DESCRIPTOR_T pDescPhy, 
									XLLP_DMAC_CHANNEL_T aChannel, 
									XLLP_DMAC_DEVICE_T aDevice, 
									XLLP_DMAC_ALIGNMENT_T aLignment)
{
	// Note: for XLLP DMA codes, the first parameter is physical address. Palm wrapper changed to virtual address.
	XllpDmacCfgChannelDescTransfer( pDescPhy, aChannel, aDevice, aLignment);
}

// Start the specified channel
void OS_DmaStartTransfer(XLLP_DMAC_CHANNEL_T aChannel)
{
	XllpDmacStartTransfer(aChannel);
}
									
// Stop the specified channel
void OS_DmaStopTransfer(XLLP_DMAC_CHANNEL_T aChannel)
{
	XllpDmacStopTransfer(aChannel);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -