1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge branch 'master' of ssh://ukleos.des-mesh.net/home/git/ukleos

This commit is contained in:
Oliver Hahm 2010-11-09 18:49:25 +01:00
commit 37eb17417f
6 changed files with 49 additions and 5 deletions

View File

@ -84,7 +84,18 @@ int thread_create(char *stack, int stacksize, char priority, int flags, void (*f
/* allocate our thread control block at the top of our stackspace */
int total_stacksize = stacksize;
stacksize -= sizeof(tcb);
tcb *cb = (tcb*) (stack + stacksize);
/* align tcb address on 32bit boundary */
unsigned int tcb_address = (unsigned int) stack + stacksize;
if ( tcb_address & 1 ) {
tcb_address--;
stacksize--;
}
if ( tcb_address & 2 ) {
tcb_address-=2;
stacksize-=2;
}
tcb *cb = (tcb*) tcb_address;
if (priority >= SCHED_PRIO_LEVELS) {
return -EINVAL;

View File

@ -60,7 +60,7 @@ and the mailinglist (subscription via web site)
#include "msg.h"
#include "debug.h"
#define PRIORITY_CC1100 PRIORITY_MIN-9
#define PRIORITY_CC1100 PRIORITY_MAIN-1
#define MSG_POLL 12346
@ -97,7 +97,7 @@ static const char *cc1100_event_handler_name = "cc1100_event_handler";
static mutex_t cc1100_mutex;
volatile int cc1100_mutex_pid;
static swtimer_t cc1100_watch_dog;
static uint64_t cc1100_watch_dog_period = 0;
static swtime_t cc1100_watch_dog_period = 0;
static uint16_t cc1100_event_handler_pid;
static void cc1100_event_handler_function(void);

View File

@ -6,6 +6,6 @@
SubDir TOP projects default ;
Module default_project : main.c : shell posix_io uart0 shell_commands ps rtc sht11 ltc4150 auto_init ;
Module default_project : main.c : shell posix_io uart0 shell_commands ps rtc sht11 ltc4150 cc110x auto_init ;
UseModule default_project ;

View File

@ -28,7 +28,7 @@
SubDir TOP sys shell ;
Module shell : shell.c ;
Module shell_commands : shell_commands.c rtc.c sht11.c ltc4150.c : shell ;
Module shell_commands : shell_commands.c rtc.c sht11.c ltc4150.c cc1100.c : shell ;
Module ps : ps.c ;

24
sys/shell/cc1100.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdio.h>
#include <cc1100-interface.h>
void _cc1100_get_address_handler(char *str) {
radio_address_t addr = cc1100_get_address();
printf("cc1100 address: %i\n", addr);
}
void _cc1100_set_address_handler(char *str) {
int addr;
int res = sscanf(str, "cc1100_set_address %i", &addr);
if (res == 1) {
cc1100_set_address((radio_address_t)addr);
printf("Setting cc1100 address to %i: ", addr);
if (cc1100_get_address() == (radio_address_t)addr) {
puts("OK");
} else {
puts("Error!");
}
} else {
puts("usage: cc1100_set_address <address>");
}
}

View File

@ -21,6 +21,11 @@ extern void _get_current_handler(char* unused);
extern void _reset_current_handler(char* unused);
#endif
#ifdef MODULE_CC110X
extern void _cc1100_get_address_handler(char *unused);
extern void _cc1100_set_address_handler(char *ptr);
#endif
const shell_command_t _shell_command_list[] = {
#ifdef MODULE_PS
{"ps", "Prints information about running threads.", _ps_handler},
@ -37,6 +42,10 @@ const shell_command_t _shell_command_list[] = {
#ifdef MODULE_LTC4150
{"cur", "Prints current and average power consumption.", _get_current_handler},
{"rstcur", "Resets coulomb counter.", _reset_current_handler},
#endif
#ifdef MODULE_CC110X
{"cc1100_get_address", "", _cc1100_get_address_handler},
{"cc1100_set_address", "", _cc1100_set_address_handler},
#endif
{NULL, NULL, NULL}
};