STM MATLAB Simulator
Loading...
Searching...
No Matches
Data Structures | Macros
mcu_wrapper_conf.h File Reference
#include "stm32f4xx_matlab_conf.h"
#include "simstruc.h"
#include <process.h>
+ Include dependency graph for mcu_wrapper_conf.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SIM__MCUHandleTypeDef
 MCU handle Structure definition. More...
 

Macros

#define CREATE_SUSPENDED   0x00000004
 define from WinBase.h. We dont wanna include "Windows.h" or smth like this, because of HAL there are a lot of redefine errors.
 
#define DEKSTOP_CYCLES_FOR_MCU_APP   0xFFFF
 number of for() cycles after which MCU thread would be suspended
 
#define PORT_WIDTH   16
 width of one port
 
#define PORT_NUMB   3
 amount of ports
 
#define NPARAMS   1
 number of input parametrs (only Ts)
 
#define IN_PORT_WIDTH   (8)
 width of input ports
 
#define IN_PORT_NUMB   1
 number of input ports
 
#define OUT_PORT_WIDTH   PORT_WIDTH
 width of output ports
 
#define OUT_PORT_NUMB   PORT_NUMB
 number of output ports
 
#define DISC_STATES_WIDTH   PORT_WIDTH*PORT_NUMB
 width of discrete states array
 
#define while(_expression_)   sim_while(_expression_)
 Redefine C while statement with sim_while() macro.
 
#define sim_while(_expression_)   while((_expression_)&&(hmcu.MCU_Stop == 0))
 While statement for emulate MCU code in Simulink.
 
#define native_while(_expression_)   for(; (_expression_); )
 Default/Native C while statement.
 
typedef void * HANDLE
 MCU handle typedef.
 
SIM__MCUHandleTypeDef hmcu
 extern для видимости переменной во всех файлах
 
void MCU_Step_Simulation (SimStruct *S, time_T time)
 Read from simulink S-Block Inputs and write to MCU I/O ports.
 
void MCU_Periph_Simulation (void)
 Simulate peripheral of MCU.
 
void SIM_Initialize_Simulation (void)
 Initialize structures and variables for simulating MCU.
 
void SIM_deInitialize_Simulation (void)
 Deinitialize structures and variables for simulating MCU.
 
void MCU_readInputs (real_T *in)
 
void MCU_writeOutputs (real_T *disc)
 
void SIM_writeOutput (SimStruct *S)
 

Macro Definition Documentation

◆ while

#define while ( _expression_)    sim_while(_expression_)

Redefine C while statement with sim_while() macro.

Parameters
_expression_- expression for while.

Это while который будет использоваться в симулинке sim_while для подробностей.

◆ sim_while

#define sim_while ( _expression_)    while((_expression_)&&(hmcu.MCU_Stop == 0))

While statement for emulate MCU code in Simulink.

Parameters
_expression_- expression for while.

Данный while необходим, чтобы в конце симуляции, завершить поток МК: При выставлении флага окончания симуляции, все while будут пропускаться и поток сможет дойти до конца функции main и завершить себя.

◆ native_while

#define native_while ( _expression_)    for(; (_expression_); )

Default/Native C while statement.

Parameters
_expression_- expression for while.

Данный while - аналог обычного while, без дополнительного функционала.

Function Documentation

◆ MCU_Step_Simulation()

void MCU_Step_Simulation ( SimStruct * S,
time_T time )

Read from simulink S-Block Inputs and write to MCU I/O ports.

SIMULATE MCU FOR ONE SIMULATION STEP

Parameters
time- current time of simulation (in second).

Запускает поток, который выполняет код МК и управляет ходом потока: Если прошел таймаут, поток прерывается, симулируется периферия и на следующем шаге поток возобнавляется.

+ Here is the call graph for this function:

◆ MCU_Periph_Simulation()

void MCU_Periph_Simulation ( void )

Simulate peripheral of MCU.

SIMULATE MCU PERIPHERAL

Пользовательский код, который симулирует работу периферии МК.

+ Here is the call graph for this function:

◆ SIM_Initialize_Simulation()

void SIM_Initialize_Simulation ( void )

Initialize structures and variables for simulating MCU.

MCU WRAPPER DEINITIALIZATION

Пользовательский код, который будет настраивать все структуры для симуляции.

+ Here is the call graph for this function:

◆ SIM_deInitialize_Simulation()

void SIM_deInitialize_Simulation ( void )

Deinitialize structures and variables for simulating MCU.

MCU WRAPPER DEINITIALIZATION

Пользовательский код, который будет очищать все структуры после окончания симуляции.

+ Here is the call graph for this function:

◆ MCU_readInputs()

void MCU_readInputs ( real_T * in)

◆ MCU_writeOutputs()

void MCU_writeOutputs ( real_T * disc)

◆ SIM_writeOutput()

void SIM_writeOutput ( SimStruct * S)

Variable Documentation

◆ hmcu

SIM__MCUHandleTypeDef hmcu
extern

extern для видимости переменной во всех файлах