DCLibraries/include/globdefs.h

306 lines
7.6 KiB
C
Executable File

// global defines
// ab 6.Juli2020: neuese Board DC2b
#ifndef GLOBDEFS_H
#define GLOBDEFS_H
#include <bios19/biosdefs.h>
//#define VERSION_DC_HW "DC2b_25.02.2020"
#define VERSION_DC_HW "DC2c_oct2022"
//#define VERSION_PO_HW "PO2d_27.03.2020"
#define VERSION_PO_HW "PO2e_nov2022"
#define VERSION_SW "DC2c.04.12 06.04.2023"
//#define VERSION_SW "DC2c.04.04b14.02.2023"
//#define VERSION_SW "DC2c.04.04c14.02.2023"
#define USE1256MODE 1
#define SEND_DIAG_TO_MASTER 1
#define MAX_DATA_FROM_MASTER 64
#define MAX_RECLEN_FROM_MASTER MAX_DATA_FROM_MASTER+20
#define MAX_DATA_TO_MASTER 64
#define MAX_SENDLEN_TO_MASTER MAX_DATA_TO_MASTER+16
#define WORK_WITHOUT_HANDSHAKES
#define PAGEBUFFERSIZE 1026
extern UCHAR PageBuffer[PAGEBUFFERSIZE];
#define WAKESRC_NONE 0
#define WAKESRC_MDB 1
#define WAKESRC_COIN 2
#define WAKESRC_MASTER 3
#define WAKESRC_RTC 4
#define WAKESRC_DOOR 5
#define WAKESRC_DIAG 6
#define WAKESRC_HB 7
struct T_power
{
char busy;
char sleepAllowed;
UCHAR WakeSource;
char everythingUP;
char WokenByDevice;
char NoExternalEventNow;
char WakePulseNowActive;
UCHAR DC_status; // 0:POR 1:board ini 2:running HWtest 3: device ini 4: start-up-test
// 5: SW Module ini
UCHAR storeWakeReason[6];
char blockRS2forMif;
char blockRS1forPrinter;
};
struct T_globTime
{
UCHAR Year;
UCHAR Month;
UCHAR Day;
UCHAR DOW; // 1(Mo)....7(So)
UCHAR Hours;
UCHAR Min;
UCHAR Sec;
UINT MinOfDay; // Anzahl Minuten des Tages 0...1439
ULONG SecOfDay;
//UCHAR IsLeap;
//UCHAR aktuell; // 0,1 der der liest kann es auf 0 setzen
// und sieht dann wanns wieder aktuell
};
extern struct T_globTime GlobTime;
extern UCHAR main_getWakeEvent(void);
struct T_out // für alle Levels
{
UINT WrCmd; // was soll gemacht/gesetzt werden
UINT address; // z.B. bei Datenspeicher. Binär.
UCHAR datLen; // Anzahl nachfolgender Datenbytes
UCHAR inBuf[MAX_DATA_FROM_MASTER]; // kam so vom Master rein, soll ausgegeben werden
};
struct T_in // für alle Levels
{
UINT RdCmd; // was soll gemacht/gesetzt werden
UINT address; // z.B. bei Datenspeicher. Binär.
};
struct T_serial
{
// basic machine settings ("DIP-Switches")
// to be stored in eeprom
UCHAR crcCheckOn; // 1,0
UCHAR baudRate; // 1...8
UCHAR parity; // 'E' 'O' 'N'
//UCHAR myAddr; // not needed
//UCHAR NowTestmode; // 1=on
UCHAR dataBits; // 8
UCHAR stopBits; // 1
UCHAR pad6;
};
struct T_devices
{
// set by master, used(1) or notused (0) or type 2....20
// to be stored in eeprom
UCHAR kindOfPrinter; // 0:off 1:Gebe
UCHAR kindOfCoinChecker; // 0: without 1=EMP820 2=EMP900 3=currenza c² (MW)
UCHAR kindOfMifareReader; // by now only stronglink SL025 =1
UCHAR suppressSleepMode; // 0:sleep allowed 1: no sleep
UCHAR kindOfModem; // 0:off 1:Sunlink
UCHAR kindOfCreditcard; // 0:off 1:Feig NFC
UCHAR CoinEscrow;
UCHAR CoinRejectUnit;
UCHAR CoinShutter;
UCHAR BillAcceptor;
UCHAR usevaultLock;
UCHAR autoAlarm; // 1: switch on siren for 1min in doors opened unauthorized
UCHAR autoOpen; // 1: open door covers after valid ATBcard
UCHAR printAccReceipt; // 0/1
UCHAR printDoorReceipt;
UCHAR printTokenTicket;
UINT VaultFullWarnLevel;
UINT VaultFullErrorLevel;
};
/*
struct T_cashAccept // 1.version des cash.json files
{
// Values come from Json File
UINT coinsToAccept; // bit 15...0, je 1=accept 0=do not
UCHAR billsToAccept; // bit 7...0, je 1=accept 0=do not
UCHAR tokenChannel;
ULONG exchgRate; // Multiplikator local -->foreign currency
// eg: hungary: 380 (380Ft = 1EUR)
UINT foreignCoinValue[8];
UINT localCoinValues[8]; // read from coin checker
}; */
struct T_cashAccept
{
// all Values come from Json File
// struct will be stored in eeprom. respect 4byte-borders
UINT CoinDenomination[16]; // 15...8 =foreign coins 7..0 =local coins
UINT CoinValues[16]; // 15...8 =foreign coins 7..0 =local coins
// bei der lokalen Landeswährung wird der Wert eines Geldstückes
// direkt verwendet, da steht genau das gleiche drin wie in "Denom"
// Die ausländischen Münzen werden hier umgerechnet, z.B. 100cent=378Huf
//char Coins2Accept[16];
// kommt jetzt direkt aus Json und ersetzt:
UINT coinAcceptance; // bit 15...0, je 1=accept 0=do not
ULONG exchgRate; // Multiplikator local -->foreign currency
// eg: hungary: 380 (380Ft = 1EUR)
UCHAR tokenChannel; // 0=off, oder 1..16
UCHAR res1;
UCHAR res2;
UCHAR res3;
UINT billValues[8];
//UCHAR localTaxRate;
//UCHAR foreignTaxRate;
//UINT surcharge;
//UINT discount;
//UINT res4;
//UINT res5;
};
struct T_machID
{
// liegen im int. eeprom
// to be stored in eeprom
UINT customerNumber;
UINT machineNumber;
UINT borough; // =group
UINT zone;
UINT alias; // for example another machine number for customer
UINT firstrun;
UCHAR location[32];
};
struct T_moduleCondition
{
// store conditon of all system components, hold in RAM
// 0 means unknown, not yet tested/used
// 1 means OK
// 50..99 = HINT / Notification
// 100..150 = WARNING
// 200..250 = ERROR
UCHAR structStart; // always first!!!
UCHAR ram; // v
UCHAR intEe; // v
UCHAR extEe; // v
UCHAR rtc; // 1: time/date OK 100: time not plausible 200: hardware error
UCHAR boardHw; // v
UCHAR printer; // v
UCHAR modem; // v
UCHAR signal; // 1...99
UCHAR regist; // 100:not 1:reg 2:ping OK 3:gotTime
UCHAR mdbBus;
UCHAR coinChecker; // EMP, OMP or mei-cashflow
UCHAR coinEscrow; // v
UCHAR mifareReader; // v
UCHAR creditTerm; // not available
UCHAR coinReject; // v
UCHAR coinSafe; // v
UCHAR billSafe; // v
UCHAR voltage; // v // 1:11..14V
UCHAR temper; // v
UCHAR poweronTest;
UCHAR doorState; // 1: alles zu 200: tür offen + bit1(S) +bit2(CB) + bit3(CB)
UCHAR doorWasOpened; // 1: all doors are closed 200: any door was just opened
UCHAR changer; // can only be tested by usage
UCHAR coinBlocker; // can only be tested by usage
UCHAR billReader; // can only be tested by usage
UCHAR ResetReason;
UCHAR allModulesChecked;
UCHAR alarmState;
UCHAR res11;
UCHAR res12;
UCHAR res13;
};
struct T_dynamicCondition
{
// dynamic conditions, change rapidly and frequently
// these are values for the Heartbeat
// Türschalter entprellt:
char upperDoor; // 0:fehlt 1:drin
char middleDoor;
char lowerDoor;
char coinBox;
char billBox;
char modeAbrech;
char onAlarm;
char nowCardTest;
char nowPayment;
char lastMifCardType;
char openedAuthorized;
char allDoorsDebounced;
UCHAR lastSDoorState;
UCHAR lastVDoorState;
UCHAR CBinDebounced;
UCHAR lastCBstate;
char paymentInProgress;
char res1;
char res2;
char res3;
UINT U_Batt;
UINT Temperatur;
UINT cash_storedaccNumbers[8]; // List all stored accounting numbers in ext. eeprom
UINT nrCoinsInBox;
UINT resui1;
ULONG amountInBox;
ULONG amountJustPaid;
UINT lastInsCoinType; // wahrscheinlich uchar
UINT resui2;
ULONG totalTransVolume;
ULONG totalNrOfVends;
};
#endif