apps/fpcf/fpcf.c File Reference

#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/autoexp.h>
#include <asm/elphel/fpgaclocks.h>
#include <asm/elphel/fpgaconfa.h>

Include dependency graph for fpcf.c:

Go to the source code of this file.

Defines

#define SUPPORTED_IN_72   0
#define X313__RA__STATUS   0x10
#define X313_WA_DCM   8
#define X313_SR__DCM_OVFL   22
#define X313_SR__DCM_LOCKED   21
#define X313_SR__DCM_RDY   20
#define X313_SR__DCM_EARLY   19
#define X313_SR__DCM_LATE   18
#define IS_DCM_OVFL(x)   ( x & (1 << X313_SR__DCM_OVFL ))
#define IS_DCM_LOCK(x)   ( x & (1 << X313_SR__DCM_LOCKED ))
#define IS_DCM_RDY(x)   ( x & (1 << X313_SR__DCM_RDY ))
#define DCM_ERR(x)   (( x >> X313_SR__DCM_LATE ) & 3)
#define IS_DCM_GOOD(x)   (IS_DCM_LOCK(x) && IS_DCM_RDY(x) && !(IS_DCM_OVFL(x)))
#define CLOCK_LOW   20
#define CLOCK_HIGH   127
#define CY22393_SA   0xd2
#define LSEEK_FSDRAM_RESET   0x01
#define FPCF_SDBUFFER_SIZE   0x800
#define DCM_RETRY   100
#define phase_noise_margin   5

Functions

int readSDRAMdummy (void)
int resetSDRAM (void)
void usleepFPGA (int devfd, int dly)
int main (int argc, char *argv[])

Variables

static char * usage
static char * short_usage = "Use fpcf -help for options\n"


Define Documentation

#define CLOCK_HIGH   127

Definition at line 178 of file fpcf.c.

Referenced by main().

#define CLOCK_LOW   20

Definition at line 177 of file fpcf.c.

Referenced by main().

#define CY22393_SA   0xd2

Definition at line 179 of file fpcf.c.

Referenced by main().

#define DCM_ERR ( x   )     (( x >> X313_SR__DCM_LATE ) & 3)

Definition at line 157 of file fpcf.c.

Referenced by main().

#define DCM_RETRY   100

Referenced by main().

#define FPCF_SDBUFFER_SIZE   0x800

Definition at line 330 of file fpcf.c.

Referenced by main().

#define IS_DCM_GOOD ( x   )     (IS_DCM_LOCK(x) && IS_DCM_RDY(x) && !(IS_DCM_OVFL(x)))

Definition at line 158 of file fpcf.c.

Referenced by main().

#define IS_DCM_LOCK ( x   )     ( x & (1 << X313_SR__DCM_LOCKED ))

Definition at line 155 of file fpcf.c.

Referenced by main().

#define IS_DCM_OVFL ( x   )     ( x & (1 << X313_SR__DCM_OVFL ))

Definition at line 153 of file fpcf.c.

#define IS_DCM_RDY ( x   )     ( x & (1 << X313_SR__DCM_RDY ))

Definition at line 156 of file fpcf.c.

#define LSEEK_FSDRAM_RESET   0x01

Definition at line 306 of file fpcf.c.

Referenced by fsdram_lseek(), and resetSDRAM().

#define phase_noise_margin   5

#define SUPPORTED_IN_72   0

*************************************************************************** ! FILE NAME : fpcf.c ! DESCRIPTION: A big set of different FPGA-related commands ! Copyright (C) 2002-2007 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
fpcf.c,v
! Revision 1.1.1.1 2008/11/27 20:04:01 elphel ! ! ! Revision 1.5 2008/09/22 22:55:47 elphel ! snapshot ! ! Revision 1.4 2008/09/16 00:49:30 elphel ! snapshot ! ! Revision 1.3 2008/09/13 22:28:16 elphel ! removed commands not supported in 7.2 ! ! Revision 1.2 2008/09/05 23:20:25 elphel ! just a snapshot ! ! Revision 1.6 2008/04/29 06:24:06 elphel ! used strtoll() instead of strtol to handle unsigned long >=0x7fffffff ! ! Revision 1.5 2008/04/09 19:46:59 elphel ! added fflush ! ! Revision 1.4 2008/04/09 19:35:08 elphel ! removed "test error" ! ! Revision 1.3 2008/04/09 19:33:07 elphel ! added system memory test, more wait state registers ! ! Revision 1.2 2008/01/25 07:13:01 elphel ! typo ! ! Revision 1.1.1.1 2007/09/30 03:20:25 elphel ! This is a fresh tree based on elphel353-2.10 ! ! Revision 1.5 2007/09/30 03:20:25 elphel ! fixed comment typo ! ! Revision 1.4 2007/09/16 06:15:42 elphel ! Just debug info (disabled by # define) to troubleshoot sctl.cgi ! ! Revision 1.3 2007/08/17 12:12:22 spectr_rain ! switch to GPL3 license ! ! Revision 1.2 2007/07/10 08:25:44 spectr_rain ! *** empty log message *** ! ! Revision 1.3 2007/04/17 21:37:16 elphel ! added short output for "fpcf -c <bit_number>" ! ! Revision 1.2 2007/04/04 03:58:57 elphel ! support for new i2c features (hello.c - control i2c timing, fpcf - character device access to i2c) ! ! Revision 1.1.1.1 2007/02/23 10:11:49 elphel ! initial import into CVS ! ! Revision 1.12 2006/04/06 07:46:33 elphel ! control for canon lenses ! ! Revision 1.11 2006/02/18 18:55:28 elphel ! addet FPGA 6 i/o pins capture mode ! ! Revision 1.10 2006/01/11 17:10:05 elphel ! *** empty log message *** ! ! Revision 1.9 2006/01/05 05:07:46 spectr_rain ! load precalculated gamma table ! ! Revision 1.8 2005/11/23 05:07:42 spectr_rain ! up limit for sensor clock ! ! Revision 1.7 2005/08/28 15:46:55 elphel ! bug fix in "fpcf -?" ! ! Revision 1.6 2005/08/27 00:46:08 elphel ! continue on histograms ! ! Revision 1.5 2005/08/26 02:59:06 elphel ! working on histogram ! ! Revision 1.4 2005/07/11 01:33:05 elphel ! improved DDR SDRAM phase adjustment ! ! Revision 1.3 2005/05/15 17:39:07 elphel ! made DDR SDRAM clock phase adjustment - same as in Theora for model 333 branch ! ! Revision 1.2 2005/05/10 21:08:46 elphel ! *** empty log message *** ! ! Revision 1.2 2004/06/18 21:34:13 elphel ! added "JPEG_CMD_JUST_STOP" command to stop continuous acquisition mode (actually just a line in help) !

Definition at line 138 of file fpcf.c.

#define X313__RA__STATUS   0x10

Definition at line 142 of file fpcf.c.

Referenced by main().

#define X313_SR__DCM_EARLY   19

Definition at line 149 of file fpcf.c.

#define X313_SR__DCM_LATE   18

Definition at line 150 of file fpcf.c.

#define X313_SR__DCM_LOCKED   21

Definition at line 147 of file fpcf.c.

#define X313_SR__DCM_OVFL   22

Definition at line 146 of file fpcf.c.

#define X313_SR__DCM_RDY   20

Definition at line 148 of file fpcf.c.

#define X313_WA_DCM   8

Definition at line 143 of file fpcf.c.

Referenced by main().


Function Documentation

int main ( int  argc,
char *  argv[] 
)

*************************************************************************** ! FILE NAME : autoexposure.c ! DESCRIPTION: Daemon to adjust camera exposure and white balance ! Copyright (C) 2008 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
autoexposure.c,v
! Revision 1.1.1.1 2008/11/27 20:04:01 elphel ! ! ! Revision 1.16 2008/11/18 19:30:16 elphel ! Added initialization of the "next" frame - otherwise it wait _very_ long if the camera frame number is reset ! ! Revision 1.15 2008/11/15 23:08:24 elphel ! 8.0.alpha17 - split autoexposure source file ! ! Revision 1.14 2008/11/15 07:05:38 elphel ! implemented analog gain control (in addition to gammas) while while balancing ! ! Revision 1.13 2008/11/15 03:10:13 elphel ! Some parameters renamed, reassigned. ! ! Revision 1.12 2008/11/14 07:13:32 elphel ! Added gammaReverse() and gammaDirect() functions, TODO lists, bug fixes ! ! Revision 1.11 2008/11/14 01:01:59 elphel ! cleared debug output ! ! Revision 1.10 2008/11/13 05:40:45 elphel ! 8.0.alpha16 - modified histogram storage, profiling ! ! Revision 1.9 2008/11/08 05:52:21 elphel ! debug feature ! ! Revision 1.8 2008/11/04 17:40:34 elphel ! comment typos ! ! Revision 1.7 2008/11/02 00:32:35 elphel ! added TODO ! ! Revision 1.6 2008/10/31 18:26:32 elphel ! Adding support for constants like SENSOR_REGS32 (defined constant plus 32 to simplify referencing sensor registers from PHP ! ! Revision 1.5 2008/10/29 04:18:28 elphel ! v.8.0.alpha10 made a separate structure for global parameters (not related to particular frames in a frame queue) ! ! Revision 1.4 2008/10/28 07:05:12 elphel ! implemented white balance, HDR mode (1/1 and 2/2) ! ! Revision 1.3 2008/10/26 05:55:38 elphel ! snapshot ! ! Revision 1.2 2008/10/25 19:49:15 elphel ! 8.0.alpha8 - added autoexposure to the installation ! ! Revision 1.1 2008/10/24 00:34:12 elphel ! initial release !

define X313_CHN_DISALL_D 0xaa0 // disable all channels, do not modify refresh or memory as a whole define X313_SDRAM_OFF_D 0xaaa // disable all chennels, refresh and memory itself define X313_SDRAM_ON_D 0xaaf // will disable all channels but refresh

test system memory - now - just for intereference, not a real memory test

allocate memory

deallocate memory

Definition at line 331 of file fpcf.c.

References _CCCMD, a, AUTOEXP_DEV_NAME, CCAM_WPARS, CLOCK_HIGH, CLOCK_LOW, CMOSCAM_IOCTYPE, CY22393_SA, d, DCM_ERR, DCM_RETRY, f, FPCF_SDBUFFER_SIZE, FPGA_CLOCK_I2C_READREG, FPGA_CLOCK_I2C_WRITEREG, FPGA_CLOCK_IOCTYPE, FPGA_CLOCK_IOCTYPE_RD, FPGA_JTAG, FPGA_JTAG_ARG, FPGA_PA_RD, FPGA_PA_WR, FPGA_PGM, FPGA_STAT, FPGACONF_CANON_IOBYTE, FPGACONF_CONTROL_REG, FPGACONF_CR_MODIFY, FPGACONF_CR_SHADOW, FPGACONF_CR_SHADOW1, FPGACONF_GETSTATE, FPGACONF_IOCTYPE, 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, free(), I2C_READARG, I2C_WRITEARG, IO_CCAM_DMA, IO_CCAM_JPEG, IO_CCAM_JPEG_CTRL, IO_CCAM_JPEG_GET_L, IO_CCAM_JPEG_GET_N, IOC_AUTOEXP_GAMMA_TABLE, IS_DCM_GOOD, IS_DCM_LOCK, malloc(), n, P_CLK_FPGA, P_CLK_SENSOR, read, readSDRAMdummy(), resetSDRAM(), sa, short_usage, state, usage, write, X313__RA__STATUS, X313_WA_DCM, and xa0.

int readSDRAMdummy ( void   ) 

Definition at line 284 of file fpcf.c.

References read.

Referenced by main().

int resetSDRAM ( void   ) 

Definition at line 295 of file fpcf.c.

References LSEEK_FSDRAM_RESET, and SEEK_END.

Referenced by main().

void usleepFPGA ( int  devfd,
int  dly 
)

Definition at line 310 of file fpcf.c.

References FPGACONF_READREG, FPGACONF_WRITEREG, and t.


Variable Documentation

char* short_usage = "Use fpcf -help for options\n" [static]

Definition at line 269 of file fpcf.c.

Referenced by main().

char* usage [static]

Definition at line 184 of file fpcf.c.


Generated on Fri Nov 28 00:07:03 2008 for elphel by  doxygen 1.5.1