os/linux-2.6-tag--devboard-R2_10-4/include/asm-cris/elphel/fpgactrl.h

Go to the documentation of this file.
00001 /*
00002 fpgaconfa.h
00003  */
00004 
00005 #ifndef _ASM_FPGACONF_H
00006 #define _ASM_FPGACONF_H
00007 // most defines are from cmoscama.h ...
00008 /* _IOC_TYPE, bits 8 to 15 in ioctl cmd */
00009 
00010 #define FPGACONF_IOCTYPE     129
00011 
00012 #define FPGACONF_READREG      140    // read 32-bit register  (through CSP0)
00013 #define FPGACONF_WRITEREG     141    // write 32-bit register (through CSP0)
00014 #define FPGACONF_READREG_L    142    // read lower 16 bits    (through CSP0)
00015 #define FPGACONF_READREG_H    143    // read upper 16 bits    (through CSP0)
00016 #define FPGACONF_READREG4     144    // read 32-bit register  (through CSP4)
00017 #define FPGACONF_WRITEREG4    145    // write 32-bit register (through CSP4)
00018 #define FPGACONF_READREG_L4   146    // read lower 16 bits    (through CSP4)
00019 #define FPGACONF_READREG_H4   147    // read upper 16 bits    (through CSP4)
00020 
00021 #define FPGACONF_GETSTATE     148    // read FPGA/clock state  (minor FPGACONF_MINOR_IORW)
00022 
00023 #define FPGACONF_RD_WAITSTATES     150    // read R_WAITSTATES
00024 #define FPGACONF_WR_WAITSTATES     151    // write R_WAITSTATES
00025 
00026 #define FPGACONF_START_CAPTURE     152    // start capturing I/O pins to memory (IRQ off!). argument time 1=1ms (actually - longer)
00027 #define FPGACONF_READ_CAPTURE      153    // read captured I/O pins. 1-st time (after FPGACONF_START_CAPTURE) - length, after that - data 
00028 
00029 #define FPGACONF_CANON_IOBYTE      154    // write/read byte to CANON lens interface
00030 
00031 
00032 #define FPGA_STATE_LOADED       0x0000FFFF //
00033 #define FPGA_STATE_CLOCKS       0x000F0000 // 
00034 #define FPGA_STATE_INITIALIZED  0x00F00000 // 
00035 #define FPGA_STATE_SDRAM_INIT   0x00100000 // 
00036 
00037 #define FPGACONF_CONTROL_REG      155    // modify FPGA control register (0x10)
00038 
00039 #define FPGACONF_CR_MODIFY  0x0e        //(bit number)<<2 | op; op= 0 - nop, 1 - set, 2 - reset, 3 - toggle)
00040 #define FPGACONF_CR_SHADOW  0x0f
00041 #define FPGACONF_CR_SHADOW1 0x10
00042 
00043 
00044 /* MINORS */
00045 
00046 #define FPGACONF_MINOR_JTAG      1
00047 #define FPGACONF_MINOR_SJTAG     2
00048 
00049 #define FPGACONF_MINOR_I2C       2
00050 #define FPGACONF_MINOR_IORW      3   /* direct R/W FPGA registers */
00051 // 4 and 5 should block each other?
00052 #define FPGACONF_MINOR_SDRAM     4   /* read/write SDRAM through PIO */
00053 
00054 
00055 /* supported ioctl _IOC_NR's */
00056 #ifndef I2C_WRITEARG
00057  #define I2C_WRITEARG(bus, slave, reg, value) (((bus) << 24) | ((slave) << 16) | ((reg) << 8) | (value))
00058  #define I2C_READARG(bus, slave, reg) (((bus) << 24) | ((slave) << 16) | ((reg) << 8))
00059 
00060  #define I2C_ARGBUS(arg) (((arg) >> 24)  & 0x1)
00061  #define I2C_ARGSLAVE(arg) (((arg) >> 16)  & 0xff)
00062  #define I2C_ARGREG(arg) (((arg) >> 8) & 0xff)
00063  #define I2C_ARGVALUE(arg) ((arg) & 0xff)
00064 
00065  #define I2C_WRITEREG 0x1   /* write to an i2c register */
00066  #define I2C_READREG  0x2   /* read from an i2c register */
00067 #endif
00068 
00069 
00070 
00071 
00072 
00073 
00074 #define FPGA_PGM     0x3   /* set FPGA pgm pin */
00075 #define FPGA_STAT    0x4   /* read FPGA pins status (bit 0 - INIT, bit 1 - DOME) */
00076 #define FPGA_JTAG    0x5   /* shift byte to FPGA JTAG */
00077 #define FPGA_PA_RD   0x6   /* write data to port A and shadow */
00078 #define FPGA_PA_WR   0x7   /* write data to port A and shadow */
00079 #ifndef PGA_JTAG_ARG
00080   #define FPGA_JTAG_ARG(tms, len, d) (((tms) << 11) | ((len) << 8) | ((d) & 0xff))
00081   #define FPGA_JTAG_TMS(arg) ((arg >> 11) &    1)
00082   #define FPGA_JTAG_LEN(arg) ((arg >> 8)  &    7)
00083   #define FPGA_JTAG_DW(arg)  ( arg        & 0xff)
00084 #endif
00085 
00086 #define _FCCMD(x,y)  (_IO(FPGACONF_IOCTYPE, (x << 6) | (y & 0x3f)))
00087 
00088 
00089 /* i2c errors */
00090 #ifndef ERR_I2C_SCL_ST0
00091  #define        ERR_I2C_SCL_ST0          1
00092  #define        ERR_I2C_SDA_ST0          2
00093  #define        ERR_I2C_SCL_ST1          4
00094  #define        ERR_I2C_SDA_ST1          8
00095  #define        ERR_I2C_SCL_NOPULLUP 16
00096  #define        ERR_I2C_SDA_NOPULLUP 32
00097 /* i2c_diagnose called by i2c_start (?) could not find any problems. Try again start */
00098  #define ERR_I2C_NOTDETECTED  64
00099  #define        ERR_I2C_SHORT            128
00100  #define        ERR_I2C_BSY              256
00101  #define        ERR_I2C_NACK             512
00102 #endif
00103 
00104 /* direct register r/w*/
00105 #define IO_CSP0R0    0x10  /* read and return CSP0+0  port data */
00106 #define IO_CSP0W0    0x20  /* write data to port CSP0+0  */
00107 
00108 #define IO_CSP0R(a) (IO_CSP0R0 + a)
00109 #define IO_CSP0W(a) (IO_CSP0W0 + a)
00110 
00111 #define IO_CSP0_R 1
00112 #define IO_CSP0_W 2
00113 
00114 #endif
00115 

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