source: drsdaq/VME/struck/sis1100/V2.02/dev/pci/sis1100_front_io.c@ 23

Last change on this file since 23 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
File size: 4.5 KB
Line 
1/* $ZEL: sis1100_front_io.c,v 1.4 2004/05/27 23:10:20 wuestner Exp $ */
2
3/*
4 * Copyright (c) 2001-2004
5 * Peter Wuestner. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include "sis1100_sc.h"
30
31/*
32 * pseudoregister front_io:
33 * bit write function read function
34 * 27 res pci_led_1 free
35 * 26 res pci_led_0 free
36 * 25 res pci_lemo_out_1 status pci_lemo_in_1
37 * 24 res pci_lemo_out_0 status pci_lemo_in_0
38 * 11 set pci_led_1 status pci_led_1
39 * 10 set pci_led_0 status pci_led_0
40 * 9 set pci_lemo_out_1 status pci_lemo_out_1
41 * 8 set pci_lemo_out_0 status pci_lemo_out_0
42 */
43/*
44 * set_pci_lemo_out_?=0x00000300
45 * res_pci_lemo_out_?=0x03000000
46 * set_pci_led_? =0x00000c00
47 * res_pci_led_? =0x0c000000
48 */
49
50/*
51 * sis1100_front_io
52 * sis1100rem_front_io
53 * sis3100rem_front_io
54 * sis5100rem_front_io
55 *
56 * sis1100_front_pulse
57 * sis1100rem_front_pulse
58 * sis3100rem_front_pulse
59 * sis5100rem_front_pulse
60 *
61 * sis1100_front_latch
62 * sis1100rem_front_latch
63 * sis3100rem_front_latch
64 * sis5100rem_front_latch
65 */
66
67int
68sis1100_front_io(struct sis1100_softc* sc, u_int32_t* data, int locked)
69{
70 u_int32_t opt1100, _data;
71
72 if (!locked) SEM_LOCK(sc->sem_hw);
73
74 opt1100=sis1100readreg(sc, opt_csr);
75
76 _data = ((opt1100&0xf0)<<4) | /* 1100 lemo out and led */
77 ((opt1100&0x300)<<16); /* 1100 lemo in */
78
79 opt1100&=0xff;
80 opt1100&=~((*data>>20) & 0xf0);
81 opt1100|=(*data>>4) & 0xf0;
82 sis1100writereg(sc, opt_csr, opt1100);
83
84 switch (sc->remote_hw) {
85 case sis1100_hw_invalid: break;
86 case sis1100_hw_pci:
87 sis1100rem_front_io(sc, data);
88 break;
89 case sis1100_hw_vme:
90 sis3100rem_front_io(sc, data);
91 break;
92 case sis1100_hw_camac:
93 sis5100rem_front_io(sc, data);
94 break;
95 case sis1100_hw_f1: break;
96 case sis1100_hw_vertex: break;
97 default:
98 pINFO(sc, "front_io: remote_hw %d not known", sc->remote_hw);
99 }
100
101 if (!locked) SEM_UNLOCK(sc->sem_hw);
102 *data|=_data;
103 return 0;
104}
105
106int
107sis1100_front_pulse(struct sis1100_softc* sc, u_int32_t* data, int locked)
108{
109 if (!locked) SEM_LOCK(sc->sem_hw);
110
111 switch (sc->remote_hw) {
112 case sis1100_hw_invalid: break;
113 case sis1100_hw_pci: break;
114 case sis1100_hw_vme:
115 sis3100rem_front_pulse(sc, data);
116 break;
117 case sis1100_hw_camac: break;
118 case sis1100_hw_f1: break;
119 case sis1100_hw_vertex: break;
120 default:
121 pINFO(sc, "front_pulse: remote_hw %d not known", sc->remote_hw);
122 }
123
124 if (!locked) SEM_UNLOCK(sc->sem_hw);
125
126 return 0;
127}
128
129int
130sis1100_front_latch(struct sis1100_softc* sc, u_int32_t* data, int locked)
131{
132 if (!locked) SEM_LOCK(sc->sem_hw);
133
134 switch (sc->remote_hw) {
135 case sis1100_hw_invalid: break;
136 case sis1100_hw_pci: break;
137 case sis1100_hw_vme:
138 sis3100rem_front_latch(sc, data);
139 break;
140 case sis1100_hw_camac: break;
141 case sis1100_hw_f1: break;
142 case sis1100_hw_vertex: break;
143 default:
144 pINFO(sc, "front_latch: remote_hw %d not known", sc->remote_hw);
145 }
146
147 if (!locked) SEM_UNLOCK(sc->sem_hw);
148
149 return 0;
150}
151/*
152void
153_front_pulse(struct sis1100_softc* sc, u_int32_t data)
154{
155 u_int32_t opt1100;
156 opt1100=sis1100readreg(sc, opt_csr)&0xf;
157 opt1100|=(data<<4)&0xf0;
158 sis1100writereg(sc, opt_csr, opt1100);
159}
160*/
Note: See TracBrowser for help on using the repository browser.