Files
sics/site_ansto/hardsup/Digital/hware.h
Douglas Clowes 2df0200228 Rename files and make more consistent with Beam Monitor code
dio.* => device.*
hdio.* => hware.*
Digital.* => Monitor.*

r1265 | dcl | 2006-11-09 12:25:16 +1100 (Thu, 09 Nov 2006) | 5 lines
2012-11-15 12:52:09 +11:00

88 lines
1.7 KiB
C

/*
* This is an encapsulation of a National Instruments DIO port.
*
* It presents a simple device abstraction.
*
* The device can be read and returns a 32-bit unsigned value.
*/
#ifndef _HWARE_H_
#define _HWARE_H_
#ifdef __cplusplus
#else
#include <stdbool.h>
#endif
struct device_private_t;
typedef struct device_private_t* pHWARE;
typedef unsigned int HWARE_VALUE;
/**
* Create a device
*
* \param card_name the name of the device (e.g. "dev1/port0")
* \param ptr address of pointer to opaque private data structure
*
* \return
* 0 OK
* !0 Error
*/
int hware_ctor(const char* card_name, pHWARE* ptr);
/**
* Read the value of the device
*
* \param hware pointer to opaque private data structure
* \param value address of value to receive the output
*
* \return
* 0 OK
* !0 Error
*/
int hware_read(pHWARE hware, HWARE_VALUE* value);
/**
* Write the value of the device
*
* \param hware pointer to opaque private data structure
* \param value to be written to the device
*
* \return
* 0 OK
* !0 Error
*/
int hware_write(pHWARE hware, HWARE_VALUE value);
/**
* Destroy the device
*
* \param ptr address of pointer to opaque private data structure
*
* \return
* 0 OK
* !0 Error
*/
int hware_dtor(pHWARE* hware);
/**
* Tests returned error value to see if it represents failure
*
* \param error a value returned from another hware function
*
* \return
* true the error was a failure
* false the error was not a failure (warning)
*/
bool hware_failed(int error);
/**
* Retrieves a textual representation of the most recent error
*
* \param buff a pointer to the buffer to receive the text
* \param len the length of the provided buffer
*/
void hware_errmsg(char* buff, int len);
#endif