/elekIOServ/mirrorcom.h

http://github.com/Yniold/liftsrc · C Header · 97 lines · 54 code · 19 blank · 24 comment · 0 complexity · 6b98075a2b07f0d156eaf80200c10e84 MD5 · raw file

  1. // ============================================
  2. // Mirror.h
  3. // Headerfile
  4. // ============================================
  5. // $RCSfile: mirrorcom.h,v $ last changed on $Date: 2007/03/08 19:50:29 $ by $Author: harder $
  6. // History:
  7. //
  8. // $Log: mirrorcom.h,v $
  9. // Revision 1.2 2007/03/08 19:50:29 harder
  10. // added idle state and allow only new command when idle
  11. //
  12. // Revision 1.1 2007-03-05 16:28:36 martinez
  13. // implemented mirrors
  14. //
  15. // Revision 1.1 2007-2-27 14:34:59 martinez
  16. //
  17. //
  18. //
  19. #ifndef Mirror_H
  20. #define Mirror_H
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <unistd.h>
  24. #include <time.h>
  25. #include <string.h>
  26. #include <sys/types.h>
  27. #include <sys/socket.h>
  28. #include <sys/time.h>
  29. #include <netinet/in.h>
  30. #include <arpa/inet.h>
  31. #include <netdb.h>
  32. #ifndef false
  33. #define false 0
  34. #endif
  35. #ifndef true
  36. #define true (!false)
  37. #endif
  38. // ====================================
  39. // Globals for Mirror Control Thread
  40. // ====================================
  41. extern long lMirrorBaudrate;
  42. extern int iMirrorFile;
  43. extern unsigned char ucMirrorDeviceName[];
  44. extern unsigned char ucMirrorDeviceOpened;
  45. extern char aMirrorRxBuffer[];
  46. enum PosCommandStatus
  47. {
  48. POS_IDLE,
  49. POS_PREP0,
  50. POS_PREP1,
  51. POS_PREP2,
  52. POS_PREP3,
  53. POS_MOVING,
  54. MAX_POS_STATUS
  55. };
  56. struct sMirrorType
  57. {
  58. int iFD;
  59. uint16_t Mirror;
  60. uint16_t Axis;
  61. int32_t RelPositionSet;
  62. int32_t CurrentRelPos;
  63. int32_t CurrentAbsPos;
  64. uint16_t CommandSent;
  65. uint16_t PosCommandStatus;
  66. uint16_t ReadPosCommand;
  67. uint16_t StopFlag;
  68. };
  69. extern struct sMirrorType sMirrorThread;
  70. extern pthread_mutex_t mMirrorMutex;
  71. // ====================================
  72. // prototypes
  73. // ====================================
  74. extern int MirrorInit(void);
  75. extern void MirrorThreadFunc(void* pArgument);
  76. extern void MirrorParseLine(char* aBuffer, int iLength, struct sMirrorType* sStructure);
  77. extern void MirrorUpdateData(void);
  78. #endif