Motr  M0
sim.h File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <ucontext.h>
#include "lib/tlist.h"
#include "desim/cnt.h"
Include dependency graph for sim.h:

Go to the source code of this file.

Data Structures

struct  sim_callout
 
struct  sim
 
struct  sim_thread
 
struct  sim_chan
 

Macros

#define __MOTR_DESIM_SIM_H__
 

Typedefs

typedef unsigned long long sim_time_t
 
typedef int sim_call_t(struct sim_callout *)
 
typedef void sim_func_t(struct sim *, struct sim_thread *, void *)
 

Enumerations

enum  sim_log_level { SLL_WARN, SLL_INFO, SLL_TRACE, SLL_DEBUG }
 

Functions

M0_INTERNAL void sim_init (struct sim *state)
 
M0_INTERNAL void sim_fini (struct sim *state)
 
M0_INTERNAL void sim_run (struct sim *state)
 
M0_INTERNAL void sim_timer_add (struct sim *state, sim_time_t delta, sim_call_t *cfunc, void *datum)
 
M0_INTERNAL void sim_timer_rearm (struct sim_callout *call, sim_time_t delta, sim_call_t *cfunc, void *datum)
 
M0_INTERNAL void * sim_alloc (size_t size)
 
M0_INTERNAL void sim_free (void *ptr)
 
M0_INTERNAL void sim_chan_init (struct sim_chan *chan, char *format,...)
 
M0_INTERNAL void sim_chan_fini (struct sim_chan *chan)
 
M0_INTERNAL void sim_chan_wait (struct sim_chan *chan, struct sim_thread *thread)
 
M0_INTERNAL void sim_chan_signal (struct sim_chan *chan)
 
M0_INTERNAL void sim_chan_broadcast (struct sim_chan *chan)
 
M0_INTERNAL void sim_thread_init (struct sim *state, struct sim_thread *thread, unsigned stacksize, sim_func_t func, void *arg)
 
M0_INTERNAL void sim_thread_fini (struct sim_thread *thread)
 
M0_INTERNAL void sim_thread_exit (struct sim_thread *thread)
 
M0_INTERNAL void sim_sleep (struct sim_thread *thread, sim_time_t nap)
 
M0_INTERNAL struct sim_threadsim_thread_current (void)
 
M0_INTERNAL unsigned long long sim_rnd (unsigned long long a, unsigned long long b)
 
M0_INTERNAL void sim_name_set (char **name, const char *format,...)
 
M0_INTERNAL void sim_name_vaset (char **name, const char *format, va_list valist)
 
M0_INTERNAL void sim_log (struct sim *s, enum sim_log_level level, const char *format,...)
 
M0_INTERNAL int sim_global_init (void)
 
M0_INTERNAL void sim_global_fini (void)
 

Variables

enum sim_log_level sim_log_level