Extended procedure information structure, Caller identification, Extended procedure information structure -18 – National Instruments AutoCode NI MATRIX User Manual

Page 126: Caller identification -18

Advertising
background image

Chapter 5

Generated Code Architecture

AutoCode Reference

5-18

ni.com

Extended Procedure Information Structure

The

-epi

option specifies that additional elements to all standard

procedure SuperBlock’s

info

structure are to be generated. Currently,

only one additional element is generated. It is named

caller_id

and is of

type

RT_INTEGER

. Example 5-2 and Example 5-3 show an

info

structure

declaration (in C) with and without the

-epi

option. Equivalent structures

are declared when generating Ada code.

Example 5-2

Regular Procedure

info Structure Declaration

struct _proc1_info {

RT_INTEGER iinfo[5];

RT_FLOAT rinfo[5];

};

Example 5-3

Extended Procedure

info Structure Declaration (-epi)

struct _proc1_info {

RT_INTEGER iinfo[5];

RT_FLOAT rinfo[5];

RT_INTEGER caller_id;

};

Caller Identification

The purpose of the

caller_id

element is to provide the unique identifier

of the caller, that is, the number of the subsystem task, background, startup,
or interrupt procedure SuperBlock. As implied in Example 5-2 and
Example 5-3, all subsystem tasks and nonstandard procedure SuperBlocks
are assigned a unique identifier. Starting with 1, the tasks and procedures
are numbered in this order: subsystem tasks, startup procedures,
background procedures, and interrupt procedures.

Startup procedures are unlike the other procedures in that they are called
only once during the startup phase. Consequently, it has been shown that
easy identification of when a startup SuperBlock is referenced in the

caller_id

element simplifies template programming and code

generation. Therefore, startup SuperBlocks are represented as the negative
of the ordering number. For example, assume a model has three subsystem
tasks, three startup procedure SuperBlocks, two background procedure
SuperBlocks, and one interrupt procedure SuperBlock. The ordering is
shown in Table 5-1.

Advertising