vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / include / config_data.h
blob5109abb1e53ae2011b7d50994b2af084522fac64
1 /**
2 * @file config_data.h
4 * @brief Common part of libinst used in kernel and user space
6 * @author Copyright (C) 2009 CERN CO/HT Julian Lewis
8 * @date Created on 02/02/2009
10 * @section license_sec License
11 * Released under the GPL
13 #ifndef _CONFIG_DATA_H_INCLUDE_
14 #define _CONFIG_DATA_H_INCLUDE_
16 #define InsLibMAX_MODULES 16
17 #define InsLibNAME_SIZE 32
18 #define InsLibCOMMENT_SIZE 128
20 /** @brief Different bus types supported by skeleton and other drivers */
21 typedef enum {
22 InsLibBusTypeNOT_SET,
23 InsLibBusTypeCARRIER,
24 InsLibBusTypeVME,
25 InsLibBusTypePMC,
26 InsLibBusTypePCI
27 } InsLibBusType;
29 /** @brief Endianity */
30 typedef enum {
31 InsLibEndianNOT_SET,
32 InsLibEndianBIG,
33 InsLibEndianLITTLE
34 } InsLibEndian;
37 /** @brief Descriptor for installing an ISR */
38 typedef struct {
39 unsigned int IsrFlag; /**< If 0 then no ISR is required */
40 unsigned int Vector;
41 unsigned int Level;
42 char Comment[InsLibCOMMENT_SIZE];
43 } InsLibIntrDesc;
46 /** @brief Start of a module description linked list
48 * @param BusType --
49 * @param ModuleNumber -- Logical Unit Number. aka [L U N]
50 * Must start at '1', zero is illegal.
51 * @param IgnoreErrors -- Tolerate install errors
52 * @param Isr --
53 * @param ModuleAddress -- Any module type [PCI/VME/CARR] hardware description.
54 * @param Extra -- user can use it to pass extra params
55 * @param Comment --
56 * @param Next -- next module description
57 * @param ModuleName -- DB module name
59 typedef struct {
60 InsLibBusType BusType;
61 unsigned int ModuleNumber;
62 unsigned int IgnoreErrors;
63 InsLibIntrDesc *Isr;
64 void *ModuleAddress;
65 char *Extra;
66 char Comment[InsLibCOMMENT_SIZE];
67 void *Next;
68 char ModuleName[InsLibNAME_SIZE];
69 } InsLibModlDesc;
71 /** @brief The bus types PCI/VME/CAR are dealtwith in the driver anonymously
73 * So with these structures a driver can work with any bus type.
75 typedef struct {
76 void *Mapped;
77 void *Next;
78 unsigned int SpaceNumber;
79 unsigned int WindowSize;
80 unsigned int DataWidth;
81 InsLibEndian Endian;
82 } InsLibAnyAddressSpace;
85 /** @brief */
86 typedef struct {
87 InsLibAnyAddressSpace *AnyAddressSpace;
88 } InsLibAnyModuleAddress;
91 /** @brief Each PCI address space is a BAR and is mapped to kernel memory
93 * @param Mapped -- Mapped kernel memory pointer or NULL
94 * @param Next -- Next BAR (if any)
95 * @param BaseAddressRegister -- which BAR [0 - 5]
96 * @param WindowSize --
97 * @param DataWidth --
98 * @param Endian --
99 * @param Comment --
101 typedef struct {
102 void *Mapped;
103 void *Next;
104 unsigned int BaseAddressRegister;
105 unsigned int WindowSize;
106 unsigned int DataWidth;
107 InsLibEndian Endian;
108 char Comment[InsLibCOMMENT_SIZE];
109 } InsLibPciAddressSpace;
112 /** @brief A basic PCI module hardware address */
113 typedef struct {
114 InsLibPciAddressSpace *PciAddressSpace; /**< Points to all the BAR
115 registers */
116 unsigned int BusNumber;
117 unsigned int SlotNumber;
118 unsigned int VendorId;
119 unsigned int DeviceId;
120 unsigned int SubVendorId;
121 unsigned int SubDeviceId;
122 char Comment[InsLibCOMMENT_SIZE];
123 } InsLibPciModuleAddress;
125 /** @brief Each VME address space is a VME base address mapped to kernel
126 * memory.
128 * @param Mapped -- Virtual Base Address
129 * @param Next -- next VME addr space (if any)
130 * @param AddressModifier -- SpaceNumber is the VME address modifier
131 * @param WindowSize --
132 * @param DataWidth --
133 * @param Endian --
134 * @param BaseAddress -- VME base address
135 * @param FreeModifierFlag --
136 * @param Comment --
138 typedef struct {
139 void *Mapped;
140 void *Next;
141 unsigned int AddressModifier;
142 unsigned int WindowSize;
143 unsigned int DataWidth;
144 InsLibEndian Endian;
145 unsigned int BaseAddress;
146 unsigned int FreeModifierFlag;
147 char Comment[InsLibCOMMENT_SIZE];
148 } InsLibVmeAddressSpace;
151 /** @brief The VME module hardware address is just its address spaces */
152 typedef struct {
153 InsLibVmeAddressSpace *VmeAddressSpace; /**< */
154 char Comment[InsLibCOMMENT_SIZE]; /**< */
155 } InsLibVmeModuleAddress;
158 /** @brief Carrier boards provide a bus on which piggy back boards ride */
159 typedef struct {
160 void *Mapped; /**< Points to the piggy backs mapped kernel
161 memory */
162 void *Next; /**< next carrier addr space (if any) */
163 unsigned int SpaceNumber; /**< SpaceNumber for carrier boards its just
164 a number */
165 unsigned int DataWidth;
166 unsigned int WindowSize;
167 InsLibEndian Endian;
168 char Comment[InsLibCOMMENT_SIZE];
169 } InsLibCarAddressSpace;
172 /** @brief The hardware address is the carrier board number and position
173 * on that board
175 typedef struct {
176 InsLibCarAddressSpace *CarAddressSpace;
177 char DriverName[InsLibNAME_SIZE];
178 unsigned int MotherboardNumber;
179 unsigned int SlotNumber;
180 char Comment[InsLibCOMMENT_SIZE];
181 } InsLibCarModuleAddress;
184 /** @brief A driver resides on a host computer and has a name and a list
185 * of modules
187 typedef struct {
188 InsLibModlDesc *Modules; /**< all controlled modules of the driver */
189 void *Next; /**< next driver description */
190 char DrvrName[InsLibNAME_SIZE]; /**< driver name */
191 unsigned int DebugFlags;
192 unsigned int EmulationFlags;
193 unsigned int ModuleCount; /**< how many modules driver controls */
194 char Comment[InsLibCOMMENT_SIZE]; /**< comment string */
195 int isdg; /**< if driver was generated by the DriverGen?
196 0 -- no
197 1 -- yes
198 -1 -- not specified */
199 } InsLibDrvrDesc;
201 /** @brief The root node for the host */
202 typedef struct {
203 InsLibDrvrDesc *Drivers; /**< drivers list */
204 char HostName[InsLibNAME_SIZE];
205 char Comment[InsLibCOMMENT_SIZE];
206 } InsLibHostDesc;
210 #endif /* _CONFIG_DATA_H_INCLUDE_ */