Rev 645 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
106 | 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 | #include "ll/sys/cdefs.h" |
||
42 | |||
43 | __BEGIN_DECLS |
||
44 | |||
45 | //#define __REG_DEBUG__ //enable this in debug mode to see |
||
46 | //configuration registers value |
||
47 | |||
48 | #define NI_CODE 0x1093 //NI Vendor_ID board code |
||
49 | |||
50 | #define Board_Address STC_Base_Address |
||
51 | |||
52 | #define BAR0 0xE8000L //New address of MITE |
||
53 | #define BAR1 0xEA000L //New address of STC |
||
54 | |||
55 | #define INT_NO NIDevice_info[0].InterruptLevel |
||
56 | |||
57 | struct pci6025e_deviceinfo { |
||
58 | WORD DEVID; |
||
59 | BYTE DevFunction; |
||
60 | BYTE BusNumber; |
||
61 | DWORD BAR0Value; |
||
62 | DWORD IntLineRegValue; |
||
63 | DWORD RevisionID; |
||
64 | BYTE InterruptLevel; |
||
65 | }; |
||
66 | |||
67 | extern struct pci6025e_deviceinfo NIDevice_info[10]; |
||
68 | extern DWORD *IntLinestructptr; |
||
69 | extern DWORD *BAR0structptr; |
||
70 | extern DWORD *RevID; |
||
71 | |||
72 | extern DWORD STC_Base_Address, MITE_Base_Address; |
||
73 | |||
74 | #define set(b,p) b|=(0x01 << p) //set p-th bit of byte b to 1 |
||
75 | #define clr(b,p) b&=~(0x01 << p) //set p-th bit of byte b to 0 |
||
76 | |||
77 | //scan PCI bus to find board and remap it on memory above 1MB |
||
78 | BYTE find_NI_Device(void); |
||
79 | BYTE reMap(void); |
||
80 | |||
81 | //IO Windowed access board registers |
||
82 | void DAQ_STC_Windowed_Mode_Write(WORD reg_addr, WORD value); |
||
83 | WORD DAQ_STC_Windowed_Mode_Read(WORD reg_addr); |
||
84 | |||
85 | //On board clock |
||
86 | BYTE setIntClock(BYTE, BYTE, BYTE); |
||
87 | |||
88 | //PFI programming |
||
89 | void PFIprogramming(WORD); |
||
90 | |||
91 | //Interrupt management |
||
92 | void INT_personalize(BYTE); |
||
93 | void INT_setup(BYTE, BYTE); |
||
94 | |||
95 | //needful macros |
||
96 | #define Immediate_Readb(addr) *((BYTE *)(Board_Address + (addr))) |
||
97 | #define Immediate_Readw(addr) *((WORD *)(Board_Address + (addr))) |
||
98 | #define Immediate_Writeb(addr, val) *((BYTE *)(Board_Address + (addr)))=(val) |
||
99 | #define Immediate_Writew(addr, val) *((WORD *)(Board_Address + (addr)))=(val) |
||
100 | |||
101 | void bitfield(BYTE dim, DWORD value); |
||
102 | void TEST_bitfield(BYTE dim, DWORD value, char *str); |
||
103 | |||
104 | //Software copy of STC general registers |
||
105 | extern WORD joint_reset, interrupt_a_enable, interrupt_a_ack, |
||
106 | interrupt_b_enable, interrupt_b_ack, clock_and_fout; |
||
107 | |||
108 | __END_DECLS |
||
109 | #endif |
||
110 | /*End of File: Pci6025e.h*/ |