Documente Academic
Documente Profesional
Documente Cultură
Inter-Process
Communications Calls
B0193BB
Rev D
February 16, 2011
Invensys, Foxboro, I/A Series, the Invensys logo, and SPECTRUM are trademarks of Invensys plc, its
subsidiaries, and affiliates.
All other brand names may be trademarks of their respective owners.
iii
B0193BB – Rev D Contents
Index .................................................................................................................................... 51
iv
Preface
This document is for process control software engineers who wish to write application programs
to run on the I/A Series System.
Readers are assumed to know the C programming language, particularly pointers and data struc-
tures. They are also assumed to be familiar with the SunOS or VENIX (or UNIX) operating sys-
tem. The I/A Series documentation set does not include any programming language manuals.
Revision Information
For this release of the document (B0193BB-D), the following changes were made:
Appendix B “IPC Error Codes”
Added this appendix.
Reference Documents
SunOS Reference Manual I, II, III
VENIX User Reference Manual
VENIX Programmer’s Reference Manual
VENIX Administrator’s Reference Manual
VENIX Support Tools Guide
Program Development (B0193BA)
Object Manager Calls (B0193BC)
Human Interface Calls (B0193BD)
Most are available on the I/A Series Electronic Documentation CD-ROM (K0173TQ or
K0173WT) provided by the Foxboro business unit of Invensys Operations Management (IOM).
The latest revisions may also be available through the IOM Global Customer Support at
http://support.ips.invensys.com.
v
B0193BB – Rev D Preface
vi
1. IPC Concepts
The Inter-Process Communications (IPC) calls provide a method for tasks written in C to pass
messages to one another. “Process,” in this case, refers to a program or script in execution, not a
process in the user’s plant. Use these messages to:
Pass data or control information
Notify another task of an event
Coordinate the use of common network resources
Distribute some of a task’s functions.
The two communicating tasks do not need to be aware of one another’s location. Also, IPC can
broadcast messages to identically named tasks in different stations.
This section describes some of the details of how IPC operates so that programmers can make the
best use of it. IPC calls are simple to use, but at the same time it is possible to create very complex
data transfer routines.
Covered in this section are:
Registering a task to use IPC
Activating a task to use IPC
Connected data transfers
Connectionless data transfers
Awakening a task by sending it a message
Asynchronous communications
Synchronous communications
Event flags
Examples of IPC call uses
Return codes.
1
B0193BB – Rev D 1. IPC Concepts
Each connection to another task is established on a specific “channel.” The channel id number is
returned to you when you connect, and to the other task when it answers a connect request. Alias
names are not used in connected calls.
You may issue only one c_answer call at a time. The c_answer call responds to requests by other
tasks to establish a channel (connection) over which you both can send and receive.
Over a single channel you may only have one c_receive call outstanding to retrieve messages.
If the connection is broken for any reason, you are notified the next time you attempt to use the
channel.
You can send a group of messages as a virtual single message by using the end-of-message (EOM)
flag on the last message in the group.
2
1. IPC Concepts B0193BB – Rev D
Since the task suspends until the call completes or times out, you can check the results by examin-
ing the value that the call returns, and you can do it in code that executes immediately after the
call.
Timer values represent fifths of a second.
You cannot issue a synchronous call over a connection or to a task alias while an asynchronous call
is pending on the same connection or alias. This includes IPC calls, Object Manager calls, and all
other calls.
Understanding why this is so may be easier after reading the next section on asynchronous calls.
clu_send is neither synchronous or asynchronous in that it initiates immediately and you cannot
check its status.
On a given channel (i.e., connected service), you can have only one c_receive call active at a
time. For example, two c_receives would require two different channels.
For a given task alias (i.e., connectionless service), you can have only one cl_receive call active at
a time. Two cl_receives would require two task aliases.
Keep in mind that as long as an asynchronous call is pending over a given connection or alias, no
synchronous calls can be made using the same connection or task alias. This includes Object
Manager calls and all others. “Pending” means that, although control has been returned to your
task, the call has not finished doing its job yet.
3
B0193BB – Rev D 1. IPC Concepts
Administrative Calls
9. Remove aliases from your task (del_alias).
10. Remove task from the registration list (cs_unregister).
4
1. IPC Concepts B0193BB – Rev D
Where msg_id, event_num, and result are an integer type return code:
char *d_name;
struct chk_clinfo *info;
lchar *buffer;
struct event_spec *event;
5
B0193BB – Rev D 1. IPC Concepts
6
1. IPC Concepts B0193BB – Rev D
7
B0193BB – Rev D 1. IPC Concepts
8
2. Administrative Calls
These are the calls used to set up for communications via IPC. You must register with IPC and
activate, the other calls are optional.
cs_register Register your task with IPC
cs_reg_exit Register With Automatic Unregister when task is exiting
add_alias Add other names that your task can be known as
del_alias Delete alias names form the alias list
cs_activate Activate your task before issuing any IPC calls
e_cs_activate Event activate your task before issuing any IPC calls
cs_unregister Unregister your task with IPC
Where:
ap_name The name (not an alias) of the application task making the IPC calls. Use
this name in the Object Manager’s obj_create call to make your process
globally known.
numalias The number of other names by which this task can be referred. You can
specify up to 20 aliases. This is for connectionless service only. For con-
nected service, numalias = 0.
alias An array containing pointers to alias names that you wish to specify (con-
nectionless service only). If an alias is to be available throughout the net-
work, use the Object Manager call obj_create with the alias as type
PROCESS. The array must be as big as numalias.
9
B0193BB – Rev D 2. Administrative Calls
max_chnls Specify up to eight channels for connected service; specify zero for connec-
tionless service.
NOTE
NOTES:
1.) Alias names must be unique within a station; those available outside the station
must be unique to the network.
2.) You can register a task in a system-initialization task to avoid re-registering the
task every time it runs.
3.) If a message comes in for a task that is registered, but not running, the system
will locate and load the task.
10
2. Administrative Calls B0193BB – Rev D
Return Codes:
CALL_COMPLETE Alias name added successfully
E_NO_ACT You have not issued a cs_activate call
E_NOT_REG You have not issued a cs_register call
E_INV_ANAME Invalid alias name
E_NO_RES No IPC space for another alias; try again later
E_ILL_AL_VAL Attempt to exceed max number of aliases
E_ILL_NAM_SZ Name size not 1 to 12 characters
int service;
Where:
ap_name The name (not an alias) of the application task that is making the IPC
calls.
11
B0193BB – Rev D 2. Administrative Calls
Return Codes:
CALL_COMPLETE Task activation successful
E_NO_SERV Service not available or illegal value
E_INV_NAM Syntax error in application task name
E_NOT_REG Calling task is not registered for IPC
E_INV_UE Unknown application task name
E_MULT_ACT This name and service already active
E_NO_RES No IPC resources (space) left; try again later
E_ILL_NAM_SZ Name size not 1 to 12 characters
NOTE
NOTES:
1.) Make a separate cs_activate call for each type of service (connected or connec-
tionless) that the application will be using.
2.) Make sure ap_name is the task name and not an alias name. As with registering,
activating the task name activates all alias names as well.
char *ap_name;
int service;
int num_event
Where:
*ap_name The name (not an alias) of the application task that is making the IPC
calls.
12
2. Administrative Calls B0193BB – Rev D
NOTE
NOTES:
1.) Make a separate e_cs_activate call for each type of service (connected or con-
nectionless) that the application will be using.
2.) Make sure ap_name is the task name and not an alias name. As with registering,
activating the task name activates all alias names as well.
ap_name The name of the application task that will no longer be making IPC calls
(the same name you registered with).
13
B0193BB – Rev D 2. Administrative Calls
NOTE
NOTES:
1.) A task can only unregister itself, not other tasks.
2.) A task cannot unregister until it terminates all IPC activities (use c_disconnect
and cl_cancel).
3.) Leaving a task registered when exiting allows other tasks to awaken it by sending
it a message.
4.) Unregistering a task removes all of its alias names.
14
3. Connected Data Transfer
Services
This is one of two types of communications services: Connected and Connectionless Data Trans-
fer services. In Connected service, a task forms a connection (a channel) to another task and can
then send and receive data over the connection. Either task can break the connection.
Tasks can connect to another task in the same station or to a task in another station. The maxi-
mum is eight, regardless of who initiated the connections.
Once a connection is established, both tasks can send and receive data over it.
The Connectionless Data Transfer services are discussed in “Connectionless Data Transfer Calls”
on page 21.
char *d_name;
int service;
struct c_option *c_opt_prt;
unsigned long null;
Where:
d_name The destination task with which the connection is to be formed. It must
be the ap_name used to register and activate that task with IPC.
service For this call, service must equal zero for Connected Data Transfer services.
c_opt_prt This is a pointer to a c_option data structure used to locate the station.
This structure contains two parameter fields, d_loca and psap_address.
Set these to zero if you are not using them, or they will be used to try and
find the station.
timer This is reserved for future use. Whatever value is entered here is ignored.
15
B0193BB – Rev D 3. Connected Data Transfer Services
Return Codes:
channel_id Successful connection returns this id
E_NO_ACT The calling task is not activated
E_NO_CHANS No more channels available for this task
E_ILL_LOCA Destination station cannot be found
E_NO_RES No resource to allocate connect message
E_NO_DEST Destination task name cannot be found
E_ILL_NAM_SZ d_name is not 1 to 12 characters long
NOTE
NOTES:
1.) If the destination task name is unique within the network, then d_name is suffi-
cient; set d_loca and psap_address to zero.
2.) If the task name is not unique, specify psap_address – its station address –
(more efficient), or d_loca (its station letterbug id). Use the Object Manager’s
GLOBAL_FIND call to get the task’s station address.
3.) If you specify both d_loca and psap_address, IPC ignores d_loca and uses
psap_address. If you specify neither, IPC locates the task on its own.
4.) Upon successful completion of this call, IPC returns a channel identification. All
subsequent sending and receiving on that channel must use that channel id.
int service;
struct chk_info *info;
struct event_spec *event;
Where:
info This is a pointer to a data structure containing five fields that are returned
to the calling task upon completion of the call:
r_size, eom, and dis_ind are not used with this call
16
3. Connected Data Transfer Services B0193BB – Rev D
event By assigning an event number from 1 to 32 you can use a c_worevent call
to see if the event has completed. Event number zero means the call is not
assigned any event number (use c_chkio to check for completion).
Return Codes:
IN_PROGRESS c_answer is in progress
E_NO_ACT You have not issued a cs_activate call
E_NO_CHANS No more channels available for this task
E_NO_SERV The specified service is not available
E_ILL_EFN Event flag not 0-32 or is a duplicate
E_ANS_OUT Still a c_answer pending for this task
E_NOT_CHK You did not check the last operation
E_NO_RES No IPC resources (space) left; try again later
E_INV_MY_NAME my_name is illegal or not zeroed out
int channel_id;
long size;
int eom;
char *buffer_ptr;
Where:
channel_id You can get this value from a c_chkio issued after a c_answer or from a
cs_connect’s return code.
eom The end-of-message flag should be set to TRUE (1) if the message is com-
plete in this call. In messages longer than 1024 bytes, this would be
FALSE (0) until the last c_send call.
17
B0193BB – Rev D 3. Connected Data Transfer Services
NOTE
NOTE: This call is synchronous, but it is complete when the message is in the
queue, not when it is sent. If the message cannot be sent out of the station, the com-
munications layers abort the connection and notify IPC. IPC marks the channel
disconnected.
A disconnect indication in a later attempt to use the channel means the message was not sent.
Example of the calling sequence:
int channel_id;
long size;
struct chk_info *info
char *buffer_ptr;
18
3. Connected Data Transfer Services B0193BB – Rev D
Where:
channel_id You can get this value from a c_chkio issued after a c_answer or from a
cs_connect’s return code.
size The size of the received-message buffer in bytes. The maximum is 1024.
info This is a pointer to a data structure containing five fields that are returned
to the calling task upon completion of the call.
buffer_ptr This points to a buffer in your task’s data space for the received message.
event Pointer to the event data structure (one field), in which you can define an
event flag number (optional). The flag is set when the message arrives. Use
cl_chkio to retrieve the message.
Return Codes:
IN_PROGRESS The call is in progress (see note 2)
E_INV_CHAN Invalid channel identifier
E_NO_ACT You have not issued the c_activate call
E_MAX_SIZE Specified buffer size exceeds 1024 bytes
E_DISCON Channel disconnected, input buffer clear
E_ILL_EFN Event flag not 0-32, or is a duplicate
E_NOT_CHK Last action not checked with c_chkio
E_ABORT_CON Channel aborted by system
E_INV_BUFPTR Buffer pointer is null, initialize it
E_NO_RES No IPC resources (space) left; try again later
E_INV_MY_NAME my_name is illegal or not zeroed out
19
B0193BB – Rev D 3. Connected Data Transfer Services
NOTE
NOTES:
1.) There can be only one outstanding c_receive call per channel.
2.) Use a c_chkio call to check the results of a c_receive call in progress. If a mes-
sage has come in, c_chkio will put it in the buffer specified in the c_receive call
and fill in the fields in the chk_info structure.
3.) The size specified for the received-message buffer can be larger or smaller than
the actual amount of data sent, as long as the size specification does not exceed
1024 bytes.
If the buffer is too small for the data sent, no data is lost; the next c_receive call
retrieves the rest of the data.
int channel_id;
Where:
channel_id The channel identifier that was returned in the successful cs_connect call
or from a c_chkio issued to check a c_answer call.
Return Codes:
CALL_COMPLETE The channel has been disconnected
E_INV_CHAN Invalid channel identifier
E_NO_ACT You have not issued the cs_activate call
E_NO_RES No IPC resources (space) left; try again later
NOTE
NOTES:
1.) Any outstanding messages are discarded and input buffers are cleared.
2.) All event flags associated with the specified channel are cleared.
3.) The channel identifier number is released for future assignments.
4.) Attempts to use a disconnected channel return an error.
5.) To abort a pending c_answer call use c_disconnect(0).
20
4. Connectionless Data Transfer
Calls
This section lists the calls that provide a method for transmitting data between two tasks without
setting up a connection.
The calls are:
The cl_send call allows your task to send a message to another task without previously having
established a connection. A successful call returns a message identification number. The cl_send
call is asynchronous, that is, it returns to your task as soon as it has been initiated, and you must
check back with cl_chkio to see if the call has completed.
char *d_name;
struct chk_clinfo *info;
long size;
char *buffer_ptr;
struct event_spec *event;
Where:
d_name The name or alias of the task to which you are sending
21
B0193BB – Rev D 4. Connectionless Data Transfer Calls
*event Pointer to the event data structure (one field), in which you can define an
event flag number (optional). The flag is set upon message transmission,
whether successful or not. Use cl_chkio to determine success.
Return Codes:
id Message identification number
E_NO_ACT The calling process is not activated
E_MAX_SIZE Specified buffer size exceeds 1024 bytes
E_INV_NAM d_name, d_loca, or psap_address is bad
E_ILL_EFN Event flag not 0-32, or is a duplicate
E_INV_BUFPTR The message buffer pointer is null (00)
E_INV_INFOPTR Invalid chk_clinfo structure pointer
E_INV_DNAME Invalid d_name
E_NO_RES No IPC resources (space) left; try again later
E_INV_MY_NAME Invalid my_name
E_ILL_LOCA d_loca (letterbug name) not found or else you provided an
invalid psap_address
NOTE
NOTES:
1.) You can provide d_loca, psap_address, both, or neither. If you provide both,
IPC uses psap_address and ignores d_loca. If you provide neither, set them to
zero. IPC makes an Object Manager global_find call to locate the task.
The most efficient method for many sends is to issue a global_find to get the
psap_address, which speeds up the cl_send call.
2.) Fill in the my_name field to send from an alias name. If you leave it null, IPC
fills in your task name.
3.) If you send to another station, IPC provides a return code value indicating that
the call is in progress (a message id). When the message is sent, IPC sets the event
flag, if defined. You must issue a cl_chkio call to determine the status of the transac-
tion, using the message id as a reference.
22
4. Connectionless Data Transfer Calls B0193BB – Rev D
restrictions on the number of times the call is made. The clu_send call returns to your task as
soon as it has been initiated.
Configuration: For 50 Series Only
char *d_name;
struct chk_clinfo *info;
long size;
char *buffer;
Where:
d_name The name or alias of the task to which you are sending
23
B0193BB – Rev D 4. Connectionless Data Transfer Calls
NOTE
NOTES:
1.) You can provide d_loca, psap_address, both, or neither. If you provide both,
IPC uses psap_address and ignores d_loca. If you provide neither, set them to
zero. IPC makes an Object Manager global_find call to locate the task.
The most efficient method for many sends is to issue a global_find to get the
psap_address, which speeds up the clu_send call.
2.) Fill in the my_name field to send from an alias name. If you leave it null, IPC
fills in your task name.
char *a_name;
long size;
struct chk_clinfo *info;
char *buffer_ptr;
struct event_spec *event;
Where:
*a_name A pointer to the task name or alias under which you are receiving
*event Pointer to the event data structure (one field), in which you can define an
event flag number (optional). The flag is set when the message arrives. Use
cl_chkio to retrieve the message.
24
4. Connectionless Data Transfer Calls B0193BB – Rev D
Return Codes:
id Message identification number
E_NO_ACT You have not issued a cs_activate call
E_MAX_SIZE Specified buffer size exceeds 1024 bytes
E_ILL_EFN Event flag not 0-32, or is a duplicate
E_MULT_RECV Receive already issued for this name
E_NOT_CHK Previous cl_receive call not checked
E_INV_BUFPTR The message buffer pointer is null (00)
E_INV_DNAME Invalid d_name (a_name, in this case)
E_NO_RES No IPC resources (space) left; try again later
NOTE
NOTES:
1.) If the message sent is larger than the message buffer in your task, the buffer is
filled and IPC holds the rest of the message. You can use additional receive calls to
retrieve the rest of the message, but you should work out a protocol with the sender
for knowing how much was sent or else receive 1024 bytes each time and avoid the
problem.
2.) The cl_chkio call is required to check the results of a cl_receive call. Use the
message id returned by cl_receive as a reference in the cl_chkio call.
3.) It is the cl_chkio call that fills in the fields in the chk_clinfo data structure and
transfers the message to buffer_ptr.
4.) Only one outstanding cl_receive is permitted per alias, but multiple async
receives if they each use a different alias.
5.) You can have only one async answer active at a time, but multiple async
receives if each is on a different channel.
char *dname
Where:
dname The task or alias name of the receiving task. Specifying the task name can-
cels for all aliases.
Return Codes:
CALL_COMPLETE The cl_receive is cancelled
E_NO_ACT You have not issued a cs_activate call
25
B0193BB – Rev D 4. Connectionless Data Transfer Calls
char *d_name;
char *group_name;
long size;
char *buffer_ptr;
char *my_name;
Where:
*group_name
26
4. Connectionless Data Transfer Calls B0193BB – Rev D
NOTE
NOTES:
1.) If the communications software cannot send the message on the first try, it
makes one retry.
2.) There is no station-to-station acknowledgment that the message was received by
the various tasks. You should set up your own protocol for this purpose.
3.) If d_name exists in the local station, it is delivered there as well.
4.) If the my_name pointer is left null, IPC will supply the name when it sends the
message.
27
B0193BB – Rev D 4. Connectionless Data Transfer Calls
28
5. Utility IPC Calls
The IPC utility calls are the ones that allow the user to check the outcome of asynchronous calls,
wait for events, and check to see what event awakened your process.
The calls are:
c_chkio Check a c_answer and pick up a channel id.
Check a c_receive and move the data to the buffer.
c_chkio_s Check on the progress of c_answer.
cl_chkio Check a cl_send to see if it was sent.
Check a cl_receive and move the data to the buffer.
c_worevent Suspend the task to monitor up to 32 events and resume processing when
one occurs.
c_waitevent Suspend task to monitor unlimited events and resume when an event
occurs.
c_selevent Marks events of the calling process for use with the system select call
int channel_id;
act action;
struct chk_info *info;
char *buffer_ptr;
Where:
channel_id If this call is issued to check a c_answer call, then this should be set to
zero and c_chkio returns the channel id as a return code
If this call is issued after a c_receive call, use the same channel_id as the
c_receive call.
action This specifies the type of call to check. This value can only be RECEIVE
(0) or ANSWER (1).
*info This is a data structure containing the following fields (filled in when the
call is successful):
29
B0193BB – Rev D 5. Utility IPC Calls
*buffer_ptr This is a pointer to the location where c_chkio places messages picked up
with a c_receive call.
Return Codes:
channel_id Channel id if c_chkio call is successful
IN_PROGRESS Action still in progress
E_INV_CHAN Invalid channel id
E_NO_ACT You have not issued a c_activate call
E_INV_ACT The specified action is not in progress
E_DISC_IND IPC received a disconnect indication
E_NO_DEST Destination task name cannot be found
E_UE_DEST Destination station cannot be found
E_ABORT_CON The connection has been aborted
E_ILL_ACT Action must be RECEIVE or ANSWER
NOTE
NOTES:
1.) Use the c_chkio call to complete the c_receive and c_answer calls.
2.) If action = RECEIVE, and a message is now available, this call moves the mes-
sage into buffer_ptr. The size of the data transfer is the size specified in the
c_receive call.
30
5. Utility IPC Calls B0193BB – Rev D
Where:
*info This is a data structure containing the following fields (filled in when the
call is successful):
NOTE
NOTES:
1.) Use the c_chkio_s call to complete c_answer calls.
2.) If the return code is in_progress, you must re-issue the c_chkio_s call.
int message_id;
act action;
31
B0193BB – Rev D 5. Utility IPC Calls
Where:
message_id Use the same message id as the cl_receive or cl_send call that you are
checking.
action This specifies the type of call to check. This value can only be
CLRECEIVE (0) or CLSEND (1).
*buffer_ptr This is a pointer to the location where cl_chkio places messages picked up
with a cl_receive call.
Return Codes:
message_id Message id, if cl_chkio is successful
IN_PROGRESS Action still in progress, try again
E_NO_ACT You have not issued a cs_activate call
E_INV_ACT The specified action is not in progress
E_UE_DEST Destination station cannot be found
E_ILL_ACT Illegal action specification
E_MSG_REJECTED Message could not be sent
NOTE
NOTES:
1.) Use cl_chkio to complete the cl_receive and cl_send calls.
2.) For cl_receive, cl_chkio moves new messages into buffer_ptr. cl_receive speci-
fies the amount of data transferred.
3.) If action is CLSEND, set the buffer pointer to null.
4.) If the return code is IN_PROGRESS, you must reissue the cl_chkio call.
32
5. Utility IPC Calls B0193BB – Rev D
Where:
mask The value of mask indirectly determines which event(s) to monitor. The
value of mask, in binary, sets bits 0 through 31, which correspond to
events 1 to 32. Each bit set to one corresponds to an event to monitor.
Processing continues when any one of the events occurs.
A mask example:
The bits of the unsigned long word are numbered from right to left, least
significant bit (lsb) to most significant bit (msb), 00 to 31. These bit num-
bers correspond to event numbers 1 to 32, as specified in the c_answer,
c_receive, cl_send, or cl_receive calls.
For example, to wait for events one, two, or three:
Set the bits for those event numbers
Convert from binary (111) to decimal (7)
Set the mask equal to seven
msb . . . 13 12 11 10 09 08 07 06 05 04 03 02 01 00 lsb
event # 14 13 12 11 10 9 8 7 6 5 4 3 2 1
mask = 7: 00000000000111
event # 13 12 11 10 9 8 7 6 5 4 3 2 1
mask = 128 0000010000000
timer This is the maximum length of time, in fifths of a second, that the current
task will suspend while waiting for an event to occur. If the timer is set to
zero, the task will wait forever for an event to occur.
Return Codes:
33
B0193BB – Rev D 5. Utility IPC Calls
NOTE
NOTES:
1.) If an event has completed before you issue the c_worevent call, your task does
not suspend.
2.) If more than one event completed before you issued the call, the lowest event
number is returned.
Where:
*event_return Pointer to an array of returned events which could be one or many events.
Order of event bits for mask and event_return:
bit 32.............bit 1
-------------------------------------
word[0] | 32..................1
word[1] | 64..................33
word[2] | 96.................. 65
word[3] | 128 .................. 97
word[4] | 160 ..................129
...
...
34
5. Utility IPC Calls B0193BB – Rev D
timer This is the maximum length of time, in fifths of a second, that the current
task will suspend while waiting for an event to occur. If the timer is set to
zero, the task will wait forever for an event to occur.
Return Codes:
u_int mask;
Where:
35
B0193BB – Rev D 5. Utility IPC Calls
36
6. Timer Services (for 50 Series
Only)
Timer services is the portion of IPC that provides a service for a process to start and wait on mul-
tiple event timers. Each timer request has an event number associated with it. The wait on event
call is c_worevent(). User processes may start a timer and then proceed to send or receive IPC
messages while the timer is active. Detection of an overrun, or tracking the number of expirations
of a timer are not supported.
IPC provides three functions for the timer services:
Start a one shot timer or an auto timer
Restart a timer
Stop a timer.
The user process must be registered and activated with either a connection service or a connec-
tionless service or both, prior to using the timer calls. The event number must be unique. The
time-out period must not be 0. The timer value is in 100 milliseconds granularity. The maximum
number of timer services per process is 2 of any kind. The maximum number of timer serviced
per station is 50.
All outstanding timer events for a user process are cancelled when the task exits.
The following user initiated calls are used when making a timer service request:
start_timer()
restart_timer()
stop_timer()
start_time
The start_time() call starts a software timer and returns a timer identification. The user process is
notified via c_worevent() call when the timer expires. The user must maintain the timer id in
order to execute stop_time() or restart_time().
Configuration: For 50 Series only.
u_int duration;
u_int type;
struct event_spec *event
Where:
37
B0193BB – Rev D 6. Timer Services (for 50 Series Only)
restart_time
The restart_time() call restarts a software timer (either a one shot timer or auto timer). The
timer’s delay begins immediately and is of the same duration that was in the start_time() request.
The user process is notified via c_worevent() call when the timer expires.
Configuration: For 50 Series only.
Where:
38
6. Timer Services (for 50 Series Only) B0193BB – Rev D
Error is returned.
stop_time
The stop_time() call stops the associated one shot timer or auto timer. The timer may already be
expired.
Configuration: For 50 Series only.
int timer_id;
Where:
Return Codes:
39
B0193BB – Rev D 6. Timer Services (for 50 Series Only)
40
Appendix A. IPC Calls Sample
Programs
41
B0193BB – Rev D Appendix A. IPC Calls Sample Programs
cs_unregister(“task1”,CDT);
}
byte_fill(dest,init,count)
char *dest;
char init;
int count;
{
int i;
for (i=1;i<=count;i++)*dest++ = init;
return(0);
}
42
Appendix A. IPC Calls Sample Programs B0193BB – Rev D
43
B0193BB – Rev D Appendix A. IPC Calls Sample Programs
44
Appendix A. IPC Calls Sample Programs B0193BB – Rev D
result = obj_create(“task2”,PROCESS);
if (result!=0 && result!=(-10)) {
printf(“Task2 obj_create result = %d\n”,result);
printf(“Task2 aborting\n”);
exit(0);
}
result=cs_register(“task2”,0,NULL,DT,0,1);
if(result<0)
printf(“Task2 cs_register result = %d\n”,result);
result = cs_activate(“task2”,DT);
if(result<0)
printf(“Task2 cs_activate result = %d\n”,result);
pid = fork(); /* do fork */
if (pid == -1) { /* failed */
fprintf( stderr, “fork failed\n” );
exit( -1 );
}
else if (!pid) { /* child process */
execl( “task1c”, “task1c”,buf, 0 );
fprintf( stderr, “exec failed\n” );
exit( -1 );
}
byte_fill(buf,0,sizeof(buf));
c_answer(DT,&info,0L);
result = IN_PROGRESS;
while (result == IN_PROGRESS) {
result = c_chkio(0,ANSWER,&info,buf);
}
if(result<0)
printf(“Task2 c_answer result = %d\n”,result);
channel_id = result;
c_receive(channel_id,50L,&info,buf,0L);
result = IN_PROGRESS;
while (result == IN_PROGRESS) {
result = c_chkio(channel_id,RECEIVE,&info,buf);
}
if(result<0)
printf(“Task2 c_receive result = %d\n”,result);
printf(“\nTask2 receive buffer contains: %s\n”,buf);
for (i=0;buf[i] != NULL;i++)
buf[i] = toupper(buf[i]);
buf[i]=NULL;
printf(“Converted string: %s\n”,buf);
result = c_send(channel_id,(long)i,1,buf,0L);
if(result<0)
printf(“Task2 c_ send result = %d\n”,result);
wait ( &status );/* wait for child */
cs_unregister(“task2”,DT);
45
B0193BB – Rev D Appendix A. IPC Calls Sample Programs
46
Appendix B. IPC Error Codes
This appendix lists the IPC error codes formerly held in the obsolete ipc.h file.
The following tables provide the IPC error codes for any of the packages which once included
/usr/include/fox/ipc.h (which is found only in I/A Series systems with software with
revisions earlier than v8.x).
NOTE
Symbolic references for IPC error codes error codes up to -999 are reserved for
GM-MAP standard error codes. Error codes less than -999 are Invensys generated.
47
B0193BB – Rev D Appendix B. IPC Error Codes
48
Appendix B. IPC Error Codes B0193BB – Rev D
49
B0193BB – Rev D Appendix B. IPC Error Codes
50
Index
A
a_name 10, 11, 24
action 29, 32
add_alias 10
administrative calls 3, 9
alias 2, 3, 4, 9, 10, 11
ap_name 9, 11, 12, 13
asynchronous calls 3
B
broadcast 1, 26
buffer 5, 23
buffer_ptr 17, 19, 22, 26, 30, 32
C
c_answer 16
c_chkio 29
c_chkio_s 30
c_opt_prt 15
c_receive 18
c_selevent 35
c_send 17
c_waitevent 34
c_worevent 5, 32
CALL_COMPLETE 10, 11, 12, 13, 17, 20, 23, 25, 26, 35, 38, 39
CDT 5, 6
CDT_PTR structure 5
channel 2
channel_id 16, 17, 19, 20, 29, 30, 31
chk_clinfo 21
cl_bcast 26
cl_cancel 25
cl_chkio 5, 31
cl_info 32
cl_receive 24
cl_send 5, 21
clu_send 21, 22
codes return 4
COM_SERVERS 26
Connected Data Transfers (DT) 1, 3, 7, 15
Connectionless Data Transfers (CDT) 2, 3, 7, 21
cs_activate 11
cs_connect 15
cs_register 9
cs_register_exit 10
51
B0193BB – Rev D Index
cs_unregister 13
D
d_loc 21
d_loca 15, 23, 32
d_name 5, 15, 21, 23, 26
del_alias 11
DIAG_SUPER 26
dis_ind 19, 30, 31
DT 6
DT_PRT 6
E
E_ABORT_CON 17, 19, 30, 31
E_ANS_OUT 17
e_cs_activate 12
E_DISC_IND 30
E_DISCON 17, 19
E_GROUPID 26
E_ILL_ACT 30, 31, 32, 38
E_ILL_AL_VAL 10, 11
E_ILL_EFN 17, 19, 22, 25, 38
E_ILL_LOCA 16, 22, 23
E_ILL_MASK 33
E_ILL_NAM_SZ 10, 11, 12, 13, 16, 23
E_INV_ACT 30, 32
E_INV_ANAME 11
E_INV_BUFFER 23
E_INV_BUFPTR 17, 19, 25, 26
E_INV_BUFPTR_E_INV_INFOPTR_E_INV_DNAME 22
E_INV_CHAN 17, 19, 20
E_INV_DNAME 25, 26
E_INV_INFOPTR 23, 31
E_INV_MY_NAME 17, 19, 22, 23, 26
E_INV_NAM 12, 22
E_INV_TIME 38
E_INV_TIMIED 38, 39
E_INV_UE 12
E_MAX_CHAN 10
E_MAX_SIZE 17, 19, 22, 23, 25, 26
E_MSG_REJECTED 32
E_MULT_ACT 12
E_MULT_RECV 25
E_NO_ACT 11, 13, 16, 17, 19, 20, 22, 25, 26, 30, 31, 32, 33, 35, 38
E_NO_CHANS 16, 17
E_NO_DEST 16, 30
E_NO_DT_ALIAS 10
E_NO_RES 10, 11, 12, 16, 17, 19, 20, 22, 23, 25, 26, 33, 38
E_NO_SERV 10, 12, 17
E_NOT_CHK 17, 19, 25
52
Index B0193BB – Rev D
F
FS_GATEWAY 26
G
group_name 26
H
HISTORIAN 26
I
id 22, 25
IN_PROGRESS 17, 19, 31, 32
IN_PROGRESS_E_INV_CHAN 30
include file 4
info 5, 16, 19, 21, 23, 29, 31
integer values 5
IPC error codes 47
ipc_init 7
M
mask 33, 34, 35
max_chnls 10
max_insts 10
message_id 5, 32
my_name 17, 19, 21, 23, 26, 30, 31, 32
N
network traffic 1
null 15
num_event 12
numalias 9
number 33
53
B0193BB – Rev D Index
O
o_name 16, 19, 23, 30, 31, 32
P
parameters, configurable 7
pending 3
process 1
process registration tables 7
psap_address 15, 21, 23, 31, 32
R
r_size 19, 21, 23, 30, 32
restart timer 38
return codes 4
S
service 9, 11, 12, 13, 15
size 5, 17, 19, 21, 23
start_time 37
stations number 7
stop_time 39
structure connections 5
structure event_ent 6
structure ts_event 6
synchronous calls 2
T
timer 32, 34, 37, 38
timer_id 38
type_timer 37
U
uses of calls 3
V
value, integer 5
54
Index B0193BB – Rev D
55
Invensys Operations Management
5601 Granite Parkway Suite 1000
Plano, TX 75024
United States of America
http://www.iom.invensys.com