PWM_mid.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. #include "simstruc.h"
  23. #include "PWM_sf.h"
  24. #if defined(MATLAB_MEX_FILE) || defined(RT_MALLOC)
  25. static int_T RegNumInputPorts(SimStruct *S, int_T nInputPorts)
  26. {
  27. _ssSetNumInputPorts(S,nInputPorts);
  28. return true;
  29. }
  30. static int_T RegNumOutputPorts(SimStruct *S, int_T nOutputPorts)
  31. {
  32. _ssSetNumOutputPorts(S,nOutputPorts);
  33. return true;
  34. }
  35. static int_T FcnSetErrorStatus(const SimStruct *S, DTypeId arg2)
  36. {
  37. static char msg[256];
  38. if (strlen(ssGetModelName(S)) < 128) {
  39. sprintf(msg,
  40. "S-function %s does not have a tlc file. It cannot use macros that access regDataType field in simstruct.",
  41. ssGetModelName(S));
  42. } else {
  43. sprintf(msg,
  44. "A S-function does not have a tlc file. It cannot use macros that access regDataType field in simstruct.");
  45. }
  46. ssSetErrorStatus(S, msg);
  47. UNUSED_PARAMETER(arg2);
  48. return 0;
  49. }
  50. static void * FcnSetErrorStatusWithReturnPtr(const SimStruct *S, DTypeId arg2)
  51. {
  52. FcnSetErrorStatus(S,0);
  53. UNUSED_PARAMETER(arg2);
  54. return 0;
  55. }
  56. static int_T FcnSetErrorStatusWithArgPtr(const SimStruct *S, const void* arg2)
  57. {
  58. FcnSetErrorStatus(S,0);
  59. UNUSED_PARAMETER(arg2);
  60. return 0;
  61. }
  62. #endif
  63. /* Instance data for model: PWM */
  64. void *PWM_malloc(SimStruct *rts)
  65. {
  66. /* Local SimStruct for the generated S-Function */
  67. LocalS *lS = (LocalS *) malloc(sizeof(LocalS));
  68. ss_VALIDATE_MEMORY(rts,lS);
  69. (void) memset((char *) lS, 0,
  70. sizeof(LocalS));
  71. ssSetUserData(rts, lS);
  72. /* block I/O */
  73. {
  74. void *b = malloc(sizeof(B_PWM_T));
  75. ss_VALIDATE_MEMORY(rts,b);
  76. ssSetLocalBlockIO(rts, b);
  77. (void) memset(b, 0,
  78. sizeof(B_PWM_T));
  79. }
  80. /* model checksums */
  81. ssSetChecksumVal(rts, 0, 1460315084U);
  82. ssSetChecksumVal(rts, 1, 1873271935U);
  83. ssSetChecksumVal(rts, 2, 11797905U);
  84. ssSetChecksumVal(rts, 3, 1909962613U);
  85. return (NULL);
  86. }