/** \file * pex_user.h * * Created on: 01.12.2009, Updated for mbspex 08.04.2014 * Added sg pipe mode 13.03.2015 * Added parallel token dma ioctl 10.09.2015 * Author: J. Adamczewski-Musch * * Contains all common definitions for kernel driver and user space library */ #ifndef PEX_USER_H_ #define PEX_USER_H_ #include #define PEXNAME "mbspex" #define PEXORNAMEFMT "pexor%d" #define PEXARIANAMEFMT "pexaria%d" #define KINPEXNAMEFMT "kinpex%d" #define PEX_TRIX_RES 0 /**< Command for ioctl set trixor to reset trigger - clear dt flag */ #define PEX_TRIX_GO 1 /**< Command for ioctl set trixor to start acquisition */ #define PEX_TRIX_HALT 2 /**< Command for ioctl set trixor to stop acquisition */ #define PEX_TRIX_TIMESET 3 /**< Command for ioctl set trixor to set trigger time windows*/ #define PEX_TRIGGER_FIRED 0/**< return value from wait trigger to inform that trigger ir was fired reached */ #define PEX_TRIGGER_TIMEOUT 1 /**< return value from wait trigger to inform that wait timeout was reached */ #define PEX_SFP_NUMBER 4 /**< number of used sfp connections*/ #define PEX_MAXCONFIG_VALS 60 /**< number of configuration commands treated by driver in a single operation*/ struct pex_reg_io { unsigned int address; /**< address of a board register, relative to the specified BAR*/ unsigned int value; /**< value for read/write at register address*/ unsigned char bar; /**< the BAR where the register is mapped to PCI access. */ }; struct pex_pipebuf { unsigned long addr; /**< user space virtual address of mbs pipe*/ unsigned long size; /**< allocated size or used size*/ }; struct pex_dma_io { unsigned int source; /**< DMA source start address on the *pex* pciEx board*/ unsigned long target; /**< physical DMA target start address in host memory*/ unsigned long virtdest; /**< virtual target start address in readout process. only for pipe type 4 with sg mapping*/ unsigned int size; /**< size of bytes to transfer. returns real transfer size*/ unsigned int burst; /**< burst lenght in bytes*/ }; struct pex_bus_io { int sfp; /**< sfp link id 0..3 (-1 for broadcast to all configured sfps)*/ long slave; /**< slave device id at the sfp (-1 ato broadcast to all slaves)*/ unsigned long address; /**< address on the "field bus" connected to the optical links*/ unsigned long value; /**< value for read/write at bus address. Contains result status after write*/ }; struct pex_bus_config{ struct pex_bus_io param[PEX_MAXCONFIG_VALS]; /**< array of configuration parameters*/ unsigned int numpars; /**< number of used parameters*/ }; struct pex_sfp_links{ int numslaves[PEX_SFP_NUMBER]; /**< contains configured number of slaves at each sfp chain. */ }; struct pex_token_io { unsigned char sync; /**< 1:synchronous mode, 0: asynchronous mode*/ unsigned char directdma; /**< 1: direct DMA to host on token receive, 0 explicit DMA from pex ram required*/ unsigned long sfp; /**< sfp link id 0..3 */ unsigned long bufid; /**< switch double buffer id on slave (1 or 0)*/ unsigned long dmatarget; /**< target address (physical) for DMA transfer*/ unsigned long dmasize; /**< length of transferred data (bytes) after DMA*/ unsigned long dmaburst; /**< burst size (bytes) for DMA*/ unsigned long check_comm; /**< optional check returned command*/ unsigned long check_token; /**< optional check returned token status bits*/ unsigned long check_numslaves; /**< optional check returned number of slaves*/ }; struct pex_trixor_set { unsigned int command; /**< command id to be issued for trixor*/ unsigned int fct; /**< optional argument for trixor settings (fast clear time)*/ unsigned int cvt; /**< optional argument for trixor settings (conversion time)*/ }; ////////////// JAM 2024: new for changing link speeds /* this one is for user space ioctls: */ #define PEX_MAX_SPEEDSETUP 6 enum pex_linkspeed { PEX_SPEED_NONE, PEX_SPEED_2_GBS, PEX_SPEED_2_5_GBS, PEX_SPEED_3_125_GBS, PEX_SPEED_5_GBS, PEX_SPEED_6_250_GBS }; /** relate speed setup index to desired link speed */ static char gLinkspeed[PEX_MAX_SPEEDSETUP][64] = { "none", "2.0 Gb", "2.5 Gb", "3.125 Gb", "5.0 Gb", "6.250 Gb" }; struct pex_linkspeed_set { int sfp; /**< gtx link id 0..3 (-1 for all configured sfps) = sfp chain id*/ enum pex_linkspeed specs; /** specifications of speed id as from enumeration*/ }; /** the ioctl stuff here:*/ #define PEX_IOC_MAGIC 0xE0 #define PEX_IOC_RESET _IO( PEX_IOC_MAGIC, 0) /**