| Real-Time Workshop | ![]() |
Host (ext_comm) Source Files
The source files for the ext_comm component are located in the directory matlabroot/rtw/ext_mode:
This file is the core of external mode communication. It acts as a relay station between the target and Simulink. ext_comm.c communicates to Simulink via a shared data structure, ExternalSim. It communicates to the target via calls to the transport layer.
Tasks carried out by ext_comm include establishment of a connection with the target, downloading of parameters, and termination of the connection with the target.
This file implements required transport layer functions. (Note that ext_transport.c includes ext_transport_share.h, which contains functions common to client and server sides.) The version of ext_transport.c shipped with Real-Time Workshop uses TCP/IP functions including recv(), send(), and socket().
This file is a MEX-file wrapper for external mode. ext_main interfaces to Simulink via the standard mexFunction call. (See External Interfaces/API in the MATLAB online documentation for information on mexFunction.) ext_main contains a function dispatcher, esGetAction, that sends requests from Simulink to ext_comm.
This file contains functions used for converting data from host to target formats (and vice versa). Functions include byte-swapping (big to little- endian), conversion from non-IEEE floats to IEEE doubles, and other conversions. These functions are called both by ext_comm.c and directly by Simulink (via function pointers).
This file defines the ExternalSim data structure and access macros. This structure is used for communication between Simulink and ext_comm.c.
Target (Server) Source Files
These files are part of the run-time interface and are linked into the model.exe executable. They are located in the directory matlabroot/rtw/c/src.
ext_svr.c is analogous to ext_comm.c on the host, but generally is responsible for more tasks. It acts as a relay station between the host and the generated code. Like ext_comm.c, ext_svr.c carries out tasks such as establishing and terminating connection with the host. ext_svr.c also contains the background task functions that either write downloaded parameters to the target model, or extract data from the target data buffers and send it back to the host.
The version of ext_svr.c shipped with Real-Time Workshop uses TCP/IP functions including recv(), send(), and socket().
This file implements required transport layer functions. (Note that ext_svr_transport.c includes ext_transport_share.h, which contains functions common to client and server sides.) The version of ext_svr_transport.c shipped with Real-Time Workshop uses TCP/IP functions including recv(), send(), and socket().
updown.c handles the details of interacting with the target model. During parameter downloads, updown.c does the work of installing the new parameters into the model's parameter vector. For data uploading, updown.c contains the functions that extract data from the model's blockio vector and write the data to the upload buffers. updown.c provides services both to ext_svr.c and to the model code (e.g., grt_main.c). It contains code that is called via the background tasks of ext_svr.c as well as code that is called as part of the higher priority model execution.
These files contain data type transition information that allows access to multi-data type structures across different computer architectures. This information is used in data conversions between host and target formats.
Other Files
Contains message code definitions and other definitions required by both the host and target modules.
Contains functions and data structures required by both the host and target modules of the transport layer. The version of ext_transport_share.h shipped with Real-Time Workshop is specific to TCP/IP communications.
| External Mode Communications Overview | Guidelines for Implementing the Transport Layer | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |