source: fact/drsdaq/VME/atlas/include/vme_rcc/vme_rcc.h@ 16858

Last change on this file since 16858 was 22, checked in by ogrimm, 16 years ago
First commit of drsdaq program
  • Property svn:executable set to *
File size: 9.1 KB
Line 
1// $Id: vme_rcc.h,v 1.11 2007/11/08 07:56:44 joos Exp $
2/************************************************************************/
3/* */
4/* File: vme_rcc.h */
5/* */
6/* This is the public header file for RCC VMEbus library */
7/* */
8/* 12. Oct. 01 MAJO created */
9/* */
10/* 011101 JOP add error codes */
11/* 020418 JOP ROAK / RORA */
12/* 020527 JOP update interrupt API */
13/* */
14/************ C 2003 - The software with that certain something *********/
15
16#ifndef _VME_RCC_H
17#define _VME_RCC_H
18
19#include <linux/types.h>
20#include "vme_rcc_common.h"
21
22/***********************************/
23/*VMEbus transfer type definitions*/
24/***********************************/
25#define VME_RP 0x01
26#define VME_WP 0x02
27#define VME_A16 0x0
28#define VME_A24 0x1
29#define VME_A32 0x2
30#define VME_CRCSR 0x5
31#define VME_USER1 0x6
32#define VME_USER2 0x7
33#define VME_AM09 (VME_A32)
34#define VME_AM39 (VME_A24)
35#define VME_AM29 (VME_A16)
36#define VME_AM2f (VME_CRCSR)
37#define VME_AM_PROGRAM 0x00004000
38#define VME_AM_DATA 0x00000000
39#define VME_AM_USER 0x00000000
40#define VME_AM_SUPERVISOR 0x00001000
41#define VME_DMA_READ 0x00000000
42#define VME_DMA_WRITE 0x80000000
43#define VME_DMA_D32 0x00800000
44#define VME_DMA_D64 0x00c00000
45#define VME_DMA_DEF 0x00020100 //A32, user, data, BLT
46#define VME_DMA_D32W (VME_DMA_DEF | VME_DMA_D32 | VME_DMA_WRITE)
47#define VME_DMA_D32R (VME_DMA_DEF | VME_DMA_D32 | VME_DMA_READ)
48#define VME_DMA_D64W (VME_DMA_DEF | VME_DMA_D64 | VME_DMA_WRITE)
49#define VME_DMA_D64R (VME_DMA_DEF | VME_DMA_D64 | VME_DMA_READ)
50#define VME_DMA_DEF_A24 0x00010100 //A24, user, data, BLT
51#define VME_DMA_A24D32W (VME_DMA_DEF_A24 | VME_DMA_D32 | VME_DMA_WRITE)
52#define VME_DMA_A24D32R (VME_DMA_DEF_A24 | VME_DMA_D32 | VME_DMA_READ)
53#define VME_FIFO_DMA_D32W 0x80820200 //Write in A32/D32 single cycle mode to a constant address
54#define VME_FIFO_DMA_D32R 0x00820200 //Read in A32/D32 single cycle mode from a constant address
55
56/************************************************/
57/*Identifier definitions for CR/CSR space access*/
58/* */
59/* Bits 31..28 Number of bytes to read */
60/* Bits 27..24 Data width */
61/* 0 = D08 */
62/* 1 = D16 */
63/* 2 = D32 */
64/* Bits 19..00 Offset of first byte */
65/************************************************/
66#define ONE_BYTE 0x10000000
67#define TWO_BYTE 0x20000000
68#define THREE_BYTE 0x30000000
69#define FOUR_BYTE 0x40000000
70
71#define CRCSR_D08 0x00000000
72#define CRCSR_D16 0x01000000
73#define CRCSR_D32 0x02000000
74
75#define CR_CHECKSUM (CRCSR_D08 | ONE_BYTE | 0x00003)
76#define CR_LENGTH (CRCSR_D08 | THREE_BYTE | 0x00007)
77#define CR_CRACCESSWIDTH (CRCSR_D08 | ONE_BYTE | 0x00013)
78#define CR_CSRACCESSWIDTH (CRCSR_D08 | ONE_BYTE | 0x00017)
79#define CR_CRCSRSPEC (CRCSR_D08 | ONE_BYTE | 0x0001b)
80#define CR_ASCII1 (CRCSR_D08 | ONE_BYTE | 0x0001f)
81#define CR_ASCII2 (CRCSR_D08 | ONE_BYTE | 0x00023)
82#define CR_MANUFID (CRCSR_D08 | THREE_BYTE | 0x00027)
83#define CR_BOARDID (CRCSR_D08 | FOUR_BYTE | 0x00033)
84#define CR_REVID (CRCSR_D08 | FOUR_BYTE | 0x00043)
85
86#define CSR_BAR (CRCSR_D08 | ONE_BYTE | 0x7ffff)
87#define CSR_BSR (CRCSR_D08 | ONE_BYTE | 0x7fffb)
88#define CSR_BCR (CRCSR_D08 | ONE_BYTE | 0x7fff7)
89#define CSR_ADER7 (CRCSR_D08 | FOUR_BYTE | 0x7ffd3)
90#define CSR_ADER6 (CRCSR_D08 | FOUR_BYTE | 0x7ffc3)
91#define CSR_ADER5 (CRCSR_D08 | FOUR_BYTE | 0x7ffb3)
92#define CSR_ADER4 (CRCSR_D08 | FOUR_BYTE | 0x7ffa3)
93#define CSR_ADER3 (CRCSR_D08 | FOUR_BYTE | 0x7ff93)
94#define CSR_ADER2 (CRCSR_D08 | FOUR_BYTE | 0x7ff83)
95#define CSR_ADER1 (CRCSR_D08 | FOUR_BYTE | 0x7ff73)
96#define CSR_ADER0 (CRCSR_D08 | FOUR_BYTE | 0x7ff63)
97
98/***************************************/
99/*various upper limits for arrays, etc.*/
100/***************************************/
101#define VME_MAXSTRING 256
102
103
104/******************/
105/*type definitions*/
106/******************/
107typedef struct
108{
109 int number_of_items;
110 VME_BlockTransferItem_t list_of_items[VME_MAXCHAINEL];
111} VME_BlockTransferList_t;
112
113typedef struct
114{
115 int number_of_items;
116 VME_InterruptItem_t list_of_items[VME_MAXINTERRUPT];
117} VME_InterruptList_t;
118
119
120/************/
121/*Prototypes*/
122/************/
123#ifdef __cplusplus
124extern "C" {
125#endif
126
127
128/*******************************/
129/*Official functions of the API*/
130/*******************************/
131int VME_ErrorPrint(VME_ErrorCode_t error_code);
132int VME_ErrorString(VME_ErrorCode_t error_code, char *error_string);
133int VME_ErrorNumber(VME_ErrorCode_t error_code, int *error_number);
134VME_ErrorCode_t VME_Open(void);
135VME_ErrorCode_t VME_Close(void);
136VME_ErrorCode_t VME_ReadCRCSR(int slot_number, u_int crcsr_identifier, u_int *value);
137VME_ErrorCode_t VME_WriteCRCSR(int slot_number, u_int crcsr_identifier, u_int value);
138VME_ErrorCode_t VME_MasterMap(VME_MasterMap_t *master_map, int *master_mapping);
139VME_ErrorCode_t VME_MasterMapVirtualAddress(int master_mapping, u_int *virtual_address);
140VME_ErrorCode_t VME_ReadSafeUInt(int master_mapping, u_int address_offset, u_int *value);
141VME_ErrorCode_t VME_ReadSafeUShort(int master_mapping, u_int address_offset, u_short *value);
142VME_ErrorCode_t VME_ReadSafeUChar(int master_mapping, u_int address_offset, u_char *value);
143VME_ErrorCode_t VME_WriteSafeUInt(int master_mapping, u_int address_offset, u_int value);
144VME_ErrorCode_t VME_WriteSafeUShort(int master_mapping, u_int address_offset, u_short value);
145VME_ErrorCode_t VME_WriteSafeUChar(int master_mapping, u_int address_offset, u_char value);
146VME_ErrorCode_t VME_MasterUnmap(int master_mapping);
147VME_ErrorCode_t VME_MasterMapDump(void);
148VME_ErrorCode_t VME_BusErrorRegisterSignal(int signal_number);
149VME_ErrorCode_t VME_BusErrorInfoGet(VME_BusErrorInfo_t *bus_error_info);
150VME_ErrorCode_t VME_SlaveMap(VME_SlaveMap_t *slave_map, int *slave_mapping);
151VME_ErrorCode_t VME_SlaveMapVmebusAddress(int slave_mapping, u_int *vmebus_address);
152VME_ErrorCode_t VME_SlaveUnmap(int slave_mapping);
153VME_ErrorCode_t VME_SlaveMapDump(void);
154VME_ErrorCode_t VME_BlockTransferInit(VME_BlockTransferList_t *block_transfer_list, int *block_transfer);
155VME_ErrorCode_t VME_BlockTransferStart(int block_transfer);
156VME_ErrorCode_t VME_BlockTransferWait(int block_transfer, int time_out, VME_BlockTransferList_t *block_transfer_list);
157VME_ErrorCode_t VME_BlockTransferEnd(int block_transfer);
158VME_ErrorCode_t VME_BlockTransfer(VME_BlockTransferList_t *block_transfer_list, int time_out);
159VME_ErrorCode_t VME_BlockTransferDump(void);
160VME_ErrorCode_t VME_BlockTransferStatus(VME_BlockTransferList_t *block_transfer_list, int position_of_block, VME_ErrorCode_t *status);
161VME_ErrorCode_t VME_BlockTransferRemaining(VME_BlockTransferList_t *block_transfer_list, int position_of_block, int *remaining);
162VME_ErrorCode_t VME_InterruptLink(VME_InterruptList_t* vmebus_interrupt_list, int *interrupt);
163VME_ErrorCode_t VME_InterruptReenable(int interrupt);
164VME_ErrorCode_t VME_InterruptWait(int interrupt, int time_out, VME_InterruptInfo_t* ir_info);
165VME_ErrorCode_t VME_InterruptRegisterSignal(int interrupt, int signal_number);
166VME_ErrorCode_t VME_InterruptInfoGet(int interrupt, VME_InterruptInfo_t* ir_info);
167VME_ErrorCode_t VME_InterruptUnlink(int interrupt);
168VME_ErrorCode_t VME_InterruptGenerate(int level, u_char vector);
169VME_ErrorCode_t VME_InterruptDump(void);
170VME_ErrorCode_t VME_SysfailInterruptLink(void);
171VME_ErrorCode_t VME_SysfailInterruptRegisterSignal(int signal_number);
172VME_ErrorCode_t VME_SysfailInterruptWait(int time_out);
173VME_ErrorCode_t VME_SysfailInterruptUnlink(void);
174VME_ErrorCode_t VME_SysfailInterruptReenable(void);
175VME_ErrorCode_t VME_SysfailSet(void);
176VME_ErrorCode_t VME_SysfailReset(void);
177VME_ErrorCode_t VME_SysfailPoll(int *flag);
178VME_ErrorCode_t VME_UniverseMap(u_int *virtual_address);
179VME_ErrorCode_t VME_UniverseUnmap(u_int virtual_address);
180VME_ErrorCode_t VME_CCTSetSwap(u_char data);
181VME_ErrorCode_t VME_Update(u_int *data);
182VME_ErrorCode_t VME_SendSysreset(void);
183void VME_ReadFastUInt(int master_mapping, u_int address_offset, u_int *value);
184void VME_ReadFastUShort(int master_mapping, u_int address_offset, u_short *value);
185void VME_ReadFastUChar(int master_mapping, u_int address_offset, u_char *value);
186void VME_WriteFastUInt(int master_mapping, u_int address_offset, u_int value);
187void VME_WriteFastUShort(int master_mapping, u_int address_offset, u_short value);
188void VME_WriteFastUChar(int master_mapping, u_int address_offset, u_char value);
189
190/******************************/
191/* Internal service functions */
192/******************************/
193VME_ErrorCode_t vmercc_err_get(err_pack err, err_str pid, err_str code);
194
195/**********************************/
196/*Additional (temporary) functions*/
197/**********************************/
198VME_ErrorCode_t VME_test(void);
199
200
201#ifdef __cplusplus
202}
203#endif
204
205#endif
Note: See TracBrowser for help on using the repository browser.