1/*
2 * File: ert_main.c
3 *
4 * Code generated for Simulink model 'ADM_Integrated_Logic'.
5 *
6 * Model version : 7.13
7 * Simulink Coder version : 9.5 (R2021a) 14-Nov-2020
8 * C/C++ source code generated on : Wed Jul 16 16:53:18 2025
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: NXP->Cortex-M4
12 * Code generation objectives:
13 * 1. Execution efficiency
14 * 2. RAM efficiency
15 * 3. Debugging
16 * Validation result: Not run
17 */
18
19#include <stddef.h>
20#include <stdio.h> /* This ert_main.c example uses printf/fflush */
21#include "ADM_Integrated_Logic.h" /* Model's header file */
22#include "rtwtypes.h"
23
24/*
25 * Associating rt_OneStep with a real-time clock or interrupt service routine
26 * is what makes the generated code "real-time". The function rt_OneStep is
27 * always associated with the base rate of the model. Subrates are managed
28 * by the base rate from inside the generated code. Enabling/disabling
29 * interrupts and floating point context switches are target specific. This
30 * example code indicates where these should take place relative to executing
31 * the generated code step function. Overrun behavior should be tailored to
32 * your application needs. This example simply sets an error status in the
33 * real-time model and returns from rt_OneStep.
34 */
35void rt_OneStep(void);
36void rt_OneStep(void)
37{
38 static boolean_T OverrunFlag = false;
39
40 /* Disable interrupts here */
41
42 /* Check for overrun */
43 if (OverrunFlag) {
44 rtmSetErrorStatus(ADM_Integrated_Logic_M, "Overrun");
45 return;
46 }
47
48 OverrunFlag = true;
49
50 /* Save FPU context here (if necessary) */
51 /* Re-enable timer or interrupt here */
52 /* Set model inputs here */
53
54 /* Step the model */
55 ADM_Integrated_Logic_step();
56
57 /* Get model outputs here */
58
59 /* Indicate task complete */
60 OverrunFlag = false;
61
62 /* Disable interrupts here */
63 /* Restore FPU context here (if necessary) */
64 /* Enable interrupts here */
65}
66
67/*
68 * The example "main" function illustrates what is required by your
69 * application code to initialize, execute, and terminate the generated code.
70 * Attaching rt_OneStep to a real-time clock is target specific. This example
71 * illustrates how you do this relative to initializing the model.
72 */
73int_T main(int_T argc, const char *argv[])
74{
75 /* Unused arguments */
76 (void)(argc);
77 (void)(argv);
78
79 /* Initialize model */
80 ADM_Integrated_Logic_initialize();
81
82 /* Attach rt_OneStep to a timer or interrupt service routine with
83 * period 0.002 seconds (the model's base sample time) here. The
84 * call syntax for rt_OneStep is
85 *
86 * rt_OneStep();
87 */
88 printf("Warning: The simulation will run forever. "
89 "Generated ERT main won't simulate model step behavior. "
90 "To change this behavior select the 'MAT-file logging' option.\n");
91 fflush((NULL));
92 while (rtmGetErrorStatus(ADM_Integrated_Logic_M) == (NULL)) {
93 /* Perform other application tasks here */
94 }
95
96 /* Disable rt_OneStep() here */
97 return 0;
98}
99
100/*
101 * File trailer for generated code.
102 *
103 * [EOF]
104 */
105