    1/*

    2 * PWM_mid.h

    3 *

    4 * Code generation for model "PWM_sf".

    5 *

    6 * Model version              : 1.825

    7 * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020

    8 * C source code generated on : Fri Apr 14 12:53:29 2023

    9 *

    10 * Target selection: rtwsfcn.tlc

    11 * Note: GRT includes extra infrastructure and instrumentation for prototyping

    12 * Embedded hardware selection: ARM Compatible->ARM Cortex-M

    13 * Emulation hardware selection:

    14 *    Differs from embedded hardware (MATLAB Host)

    15 * Code generation objectives:

    16 *    1. Execution efficiency

    17 *    2. RAM efficiency

    18 * Validation result: Not run

    19 *

    20 * SOURCES: PWM_sf.c

    21 */

    22

    23#include "simstruc.h"

    24#include "PWM_sf.h"

    25#if defined(MATLAB_MEX_FILE) || defined(RT_MALLOC)

    26

    27static int_T RegNumInputPorts(SimStruct *S, int_T nInputPorts)

    28{

    29  _ssSetNumInputPorts(S,nInputPorts);

    30  return true;

    31}

    32

    33static int_T RegNumOutputPorts(SimStruct *S, int_T nOutputPorts)

    34{

    35  _ssSetNumOutputPorts(S,nOutputPorts);

    36  return true;

    37}

    38

    39static int_T FcnSetErrorStatus(const SimStruct *S, DTypeId arg2)

    40{

    41  static char msg[256];

    42  if (strlen(ssGetModelName(S)) < 128) {

    43    sprintf(msg,

    44            "S-function %s does not have a tlc file. It cannot use macros that access regDataType field in simstruct.",

    45            ssGetModelName(S));

    46  } else {

    47    sprintf(msg,

    48            "A S-function does not have a tlc file. It cannot use macros that access regDataType field in simstruct.");

    49  }

    50

    51  ssSetErrorStatus(S, msg);

    52  UNUSED_PARAMETER(arg2);

    53  return 0;

    54}

    55

    56static void * FcnSetErrorStatusWithReturnPtr(const SimStruct *S, DTypeId arg2)

    57{

    58  FcnSetErrorStatus(S,0);

    59  UNUSED_PARAMETER(arg2);

    60  return 0;

    61}

    62

    63static int_T FcnSetErrorStatusWithArgPtr(const SimStruct *S, const void* arg2)

    64{

    65  FcnSetErrorStatus(S,0);

    66  UNUSED_PARAMETER(arg2);

    67  return 0;

    68}

    69

    70#endif

    71

    72/* Instance data for model: PWM */

    73void *PWM_malloc(SimStruct *rts)

    74{

    75  /* Local SimStruct for the generated S-Function */

    76  LocalS *lS = (LocalS *) malloc(sizeof(LocalS));

    77  ss_VALIDATE_MEMORY(rts,lS);

    78  (void) memset((char *) lS, 0,

    79                sizeof(LocalS));

    80  ssSetUserData(rts, lS);

    81

    82  /* block I/O */

    83  {

    84    void *b = malloc(sizeof(B_PWM_T));

    85    ss_VALIDATE_MEMORY(rts,b);

    86    ssSetLocalBlockIO(rts, b);

    87    (void) memset(b, 0,

    88                  sizeof(B_PWM_T));

    89  }

    90

    91  /* model checksums */

    92  ssSetChecksumVal(rts, 0, 1460315084U);

    93  ssSetChecksumVal(rts, 1, 1873271935U);

    94  ssSetChecksumVal(rts, 2, 11797905U);

    95  ssSetChecksumVal(rts, 3, 1909962613U);

    96  return (NULL);

    97}

    98