source: drsdaq/VME/struck/sis1100/V2.04/sis5100_calls/sis5100_camac_calls.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: 3.4 KB
Line 
1/*===========================================================================*/
2/* */
3/* File: sis5100_camac_calls.c */
4/* */
5/* OS: LINUX (Kernel >= 2.4.18 */
6/* */
7/* Description: */
8/* */
9/* Version: 0.1 */
10/* */
11/* */
12/* Generated: 22.06.04 */
13/* */
14/* Author: MKI */
15/* */
16/* Last Change: Installation */
17/*---------------------------------------------------------------------------*/
18/* SIS GmbH */
19/* Harksheider Str. 102A */
20/* 22399 Hamburg */
21/* */
22/* http://www.struck.de */
23/* */
24/*===========================================================================*/
25
26#define _GNU_SOURCE
27#include <stdio.h>
28#include <errno.h>
29#include <string.h>
30#include <sys/types.h>
31#include <unistd.h>
32#include <stdlib.h>
33#include <fcntl.h>
34#include <sys/ioctl.h>
35
36
37#include "dev/pci/sis1100_var.h" /* pfad im Makefile angeben */
38
39
40#include "sis5100_camac_calls.h"
41
42
43/*******************/
44/* */
45/* CAMAC_NAF */
46/* */
47/*******************/
48
49
50int camac_write(int p, u_int32_t N,u_int32_t A,u_int32_t F, u_int32_t camac_data)
51{
52struct sis1100_camac_req req;
53int res;
54
55req.N=N;
56req.A=A;
57req.F=F;
58req.data=camac_data;
59req.error=0;
60
61res=ioctl(p, SIS5100_CNAF, &req);
62
63if (res) {
64 return res;
65}
66else {
67 return req.error;
68}
69}
70
71int camac_read(int p, u_int32_t N,u_int32_t A,u_int32_t F, u_int32_t* camac_data)
72{
73struct sis1100_camac_req req;
74int res;
75
76req.N=N;
77req.A=A;
78req.F=F;
79req.error=0;
80
81res=ioctl(p, SIS5100_CNAF, &req);
82
83if (res) {
84 return res;
85}
86else {
87 *camac_data=req.data;
88 /* printf("reqdata: %8.8x\n",req.data); */
89 return req.error;
90}
91}
92
93
94
95
96/***********************/
97/* */
98/* s5100_control */
99/* */
100/***********************/
101
102
103int s5100_control_read(int p, int offset, u_int32_t* data)
104{
105struct sis1100_ctrl_reg reg;
106int error ;
107 reg.offset = offset;
108 error = (ioctl(p, SIS1100_CTRL_READ, &reg)<0) ;
109 *data = reg.val;
110 return error ;
111}
112
113
114int s5100_control_write(int p, int offset, u_int32_t data)
115{
116struct sis1100_ctrl_reg reg;
117int error ;
118 reg.offset = offset;
119 reg.val = data;
120 error = (ioctl(p, SIS1100_CTRL_WRITE, &reg)<0) ;
121 return error ;
122}
123
124
125
126
127
128
129
130
Note: See TracBrowser for help on using the repository browser.