This set of functions provide support for controlling clusters from fabric-controller side.
Enumerator |
---|
PI_CLUSTER_FLAGS_FORK_BASED |
Start the cluster with a fork-based execution model.
|
PI_CLUSTER_FLAGS_TASK_BASED |
Start the cluster with a task-based execution model.
|
static void pi_cl_send_callback_to_fc |
( |
pi_callback_t * |
callback | ) |
|
|
inlinestatic |
This function is used to send a simple callback to FC.
- Parameters
-
callback | Pointer to callback(with function and arg). |
- Note
- This is an alternative to pi_cl_send_task_to_fc().
void pi_cl_send_task_to_fc |
( |
pi_task_t * |
task | ) |
|
This enqueues the specified task into the fabric-controller task scheduler for execution. The task must have been initialized from fabric-controller side.
- Parameters
-
task | Pointer to the fabric-controller task to be enqueued. |
int pi_cluster_close |
( |
struct pi_device * |
device | ) |
|
This function can be called to close an opened cluster device once it is not needed anymore, in order to free all allocated resources. Once this function is called, the device is not accessible anymore and must be opened again before being used. This will power-down the cluster. The caller is blocked until the operation is finished.
- Parameters
-
device | A pointer to the structure describing the device. |
This function can be called to get default values for all parameters before setting some of them. The structure containing the configuration must be kept alive until the SPI device is opened.
- Parameters
-
conf | A pointer to the SPI master configuration. |
int pi_cluster_open |
( |
struct pi_device * |
device | ) |
|
This function must be called before the cluster device can be used. It will do all the needed configuration to make it usable and initialize the handle used to refer to this opened device when calling other functions. By default the cluster is powered down and cannot be used. Calling this function will power it up. At the end of the call, the cluster is ready to execute a task. The caller is blocked until the operation is finished.
- Parameters
-
device | A pointer to the device structure of the device to open. This structure is allocated by the called and must be kept alive until the device is closed. |
- Returns
- 0 if the operation is successfull, -1 if there was an error.
static int pi_cluster_send_task |
( |
struct pi_device * |
device, |
|
|
struct pi_cluster_task * |
task |
|
) |
| |
|
inlinestatic |
This will enqueue the task at the end of the queue of tasks, ready to be executed by the specified cluster. Once the task gets scheduled, the cluster-controller core is waken-up and starts executing the task entry point. This function is intended to be used for coarse-grain job delegation to the cluster side, and thus the stack used to execute this function can be specified. When the function starts executing on the cluster, the other cores of the cluster are also available for parallel computation. Thus the stacks for the other cores (called slave cores) can also be specified, as well as the number of cores which can be used by the function on the cluster (including the cluster controller). The caller is blocked until the task has finished execution.
Note that this enqueues a function execution. To allow cluster executions to be pipelined, several tasks can be enqueued at the same time. If more than two tasks are enqueued, as soon as the first is finished, the cluster-controller core immediately continues with the next one, while the fabric controller receives the termination notification and can enqueue a new execution, in order to keep the cluster busy.
- Parameters
-
device | A pointer to the structure describing the device. |
task | Cluster task structure containing task and its parameters. |
static int pi_cluster_send_task_async |
( |
struct pi_device * |
device, |
|
|
struct pi_cluster_task * |
cluster_task, |
|
|
pi_task_t * |
task |
|
) |
| |
|
inlinestatic |
This will enqueue the task at the end of the queue of tasks, ready to be executed by the specified cluster. Once the task gets scheduled, the cluster-controller core is waken-up and starts executing the task entry point. This function is intended to be used for coarse-grain job delegation to the cluster side, and thus the stack used to execute this function can be specified. When the function starts executing on the cluster, the other cores of the cluster are also available for parallel computation. Thus the stacks for the other cores (called slave cores) can also be specified, as well as the number of cores which can be used by the function on the cluster (including the cluster controller). The task is just enqueued and the caller continues execution. A task must be specified in order to specify how the caller should be notified when the task has finished execution.
Note that this enqueues a function execution. To allow cluster executions to be pipelined, several tasks can be enqueued at the same time. If more than two tasks are enqueued, as soon as the first is finished, the cluster-controller core immediately continues with the next one, while the fabric controller receives the termination notification and can enqueue a new execution, in order to keep the cluster busy.
- Parameters
-
device | A pointer to the structure describing the device. |
cluster_task | Cluster task structure containing task and its parameters. |
task | The task used to notify the end of execution. |
static struct pi_cluster_task* pi_cluster_task |
( |
struct pi_cluster_task * |
task, |
|
|
void(*)(void *) |
entry, |
|
|
void * |
arg |
|
) |
| |
|
static |
This initializes a cluster task before it can be sent to the cluster side for execution. If the same task is re-used for several executions, it must be reinitialized everytime by calling this function.
- Parameters
-
task | A pointer to the structure describing the task. This structure is allocated by the caller and must be kept alive until the task has finished execution. |
entry | The task entry point that the cluster controller will execute. |
arg | The argument to the entry point. |