2 * @file vp_api_supervisor.h
3 * @brief VP Api. Pipeline supervisor
7 #ifndef _VP_API_SUPERVISOR_H_
8 #define _VP_API_SUPERVISOR_H_
19 * @defgroup vp_api_supervisor Api supervisor
24 Handle multiple pipelines per application.
25 Handle pipeline messages and dispatch them to stages.
30 * \par date: 2007-06-14 author: <julien.floret.ext\@parrot.com>
31 * - Handle different message dispatchs : Pipeline level, stage broadcast
33 * \par date: 2007-05-28 author: <julien.floret.ext\@parrot.com>
38 ///////////////////////////////////////////////
41 #include <VP_Os/vp_os_types.h>
42 #include <VP_Os/vp_os_signal.h>
44 ///////////////////////////////////////////////
47 struct _vp_api_io_pipeline_;
50 ///////////////////////////////////////////////
54 * @def VP_API_DEST_PIPELINE_LEVEL
55 * Pipeline level : no dispatch to stages
58 * @def VP_API_DEST_STAGE_BROADCAST
59 * Broadcast message to all stages
62 #define VP_API_DEST_PIPELINE_LEVEL 0x7fff
63 #define VP_API_DEST_STAGE_BROADCAST 0x7ffe
66 typedef int32_t PIPELINE_ADDRESS; ///< Pipeline address
67 typedef int16_t PIPELINE_HANDLE; ///< Pipeline handle
70 /** Pipeline message identifiers
72 typedef enum _PIPELINE_MSG
80 PIPELINE_MSG_SYNCHRONIZE,
87 * @brief Pipeline messages fifo
89 typedef struct _vp_api_fifo_
91 char *pbase; ///< Base address of the fifo
92 char *pget; ///< Pointer to the next message to get
93 char *ppost; ///< Where to post a new message in the fifo
94 int32_t nb_waiting; ///< Number of messages waiting to be handled
101 * @brief Handle to a message destination
103 typedef union _DEST_HANDLE
105 int32_t handle; ///< Pipeline handle (16 bits) + stage number (16bits)
108 PIPELINE_HANDLE pipeline; ///< Pipeline handle
109 int16_t stage; ///< Stage number
115 typedef C_RESULT (*vp_api_handle_msg_t)( struct _vp_api_io_pipeline_ *pipeline,
122 ///////////////////////////////////////////////
126 * @fn vp_api_add_pipeline(struct _vp_api_io_pipeline_ *, PIPELINE_HANDLE *)
127 * @brief Add a pipeline and get its handle
128 * @param pipeline Pipeline to add
129 * @param handle Handle to the added pipeline
130 * @return C_RESULT : VP_SUCCESS
131 * @author Julien Floret <julien.floret.ext\@parrot.com>
134 C_RESULT vp_api_add_pipeline(struct _vp_api_io_pipeline_ *pipeline, PIPELINE_HANDLE *handle);
138 * @fn vp_api_remove_pipeline(struct _vp_api_io_pipeline_ *, PIPELINE_HANDLE *)
139 * @brief Remove a pipeline and release handle
140 * @param pipeline Pipeline to remove
141 * @param handle Handle of the pipeline
142 * @return C_RESULT : VP_SUCCESS
143 * @author Aurelien Morelle <aurelien.morelle@parrot.com>
146 C_RESULT vp_api_remove_pipeline(struct _vp_api_io_pipeline_ *pipeline, PIPELINE_HANDLE *handle);
150 * @fn vp_api_get_pipeline(PIPELINE_HANDLE)
151 * @brief Get a pipeline address from its handle
152 * @param handle Pipeline handle
153 * @return struct _vp_api_io_pipeline_ * : Pipeline to get
154 * @author Julien Floret <julien.floret.ext\@parrot.com>
157 struct _vp_api_io_pipeline_ * vp_api_get_pipeline(PIPELINE_HANDLE handle);
161 * @fn vp_api_post_message(DEST_HANDLE, PIPELINE_MSG, void *, void *)
162 * @brief Post a message to a pipeline
163 * @param dest Message destination
164 * @param msg_id Message identifier
165 * @param callback Optional callback function called after processing of the message
166 * @param param Optional message parameters
167 * @return C_RESULT : VP_SUCCESS or VP_FAILURE
168 * @author Julien Floret <julien.floret.ext\@parrot.com>
171 C_RESULT vp_api_post_message(DEST_HANDLE dest, PIPELINE_MSG msg_id, void *callback, void *param);
175 * @fn vp_api_handle_messages(struct _vp_api_io_pipeline_ *)
176 * @brief Handle pipeline messages
178 * This function handles pipeline messages by calling user defined callback functions
179 * @param pipeline Current pipeline
180 * @return C_RESULT : VP_SUCCESS
181 * @author Julien Floret <julien.floret.ext\@parrot.com>
184 C_RESULT vp_api_handle_messages(struct _vp_api_io_pipeline_ *pipeline);
193 #endif // ! _VP_API_SUPERVISOR_H_