From 2109f7dc86b622216d3a8f869c0c5b5094ecb8c7 Mon Sep 17 00:00:00 2001 From: Oliver Hahm Date: Thu, 18 Oct 2012 18:08:40 +0200 Subject: [PATCH] [core thread] * added thread_getlastpid --- board/msba2-common/drivers/msba2-cc110x.c | 2 ++ core/sched.c | 4 ++++ core/thread.c | 5 +++++ drivers/ltc4150.c | 1 - 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/board/msba2-common/drivers/msba2-cc110x.c b/board/msba2-common/drivers/msba2-cc110x.c index 7d5a6b2196..b0a5854446 100644 --- a/board/msba2-common/drivers/msba2-cc110x.c +++ b/board/msba2-common/drivers/msba2-cc110x.c @@ -126,6 +126,8 @@ void cc110x_spi_init(void) while( SPI_RX_AVAIL ) { // while RNE (Receive FIFO Not Empty)... dummy = SSP0DR; // read data } + /* to suppress unused-but-set-variable */ + (void) dummy; } uint8_t cc110x_txrx(uint8_t c) { diff --git a/core/sched.c b/core/sched.c index 51fdaef62e..b1dc4157ba 100644 --- a/core/sched.c +++ b/core/sched.c @@ -31,6 +31,7 @@ volatile tcb_t *sched_threads[MAXTHREADS]; volatile tcb_t *active_thread; volatile int thread_pid; +volatile int last_pid = -1; clist_node_t *runqueues[SCHED_PRIO_LEVELS]; static uint32_t runqueue_bitcache = 0; @@ -112,6 +113,9 @@ void sched_run() { // break; // } // } + if (my_active_thread->pid != last_pid) { + last_pid = my_active_thread->pid; + } } DEBUG("scheduler: next task: %s\n", my_active_thread->name); diff --git a/core/thread.c b/core/thread.c index 1a5bf82f7f..335dcf6659 100644 --- a/core/thread.c +++ b/core/thread.c @@ -30,6 +30,11 @@ inline int thread_getpid() { return active_thread->pid; } +int thread_getlastpid() { + extern int last_pid; + return last_pid; +} + unsigned int thread_getstatus(int pid) { if (sched_threads[pid]==NULL) return STATUS_NOT_FOUND; diff --git a/drivers/ltc4150.c b/drivers/ltc4150.c index b68338149e..9f4134b5c9 100644 --- a/drivers/ltc4150.c +++ b/drivers/ltc4150.c @@ -107,7 +107,6 @@ void ltc4150_stop() { void __attribute__((__no_instrument_function__)) ltc4150_interrupt() { uint32_t now = hwtimer_now(); - printf("last_int_duration %lu\n",last_int_duration); //todo remove printf row if (now >= last_int_time) { last_int_duration = now - last_int_time; } else {