os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/fpga_io.c File Reference

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/autoconf.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/elphel/fpgactrl.h>
#include <asm/arch/hwregs/reg_map.h>
#include <asm/arch/hwregs/bif_core_defs.h>
#include "x3x3.h"
#include "fpgactrl.h"
#include "fpga_io.h"

Include dependency graph for fpga_io.c:

Go to the source code of this file.

Defines

#define D(x)
#define CAPTURE_SIZE   8192

Functions

int fpga_io_open (void)
int fpga_io_close (void)
int canon_lens_io (int d)
int capture_pins (int n, int m)
int capture_read (void)
int fpga_io_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
loff_t fpga_io_lseek (struct file *file, loff_t offset, int orig)
ssize_t fpga_io_read (struct file *file, char *buf, size_t count, loff_t *off)
 Maybe make an "atomic" read/write FPGA sequence that is executed with IRQ down? How?
ssize_t fpga_io_write (struct file *file, const char *buf, size_t count, loff_t *off)
void fpga_table_write (unsigned long fpga_addr, unsigned long *data, int length)

Variables

volatile unsigned long ccam_cr_shadow
static char capture_buf [CAPTURE_SIZE]
static int capture_length
static int capture_pointer


Define Documentation

#define CAPTURE_SIZE   8192

Definition at line 95 of file fpga_io.c.

Referenced by capture_pins().

#define D ( x   ) 

*************************************************************************** ! FILE NAME : fpga_io.c ! DESCRIPTION: TBD ! Copyright (C) 2002-2006 Elphel, 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 3 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, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** !

Log
fpga_io.c,v
! Revision 1.6 2008/04/29 05:49:27 elphel ! typo ! ! Revision 1.5 2008/04/14 17:15:52 spectr_rain ! 200 gamma tables, correct 257 values tables ! ! Revision 1.4 2008/04/11 23:16:51 elphel ! removed unneeded local_irq_disable() after local_irq_save_flags() ! ! Revision 1.3 2008/04/09 21:01:25 elphel ! added access to individual wait state registers ! ! Revision 1.2 2007/10/23 16:58:51 elphel ! Improved r/w access to FPGA registers (available from PHP) ! ! Revision 1.1.1.1 2007/08/17 10:23:18 elphel ! This is a fresh tree based on elphel353-2.10 ! ! Revision 1.7 2007/08/17 10:23:18 spectr_rain ! switch to GPL3 license ! ! Revision 1.6 2007/07/20 10:17:46 spectr_rain ! *** empty log message *** ! ! Revision 1.2 2007/05/21 17:45:10 elphel ! boundary scan support, added 359/347 detection ! ! Revision 1.1.1.1 2007/02/23 10:11:48 elphel ! initial import into CVS ! ! Revision 1.3 2006/04/06 07:46:33 elphel ! control for canon lenses !

Definition at line 86 of file fpga_io.c.


Function Documentation

int canon_lens_io ( int  d  ) 

Definition at line 107 of file fpga_io.c.

References local_irq_restore, local_irq_save, port_csp0_addr, and udelay.

Referenced by fpga_io_ioctl().

int capture_pins ( int  n,
int  m 
)

Definition at line 148 of file fpga_io.c.

References capture_buf, capture_length, capture_pointer, CAPTURE_SIZE, local_irq_restore, local_irq_save, port_csp0_addr, and udelay.

Referenced by fpga_io_ioctl().

int capture_read ( void   ) 

Definition at line 174 of file fpga_io.c.

References capture_buf, capture_length, and capture_pointer.

Referenced by fpga_io_ioctl().

int fpga_io_close ( void   ) 

Definition at line 102 of file fpga_io.c.

int fpga_io_ioctl ( struct inode *  inode,
struct file *  file,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 206 of file fpga_io.c.

References canon_lens_io(), capture_pins(), capture_read(), ccam_cr_shadow, D, FPGACONF_CANON_IOBYTE, FPGACONF_CONTROL_REG, FPGACONF_CR_MODIFY, FPGACONF_CR_SHADOW, FPGACONF_CR_SHADOW1, FPGACONF_RD_WAITSTATES, FPGACONF_READ_CAPTURE, FPGACONF_READREG, FPGACONF_READREG4, FPGACONF_READREG_H, FPGACONF_READREG_H4, FPGACONF_READREG_L, FPGACONF_READREG_L4, FPGACONF_START_CAPTURE, FPGACONF_WR_WAITSTATES, FPGACONF_WRITEREG, FPGACONF_WRITEREG4, int, local_irq_restore, local_irq_save, port_csp0_addr, port_csp4_addr, printk, and X313_WA_WCTL.

Referenced by fpga_ioctl().

loff_t fpga_io_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

Definition at line 326 of file fpga_io.c.

References D, and printk.

Referenced by fpga_lseek().

int fpga_io_open ( void   ) 

Definition at line 99 of file fpga_io.c.

ssize_t fpga_io_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Maybe make an "atomic" read/write FPGA sequence that is executed with IRQ down? How?

it is not safe to read data table if interrupts are - autoexposure may try to read FPGA tables and that will change the pointers. So these functions are provided for testing only, there will be special functions for reading/writing FPGA tables TODO: Make sure that these FPGA accesses do not disturb autoexposure (it should read histogram only while IRQ is off)

off is considered to be a register address, not a byte pointer

now read to the buffer

copy data to user space

dont modify *off, return number of bytes read

Definition at line 363 of file fpga_io.c.

References D, port_csp0_addr, port_csp4_addr, and printk.

Referenced by fpga_read().

ssize_t fpga_io_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
)

Changing again: 1. Lseek selects a 32-bit register, Bit 13 selects between CSP0 and CSP4 (needed for buffer reads that increment buffer address - i.e. histogram) 2. Writes and Reads always start from register LSB (i.e. multiple one byte reads will each return LSB of the same register), addresses are not autoincremented 3. Writes with less than muptiple of 4 bytes will fill higher bytes with zeros, register addresses are not auto incremented

off is considered to be a register address, not a byte pointer

get data from user space

zero unused bytes in last partial word

now write to FPGA

dont modify *off, return number of bytes written

Definition at line 381 of file fpga_io.c.

References D, port_csp0_addr, port_csp4_addr, printk, and wbuf.

Referenced by fpga_write().

void fpga_table_write ( unsigned long  fpga_addr,
unsigned long *  data,
int  length 
)

Definition at line 402 of file fpga_io.c.

References local_irq_restore, local_irq_save, and port_csp0_addr.

Referenced by set_gamma().


Variable Documentation

char capture_buf[CAPTURE_SIZE] [static]

Definition at line 96 of file fpga_io.c.

Referenced by capture_pins(), and capture_read().

int capture_length [static]

Definition at line 97 of file fpga_io.c.

Referenced by capture_pins(), and capture_read().

int capture_pointer [static]

Definition at line 98 of file fpga_io.c.

Referenced by capture_pins(), and capture_read().

volatile unsigned long ccam_cr_shadow

Definition at line 802 of file cc353.c.


Generated on Thu Aug 7 16:20:20 2008 for elphel by  doxygen 1.5.1