support_camac_h

/*
**	Copyright 1996, Universities Research Association.  All rights reserved.
*/
/******************************************************************************/
/******************************************************************************/
/* support_camac.h
**  
**	function prototypes and defined constants for argument values for
**	CAMAC support routines in CLIB
**
*/
/******************************************************************************/
#ifndef NULL
    #define NULL 0
#endif

#ifndef SUPPORT_CAMAC_DEFINED			/* do this only once */
    #define	SUPPORT_CAMAC_DEFINED

/******************************************************************************/
/* 
**	defined constants for argument values and structure definitions
*/
/******************************************************************************/

    #define	CAMAC_ERROR_TEXT_LEN	21		/* maximum length of a CAMAC error message */

    #define	CAMAC_OK		0		/* success */
    #define	CAMAC_NO_Q		-1		/* no Q */
    #define	CAMAC_NO_X		-2		/* no X */
    #define	CAMAC_ARBCON		-3		/* arbitration conflict (obsolete) */
    #define	CAMAC_NO_SRP		-4		/* no SRP */
    #define	CAMAC_TIMEOUT		-5		/* timeout */
    #define	CAMAC_PROTERR		-6		/* protocol error */
    #define	CAMAC_ECHOCHK		-7		/* echo check */
    #define	CAMAC_PARITYERR		-8		/* parity error */
    #define	CAMAC_SLC_TIMEOUT	-9		/* serial link controller timeout */
    #define	CAMAC_REJECT		-10		/* reject */
    #define	CAMAC_BAD_NAF		-125		/* invalid NAF requested */
    #define	CAMAC_PORTA_XERROR	-126		/* port A transmit error */
    #define	CAMAC_BADARB		-127		/* block transfer arbitration error */
    #define	CAMAC_CC_BADSTATUS	-128		/* invalid status from crate controller */


/******************************************************************************/
/*
**	function prototypes for CAMAC support routines in CLIB
*/
/******************************************************************************/

    #ifdef __cplusplus
extern "C" {
#endif

int camac_error_text_c(int error, char *text);
int camac_error_to_acnet_error_c(int error, int *acnet_error);
int camac_io_c(int front_end, int num_commands, int *crates, int *slots,
	       int *functions, int *subaddresses, int *data,
	       char *status, int *retries = (int *) NULL,
	       int *arbitration = (int *) NULL,
	       short *ext_status = (short *) NULL);		/* called by module SUPPORT_CAMAC_DEVICES */
int camac_module_type_c(int const *device_indices, short const *properties,
			int *module_types, short *errors, int num_devices = 1);

#ifdef __cplusplus
}
    #endif


/******************************************************************************/
/*
**	equivalent name definitions
*/
/******************************************************************************/

#define	CAMAC_ERROR_TEXT_C		camac_error_text_c
#define	CAMAC_ERROR_TO_ACNET_ERROR_C	camac_error_to_acnet_error_c
#define	CAMAC_IO_C			camac_io_c
#define	CAMAC_MODULE_TYPE_C		camac_module_type_c

#endif