Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*****************************************************************************
2
* Filename:    pci6025e.h                                                    *
3
* Author:      Ziglioli Marco                                                *
4
* Date:        15/03/2001                                                    *
5
* Last update:                                                               *
6
* Description: Header file which contains declaration of structure variables *
7
*              and routines used to interface with PCI6025E                  *
8
*----------------------------------------------------------------------------*
9
* Notes:       Based on National C Routines                                  *
10
*****************************************************************************/
11
 
12
/* This file is part of the S.Ha.R.K. Project - http://shark.sssup.it
13
 *
14
 * Copyright (C) 2001 Marco Ziglioli
15
 *
16
 * This program is free software; you can redistribute it and/or modify
17
 * it under the terms of the GNU General Public License as published by
18
 * the Free Software Foundation; either version 2 of the License, or
19
 * (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
 *
30
 */
31
 
32
#ifndef _MY_PCI6025E_
33
#define _MY_PCI6025E_
34
 
35
#include <kernel/kern.h>
36
#include <drivers/pci.h>
37
#include <ll/i386/hw-instr.h>
38
 
39
#include "regconst.h"
40
 
41
//#define  __REG_DEBUG__         //enable this in debug mode to see
42
                                 //configuration registers value
43
 
44
#define  NI_CODE                 0x1093         //NI Vendor_ID board code
45
 
46
#define  Board_Address           STC_Base_Address
47
 
48
#define  BAR0                    0xE8000L       //New address of MITE
49
#define  BAR1                    0xEA000L       //New address of STC
50
 
51
#define  INT_NO                   NIDevice_info[0].InterruptLevel
52
 
53
struct pci6025e_deviceinfo {
54
   WORD     DEVID;
55
   BYTE     DevFunction;
56
   BYTE     BusNumber;
57
   DWORD    BAR0Value;
58
   DWORD    IntLineRegValue;
59
   DWORD    RevisionID;
60
   BYTE     InterruptLevel;
61
};
62
 
63
extern struct pci6025e_deviceinfo NIDevice_info[10];
64
extern DWORD *IntLinestructptr;
65
extern DWORD *BAR0structptr;
66
extern DWORD *RevID;
67
 
68
extern DWORD    STC_Base_Address, MITE_Base_Address;
69
 
70
#define set(b,p)        b|=(0x01 << p)    //set p-th bit of byte b to 1
71
#define clr(b,p)        b&=~(0x01 << p)   //set p-th bit of byte b to 0
72
 
73
//scan PCI bus to find board and remap it on memory above 1MB
74
BYTE find_NI_Device(void);
75
BYTE reMap(void);
76
 
77
//IO Windowed access board registers
78
void DAQ_STC_Windowed_Mode_Write(WORD reg_addr, WORD value);
79
WORD DAQ_STC_Windowed_Mode_Read(WORD reg_addr);
80
 
81
//On board clock
82
BYTE  setIntClock(BYTE, BYTE, BYTE);
83
 
84
//PFI programming
85
void  PFIprogramming(WORD);
86
 
87
//Interrupt management
88
void  INT_personalize(BYTE);
89
void  INT_setup(BYTE, BYTE);
90
 
91
//needful macros
92
#define Immediate_Readb(addr)       *((BYTE *)(Board_Address + (addr)))
93
#define Immediate_Readw(addr)       *((WORD *)(Board_Address + (addr)))
94
#define Immediate_Writeb(addr, val) *((BYTE *)(Board_Address + (addr)))=(val)
95
#define Immediate_Writew(addr, val) *((WORD *)(Board_Address + (addr)))=(val)
96
 
97
void  bitfield(BYTE dim, DWORD value);
98
void  TEST_bitfield(BYTE dim, DWORD value, char *str);
99
 
100
//Software copy of STC general registers
101
extern WORD joint_reset, interrupt_a_enable, interrupt_a_ack,
102
            interrupt_b_enable, interrupt_b_ack, clock_and_fout;
103
 
104
#endif
105
/*End of File: Pci6025e.h*/