File: INCLUDE\MOTRSTRG\motorcontroller.h

    1 /*//////////////////////////////////////////////////////////////////////////////
    2 //                                                                            //
    3 // MOTORCONTROLLER.H                                                          //
    4 //                                                                            //
    5 // Subsystem : Motorsteuerung / Hardwarezugriff                                                           //
    6 //----------------------------------------------------------------------------//
    7 // Autoren:  René Harder, Alexander Paschold (2003)                                   //
    8 //                                                                            // 
    9 // Stand  : 23.05.2003                                                        //
   10 // letzter vollständiger Test:                                    //
   11 //                                                                            //
   12 //////////////////////////////////////////////////////////////////////////////*/
   13 
   14 #ifndef _MOTORCONTROLLER_H
   15 #define _MOTORCONTROLLER_H
   16 
   17 #include "hardware\hwio.h"
   18 
   19 #ifndef _MOTORCLASS 
   20 #if defined (Build_Motors)
21 #define _MOTORCLASS __declspec(dllexport)
22 #elif defined(Use_Motors)
23 #define _MOTORCLASS __declspec(dllimport)
24 #else 25 #define _MOTORCLASS 26 #endif 27 #endif 28 29 ///////////////////////////////////////////////////////////////// 30 // Controller für C-812 Motorsteuerkarte 31 class _MOTORCLASS TC_812Controller : public Controller 32 { 33 34 public: 35 TC_812Controller(EDeviceType DeviceID, LPTSTR HardwareID, DeviceList* Devices); 36 37 virtual BOOL Check(); 38 39 char Get(DWORD addr); 40 void Put(DWORD addr, BYTE data); 41 int PutChar(const char c); 42 char GetChar(void); 43 int ExecuteCmd(LPTSTR pString); 44 45 public: 46 DWORD oFlag; 47 DWORD oIn; 48 DWORD oOut1; 49 DWORD oOut2; 50 DWORD oDPRam; 51 }; 52 53 ///////////////////////////////////////////////////////////////// 54 // Controller für C-832 Motorsteuerkarte 55 class _MOTORCLASS TC_832Controller : public Controller 56 { 57 58 public: 59 TC_832Controller(EDeviceType DeviceID, LPTSTR HardwareID, DeviceList* Devices); 60 // Endlagen-Ueberwachung und Handling 61 static void CALLBACK LimitWatch( UINT, UINT, DWORD, DWORD, DWORD ); 62 63 virtual BOOL Check(); 64 65 public: 66 BYTE activeConfig; 67 WORD activeDrive; 68 WORD baddr; 69 // BYTE raddr; 70 71 // Endlagen-Ueberwachung und Handling 72 BOOL bLimitHit; 73 BOOL bIdle; 74 BOOL bIOActive; 75 76 private: 77 const WORD CmdRegister; 78 const WORD DataRegister; 79 DWORD dwSimBasePort; 80 81 //Hardwarezugriffsfunktionen (ehemals global) 82 private: 83 int GetWord(WORD base, WORD regaddr, unsigned short drive); 84 long GetDWord(WORD base, WORD regaddr, unsigned short drive); 85 void PutWord(int data, WORD base, WORD regaddr, unsigned short drive); 86 void PutDWord(long data, WORD base, WORD regaddr, unsigned short drive); 87 88 89 public: 90 void UpdateController(BYTE activeConfig, WORD activeDrive); 91 long Drive628c(BYTE cmd, WORD ctrl_word, long param, WORD base, WORD regaddr, unsigned short drive); 92 void Put(unsigned port, int value); 93 int Get(unsigned port); 94 BOOL LM628Ready(WORD base, unsigned short drive); 95 96 }; 97 98 99 #endif 100