⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bluetooth_lib2_sfun_c4.c

📁 在matlab的simulink中实现的无线蓝牙模块
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "bluetooth_lib2_sfun.h"
#include "bluetooth_lib2_sfun_c4.h"
#define mexPrintf                       sf_mex_printf
#ifdef printf
#undef printf
#endif
#define printf                          sf_mex_printf
#define CHARTINSTANCE_CHARTNUMBER       (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER    (chartInstance->instanceNumber)
#include "bluetooth_lib2_sfun_debug_macros.h"
#define IN_NO_ACTIVE_CHILD              (0)
#define IN_m1_c4_s1_Not_SCORT           1
#define IN_m1_c4_s2_SCORT               2
#define IN_m1_c4_s12_Unknown_Packet_Type 3
#define IN_m1_c4_s3_Slot_pair_1         1
#define IN_m1_c4_s6_Slot_pair_2         2
#define IN_m1_c4_s9_Slot_pair_3         3
#define IN_m1_c4_s4_Bad                 1
#define IN_m1_c4_s5_Good                2
#define IN_m1_c4_s7_Bad                 1
#define IN_m1_c4_s8_Good                2
#define IN_m1_c4_s10_Bad                1
#define IN_m1_c4_s11_Good               2
#define InputData_m1_c4_d3_AM_ADDR_OK   (((real_T *)(ssGetInputPortSignal(chartInstance->S,0)))[0])
#define InputData_m1_c4_d4_HEC_OK       (((real_T *)(ssGetInputPortSignal(chartInstance->S,1)))[0])
#define InputData_m1_c4_d5_Slot_OK      (((real_T *)(ssGetInputPortSignal(chartInstance->S,2)))[0])
#define InputData_m1_c4_d6_Packet_Type  (((real_T *)(ssGetInputPortSignal(chartInstance->S,3)))[0])
#define InputData_m1_c4_d7_DM_DH_DV     (((real_T *)(ssGetInputPortSignal(chartInstance->S,4)))[0])
#define InputData_m1_c4_d8_SEQN         (((real_T *)(ssGetInputPortSignal(chartInstance->S,5)))[0])
#define InputData_m1_c4_d9_CRC_OK       (((real_T *)(ssGetInputPortSignal(chartInstance->S,6)))[0])
#define OutputData_m1_c4_d10_Pass_Frame (((real_T *)(ssGetOutputPortSignal(chartInstance->S,1)))[0])
#define OutputData_m1_c4_d11_Frame_OK   (((real_T *)(ssGetOutputPortSignal(chartInstance->S,2)))[0])

static void
enter_atomic_m1_c4_s3_Slot_pair_1(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_atomic_m1_c4_s3_Slot_pair_1(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_internal_m1_c4_s3_Slot_pair_1(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void enter_atomic_m1_c4_s4_Bad(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void enter_atomic_m1_c4_s5_Good(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
enter_atomic_m1_c4_s6_Slot_pair_2(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_atomic_m1_c4_s6_Slot_pair_2(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_internal_m1_c4_s6_Slot_pair_2(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void enter_atomic_m1_c4_s8_Good(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
enter_atomic_m1_c4_s9_Slot_pair_3(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_atomic_m1_c4_s9_Slot_pair_3(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_internal_m1_c4_s9_Slot_pair_3(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void enter_atomic_m1_c4_s11_Good(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void
exit_atomic_m1_c4_s12_Unknown_Packet_Type(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void m1_c4_s13_Accept_Payload(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
static void m1_c4_s14_Reject_Payload(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance);
void bluetooth_lib2_sfun_c4(SFbluetooth_lib2_sfun_c4InstanceStruct
 *chartInstance)
{
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
  if(chartInstance->State.is_active_bluetooth_lib2_sfun_c4 == 0) {
    _SFD_CC_CALL(CHART_ENTER_ENTRY_FUNCTION_TAG,0);
    chartInstance->State.is_active_bluetooth_lib2_sfun_c4 = 1;
    _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,12);
    _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,12);
    _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,12);
    _SFD_CS_CALL(STATE_ENTER_ENTRY_FUNCTION_TAG,6);
    _SFD_CCS_CALL(STATE_ENTRY_COVERAGE_TAG,6,0);
    chartInstance->State.is_bluetooth_lib2_sfun_c4 =
      IN_m1_c4_s12_Unknown_Packet_Type;
    _SFD_CS_CALL(STATE_ACTIVE_TAG,6);
    _SFD_CS_CALL(EXIT_OUT_OF_FUNCTION_TAG,6);
  } else {
    switch(chartInstance->State.is_bluetooth_lib2_sfun_c4) {
     case IN_m1_c4_s1_Not_SCORT:
      CV_CHART_EVAL(0,0,1);
      _SFD_CS_CALL(STATE_ENTER_DURING_FUNCTION_TAG,7);
      _SFD_CCS_CALL(STATE_DURING_COVERAGE_TAG,7,0);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,24);
      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,24);
      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,24);
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,33);
      if(CV_TRANSITION_EVAL(33,
        !(_SFD_CCP_CALL(33,0,(InputData_m1_c4_d4_HEC_OK)) != 0)) != 0) {
        if(sf_debug_transition_conflict_check_enabled()) {
          unsigned int transitionList[2];
          unsigned int numTransitions=1;
          transitionList[0] = 33;
          sf_debug_transition_conflict_check_begin();
          if(InputData_m1_c4_d4_HEC_OK != 0.0) {
            transitionList[numTransitions] = 22;
            numTransitions++;
          }
          sf_debug_transition_conflict_check_end();
          if(numTransitions>1) {
            _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
          }
        }
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,33);
        _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,33);
        _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,33);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,27);
        _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,27);
        _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,27);
        goto sf_label_1;
      } else {
        _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,22);
        if(CV_TRANSITION_EVAL(22,
          _SFD_CCP_CALL(22,0,(InputData_m1_c4_d4_HEC_OK))) != 0) {
          _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,22);
          _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,22);
          _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,22);
          _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,13);
          if(CV_TRANSITION_EVAL(13,
            !(_SFD_CCP_CALL(13,0,(InputData_m1_c4_d3_AM_ADDR_OK)) != 0)) != 0) {
            if(sf_debug_transition_conflict_check_enabled()) {
              unsigned int transitionList[2];
              unsigned int numTransitions=1;
              transitionList[0] = 13;
              sf_debug_transition_conflict_check_begin();
              if(InputData_m1_c4_d3_AM_ADDR_OK != 0.0) {
                transitionList[numTransitions] = 23;
                numTransitions++;
              }
              sf_debug_transition_conflict_check_end();
              if(numTransitions>1) {
                _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
              }
            }
            _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,13);
            _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,13);
            _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,13);
            goto sf_label_1;
          } else {
            _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,23);
            if(CV_TRANSITION_EVAL(23,
              _SFD_CCP_CALL(23,0,(InputData_m1_c4_d3_AM_ADDR_OK))) != 0) {
              _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,23);
              _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,23);
              _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,23);
              _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,32);
              if(CV_TRANSITION_EVAL(32,
                _SFD_CCP_CALL(32,0,(InputData_m1_c4_d7_DM_DH_DV))) != 0) {
                if(sf_debug_transition_conflict_check_enabled()) {
                  unsigned int transitionList[2];
                  unsigned int numTransitions=1;
                  transitionList[0] = 32;
                  sf_debug_transition_conflict_check_begin();
                  if(!(InputData_m1_c4_d7_DM_DH_DV != 0.0)) {
                    transitionList[numTransitions] = 28;
                    numTransitions++;
                  }
                  sf_debug_transition_conflict_check_end();
                  if(numTransitions>1) {
                    _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
                  }
                }
                _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,32);
                _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,32);
                _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,32);
                _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,6);
                if(CV_TRANSITION_EVAL(6,
                  _SFD_CCP_CALL(6,0,(InputData_m1_c4_d8_SEQN !=
                    chartInstance->LocalData.m1_c4_d2_SEQN_old)))
                 != 0) {
                  _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,6);
                  _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,6);
                  _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,6);
                  _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,15);
                  if(CV_TRANSITION_EVAL(15,
                    !(_SFD_CCP_CALL(15,0,(InputData_m1_c4_d9_CRC_OK)) != 0)) !=
                   0) {
                    if(sf_debug_transition_conflict_check_enabled()) {
                      unsigned int transitionList[2];
                      unsigned int numTransitions=1;
                      transitionList[0] = 15;
                      sf_debug_transition_conflict_check_begin();
                      if(InputData_m1_c4_d9_CRC_OK != 0.0) {
                        transitionList[numTransitions] = 8;
                        numTransitions++;
                      }
                      sf_debug_transition_conflict_check_end();
                      if(numTransitions>1) {
                        _SFD_TRANSITION_CONFLICT(&(transitionList[0]),numTransitions);
                      }
                    }
                    _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,15);
                    _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,15);
                    _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,15);
                    goto sf_label_2;
                  } else {
                    _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,8);
                    if(CV_TRANSITION_EVAL(8,
                      _SFD_CCP_CALL(8,0,(InputData_m1_c4_d9_CRC_OK))) != 0) {
                      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,8);
                      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,8);
                      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,8);
                      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,10);
                      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,10);
                      _SFD_CT_CALL(TRANSITION_BEFORE_COND_ACTION_TAG,10);
                      _SFD_CHART_CALL(EVENT_OBJECT,EVENT_BEFORE_BROADCAST_TAG,0);
                      if(chartInstance->chartInfo.chartInitialized==false) {
                        sf_mex_error_message("Cannot broadcast function call output event 'Latch_Payload' during initialization. "
                         "You have set 'Execute At Initialization' flag on the chart properties "
                         "that caused the chart to be executed at startup time. During startup, "
                         "function call output event broadcast is disallowed.");
                      }
                      ssCallSystem(chartInstance->S,0);
                      if(sf_mex_get_halt_simulation())
                      sf_mex_long_jump_on_error(2);
                      _SFD_CHART_CALL(EVENT_OBJECT,EVENT_AFTER_BROADCAST_TAG,0);
                      _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,10,0);
                      m1_c4_s13_Accept_Payload(chartInstance);
                      _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,10,1);
                      _SFD_CT_CALL(TRANSITION_AFTER_COND_ACTION_TAG,10);
                      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,10);
                      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,19);
                      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,19);
                      _SFD_CT_CALL(TRANSITION_BEFORE_COND_ACTION_TAG,19);
                      chartInstance->LocalData.m1_c4_d1_ARQN = 1.0;
                      _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,19,0);
                      _SFD_CT_CALL(TRANSITION_AFTER_COND_ACTION_TAG,19);
                      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,19);
                      goto sf_label_3;
                    }
                  }
                }
              }
            } else {
              goto sf_label_3;
            }
          }
        } else {
          goto sf_label_3;
        }
      }
      _SFD_CT_CALL(TRANSITION_BEFORE_PROCESSING_TAG,28);
      if(CV_TRANSITION_EVAL(28,
        !(_SFD_CCP_CALL(28,0,(InputData_m1_c4_d7_DM_DH_DV)) != 0)) != 0) {
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,28);
        _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,28);
        _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,28);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,2);
        _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,2);
        _SFD_CT_CALL(TRANSITION_BEFORE_COND_ACTION_TAG,2);
        _SFD_CHART_CALL(EVENT_OBJECT,EVENT_BEFORE_BROADCAST_TAG,0);
        if(chartInstance->chartInfo.chartInitialized==false) {
          sf_mex_error_message("Cannot broadcast function call output event 'Latch_Payload' during initialization. "
           "You have set 'Execute At Initialization' flag on the chart properties "
           "that caused the chart to be executed at startup time. During startup, "
           "function call output event broadcast is disallowed.");
        }
        ssCallSystem(chartInstance->S,0);
        if(sf_mex_get_halt_simulation()) sf_mex_long_jump_on_error(2);
        _SFD_CHART_CALL(EVENT_OBJECT,EVENT_AFTER_BROADCAST_TAG,0);
        _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,2,0);
        m1_c4_s13_Accept_Payload(chartInstance);
        _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,2,1);
        _SFD_CT_CALL(TRANSITION_AFTER_COND_ACTION_TAG,2);
        _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,2);
        _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,34);
        _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,34);
        _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,34);
      }
      goto sf_label_3;
      sf_label_1:;
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,21);
      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,21);
      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,21);
      sf_label_2:;
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,5);
      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,5);
      _SFD_CT_CALL(TRANSITION_BEFORE_COND_ACTION_TAG,5);
      m1_c4_s14_Reject_Payload(chartInstance);
      _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,5,0);
      _SFD_CT_CALL(TRANSITION_AFTER_COND_ACTION_TAG,5);
      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,5);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,36);
      _SFD_CT_CALL(TRANSITION_WHEN_VALID_TAG,36);
      _SFD_CT_CALL(TRANSITION_BEFORE_COND_ACTION_TAG,36);
      chartInstance->LocalData.m1_c4_d1_ARQN = 0.0;
      _SFD_CCT_CALL(TRANSITION_CONDITION_ACTION_COVERAGE_TAG,36,0);
      _SFD_CT_CALL(TRANSITION_AFTER_COND_ACTION_TAG,36);
      _SFD_CT_CALL(TRANSITION_INACTIVE_TAG,36);
      _SFD_CT_CALL(TRANSITION_ACTIVE_TAG,0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -