]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/blobdiff - rpp/rpp/rpp_srmain.tlc
demo: Uncheck "Download to RPP"
[jenkicar/rpp-simulink.git] / rpp / rpp / rpp_srmain.tlc
index 36715f9b58fc61c4109d42e85306c8428a39bafa..5491f846af1ad57bc18411a192769acf17d61de2 100644 (file)
@@ -1,4 +1,4 @@
-%% Copyright (C) 2013-2014 Czech Technical University in Prague
+%% Copyright (C) 2013-2015 Czech Technical University in Prague
 %%
 %% Authors:
 %%     - Carlos Jenkins <carlos@jenkins.co.cr>
@@ -59,7 +59,7 @@
     %openfile tmpBuf
 
     /* Definitions */
-    #define STEP_SIZE_MILLIS %<CompiledModel.FundamentalStepSize>*1000.0
+    #define STEP_SIZE_MILLIS (%<CompiledModel.FundamentalStepSize>*1000.0)
     #define CONTROL_PRIORITY 3
     #define WORKING_PRIORITY 2
     #define EXTMODE_PRIORITY 1
                 /* Overrun detected */
                 overrun_flag = TRUE;
             } else {
-                overrun_flag = FALSE;
                 /* Release semaphore */
                 xSemaphoreGive(step_signal);
             }
         %<LibCallModelInitialize()>\
         /* Step the model for any subrate */
         xSemaphoreGive(initialized_signal);
-        %foreach idx = LibGetNumSyncPeriodicTasks()
-        %assign tid = idx + tid01Eq
-        %assign sampleTime = LibGetSampleTimePeriodAndOffset(tid,0)
-        %assign steps = FEVAL("round", sampleTime / CompiledModel.FundamentalStepSize)
-        #define STEPS_FOR_TID%<tid>   ((int)%<steps>)
-        %endforeach
 
         while (1) {
-
-            /* Lock semaphore */
             if (xSemaphoreTake(step_signal, portMAX_DELAY)) {
                 working = TRUE;
-                %if LibNumSynchronousSampleTimes() > 1
-                               int i;
-                       for (i = %<tid01Eq>; i < %<LibNumSynchronousSampleTimes()>; i++) {
-                           switch(i) {
-                               %foreach idx = LibGetNumSyncPeriodicTasks()
-                               %assign tid = idx + tid01Eq
-                                       case %<tid> :
-                                   %assign sampleTime = LibGetSampleTimePeriodAndOffset(tid,0)
-                                                       if ((steps_working % STEPS_FOR_TID%<tid>) == 0) {
-                                       %<LibCallModelStep(tid)>\
-                           }
-                                           break;
-                               %endforeach
-                               default : 
-                                   break;
-                               }
-                       }
-                %else
-                    %<LibCallModelStep(0)>\
-                %endif
-                       steps_working++;
-                       working = FALSE;
-                       }
+                %<LibCallModelStep(0)>\
+                steps_working++;
+                working = FALSE;
+            }
         }
 
        %% /* In case of shutdown, delete this task */
         %if EXISTS(::rpp_ain_present)
             rpp_adc_init();
         %endif
-        %if EXISTS(::rpp_din_present) || EXISTS(::rpp_dout_present)
+        %if EXISTS(::rpp_aout_present)
+            rpp_dac_init();
+        %endif
+        %if EXISTS(::rpp_din_present)
+            rpp_din_init();
+        %endif
+        %if EXISTS(::rpp_hbr_present)
+            rpp_hbr_init();
+        %endif
+        %if EXISTS(::rpp_irc_present)
+            rpp_irc_init();
+        %endif
+        %if EXISTS(::rpp_lout_present)
+            rpp_lout_init();
+        %endif
+        %if EXISTS(::rpp_mout_present)
+            rpp_mout_init();
+        %endif
+        %if EXISTS(::rpp_sdr_present)
+            rpp_sdr_init();
+        %endif
+        %if EXISTS(::rpp_gio_in_present) || EXISTS(::rpp_gio_out_present)
             rpp_gio_init(RPP_GIO_PORT_ALL);
         %endif
         rpp_sci_init();