📄 sigmapdef.h
字号:
* series of data points). If your application
* does not support frames, include SLREG_FRAME
* as part of the excludeFlags to ensure that
* all frame data is excluded from the sigList.
*
* SLREG_WIDE_FRAME:
* The data region corresponds to a wide frame,
* size greated than 1. If your application
* does not support wide frames, include
* SLREG_WIDE_FRAME as part of the excludeFlags to
* ensure that all wide frame data is excluded from the
* sigList.
*
* SLREG_MATRIX:
* The data region corresponds to a matrix. If
* your application does not support matrices,
* include SLREG_MATRIX as part of the
* excludeFlags to ensure that all matrices are
* excluded from the sigList.
*
* SLREG_COMPLEX:
* The data region corresponds to complex data. If
* your application does not support complex data,
* include SLREG_COMPLEX as part of the
* excludeFlags to ensure that all complex data is
* excluded from the sigList.
*
* ====================================================
* The following overrides the default exclusions
* of the specified type of regions.
* ====================================================
*
* SLREG_ALLOW_REUSED
* "un-exludes" reused regions (which are excluded
* by default. As described above in the
* SLREG_REUSED section, this can lead to
* unexpected results, unless the block that is
* requesting the signal access is hardwired into
* the diagram.
*
* In general, if a block has input ports, this
* flag should be specified (assuming that the
* sigmaps being created correspond to its input
* ports).
*
* dType: The Simulink data type id for the data.
* dTypeSize: Number of bytes in 1 non-complex element.
* complexity: true if the data values are complex
* m: if a matrix, the number of rows (-1 if not matrix)
* n: if a matrix, the number of cols (-1 if not matrix)
*
*
* In general, the following snippet of code can be used to walk the elements
* of a signal:
* SL_SigRegion *sigReg = gsl_FirstReg(sigList,i);
*
* do {
* int nEls = gsr_nEls(sigReg);
*
* if (nEls > 0) {
* int el;
* int dType = gsr_DataType(sigReg);
* int elSize = gsr_DataTypeSize(sigReg);
* const char *data = gsr_data(sigReg);
*
* for (el=0; el<nEls; el++) {
* data += elSize;
* }
* }
* } while((sigReg = gsr_NextReg(sigReg)) != NULL);
*/
/*******************************************************************************
* SIGLIST: PUBLIC ACCESSORS *
******************************************************************************/
/*
* Number of signals in the signal list.
*/
#define gsl_nSigs(sigList) ((sigList)->nSigs)
/*
* Number of regions comprising the 'listIdx-th' signal in the list.
*/
#define gsl_nSigRegions(sigList,lstIdx) \
(sigList->sigInfos[(lstIdx)].sigMap->nSigRegions)
/*
* A pointer to the first region of the 'listIdx-th'signal in the list.
*/
#define gsl_FirstReg(sigList,lstIdx) \
(&sigList->sigInfos[(lstIdx)].sigMap->sigRegions)
/*
* The total number of elements comprising the 'listIdx-th' signal in the list.
*/
#define gsl_NumElements(sigList,lstIdx) \
(sigList->sigInfos[(lstIdx)].sigMap->nEls)
/*
* Returns true if the signal is a tie wrap. This means that the signal map
* consists of either:
* o one entire signal (i.e., the output of 1 non-virtual block)
* o a simple bundling together of multiple entire signals
*
* Generally the only way to get a non-tie-wrapped signal is to mix the
* elements of existing signals or re-shuffle them via the use of the selector,
* mux and demux blocks.
*
*
* ----- ----- --------
* | 1 | ---->| | ----- | |
* ----- | | | | ------>| |
* constant | | tie wrap | |------ | | | not a tie wrap
* ----- | |---------->| | | | | |--------------->
* | 1 | ---->| | | | ---|--| | | elements got
* ----- | | | |--| |-------->| | shuffled
* constant ----- | | | |
* mux ----- --------
* demux mux
*
*
*/
#define gsl_TieWrap(sigList,lstIdx) \
(sigList->sigInfos[(lstIdx)].sigMap->tieWrap)
/*
* Get the pointer to the port associated with the 'listIdx-th' signal in the
* list.
*/
#define gsl_PortObj(sigList,lstIdx) \
(sigList->sigInfos[(lstIdx)].portObj)
/*
* Get a pointer to the sigMap associated with the 'listIdx-th' signal in the
* list.
*/
#define gsl_SigMap(sigList,lstIdx) ((sigList)->sigInfos[(lstIdx)].sigMap)
/*******************************************************************************
* SIGMAP: PUBLIC ACCESSORS *
******************************************************************************/
/*
* A pointer to the first region of the 'listIdx-th'signal in the list.
*/
#define gsm_FirstReg(sigMap) (&((sigMap)->sigRegions))
/*
* The number of signal regions.
*/
#define gsm_nSigRegions(sigMap) ((sigMap)->nSigRegions)
/*
* Is the map a simple tie wrap.
*/
#define gsm_TieWrap(sigMap) ((sigMap)->tieWrap)
/*******************************************************************************
* SIGREGION: PUBLIC ACCESSORS *
******************************************************************************/
/*
* The number of elements in the region.
*/
#define gsr_nEls(reg) ((reg)->nEls)
/*
* A pointer to the next region in the linked list. NULL if at the end of
* the list.
*/
#define gsr_NextReg(reg) ((reg)->next)
/*
* A const char * pointer into the data.
*/
#define gsr_data(reg) ((const char *)((reg)->data))
/*
* Starting element of the region (i.e., 'data' points to the 'startIdx'
* element of the port)
*/
#define gsr_startIdx(reg) ((reg)->startIdx)
/*
* Output port associated with region.
*/
#define gsr_portObj(reg) ((reg)->portObj)
/*
* The simulink data type identifier for the region.
*/
#define gsr_DataType(reg) ((reg)->dType)
/*
* The number of bytes in one, non-complex data value.
*/
#define gsr_DataTypeSize(reg) ((reg)->dTypeSize)
/*
* True if the data region contains complex elements.
*/
#define gsr_Complex(reg) ((reg)->complexity)
/*
* If a matrix, the number of rows, else -1.
*/
#define gsr_M(reg) ((reg)->m)
/*
* If a matrix, the number of cols, else -1.
*/
#define gsr_N(reg) ((reg)->n)
/*
* The availability status of the region (SLREG_AVAIL if avail, else one
* of the status described above in the "Public Description" section.
*/
#define gsr_status(reg) ((reg)->status)
#endif /* sigmapdef_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -