1/*
2 * File: ert_main.c
3 *
4 * Code generated for Simulink model 'Inverter_000_test'.
5 *
6 * Model version : 1.126
7 * Simulink Coder version : 8.14 (R2018a) 06-Feb-2018
8 * C/C++ source code generated on : Wed Apr 14 17:29:45 2021
9 *
10 * Target selection: ert.tlc
11 * Embedded hardware selection: Texas Instruments->C2000
12 * Code generation objectives: Unspecified
13 * Validation result: Not run
14 */
15
16#include "Inverter_000_test.h"
17#include "rtwtypes.h"
18
19volatile int IsrOverrun = 0;
20boolean_T isRateRunning[2] = { 0, 0 };
21
22boolean_T need2runFlags[2] = { 0, 0 };
23
24void rt_OneStep(void)
25{
26 boolean_T eventFlags[2];
27
28 /* Check base rate for overrun */
29 if (isRateRunning[0]++) {
30 IsrOverrun = 1;
31 isRateRunning[0]--; /* allow future iterations to succeed*/
32 return;
33 }
34
35 /*
36 * For a bare-board target (i.e., no operating system), the rates
37 * that execute this base step are buffered locally to allow for
38 * overlapping preemption. The generated code includes function
39 * writeCodeInfoFcn() which sets the rates
40 * that need to run this time step. The return values are 1 and 0
41 * for true and false, respectively.
42 */
43 Inverter_000_test_SetEventsForThisBaseStep(eventFlags);
44 enableTimer0Interrupt();
45 Inverter_000_test_step0();
46
47 /* Get model outputs here */
48 disableTimer0Interrupt();
49 isRateRunning[0]--;
50 if (eventFlags[1]) {
51 if (need2runFlags[1]++) {
52 IsrOverrun = 1;
53 need2runFlags[1]--; /* allow future iterations to succeed*/
54 return;
55 }
56 }
57
58 if (need2runFlags[1]) {
59 if (isRateRunning[1]) {
60 /* Yield to higher priority*/
61 return;
62 }
63
64 isRateRunning[1]++;
65 enableTimer0Interrupt();
66
67 /* Step the model for subrate "1" */
68 switch (1)
69 {
70 case 1 :
71 Inverter_000_test_step1();
72
73 /* Get model outputs here */
74 break;
75
76 default :
77 break;
78 }
79
80 disableTimer0Interrupt();
81 need2runFlags[1]--;
82 isRateRunning[1]--;
83 }
84}
85
86volatile boolean_T stopRequested = false;
87int main(void)
88{
89 volatile boolean_T runModel = true;
90 float modelBaseRate = 5.0E-5;
91 float systemClock = 200;
92 c2000_flash_init();
93 init_board();
94
95#ifdef MW_EXEC_PROFILER_ON
96
97 config_profilerTimer();
98
99#endif
100
101 ;
102 rtmSetErrorStatus(Inverter_000_test_M, 0);
103 Inverter_000_test_initialize();
104 configureTimer0(modelBaseRate, systemClock);
105 runModel =
106 rtmGetErrorStatus(Inverter_000_test_M) == (NULL);
107 enableTimer0Interrupt();
108 globalInterruptEnable();
109 while (runModel) {
110 stopRequested = !(
111 rtmGetErrorStatus(Inverter_000_test_M) == (NULL));
112 runModel = !(stopRequested);
113 }
114
115 /* Disable rt_OneStep() here */
116
117 /* Terminate model */
118 Inverter_000_test_terminate();
119 globalInterruptDisable();
120 return 0;
121}
122
123/*
124 * File trailer for generated code.
125 *
126 * [EOF]
127 */
128