You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitlib.pub/MITLIB/IODll/HardwareIni.h

227 lines
6.3 KiB
C++

// HardwareIni.h: interface for the CHardwareIni class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_HARDWAREINI_H__72E28502_940B_4759_854A_B4A6879C3115__INCLUDED_)
#define AFX_HARDWAREINI_H__72E28502_940B_4759_854A_B4A6879C3115__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Afxtempl.h"
#include "dmccom.h"
// ETEL
#ifdef WITH_ETEL
#include "dsa30.h"
#endif
// Input Card
#define PCI_7433_ADLINK 0
// Input & Output Card
#define PCI_7296_ADLINK 1
#define PCI_9112_ADLINK 2
#define PCI_7851_ADLINK 3
#define PCI_7432_ADLINK 4 // 32 in, 32 out
#define PCI_9222_ADLINK 5 // AO, AI, Encoder, DI, DO card
#define PCI_7856_HSL_ADLINK 6
#define MAX_INPUT_CARD_TYPE 7
// 7856 Port Definition
#define PCI_7856_HSL_PORT 0
#define PCI_7856_MOTIONNET_PORT 1
// Output Card
#define PCI_7434_ADLINK 0
#define MAX_OUTPUT_CARD_TYPE MAX_INPUT_CARD_TYPE
// note that the output array size is set based on 6*16*144 = 13824 output pts total
// 1 card type can have max 16*144=2304 output pts
#define MAX_CARD_TYPE MAX_OUTPUT_CARD_TYPE
#define MAX_CARD_FOR_EACH_TYPE 16
#define MAX_POINTS_FOR_EACH_CARD 144
// for remote IO 7851, max IO 63*32=2016. This value must be smaller than 2304 (as above).
// for remote IO 7856 (HSL), max IO 63*32=2016. This value must be smaller than 2304 (as above).
#define MAX_SLAVE_ID 63
#define MAX_POINTS_FOR_EACH_SLAVE_ID 32
// ETEL
#define MAX_ETEL_AXIS 32
enum CARD_TYPE
{
INPUT_CARD,
OUTPUT_CARD,
MOTION_CARD,
ENCODER_CARD
};
enum INPUT_STATE
{
INPUT_UNKNOWN,
INPUT_ON,
INPUT_OFF,
};
enum INPUT_CARD_INIT_RESULT
{
INPUT_CARD_INIT_FAIL,
INPUT_CARD_INIT_PASS,
};
enum INPUT_CARD_CLOSE_RESULT
{
INPUT_CARD_CLOSE_FAIL,
INPUT_CARD_CLOSE_PASS,
};
enum OUTPUT_CARD_INIT_RESULT
{
OUTPUT_CARD_INIT_FAIL,
OUTPUT_CARD_INIT_PASS,
};
enum OUTPUT_CARD_CLOSE_RESULT
{
OUTPUT_CARD_CLOSE_FAIL,
OUTPUT_CARD_CLOSE_PASS,
};
// class CIniFile;
#include "Utility.h"
#ifdef BUILD_IODLL
#define IODLLCLASS __declspec(dllexport)
#else
#define IODLLCLASS __declspec(dllimport)
#endif
class IODLLCLASS CHardwareIni : public CIniFile
{
public:
BOOL GetChannelConfig(int nCardType, int nCardNo, int nNoOfChannel, int *npChannelArray, int nWhatCard);
int GetSharing(int nCardType, int nCardNo, int nWhatCard);
int GetNoOfDifferentCardType(int nWhatCard);
CString GetCardName(int nCardTypeNo, int nWhatCard);
// read from hardware ini file for any hardware cards info used on the machine
// get the no of card of different card category
int GetNoOfCard(int nCardTypeNo, int nWhatCard);
// get the no of encoder card type, eg 1
int GetEncoderCardTypeNo(int nCardTypeNo);
// get the name of the encoder card type, eg 8133
CString GetEncoderCardType(int nCardTypeNo);
// get the different no of encoder card used in the machine
int GetNoOfEncoderCardType(void);
CHardwareIni();
virtual ~CHardwareIni();
private:
BOOL SetIniFile(int nWhatCard);
};
struct stCard
{
CString csCardType;
BOOL Initialised;
};
enum Galil_Axis
{
AXIS_X,
AXIS_Y,
AXIS_Z,
AXIS_W,
AXIS_E,
AXIS_F,
AXIS_G,
AXIS_H,
MAX_GALIL_AXIS
};
const char GalilAxis[MAX_GALIL_AXIS] = {
'X', 'Y', 'Z', 'W', 'E', 'F', 'G', 'H'
};
class CCard
{
public:
HANDLEDMC GetGalilCardHandle(int nCardType, int nCardNo);
void SetGalilCardHandle(int nCardType, int nCardNo, HANDLEDMC hDMC);
int Get7296PortNo(int nPoint);
BOOL GetOutputStatus(int nIndex);
CCard();
virtual ~CCard();
int GetOutputCardInitIndex(int nCardType, int nCardNo);
int GetInputCardInitIndex(int nCardType, int nCardNo);
void SetOutputCardInitIndex(int nCardType, int nCardNo, int nIndexNo);
void SetInputCardInitIndex(int nCardType, int nCardNo, int nIndexNo);
long GetOutputStatusSize();
BOOL GetOutputStatus(int nCardType, int nCardNo, int nPoint);
void SetOutputStatusSize(long lSize);
// Update the Output Status for read back
void SetOutputStatus(int nCardType, int nCardNo, int nPoint, BOOL bLogic);
bool m_bTraceData;
bool m_bBenchDebug;
protected:
// for 8134
static HANDLE m_hMotionIntArr[32]; // each axis has 1 int event
// for 8164
static HANDLE m_h8164MotionIntArr[32]; // each axis has 1 int event
// for Galil Optima series
static HANDLE m_hGalilMotionIntArr[32]; // each axis has 1 int event
// 7856 MotionNet - cater up to 64 axis
static HANDLE m_h7856MotionIntArr[64]; // each axis has 1 int event
#ifdef WITH_ETEL
// ETEL - per axis handle
static DSA_DRIVE *m_ETEL_DSA_DRIVE[MAX_ETEL_AXIS]; // cater up to 32 ETEL Axis
#endif
// static bool *m_pbOutput;
// static bool *m_pbInput;
private:
// cater tracking for upto 16 brands
static int m_nCardsPerBrand[MAX_CARD_FOR_EACH_TYPE];
// track the input cards initialised Index
// currently this is used for AdLink PCI IO Cards
// for up to 6 different type of cards with 16 cards in each type per system
static int m_nInputCardIndex[MAX_CARD_TYPE][MAX_CARD_FOR_EACH_TYPE];
// track the output cards initialised Index
// currently this is used for AdLink PCI IO Cards
// for up to 6 different type of cards with 16 cards in each type per system
static int m_nOutputCardIndex[MAX_CARD_TYPE][MAX_CARD_FOR_EACH_TYPE];
// tracking of output point status for read back purpose
// cater for 6 different output cards type
// 16 cards per type
// 144 points per card
static bool m_nOutputStatus[MAX_CARD_TYPE][MAX_CARD_FOR_EACH_TYPE][MAX_POINTS_FOR_EACH_CARD];
// for output tracking
static CArray <BOOL, BOOL> m_bOutputArray;
//
// track the Galil cards initialised handle
// currently this is used for Galil Cards only
// for up to 5 different type of cards with 5 cards in each type per system
static HANDLEDMC m_hdmcGalil[5][5];
};
#endif // !defined(AFX_HARDWAREINI_H__72E28502_940B_4759_854A_B4A6879C3115__INCLUDED_)