os/linux-2.6-tag--devboard-R2_10-4/include/asm-cris/elphel/fpgaconfa.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 
00038 
00039 /* MINORS */
00040 
00041 #define FPGACONF_MINOR_JTAG      1
00042 #define FPGACONF_MINOR_I2C       2
00043 #define FPGACONF_MINOR_IORW      3   /* direct R/W FPGA registers */
00044 // 4 and 5 should block each other?
00045 #define FPGACONF_MINOR_SDRAM     4   /* read/write SDRAM through PIO */
00046 
00047 
00048 /* supported ioctl _IOC_NR's */
00049 #ifndef I2C_WRITEARG
00050  #define I2C_WRITEARG(bus, slave, reg, value) (((bus) << 24) | ((slave) << 16) | ((reg) << 8) | (value))
00051  #define I2C_READARG(bus, slave, reg) (((bus) << 24) | ((slave) << 16) | ((reg) << 8))
00052 
00053  #define I2C_ARGBUS(arg) (((arg) >> 24)  & 0x1)
00054  #define I2C_ARGSLAVE(arg) (((arg) >> 16)  & 0xff)
00055  #define I2C_ARGREG(arg) (((arg) >> 8) & 0xff)
00056  #define I2C_ARGVALUE(arg) ((arg) & 0xff)
00057 
00058  #define I2C_WRITEREG 0x1   /* write to an i2c register */
00059  #define I2C_READREG  0x2   /* read from an i2c register */
00060 #endif
00061 
00062 
00063 
00064 
00065 
00066 
00067 #define FPGA_PGM     0x3   /* set FPGA pgm pin */
00068 #define FPGA_STAT    0x4   /* read FPGA pins status (bit 0 - INIT, bit 1 - DOME) */
00069 #define FPGA_JTAG    0x5   /* shift byte to FPGA JTAG */
00070 #define FPGA_PA_RD   0x6   /* write data to port A and shadow */
00071 #define FPGA_PA_WR   0x7   /* write data to port A and shadow */
00072 #ifndef PGA_JTAG_ARG
00073   #define FPGA_JTAG_ARG(tms, len, d) (((tms) << 11) | ((len) << 8) | ((d) & 0xff))
00074   #define FPGA_JTAG_TMS(arg) ((arg >> 11) &    1)
00075   #define FPGA_JTAG_LEN(arg) ((arg >> 8)  &    7)
00076   #define FPGA_JTAG_DW(arg)  ( arg        & 0xff)
00077 #endif
00078 
00079 #define _FCCMD(x,y)  (_IO(FPGACONF_IOCTYPE, (x << 6) | (y & 0x3f)))
00080 
00081 
00082 /* i2c errors */
00083 #ifndef ERR_I2C_SCL_ST0
00084  #define        ERR_I2C_SCL_ST0          1
00085  #define        ERR_I2C_SDA_ST0          2
00086  #define        ERR_I2C_SCL_ST1          4
00087  #define        ERR_I2C_SDA_ST1          8
00088  #define        ERR_I2C_SCL_NOPULLUP 16
00089  #define        ERR_I2C_SDA_NOPULLUP 32
00090 /* i2c_diagnose called by i2c_start (?) could not find any problems. Try again start */
00091  #define ERR_I2C_NOTDETECTED  64
00092  #define        ERR_I2C_SHORT            128
00093  #define        ERR_I2C_BSY              256
00094  #define        ERR_I2C_NACK             512
00095 #endif
00096 
00097 /* direct register r/w*/
00098 #define IO_CSP0R0    0x10  /* read and return CSP0+0  port data */
00099 #define IO_CSP0W0    0x20  /* write data to port CSP0+0  */
00100 
00101 #define IO_CSP0R(a) (IO_CSP0R0 + a)
00102 #define IO_CSP0W(a) (IO_CSP0W0 + a)
00103 
00104 #define IO_CSP0_R 1
00105 #define IO_CSP0_W 2
00106 
00107 #endif
00108 

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