grt.h
Go to the documentation of this file.
00001 //=================================================================================================
00002 // Copyright (c) 2012, Johannes Meyer, TU Darmstadt
00003 // All rights reserved.
00004 
00005 // Redistribution and use in source and binary forms, with or without
00006 // modification, are permitted provided that the following conditions are met:
00007 //     * Redistributions of source code must retain the above copyright
00008 //       notice, this list of conditions and the following disclaimer.
00009 //     * Redistributions in binary form must reproduce the above copyright
00010 //       notice, this list of conditions and the following disclaimer in the
00011 //       documentation and/or other materials provided with the distribution.
00012 //     * Neither the name of the Flight Systems and Automatic Control group,
00013 //       TU Darmstadt, nor the names of its contributors may be used to
00014 //       endorse or promote products derived from this software without
00015 //       specific prior written permission.
00016 
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00018 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //=================================================================================================
00028 
00029 #ifndef ROSRTW_GRT_COMMON_H
00030 #define ROSRTW_GRT_COMMON_H
00031 
00032 /*
00033  * Copyright 1994-2011 The MathWorks, Inc.
00034  *
00035  * File    : grt_main.c
00036  *
00037  * Abstract:
00038  *      A Generic "Real-Time (single tasking or pseudo-multitasking,
00039  *      statically allocated data)" main that runs under most
00040  *      operating systems.
00041  *
00042  *      This file may be a useful starting point when targeting a new
00043  *      processor or microcontroller.
00044  *
00045  *
00046  * Compiler specified defines:
00047  *      RT              - Required.
00048  *      MODEL=modelname - Required.
00049  *      NUMST=#         - Required. Number of sample times.
00050  *      NCSTATES=#      - Required. Number of continuous states.
00051  *      TID01EQ=1 or 0  - Optional. Only define to 1 if sample time task
00052  *                        id's 0 and 1 have equal rates.
00053  *      MULTITASKING    - Optional. (use MT for a synonym).
00054  *      SAVEFILE        - Optional (non-quoted) name of .mat file to create.
00055  *                        Default is <MODEL>.mat
00056  */
00057 
00058 #include <float.h>
00059 #include <stdio.h>
00060 #include <stdlib.h>
00061 #include <string.h>
00062 
00063 #include "rtwtypes.h"
00064 #include "rtmodel.h"
00065 #include "rt_sim.h"
00066 #include "rt_logging.h"
00067 #ifdef UseMMIDataLogging
00068 #include "rt_logging_mmi.h"
00069 #endif
00070 
00071 #include "ext_work.h"
00072 
00073 /*=========*
00074  * Defines *
00075  *=========*/
00076 
00077 #ifndef TRUE
00078 #define FALSE (0)
00079 #define TRUE  (1)
00080 #endif
00081 
00082 #ifndef EXIT_FAILURE
00083 #define EXIT_FAILURE  1
00084 #endif
00085 #ifndef EXIT_SUCCESS
00086 #define EXIT_SUCCESS  0
00087 #endif
00088 
00089 #define QUOTE1(name) #name
00090 #define QUOTE(name) QUOTE1(name)    /* need to expand name    */
00091 
00092 #ifndef RT
00093 # error "must define RT"
00094 #endif
00095 
00096 #ifndef MODEL
00097 # error "must define MODEL"
00098 #endif
00099 
00100 #ifndef NUMST
00101 # error "must define number of sample times, NUMST"
00102 #endif
00103 
00104 #ifndef NCSTATES
00105 # error "must define NCSTATES"
00106 #endif
00107 
00108 #ifndef SAVEFILE
00109 # define MATFILE2(file) #file ".mat"
00110 # define MATFILE1(file) MATFILE2(file)
00111 # define MATFILE MATFILE1(MODEL)
00112 #else
00113 # define MATFILE QUOTE(SAVEFILE)
00114 #endif
00115 
00116 #define RUN_FOREVER -1.0
00117 
00118 #define EXPAND_CONCAT(name1,name2) name1 ## name2
00119 #define CONCAT(name1,name2) EXPAND_CONCAT(name1,name2)
00120 #define RT_MODEL            CONCAT(MODEL,_rtModel)
00121 
00122 /*==================================================*
00123  * External functions for Simplified Call Interface *
00124  *==================================================*/
00125 # define MODEL_INITIALIZE    CONCAT(MODEL,_initialize)
00126 #if ONESTEPFCN == 1
00127 # define MODEL_STEP          CONCAT(MODEL,_step)
00128 # define MODEL_OUTPUT        MODEL_STEP
00129 #else
00130 # define MODEL_OUTPUT        CONCAT(MODEL,_output)
00131 # define MODEL_UPDATE        CONCAT(MODEL,_update)
00132 #endif
00133 
00134 # define MODEL_TERMINATE     CONCAT(MODEL,_terminate)
00135 # define RT_MDL              CONCAT(MODEL,_M)
00136 
00137 extern void MODEL_INITIALIZE(void);
00138 extern void MODEL_TERMINATE(void);
00139 
00140 #if !defined(MULTITASKING)
00141 #if ONESTEPFCN == 1
00142 # define MODEL_UPDATE()              /* No op */
00143 extern void MODEL_STEP(void);        /* single rate step function */
00144 #else
00145 extern void MODEL_OUTPUT(void);      /* single rate output function */
00146 extern void MODEL_UPDATE(void);      /* single rate update function */
00147 #endif
00148 #else
00149 #if ONESTEPFCN == 1
00150 # define MODEL_UPDATE(S)             /* No op */
00151 extern void MODEL_STEP(int_T tid);   /* multirate step function */
00152 #else
00153 extern void MODEL_OUTPUT(int_T tid); /* multirate output function */
00154 extern void MODEL_UPDATE(int_T tid); /* multirate update function */
00155 #endif
00156 #endif  /* !defined(MULTITASKING) */
00157 
00158 #endif // ROSRTW_GRT_COMMON_H


rosrtw
Author(s): Johannes Meyer
autogenerated on Fri Jul 25 2014 06:08:44