1/*
2 * File: ert_main.c
3 *
4 * Code generated for Simulink model 'SMD_TF'.
5 *
6 * Model version : 1.7
7 * Simulink Coder version : 8.10 (R2016a) 10-Feb-2016
8 * C/C++ source code generated on : Sun Jun 05 15:55:07 2016
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: ARM Compatible->ARM Cortex
12 * Code generation objectives:
13 * 1. Execution efficiency
14 * 2. RAM efficiency
15 * Validation result: Not run
16 */
17
18#include <stddef.h>
19#include <stdio.h> /* This ert_main.c example uses printf/fflush */
20#include "SMD_TF.h" /* Model's header file */
21#include "rtwtypes.h"
22
23/*
24 * Associating rt_OneStep with a real-time clock or interrupt service routine
25 * is what makes the generated code "real-time". The function rt_OneStep is
26 * always associated with the base rate of the model. Subrates are managed
27 * by the base rate from inside the generated code. Enabling/disabling
28 * interrupts and floating point context switches are target specific. This
29 * example code indicates where these should take place relative to executing
30 * the generated code step function. Overrun behavior should be tailored to
31 * your application needs. This example simply sets an error status in the
32 * real-time model and returns from rt_OneStep.
33 */
34void rt_OneStep(void);
35void rt_OneStep(void)
36{
37 static boolean_T OverrunFlag = false;
38
39 /* Disable interrupts here */
40
41 /* Check for overrun */
42 if (OverrunFlag) {
43 rtmSetErrorStatus(rtM, "Overrun");
44 return;
45 }
46
47 OverrunFlag = true;
48
49 /* Save FPU context here (if necessary) */
50 /* Re-enable timer or interrupt here */
51 /* Set model inputs here */
52
53 /* Step the model for base rate */
54 SMD_TF_step();
55
56 /* Get model outputs here */
57
58 /* Indicate task complete */
59 OverrunFlag = false;
60
61 /* Disable interrupts here */
62 /* Restore FPU context here (if necessary) */
63 /* Enable interrupts here */
64}
65
66/*
67 * The example "main" function illustrates what is required by your
68 * application code to initialize, execute, and terminate the generated code.
69 * Attaching rt_OneStep to a real-time clock is target specific. This example
70 * illustrates how you do this relative to initializing the model.
71 */
72int_T main(int_T argc, const char *argv[])
73{
74 /* Unused arguments */
75 (void)(argc);
76 (void)(argv);
77
78 /* Initialize model */
79 SMD_TF_initialize();
80
81 /* Simulating the model step behavior (in non real-time) to
82 * simulate model behavior at stop time.
83 */
84 while ((rtmGetErrorStatus(rtM) == (NULL)) && !rtmGetStopRequested(rtM)) {
85 rt_OneStep();
86 }
87
88 /* Disable rt_OneStep() here */
89 return 0;
90}
91
92/*
93 * File trailer for generated code.
94 *
95 * [EOF]
96 */
97