17 #include <core/dependencies.h>
19 #ifdef POK_NEEDS_MIDDLEWARE
20 #ifdef POK_NEEDS_BLACKBOARDS
24 #include <libc/string.h>
25 #include <core/event.h>
26 #include <middleware/blackboard.h>
29 extern char* pok_blackboards_names[POK_CONFIG_NB_BLACKBOARDS];
30 pok_size_t pok_blackboards_data_index = 0;
32 pok_ret_t pok_blackboard_create (
char* name,
33 const pok_port_size_t msg_size,
34 pok_blackboard_id_t*
id)
39 for (n=0 ; n < POK_CONFIG_NB_BLACKBOARDS ; n++)
41 if (streq (name, pok_blackboards_names[n]))
43 if (pok_blackboards[n].ready == TRUE)
45 return POK_ERRNO_READY;
48 ret = pok_event_create (&pok_blackboards[n].lock);
50 if (ret != POK_ERRNO_OK)
55 pok_blackboards[n].ready = TRUE;
56 pok_blackboards[n].empty = TRUE;
57 pok_blackboards[n].index = pok_blackboards_data_index;
58 pok_blackboards[n].waiting_processes = 0;
59 pok_blackboards[n].size = msg_size;
61 pok_blackboards_data_index = pok_blackboards_data_index + msg_size;
66 return POK_ERRNO_EINVAL;