PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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