Add macro for define process stack.
[bertos.git] / bertos / kern / proc.h
index b396a2c9a94d256d4a8fbcfd70f8959992a1cc5b..45949e8e3ef166f0bebc3b62bb014a15c8444ba1 100644 (file)
 #include <cpu/types.h> // cpu_stack_t
 #include <cpu/frame.h> // CPU_SAVED_REGS_CNT
 
+/*
+ * Define stack for one process.
+ *
+ * This macro define a static stack for one process and do
+ * check if given stack size is enough to run process.
+ */
+#define PROC_DEFINE_STACK(name, size) \
+       STATIC_ASSERT(size >= CONFIG_KERN_MINSTACKSIZE); \
+       cpu_stack_t name[size / sizeof(cpu_stack_t)]; \
+
 /*
  * Forward declaration. The definition of struct Process is private to the
  * scheduler and hidden in proc_p.h.