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 typedef int vp_os_mutex_t ;
45 ///////////////////////////////////////////////
48 struct _vp_api_io_pipeline_;
51 ///////////////////////////////////////////////
55 * @def VP_API_DEST_PIPELINE_LEVEL
56 * Pipeline level : no dispatch to stages
59 * @def VP_API_DEST_STAGE_BROADCAST
60 * Broadcast message to all stages
63 #define VP_API_DEST_PIPELINE_LEVEL 0x7fff
64 #define VP_API_DEST_STAGE_BROADCAST 0x7ffe
67 typedef int32_t PIPELINE_ADDRESS; ///< Pipeline address
68 typedef int16_t PIPELINE_HANDLE; ///< Pipeline handle
71 /** Pipeline message identifiers
73 typedef enum _PIPELINE_MSG
81 PIPELINE_MSG_SYNCHRONIZE,
88 * @brief Pipeline messages fifo
90 typedef struct _vp_api_fifo_
92 char *pbase; ///< Base address of the fifo
93 char *pget; ///< Pointer to the next message to get
94 char *ppost; ///< Where to post a new message in the fifo
95 int32_t nb_waiting; ///< Number of messages waiting to be handled
102 * @brief Handle to a message destination
104 typedef union _DEST_HANDLE
106 int32_t handle; ///< Pipeline handle (16 bits) + stage number (16bits)
109 PIPELINE_HANDLE pipeline; ///< Pipeline handle
110 int16_t stage; ///< Stage number
116 typedef C_RESULT (*vp_api_handle_msg_t)( struct _vp_api_io_pipeline_ *pipeline,
123 ///////////////////////////////////////////////
127 * @fn vp_api_add_pipeline(struct _vp_api_io_pipeline_ *, PIPELINE_HANDLE *)
128 * @brief Add a pipeline and get its handle
129 * @param pipeline Pipeline to add
130 * @param handle Handle to the added pipeline
131 * @return C_RESULT : VP_SUCCESS
132 * @author Julien Floret <julien.floret.ext\@parrot.com>
135 C_RESULT vp_api_add_pipeline(struct _vp_api_io_pipeline_ *pipeline, PIPELINE_HANDLE *handle);
139 * @fn vp_api_remove_pipeline(struct _vp_api_io_pipeline_ *, PIPELINE_HANDLE *)
140 * @brief Remove a pipeline and release handle
141 * @param pipeline Pipeline to remove
142 * @param handle Handle of the pipeline
143 * @return C_RESULT : VP_SUCCESS
144 * @author Aurelien Morelle <aurelien.morelle@parrot.com>
147 C_RESULT vp_api_remove_pipeline(struct _vp_api_io_pipeline_ *pipeline, PIPELINE_HANDLE *handle);
151 * @fn vp_api_get_pipeline(PIPELINE_HANDLE)
152 * @brief Get a pipeline address from its handle
153 * @param handle Pipeline handle
154 * @return struct _vp_api_io_pipeline_ * : Pipeline to get
155 * @author Julien Floret <julien.floret.ext\@parrot.com>
158 struct _vp_api_io_pipeline_ * vp_api_get_pipeline(PIPELINE_HANDLE handle);
162 * @fn vp_api_post_message(DEST_HANDLE, PIPELINE_MSG, void *, void *)
163 * @brief Post a message to a pipeline
164 * @param dest Message destination
165 * @param msg_id Message identifier
166 * @param callback Optional callback function called after processing of the message
167 * @param param Optional message parameters
168 * @return C_RESULT : VP_SUCCESS or VP_FAILURE
169 * @author Julien Floret <julien.floret.ext\@parrot.com>
172 C_RESULT vp_api_post_message(DEST_HANDLE dest, PIPELINE_MSG msg_id, void *callback, void *param);
176 * @fn vp_api_handle_messages(struct _vp_api_io_pipeline_ *)
177 * @brief Handle pipeline messages
179 * This function handles pipeline messages by calling user defined callback functions
180 * @param pipeline Current pipeline
181 * @return C_RESULT : VP_SUCCESS
182 * @author Julien Floret <julien.floret.ext\@parrot.com>
185 C_RESULT vp_api_handle_messages(struct _vp_api_io_pipeline_ *pipeline);
194 #endif // ! _VP_API_SUPERVISOR_H_