2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28 #define GRAVITY 9.80665
33 #define AO_DATA_RING 64
34 #define ao_data_ring_next(n) (((n) + 1) & (AO_DATA_RING - 1))
35 #define ao_data_ring_prev(n) (((n) - 1) & (AO_DATA_RING - 1))
37 #define AO_M_TO_HEIGHT(m) ((int16_t) (m))
38 #define AO_MS_TO_SPEED(ms) ((int16_t) ((ms) * 16))
39 #define AO_MSS_TO_ACCEL(mss) ((int16_t) ((mss) * 16))
41 #define AO_GPS_NEW_DATA 1
42 #define AO_GPS_NEW_TRACKING 2
47 #define AO_ADC_NUM_SENSE 6
53 int16_t sense[AO_ADC_NUM_SENSE];
62 * One set of samples read from the A/D converter
65 int16_t accel; /* accelerometer */
66 int16_t pres; /* pressure sensor */
67 int16_t pres_real; /* unclipped */
68 int16_t temp; /* temperature sensor */
69 int16_t v_batt; /* battery voltage */
70 int16_t sense_d; /* drogue continuity sense */
71 int16_t sense_m; /* main continuity sense */
76 #define HAS_ACCEL_REF 0
95 #define to_fix16(x) ((int16_t) ((x) * 65536.0 + 0.5))
96 #define to_fix32(x) ((int32_t) ((x) * 65536.0 + 0.5))
97 #define from_fix(x) ((x) >> 16)
100 * Above this height, the baro sensor doesn't work
102 #define AO_BARO_SATURATE 13000
103 #define AO_MIN_BARO_VALUE ao_altitude_to_pres(AO_BARO_SATURATE)
106 * Above this speed, baro measurements are unreliable
108 #define AO_MAX_BARO_SPEED 200
110 #define ACCEL_NOSE_UP (ao_accel_2g >> 2)
112 extern enum ao_flight_state ao_flight_state;
117 volatile struct ao_data ao_data_ring[AO_DATA_RING];
118 volatile uint8_t ao_data_head;
122 #define ao_led_off(l)
123 #define ao_timer_set_adc_interval(i)
124 #define ao_wakeup(wchan) ao_dump_state()
125 #define ao_cmd_register(c)
126 #define ao_usb_disable()
127 #define ao_telemetry_set_interval(x)
128 #define ao_rdf_set(rdf)
129 #define ao_packet_slave_start()
130 #define ao_packet_slave_stop()
133 ao_igniter_drogue = 0,
137 struct ao_data ao_data_static;
146 static int32_t ao_k_height;
151 return ao_data_static.tick;
155 ao_delay(int16_t interval)
161 ao_ignite(enum ao_igniter igniter)
163 double time = (double) (ao_data_static.tick + tick_offset) / 100;
165 if (igniter == ao_igniter_drogue) {
167 drogue_height = ao_k_height >> 16;
170 main_height = ao_k_height >> 16;
178 #define ao_add_task(t,f,n) ((void) (t))
180 #define ao_log_start()
181 #define ao_log_stop()
183 #define AO_MS_TO_TICKS(ms) ((ms) / 10)
184 #define AO_SEC_TO_TICKS(s) ((s) * 100)
186 #define AO_FLIGHT_TEST
194 double emulator_error_max = 4;
195 double emulator_height_error_max = 20; /* noise in the baro sensor */
201 ao_sleep(void *wchan);
203 const char const * const ao_state_names[] = {
204 "startup", "idle", "pad", "boost", "fast",
205 "coast", "drogue", "main", "landed", "invalid"
213 #define ao_xmemcpy(d,s,c) memcpy(d,s,c)
214 #define ao_xmemset(d,v,c) memset(d,v,c)
215 #define ao_xmemcmp(d,s,c) memcmp(d,s,c)
217 #define AO_NEED_ALTITUDE_TO_PRES 1
219 #include "ao_convert_pa.c"
220 #include <ao_ms5607.h>
221 struct ao_ms5607_prom ms5607_prom;
222 #include "ao_ms5607_convert.c"
223 #define AO_PYRO_NUM 4
226 #include "ao_convert.c"
230 uint16_t main_deploy;
231 int16_t accel_plus_g;
232 int16_t accel_minus_g;
233 uint8_t pad_orientation;
234 uint16_t apogee_lockout;
236 struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */
240 #define AO_PAD_ORIENTATION_ANTENNA_UP 0
241 #define AO_PAD_ORIENTATION_ANTENNA_DOWN 1
243 #define ao_config_get()
245 struct ao_config ao_config;
247 #define DATA_TO_XDATA(x) (x)
250 extern int16_t ao_ground_accel, ao_flight_accel;
251 extern int16_t ao_accel_2g;
253 typedef int16_t accel_t;
255 extern uint16_t ao_sample_tick;
257 extern alt_t ao_sample_height;
258 extern accel_t ao_sample_accel;
259 extern int32_t ao_accel_scale;
260 extern alt_t ao_ground_height;
261 extern alt_t ao_sample_alt;
263 double ao_sample_qangle;
265 int ao_sample_prev_tick;
269 #include "ao_kalman.c"
271 #include "ao_sample.c"
272 #include "ao_flight.c"
274 #define AO_PYRO_NUM 4
282 ao_pyro_pin_set(uint8_t pin, uint8_t value)
284 printf ("set pyro %d %d\n", pin, value);
290 #define to_double(f) ((f) / 65536.0)
292 static int ao_records_read = 0;
293 static int ao_eof_read = 0;
294 static int ao_flight_ground_accel;
295 static int ao_flight_started = 0;
296 static int ao_test_max_height;
297 static double ao_test_max_height_time;
298 static int ao_test_main_height;
299 static double ao_test_main_height_time;
300 static double ao_test_landed_time;
301 static double ao_test_landed_height;
302 static double ao_test_landed_time;
303 static int landed_set;
304 static double landed_time;
305 static double landed_height;
308 static struct ao_mpu6000_sample ao_ground_mpu6000;
317 double landed_time_error;
319 if (!ao_test_main_height_time) {
320 ao_test_main_height_time = ao_test_max_height_time;
321 ao_test_main_height = ao_test_max_height;
323 drogue_error = fabs(ao_test_max_height_time - drogue_time);
324 main_error = fabs(ao_test_main_height_time - main_time);
325 landed_error = fabs(ao_test_landed_height - landed_height);
326 landed_time_error = ao_test_landed_time - landed_time;
327 if (drogue_error > emulator_error_max || main_error > emulator_error_max) {
329 emulator_app, emulator_name);
331 printf ("\t%s\n", emulator_info);
332 printf ("\tApogee error %g\n", drogue_error);
333 printf ("\tMain error %g\n", main_error);
334 printf ("\tLanded height error %g\n", landed_error);
335 printf ("\tLanded time error %g\n", landed_time_error);
336 printf ("\tActual: apogee: %d at %7.2f main: %d at %7.2f landed %7.2f at %7.2f\n",
337 ao_test_max_height, ao_test_max_height_time,
338 ao_test_main_height, ao_test_main_height_time,
339 ao_test_landed_height, ao_test_landed_time);
340 printf ("\tComputed: apogee: %d at %7.2f main: %d at %7.2f landed %7.2f at %7.2f\n",
341 drogue_height, drogue_time, main_height, main_time,
342 landed_height, landed_time);
353 ao_data_ring[ao_data_head] = ao_data_static;
354 ao_data_head = ao_data_ring_next(ao_data_head);
355 if (ao_flight_state != ao_flight_startup) {
357 double accel = ((ao_flight_ground_accel - ao_data_accel_cook(&ao_data_static)) * GRAVITY * 2.0) /
358 (ao_config.accel_minus_g - ao_config.accel_plus_g);
365 ao_ms5607_convert(&ao_data_static.ms5607_raw, &ao_data_static.ms5607_cooked);
366 height = ao_pa_to_altitude(ao_data_static.ms5607_cooked.pres) - ao_ground_height;
368 double height = ao_pres_to_altitude(ao_data_static.adc.pres_real) - ao_ground_height;
372 tick_offset = -ao_data_static.tick;
373 if ((prev_tick - ao_data_static.tick) > 0x400)
374 tick_offset += 65536;
375 prev_tick = ao_data_static.tick;
376 time = (double) (ao_data_static.tick + tick_offset) / 100;
378 if (ao_test_max_height < height) {
379 ao_test_max_height = height;
380 ao_test_max_height_time = time;
381 ao_test_landed_height = height;
382 ao_test_landed_time = time;
384 if (height > ao_config.main_deploy) {
385 ao_test_main_height_time = time;
386 ao_test_main_height = height;
389 if (ao_test_landed_height > height) {
390 ao_test_landed_height = height;
391 ao_test_landed_time = time;
394 if (ao_flight_state == ao_flight_landed && !landed_set) {
397 landed_height = height;
401 printf("%7.2f height %8.2f accel %8.3f "
404 /* "accel_x %8.3f accel_y %8.3f accel_z %8.3f gyro_x %8.3f gyro_y %8.3f gyro_z %8.3f " */
406 "state %-8.8s k_height %8.2f k_speed %8.3f k_accel %8.3f avg_height %5d drogue %4d main %4d error %5d\n",
413 ao_mpu6000_accel(ao_data_static.mpu6000.accel_x),
414 ao_mpu6000_accel(ao_data_static.mpu6000.accel_y),
415 ao_mpu6000_accel(ao_data_static.mpu6000.accel_z),
416 ao_mpu6000_gyro(ao_data_static.mpu6000.gyro_x - ao_ground_mpu6000.gyro_x),
417 ao_mpu6000_gyro(ao_data_static.mpu6000.gyro_y - ao_ground_mpu6000.gyro_y),
418 ao_mpu6000_gyro(ao_data_static.mpu6000.gyro_z - ao_ground_mpu6000.gyro_z),
421 ao_state_names[ao_flight_state],
422 ao_k_height / 65536.0,
423 ao_k_speed / 65536.0 / 16.0,
424 ao_k_accel / 65536.0 / 16.0,
430 // if (ao_flight_state == ao_flight_landed)
436 #define AO_MAX_CALLSIGN 8
437 #define AO_MAX_VERSION 8
438 #define AO_MAX_TELEMETRY 128
440 struct ao_telemetry_generic {
441 uint16_t serial; /* 0 */
442 uint16_t tick; /* 2 */
443 uint8_t type; /* 4 */
444 uint8_t payload[27]; /* 5 */
448 #define AO_TELEMETRY_SENSOR_TELEMETRUM 0x01
449 #define AO_TELEMETRY_SENSOR_TELEMINI 0x02
450 #define AO_TELEMETRY_SENSOR_TELENANO 0x03
452 struct ao_telemetry_sensor {
453 uint16_t serial; /* 0 */
454 uint16_t tick; /* 2 */
455 uint8_t type; /* 4 */
457 uint8_t state; /* 5 flight state */
458 int16_t accel; /* 6 accelerometer (TM only) */
459 int16_t pres; /* 8 pressure sensor */
460 int16_t temp; /* 10 temperature sensor */
461 int16_t v_batt; /* 12 battery voltage */
462 int16_t sense_d; /* 14 drogue continuity sense (TM/Tm) */
463 int16_t sense_m; /* 16 main continuity sense (TM/Tm) */
465 int16_t acceleration; /* 18 m/s² * 16 */
466 int16_t speed; /* 20 m/s * 16 */
467 int16_t height; /* 22 m */
469 int16_t ground_pres; /* 24 average pres on pad */
470 int16_t ground_accel; /* 26 average accel on pad */
471 int16_t accel_plus_g; /* 28 accel calibration at +1g */
472 int16_t accel_minus_g; /* 30 accel calibration at -1g */
476 #define AO_TELEMETRY_CONFIGURATION 0x04
478 struct ao_telemetry_configuration {
479 uint16_t serial; /* 0 */
480 uint16_t tick; /* 2 */
481 uint8_t type; /* 4 */
483 uint8_t device; /* 5 device type */
484 uint16_t flight; /* 6 flight number */
485 uint8_t config_major; /* 8 Config major version */
486 uint8_t config_minor; /* 9 Config minor version */
487 uint16_t apogee_delay; /* 10 Apogee deploy delay in seconds */
488 uint16_t main_deploy; /* 12 Main deploy alt in meters */
489 uint16_t flight_log_max; /* 14 Maximum flight log size in kB */
490 char callsign[AO_MAX_CALLSIGN]; /* 16 Radio operator identity */
491 char version[AO_MAX_VERSION]; /* 24 Software version */
495 #define AO_TELEMETRY_LOCATION 0x05
497 #define AO_GPS_MODE_NOT_VALID 'N'
498 #define AO_GPS_MODE_AUTONOMOUS 'A'
499 #define AO_GPS_MODE_DIFFERENTIAL 'D'
500 #define AO_GPS_MODE_ESTIMATED 'E'
501 #define AO_GPS_MODE_MANUAL 'M'
502 #define AO_GPS_MODE_SIMULATED 'S'
504 struct ao_telemetry_location {
505 uint16_t serial; /* 0 */
506 uint16_t tick; /* 2 */
507 uint8_t type; /* 4 */
509 uint8_t flags; /* 5 Number of sats and other flags */
510 int16_t altitude; /* 6 GPS reported altitude (m) */
511 int32_t latitude; /* 8 latitude (degrees * 10⁷) */
512 int32_t longitude; /* 12 longitude (degrees * 10⁷) */
513 uint8_t year; /* 16 (- 2000) */
514 uint8_t month; /* 17 (1-12) */
515 uint8_t day; /* 18 (1-31) */
516 uint8_t hour; /* 19 (0-23) */
517 uint8_t minute; /* 20 (0-59) */
518 uint8_t second; /* 21 (0-59) */
519 uint8_t pdop; /* 22 (m * 5) */
520 uint8_t hdop; /* 23 (m * 5) */
521 uint8_t vdop; /* 24 (m * 5) */
522 uint8_t mode; /* 25 */
523 uint16_t ground_speed; /* 26 cm/s */
524 int16_t climb_rate; /* 28 cm/s */
525 uint8_t course; /* 30 degrees / 2 */
526 uint8_t unused[1]; /* 31 */
530 #define AO_TELEMETRY_SATELLITE 0x06
532 struct ao_telemetry_satellite_info {
537 struct ao_telemetry_satellite {
538 uint16_t serial; /* 0 */
539 uint16_t tick; /* 2 */
540 uint8_t type; /* 4 */
541 uint8_t channels; /* 5 number of reported sats */
543 struct ao_telemetry_satellite_info sats[12]; /* 6 */
544 uint8_t unused[2]; /* 30 */
548 union ao_telemetry_all {
549 struct ao_telemetry_generic generic;
550 struct ao_telemetry_sensor sensor;
551 struct ao_telemetry_configuration configuration;
552 struct ao_telemetry_location location;
553 struct ao_telemetry_satellite satellite;
557 uint16(uint8_t *bytes, int off)
559 return (uint16_t) bytes[off] | (((uint16_t) bytes[off+1]) << 8);
563 int16(uint8_t *bytes, int off)
565 return (int16_t) uint16(bytes, off);
569 uint32(uint8_t *bytes, int off)
571 return (uint32_t) bytes[off] | (((uint32_t) bytes[off+1]) << 8) |
572 (((uint32_t) bytes[off+2]) << 16) |
573 (((uint32_t) bytes[off+3]) << 24);
577 int32(uint8_t *bytes, int off)
579 return (int32_t) uint32(bytes, off);
582 static int log_format;
585 ao_sleep(void *wchan)
587 if (wchan == &ao_data_head) {
590 uint16_t a = 0, b = 0;
592 union ao_telemetry_all telem;
600 if (ao_flight_state >= ao_flight_boost && ao_flight_state < ao_flight_landed)
604 if (ao_records_read > 2 && ao_flight_state == ao_flight_startup)
607 ao_data_static.mpu6000 = ao_ground_mpu6000;
609 ao_data_static.adc.accel = ao_flight_ground_accel;
615 if (!fgets(line, sizeof (line), emulator_in)) {
616 if (++ao_eof_read >= 1000) {
618 printf ("no more data, exiting simulation\n");
621 ao_data_static.tick += 10;
626 for (nword = 0; nword < 64; nword++) {
627 words[nword] = strtok_r(l, " \t\n", &saveptr);
629 if (words[nword] == NULL)
633 if (log_format == AO_LOG_FORMAT_TELEMEGA && nword == 30 && strlen(words[0]) == 1) {
635 struct ao_ms5607_value value;
638 tick = strtoul(words[1], NULL, 16);
639 // printf ("%c %04x", type, tick);
640 for (i = 2; i < nword; i++) {
641 bytes[i - 2] = strtoul(words[i], NULL, 16);
642 // printf(" %02x", bytes[i-2]);
647 ao_flight_ground_accel = int16(bytes, 2);
648 ao_flight_started = 1;
649 ao_ground_pres = int32(bytes, 4);
650 ao_ground_height = ao_pa_to_altitude(ao_ground_pres);
653 ao_data_static.tick = tick;
654 ao_data_static.ms5607_raw.pres = int32(bytes, 0);
655 ao_data_static.ms5607_raw.temp = int32(bytes, 4);
656 ao_ms5607_convert(&ao_data_static.ms5607_raw, &value);
657 ao_data_static.mpu6000.accel_x = int16(bytes, 8);
658 ao_data_static.mpu6000.accel_y = -int16(bytes, 10);
659 ao_data_static.mpu6000.accel_z = int16(bytes, 12);
660 ao_data_static.mpu6000.gyro_x = int16(bytes, 14);
661 ao_data_static.mpu6000.gyro_y = -int16(bytes, 16);
662 ao_data_static.mpu6000.gyro_z = int16(bytes, 18);
664 ao_data_static.mma655x = int16(bytes, 26);
671 } else if (nword == 3 && strcmp(words[0], "ms5607") == 0) {
672 if (strcmp(words[1], "reserved:") == 0)
673 ms5607_prom.reserved = strtoul(words[2], NULL, 10);
674 else if (strcmp(words[1], "sens:") == 0)
675 ms5607_prom.sens = strtoul(words[2], NULL, 10);
676 else if (strcmp(words[1], "off:") == 0)
677 ms5607_prom.off = strtoul(words[2], NULL, 10);
678 else if (strcmp(words[1], "tcs:") == 0)
679 ms5607_prom.tcs = strtoul(words[2], NULL, 10);
680 else if (strcmp(words[1], "tco:") == 0)
681 ms5607_prom.tco = strtoul(words[2], NULL, 10);
682 else if (strcmp(words[1], "tref:") == 0)
683 ms5607_prom.tref = strtoul(words[2], NULL, 10);
684 else if (strcmp(words[1], "tempsens:") == 0)
685 ms5607_prom.tempsens = strtoul(words[2], NULL, 10);
686 else if (strcmp(words[1], "crc:") == 0)
687 ms5607_prom.crc = strtoul(words[2], NULL, 10);
689 } else if (nword >= 3 && strcmp(words[0], "Pyro") == 0) {
690 int p = strtoul(words[1], NULL, 10);
692 struct ao_pyro *pyro = &ao_config.pyro[p];
694 for (i = 2; i < nword; i++) {
695 for (j = 0; j < NUM_PYRO_VALUES; j++)
696 if (!strcmp (words[2], ao_pyro_values[j].name))
698 if (j == NUM_PYRO_VALUES)
700 pyro->flags |= ao_pyro_values[j].flag;
701 if (ao_pyro_values[j].offset != NO_VALUE && i + 1 < nword) {
702 int16_t val = strtoul(words[++i], NULL, 10);
703 *((int16_t *) ((char *) pyro + ao_pyro_values[j].offset)) = val;
708 if (nword == 4 && log_format != AO_LOG_FORMAT_TELEMEGA) {
710 tick = strtoul(words[1], NULL, 16);
711 a = strtoul(words[2], NULL, 16);
712 b = strtoul(words[3], NULL, 16);
717 else if (nword == 2 && strcmp(words[0], "log-format") == 0) {
718 log_format = strtoul(words[1], NULL, 10);
719 } else if (nword >= 6 && strcmp(words[0], "Accel") == 0) {
720 ao_config.accel_plus_g = atoi(words[3]);
721 ao_config.accel_minus_g = atoi(words[5]);
722 } else if (nword >= 4 && strcmp(words[0], "Main") == 0) {
723 ao_config.main_deploy = atoi(words[2]);
724 } else if (nword >= 3 && strcmp(words[0], "Apogee") == 0 &&
725 strcmp(words[1], "lockout:") == 0) {
726 ao_config.apogee_lockout = atoi(words[2]);
727 } else if (nword >= 36 && strcmp(words[0], "CALL") == 0) {
728 tick = atoi(words[10]);
729 if (!ao_flight_started) {
732 ao_flight_started = 1;
738 } else if (nword == 3 && strcmp(words[0], "BARO") == 0) {
739 tick = strtol(words[1], NULL, 16);
741 b = strtol(words[2], NULL, 10);
743 if (!ao_flight_started) {
744 ao_flight_ground_accel = 16384 - 328;
745 ao_config.accel_plus_g = 16384 - 328;
746 ao_config.accel_minus_g = 16384 + 328;
747 ao_flight_started = 1;
749 } else if (nword == 2 && strcmp(words[0], "TELEM") == 0) {
750 __xdata char *hex = words[1];
756 if (len > sizeof (bytes) * 2) {
757 len = sizeof (bytes)*2;
760 for (i = 0; i < len; i += 2) {
764 bytes[i/2] = (uint8_t) strtol(elt, NULL, 16);
767 if (bytes[0] != len - 2) {
768 printf ("bad length %d != %d\n", bytes[0], len - 2);
772 for (i = 1; i < len-1; i++)
774 if (sum != bytes[len-1]) {
775 printf ("bad checksum\n");
778 if ((bytes[len-2] & 0x80) == 0) {
782 ao_xmemcpy(&telem, bytes + 1, 32);
783 tick = telem.generic.tick;
784 switch (telem.generic.type) {
785 case AO_TELEMETRY_SENSOR_TELEMETRUM:
786 case AO_TELEMETRY_SENSOR_TELEMINI:
787 case AO_TELEMETRY_SENSOR_TELENANO:
788 if (!ao_flight_started) {
789 ao_flight_ground_accel = telem.sensor.ground_accel;
790 ao_config.accel_plus_g = telem.sensor.accel_plus_g;
791 ao_config.accel_minus_g = telem.sensor.accel_minus_g;
792 ao_flight_started = 1;
795 a = telem.sensor.accel;
796 b = telem.sensor.pres;
799 } else if (len == 99) {
800 ao_flight_started = 1;
801 tick = uint16(bytes+1, 21);
802 ao_flight_ground_accel = int16(bytes+1, 7);
803 ao_config.accel_plus_g = int16(bytes+1, 17);
804 ao_config.accel_minus_g = int16(bytes+1, 19);
806 a = int16(bytes+1, 23);
807 b = int16(bytes+1, 25);
808 } else if (len == 98) {
809 ao_flight_started = 1;
810 tick = uint16(bytes+1, 20);
811 ao_flight_ground_accel = int16(bytes+1, 6);
812 ao_config.accel_plus_g = int16(bytes+1, 16);
813 ao_config.accel_minus_g = int16(bytes+1, 18);
815 a = int16(bytes+1, 22);
816 b = int16(bytes+1, 24);
818 printf("unknown len %d\n", len);
822 if (type != 'F' && !ao_flight_started)
831 ao_flight_ground_accel = a;
832 if (ao_config.accel_plus_g == 0) {
833 ao_config.accel_plus_g = a;
834 ao_config.accel_minus_g = a + 530;
836 if (ao_config.main_deploy == 0)
837 ao_config.main_deploy = 250;
838 ao_flight_started = 1;
843 ao_data_static.tick = tick;
844 ao_data_static.adc.accel = a;
845 ao_data_static.adc.pres_real = b;
846 if (b < AO_MIN_BARO_VALUE)
847 b = AO_MIN_BARO_VALUE;
848 ao_data_static.adc.pres = b;
853 ao_data_static.tick = tick;
854 ao_data_static.adc.temp = a;
855 ao_data_static.adc.v_batt = b;
869 #define COUNTS_PER_G 264.8
876 static const struct option options[] = {
877 { .name = "summary", .has_arg = 0, .val = 's' },
878 { .name = "debug", .has_arg = 0, .val = 'd' },
879 { .name = "info", .has_arg = 1, .val = 'i' },
883 void run_flight_fixed(char *name, FILE *f, int summary, char *info)
885 emulator_name = name;
887 emulator_info = info;
888 ao_summary = summary;
894 main (int argc, char **argv)
906 while ((c = getopt_long(argc, argv, "sdi:", options, NULL)) != -1) {
921 run_flight_fixed("<stdin>", stdin, summary, info);
923 for (i = optind; i < argc; i++) {
924 FILE *f = fopen(argv[i], "r");
929 run_flight_fixed(argv[i], f, summary, info);