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

📄 pxa27x_camera.h

📁 PXA270平台下WINCE6.0的摄像头控制驱动
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
//
/**************************************************************************
** Copyright 2000-2003 Intel Corporation. All Rights Reserved.
**
** Portions of the source code contained or described herein and all documents
** related to such source code (Material) are owned by Intel Corporation
** or its suppliers or licensors and is licensed by Microsoft Corporation for distribution.  
** Title to the Material remains with Intel Corporation or its suppliers and licensors. 
** Use of the Materials is subject to the terms of the Microsoft license agreement which accompanied the Materials.  
** No other 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 
** Some portion of the Materials may be copyrighted by Microsoft Corporation.

Module Name:  

    pxa27x_camera.h

**************************************************************************/



#ifndef __PXA27X_CAMERA_H__
#define __PXA27X_CAMERA_H__

#include <xllp_dmac.h>
#include <xllp_camera.h>
#include <bulverde_camera.h>

// Statically allocated, the maximum number of descriptor chains that may be managed at one time
#define MAX_CAMERA_DMA_BUFFERS 32

// A single descriptor will DMA data the matches the PAGE SIZE of 4K
#define SINGLE_DESCRIPTOR_TRANSFER_MAX 4096

typedef struct
{
        // Descriptor chain layout.  
        // X1..Xn is the real descriptor chain.  
        // XP1..XPn is a phantom descriptor chain used for flow control.
        // [X1]->[X2]->..->[Xn]->[XP1]->[XP2]->..->[XPn]

        XLLP_VUINT32_T pPhysAddr_XP1_CH0;       // Physical address of the first phantom descriptor
        XLLP_VUINT32_T pPhysAddr_X1_CH0;        // Physical address of the first real descriptor
        XLLP_VUINT32_T pVirtAddr_XPn_CH0;       // Virtual address of the last phantom descriptor       
        XLLP_VUINT32_T pVirtAddr_Xn_CH0;        // Virtual address of the last real descriptor

        XLLP_VUINT32_T pPhysAddr_XP1_CH1;       // Physical address of the first phantom descriptor
        XLLP_VUINT32_T pPhysAddr_X1_CH1;        // Physical address of the first real descriptor
        XLLP_VUINT32_T pVirtAddr_XPn_CH1;       // Virtual address of the last phantom descriptor       
        XLLP_VUINT32_T pVirtAddr_Xn_CH1;        // Virtual address of the last real descriptor

        XLLP_VUINT32_T pPhysAddr_XP1_CH2;       // Physical address of the first phantom descriptor
        XLLP_VUINT32_T pPhysAddr_X1_CH2;        // Physical address of the first real descriptor
        XLLP_VUINT32_T pVirtAddr_XPn_CH2;       // Virtual address of the last phantom descriptor       
        XLLP_VUINT32_T pVirtAddr_Xn_CH2;        // Virtual address of the last real descriptor

        XLLP_VUINT32_T pPhysAddr_Phantom;       // Physical address of the phantom buffer

        DWORD FrameID;                          // A frame ID for the real descriptor chain
        DWORD dwPlanesNumber;                   // 1 for all formats instead of YUV planar (3)
        DWORD *pBufferPhyAddress;               // Pointer to an array of physical addresses that
                                                // correspond to each 4K page of buffer space
        DWORD *pBufferVirtAddress;              // Pointer to the virtual address of the start of the
                                                // buffer space (this is contiguous in virtual address space)
        DWORD *pDescriptorBufferPhyAddress;     // Pointer to an array of physical addresses that correspond
                                                // to each 16 byte descriptor
        DWORD *pDescriptorBufferVirtAddress;    // Pointer to the virtual address of the start of the
                                                // descriptor buffer space (contiguous in virtual address space)

} DESCRIPTOR_INFO_T, *P_DESCRIPTOR_INFO_T;

typedef struct 
{
    XLLP_VUINT32_T   DDADR;  // descriptor address reg
    XLLP_VUINT32_T   DSADR;  // source address register
    XLLP_VUINT32_T   DTADR;  // target address register
    XLLP_VUINT32_T   DCMD;   // command address register

} XLLP_DMA_DESCRIPTOR_T, *P_XLLP_DMA_DESCRIPTOR_T;


typedef struct _HwContext
{
    PVOID  hDriverIndex;
    HANDLE hDMAIsrHandler;
    DWORD  dwDmaIrq;                   // DMA IRQ number
    DWORD  dwSysIntrDMA;               // SysIntr for the shared DMA interrupt
    VOID*  hDmaIntrThread;             // Handle to DMA Interrupt Service Thread
    HANDLE hDmaIntrEvent;              // Event used to signal DMA IST
    HANDLE hDMAEvent[3];

    //
    // Structure containing camera data structures used throughout
    //
    XLLP_Camera_Context_T       XllpCAMERA;
    XLLP_Camera_Function_T      XllpSENSOR;
    XLLP_Camera_DMA_Context_T   XllpDMA;

} HW_CONTEXT_T, *P_HW_CONTEXT_T;

// The global camera hardware context
extern HW_CONTEXT_T g_HwContext;

// Camera driver internal functions
int GenerateDMAChain( DESCRIPTOR_INFO_T *pDescriptorInfo,
                      int fifo0_transfer_size,
                      int fifo1_transfer_size,
                      int fifo2_transfer_size );

BOOL getPhyAddress (DWORD * pdwVirtual, DWORD * pdwPhysical);

void CameraInterruptHandler(HW_CONTEXT_T *pHwContext);
void CameraInterfaceInterruptHandler(HW_CONTEXT_T *pHwContext);

#endif //__PXA27X_CAMERA_H__

⌨️ 快捷键说明

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