cr929 first release

This commit is contained in:
matt
2020-12-20 15:19:07 +08:00
parent da75c54af9
commit 4d25cac168
486 changed files with 42715 additions and 44873 deletions
+311
View File
@@ -0,0 +1,311 @@
/* Copyright 1994-2016 The MathWorks, Inc. */
/*
* File: rtw_capi.h
*
* Abstract:
* Provides structure types and constants generated by CAPI.
* Macros for accessing the fields of the structures are also provided.
* This header file is included in MODEL_capi.c
*
*/
#ifndef _RTW_CAPI_H_
# define _RTW_CAPI_H_
#ifdef SL_INTERNAL
# include "simstruct/simstruc_types.h"
#else
#ifdef HOST_CAPI_BUILD
#include "simstruc_types.h"
#else
#include "rtwtypes.h"
#endif
#endif
#define SS_ENUM_TYPE (((uint8_T)(255U))-1)
#define SS_STRUCT (((uint8_T)(255U)))
#define rt_offsetof(s,el) ((uint32_T)((char_T *)&((s *)0)->el - (char_T *)(s *)0))
/* Enumeration for fixed point scaling type*/
typedef enum {
rtwCAPI_FIX_UNIFORM_SCALING,
rtwCAPI_FIX_NONUNIFORM_SCALING,
rtwCAPI_FIX_RESERVED
} rtwCAPI_FixPtScalingType;
/* Enumeration for data orientation */
typedef enum {
rtwCAPI_SCALAR,
rtwCAPI_VECTOR,
rtwCAPI_MATRIX_ROW_MAJOR,
rtwCAPI_MATRIX_COL_MAJOR,
rtwCAPI_MATRIX_COL_MAJOR_ND,
rtwCAPI_MATRIX_ROW_MAJOR_ND
} rtwCAPI_Orientation;
/* function pointers for matfile logging */
typedef void(*RTWLoggingFcnPtr)(void*, const void*);
/* Signals Structure */
/* Fields of this structure can be used to monitor block output signals*/
typedef struct rtwCAPI_Signals_tag {
uint_T addrMapIndex; /* index into the data address map */
uint_T sysNum; /* system identification number, where 0 = root */
const char_T *blockPath; /* block's full path name (RTW mangled version) */
const char_T *signalName;/* signal label (unmangled, NULL if not present) */
uint16_T portNumber; /* port number (starts at 0) */
uint16_T dataTypeIndex; /* index into DataTypeMap, gives signal data type */
uint16_T dimIndex; /* index into DimensionMap, gives signal dimension*/
uint16_T fxpIndex; /* index into FixPtMap, gives Fixed point info */
uint8_T sTimeIndex; /* index into SampleTimeMap, gives Task info */
} rtwCAPI_Signals;
/* Macros for accessing Signals structure fields */
/* bio is a pointer to array of Signals structures */
#define rtwCAPI_GetSignalAddrIdx(bio, i) ((bio)[(i)].addrMapIndex)
#define rtwCAPI_GetSignalBlockPath(bio, i) ((bio)[(i)].blockPath)
#define rtwCAPI_GetSignalName(bio, i) ((bio)[(i)].signalName)
#define rtwCAPI_GetSignalPortNumber(bio, i) ((bio)[(i)].portNumber)
#define rtwCAPI_GetSignalDataTypeIdx(bio, i) ((bio)[(i)].dataTypeIndex)
#define rtwCAPI_GetSignalDimensionIdx(bio, i) ((bio)[(i)].dimIndex)
#define rtwCAPI_GetSignalFixPtIdx(bio, i) ((bio)[(i)].fxpIndex)
#define rtwCAPI_GetSignalSampleTimeIdx(bio, i) ((bio)[(i)].sTimeIndex)
#define rtwCAPI_GetSignalSysNum(bio, i) ((bio)[(i)].sysNum)
/* BlockParameters Structure */
/* Fields of this structure can be used to monitor/modify block parameters */
typedef struct rtwCAPI_BlockParameters_tag {
uint_T addrMapIndex; /* index into the data address map */
const char_T *blockPath; /* block's full path name (RTW mangled version) */
const char_T *paramName; /* parameter name */
uint16_T dataTypeIndex; /* index into DataTypeMap, gives param data type */
uint16_T dimIndex; /* index into DimensionMap, gives param dimensions*/
uint16_T fxpIndex; /* index into FixPtMap, gives Fixed point info */
} rtwCAPI_BlockParameters;
/* Macros for accessing BlockParameter structure fields */
/* prm is a pointer to array of BlockParameter structures */
#define rtwCAPI_GetBlockParameterAddrIdx(prm, i) ((prm)[(i)].addrMapIndex)
#define rtwCAPI_GetBlockParameterBlockPath(prm, i) ((prm)[(i)].blockPath)
#define rtwCAPI_GetBlockParameterName(prm, i) ((prm)[(i)].paramName)
#define rtwCAPI_GetBlockParameterDataTypeIdx(prm, i) ((prm)[(i)].dataTypeIndex)
#define rtwCAPI_GetBlockParameterDimensionIdx(prm, i) ((prm)[(i)].dimIndex)
#define rtwCAPI_GetBlockParameterFixPtIdx(prm, i) ((prm)[(i)].fxpIndex)
/* ModelParameter Structure */
/* Fields of this structure can be used to monitor/modify model parameters *
* When Inline Parameters is on, you can configure tunable block parameters *
* as model parameters. */
typedef struct rtwCAPI_ModelParameters_tag {
uint_T addrMapIndex; /* index into the data address map */
const char_T *varName; /* variable name */
uint16_T dataTypeIndex; /* index into DataTypeMap, gives param data type */
uint16_T dimIndex; /* index into DimensionMap, gives param dimensions*/
uint16_T fxpIndex; /* index into FixPtMap, gives Fixed point info */
} rtwCAPI_ModelParameters;
/* Macros for accessing ModelParameter structure fields */
/* prm is a pointer to array of ModelParameter structures */
#define rtwCAPI_GetModelParameterAddrIdx(prm, i) ((prm)[(i)].addrMapIndex)
#define rtwCAPI_GetModelParameterName(prm, i) ((prm)[(i)].varName)
#define rtwCAPI_GetModelParameterDataTypeIdx(prm, i) ((prm)[(i)].dataTypeIndex)
#define rtwCAPI_GetModelParameterDimensionIdx(prm, i) ((prm)[(i)].dimIndex)
#define rtwCAPI_GetModelParameterFixPtIdx(prm, i) ((prm)[(i)].fxpIndex)
/* rtwCAPI_States Structure */
/* Fields of this structure can be used to monitor block States */
typedef struct rtwCAPI_States_tag {
uint_T addrMapIndex; /* index into the data address map */
int_T contStateStartIndex; /* starting index in the model's continuous *
* state and state derivative vectors. This is *
* set to -1 for discrete states */
const char_T *blockPath; /* block's full path name (RTW mangled version) */
const char_T *stateName; /* state name, Default:DWork/Cont State Identifier */
const char_T *pathAlias; /* Alias block path */
uint16_T dWorkIndex; /* Index into the Block DWork, 0 for cont. states */
uint16_T dataTypeIndex; /* index into DataTypeMap, gives state data type */
uint16_T dimIndex; /* index into DimensionMap, gives state dimensions */
uint16_T fxpIndex; /* index into FixPtMap, gives Fixed point info */
uint8_T sTimeIndex; /* index into SampleTimeMap, gives Task info */
uint8_T isContinuous; /* if the state is a Continuous state*/
int_T hierInfoIdx; /* the hierInfo associated with this state, -1 if no hierInfo */
uint_T flatElemIdx; /* flat element index in hierarchy */
} rtwCAPI_States;
/* Macros for accessing States structure fields */
/* bState is a pointer to array of States structures */
#define rtwCAPI_GetStateAddrIdx(bState, i) ((bState)[(i)].addrMapIndex)
#define rtwCAPI_GetContStateStartIndex(bState, i) \
((bState)[(i)].contStateStartIndex)
#define rtwCAPI_GetStateBlockPath(bState, i) ((bState)[(i)].blockPath)
#define rtwCAPI_GetStateName(bState, i) ((bState)[(i)].stateName)
#define rtwCAPI_GetStatePathAlias(bState, i) ((bState)[(i)].pathAlias)
#define rtwCAPI_GetStateDWorkIdx(bState, i) ((bState)[(i)].dWorkIndex)
#define rtwCAPI_GetStateDataTypeIdx(bState, i) ((bState)[(i)].dataTypeIndex)
#define rtwCAPI_GetStateDimensionIdx(bState, i) ((bState)[(i)].dimIndex)
#define rtwCAPI_GetStateFixPtIndex(bState, i) ((bState)[(i)].fxpIndex)
#define rtwCAPI_GetStateSampleTimeIdx(bState, i) ((bState)[(i)].sTimeIndex)
#define rtwCAPI_IsAContinuousState(bState, i) ((bState)[(i)].isContinuous == 1)
#define rtwCAPI_GetStateHierInfoIdx(bState, i) ((bState)[(i)].hierInfoIdx)
#define rtwCAPI_GetStateFlatElemIdx(bState, i) ((bState)[(i)].flatElemIdx)
/* DataTypeMap structure */
/* Members provide data type information of a signal or parameter */
typedef struct rtwCAPI_DataTypeMap_tag {
const char_T *cDataName; /* C language data type name */
const char_T *mwDataName; /* MathWorks data type, typedef in rtwtypes.h */
uint16_T numElements; /* number of elements, 0 for non-structure data */
uint16_T elemMapIndex;/* index into the ElementMap, gives Bus Info */
uint16_T dataSize; /* data size in Bytes */
uint8_T slDataId; /* enumerated data type from simstruc_types.h */
unsigned int isComplex:1; /* is the data type complex (1=Complex, 0=Real) */
unsigned int isPointer:1; /* is data accessed Via Pointer (1=yes, 0= no) */
} rtwCAPI_DataTypeMap;
/* Notes on rtwCAPI_DataTypeMap:
* cDataName - The ANSI C equivalent data type.
* For fixed point data
* cDataName = the native integer equivalent
* For Complex data or non-virtual structures,
* cDataName = "struct"
* mwDataName - RTW defined data type. Typedef can be found in rtwtypes.h
* For fixed point data,
* mwDataName = the integer type in which the data is stored.
* Use rtwCAPI_FixPtMap to get slope & bias of the data.
* numElements - Number of elements/members in the data type. If the data type
* represents a non-virtual structure (for e.g, bus structure),
* this field gives the number of elements in the structure.
* For non-structure data type, the default value is 0
* Complex data types are treated as non-structures
* elemMapIndex - Index into the rtwCAPI_ElementMap which maps each of the
* element/member of a structure data type.
* slDataId - Enumerated Simulink Data type defined in simstruc_types.h.
* The enumerations are
* o SS_DOUBLE
* o SS_SINGLE
* o SS_INT8
* o SS_UINT8
* o SS_INT16
* o SS_UINT16
* o SS_INT32
* o SS_UINT32
* o SS_BOOLEAN
* o SS_ENUM_TYPE (for enumerated data types)
* o SS_STRUCT (for non-virtual structures)
* For fixed point data:
* slDataId = enumeration corresponding to the integer type
* in which the data is stored
* For Complex data:
* slDataId = enumeration corresponding to the data type of
* the real part.
* isComplex - is the data type complex (1=Complex, 0=Real)
* isPointer - is data accessed Via Pointer (1=yes, 0= no)
*/
/* Macros for accessing DataTypeMap fields/members */
#define rtwCAPI_GetDataTypeCName(dTypeMap, i) ((dTypeMap)[(i)].cDataName)
#define rtwCAPI_GetDataTypeMWName(dTypeMap, i) ((dTypeMap)[(i)].mwDataName)
#define rtwCAPI_GetDataTypeNumElements(dTypeMap, i) ((dTypeMap)[(i)].numElements)
#define rtwCAPI_GetDataTypeElemMapIndex(dTypeMap,i) ((dTypeMap)[(i)].elemMapIndex)
#define rtwCAPI_GetDataTypeSLId(dTypeMap, i) ((dTypeMap)[(i)].slDataId)
#define rtwCAPI_GetDataTypeSize(dTypeMap, i) ((dTypeMap)[(i)].dataSize)
#define rtwCAPI_GetDataIsComplex(dTypeMap, i) ((dTypeMap)[(i)].isComplex)
#define rtwCAPI_GetDataIsPointer(dTypeMap, i) ((dTypeMap)[(i)].isPointer)
/* Macros for determining whether signals/states support MAT-File logging */
#define rtwCAPI_CanLogSignalToMATFile(dTypeMap, bio, i) \
(rtwCAPI_GetDataTypeSLId(dTypeMap, rtwCAPI_GetSignalDataTypeIdx(bio, i)) < SS_NUM_BUILT_IN_DTYPE)
#define rtwCAPI_CanLogStateToMATFile(dTypeMap, bState, i) \
(rtwCAPI_GetDataTypeSLId(dTypeMap, rtwCAPI_GetStateDataTypeIdx(bState, i)) < SS_NUM_BUILT_IN_DTYPE)
/* ElementMap structure */
/* Fields provide information on elements (fields) in Simulink Bus structure */
typedef struct rtwCAPI_ElementMap_tag {
const char_T *elementName; /* name of the element */
uint32_T elementOffset; /* offset of the structure element in bytes */
uint16_T dataTypeIndex; /* index into DataTypeMap, datatype of the element*/
uint16_T dimIndex; /* index into DimensionMap, element's dimensions */
uint16_T fxpIndex; /* index into fixPtMap, fixed point information */
} rtwCAPI_ElementMap;
/* Macros for accessing ElementMap fields */
#define rtwCAPI_GetElementName(elemMap, i) ((elemMap)[(i)].elementName)
#define rtwCAPI_GetElementOffset(elemMap, i) ((elemMap)[(i)].elementOffset)
#define rtwCAPI_GetElementDataTypeIdx(elemMap, i) ((elemMap)[(i)].dataTypeIndex)
#define rtwCAPI_GetElementDimensionIdx(elemMap, i) ((elemMap)[(i)].dimIndex)
#define rtwCAPI_GetElementFixPtIdx(elemMap, i) ((elemMap)[(i)].fxpIndex)
/* DimensionMap structure */
/* Fields provide dimensions of a signal or a parameter */
typedef struct rtwCAPI_DimensionMap_tag {
rtwCAPI_Orientation orientation;
/* orientation of data -scalar/vector/matrix/ND */
uint_T dimArrayIndex; /* index into dimension array */
uint8_T numDims; /* number of dimensions */
uint_T vardimsIndex; /* index into vardims address array */
} rtwCAPI_DimensionMap;
/* Macros for accessing DimensionMap fields */
#define rtwCAPI_GetOrientation(dimMap, i) ((dimMap)[(i)].orientation)
#define rtwCAPI_GetDimArrayIndex(dimMap, i) ((dimMap)[(i)].dimArrayIndex)
#define rtwCAPI_GetNumDims(dimMap, i) ((dimMap)[(i)].numDims)
#define rtwCAPI_GetDimsIsVariable(vardimsAddrMap, dimMap, i) (vardimsAddrMap[(dimMap)[(i)].vardimsIndex] != NULL)
/* FixPtMap Structure */
/* Fields provide fixed point information of a signal or parameter */
typedef struct rtwCAPI_FixPtMap_tag {
const void* fracSlopePtr; /* pointer to fractional slope value */
const void* biasPtr; /* pointer to bias value */
rtwCAPI_FixPtScalingType scaleType;
/* scaling type - uniform/non-uniform */
uint8_T wordLength; /* number of bits required to store value *
* In MATLAB, word length of the fi object */
int8_T exponent; /* exponent */
boolean_T isSigned; /* 1 = signed data, 0 = unsigned data */
} rtwCAPI_FixPtMap;
/* Macros for accessing FixPtMap fields */
#define rtwCAPI_GetFxpFracSlopePtr(fxpMap, i) ((fxpMap)[(i)].fracSlopePtr)
#define rtwCAPI_GetFxpBiasPtr(fxpMap, i) ((fxpMap)[(i)].biasPtr)
#define rtwCAPI_GetFxpScaling(fxpMap, i) ((fxpMap)[(i)].scaleType)
#define rtwCAPI_GetFxpWordLength(fxpMap, i) ((fxpMap)[(i)].wordLength)
#define rtwCAPI_GetFxpExponent(fxpMap, i) ((fxpMap)[(i)].exponent)
#define rtwCAPI_GetFxpIsSigned(fxpMap, i) ((fxpMap)[(i)].isSigned)
/* Macros to get the slope and bias values casted to DOUBLE */
#define rtwCAPI_GetFxpFracSlope(fxpMap, i) (*((real_T*) rtwCAPI_GetFxpFracSlopePtr(fxpMap,i)))
#define rtwCAPI_GetFxpBias(fxpMap, i) (*((real_T*) rtwCAPI_GetFxpBiasPtr(fxpMap, i)))
/* SampleTimeMap Structure */
typedef struct rtwCAPI_SampleTimeMap_tag {
const void* samplePeriodPtr; /* pointer to sample time period value */
const void* sampleOffsetPtr; /* pointer to sample time Offset value */
int8_T tid; /* task identifier */
uint8_T samplingMode; /* 1 = FrameBased, 0 = SampleBased */
} rtwCAPI_SampleTimeMap;
/* Macros for accessing SampleTimeMap fields */
#define rtwCAPI_GetSamplePeriodPtr(sampTimeMap, i) ((sampTimeMap)[(i)].samplePeriodPtr)
#define rtwCAPI_GetSampleOffsetPtr(sampTimeMap, i) ((sampTimeMap)[(i)].sampleOffsetPtr)
#define rtwCAPI_GetSampleTimeTID(sampTimeMap, i) ((sampTimeMap)[(i)].tid)
#define rtwCAPI_GetSamplingMode(sampTimeMap, i) ((sampTimeMap)[(i)].samplingMode)
/* Macros to get sample period and offset casted to DOUBLE */
/* if sample period is -3.0 and offset is 1.0, then it represents an initialize function,
if sample period is -3.0 and offset is 2.0, then it represents a terminate function,
if sample period is -3.0 and offset > 2.0, then it represents a reset function.
*/
#define rtwCAPI_GetSamplePeriod(sampTimeMap, i) (*((real_T *) rtwCAPI_GetSamplePeriodPtr(sampTimeMap, i)))
#define rtwCAPI_GetSampleOffset(sampTimeMap, i) (*((real_T *) rtwCAPI_GetSampleOffsetPtr(sampTimeMap, i)))
/* Macro to get the actual data address */
#define rtwCAPI_GetDataAddress(dataAddrMap,addrIdx) ((dataAddrMap)[(addrIdx)])
/* Macro to get the actual var dims address */
#define rtwCAPI_GetCurrentDimsAddr(vardimsAddrMap,dimMap,addrIdx) ((vardimsAddrMap)[(dimMap)[(addrIdx)].vardimsIndex])
#endif /* _RTW_CAPI_H_ */
/* EOF - rtw_capi.h */
+278
View File
@@ -0,0 +1,278 @@
/* Copyright 1994-2014 The MathWorks, Inc. */
/*
* File: rtw_modelmap.h
*
* Abstract:
* Model tuning information. Use the provided structure access methods
* whenever possible.
*
* For details about these structures see Simulink Coder User's guide.
*/
#ifndef __RTW_MODELMAP__
#define __RTW_MODELMAP__
#ifdef SL_INTERNAL
# include "version.h"
# include "util.h"
# include "simstruct/simstruc_types.h"
# include "simulinkcoder_capi_export.hpp"
#else
# include <stdlib.h>
#ifdef HOST_CAPI_BUILD
# include "simstruc_types.h"
#else
# include "rtwtypes.h"
#endif
#ifndef __RTW_UTFREE__
# define __RTW_UTFREE__
# define utFree(arg) if (arg) free(arg)
# define utMalloc(arg) malloc(arg)
#endif
# define SIMULINKCODER_CAPI_API extern
#endif
#include "rtw_capi.h"
#include "rtw_modelmap_logging.h"
typedef struct rtwCAPI_ModelMappingInfo_tag rtwCAPI_ModelMappingInfo;
typedef struct rtwCAPI_ModelMappingStaticInfo_tag rtwCAPI_ModelMappingStaticInfo;
/* ModelMappingStaticInfo */
struct rtwCAPI_ModelMappingStaticInfo_tag {
/* signals */
struct {
rtwCAPI_Signals const *signals; /* Signals Array */
uint_T numSignals; /* Num Signals */
rtwCAPI_Signals const *rootInputs; /* Root Inputs array */
uint_T numRootInputs; /* Num Root Inputs */
rtwCAPI_Signals const *rootOutputs; /* Root Outputs array */
uint_T numRootOutputs;/* Num Root Outputs */
} Signals;
/* parameters */
struct {
rtwCAPI_BlockParameters const *blockParameters; /* Block parameters Array */
uint_T numBlockParameters; /* Num block parameters */
rtwCAPI_ModelParameters const *modelParameters; /* Model parameters Array*/
uint_T numModelParameters; /* Num Model parameters */
} Params;
/* states */
struct {
rtwCAPI_States const *states; /* States array */
uint_T numStates; /* Num States */
} States;
/* Static maps */
/* datatypes, dimensions, fixed point, structure elements, sample times */
struct {
rtwCAPI_DataTypeMap const *dataTypeMap; /* Data Type Map */
rtwCAPI_DimensionMap const *dimensionMap; /* Data Dimension Map */
rtwCAPI_FixPtMap const *fixPtMap; /* Fixed Point Map */
rtwCAPI_ElementMap const *elementMap; /* Structure Element map */
rtwCAPI_SampleTimeMap const *sampleTimeMap; /* Sample Times Map */
uint_T const *dimensionArray; /* Dimension Array */
} Maps;
/* TargetType - string specifying the intended target of the generated *
* C-API. *
* targetType = "float" - target supports floats and integer code *
* = "integer" - target supports integer only code */
char_T const *targetType;
/* for internal use */
uint32_T modelChecksum[4];
rtwCAPI_ModelMapLoggingStaticInfo const *staticLogInfo;
size_t rtpSize;
/* If this instance in a protected model*/
boolean_T isProtectedModel;
};
/* ModelMappingInfo */
struct rtwCAPI_ModelMappingInfo_tag {
/* ModelMappingInfo version */
uint8_T versionNum;
/* Reference to static model data, all model instances share this map */
rtwCAPI_ModelMappingStaticInfo *staticMap;
/* Instance specific Maps, each model instance has a unique InstanceMap */
struct {
const char* path; /* Path to this instance */
char* fullPath;
void** dataAddrMap; /* Data Address map */
rtwCAPI_ModelMappingInfo** childMMIArray; /* array of child MMI */
uint_T childMMIArrayLen; /* Number of child MMIs */
int_T contStateStartIndex;
/* for internal use */
rtwCAPI_ModelMapLoggingInstanceInfo *instanceLogInfo;
int32_T** vardimsAddrMap; /* Vardims Address map */
void* rtpAddress;
RTWLoggingFcnPtr* RTWLoggingPtrs; /* MatFile logging information */
} InstanceMap;
};
/* Macros for accessing ModelMappingStaticInfo fields */
#define rtwCAPI_GetSignalsFromStaticMap(SM) ((SM)->Signals.signals)
#define rtwCAPI_GetNumSignalsFromStaticMap(SM) ((SM)->Signals.numSignals)
#define rtwCAPI_GetLogSignalsArrayFromStaticMap(SM) ((SM)->Signals.logSignalsArray)
#define rtwCAPI_GetNumLogSignalsFromStaticMap(SM) ((SM)->Signals.numLogSignals)
#define rtwCAPI_GetBlockParametersFromStaticMap(SM) ((SM)->Params.blockParameters)
#define rtwCAPI_GetNumBlockParametersFromStaticMap(SM) ((SM)->Params.numBlockParameters)
#define rtwCAPI_GetModelParametersFromStaticMap(SM) ((SM)->Params.modelParameters)
#define rtwCAPI_GetNumModelParametersFromStaticMap(SM) ((SM)->Params.numModelParameters)
#define rtwCAPI_GetStatesFromStaticMap(SM) ((SM)->States.states)
#define rtwCAPI_GetNumStatesFromStaticMap(SM) ((SM)->States.numStates)
#define rtwCAPI_GetRootInputsFromStaticMap(SM) ((SM)->Signals.rootInputs)
#define rtwCAPI_GetNumRootInputsFromStaticMap(SM) ((SM)->Signals.numRootInputs)
#define rtwCAPI_GetRootOutputsFromStaticMap(SM) ((SM)->Signals.rootOutputs)
#define rtwCAPI_GetNumRootOutputsFromStaticMap(SM) ((SM)->Signals.numRootOutputs)
#define rtwCAPI_GetDataTypeMapFromStaticMap(SM) ((SM)->Maps.dataTypeMap)
#define rtwCAPI_GetDimensionMapFromStaticMap(SM) ((SM)->Maps.dimensionMap)
#define rtwCAPI_GetFixPtMapFromStaticMap(SM) ((SM)->Maps.fixPtMap)
#define rtwCAPI_GetElementMapFromStaticMap(SM) ((SM)->Maps.elementMap)
#define rtwCAPI_GetSampleTimeMapFromStaticMap(SM) ((SM)->Maps.sampleTimeMap)
#define rtwCAPI_GetDimensionArrayFromStaticMap(SM) ((SM)->Maps.dimensionArray)
/* Macros for accessing ModelMappingInfo fields */
#define rtwCAPI_GetSignals(MMI) rtwCAPI_GetSignalsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumSignals(MMI) rtwCAPI_GetNumSignalsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetLogSignalsArray(MMI) rtwCAPI_GetLogSignalsArrayFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumLogSignals(MMI) rtwCAPI_GetNumLogSignalsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetBlockParameters(MMI) rtwCAPI_GetBlockParametersFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumBlockParameters(MMI) rtwCAPI_GetNumBlockParametersFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetModelParameters(MMI) rtwCAPI_GetModelParametersFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumModelParameters(MMI) rtwCAPI_GetNumModelParametersFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetStates(MMI) rtwCAPI_GetStatesFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumStates(MMI) rtwCAPI_GetNumStatesFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetRootInputs(MMI) rtwCAPI_GetRootInputsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumRootInputs(MMI) rtwCAPI_GetNumRootInputsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetRootOutputs(MMI) rtwCAPI_GetRootOutputsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetNumRootOutputs(MMI) rtwCAPI_GetNumRootOutputsFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetDataTypeMap(MMI) rtwCAPI_GetDataTypeMapFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetDimensionMap(MMI) rtwCAPI_GetDimensionMapFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetFixPtMap(MMI) rtwCAPI_GetFixPtMapFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetElementMap(MMI) rtwCAPI_GetElementMapFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetSampleTimeMap(MMI) rtwCAPI_GetSampleTimeMapFromStaticMap((MMI)->staticMap)
#define rtwCAPI_GetDimensionArray(MMI) rtwCAPI_GetDimensionArrayFromStaticMap((MMI)->staticMap)
#define rtwCAPI_IsProtectedModel(MMI) ((MMI)->staticMap->isProtectedModel)
#define rtwCAPI_GetStaticLoggingInfo(MMI) ((MMI)->staticMap->staticLogInfo)
#define rtwCAPI_GetVersion(MMI) ((MMI)->versionNum)
#define rtwCAPI_GetDataAddressMap(MMI) ((MMI)->InstanceMap.dataAddrMap)
#define rtwCAPI_GetVarDimsAddressMap(MMI) ((MMI)->InstanceMap.vardimsAddrMap)
#define rtwCAPI_GetRTWLoggingPtrsMap(MMI) ((MMI)->InstanceMap.RTWLoggingPtrs)
#define rtwCAPI_GetPath(MMI) ((MMI)->InstanceMap.path)
#define rtwCAPI_GetFullPath(MMI) ((MMI)->InstanceMap.fullPath)
#define rtwCAPI_GetChildMMI(MMI,i) ((MMI)->InstanceMap.childMMIArray[i])
#define rtwCAPI_GetChildMMIArray(MMI) ((MMI)->InstanceMap.childMMIArray)
#define rtwCAPI_GetChildMMIArrayLen(MMI) ((MMI)->InstanceMap.childMMIArrayLen)
#define rtwCAPI_MMIGetContStateStartIndex(MMI) ((MMI)->InstanceMap.contStateStartIndex)
#define rtwCAPI_GetInstanceLoggingInfo(MMI) ((MMI)->InstanceMap.instanceLogInfo)
/* Macros for setting ModelMappingInfo fields */
#define rtwCAPI_SetVersion(MMI, n) ((MMI).versionNum = (n))
#define rtwCAPI_SetStaticMap(MMI, statMap) (MMI).staticMap = (statMap)
#define rtwCAPI_SetLoggingStaticMap(MMI,lStatMap) (MMI).staticMap->staticLogInfo = (lStatMap)
#define rtwCAPI_SetDataAddressMap(MMI, dAddr) (MMI).InstanceMap.dataAddrMap = (dAddr)
#define rtwCAPI_SetVarDimsAddressMap(MMI, vAddr) (MMI).InstanceMap.vardimsAddrMap = (vAddr)
#define rtwCAPI_SetLoggingPtrs(MMI, lAddr) (MMI).InstanceMap.RTWLoggingPtrs = (lAddr)
#define rtwCAPI_SetPath(MMI,p) (MMI).InstanceMap.path = (p)
#define rtwCAPI_SetFullPath(MMI,p) (MMI).InstanceMap.fullPath = (p)
#define rtwCAPI_SetChildMMI(MMI,i,cMMI) (MMI).InstanceMap.childMMIArray[i] = (cMMI)
#define rtwCAPI_SetChildMMIArray(MMI,cMMIs) (MMI).InstanceMap.childMMIArray = (cMMIs)
#define rtwCAPI_SetChildMMIArrayLen(MMI,n) (MMI).InstanceMap.childMMIArrayLen = (n)
#define rtwCAPI_MMISetContStateStartIndex(MMI,i) (MMI).InstanceMap.contStateStartIndex = (i)
#define rtwCAPI_SetInstanceLoggingInfo(MMI,l) (MMI).InstanceMap.instanceLogInfo = (l)
/* Functions in rtw_modelmap_utils.c */
#ifdef __cplusplus
extern "C" {
#endif
SIMULINKCODER_CAPI_API char* rtwCAPI_EncodePath(const char* path);
SIMULINKCODER_CAPI_API boolean_T rtwCAPI_HasStates(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API int_T rtwCAPI_GetNumStateRecords(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API int_T rtwCAPI_GetNumStateRecordsForRTWLogging(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API int_T rtwCAPI_GetNumContStateRecords(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API void rtwCAPI_FreeFullPaths(rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API const char_T* rtwCAPI_UpdateFullPaths(rtwCAPI_ModelMappingInfo* mmi,
const char_T* path,
boolean_T isCalledFromTopModel);
SIMULINKCODER_CAPI_API char* rtwCAPI_GetFullStateBlockPath(const char* stateBlockPath,
const char* mmiPath,
size_t mmiPathLen,
boolean_T crossingModel);
SIMULINKCODER_CAPI_API uint_T rtwCAPI_GetStateWidth(const rtwCAPI_DimensionMap* dimMap,
const uint_T* dimArray,
const rtwCAPI_States* states,
uint_T iState);
SIMULINKCODER_CAPI_API const char_T* rtwCAPI_GetStateRecordInfo(const rtwCAPI_ModelMappingInfo* mmi,
const char_T** sigBlockName,
const char_T** sigLabel,
const char_T** sigName,
int_T* sigWidth,
int_T* sigDataType,
int_T* logDataType,
int_T* sigComplexity,
void** sigDataAddr,
RTWLoggingFcnPtr* RTWLoggingPtrs,
boolean_T* sigCrossMdlRef,
boolean_T* sigInProtectedMdl,
const char_T** sigPathAlias,
double* sigSampleTime,
int_T* sigHierInfoIdx,
uint_T* sigFlatElemIdx,
const rtwCAPI_ModelMappingInfo** sigMMI,
int_T* sigIdx,
boolean_T crossingModel,
boolean_T isInProtectedMdl,
real_T* stateDerivVector,
boolean_T rtwLogging);
SIMULINKCODER_CAPI_API int_T rtwCAPI_GetNumSigLogRecords(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API int_T rtwCAPI_GetNumSigLogRecordsForRTWLogging(const rtwCAPI_ModelMappingInfo* mmi);
SIMULINKCODER_CAPI_API const char_T* rtwCAPI_GetSigLogRecordInfo(const rtwCAPI_ModelMappingInfo* mmi,
const char_T** sigBlockName,
const char_T** sigLabel,
int_T* sigWidth,
int_T* sigDataType,
int_T* logDataType,
int_T* sigComplexity,
void** sigDataAddr,
boolean_T* sigCrossMdlRef,
int_T* sigIdx,
boolean_T crossingModel,
boolean_T rtwLogging);
SIMULINKCODER_CAPI_API void rtwCAPI_CountSysRan(const rtwCAPI_ModelMappingInfo *mmi,
int *count);
SIMULINKCODER_CAPI_API void rtwCAPI_FillSysRan(const rtwCAPI_ModelMappingInfo *mmi,
sysRanDType **sysRan,
int *sysTid,
int *fillIdx);
#ifdef __cplusplus
}
#endif
#endif /* __RTW_MODELMAP__ */
/* EOF - rtw_modelmap.h */
/* LocalWords: MMI Vardims utils
*/
@@ -0,0 +1,179 @@
/* Copyright 1994-2013 The MathWorks, Inc. */
/*
* File: rtw_modelmap_logging.h
*
* Abstract:
* Meta information used in conjunction with the ModelMappingInfo to
* facilitate logging.
*
*/
#ifndef __RTW_MODELMAP_LOGGING__
#define __RTW_MODELMAP_LOGGING__
#ifdef SL_INTERNAL
# include "simstruct/sysran_types.h"
#else
# include "sysran_types.h"
#endif
typedef struct rtwCAPI_ModelMapLoggingStaticInfo_tag rtwCAPI_ModelMapLoggingStaticInfo;
typedef struct rtwCAPI_ModelMapLoggingInstanceInfo_tag rtwCAPI_ModelMapLoggingInstanceInfo;
typedef struct rtwCAPI_LoggingMetaInfo_tag {
uint_T sigIdx; /* same index as the rtwCAPI_Signals */
uint_T startIdx; /* starting index in the block I/O */
const char *blockPath;
uint_T portIdx;
int_T parentSysNum; /* system number of the parent signal that requested
the logging */
} rtwCAPI_LoggingMetaInfo;
typedef enum {
rtwCAPI_bus,
rtwCAPI_signal
} rtwCAPI_LoggingBusElementType;
typedef struct rtwCAPI_LoggingBusElement_tag {
uint_T index;
rtwCAPI_LoggingBusElementType type;
} rtwCAPI_LoggingBusElement;
typedef struct rtwCAPI_LoggingBusSignals_tag {
const char *signalName; /* logname should be in the sigProp */
const char *blockPath;
uint_T portIdx;
uint_T numElements;
const rtwCAPI_LoggingBusElement *elements;
} rtwCAPI_LoggingBusSignals;
typedef struct rtwCAPI_StateflowSignalLoggingInfo_tag {
const char *signalName;
const char *blockPath;
const char *loggingName;
uint_T maxPoints;
uint_T decimation;
boolean_T useCustomName;
} rtwCAPI_StateflowSignalLoggingInfo;
/* Structure used for representing bus hierarchy information for dataset logging */
typedef struct rtwCAPI_SignalHierLoggingInfo_tag {
const char_T* signalName;
uint_T numChildren;
int_T childStartIdx;
} rtwCAPI_SignalHierLoggingInfo;
typedef struct rtwCAPI_SignalHierLoggingInfoTable_tag {
uint_T numSignals;
rtwCAPI_SignalHierLoggingInfo const* infoTable;
uint_T const* childIndexTable;
} rtwCAPI_SignalHierLoggingInfoTable;
/* ModelMapLoggingStaticInfo */
struct rtwCAPI_ModelMapLoggingStaticInfo_tag {
/* Total number of non-virtual systems */
uint_T numSystems;
/* Effective context systems array */
int_T const * contextSystems;
rtwCAPI_LoggingMetaInfo const *logInfo;
/* Bus signals info */
uint_T numBusSignals;
rtwCAPI_LoggingBusSignals const *busSignals;
/* Dataset format hierarchy info */
rtwCAPI_SignalHierLoggingInfoTable hierInfoTable;
/* Dataset format Stateflow logging info */
uint_T numChartSignals;
rtwCAPI_StateflowSignalLoggingInfo const *chartSignals;
};
/* Macros for accessing static fields */
/* Note: These are all relative to the base MMI */
#define rtwCAPI_GetHierInfoMap(MMI) \
((MMI)->staticMap->staticLogInfo->hierInfoTable)
#define rtwCAPI_GetNumSystems(MMI) \
((MMI)->staticMap->staticLogInfo->numSystems)
#define rtwCAPI_GetContextSystems(MMI) \
((MMI)->staticMap->staticLogInfo->contextSystems)
#define rtwCAPI_GetLoggingInfoSigIdx(MMI, i) \
((MMI)->staticMap->staticLogInfo->logInfo[i].sigIdx)
#define rtwCAPI_GetLoggingInfoStartIdx(MMI, i) \
((MMI)->staticMap->staticLogInfo->logInfo[i].startIdx)
#define rtwCAPI_GetLoggingInfoBlockPath(MMI, i) \
((MMI)->staticMap->staticLogInfo->logInfo[i].blockPath)
#define rtwCAPI_GetLoggingInfoPortNumber(MMI, i) \
((MMI)->staticMap->staticLogInfo->logInfo[i].portIdx)
#define rtwCAPI_GetLoggingInfoParentSysNum(MMI, i) \
((MMI)->staticMap->staticLogInfo->logInfo[i].parentSysNum)
#define rtwCAPI_GetLoggingInfoNumBusSignals(MMI) \
((MMI)->staticMap->staticLogInfo->numBusSignals)
#define rtwCAPI_GetLoggingInfoBusSignalName(MMI, i) \
((MMI)->staticMap->staticLogInfo->busSignals[i].signalName)
#define rtwCAPI_GetLoggingInfoBusBlockPath(MMI, i) \
((MMI)->staticMap->staticLogInfo->busSignals[i].blockPath)
#define rtwCAPI_GetLoggingInfoBusPortIdx(MMI, i) \
((MMI)->staticMap->staticLogInfo->busSignals[i].portIdx)
#define rtwCAPI_GetLoggingInfoBusNumElements(MMI, i) \
((MMI)->staticMap->staticLogInfo->busSignals[i].numElements)
#define rtwCAPI_GetLoggingInfoBusElementIndex(MMI, i, j) \
((MMI)->staticMap->staticLogInfo->busSignals[i].elements[j].index)
#define rtwCAPI_GetLoggingInfoBusElementType(MMI, i, j) \
((MMI)->staticMap->staticLogInfo->busSignals[i].elements[j].type)
/* ModelMapLoggingInstanceInfo */
struct rtwCAPI_ModelMapLoggingInstanceInfo_tag {
/* Pointer to the sysRan dwork pointers */
sysRanDType **systemRan;
/* Effective non-triggered tid of each system */
int_T *systemTid;
/* Points to the global tid map */
int_T *globalTIDMap;
};
/* Note: These are all relative to the base MMI */
/* Get methods */
#define rtwCAPI_GetSystemRan(MMI) \
((MMI)->InstanceMap.instanceLogInfo->systemRan)
#define rtwCAPI_GetSystemTid(MMI) \
((MMI)->InstanceMap.instanceLogInfo->systemTid)
#define rtwCAPI_GetGlobalTIDMap(MMI) \
((MMI)->InstanceMap.instanceLogInfo->globalTIDMap)
/* Set methods */
#define rtwCAPI_SetSystemRan(MMI,s) \
((MMI).InstanceMap.instanceLogInfo->systemRan) = (s)
#define rtwCAPI_SetSystemTid(MMI,s) \
((MMI).InstanceMap.instanceLogInfo->systemTid) = (s)
#define rtwCAPI_SetGlobalTIDMap(MMI,s) \
((MMI).InstanceMap.instanceLogInfo->globalTIDMap) = (s)
#endif /* __RTW_MODELMAP_LOGGING__ */
/* EOF - rtw_modelmap_logging.h */