Chapter 4: initialization and status functions, 1 overview, 2 middleware initialization and shutdown – Sensoray 2600 User Manual

Page 9

Advertising
background image

Sensoray 2600 Programming Guide

5

Initialization and Status Functions

Chapter 4: Initialization and Status Functions

4.1 Overview

The functions described in this chapter are used to open, initialize and close the middleware library and all Main Modules in the
2600 system.

4.2 Middleware Initialization and Shutdown

4.2.1 S26_DriverOpen()

Function:

Initializes the middleware.

Prototype:

u32 S26_DriverOpen( u32 NumMMs );

Returns:

u32 containing an error code. One of the following values is returned:

Errors can often be resolved by reconfiguring your network settings. In Windows, you can do this by changing the
TCP/IP settings through the network control panel.

Notes:

This function allocates memory for and initializes the MM middleware.

S26_DriverOpen()

must be successfully

invoked before any other middleware functions are called. Each Ethernet client must call this function exactly
once. Multi-threaded applications must invoke this function one time before any other middleware functions are
called by any of the application’s threads.

Example:

See section 4.4.4.

4.2.2 S26_DriverClose()

Function:

Closes the middleware.

Prototype:

void S26_DriverClose();

Returns:

None.

Notes:

If the prior call to

S26_DriverOpen()

was successful, this function must be called before the application closes to

ensure that the middleware shuts down gracefully and properly releases all resources. If an error code was returned

Parameter

Type

Description

NumMMs

u32

Number of MMs (2601 modules) in the system.

Value

Description

0

No errors were detected; middleware is open.

DRVERR_MALLOC

The version number of the socket API is incompatible with the middleware, or TCP/IP is
not properly configured on the Ethernet client.

DRVERR_NETWORKOPEN

There was a problem when the network interface was opened. Any of the following
conditions can cause this error:

1.

The version number of the socket API is incompatible with the middleware.

2.

TCP/IP is not properly configured on the Ethernet client.

3.

The socket driver can’t support the number of sockets required for communicating
with the number of MMs in the system.

DRVERR_CRITICALSECTION

There was a problem creating semaphores.

Advertising