X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fsignal_test.c;h=6734347b0e345089a0c7dbf8ff725b0f9023027f;hb=3382ed7ae024250b265519b57482342608d7d0cb;hp=f2a4acfc62d22fd098393fa98322b4cd24b97103;hpb=e423e63cade618baf616a79b99aaab5de74ec76e;p=bertos.git diff --git a/bertos/kern/signal_test.c b/bertos/kern/signal_test.c index f2a4acfc..6734347b 100644 --- a/bertos/kern/signal_test.c +++ b/bertos/kern/signal_test.c @@ -32,7 +32,6 @@ * * \brief Signals test. * - * \version $Id$ * * \author Daniele Basile * @@ -76,38 +75,31 @@ sigmask_t sig_to_slave; * These macros generate the code needed to create the test process functions. */ #define PROC_TEST_SLAVE(index, signal) \ -static void NORETURN proc_test##index(void) \ +static void proc_signalTest##index(void) \ { \ - for(;;) \ - { \ - kprintf("> Slave [%d]: Wait signal [%d]\n", index, signal); \ - sig_wait(signal); \ - kprintf("> Slave [%d]: send signal [%d]\n", index, signal); \ - sig_signal(proc_currentUserData(), signal); \ - } \ -} \ + kputs("> Slave [" #index "]: Wait signal [" #signal "]\n"); \ + sig_wait(signal); \ + kputs("> Slave [" #index "]: send signal [" #signal "]\n"); \ + sig_send(proc_currentUserData(), signal); \ +} #define MAIN_CHECK_SIGNAL(index, slave) \ do { \ kprintf("> Main: send signal [%d]\n", test_signal[index]); \ - sig_signal(slave, test_signal[index]); \ + sig_send(slave, test_signal[index]); \ kprintf("> Main: wait signal [%d]\n", test_signal[index]); \ sig_wait(test_signal[index]); \ count++; \ } while(0) \ -#define PROC_TEST_SLAVE_STACK(index) static cpu_stack_t proc_test##index##_stack[CONFIG_KERN_MINSTACKSIZE / sizeof(cpu_stack_t)]; -#define PROC_TEST_SLAVE_INIT(index, master_process) proc_new(proc_test##index, master_process, sizeof(proc_test##index##_stack), proc_test##index##_stack) +#if CONFIG_KERN_HEAP -// Generate the code for signal test. -PROC_TEST_SLAVE(0, SIG_USER0) -PROC_TEST_SLAVE(1, SIG_USER1) -PROC_TEST_SLAVE(2, SIG_USER2) -PROC_TEST_SLAVE(3, SIG_USER3) -PROC_TEST_SLAVE(4, SIG_TIMEOUT) -PROC_TEST_SLAVE(5, SIG_SYSTEM5) -PROC_TEST_SLAVE(6, SIG_SYSTEM6) -PROC_TEST_SLAVE(7, SIG_SINGLE) +#define PROC_TEST_SLAVE_INIT(index, master_process) proc_new(proc_signalTest##index, master_process, KERN_MINSTACKSIZE * 2, NULL) + +#else + +#define PROC_TEST_SLAVE_STACK(index) PROC_DEFINE_STACK(proc_signal_test##index##_stack, KERN_MINSTACKSIZE * 2); +#define PROC_TEST_SLAVE_INIT(index, master_process) proc_new(proc_signalTest##index, master_process, sizeof(proc_signal_test##index##_stack), proc_signal_test##index##_stack) PROC_TEST_SLAVE_STACK(0) PROC_TEST_SLAVE_STACK(1) @@ -118,6 +110,18 @@ PROC_TEST_SLAVE_STACK(5) PROC_TEST_SLAVE_STACK(6) PROC_TEST_SLAVE_STACK(7) +#endif + +// Generate the code for signal test. +PROC_TEST_SLAVE(0, SIG_USER0) +PROC_TEST_SLAVE(1, SIG_USER1) +PROC_TEST_SLAVE(2, SIG_USER2) +PROC_TEST_SLAVE(3, SIG_USER3) +PROC_TEST_SLAVE(4, SIG_TIMEOUT) +PROC_TEST_SLAVE(5, SIG_SYSTEM5) +PROC_TEST_SLAVE(6, SIG_SYSTEM6) +PROC_TEST_SLAVE(7, SIG_SINGLE) + /** * Run signal test */ @@ -166,12 +170,6 @@ int signal_testSetup(void) { kdbg_init(); - #if CONFIG_KERN_PREEMPT - kprintf("Init Interrupt (preempt mode).."); - irq_init(); - kprintf("Done.\n"); - #endif - kprintf("Init Timer.."); timer_init(); kprintf("Done.\n");