Flylib.com

Books Software

 
 
 

CO_PROCESS_CREATE


CO_PROCESS_CREATE

co_process co_process_create(const char *name,
                             co_function run,
                             int argc, ...);

Header File

co.h

Description

This function creates a process. This function must be called from within the configuration function of your application.

Arguments

The arguments for co_process_create are as follows :

const char *name

A programmer-defined name. This name may be any text string. It is used to identify the process externally, such as when using the Application Monitor.

co_function run

The run function associated with this process.

int argc

The number of input/output ports (streams, signals, registers, memories, and parameters) associated with the run function. The argc variable is followed by a corresponding list of port arguments as specified in the run function declaration.


Return Value

A pointer to the created process. This return value may subsequently be used as an argument to the function co_process_config .

Notes

Processes created using co_process_create represent specific instances of the specified run function. It is possible (and common) for co_process_create to be called repeatedly for the same process in order to create multiple instances of a run function.

In simulation, this function prints an error message and terminates the application if it is called from outside the configuration function, or if the Application Monitor is being used and a name argument is not supplied (== NULL ).


CO_REGISTER_CREATE

co_register co_register_create(const char *name,
                               co_type type);

Header File

co.h

Description

This function creates a register object. This function must be called from within the configuration function of your application.

Arguments

The arguments for co_register_create are as follows :

const char *name

A programmer-defined name. This name may be any text string. It is used to identify the register externally, such as when using the Application Monitor.

co_type type

The type of the register. The type is normally expressed as a signed or unsigned integer of a specific width using the INT_TYPE(n) , UINT_TYPE(n) , or CHAR_TYPE macros.


Return Value

A pointer to the created register. This return value may subsequently be used as an argument to function co_process_create . It returns NULL and sets co_errno to CO_ENOERROR if the type argument is NULL .

Notes

Register names , as specified in the first argument to co_register_create , must be unique across the application when using the Application Monitor.


CO_REGISTER_GET

int32 co_register_get(co_register reg);

Header File

co.h

Description

This function reads the contents of a register. This function must be called from within a process run function.

Arguments

The argument for co_register_get is as follows :

co_register reg

A pointer to a register object as passed on the process argument list.


Return Value

The value of the register is returned as a 32-bit integer. If the register is wider than 32 bits, the least-significant 32 bits of data are returned as an integer. If the register is smaller than 32 bits, the integer value of the data in the register is returned.


CO_REGISTER_PUT

void co_register_put(co_register reg,
                     int32 value);

Header File

co.h

Description

This function puts a data value to a register object. This function must be called from within a process run function.

Arguments

The arguments for co_register_put are as follows :

co_register reg

A pointer to a register object as passed on the process argument list.

int32 value

Specifies the value to be assigned to the register.


Return Value

None.

Notes

If the register is wider than 32 bits, the data value is written into the least-significant bytes of the register and higher-order bytes are unchanged. If the register is smaller than 32 bits, the least-significant bytes of the value are written to the register until it is full.