📄 c2_myuart1.c
字号:
}
_SFD_TRANS_COV_WTS(3,0,0,0,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(3,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(8,0,1,0,0);
if (chartAlreadyPresent==0) {
static unsigned int sStartGuardMap[] = { 1 };
static unsigned int sEndGuardMap[] = { 11 };
_SFD_TRANS_COV_MAPS(8,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(10,0,1,0,0);
if (chartAlreadyPresent==0) {
static unsigned int sStartGuardMap[] = { 1 };
static unsigned int sEndGuardMap[] = { 10 };
_SFD_TRANS_COV_MAPS(10,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(4,0,1,0,0);
if (chartAlreadyPresent==0) {
static unsigned int sStartGuardMap[] = { 1 };
static unsigned int sEndGuardMap[] = { 11 };
_SFD_TRANS_COV_MAPS(4,
0,NULL,NULL,
1,&(sStartGuardMap[0]),&(sEndGuardMap[0]),
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(13,0,0,0,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(13,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(6,0,0,0,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(6,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
_SFD_TRANS_COV_WTS(14,0,0,0,0);
if (chartAlreadyPresent==0) {
_SFD_TRANS_COV_MAPS(14,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL,
0,NULL,NULL);
}
{
uint8_T *c2_TxDData;
uint8_T *c2_TxD;
uint8_T *c2_Wr;
uint8_T *c2_Ready;
c2_TxDData = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 0);
c2_Wr = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 2);
c2_TxD = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 1);
c2_Ready = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 1);
_SFD_SET_DATA_VALUE_PTR(0U, c2_TxDData);
_SFD_SET_DATA_VALUE_PTR(1U, c2_TxD);
_SFD_SET_DATA_VALUE_PTR(2U, &chartInstance.c2_Tmp);
_SFD_SET_DATA_VALUE_PTR(3U, &chartInstance.c2_BitCnt);
_SFD_SET_DATA_VALUE_PTR(4U, &chartInstance.c2_RateCnt);
_SFD_SET_DATA_VALUE_PTR(5U, c2_Wr);
_SFD_SET_DATA_VALUE_PTR(6U, c2_Ready);
}
}
}
} else {
sf_debug_reset_current_state_configuration(_MyUART1MachineNumber_,
chartInstance.chartNumber,chartInstance.instanceNumber);
}
}
static void sf_opaque_initialize_c2_MyUART1(void *chartInstanceVar)
{
chart_debug_initialization(chartInstance.S,0);
initialize_params_c2_MyUART1();
initialize_c2_MyUART1();
}
static void sf_opaque_enable_c2_MyUART1(void *chartInstanceVar)
{
enable_c2_MyUART1();
}
static void sf_opaque_disable_c2_MyUART1(void *chartInstanceVar)
{
disable_c2_MyUART1();
}
static void sf_opaque_gateway_c2_MyUART1(void *chartInstanceVar)
{
sf_c2_MyUART1();
}
static void sf_opaque_terminate_c2_MyUART1(void *chartInstanceVar)
{
if (sim_mode_is_rtw_gen(chartInstance.S) || sim_mode_is_external
(chartInstance.S)) {
sf_clear_rtw_identifier(chartInstance.S);
}
finalize_c2_MyUART1();
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_MyUART1(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
initialize_params_c2_MyUART1();
}
}
static void mdlSetWorkWidths_c2_MyUART1(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable("MyUART1","MyUART1",2);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop("MyUART1","MyUART1",2,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop("MyUART1","MyUART1",2,
"gatewayCannotBeInlinedMultipleTimes"));
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,"MyUART1","MyUART1",2,2);
sf_mark_chart_reusable_outputs(S,"MyUART1","MyUART1",2,2);
}
sf_set_rtw_dwork_info(S,"MyUART1","MyUART1",2);
ssSetHasSubFunctions(S,!(chartIsInlinable));
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetCallsOutputInInitFcn(S,1);
}
ssSetChecksum0(S,(2273564009U));
ssSetChecksum1(S,(2329695163U));
ssSetChecksum2(S,(3992932861U));
ssSetChecksum3(S,(756820328U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
}
static void mdlRTW_c2_MyUART1(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
sf_write_symbol_mapping(S, "MyUART1", "MyUART1",2);
ssWriteRTWStrParam(S, "StateflowChartType", "Stateflow");
}
}
static void mdlStart_c2_MyUART1(SimStruct *S)
{
chartInstance.chartInfo.chartInstance = NULL;
chartInstance.chartInfo.isEMLChart = 0;
chartInstance.chartInfo.chartInitialized = 0;
chartInstance.chartInfo.sFunctionGateway = sf_opaque_gateway_c2_MyUART1;
chartInstance.chartInfo.initializeChart = sf_opaque_initialize_c2_MyUART1;
chartInstance.chartInfo.terminateChart = sf_opaque_terminate_c2_MyUART1;
chartInstance.chartInfo.enableChart = sf_opaque_enable_c2_MyUART1;
chartInstance.chartInfo.disableChart = sf_opaque_disable_c2_MyUART1;
chartInstance.chartInfo.zeroCrossings = NULL;
chartInstance.chartInfo.outputs = NULL;
chartInstance.chartInfo.derivatives = NULL;
chartInstance.chartInfo.mdlRTW = mdlRTW_c2_MyUART1;
chartInstance.chartInfo.mdlStart = mdlStart_c2_MyUART1;
chartInstance.chartInfo.mdlSetWorkWidths = mdlSetWorkWidths_c2_MyUART1;
chartInstance.chartInfo.extModeExec = NULL;
chartInstance.chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance.chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance.chartInfo.storeCurrentConfiguration = NULL;
chartInstance.S = S;
ssSetUserData(S,(void *)(&(chartInstance.chartInfo)));/* register the chart instance with simstruct */
if (!sim_mode_is_rtw_gen(S)) {
init_test_point_mapping_info(S);
init_dsm_address_info();
}
chart_debug_initialization(S,1);
}
void c2_MyUART1_method_dispatcher(SimStruct *S, int_T method, void *data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c2_MyUART1(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c2_MyUART1(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c2_MyUART1(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c2_MyUART1_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
static const rtwCAPI_DataTypeMap dataTypeMap[] = {
/* cName, mwName, numElements, elemMapIndex, dataSize, slDataId, isComplex, isPointer */
{ "uint8_T", "uint8_T", 0, 0, sizeof(uint8_T), SS_UINT8, 0, 0 } };
static real_T fixPtSlopeBiasVals[2] = {
0,
1 };
static const rtwCAPI_FixPtMap fixedPointMap[] = {
/* *fracSlope, *bias, scaleType, wordLength, exponent, isSigned */
{ &fixPtSlopeBiasVals[1], &fixPtSlopeBiasVals[0], rtwCAPI_FIX_UNIFORM_SCALING,
4, 0, 0 },
{ &fixPtSlopeBiasVals[1], &fixPtSlopeBiasVals[0], rtwCAPI_FIX_UNIFORM_SCALING,
5, 0, 0 },
{ &fixPtSlopeBiasVals[1], &fixPtSlopeBiasVals[0], rtwCAPI_FIX_UNIFORM_SCALING,
8, 0, 0 },
{ NULL, NULL, rtwCAPI_FIX_RESERVED, 64, 0, 0 } };
static const rtwCAPI_DimensionMap dimensionMap[] = {
/* dataOrientation, dimArrayIndex, numDims*/
{ rtwCAPI_SCALAR, 0, 2 } };
static const uint_T dimensionArray[] = {
1, 1 };
static real_T sfCAPIsampleTimeZero = 0.0;
static const rtwCAPI_SampleTimeMap sampleTimeMap[] = {
/* *period, *offset, taskId, mode */
{ &sfCAPIsampleTimeZero, &sfCAPIsampleTimeZero, 0, 0 }
};
static const rtwCAPI_Signals testPointSignals[] = {
/* addrMapIndex, sysNum, SFRelativePath, dataName, portNumber, dataTypeIndex, dimIndex, fixPtIdx, sTimeIndex */
{ 0, 0, "StateflowChart/Tmp", "Tmp", 0, 0, 0, 2, 0 },
{ 1, 0, "StateflowChart/BitCnt", "BitCnt", 0, 0, 0, 0, 0 },
{ 2, 0, "StateflowChart/RateCnt", "RateCnt", 0, 0, 0, 1, 0 },
{ 3, 0, "StateflowChart/S", "S", 0, 0, 0, 3, 0 },
{ 4, 0, "StateflowChart/S.CntPro", "CntPro", 0, 0, 0, 3, 0 },
{ 5, 0, "StateflowChart/S.CntPro.DEC", "DEC", 0, 0, 0, 3, 0 },
{ 6, 0, "StateflowChart/S.CntPro.Last", "Last", 0, 0, 0, 3, 0 },
{ 7, 0, "StateflowChart/S.CntPro.WAIT", "WAIT", 0, 0, 0, 3, 0 },
{ 8, 0, "StateflowChart/S.TxdPro", "TxdPro", 0, 0, 0, 3, 0 },
{ 9, 0, "StateflowChart/S.TxdPro.DATA", "DATA", 0, 0, 0, 3, 0 },
{ 10, 0, "StateflowChart/S.TxdPro.DELAY2", "DELAY2", 0, 0, 0, 3, 0 },
{ 11, 0, "StateflowChart/S.TxdPro.Delay", "Delay", 0, 0, 0, 3, 0 },
{ 12, 0, "StateflowChart/S.TxdPro.IDLE", "IDLE", 0, 0, 0, 3, 0 },
{ 13, 0, "StateflowChart/S.TxdPro.START", "START", 0, 0, 0, 3, 0 },
{ 14, 0, "StateflowChart/S.TxdPro.STOP", "STOP", 0, 0, 0, 3, 0 } };
static rtwCAPI_ModelMappingStaticInfo testPointMappingStaticInfo = {
/* block signal monitoring */
{
testPointSignals, /* Block signals Array */
15 /* Num Block IO signals */
},
/* parameter tuning */
{
NULL, /* Block parameters Array */
0, /* Num block parameters */
NULL, /* Variable parameters Array */
0 /* Num variable parameters */
},
/* block states */
{
NULL, /* Block States array */
0 /* Num Block States */
},
/* Static maps */
{
dataTypeMap, /* Data Type Map */
dimensionMap, /* Data Dimension Map */
fixedPointMap, /* Fixed Point Map */
NULL, /* Structure Element map */
sampleTimeMap, /* Sample Times Map */
dimensionArray /* Dimension Array */
},
/* Target type */
"float"
};
static void init_test_point_mapping_info(SimStruct *S)
{
rtwCAPI_ModelMappingInfo *testPointMappingInfo;
void **testPointAddrMap;
init_test_point_addr_map();
testPointMappingInfo = get_test_point_mapping_info();
testPointAddrMap = get_test_point_address_map();
rtwCAPI_SetStaticMap(*testPointMappingInfo, &testPointMappingStaticInfo);
rtwCAPI_SetLoggingStaticMap(*testPointMappingInfo, NULL);
rtwCAPI_SetInstanceLoggingInfo(*testPointMappingInfo, NULL);
rtwCAPI_SetPath(*testPointMappingInfo, "");
rtwCAPI_SetFullPath(*testPointMappingInfo, NULL);
rtwCAPI_SetDataAddressMap(*testPointMappingInfo, testPointAddrMap);
rtwCAPI_SetChildMMIArray(*testPointMappingInfo, NULL);
rtwCAPI_SetChildMMIArrayLen(*testPointMappingInfo, 0);
ssSetModelMappingInfoPtr(S, testPointMappingInfo);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -