MsysAlloc()函数

Synopsis

Allocate a system.

Format

MIL_ID MsysAlloc(SystemTypePtr, SystemNum, InitFlag, SystemIdPtr)

void *SystemTypePtr; Type of system to allocate
long SystemNum; System number
long InitFlag; Initialization flag
MIL_ID *SystemIdPtr; Storage location for system identifier

Description

This function allocates a hardware system (board set or Host system) so that it can be used by subsequent MIL functions. Upon execution of this command, MIL ensures that it can open communication with the system before allocating it and generates an error if it cannot.

A system must be allocated before any buffers, displays, or digitizers can be allocated on it. Before allocating a system, an application must be allocated, using MappAlloc or MappAllocDefault.

When finished using a system, free it, using MsysFree.

The SystemTypePtr parameter specifies the type of system to allocate. This parameter is a pointer to a function that allows communication with the specified system (board). Set this parameter to one of the following values:

M_SYSTEM_SETUP System selected in the setup utility.
M_SYSTEM_HOST Host type system.
M_SYSTEM_VGA VGA type system.
M_SYSTEM_METEOR Meteor type system.
M_SYSTEM_PULSAR Pulsar type system.
M_SYSTEM_GENESIS Genesis type system.

The SystemNum parameter specifies the number (or rank) of the target board of the specified system type. This parameter can be set to one of the following:

M_DEFAULT Default board.
M_DEV0 The first board of the specified system type.
…, The nth board of the specified system type.
M_DEV15 The sixteenth board of the specified system type.

The InitFlag parameter specifies the type of initialization you want to perform on the selected system. This parameter can be set to one of the following:

M_COMPLETE Perform a complete initialization of the system: initialize the system to its default state and download any required resident software. At least one complete initialization is necessary after you power-up your system.
M_PARTIAL Initialize the system with its default state but do not download any resident software (which can take a few seconds).
M_DEFAULT Same as M_COMPLETE.

The SystemIdPtr parameter specifies the address of the variable in which the system identifier is to be written. Since the MsysAlloc function also returns the system identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Note, upon allocation of an application, a default Host system is automatically allocated. Rather than using MsysAlloc to allocate a Host system, you can use this default Host system, by specifying M_DEFAULT_HOST wherever a Host system identifier is required.

Return value

The returned value is the system identifier. If allocation fails, M_NULL is returned.

See also

MsysFree

《MsysAlloc()函数》上有4条评论

评论已关闭。