diff --git a/Jamrules b/Jamrules index a2801d2a9..8dbb5f62c 100644 --- a/Jamrules +++ b/Jamrules @@ -33,7 +33,7 @@ include $(TOP)$(SLASH)Jamrules.common ; # # Setup ukleos build system configuration (default values for common options) # -PROJECT = $(PROJECT:E=hello-world) ; +PROJECT = $(PROJECT:E=default) ; BOARD = $(BOARD:E=msba2) ; SUFFIX ?= "" ; # must be at least "" !!! TARGET = "$(BOARD)-$(PROJECT)$(SUFFIX)$(SUFEXE)" ; # main target binary diff --git a/core/include/kernel.h b/core/include/kernel.h index d44f55a03..081ced085 100644 --- a/core/include/kernel.h +++ b/core/include/kernel.h @@ -70,7 +70,7 @@ #define PRIORITY_MIN SCHED_PRIO_LEVELS-1 #define PRIORITY_IDLE PRIORITY_MIN -#define PRIORITY_MAIN PRIORITY_MIN-1 +#define PRIORITY_MAIN (PRIORITY_MIN - (SCHED_PRIO_LEVELS/2)) /** * @brief Check whether called from interrupt service routine diff --git a/core/include/tcb.h b/core/include/tcb.h index 2de982772..95f941253 100644 --- a/core/include/tcb.h +++ b/core/include/tcb.h @@ -17,20 +17,21 @@ #define TCB_H_ #include -#include "queue.h" -#include "clist.h" +#include +#include /* uneven means has to be on runqueue */ -#define STATUS_NOT_FOUND 0 -#define STATUS_ON_RUNQUEUE 1 -#define STATUS_RUNNING 2 + STATUS_ON_RUNQUEUE -#define STATUS_PENDING 4 + STATUS_ON_RUNQUEUE -#define STATUS_STOPPED 8 -#define STATUS_SLEEPING 16 -#define STATUS_MUTEX_BLOCKED 32 -#define STATUS_RECEIVE_BLOCKED 64 -#define STATUS_SEND_BLOCKED 128 -#define STATUS_REPLY_BLOCKED 256 +#define STATUS_NOT_FOUND (0x0000) +#define STATUS_ON_RUNQUEUE (0x0001) +#define STATUS_RUNNING (0x0002) + STATUS_ON_RUNQUEUE +#define STATUS_PENDING (0x0004) + STATUS_ON_RUNQUEUE +#define STATUS_STOPPED (0x0008) +#define STATUS_SLEEPING (0x0010) +#define STATUS_MUTEX_BLOCKED (0x0020) +#define STATUS_RECEIVE_BLOCKED (0x0040) +#define STATUS_SEND_BLOCKED (0x0080) +#define STATUS_REPLY_BLOCKED (0x0100) +#define STATUS_TIMER_WAITING (0x0200) typedef struct tcb { char* sp; diff --git a/core/include/thread.h b/core/include/thread.h index ec8f5636c..359d778d9 100644 --- a/core/include/thread.h +++ b/core/include/thread.h @@ -14,11 +14,13 @@ */ #include +#include +/** Minimum stack size */ +#define MINIMUM_STACK_SIZE (sizeof(tcb)) /** * @brief Creates a new thread. - * This version will allocate it's stack itself using malloc. * * @param stack Lowest address of preallocated stack space * @param stacksize diff --git a/core/sched.c b/core/sched.c index 03e2f4f32..bd8728fbe 100644 --- a/core/sched.c +++ b/core/sched.c @@ -14,15 +14,14 @@ */ #include -#include -#include "sched.h" -#include "kernel.h" -#include "kernel_intern.h" -#include "clist.h" +#include +#include +#include +#include #include //#define ENABLE_DEBUG -#include "debug.h" +#include volatile int num_tasks = 0; diff --git a/core/thread.c b/core/thread.c index 58df5068e..31fcde282 100644 --- a/core/thread.c +++ b/core/thread.c @@ -14,7 +14,6 @@ */ #include -#include #include #include "thread.h" diff --git a/sys/shell/rtc.c b/sys/shell/rtc.c index 86d4add0e..44c58a65a 100644 --- a/sys/shell/rtc.c +++ b/sys/shell/rtc.c @@ -2,8 +2,9 @@ #include #include #include +#include -void _gettime_handler(char *unused) { +void _gettime_handler(void) { struct tm now; rtc_get_localtime(&now); @@ -15,7 +16,7 @@ void _settime_handler(char* c) { int res; uint16_t month, epoch_year; - res = sscanf(c, "settime %hu-%hu-%i %i:%i:%i", + res = sscanf(c, "date %hu-%hu-%i %i:%i:%i", &epoch_year, &month, &(now.tm_mday), @@ -24,11 +25,11 @@ void _settime_handler(char* c) { &(now.tm_sec)); if (res < 6) { - printf("Usage: settime YYYY-MM-DD hh:mm:ss\n"); + printf("Usage: date YYYY-MM-DD hh:mm:ss\n"); return; } else { - printf("OK %s", asctime(&now)); + puts("OK"); } now.tm_year = epoch_year - 1900; @@ -37,4 +38,11 @@ void _settime_handler(char* c) { rtc_set(t); } - +void _date_handler(char* c) { + if (strlen(c) == 4) { + _gettime_handler(); + } + else { + _settime_handler(c); + } +} diff --git a/sys/shell/shell.c b/sys/shell/shell.c index 37d809775..2e17a900b 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -44,7 +44,6 @@ and the mailinglist (subscription via web site) #include #include #include -#include #include #include #include diff --git a/sys/shell/shell_commands.c b/sys/shell/shell_commands.c index f5aa08c65..e337db6f8 100644 --- a/sys/shell/shell_commands.c +++ b/sys/shell/shell_commands.c @@ -6,8 +6,7 @@ extern void _ps_handler(char* unused); #endif #ifdef MODULE_RTC -extern void _gettime_handler(char* unused); -extern void _settime_handler(char* now); +extern void _date_handler(char* now); #endif #ifdef MODULE_SHT11 @@ -21,8 +20,7 @@ const shell_command_t _shell_command_list[] = { {"ps", "Prints information about running threads.", _ps_handler}, #endif #ifdef MODULE_RTC - {"gettime", "Prints current date and time.", _gettime_handler}, - {"settime", "Sets current time.", _settime_handler}, + {"date", "Geets or gets current date and time.", _date_handler}, #endif #ifdef MODULE_SHT11 {"gettemp", "Prints measured temperature.", _get_temperature_handler}, diff --git a/sys/uart0.c b/sys/uart0.c index b4c561822..29ea4efa0 100644 --- a/sys/uart0.c +++ b/sys/uart0.c @@ -6,14 +6,15 @@ #include -#define UART0_BUFSIZE 32 +#define UART0_BUFSIZE (32) +#define UART0_STACKSIZE (MINIMUM_STACK_SIZE + 256) ringbuffer uart0_ringbuffer; int uart0_handler_pid; static char buffer[UART0_BUFSIZE]; -static char uart0_thread_stack[KERNEL_CONF_STACKSIZE_MAIN]; +static char uart0_thread_stack[UART0_STACKSIZE]; static void uart0_loop() { chardev_loop(&uart0_ringbuffer);