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

📄 c8_mysin4.c

📁 在matlab中添加dspbuilder用于实现dsp的算法
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Include files */

#include "mysin4_sfun.h"
#include "c8_mysin4.h"
#define CHARTINSTANCE_CHARTNUMBER      (chartInstance.chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER   (chartInstance.instanceNumber)
#include "mysin4_sfun_debug_macros.h"

/* Type Definitions */

/* Named Constants */
#define c8_IN_NO_ACTIVE_CHILD          (0)

/* Variable Declarations */

/* Variable Definitions */
static SFc8_mysin4InstanceStruct chartInstance;

/* Function Declarations */
static void initialize_c8_mysin4(void);
static void initialize_params_c8_mysin4(void);
static void enable_c8_mysin4(void);
static void disable_c8_mysin4(void);
static void finalize_c8_mysin4(void);
static void sf_c8_mysin4(void);
static void init_script_number_translation(uint32_T c8_machineNumber, uint32_T
  c8_chartNumber);
static const mxArray *c8_sf_marshall(void *c8_chartInstance, void *c8_u);
static const mxArray *c8_b_sf_marshall(void *c8_chartInstance, void *c8_u);
static const mxArray *c8_c_sf_marshall(void *c8_chartInstance, void *c8_u);
static const mxArray *c8_d_sf_marshall(void *c8_chartInstance, void *c8_u);
static const mxArray *c8_e_sf_marshall(void *c8_chartInstance, void *c8_u);
static const mxArray *c8_f_sf_marshall(void *c8_chartInstance, void *c8_u);
static void c8_info_helper(c8_ResolvedFunctionInfo c8_info[55]);
static void init_dsm_address_info(void);

/* Function Definitions */
static void initialize_c8_mysin4(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
  chartInstance.c8_count_not_empty = false;
  chartInstance.c8_m0 = NULL;
  chartInstance.c8_m1 = NULL;
  chartInstance.c8_m2 = NULL;
  chartInstance.c8_is_active_c8_mysin4 = 0U;
  sf_mex_assign(&chartInstance.c8_m2, sf_mex_call("numerictype", 1U, 12U, 15,
    "Signed", 12, 0, 15, "WordLength", 6, 6.0, 15,
    "FractionLength", 6, 0.0, 15, "BinaryPoint", 6, 0.0, 15, "FixedExponent", 6,
    0.0, 15, "Slope", 6, 1.0));
  sf_mex_assign(&chartInstance.c8_m1, sf_mex_call("fimath", 1U, 2U, 15,
    "RoundMode", 15, "floor"));
  sf_mex_assign(&chartInstance.c8_m0, sf_mex_call("numerictype", 1U, 12U, 15,
    "Signed", 12, 0, 15, "WordLength", 6, 5.0, 15,
    "FractionLength", 6, 0.0, 15, "BinaryPoint", 6, 0.0, 15, "FixedExponent", 6,
    0.0, 15, "Slope", 6, 1.0));
}

static void initialize_params_c8_mysin4(void)
{
}

static void enable_c8_mysin4(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
}

static void disable_c8_mysin4(void)
{
  _sfTime_ = (real_T)ssGetT(chartInstance.S);
}

static void finalize_c8_mysin4(void)
{
  sf_mex_destroy(&chartInstance.c8_m0);
  sf_mex_destroy(&chartInstance.c8_m1);
  sf_mex_destroy(&chartInstance.c8_m2);
}

static void sf_c8_mysin4(void)
{
  uint8_T c8_previousEvent;
  boolean_T c8_preset;
  real_T c8_nargout = 1.0;
  real_T c8_nargin = 1.0;
  uint8_T c8_inc;
  uint8_T c8_init_val;
  const mxArray *c8_result_fm = NULL;
  const mxArray *c8_result_nt = NULL;
  uint8_T c8_counter;
  real_T c8_val;
  real_T c8_d0;
  uint8_T c8_u0;
  const mxArray *c8_T = NULL;
  const mxArray *c8_F = NULL;
  const mxArray *c8_ERR = NULL;
  const mxArray *c8_b_val = NULL;
  uint8_T c8_a0;
  uint8_T c8_b0;
  uint8_T c8_a;
  uint8_T c8_b;
  uint8_T c8_ain;
  uint8_T c8_bin;
  uint32_T c8_u1;
  uint8_T c8_u2;
  const mxArray *c8_b_ERR = NULL;
  const mxArray *c8_a2SD = NULL;
  const mxArray *c8_b2SD = NULL;
  const mxArray *c8_Tsd = NULL;
  const mxArray *c8_tc = NULL;
  const mxArray *c8_errmsg = NULL;
  uint8_T c8_varargin_1;
  uint8_T c8_b_varargin_1;
  uint8_T c8_var1;
  uint8_T c8_u3;
  uint8_T c8_u4;
  uint8_T c8_hfi;
  const mxArray *c8_b_T = NULL;
  const mxArray *c8_b_F = NULL;
  const mxArray *c8_c_ERR = NULL;
  const mxArray *c8_c_val = NULL;
  const mxArray *c8_isautoscaled = NULL;
  boolean_T *c8_b_preset;
  uint8_T *c8_b_counter;
  c8_b_counter = (uint8_T *)ssGetOutputPortSignal(chartInstance.S, 1);
  c8_b_preset = (boolean_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)*c8_b_preset, 0U);
  _SFD_DATA_RANGE_CHECK((real_T)*c8_b_counter, 1U);
  c8_previousEvent = _sfEvent_;
  _sfEvent_ = CALL_EVENT;
  _SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG,0);
  c8_preset = *c8_b_preset;
  sf_debug_symbol_scope_push(9U, 0U);
  sf_debug_symbol_scope_add("count", &chartInstance.c8_count, c8_f_sf_marshall);
  sf_debug_symbol_scope_add_verbose("nargout", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0,
    0U, 0, 0U, 0, 0, &c8_nargout);
  sf_debug_symbol_scope_add_verbose("nargin", 0, 0U, 0U, 0U, 0U, 1.0, 0, 0.0, 0U,
    0, 0U, 0, 0, &c8_nargin);
  sf_debug_symbol_scope_add("inc", &c8_inc, c8_e_sf_marshall);
  sf_debug_symbol_scope_add("init_val", &c8_init_val, c8_b_sf_marshall);
  sf_debug_symbol_scope_add("result_fm", &c8_result_fm, c8_d_sf_marshall);
  sf_debug_symbol_scope_add("result_nt", &c8_result_nt, c8_c_sf_marshall);
  sf_debug_symbol_scope_add("counter", &c8_counter, c8_b_sf_marshall);
  sf_debug_symbol_scope_add("preset", &c8_preset, c8_sf_marshall);
  CV_EML_FCN(0, 0);

  /*  a preset counter, that counts how many times this block is called */
  /*  result 'counter' saturates if claled more than 15 times. */
  _SFD_EML_CALL(0,6);
  c8_result_nt = chartInstance.c8_m0;
  _SFD_EML_CALL(0,7);
  c8_result_fm = chartInstance.c8_m1;
  _SFD_EML_CALL(0,9);
  c8_val = 0.0;
  c8_d0 = c8_val;
  if (c8_d0 < 32.0) {
    if (c8_d0 >= 0.0) {
      c8_u0 = (uint8_T)c8_d0;
    } else {
      c8_u0 = 0U;
    }
  } else {
    c8_u0 = 31U;
  }

  c8_init_val = c8_u0;
  sf_mex_destroy(&c8_T);
  sf_mex_destroy(&c8_F);
  sf_mex_destroy(&c8_ERR);
  sf_mex_destroy(&c8_b_val);
  _SFD_EML_CALL(0,12);
  if (CV_EML_IF(0, 0, !chartInstance.c8_count_not_empty)) {
    _SFD_EML_CALL(0,13);
    chartInstance.c8_count = c8_init_val;
    chartInstance.c8_count_not_empty = true;
  }

  _SFD_EML_CALL(0,16);
  if (CV_EML_IF(0, 1, c8_preset)) {
    _SFD_EML_CALL(0,17);
    chartInstance.c8_count = c8_init_val;
  } else {
    _SFD_EML_CALL(0,19);
    c8_a0 = chartInstance.c8_count;
    c8_b0 = 1U;
    c8_a = c8_a0;
    c8_b = c8_b0;
    c8_ain = (uint8_T)(c8_a & 63U);
    c8_bin = (uint8_T)(c8_b & 63U);
    c8_u1 = (uint32_T)c8_ain + (uint32_T)c8_bin;
    if (c8_u1 > 63U) {
      c8_u2 = 63U;
    } else {
      c8_u2 = (uint8_T)c8_u1;
    }

    c8_inc = c8_u2;
    sf_mex_destroy(&c8_b_ERR);
    sf_mex_destroy(&c8_a2SD);
    sf_mex_destroy(&c8_b2SD);
    sf_mex_destroy(&c8_Tsd);
    sf_mex_destroy(&c8_tc);
    sf_mex_destroy(&c8_errmsg);
    _SFD_EML_CALL(0,20);
    c8_varargin_1 = c8_inc;
    c8_b_varargin_1 = c8_varargin_1;
    c8_var1 = c8_b_varargin_1;
    c8_u3 = c8_var1;
    if (c8_u3 > 31) {
      c8_u4 = 31U;
    } else {
      c8_u4 = c8_u3;
    }

    c8_hfi = c8_u4;
    sf_mex_destroy(&c8_b_T);
    sf_mex_destroy(&c8_b_F);
    sf_mex_destroy(&c8_c_ERR);
    sf_mex_destroy(&c8_c_val);
    sf_mex_destroy(&c8_isautoscaled);
    chartInstance.c8_count = c8_hfi;
  }

  _SFD_EML_CALL(0,23);
  c8_counter = chartInstance.c8_count;
  _SFD_EML_CALL(0,-23);
  sf_debug_symbol_scope_pop();
  *c8_b_counter = c8_counter;
  _SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG,0);
  _sfEvent_ = c8_previousEvent;
  sf_debug_check_for_state_inconsistency(_mysin4MachineNumber_,
    chartInstance.chartNumber, chartInstance.instanceNumber);
}

static void init_script_number_translation(uint32_T c8_machineNumber, uint32_T
  c8_chartNumber)
{
}

static const mxArray *c8_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  boolean_T c8_b_u;
  const mxArray *c8_b_y = NULL;
  c8_y = NULL;
  c8_b_u = *((boolean_T *)c8_u);
  c8_b_y = NULL;
  sf_mex_assign(&c8_b_y, sf_mex_create(&c8_b_u, "y", 9, 0U, 0U, 0));
  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

static const mxArray *c8_b_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  uint8_T c8_b_u;
  const mxArray *c8_b_y = NULL;
  uint8_T c8_c_u;
  const mxArray *c8_c_y = NULL;
  c8_y = NULL;
  c8_b_u = *((uint8_T *)c8_u);
  c8_b_y = NULL;
  c8_c_u = c8_b_u;
  c8_c_y = NULL;
  sf_mex_assign(&c8_c_y, sf_mex_create(&c8_c_u, "y", 3, 0U, 0U, 0));
  sf_mex_assign(&c8_b_y, sf_mex_call("embedded.fi", 1U, 6U, 15, "fimath", 14,
    sf_mex_dup(chartInstance.c8_m1), 15, "numerictype", 14,
    sf_mex_dup(chartInstance.c8_m0), 15, "intarray", 14, c8_c_y));
  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

static const mxArray *c8_c_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  const mxArray *c8_b_u;
  const mxArray *c8_b_y = NULL;
  c8_y = NULL;
  c8_b_u = sf_mex_dup(*((const mxArray **)c8_u));
  c8_b_y = NULL;
  sf_mex_assign(&c8_b_y, sf_mex_duplicatearraysafe(&c8_b_u));
  sf_mex_destroy(&c8_b_u);
  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

static const mxArray *c8_d_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  const mxArray *c8_b_u;
  const mxArray *c8_b_y = NULL;
  c8_y = NULL;
  c8_b_u = sf_mex_dup(*((const mxArray **)c8_u));
  c8_b_y = NULL;
  sf_mex_assign(&c8_b_y, sf_mex_duplicatearraysafe(&c8_b_u));
  sf_mex_destroy(&c8_b_u);
  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

static const mxArray *c8_e_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  uint8_T c8_b_u;
  const mxArray *c8_b_y = NULL;
  uint8_T c8_c_u;
  const mxArray *c8_c_y = NULL;
  c8_y = NULL;
  c8_b_u = *((uint8_T *)c8_u);
  c8_b_y = NULL;
  c8_c_u = c8_b_u;
  c8_c_y = NULL;
  sf_mex_assign(&c8_c_y, sf_mex_create(&c8_c_u, "y", 3, 0U, 0U, 0));
  sf_mex_assign(&c8_b_y, sf_mex_call("embedded.fi", 1U, 6U, 15, "fimath", 14,
    sf_mex_dup(chartInstance.c8_m1), 15, "numerictype", 14,
    sf_mex_dup(chartInstance.c8_m2), 15, "intarray", 14, c8_c_y));
  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

static const mxArray *c8_f_sf_marshall(void *c8_chartInstance, void *c8_u)
{
  const mxArray *c8_y = NULL;
  uint8_T c8_b_u;
  const mxArray *c8_b_y = NULL;
  uint8_T c8_c_u;
  const mxArray *c8_c_y = NULL;
  c8_y = NULL;
  c8_b_u = *((uint8_T *)c8_u);
  c8_b_y = NULL;
  if (!chartInstance.c8_count_not_empty) {
    sf_mex_assign(&c8_b_y, sf_mex_create(NULL, "y", 0, 0U, 1U, 2, 0, 0));
  } else {
    c8_c_u = c8_b_u;
    c8_c_y = NULL;
    sf_mex_assign(&c8_c_y, sf_mex_create(&c8_c_u, "y", 3, 0U, 0U, 0));
    sf_mex_assign(&c8_b_y, sf_mex_call("embedded.fi", 1U, 6U, 15, "fimath", 14,
      sf_mex_dup(chartInstance.c8_m1), 15, "numerictype", 14,
      sf_mex_dup(chartInstance.c8_m0), 15, "intarray", 14, c8_c_y));
  }

  sf_mex_assign(&c8_y, c8_b_y);
  return c8_y;
}

const mxArray *sf_c8_mysin4_get_eml_resolved_functions_info(void)
{
  const mxArray *c8_nameCaptureInfo = NULL;
  c8_ResolvedFunctionInfo c8_info[55];
  const mxArray *c8_m3 = NULL;
  int32_T c8_i0;
  c8_ResolvedFunctionInfo *c8_r0;
  c8_nameCaptureInfo = NULL;
  c8_info_helper(c8_info);
  sf_mex_assign(&c8_m3, sf_mex_createstruct("nameCaptureInfo", 1, 55));
  for (c8_i0 = 0; c8_i0 < 55; c8_i0 = c8_i0 + 1) {
    c8_r0 = &c8_info[c8_i0];
    sf_mex_addfield(c8_m3, sf_mex_create(c8_r0->context, "nameCaptureInfo", 13,
      0U, 0U, 2, 1, strlen(c8_r0->context)), "context",
                    "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(c8_r0->name, "nameCaptureInfo", 13, 0U,
      0U, 2, 1, strlen(c8_r0->name)), "name",
                    "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(c8_r0->dominantType, "nameCaptureInfo",
      13, 0U, 0U, 2, 1, strlen(c8_r0->dominantType)),
                    "dominantType", "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(c8_r0->resolved, "nameCaptureInfo", 13,
      0U, 0U, 2, 1, strlen(c8_r0->resolved)), "resolved",
                    "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(&c8_r0->fileLength, "nameCaptureInfo",
      7, 0U, 0U, 0), "fileLength", "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(&c8_r0->fileTime1, "nameCaptureInfo", 7,
      0U, 0U, 0), "fileTime1", "nameCaptureInfo", c8_i0);
    sf_mex_addfield(c8_m3, sf_mex_create(&c8_r0->fileTime2, "nameCaptureInfo", 7,
      0U, 0U, 0), "fileTime2", "nameCaptureInfo", c8_i0);
  }

  sf_mex_assign(&c8_nameCaptureInfo, c8_m3);
  return c8_nameCaptureInfo;
}

static void c8_info_helper(c8_ResolvedFunctionInfo c8_info[55])

⌨️ 快捷键说明

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