[core thread]

* added thread_getlastpid
This commit is contained in:
Oliver Hahm 2012-10-18 18:08:40 +02:00
parent a719715214
commit 2109f7dc86
4 changed files with 11 additions and 1 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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 {