fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/menable/hap.h
Go to the documentation of this file.
00001 //+-------------------------------------------------------------------
00002 //
00003 //  
00004 //  Copyright (C) Silicon Software GmbH, 1997.
00005 //
00006 //  File:       hap.h
00007 //
00008 //  Contents:   
00009 //              
00010 //
00011 // Revision: 1997 erzeugt
00012 // Okt. 99: Erweiterung um Registerinformationen
00013 // Nov. 99: Erweiterung um Multihap-Funktionalität und Versionskontrolle
00014 //--------------------------------------------------------------------
00015 
00016 #ifndef __HAP1H
00017 #define __HAP1H
00018 
00019 #include "os_type.h"
00020 
00021 #define DIR_READ 0
00022 #define DIR_WRITE 1
00023 
00024 #define REGISTER 0x1
00025 #define PULSE    0x2
00026 
00027 typedef struct rbt_info 
00028 {
00029                 char designname[256];
00030                 unsigned long family;   // xc4000ex
00031                 char partname[256];
00032                 unsigned long fpga_type;                // 4028exhq240
00033                 char datestring[256];
00034                 int datalen;
00035 
00036                 // Clk Data
00037                 unsigned long clk[16];
00038 
00039                 unsigned char *data;
00040 } rbt_info;
00041 
00042 // Zur Datenübertragung zwischen externene Hap-Zugriffsfunktioenn und der siso.dll
00043 
00044 typedef struct HapData {
00045         union {
00046                 // Add Konfiguration
00047                 rbt_info        *pRbtInfo;
00048 
00049                 struct interrupt {
00050                         // AddInterruptRegister
00051                         unsigned long ulBasisAddress;
00052                         unsigned long ulAckRegister;
00053                         unsigned long ulIntStartRegister;
00054                 } interrupt;
00055 
00056                 struct dma {
00057                         // AddDmaRegister
00058                         int     nChannel;
00059                         unsigned long ulLenAddr;
00060                         unsigned long ulBaseAddress;
00061                         unsigned long ulFlags;
00062                 } dma;
00063                 struct hregister {
00064                         int                             register_type;  // REGISTER, PULSE
00065                         unsigned long   address;                // Absolute Adresse des Registers
00066                         int                             cache;                  // ein Cache Wert des Registers 
00067                         int                             direction;              // Direction Read oder Write
00068                         int                             lsb;                    // von bit lsb
00069                         int                             msb;                    // bis bit msb
00070                         char                    name[64];               // Namen des Registers
00071                 } hregister;
00072 
00073                 struct comment {
00074                         char                    str[256];
00075                 } comment;
00076 
00077                 struct author {
00078                         char                    str[64];
00079                 } author;
00080 
00081                 struct version {
00082                         char                    str[64];
00083                 } version;
00084 
00085                 struct design_name {
00086                         char                    str[64];
00087                 } design_name;
00088         } u;
00089 } HapData;
00090 
00091 //
00092 // Tag Header Definitionen
00093 //
00094 
00095 #define HAP_HEADER 0x5349534f  // "SISO"
00096 
00097 // Multi-Hap-Erweiterung 7.11.99
00098 // Hat einen anderen Header: HAP_MULTI_HEADER
00099 // Dieser ist u.a. um eine Versionkontrolle erweitert
00100 
00101 #define HAP_MULTI_HEADER 0x5349534d  // "SISM"
00102 
00103 
00104 #define HAP_COM                 0x08150010
00105 #define HAP_COMMENT             HAP_COM
00106 #define HAP_TAG                 0x08150015
00107 #define HAP_FPGA_TYPE   0x08150020
00108 
00109 // Version und Revision des Applets ! nicht des Hap-Formats
00110 #define HAP_VERSION             0x08150030
00111 #define HAP_REVISION    0x08150032
00112 #define HAP_RELEASE             0x08150034
00113 #define HAP_DATE                0x08150040
00114 #define HAP_DESCRIP             0x08150050
00115 #define HAP_SPEED               0x08150060
00116 #define HAP_AUTHOR              0x08150070
00117 #define HAP_INTERFACE_INFO 0x08150080
00118 #define HAP_CLOCK               0x08150090
00119 #define HAP_DATA                0x08150110
00120 #define HAP_MULTI_DATA          0x08150120
00121 #define HAP_CONFIG      HAP_MULTI_DATA
00122 
00123 #define HAP_REGISTER                            0x08151000
00124 #define HAP_DMAMODUL                            0x08151010
00125 #define HAP_DMACNTREGISTER                      0x08151020
00126 #define HAP_INTERRUPTVECTORREGISTER     0x08151030
00127 
00128 // Erweiterungen für Multihap
00129 
00130 #define HAP_INFO                0x08152000      // Gesamtinfos über Hap #designs etc.
00131 #define HAP_VERSION_100 0x08153000
00132 
00133 // DLL Module ins Hap-Format
00134 #define HAP_DLL                 0x08154000
00135 
00136 #define HAP_DESIGN_NAME 0x08155000
00137 #define HAP_DESIGN_VERSION 0x08156000
00138 
00139 //
00140 // HAP Strukturen 
00141 //
00142 
00143 // header 
00144 typedef struct hap_head {
00145         unsigned long head;     // HAP_HEAD
00146         unsigned long len;
00147         unsigned long tag_count;
00148 } hap_head,*phap_head;
00149 
00150 // Multi_Header : ab HAP_VERSION_100
00151 typedef struct hap_multi_head {
00152         unsigned long head;     // HAP_MULTI_HEAD
00153         unsigned long len;
00154         unsigned long tag_count;
00155         unsigned long config_count;     // Die Anzahl der enthaltenen KOnfigurationen
00156         unsigned long version;  // Erweiterung ab HAP_MULTI_HEAD
00157         unsigned long destination;      // Zielsystem: microEnable, microEnable-II, etc.
00158         // PN_MICROENABLE, etc.
00159 } hap_multi_head,*phap_multi_head;
00160 
00161 
00162 // Hap-Info Struktur mit Informationen über Teildesigns des Hap-Files
00163 typedef struct hap_info {
00164         unsigned long tag;
00165         unsigned long len;
00166         unsigned long number_of_configurations;
00167         unsigned long number_of_types;
00168         unsigned long absolute_config_offsets[64];      // Mindestens 64, bei mehr als 64 conf
00169                                                                                                 // ist diese Struktur zu erweitern
00170                                                                                                 // HAP_VERSION_100
00171 } hap_info, *phap_info;
00172 
00173 // Comment
00174 
00175 typedef struct hap_com_s {
00176         unsigned long tag;
00177         unsigned long len;
00178         char str[256];
00179         struct hap_com_s *next;
00180 } hap_com_t,*phap_com;
00181 
00182 // FPGA type
00183 
00184 typedef struct hap_fpga_type {
00185         unsigned long tag;
00186         unsigned long len;
00187         unsigned long type;
00188         unsigned long speedgrade;
00189         unsigned long package;
00190 } hap_fpga_type,*phap_fpga_type;
00191 
00192 // Author
00193 
00194 typedef struct hap_author {
00195         unsigned long tag;
00196         unsigned long len;
00197         char str[64];
00198 } hap_author,*phap_author;
00199 
00200 // Design_Name
00201 
00202 typedef struct hap_design_name {
00203         unsigned long tag;
00204         unsigned long len;
00205         char str[64];
00206 } hap_design_name,*phap_design_name;
00207 
00208 // Design_Name
00209 
00210 typedef struct hap_design_version {
00211         unsigned long tag;
00212         unsigned long len;
00213         char str[64];
00214 } hap_design_version,*phap_design_version;
00215 
00216 
00217 // clocks
00218 
00219 // hap data 
00220 typedef struct hap_data {
00221         unsigned long tag;
00222         unsigned long len;
00223         unsigned char *data;
00224 } hap_data,*phap_data;
00225 
00226 // NEW: Multidaten, der Typ ist in den Daten integriert !!!
00227 
00228 typedef struct hap_multi_data {
00229         unsigned long tag;
00230         unsigned long len;
00231 
00232         // FPGA-Type
00233         unsigned long type;
00234         unsigned long speedgrade;
00235         unsigned long package;
00236         
00237         // Clock-Einstellungen
00238         unsigned long clk[16]; //plx_clk, fpga_clk,fpga_div, not used
00239 
00240         // Konfigurationsdaten
00241         unsigned char *data;
00242 } hap_multi_data,*phap_multi_data;
00243 
00244 // hap tag struktur
00245 typedef struct hap_tag {
00246         unsigned long tag;
00247         unsigned long len;
00248 } hap_tag,*phap_tag;
00249 
00250 
00251 // hap register struktur
00252 
00253 
00254 typedef struct hap_register {
00255         unsigned long           tag;
00256         unsigned long           len;
00257         // 
00258         int                                     register_type;  // REGISTER, PULSE
00259         unsigned long           address;                // Absolute Adresse des Registers
00260         int                                     cache;                  // ein Cache Wert des Registers 
00261         int                                     direction;              // Direction Read oder Write
00262         int                                     lsb;                    // von bit lsb
00263         int                                     msb;                    // bis bit msb
00264         char                            name[64];               // Namen des Registers
00265         unsigned long*      CachePtr;           // Cache Ptr
00266         struct hap_register     *next;
00267 } hap_register,*phap_register;
00268 
00269 // hap dmamodul struktur
00270 typedef struct hap_dmamodul {
00271         unsigned long tag;
00272         unsigned long len;
00273         int channel;
00274         unsigned long address;
00275         int strategie;
00276 } hap_dmamodul,*phap_dmamodul;
00277 
00278 // hap intvector struktur
00279 typedef struct hap_intvector {
00280         unsigned long tag;
00281         unsigned long len;
00282         unsigned long basis_address;
00283         unsigned long ack_address;
00284         unsigned long start_address;
00285 } hap_intvector,*phap_intvector;
00286 
00287 // hap dmacntreg struktur
00288 typedef struct hap_dmacntreg {
00289         unsigned long tag;
00290         unsigned long len;
00291         unsigned long dma_nr;
00292         unsigned long basis_addr_length_reg;
00293         unsigned long flags;
00294 } hap_dmacntreg,*phap_dmacntreg;
00295 
00296 // hap DLL Struktur, zur Verwaltung der DLL
00297 typedef struct hap_dll {
00298         unsigned long tag;
00299         unsigned long len;
00300         unsigned long version;  // Falls das Datenfeld umgebaut wird !!
00301         unsigned long prozessor_type;   // i386
00302         unsigned long operating_system; // NT4, Linux
00303         unsigned long ops_version;              // Versionsnummer, gerade bei Linux wichtig
00304         unsigned long name[64]; // DLL-NAME
00305         unsigned long *data;
00306 } hap_dll,*phap_dll;
00307 
00309 //
00310 // HAP Struktur
00311 //
00312 // Diese Datenstruktur wird zur Konfiguration 
00313 // zurückgegeben
00314 //
00315 
00316 typedef struct HAP {
00317         unsigned long tag_count;
00318         
00319         // KOnfigurationsinformationen
00320         unsigned long data_len; 
00321         unsigned long type;
00322         char *data;
00323 
00324         // Design Informationen (for future expansions)
00325         unsigned long   readback;
00326         unsigned long   partial_reconfig;
00327 
00328         // Clock Informationen
00329         unsigned long clk[16]; //plx_clk, fpga_clk,fpga_div, not used
00330 
00331         // Treiber und Bilbliotheksservice-Funktionen
00332         unsigned long interrupt_vector; // Addresse des Interrupt Vector, 0 = NOTIMPLEMENTED
00333         unsigned long interrupt_ack;    // Addresse des Interrupt Acknowledge, 0 = NOTIMPLEMENTED
00334         unsigned long interrupt_start;  // Addresse des Registers, das die DMA-Übertrgaung pro Kanal aktiviert,
00335                                                                         // Später werden hiermit auch die USER-Interrupts gesteuert
00336         unsigned long dma_len_register[4];      // Adresse der DMA-Längenregister, 0 = NOTI
00337         unsigned long interrupt_vector_funcs[16]; // TODO, Funktions-Zeiger !!!!
00338         unsigned long dma_flags;
00339 
00340         // DLL Informationen
00341         int     nr_of_funcs;
00342         char **func_name;
00343         char *dll_name;
00344 
00345         // Register Information
00346         int nrOfRegisters;
00347         hap_register    *pregister;
00348         unsigned long   *Cache; 
00349 } HAP,*PHAP;
00350 
00351 typedef struct HapTagMaster {
00352         union {
00353                 hap_head                head;
00354                 hap_multi_head  multi_head;
00355                 hap_info                info;
00356                 hap_tag                 tag;
00357                 hap_data                data;
00358                 hap_multi_data  multi_data;
00359                 hap_author              author;
00360                 hap_fpga_type   fpga_typ;
00361                 hap_com_t               hap_com;
00362                 hap_register    reg;
00363                 hap_dmamodul    dmamodul;
00364                 hap_intvector   intvector;
00365                 hap_dmacntreg   dmacntreg;
00366                 hap_dll                 dll;
00367                 hap_design_version version;
00368                 hap_design_name design_name;
00369         } u;
00370         struct HapTagMaster *next;
00371 } HapTagMaster;
00372 
00373 // -------- NEU 10.7.98 ----------
00374 
00375 #define MAX_HASH_VAL 4096
00376 
00377 typedef struct hash_ele {
00378         char *name;
00379         int nr;
00380         struct hash_ele *next;
00381 } hash_ele_t;
00382 
00383 
00384 // Neu 18.11.99
00385 
00386 // Diese Struktur gibt ein Abbild des Hapfiles
00387 
00388 typedef struct hapfile_index {
00389         int hap_version;
00390         int nr_of_tags;
00391         unsigned long *tag;
00392         unsigned long *absolute_tag_offset;
00393         int nr_of_configs;
00394         unsigned long *types;
00395         unsigned long *absolute_file_offset;
00396         int NrOfRegister;
00397         hap_register  *regs;
00398         int NrOfCom;
00399         hap_com_t               *coms;
00400         hap_author              *author;
00401         hap_design_name *design_name;
00402         hap_design_version      *design_version;
00403 } hapfile_index,*phapfile_index;
00404 
00405 
00406 #endif
00407 
00408