Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 9 | f9daq | 1 | #ifndef __MAIN_H__ | 
        
| 2 | #define __MAIN_H__ | 
        ||
| 3 | |||
| 4 | //**************************************************************************** | 
        ||
| 5 | // Copyright (C) 2000-2004  ARW Elektronik Germany | 
        ||
| 6 | // | 
        ||
| 7 | // | 
        ||
| 8 | // This program is free software; you can redistribute it and/or modify | 
        ||
| 9 | // it under the terms of the GNU General Public License as published by | 
        ||
| 10 | // the Free Software Foundation; either version 2 of the License, or | 
        ||
| 11 | // (at your option) any later version. | 
        ||
| 12 | // | 
        ||
| 13 | // This program is distributed in the hope that it will be useful, | 
        ||
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
        ||
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
        ||
| 16 | // GNU General Public License for more details. | 
        ||
| 17 | // | 
        ||
| 18 | // You should have received a copy of the GNU General Public License | 
        ||
| 19 | // along with this program; if not, write to the Free Software | 
        ||
| 20 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
        ||
| 21 | // | 
        ||
| 22 | // This product is not authorized for use as critical component in  | 
        ||
| 23 | // life support systems without the express written approval of  | 
        ||
| 24 | // ARW Elektronik Germany. | 
        ||
| 25 | //   | 
        ||
| 26 | // Please announce changes and hints to ARW Elektronik | 
        ||
| 27 | // | 
        ||
| 28 | // Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de) | 
        ||
| 29 | // | 
        ||
| 30 | //**************************************************************************** | 
        ||
| 31 | |||
| 32 | //**************************************************************************** | 
        ||
| 33 | // | 
        ||
| 34 | // main.h -- export parts of main.c | 
        ||
| 35 | // | 
        ||
| 36 | // $Log: main.h,v $ | 
        ||
| 37 | // Revision 1.7  2004/08/13 19:23:26  klaus | 
        ||
| 38 | // conversion to kernel-version 2.6, released version 3.0 | 
        ||
| 39 | // | 
        ||
| 40 | // Revision 1.6  2003/06/27 17:25:52  klaus | 
        ||
| 41 | // incomplete try to get mmap() with nopage() running for automatic page switch | 
        ||
| 42 | // | 
        ||
| 43 | // Revision 1.5  2002/10/18 21:56:28  klaus | 
        ||
| 44 | // completed functional features, untested | 
        ||
| 45 | // | 
        ||
| 46 | // Revision 1.4  2002/10/18 21:56:28  klaus | 
        ||
| 47 | // completed functional features, untested | 
        ||
| 48 | // | 
        ||
| 49 | // Revision 1.3  2002/10/10 18:57:46  klaus | 
        ||
| 50 | // source beautyfied | 
        ||
| 51 | // | 
        ||
| 52 | //**************************************************************************** | 
        ||
| 53 | |||
| 54 | /*--- INCLUDES ----------------------------------------------------------------------------*/ | 
        ||
| 55 | #include <linux/wait.h> | 
        ||
| 56 | #include <linux/types.h> | 
        ||
| 57 | #include <linux/list.h> | 
        ||
| 58 | |||
| 59 | /*--- DEFINES -----------------------------------------------------------------------------*/ | 
        ||
| 60 | #define DEVICE_NAME "pcivme" | 
        ||
| 61 | |||
| 62 | #define LOW_MEMORY        0x1000000    // 1 Mbyte PC memory border | 
        ||
| 63 | |||
| 64 | #define LCR_SPACE         0x0080 // space in bytes of LCR | 
        ||
| 65 | #define IFR_SPACE         0x2000 // space in bytes of IFR | 
        ||
| 66 | #define CTL_SPACE         0x1000 // lower part of IFR_SPACE | 
        ||
| 67 | #define VME_SPACE         (IFR_SPACE - CTL_SPACE) // higher part of IFR_SPACE used for VME window | 
        ||
| 68 | |||
| 69 | #define RELEASE_VMEMM       (u16)0x4180 // write this to release access ..  | 
        ||
| 70 | #define INHIBIT_VMEMM       (u16)0x4080 // write this to inhibit access ..  | 
        ||
| 71 | #define ENABLE_PCIADA_IRQS  (u16)0x0049 // enable PCIADA IRQs              | 
        ||
| 72 | #define DISABLE_PCIADA_IRQS (u16)0x0009 // disable PCIADA IRQs             | 
        ||
| 73 | |||
| 74 | /*--- TYPEDEFS ----------------------------------------------------------------------------*/ | 
        ||
| 75 | typedef struct  | 
        ||
| 76 | { | 
        ||
| 77 | struct list_head devList; // link anchor for list of devices  | 
        ||
| 78 | struct list_head pciList; // link anchor of all unchecked PCIADAs found  | 
        ||
| 79 | u32 nMajor; // asigned major number  | 
        ||
| 80 | int count; // count of found devices  | 
        ||
| 81 | } DRIVER_OBJ;  | 
        ||
| 82 | |||
| 83 | typedef struct  | 
        ||
| 84 | { | 
        ||
| 85 | struct list_head list; // chained list of found and not checked devices  | 
        ||
| 86 | struct pci_dev *pciDev; // associated pci descriptors of the system  | 
        ||
| 87 |     u16              index; | 
        ||
| 88 | } PCIConfig;  | 
        ||
| 89 | |||
| 90 | typedef struct  | 
        ||
| 91 | { | 
        ||
| 92 | struct vm_area_struct *vma;  | 
        ||
| 93 | struct page *pageptr; // the current active pageptr  | 
        ||
| 94 | unsigned long addr; // related user address  | 
        ||
| 95 | } MMAP_INFO;  | 
        ||
| 96 | |||
| 97 | typedef struct  | 
        ||
| 98 | { | 
        ||
| 99 | struct list_head list; /* chain element of list */  | 
        ||
| 100 | u16 wIndex; /* running index of all PCIADAs */  | 
        ||
| 101 | PCIConfig *pPch; /* associated PCI configuration */  | 
        ||
| 102 | u32 pLCR; /* base of LCR */  | 
        ||
| 103 | u32 pCtl; /* base of control area */  | 
        ||
| 104 | u32 pVME; /* base of VME access area */  | 
        ||
| 105 | u32 pPhysVME; /* physical address of VME window */  | 
        ||
| 106 | u8 bConnected; /* is it connected ?? */  | 
        ||
| 107 | u16 wInitStep; /* trace of initialisation */  | 
        ||
| 108 | u16 wIrq; /* the assigned irq */  | 
        ||
| 109 | u32 dwInterruptCount; /* counts the VME and timeout interrupts */  | 
        ||
| 110 | u16 wIrqStatus; /* last cause / status of interrupts */  | 
        ||
| 111 | int nOpenCounter; /* counts the open path to this device */  | 
        ||
| 112 | wait_queue_head_t event_queue; /* handle interrupt events */  | 
        ||
| 113 | |||
| 114 | u32 pAdrMod; /* address of address modifier register in VIC */  | 
        ||
| 115 | u32 pAdrReg; /* address of VMEMM VME address register */  | 
        ||
| 116 | u32 pCSR; /* address of the VMEMM CSR register */  | 
        ||
| 117 | |||
| 118 | u32 pPCIADACntrl; /* address of the PCIADA control register */  | 
        ||
| 119 | u32 pPCIADAIntCSR; /* address of the PCIADA INTCSR register */  | 
        ||
| 120 | |||
| 121 | u8 cModuleNumber; /* module number */  | 
        ||
| 122 | u8 cFPGAVersion; /* FPGA Version number */  | 
        ||
| 123 | u8 cSystemController; /* set if VMEMM is system controller */  | 
        ||
| 124 | u8 cWordMode; /* set if VMEMM is jumpered to word mode */  | 
        ||
| 125 | |||
| 126 | u8 bCurrentModifier; /* the current set address modifier of this device */  | 
        ||
| 127 | u32 dwCurrentPageAddress; /* the current page address association */  | 
        ||
| 128 | |||
| 129 | MMAP_INFO currentMap; /* information about current mapped page */  | 
        ||
| 130 | } DEVICE_OBJ;  | 
        ||
| 131 | |||
| 132 | typedef struct  | 
        ||
| 133 | { | 
        ||
| 134 | DEVICE_OBJ *pDo; /* pointer to my PCIADA & connected VMEMM */  | 
        ||
| 135 | u8 bModifier; /* the associated address modifier of this device */  | 
        ||
| 136 | u8 bAccessType; /* the next access is byte, word, longword - not for memory mapped access */  | 
        ||
| 137 | u8 bIncrement; /* the next increment, normally like accesstype or 0*/  | 
        ||
| 138 | void (*read)(DEVICE_OBJ*, void**, u32); /* predifined read function */  | 
        ||
| 139 | void (*write)(DEVICE_OBJ*, u32, void**); /* same for write */  | 
        ||
| 140 | int (*AlignmentCheck)(loff_t offset); /* function to check access alignment */  | 
        ||
| 141 | } PATH_OBJ;  | 
        ||
| 142 | |||
| 143 | /*--- PROTOTYPES --------------------------------------------------------------------------*/ | 
        ||
| 144 | int get_module_info(DEVICE_OBJ *pd);  | 
        ||
| 145 | int test_connection(DEVICE_OBJ *pd);  | 
        ||
| 146 | |||
| 147 | /*--- PROTOTYPES --------------------------------------------------------------------------*/ | 
        ||
| 148 | extern DRIVER_OBJ drv; /* driver globals */  | 
        ||
| 149 | |||
| 150 | #endif // __MAIN_H__ | 
        ||
| 151 |