Revision 1f7ffcff

View differences:

src/urt_core.c
48 48
/**
49 49
 * @brief   Initialize the Core.
50 50
 */
51
void urtCoreInit(void) {return;}
51
void urtCoreInit(void)
52
{
53
  urt_core_t._nodes = NULL;
54
  urt_core_t._status = URT_STATUS_OK;
55
  //add later: mutex and eventsource init
56
  #if (URT_CFG_PUBSUB_ENABLED)
57
    urt_core_t._topics = NULL;
58
  #endif /* URT_CFG_PUBSUB_ENABLED */
59
  #if (URT_CFG_RPC_ENABLED)
60
    urt_core_t.urt_service_t = NULL;
61
  #endif /* URT_CFG_RPC_ENABLED */
62
  return;
63
}
52 64

  
53 65
/**
54 66
 * @brief   Get Core status.
src/urt_message.c
51 51
 * @param[in] message  Message to initalize. Must not be NULL.
52 52
 * @param[in] payload  May be NULL for messages without payload.
53 53
 */
54
void urtMessageInit(urt_message_t* message, void* payload) {return;}
54
void urtMessageInit(urt_message_t* message, void* payload)
55
{
56
  urt_message_t.next = NULL;
57
  urt_message_t.payload = payload;
58
  urt_message_t.originTime = 0;
59
  urt_message_t.numHrtConsumersLeft = 0;
60
  #if (URT_CFG_PUBSUB_PROFILING)
61
    urt_message_t.numConsumersLeft = 0;
62
  #endif /* URT_CFG_PUBSUB_PROFILING */
63

  
64
  return;
65
}
src/urt_node.c
46 46
/******************************************************************************/
47 47

  
48 48
/**
49
 * @brief   Initalize the node.
49
 * @brief  Initalize the node.
50 50
 *
51 51
 * @param[in] node  The node to initialize. Must not be NULL.
52 52
 * @param[in] thread  The already initialized, exclusive thread for the node. Must not be NULL.
53 53
 * @param[in] setupcallback  Callback function to be executed during setup.
54 54
 *                           May be NULL if no custom setup is required.
55 55
 * @param[in] setupparams  Parameters for the setup callback function.
56
 *                         Must be NULLif no setup callback is specified.
57
 *                         May be NULLif the specified setup callback does not expect parameters.
56
 *                         Must be NULL if no setup callback is specified.
57
 *                         May be NULL if the specified setup callback does not expect parameters.
58 58
 * @param[in] loopcallback  Callback function to be executed in a loop.
59 59
 *                          Must not be NULL.
60 60
 * @param[in] loopparams  Parameters for the loop callback function.
......
67 67
 */
68 68
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback,
69 69
                 void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams,
70
                 urt_nodeShutdownCallback_t* shutdowncallback, void* shutdownparams) {return;}
70
                 urt_nodeShutdownCallback_t* shutdowncallback, void* shutdownparams)
71
{
72
  urt_node_t.next = NULL;
73
  urt_node_t.thread = thread;
74
  urt_node_t.setupcallback = setupcallback;
75
  urt_node_t.setupparams = setupparams;
76
  urt_node_t.loopparams = loopparams;
77
  urt_node_t.shutdowncallback = loopcallback;
78
  urt_node_t.shutdownparams = loopparams;
79
  urt_node_t.stage = 0;
80
  // add later: urteventlistenerinit
81
  #if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
82
    urt_node_t.loops = 0;
83
  #endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */
84
    // add later: lock core,..
85
  return;
86
}
src/urt_publisher.c
55 55
 *                     Once a message has been contributed, it cannot be removed later.
56 56
 *                     May be NULL (no messages to contribute).
57 57
 */
58
void urtPublisherInit(urt_publisher_t* publisher, urt_topic_t* topic, urt_message_t* message) {return;}
58
void urtPublisherInit(urt_publisher_t* publisher, urt_topic_t* topic, urt_message_t* message)
59
{
60
  urt_publisher_t.topic = topic;
61
  #if (URT_CFG_PUBSUB_PROFILING)
62
    urt_publisher_t.publishAttempts = 0;
63
    urt_publisher_t.publishFails = 0;
64
  endif /* URT_CFG_PUBSUB_PROFILING */
65
  //add later: messages to contribute,...
66
  return;
67
}
59 68

  
60 69

  
61 70
/**
src/urt_service.c
55 55
 * @return  Returns URT_STATUS_OK on success.
56 56
 *          Returns URT_STATUS_SERVICE_DUPLICATE if another service with the same identifier already exists.
57 57
 */
58
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback) {return URT_STATUS_OK;}
58
urt_status_t urtServiceInit(urt_service_t* service, urt_serviceid_t id, urt_servicefunc_t* callback)
59
{
60
  urt_service_t.next = NULL;
61
  urt_service_t.id = id;
62
  //add later: urtmutex init
63
  urt_service_t.callback = callback;
64
  #if (URT_CFG_RPC_PROFILING)
65
    urt_service_t.sumDurations = 0;
66
    urt_service_t.numCalls = 0;
67
    urt_service_t.numTimeouts = 0;
68
    urt_service_t.minDuration = 0;
69
    urt_service_t.maxDuration 0;
70
  #endif /* URT_CFG_RPC_PROFILING */
71
  //add later: lock core,...
72
  return URT_STATUS_OK;
73
}
59 74

  
60 75
/**
61 76
 * @brief   Calls a service.
src/urt_topic.c
54 54
 * @return  Returns URT_STATUS_OK on success.
55 55
 *          Returns URT_STATUS_TOPIC_DUPLICATE if another topic with the same identifier already exists.
56 56
 */
57
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id) {return URT_STATUS_OK;}
57
urt_status_t urtTopicInit(urt_topic_t* topic, urt_topicid_t id)
58
{
59
  urt_topic_t.next = NULL;
60
  urt_topic_t.id = id;
61
  //add later: urtmutexinit, urteventsourceinit
62
  urt_topic_t.numHrtSubscribers = 0;
63
  //add later: condvar, message init, latest message
64
  #if (URT_CFG_PUBSUB_QOS_RATECHECKS)
65
    urt_topic_t.hrtSubscribers = nullptr;
66
    //add later: timer init;
67
  #endif /* URT_CFG_PUBSUB_QOS_RATECHECKS */
68
  #if (URT_CFG_PUBSUB_PROFILING)
69
    urt_topic_t.numMessagesPublished = 0;
70
    urt_topic_t.numMessagesDiscarded = 0;
71
    urt_topic_t.numSubscribers = 0;
72
  #endif /* URT_CFG_PUBSUB_PROFILING */
73
  //add later: close circular message buffer,...
74
  return URT_STATUS_OK;
75
}

Also available in: Unified diff