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 /*---------- global variables, in realtime.c ----------*/
78 extern CommandInput cmdi;
79 extern int picio_send_noise;
81 #define UPO (&(cmdi.out))
83 /*---------- from/for startup.c ----------*/
87 void sta_startup(void);
88 void serial_moredata(PicInsn *buf);
90 extern StartupState sta_state;
91 extern const char *const stastatelist[];
93 /*---------- from/for record.c and persist.c ----------*/
95 void records_parse(const char **argv);
96 void persist_entrails_interpret(void);
97 void persist_entrails_run_converter(void);
98 void persist_install(void);
100 extern const char *persist_fn;
101 extern const char *persist_record_converted;
103 void persist_map_veryearly(void);
105 /*---------- from/for realtime.c ----------*/
107 void oupicio(const char *dirn, const PicInsnInfo *pii, int objnum);
108 void ouhex(const char *word, const Byte *command, int length);
110 void serial_transmit(const PicInsn *pi);
112 /*---------- from actual.c ----------*/
114 int picinsn_polarity_testbit(const PicInsn *pi, const SegmentInfo *segi);
115 /* this belongs in {au,skel}proto-pic.[ch] really but it's
116 * more convenient here. */
118 /*---------- tbi ----------*/
120 void abandon_run(void);
124 #define PERSIST_CONVERT_OPTION "--persist-convert-entrails"
129 #endif /*REALTIME_H*/