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

📄 omap_camera_if.c

📁 Linux Kernel 2.6.9 for OMAP1710
💻 C
字号:
/*
 *  linux/drivers/media/video/omap/omap_camera_if.c
 *
 * Copyright (C) 2004 Texas Instruments Inc
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include <linux/config.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>

#include <asm/arch/irqs.h>
#include <asm/arch/dma.h>
#include <asm/arch/hardware.h>
#include <asm/io.h>
#include <asm/scatterlist.h>

#include "camera_core.h"
#include "omap_camera_if.h"
#include "omap1610_camera_hw.h"

#include "common.h"
#include "camif.h"

/* 
 * Pointer to the camera core callback function.
 * Called when a frame is captured by this module.
 */


/* function prototypes */
extern void omap1610_camera_clk_set (unsigned int);
extern void omap_interrupt_enable_dma (int);
extern int omap1610_set_xclk (int, int);
extern void omap1610_camera_clk_clear (unsigned int);
irqreturn_t omap1610_isr(int, void *, struct pt_regs *);
extern int omap_camera_link_open(struct camera_device *);
extern int omap_camera_link_close(void);
extern void omap_dma_link_callback(int, unsigned short, void *);
extern void omap1610_waitfvsync(void);
extern void omap1610_close(void);
extern void omap1610_cleanup(unsigned long );


int omap_camera_open(struct camera_device *cam)
{
	int ret;
	if ((ret = request_irq(INT_CAMERA, omap1610_isr, SA_INTERRUPT, 
					"camera", NULL))) {
		printk(" FAILED to aquire irq\n");
	}
	omap_camera_link_open(cam);
	return 0;
}

int omap_camera_close(void)
{
	omap1610_close();
	omap_camera_link_close();
	free_irq(INT_CAMERA, NULL);
	return 0;
}


#if 0
static void
capture_abort(void)
{
	/*  Turn off the capture hardware  */
	omap1610_camera_clk_clear (LCLK_EN);
	/* clear all the bits in mode register */
	omap1610_camera_mode_clear (0xffffffff); 

	return;
}
#endif

/* Abort the data transfer */
static int omap_camera_abort (void)
{
	/* Disable the OMAP1610 camera clocks */
	omap1610_capture_abort ();
	    
	/* stop the DMA transfer */
	return 0;
}

/* Capture a single image and send */
int omap_camera_snapshot(u8* buf, int size)
{

	return 0;
}

int omap_set_xclk (int xclk, int mclk)
{
	return omap1610_set_xclk (xclk, mclk);
}

/* Initialise the OMAP camera interface */
int omap_camera_init( void (*callback)(void *), struct camera_device * cam)
{
	int err = 0;
    
	/* initialise the OMAP hardware specific Initialisation routine */
	err = omap1610_camera_init (&cam->iobase_phys); 
	if (err)
		return err;

	return 0;
}

void omap_camera_cleanup (struct camera_device *cam)
{
	omap1610_cleanup(cam->iobase_phys);
	return;
}

struct camera_interface omap_camera_if = {
    	version          : 0x01,  
        init             : omap_camera_init,
        cleanup          : omap_camera_cleanup,
        open             : omap_camera_open, 
        close            : omap_camera_close,
        snapshot         : omap_camera_snapshot,
        abort            : omap_camera_abort,
	set_xclk	 : omap_set_xclk,
};

⌨️ 快捷键说明

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