PMSIS API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
FC/Cluster synchronization

Data Structures

struct  pi_cluster_conf
 Cluster configuration structure. More...
 

Enumerations

enum  pi_cluster_flags_e
 Cluster configuration flags. More...
 

Functions

void pi_cluster_conf_init (struct pi_cluster_conf *conf)
 Initialize a cluster configuration with default values. More...
 
int pi_cluster_open (struct pi_device *device)
 Open and power-up the cluster. More...
 
int pi_cluster_close (struct pi_device *device)
 Close an opened cluster device. More...
 
static struct pi_cluster_task * pi_cluster_task (struct pi_cluster_task *task, void(*entry)(void *), void *arg)
 Prepare a cluster task for execution. More...
 
static int pi_cluster_send_task (struct pi_device *device, struct pi_cluster_task *task)
 Enqueue a task for execution on the cluster. More...
 
static int pi_cluster_send_task_async (struct pi_device *device, struct pi_cluster_task *cluster_task, pi_task_t *task)
 Enqueue asynchronously a task for execution on the cluster. More...
 
void pi_cl_send_task_to_fc (pi_task_t *task)
 Enqueue a task to fabric-controller side. More...
 
static void pi_cl_send_callback_to_fc (pi_callback_t *callback)
 Send a callback to Fabric Controller. More...
 

Description

This set of functions provide support for controlling clusters from fabric-controller side.

Enumeration Type Documentation

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.

Function Documentation

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
callbackPointer 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
taskPointer 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
deviceA pointer to the structure describing the device.
void pi_cluster_conf_init ( struct pi_cluster_conf conf)

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
confA 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
deviceA 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
deviceA pointer to the structure describing the device.
taskCluster 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
deviceA pointer to the structure describing the device.
cluster_taskCluster task structure containing task and its parameters.
taskThe 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
taskA 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.
entryThe task entry point that the cluster controller will execute.
argThe argument to the entry point.