/*
|
/*
|
|
*This file is part of fpga_gpib_controller.
|
|
*
|
|
* Fpga_gpib_controller is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Fpga_gpib_controller is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Fpga_gpib_controller. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
/*
|
* GpibHw.h
|
* GpibHw.h
|
*
|
*
|
* Created on: Feb 9, 2012
|
* Created on: Feb 9, 2012
|
* Author: Andrzej Paluch
|
* Author: Andrzej Paluch
|
*/
|
*/
|
|
|
#include "GpibHwAdapter.h"
|
#include "GpibHwAdapter.h"
|
|
|
#ifndef __GPIB_HW_H__
|
#ifndef __GPIB_HW_H__
|
#define __GPIB_HW_H__
|
#define __GPIB_HW_H__
|
|
|
/** Encapsulates GPIB hardware issues. */
|
/** Encapsulates GPIB hardware issues. */
|
struct GpibHw
|
struct GpibHw
|
{
|
{
|
struct GpibHwAdapter *ghwa;
|
struct GpibHwAdapter *ghwa;
|
bool writerLastEndOfStream;
|
bool writerLastEndOfStream;
|
};
|
};
|
|
|
/** Encapsulates GPIB device settings. */
|
/** Encapsulates GPIB device settings. */
|
struct GpibHwSettings
|
struct GpibHwSettings
|
{
|
{
|
bool talkOnly;
|
bool talkOnly;
|
bool listenOnly;
|
bool listenOnly;
|
char eosMark;
|
char eosMark;
|
bool eosUsed;
|
bool eosUsed;
|
char fixedPpLine;
|
char fixedPpLine;
|
bool lpeUsed;
|
bool lpeUsed;
|
bool isLeTe;
|
bool isLeTe;
|
char T1;
|
char T1;
|
char address;
|
char address;
|
u32 secondaryAddressMask;
|
u32 secondaryAddressMask;
|
};
|
};
|
|
|
/** Encapsulates GPIB device events. */
|
/** Encapsulates GPIB device events. */
|
struct GpibHwEvents
|
struct GpibHwEvents
|
{
|
{
|
u16 IFC : 1;
|
u16 IFC : 1;
|
u16 ATN : 1;
|
u16 ATN : 1;
|
u16 REN : 1;
|
u16 REN : 1;
|
u16 stb_received : 1;
|
u16 stb_received : 1;
|
u16 ppr : 1;
|
u16 ppr : 1;
|
u16 srq : 1;
|
u16 srq : 1;
|
u16 cwrd : 1;
|
u16 cwrd : 1;
|
u16 cwrc : 1;
|
u16 cwrc : 1;
|
u16 spa : 1;
|
u16 spa : 1;
|
u16 atl : 1;
|
u16 atl : 1;
|
u16 att : 1;
|
u16 att : 1;
|
u16 trg : 1;
|
u16 trg : 1;
|
u16 clr : 1;
|
u16 clr : 1;
|
u16 out_ready : 1;
|
u16 out_ready : 1;
|
u16 in_ready : 1;
|
u16 in_ready : 1;
|
u16 isLocal : 1;
|
u16 isLocal : 1;
|
};
|
};
|
|
|
/** Encapsulates GPIB device status. */
|
/** Encapsulates GPIB device status. */
|
struct GpibHwStatus
|
struct GpibHwStatus
|
{
|
{
|
u16 isLocal : 1;
|
u16 isLocal : 1;
|
u16 spa : 1;
|
u16 spa : 1;
|
u16 cwrd : 1;
|
u16 cwrd : 1;
|
u16 cwrc : 1;
|
u16 cwrc : 1;
|
u16 lac : 1;
|
u16 lac : 1;
|
u16 atl : 1;
|
u16 atl : 1;
|
u16 tac : 1;
|
u16 tac : 1;
|
u16 att : 1;
|
u16 att : 1;
|
u16 currentSecondaryAddress : 5;
|
u16 currentSecondaryAddress : 5;
|
};
|
};
|
|
|
/** Initializes GpibHw. */
|
/** Initializes GpibHw. */
|
bool GpibHw_init(struct GpibHw *gpibHw, struct GpibHwAdapter *ghw);
|
bool GpibHw_init(struct GpibHw *gpibHw, struct GpibHwAdapter *ghw);
|
|
|
/** Releases gpib. */
|
/** Releases gpib. */
|
void GpibHw_release(struct GpibHw *gpibHw);
|
void GpibHw_release(struct GpibHw *gpibHw);
|
|
|
|
|
/** Gets GPIB hw settings. */
|
/** Gets GPIB hw settings. */
|
bool GpibHw_getSettings(struct GpibHw *gpibHw, struct GpibHwSettings *settings);
|
bool GpibHw_getSettings(struct GpibHw *gpibHw, struct GpibHwSettings *settings);
|
|
|
/** Sets GPIB hw settings. */
|
/** Sets GPIB hw settings. */
|
bool GpibHw_setSettings(struct GpibHw *gpibHw, struct GpibHwSettings *settings);
|
bool GpibHw_setSettings(struct GpibHw *gpibHw, struct GpibHwSettings *settings);
|
|
|
|
|
/** Gets GPIB hw event status. */
|
/** Gets GPIB hw event status. */
|
bool GpibHw_getEventStatus(struct GpibHw *gpibHw, struct GpibHwEvents *events);
|
bool GpibHw_getEventStatus(struct GpibHw *gpibHw, struct GpibHwEvents *events);
|
|
|
|
|
/** Gets GPIB hw status. */
|
/** Gets GPIB hw status. */
|
bool GpibHw_getGpibStatus(struct GpibHw *gpibHw, struct GpibHwStatus *status);
|
bool GpibHw_getGpibStatus(struct GpibHw *gpibHw, struct GpibHwStatus *status);
|
|
|
|
|
/** Controls rsc signal. */
|
/** Controls rsc signal. */
|
bool GpibHw_requestSystemControl(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_requestSystemControl(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls sic signal. */
|
/** Controls sic signal. */
|
bool GpibHw_systemInterfaceClear(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_systemInterfaceClear(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls sre signal. */
|
/** Controls sre signal. */
|
bool GpibHw_sendRemoteEnable(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_sendRemoteEnable(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls gts line. */
|
/** Controls gts line. */
|
bool GpibHw_goToStandby(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_goToStandby(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls tca signal. */
|
/** Controls tca signal. */
|
bool GpibHw_takeControlAsynchronously(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_takeControlAsynchronously(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls tcs signal. */
|
/** Controls tcs signal. */
|
bool GpibHw_takeControlSynchronously(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_takeControlSynchronously(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls rpp signal. */
|
/** Controls rpp signal. */
|
bool GpibHw_requestParallelPoll(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_requestParallelPoll(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls rec_stb signal. */
|
/** Controls rec_stb signal. */
|
bool GpibHw_receiveStatusByte(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_receiveStatusByte(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls lpe signal. */
|
/** Controls lpe signal. */
|
bool GpibHw_localPollEnable(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_localPollEnable(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls ist signal. */
|
/** Controls ist signal. */
|
bool GpibHw_setIndividualStatus(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_setIndividualStatus(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls rsv signal. */
|
/** Controls rsv signal. */
|
bool GpibHw_requestService(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_requestService(struct GpibHw *gpibHw, bool value);
|
|
|
/** Controls rtl signal. */
|
/** Controls rtl signal. */
|
bool GpibHw_returnToLocal(struct GpibHw *gpibHw, bool value);
|
bool GpibHw_returnToLocal(struct GpibHw *gpibHw, bool value);
|
|
|
/** Sets local listen unlisten state by control of lines ltn and lun. */
|
/** Sets local listen unlisten state by control of lines ltn and lun. */
|
bool GpibHw_setLocalListenUnlisten(struct GpibHw *gpibHw, bool ltn, bool lun);
|
bool GpibHw_setLocalListenUnlisten(struct GpibHw *gpibHw, bool ltn, bool lun);
|
|
|
/** Gets bytes available in reader fifo. */
|
/** Gets bytes available in reader fifo. */
|
bool GpibHw_availableBytesToRead(struct GpibHw *gpibHw, SizeType *len);
|
bool GpibHw_availableBytesToRead(struct GpibHw *gpibHw, SizeType *len);
|
|
|
/** Reads bytes from reader fifo. */
|
/** Reads bytes from reader fifo. */
|
bool GpibHw_read(struct GpibHw *gpibHw, char *buf, SizeType bufLen,
|
bool GpibHw_read(struct GpibHw *gpibHw, char *buf, SizeType bufLen,
|
SizeType *bytesRead, bool *endOfStream);
|
SizeType *bytesRead, bool *endOfStream);
|
|
|
/** Gets bytes count in writer fifo. */
|
/** Gets bytes count in writer fifo. */
|
bool GpibHw_bytesInWriterFifo(struct GpibHw *gpibHw, SizeType *count);
|
bool GpibHw_bytesInWriterFifo(struct GpibHw *gpibHw, SizeType *count);
|
|
|
/** Writes bytes to writer fifo. */
|
/** Writes bytes to writer fifo. */
|
bool GpibHw_write(struct GpibHw *gpibHw, char *buf, SizeType bufLen,
|
bool GpibHw_write(struct GpibHw *gpibHw, char *buf, SizeType bufLen,
|
SizeType *bytesWritten, bool endOfStream);
|
SizeType *bytesWritten, bool endOfStream);
|
|
|
|
|
#endif /* __GPIB_HW_H__ */
|
#endif /* __GPIB_HW_H__ */
|
|
|