2017-02-02 11:34:37 +00:00
|
|
|
/**
|
|
|
|
* @file init.c
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Core library */
|
|
|
|
#define TRACE_MODULE _init
|
|
|
|
#include "core_debug.h"
|
2017-02-13 00:58:55 +00:00
|
|
|
#include "core_thread.h"
|
|
|
|
|
2017-02-06 11:54:31 +00:00
|
|
|
#include "context.h"
|
2017-02-13 00:58:55 +00:00
|
|
|
#include "event.h"
|
|
|
|
|
2017-02-13 02:48:25 +00:00
|
|
|
static thread_id mme_thread;
|
|
|
|
extern void *THREAD_FUNC mme_main(void *data);
|
2017-02-13 00:58:55 +00:00
|
|
|
|
|
|
|
void threads_start()
|
|
|
|
{
|
|
|
|
status_t rv;
|
2017-02-02 11:34:37 +00:00
|
|
|
|
2017-02-13 02:48:25 +00:00
|
|
|
rv = thread_create(&mme_thread, NULL, mme_main, NULL);
|
2017-02-13 00:58:55 +00:00
|
|
|
d_assert(rv == CORE_OK, return,
|
2017-02-13 02:48:25 +00:00
|
|
|
"MME State machine thread creation failed");
|
2017-02-13 00:58:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void threads_stop()
|
|
|
|
{
|
2017-02-13 02:48:25 +00:00
|
|
|
thread_delete(mme_thread);
|
2017-02-13 00:58:55 +00:00
|
|
|
}
|
2017-02-02 11:34:37 +00:00
|
|
|
|
|
|
|
status_t cellwire_initialize(char *config_path)
|
|
|
|
{
|
2017-02-06 11:54:31 +00:00
|
|
|
status_t rv;
|
2017-02-02 11:34:37 +00:00
|
|
|
|
|
|
|
srand(time(NULL)*getpid());
|
|
|
|
|
2017-02-06 11:54:31 +00:00
|
|
|
rv = context_init();
|
|
|
|
if (rv != CORE_OK)
|
|
|
|
return rv;
|
|
|
|
|
2017-02-02 11:34:37 +00:00
|
|
|
return CORE_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cellwire_terminate(void)
|
|
|
|
{
|
2017-02-06 11:54:31 +00:00
|
|
|
context_final();
|
2017-02-02 11:34:37 +00:00
|
|
|
}
|