/ src / emc / motion / motion_debug.h
motion_debug.h
 1  /********************************************************************
 2  * Description: motion_debug.h
 3  *   A data structure used in only a few places
 4  *
 5  * Author:
 6  * License: GPL Version 2
 7  * System: Linux
 8  *
 9  * Copyright (c) 2004 All rights reserved
10  ********************************************************************/
11  
12  #ifndef MOTION_DEBUG_H
13  #define MOTION_DEBUG_H
14  
15  /*! \todo needs mot_priv.h, but including here causes conflicts */
16  #include "tp.h"			/* TP_STRUCT */
17  #include "tc.h"			/* TC_STRUCT, TC_QUEUE_STRUCT */
18  #include "motion.h"             // EMC_TELEOP_DATA
19  
20  /*********************************
21          DEBUG STRUCTURE
22  *********************************/
23  
24  /* This is the debug structure.  I guess it was intended to make some
25     of the motion controller's internal variables visible from user
26     space for debugging, but it has evolved into a monster.
27     180K last time I checked - most of it (174K or so) is the traj
28     planner queues... each entry is 720 bytes, and there are 210
29     entries in the main queue.
30     I'll figure it out eventually though.
31     Low level things will be exported thru the HAL so they can be
32     monitored with halscope.  High level things will remain here,
33     and things that are internal will be moved to a private structure.
34  */
35  
36  /*! \todo FIXME - this struct is broken into two parts... at the top are
37     structure members that I understand, and that are needed for emc2.
38     Other structure members follow.  All the later ones need to be
39     evaluated - either they move up, or they go away.
40  */
41  
42  /*! \todo FIXME - this has become a dumping ground for all kinds of stuff */
43  
44  typedef struct emcmot_debug_t {
45  	unsigned char head;	/* flag count for mutex detect */
46  
47  /*! \todo FIXME - all structure members beyond this point are in limbo */
48  
49  	int split;		/* number of split command reads */
50  
51  	TP_STRUCT coord_tp;	/* coordinated mode planner */
52  
53  /* space for trajectory planner queues, plus 10 more for safety */
54  /*! \todo FIXME-- default is used; dynamic is not honored */
55  	TC_STRUCT queueTcSpace[DEFAULT_TC_QUEUE_SIZE + 10];
56  
57  	int enabling;		/* starts up disabled */
58  	int coordinating;	/* starts up in free mode */
59  	int teleoperating;	/* starts up in free mode */
60  
61  	int overriding;		/* non-zero means we've initiated an joint
62  				   move while overriding limits */
63  
64  	int stepping;
65  	int idForStep;
66  
67  #ifdef STRUCTS_IN_SHMEM
68  	emcmot_joint_t joints[EMCMOT_MAX_JOINTS];	/* joint data */
69  	emcmot_axis_t axes[EMCMOT_MAX_AXIS];	        /* axis data */
70  #endif
71  
72  	double start_time;
73  	double running_time;
74  	double cur_time;
75  	double last_time;
76  	unsigned char tail;	/* flag count for mutex detect */
77      } emcmot_debug_t;
78  
79  #endif // MOTION_DEBUG_H