source: drsdaq/VME/struck/sis1100/V2.02/dev/pci/sis3100rem_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.2 KB
Line 
1/* $ZEL: sis3100rem_front_io.c,v 1.2 2004/05/27 23:10:43 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 * 31
35 * 30
36 * 29
37 * 28
38 * 27 res pci_led_1 free
39 * 26 res pci_led_0 free
40 * 25 res pci_lemo_out_1 status pci_lemo_in_1
41 * 24 res pci_lemo_out_0 status pci_lemo_in_0
42 * 23 res vme_user_led free
43 * 22 res vme_lemo_out_3 status vme_lemo_in_3
44 * 21 res vme_lemo_out_2 status vme_lemo_in_2
45 * 20 res vme_lemo_out_1 status vme_lemo_in_1
46 * 19 res vme_flat_out_4 status vme_flat_in_4
47 * 18 res vme_flat_out_3 status vme_flat_in_3
48 * 17 res vme_flat_out_2 status vme_flat_in_2
49 * 16 res vme_flat_out_1 status vme_flat_in_1
50 * 15
51 * 14
52 * 13
53 * 12
54 * 11 set pci_led_1 status pci_led_1
55 * 10 set pci_led_0 status pci_led_0
56 * 9 set pci_lemo_out_1 status pci_lemo_out_1
57 * 8 set pci_lemo_out_0 status pci_lemo_out_0
58 * 7 set vme_user_led status vme_user_led
59 * 6 set vme_lemo_out_3 status vme_lemo_out_3
60 * 5 set vme_lemo_out_2 status vme_lemo_out_2
61 * 4 set vme_lemo_out_1 status vme_lemo_out_1
62 * 3 set vme_flat_out_4 status vme_flat_out_4
63 * 2 set vme_flat_out_3 status vme_flat_out_3
64 * 1 set vme_flat_out_2 status vme_flat_out_2
65 * 0 set vme_flat_out_1 status vme_flat_out_1
66 */
67/*
68 * set_vme_flat_out_?=0x0000000f
69 * res_vme_flat_out_?=0x000f0000
70 * set_vme_lemo_out_?=0x00000070
71 * res_vme_lemo_out_?=0x00700000
72 * set_vme_user_led =0x00000080
73 * res_vme_user_led =0x00800000
74 * set_pci_lemo_out_?=0x00000300
75 * res_pci_lemo_out_?=0x03000000
76 * set_pci_led_? =0x00000c00
77 * res_pci_led_? =0x0c000000
78 */
79
80int
81sis3100rem_front_io(struct sis1100_softc* sc, u_int32_t* data)
82{
83 u_int32_t io3100, st3100, _data;
84
85 /* XXX no error handling yet */
86 io3100=plxreadlocal0(sc, ofs(struct sis3100_reg, in_out)+0x800);
87 st3100=plxreadlocal0(sc, ofs(struct sis3100_reg, vme_master_sc)+0x800);
88
89 _data = (io3100&0x7f007f) | /* 3100 flat/lemo in/out */
90 (st3100&0x80); /* 3100 user led */
91
92 io3100=*data & 0x007f007f;
93 st3100=*data & 0x00800080;
94
95 if (io3100)
96 plxwritelocal0(sc, ofs(struct sis3100_reg, in_out)+0x800, io3100);
97 if (st3100)
98 plxwritelocal0(sc, ofs(struct sis3100_reg, vme_master_sc)+0x800, st3100);
99
100 *data=_data;
101 return 0;
102}
103
104int
105sis3100rem_front_pulse(struct sis1100_softc* sc, u_int32_t* data)
106{
107 u_int32_t io3100;
108
109 io3100=(*data<<24) & 0x7f000000;
110
111 plxwritelocal0(sc, ofs(struct sis3100_reg, in_out)+0x800, io3100);
112
113 return 0;
114}
115
116int
117sis3100rem_front_latch(struct sis1100_softc* sc, u_int32_t* data)
118{
119 u_int32_t latch, _data;
120
121 latch=(*data<<24) & 0xff000000;
122 _data=plxreadlocal0(sc, ofs(struct sis3100_reg, in_latch_irq)+0x800);
123 plxwritelocal0(sc, ofs(struct sis3100_reg, in_latch_irq)+0x800, latch);
124
125 *data=(_data>>24) & 0xff;
126 return 0;
127}
Note: See TracBrowser for help on using the repository browser.