2 * declarations for realtime daemon
9 #include "auproto-pic.h"
20 #include <sys/types.h>
30 #include "../layout/layout-data.h"
32 typedef struct Segment Segment;
33 typedef struct Train Train;
35 /*---------- from retransmit.c ----------*/
37 typedef struct RetransmitRelaxedNode RetransmitRelaxedNode;
38 typedef union RetransmitUrgentNode RetransmitUrgentNode;
39 typedef unsigned Retransmit__Time;
41 /* Contents of the retransmission nodes is generally all for use by
42 * retransmit.c only; as a special exception, caller may edit pi
43 * directly. Normally, though, pi is set by supplying an NMRA
44 * command to one of the _queue functions; iff the Nmra* is
45 * non-null, _queue will add an NMRA checksum and update pi.
47 struct RetransmitRelaxedNode {
49 DLIST_NODE(RetransmitRelaxedNode) rr;
51 union RetransmitUrgentNode {
54 RetransmitRelaxedNode relaxed;
56 Retransmit__Time when;
57 DLIST_NODE(RetransmitUrgentNode) queue;
61 void retransmit_start(void);
62 void retransmit_something(void);
64 void retransmit_relaxed_queue(RetransmitRelaxedNode *rn, Nmra *n);
65 void retransmit_relaxed_requeue(RetransmitRelaxedNode *rn, Nmra *n);
66 void retransmit_relaxed_cancel(RetransmitRelaxedNode *rn);
68 void retransmit_urgent_queue(RetransmitUrgentNode *rn, Nmra *n);
69 void retransmit_urgent_queue_relaxed(RetransmitUrgentNode *urg, Nmra *n);
70 void retransmit_urgent_requeue(RetransmitUrgentNode *rn, Nmra *n);
71 void retransmit_urgent_cancel(RetransmitUrgentNode *rn);
73 /* ... NB: these are NOT idempotent. Use _requeue it's queued;
74 * _requeue is just _cancel followed by queue. */
76 /*---------- features, filled in by record, used by features.c ----------*/
80 RetransmitRelaxedNode rn[4]; /* nmra feat setting cmds and speed cmd */
85 int bitval; /* may have no or several bits set */
86 int speedstep; /* -ve means backwards; 0 means not to use motor for feat */
91 char *featchs; /* null-terminated for convenience; _ means unused */
92 FeaturesFeature *feats; /* same order as featchs */
97 extern Segment *segments;
98 extern int n_feattargs;
99 extern FeaturesTarget *feattargs;
101 /*---------- global variables, in realtime.c ----------*/
103 extern CommandInput cmdi;
104 extern int picio_send_noise;
106 #define UPO (&(cmdi.out))
108 /*---------- from/for startup.c ----------*/
110 #include "stastate.h"
112 void sta_startup(void);
113 void serial_moredata(PicInsn *buf);
115 extern StartupState sta_state;
116 extern const char *const stastatelist[];
118 void resolve_begin(void); /* from resolve.c */
119 int resolve_complete(void);
121 /*---------- from/for record.c and persist.c ----------*/
123 void records_parse(const char **argv);
124 void persist_entrails_interpret(void);
125 void persist_entrails_run_converter(void);
126 void persist_install(void);
128 extern const char *persist_fn;
129 extern char *persist_record_converted;
131 void persist_map_veryearly(void);
133 /*---------- from/for realtime.c ----------*/
135 void oupicio(const char *dirn, const PicInsnInfo *pii, int objnum);
136 void ouhex(const char *word, const Byte *command, int length);
138 void serial_transmit(const PicInsn *pi);
139 int ps_needsegment(ParseState *ps, Segment **seg_r,
140 const SegmentInfo **segi_r);
142 /*---------- from actual.c ----------*/
144 int picinsn_polarity_testbit(const PicInsn *pi, const SegmentInfo *segi);
145 /* this belongs in {au,skel}proto-pic.[ch] really but it's
146 * more convenient here. */
148 /*---------- from movpos.c ----------*/
150 void points_turning_on(void);
151 void points_all_abandon(void);
153 /*---------- tbi ----------*/
155 void choreographers_all_abandon(void);
160 #define PERSIST_CONVERT_OPTION "--persist-convert-entrails"
165 #endif /*REALTIME_H*/