19 #define VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
42 #define uint16_t UINT16
45 #define uint32_t UINT32
48 #define uint64_t UINT64
56 #define MIN_DMA_SIZE (80)
57 #define MAX_MINOR (256)
62 #define A3818_MAX_PKT_SZ (0x20000)
64 #define A3818_RXFIFO_SZ (0x2000)
65 #define A3818_REGION_SIZE (0x100)
67 #define PCI_VENDOR_XILINX_ID (0x10ee) // XILINX
68 #define PCI_DEVICE_ID_VIRTEX (0x0007) // VIRTEX5
69 #define PCI_SUBSYSTEM_VENDOR_ID_XILINX (0x10ee)
70 #define PCI_SUBSYSTEM_ID_VIRTEX (0x0007)
72 #define A3818_MAGIC '8'
74 #define IOCTL_RESET _IO(A3818_MAGIC, 0)
75 #define IOCTL_COMM _IOWR(A3818_MAGIC, 1, a3818_comm_t)
76 #define IOCTL_REG_WR _IOW(A3818_MAGIC, 2, a3818_reg_t)
77 #define IOCTL_REG_RD _IOWR(A3818_MAGIC, 3, a3818_reg_t)
78 #define IOCTL_IRQ_WAIT _IOW(A3818_MAGIC, 4, a3818_intr_t)
79 #define IOCTL_SEND _IOWR(A3818_MAGIC, 5, a3818_comm_t)
80 #define IOCTL_RECV _IOWR(A3818_MAGIC, 6, int)
81 #define IOCTL_REV _IOWR(A3818_MAGIC, 7, a3818_rev_t)
82 #define IOCTL_COMM_REG_WR _IOW(A3818_MAGIC, 8, a3818_reg_t)
83 #define IOCTL_COMM_REG_RD _IOWR(A3818_MAGIC, 9, a3818_reg_t)
85 #define A3818_IOCTL_START_DMA_TO_PC _IOWR(A3818_MAGIC, 10, a3818_comm_t) // AM per debug su DMA dalla A3818 al PC
86 #define PCI_IOCTL_REG_RD _IOWR(A3818_MAGIC, 11, a3818_reg_t) // AM per conoscere i registro del PCI
87 #define A3818_IOCTL_PCIE_BRIDGE_RESET _IO(A3818_MAGIC, 12)
88 #define IOCTL_MATI _IO(A3818_MAGIC, 13)
90 #define START_WRITE_DMA (0x01) // AM Write to PC in DMA da togliere!!!
92 #define MAX_OPT_LINK (0x05)
93 #define A3818_COMMON_REG (0x05)
95 #define AT45DB321D_PAGE_SIZE 264 // AUG!
97 #define MAX_TLP32_DATA_PAYLOAD 32
102 #define A3818_ERR_NOT_READY 1
109 #define A3818_TXFIFO (0x00)
110 #define A3818_RXFIFO (0x04)
112 # define A3818_LNKRST (1) // Link Reset
113 # define A3818_RDYINTDIS (1 << 1)// Disable interrupt for data ready
114 # define A3818_SERVICE (1 << 2)// SERV mode del CONET
115 # define A3818_VINTDIS (1 << 3)// Disable interrupt from VME
116 # define A3818_RES_LOCINT (1 << 4)// Reset Local Interrupt
118 #define A3818_LINK_SR (0x0C) // link status register
119 # define A3818_RXFIFO_EMPTY (1)
120 # define A3818_RXFIFO_ALMFULL (1 << 1)
121 # define A3818_TXFIFO_FULL (1 << 2)
122 # define A3818_VMEINT (1 << 3)
124 # define A3818_LINKON (1 << 5)
125 # define A3818_LINKRST_STAT (1 << 6)
126 # define A3818_SERV (1 << 7)
127 # define A3818_LINK_FAIL (1 << 8)
128 # define A3818_LINT (1 << 9)
130 # define A3818_LINK_TX_RES (1 << 16)
131 # define A3818_LINK_RX_RES (1 << 17)
133 #define A3818_LINK_TRS (0x18) // link transfer status register
135 #define A3818_DEBUG (0x20)
137 #define A3818_IRQSTAT_0 (0x24) // IRQ Stat dagli slave 0 to 3
138 #define A3818_IRQSTAT_1 (0x28) // IRQ Stat dagli slave 4 to 7
139 #define A3818_IRQMASK_0_S (0x30) // IRQ Mask slave 0 to 3 - Set
140 #define A3818_IRQMASK_0_C (0x34) // IRQ Mask slave 0 to 3 - Clear
141 #define A3818_IRQMASK_1_S (0x38) // IRQ Mask slave 4 to 7 - Set
142 #define A3818_IRQMASK_1_C (0x3C) // IRQ Mask slave 4 to 7 - Clear
144 #define A3818_IOCTL_S (0xA0) // - IOCTL register set
145 #define A3818_IOCTL_C (0xA4) // - IOCTL register clear
148 #define A3818_DMACSR (0x100) // DMA Control Status Register
149 # define A3818_DMAREADSTART (1 << 0) // DMA Memory Read Start
150 # define A3818_DMAREADDONE (1 << 8) // DMA Memory Read Done
151 # define A3818_RES_DMAINT (1 << 31) // DMA Initiator Reset
153 #define A3818_RDMATLPA (0x104) // Read DMA Memory Address
154 #define A3818_RDMALADR (0x108) // Read DMA Local Address
155 #define A3818_RDMASIZE (0x10C) // Read DMA Size
157 #define A3818_RDMAMODE (0x110) // Read DMA Mode
158 # define A3818_DMAMODE_INTDIS (1 << 6) // Read Interrupt Disable
160 #define A3818_WDMAPERF (0x114) // DMA Performances Write to PC
162 #define A3818_DMACSR_S (0x118) // DMA Control Status Register - register set
166 #define A3818_DLWSTAT (0x00) // Device Link Width Status
167 #define A3818_DLTRSSTAT (0x04) // Device Link Transaction Size Status
168 #define A3818_DMISCCS (0x08) // Device Miscellaneous Control Status
170 # define A3818_DMISCCS_CPL_STREAM (1 << 0) // Completion Streaming Enable (default 1)
171 # define A3818_DMISCCS_RD_METERING (1 << 1) // Read Metering Enable (default 0)
172 # define A3818_DMISCCS_REC_NON_POSTED_OK (1 << 2) // Receive Non-Posted OK (default 0)
174 # define A3818_DMISCCS_SPI_BPI_FLASH_SEL (1 << 4) // BPI/SPI FLASH access select (default 0 = SPI FLASH)
175 # define A3818_DMISCCS_SPI_FLASH_RDY (1 << 5) // ATMEL SPI Flash Memory Ready (RO)
176 # define A3818_DMISCCS_ADC_CLK_SEL (1 << 6) // ADC CLK Select (default 1 = SI571 clock)
177 # define A3818_DMISCCS_V_PB_EN (1 << 7) // PB Power enable (default 1 = PB Power ON)
179 # define A3818_DMISCCS_RDDMA_DONE0 (1 << 16)// Link 0 DMA READ Done (RO)
180 # define A3818_DMISCCS_RDDMA_DONE1 (1 << 17)// Link 1 DMA READ Done (RO)
181 # define A3818_DMISCCS_RDDMA_DONE2 (1 << 18)// Link 2 DMA READ Done (RO)
182 # define A3818_DMISCCS_RDDMA_DONE3 (1 << 19)// Link 3 DMA READ Done (RO)
183 # define A3818_DMISCCS_RDDMA_DONE4 (1 << 20)// Link 4 Memory Write Done (RO)
185 # define A3818_DMISCCS_LOC_INT0 (1 << 24)// Link 0 Local Interrupt (RO)
186 # define A3818_DMISCCS_LOC_INT1 (1 << 25)// Link 1 Local Interrupt (RO)
187 # define A3818_DMISCCS_LOC_INT2 (1 << 26)// Link 2 Local Interrupt (RO)
188 # define A3818_DMISCCS_LOC_INT3 (1 << 27)// Link 3 Local Interrupt (RO)
189 # define A3818_DMISCCS_LOC_INT4 (1 << 28)// Link 4 Local Interrupt (RO)
191 #define A3818_GTPRES (0x0C) // W - GTP reset
193 #define A3818_SPI_FLASH (0x10) // R/W - ATMEL SPI Flash Memory access
194 #define A3818_SPI_FLEN (0x14) // R/W - ATMEL SPI Flash Memory enable
195 #define A3818_SPI_RELOAD (0x18) // W - Re-read the SPI flash content
197 #define A3818_BPI_FLASH_AD (0x20) // R/W - BPI_FLASH TEST
198 #define A3818_BPI_FLASH_DT (0x24) // R/W
199 #define A3818_BPI_FLASH_CMD (0x28) // R/W
201 #define A3818_PHY_I2C_COMM (0x30) // W
202 #define A3818_PHY_I2C_DAT (0x34) // R
204 #define A3818_ADC_I2C_COMM (0x38) // W
205 #define A3818_ADC_I2C_DAT (0x3C) // R
207 #define A3818_FWREV (0x40) // R - Firmware Revision
208 #define A3818_BOARD_ID (0x44) // R - Board ID
209 #define A3818_BOARD_VERS_ID (0x48) // R - Board Version ID
210 #define A3818_BOARD_SERNUM (0x4C) // R - Board Serial Number
211 #define A3818_TEMP (0x50) // R - rilettura del sensore di temp. TMP422
213 #define A3818_SSRAM_AD (0x60) // R/W - SSRAM TEST
214 #define A3818_SSRAM_DT_L (0x64) // R/W
215 #define A3818_SSRAM_DT_M (0x68) // R/W
216 #define A3818_SSRAM_DT_H (0x6C) // R/W
217 #define A3818_SSRAM_CMD (0x70) // R/W - SSRAM TEST
221 #define A3818BOARD (0x0eea)
222 # define ONE_LINK (0x0a)
223 # define TWO_LINK (0x0b)
224 # define FOUR_LINK (0x0c)
226 #define A3818DIGIT (0x0d)
227 #define A3818RAW (0xffffff)
230 #define PCIE_DMA_CONF_REG (0x68)
231 #define PCIE_MSI_CAPAB_REG (0x48)
255 struct pci_dev *pcidev;
277 struct mutex ioctl_lock;
298 struct a3818_state *next;
333 #define A3818_DRIVER_VERSION_LEN 20