📄 c1_myuart.c
字号:
/* Include files */
#include "MyUART_sfun.h"
#include "c1_MyUART.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance.instanceNumber)
#include "MyUART_sfun_debug_macros.h"
/* Type Definitions */
/* Named Constants */
#define c1_IN_NO_ACTIVE_CHILD (0)
#define c1_IN_idle (1)
#define c1_IN_start (4)
#define c1_IN_receuve (3)
#define c1_IN_next (2)
#define c1_IN_stop (5)
/* Variable Declarations */
/* Variable Definitions */
static SFc1_MyUARTInstanceStruct chartInstance;
/* Function Declarations */
static void initialize_c1_MyUART(void);
static void initialize_params_c1_MyUART(void);
static void enable_c1_MyUART(void);
static void disable_c1_MyUART(void);
static void finalize_c1_MyUART(void);
static void sf_c1_MyUART(void);
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber);
static int32_T c1__s32_add__(int32_T c1_b, int32_T c1_c);
static uint8_T c1__u8_s32_(int32_T c1_b);
static int32_T c1__s32_shl_s32_(int32_T c1_b, int32_T c1_c);
static void init_test_point_addr_map(void);
static void **get_test_point_address_map(void);
static rtwCAPI_ModelMappingInfo *get_test_point_mapping_info(void);
static void init_dsm_address_info(void);
/* Function Definitions */
static void initialize_c1_MyUART(void)
{
uint8_T c1_previousEvent;
uint8_T *c1_RxDData;
uint8_T *c1_valid;
c1_valid = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 2);
c1_RxDData = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 1);
_sfTime_ = (real_T)ssGetT(chartInstance.S);
chartInstance.c1_tp_idle = 0U;
chartInstance.c1_tp_next = 0U;
chartInstance.c1_tp_receuve = 0U;
chartInstance.c1_tp_start = 0U;
chartInstance.c1_tp_stop = 0U;
chartInstance.c1_is_active_c1_MyUART = 0U;
chartInstance.c1_is_c1_MyUART = 0U;
chartInstance.c1_BitCnt = 0U;
chartInstance.c1_RateCnt = 0U;
chartInstance.c1_TmpData = 0U;
if (!((boolean_T)cdrGetOutputPortReusable(chartInstance.S, 1) != 0)) {
*c1_RxDData = 0U;
}
if (!((boolean_T)cdrGetOutputPortReusable(chartInstance.S, 2) != 0)) {
*c1_valid = 0U;
}
c1_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
chartInstance.c1_is_active_c1_MyUART = 1U;
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,0);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_idle;
_SFD_CS_CALL(STATE_ACTIVE_TAG,0);
chartInstance.c1_tp_idle = 1U;
chartInstance.c1_BitCnt = 0U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
*c1_valid = 0U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
_sfEvent_ = c1_previousEvent;
}
static void initialize_params_c1_MyUART(void)
{
}
static void enable_c1_MyUART(void)
{
_sfTime_ = (real_T)ssGetT(chartInstance.S);
}
static void disable_c1_MyUART(void)
{
_sfTime_ = (real_T)ssGetT(chartInstance.S);
}
static void finalize_c1_MyUART(void)
{
}
static void sf_c1_MyUART(void)
{
uint8_T c1_previousEvent;
uint8_T c1_u0;
uint8_T c1_u1;
uint8_T c1_u2;
uint8_T c1_u3;
uint8_T *c1_valid;
uint8_T *c1_RxD;
uint8_T *c1_RxDData;
c1_valid = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 2);
c1_RxDData = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 1);
c1_RxD = (uint8_T *)ssGetInputPortSignal(chartInstance.S, 0);
_sfTime_ = (real_T)ssGetT(chartInstance.S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG,0);
_SFD_DATA_RANGE_CHECK((real_T)*c1_RxD, 0U);
_SFD_DATA_RANGE_CHECK((real_T)*c1_RxDData, 1U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_TmpData, 4U);
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
c1_previousEvent = _sfEvent_;
_sfEvent_ = CALL_EVENT;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
switch (chartInstance.c1_is_c1_MyUART) {
case c1_IN_idle:
CV_CHART_EVAL(0,0,1);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,0);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,1);
if (CV_TRANSITION_EVAL(1U, (int32_T)_SFD_CCP_CALL(1,0,(((uint8_T)(*c1_RxD &
1U) == 0)!=0))) != 0U != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,1);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,0);
chartInstance.c1_tp_idle = 0U;
_SFD_CS_CALL(STATE_INACTIVE_TAG,0);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_start;
_SFD_CS_CALL(STATE_ACTIVE_TAG,3);
chartInstance.c1_tp_start = 1U;
chartInstance.c1_RateCnt = 7U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
*c1_valid = 0U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
} else {
chartInstance.c1_BitCnt = 0U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
*c1_valid = 0U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
break;
case c1_IN_next:
CV_CHART_EVAL(0,0,2);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,1);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,2);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,1);
chartInstance.c1_tp_next = 0U;
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
_SFD_CS_CALL(STATE_INACTIVE_TAG,1);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_receuve;
_SFD_CS_CALL(STATE_ACTIVE_TAG,2);
chartInstance.c1_tp_receuve = 1U;
chartInstance.c1_RateCnt = 14U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,1);
break;
case c1_IN_receuve:
CV_CHART_EVAL(0,0,3);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,2);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,3);
if (CV_TRANSITION_EVAL(3U, (int32_T)_SFD_CCP_CALL(3,0,(((uint8_T)
(chartInstance.c1_BitCnt & 15U) == 8U)!=0))) != 0U != 0) {
if (sf_debug_transition_conflict_check_enabled()) {
unsigned int transitionList[2];
unsigned int numTransitions= 1;
transitionList[0] = 3;
sf_debug_transition_conflict_check_begin();
if ((uint8_T)(chartInstance.c1_RateCnt & 15U) == 0) {
transitionList[numTransitions] = 4;
numTransitions++;
}
sf_debug_transition_conflict_check_end();
if (numTransitions>1) {
_SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
}
}
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,3);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,2);
chartInstance.c1_tp_receuve = 0U;
_SFD_CS_CALL(STATE_INACTIVE_TAG,2);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_stop;
_SFD_CS_CALL(STATE_ACTIVE_TAG,4);
chartInstance.c1_tp_stop = 1U;
chartInstance.c1_RateCnt = 7U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
*c1_RxDData = chartInstance.c1_TmpData;
_SFD_DATA_RANGE_CHECK((real_T)*c1_RxDData, 1U);
*c1_valid = 1U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
} else {
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,4);
if (CV_TRANSITION_EVAL(4U, (int32_T)_SFD_CCP_CALL(4,0,(((uint8_T)
(chartInstance.c1_RateCnt & 15U) == 0)!=0))) != 0U != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,4);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,2);
chartInstance.c1_tp_receuve = 0U;
_SFD_CS_CALL(STATE_INACTIVE_TAG,2);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_next;
_SFD_CS_CALL(STATE_ACTIVE_TAG,1);
chartInstance.c1_tp_next = 1U;
c1_u0 = c1__u8_s32_(chartInstance.c1_BitCnt + 1);
if (c1_u0 > 15) {
sf_debug_overflow_detection(0U, 0U);
}
chartInstance.c1_BitCnt = (uint8_T)(c1_u0 & 15U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
chartInstance.c1_TmpData = c1__u8_s32_(c1__s32_add__(c1__s32_shl_s32_
((int32_T)*c1_RxD, 7), chartInstance.c1_TmpData >> 1));
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_TmpData, 4U);
} else {
c1_u1 = c1__u8_s32_(chartInstance.c1_RateCnt - 1);
if (c1_u1 > 15) {
sf_debug_overflow_detection(0U, 0U);
}
chartInstance.c1_RateCnt = (uint8_T)(c1_u1 & 15U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
}
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,2);
break;
case c1_IN_start:
CV_CHART_EVAL(0,0,4);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,3);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,5);
if (CV_TRANSITION_EVAL(5U, (int32_T)_SFD_CCP_CALL(5,0,(((uint8_T)
(chartInstance.c1_RateCnt & 15U) == 0)!=0))) != 0U != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,5);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,6);
if (CV_TRANSITION_EVAL(6U, (int32_T)_SFD_CCP_CALL(6,0,(((uint8_T)(*c1_RxD
& 1U) == 1)!=0))) != 0U != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,6);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
chartInstance.c1_tp_start = 0U;
_SFD_CS_CALL(STATE_INACTIVE_TAG,3);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_idle;
_SFD_CS_CALL(STATE_ACTIVE_TAG,0);
chartInstance.c1_tp_idle = 1U;
chartInstance.c1_BitCnt = 0U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
*c1_valid = 0U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
} else {
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,7);
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,7);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,3);
chartInstance.c1_tp_start = 0U;
_SFD_CS_CALL(STATE_INACTIVE_TAG,3);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_receuve;
_SFD_CS_CALL(STATE_ACTIVE_TAG,2);
chartInstance.c1_tp_receuve = 1U;
chartInstance.c1_RateCnt = 14U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
}
} else {
c1_u2 = c1__u8_s32_(chartInstance.c1_RateCnt - 1);
if (c1_u2 > 15) {
sf_debug_overflow_detection(0U, 0U);
}
chartInstance.c1_RateCnt = (uint8_T)(c1_u2 & 15U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,3);
break;
case c1_IN_stop:
CV_CHART_EVAL(0,0,5);
_SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,4);
_SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,8);
if (CV_TRANSITION_EVAL(8U, (int32_T)_SFD_CCP_CALL(8,0,(((uint8_T)
(chartInstance.c1_RateCnt & 15U) == 0)!=0))) != 0U != 0) {
_SFD_CT_CALL(TRANSITION_ACTIVE_TAG,8);
_SFD_CS_CALL(STATE_ENTER_EXIT_FUNCTION_TAG,4);
chartInstance.c1_tp_stop = 0U;
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
_SFD_CS_CALL(STATE_INACTIVE_TAG,4);
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,4);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_idle;
_SFD_CS_CALL(STATE_ACTIVE_TAG,0);
chartInstance.c1_tp_idle = 1U;
chartInstance.c1_BitCnt = 0U;
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_BitCnt, 2U);
*c1_valid = 0U;
_SFD_DATA_RANGE_CHECK((real_T)*c1_valid, 5U);
} else {
c1_u3 = c1__u8_s32_(chartInstance.c1_RateCnt - 1);
if (c1_u3 > 15) {
sf_debug_overflow_detection(0U, 0U);
}
chartInstance.c1_RateCnt = (uint8_T)(c1_u3 & 15U);
_SFD_DATA_RANGE_CHECK((real_T)chartInstance.c1_RateCnt, 3U);
}
_SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,4);
break;
default:
CV_CHART_EVAL(0,0,0);
chartInstance.c1_is_c1_MyUART = (uint8_T)c1_IN_NO_ACTIVE_CHILD;
_SFD_CS_CALL(STATE_INACTIVE_TAG,0);
break;
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
_sfEvent_ = c1_previousEvent;
sf_debug_check_for_state_inconsistency(_MyUARTMachineNumber_,
chartInstance.chartNumber, chartInstance.instanceNumber);
}
static void init_script_number_translation(uint32_T c1_machineNumber, uint32_T
c1_chartNumber)
{
}
const mxArray *sf_c1_MyUART_get_eml_resolved_functions_info(void)
{
const mxArray *c1_nameCaptureInfo = NULL;
c1_nameCaptureInfo = NULL;
sf_mex_assign(&c1_nameCaptureInfo, sf_mex_create(NULL, "nameCaptureInfo", 0,
0U, 1U, 2, 0, 1));
return c1_nameCaptureInfo;
}
static int32_T c1__s32_add__(int32_T c1_b, int32_T c1_c)
{
int32_T c1_a;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -