| 1 | // $Id: vme_rcc_lib.h,v 1.9 2007/11/08 07:56:44 joos Exp $
|
|---|
| 2 | /************************************************************************/
|
|---|
| 3 | /* */
|
|---|
| 4 | /* File: vme_rcc_lib.h */
|
|---|
| 5 | /* */
|
|---|
| 6 | /* This is the private header file for RCC VMEbus library */
|
|---|
| 7 | /* */
|
|---|
| 8 | /* 2. Nov. 01 MAJO created */
|
|---|
| 9 | /* 2. Nov. 01 JOP interrupts */
|
|---|
| 10 | /* */
|
|---|
| 11 | /************ C 2001 - The software with that certain something *********/
|
|---|
| 12 |
|
|---|
| 13 | #ifndef _VME_RCC_LIB_H
|
|---|
| 14 | #define _VME_RCC_LIB_H
|
|---|
| 15 |
|
|---|
| 16 | #include <linux/types.h>
|
|---|
| 17 | #include "vme_rcc_common.h"
|
|---|
| 18 |
|
|---|
| 19 | /***************/
|
|---|
| 20 | /*error strings*/
|
|---|
| 21 | /***************/
|
|---|
| 22 | #define VME_SUCCESS_STR "Function successfully executed"
|
|---|
| 23 | #define VME_NOTKNOWN_STR "Input parameter has illegal value"
|
|---|
| 24 | #define VME_UNKNOWN_STR "Unknown type of error"
|
|---|
| 25 | #define VME_NOTOPEN_STR "The library has not yet been opened"
|
|---|
| 26 | #define VME_RANGE_STR "Input parameter is out ofrange"
|
|---|
| 27 | #define VME_BUSERROR_STR "VMEbus bus error received"
|
|---|
| 28 | #define VME_ALIGN_STR "Misaligned address/size"
|
|---|
| 29 | #define VME_NOCHAINMEM_STR "Not enough memory available for DMA chain"
|
|---|
| 30 | #define VME_NOBUSERROR_STR "There was no bus error information"
|
|---|
| 31 | #define VME_TOOLONG_STR "Overflow of internal chain"
|
|---|
| 32 | #define VME_DMABUSY_STR "The DMA controller is busy"
|
|---|
| 33 | #define VME_TIMEOUT_STR "The time-out has expired"
|
|---|
| 34 | #define VME_FILE_STR "Error from file operation (open/close)"
|
|---|
| 35 | #define VME_NOMAP_STR "All master mappings are in use"
|
|---|
| 36 | #define VME_NOSTATMAP_STR "Static mapping does not fit parameters"
|
|---|
| 37 | #define VME_IRGBUSY_STR "The interrupg generator is busy"
|
|---|
| 38 | #define VME_EIO_STR "Unix: I/O error"
|
|---|
| 39 | #define VME_EFAULT_STR "Unix: Bad address"
|
|---|
| 40 | #define VME_VIRT_STR "Failed to get user virtual address"
|
|---|
| 41 | #define VME_REMAP_STR "Error from remap_page_range() kernel function"
|
|---|
| 42 | #define VME_ENOSYS_STR "Unix: Function not implemented"
|
|---|
| 43 | #define VME_NOSIZE_STR "A <size> parameter is zero"
|
|---|
| 44 | #define VME_CMEM_FAIL_STR "Error from CMEM_RCC library"
|
|---|
| 45 | #define VME_ERESTARTSYS_STR "Unix: driver got interrupted in down_interruptible"
|
|---|
| 46 | #define VME_DMAERR_STR "Error in DMA transfer, see status words in transfer list"
|
|---|
| 47 | #define VME_PCI_ERR_STR "Error on PCI"
|
|---|
| 48 | #define VME_VME_ERR_STR "VMEbus BERR"
|
|---|
| 49 | #define VME_PROTOCOL_ERR_STR "Protocol error"
|
|---|
| 50 | #define VME_NOT_EXECUTED_STR "This transfer has not been executed"
|
|---|
| 51 | #define VME_MUNMAP_STR "Error from call to munmap()"
|
|---|
| 52 | #define VME_ILLREV_STR "Universe has wrong revision (too old)"
|
|---|
| 53 | #define VME_IOREMAP_STR "Error from call to ioremap()"
|
|---|
| 54 | #define VME_REQIRQ_STR "Error from call to request_irq()"
|
|---|
| 55 | #define VME_TOOMANYINT_STR "Too many interrupt items"
|
|---|
| 56 | #define VME_TOOMANYHDL_STR "Too many Interrupt handles"
|
|---|
| 57 | #define VME_INTUSED_STR "Vector already in use"
|
|---|
| 58 | #define VME_ILLINTLEVEL_STR "Illegal Interrupt Level"
|
|---|
| 59 | #define VME_ILLINTTYPE_STR "Illegal Interrupt Type"
|
|---|
| 60 | #define VME_INTCONF_STR "Illegal level, type combination"
|
|---|
| 61 | #define VME_LVLDISABLED_STR "Level is disabled"
|
|---|
| 62 | #define VME_LVLISNOTRORA_STR "Level is not RORA"
|
|---|
| 63 | #define VME_ILLINTHANDLE_STR "Illegal interrupt handle"
|
|---|
| 64 | #define VME_INTBYSIGNAL_STR "Interrupted by signal"
|
|---|
| 65 | #define VME_NOINTERRUPT_STR "No pending interrupt found"
|
|---|
| 66 | #define VME_ENOMEM_STR "No memory"
|
|---|
| 67 | #define VME_KMALLOC_STR "Error in driver from call to kmalloc"
|
|---|
| 68 | #define VME_BERRTBLFULL_STR "BERR process table full"
|
|---|
| 69 | #define VME_BERRNOTFOUND_STR "Entry in BERR process table not found"
|
|---|
| 70 | #define VME_ILL_TO_STR "Value for time_out is out of range"
|
|---|
| 71 | #define VME_NODOMEMEM_STR "No morememory left in DMA done list"
|
|---|
| 72 | #define VME_NO_CODE_STR "No error code available"
|
|---|
| 73 | #define VME_UNKNOWN_BOARD_STR "Failed to determine board type"
|
|---|
| 74 | #define VME_IO_FAIL_STR "Error from IO_RCC library"
|
|---|
| 75 | #define VME_NOCRCSRMAP_STR "There is no mapping for CR/CSR space access"
|
|---|
| 76 | #define VME_SYSFAILTBLFULL_STR "An other process has already linked the SYSFAIL interrupt"
|
|---|
| 77 | #define VME_SYSFAILTBLNOTLINKED_STR "The SYSFAIL interrupt is not linked by your process"
|
|---|
| 78 | #define VME_SYSFAILNOTLINKED_STR "You have to link the SYSFAIL interrupt before you can register a signal"
|
|---|
| 79 | #define VME_NOSTATMAP2_STR "All master maps are in use"
|
|---|
| 80 | #define VME_IOUNMAP_STR "The kernel virtual address for the given master mapping could not be found"
|
|---|
| 81 | #define VME_INTDISABLED_STR "You are trying to link to a disabled interrupt level. Check the status with vmeconfig"
|
|---|
| 82 |
|
|---|
| 83 | /***************************************/
|
|---|
| 84 | /*Various upper limits for arrays, etc.*/
|
|---|
| 85 | /***************************************/
|
|---|
| 86 | #define VME_MAX_SLAVEMAP 4 //Max number of slave mappings
|
|---|
| 87 | #define VME_DMA_MAX_BLOCK_SIZE 0x800000 //Max size of single DMA
|
|---|
| 88 | #define VME_MAX_INTHANDLE 10 // Max # interrupt handles
|
|---|
| 89 |
|
|---|
| 90 | /***************************************/
|
|---|
| 91 | /*Definitions to be used in the library*/
|
|---|
| 92 | /*do not modify */
|
|---|
| 93 | /***************************************/
|
|---|
| 94 | #define DEVICE "/dev/vme_rcc"
|
|---|
| 95 | #define DMA_CHAIN_END 1
|
|---|
| 96 | #define CRCSR_BASE 0
|
|---|
| 97 | #define CRCSR_SIZE 0x01000000
|
|---|
| 98 | #define CRCSR_OPT 0
|
|---|
| 99 | #define CRCSR_OFF 0x80000
|
|---|
| 100 |
|
|---|
| 101 | /********/
|
|---|
| 102 | /*Macros*/
|
|---|
| 103 | /********/
|
|---|
| 104 | #define ISOPEN {if(!is_open) return(VME_NOTOPEN);}
|
|---|
| 105 | #define PE(x) {printf("Error from vme_rcc library: %s\n",x); break;}
|
|---|
| 106 |
|
|---|
| 107 | #ifdef __cplusplus
|
|---|
| 108 | extern "C" {
|
|---|
| 109 | #endif
|
|---|
| 110 | /******************************/
|
|---|
| 111 | /* Internal service functions */
|
|---|
| 112 | /******************************/
|
|---|
| 113 | #ifdef __cplusplus
|
|---|
| 114 | }
|
|---|
| 115 | #endif
|
|---|
| 116 |
|
|---|
| 117 | #endif
|
|---|