From b3fe69febaf2e2e41937b0f0e0dfad9b5fcbc3a5 Mon Sep 17 00:00:00 2001 From: arighi Date: Thu, 25 Mar 2010 14:56:25 +0000 Subject: [PATCH] Use the new sig_send() and sig_post() primitives. Replace the old sig_signal() calls with the new sig_send() and sig_post() functions. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3270 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/arm/drv/adc_at91.c | 2 +- bertos/cpu/avr/drv/adc_avr.c | 2 +- bertos/kern/proc_test.c | 2 +- bertos/kern/signal_test.c | 15 ++++++--------- bertos/mware/event.c | 2 +- examples/avr-kern/avr-kern.mk | 1 + examples/avr-kern/main.c | 2 ++ examples/benchmark/kernel-core_avr/main.c | 2 +- examples/benchmark/kernel-only_arm/main.c | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/bertos/cpu/arm/drv/adc_at91.c b/bertos/cpu/arm/drv/adc_at91.c index 7fd50ddf..fadaa4be 100644 --- a/bertos/cpu/arm/drv/adc_at91.c +++ b/bertos/cpu/arm/drv/adc_at91.c @@ -86,7 +86,7 @@ */ static DECLARE_ISR(adc_conversion_end_irq) { - sig_signal(adc_process, SIG_ADC_COMPLETE); + sig_post(adc_process, SIG_ADC_COMPLETE); /* Inform hw that we have served the IRQ */ AIC_EOICR = 0; diff --git a/bertos/cpu/avr/drv/adc_avr.c b/bertos/cpu/avr/drv/adc_avr.c index 20aa2a19..0aae6743 100644 --- a/bertos/cpu/avr/drv/adc_avr.c +++ b/bertos/cpu/avr/drv/adc_avr.c @@ -89,7 +89,7 @@ */ ISR(ADC_vect) { - sig_signal(adc_process, SIG_ADC_COMPLETE); + sig_post(adc_process, SIG_ADC_COMPLETE); } #endif /* CONFIG_KERN */ diff --git a/bertos/kern/proc_test.c b/bertos/kern/proc_test.c index b8de22d7..b2319faa 100644 --- a/bertos/kern/proc_test.c +++ b/bertos/kern/proc_test.c @@ -296,7 +296,7 @@ static int preempt_worker_test(void) { \ struct Process *main_proc = (struct Process *) proc_currentUserData(); \ kputs("> Process: " #num "\n"); \ - sig_signal(main_proc, SIG_USER##num); \ + sig_send(main_proc, SIG_USER##num); \ } // Default priority is 0 diff --git a/bertos/kern/signal_test.c b/bertos/kern/signal_test.c index 484c0338..8169f496 100644 --- a/bertos/kern/signal_test.c +++ b/bertos/kern/signal_test.c @@ -76,21 +76,18 @@ 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_signalTest##index(void) \ +static void proc_signalTest##index(void) \ { \ - for(;;) \ - { \ - kputs("> Slave [" #index "]: Wait signal [" #signal "]\n"); \ - sig_wait(signal); \ - kputs("> Slave [" #index "]: send signal [" #signal "]\n"); \ - 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++; \ diff --git a/bertos/mware/event.c b/bertos/mware/event.c index a0419fbf..c596e12f 100644 --- a/bertos/mware/event.c +++ b/bertos/mware/event.c @@ -47,7 +47,7 @@ void event_hook_ignore(UNUSED_ARG(Event *, e)) #if defined(CONFIG_KERN_SIGNALS) && CONFIG_KERN_SIGNALS void event_hook_signal(Event *e) { - sig_signal((e)->Ev.Sig.sig_proc, (e)->Ev.Sig.sig_bit); + sig_post((e)->Ev.Sig.sig_proc, (e)->Ev.Sig.sig_bit); } #endif diff --git a/examples/avr-kern/avr-kern.mk b/examples/avr-kern/avr-kern.mk index f241fd7f..d4e2891c 100644 --- a/examples/avr-kern/avr-kern.mk +++ b/examples/avr-kern/avr-kern.mk @@ -16,6 +16,7 @@ avr-kern_PROGRAMMER_PORT = none avr-kern_USER_CSRC = \ examples/avr-kern/main.c \ bertos/kern/proc_test.c \ + bertos/kern/signal_test.c \ bertos/mware/sprintf.c \ # diff --git a/examples/avr-kern/main.c b/examples/avr-kern/main.c index b1e502c3..ed2113e7 100644 --- a/examples/avr-kern/main.c +++ b/examples/avr-kern/main.c @@ -4,6 +4,7 @@ #include #include #include +#include #include static void init(void) @@ -27,6 +28,7 @@ int main(void) kputs("\n"); proc_testRun(); + signal_testRun(); while (1) cpu_relax(); diff --git a/examples/benchmark/kernel-core_avr/main.c b/examples/benchmark/kernel-core_avr/main.c index 190c3384..052e484d 100644 --- a/examples/benchmark/kernel-core_avr/main.c +++ b/examples/benchmark/kernel-core_avr/main.c @@ -49,7 +49,7 @@ int main(void) while (1) { - sig_signal(p, SIG_USER0); + sig_send(p, SIG_USER0); proc_yield(); } diff --git a/examples/benchmark/kernel-only_arm/main.c b/examples/benchmark/kernel-only_arm/main.c index 1c81b565..2455abf1 100644 --- a/examples/benchmark/kernel-only_arm/main.c +++ b/examples/benchmark/kernel-only_arm/main.c @@ -34,7 +34,7 @@ int main(void) Msg *msg_re = msg_get(&in_port); msg_reply(msg_re); // generate code for signals - sig_signal(p, SIG_USER0); + sig_send(p, SIG_USER0); sig_wait(SIG_USER0); return 0; -- 2.25.1