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

* changed default project from "hello-world" to "default"

* increased main priority to the half of maximum priority
* introduced define for minimum stack size
* decreased stack size for uart0 thread
* merged commands for rtc shell module to one command (date)
* cleanup of header includes
This commit is contained in:
Oleg 2010-11-05 19:33:45 +01:00
parent c389518a09
commit 416029d2c0
10 changed files with 41 additions and 34 deletions

View File

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

View File

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

View File

@ -17,20 +17,21 @@
#define TCB_H_
#include <stdint.h>
#include "queue.h"
#include "clist.h"
#include <queue.h>
#include <clist.h>
/* 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;

View File

@ -14,11 +14,13 @@
*/
#include <kernel.h>
#include <tcb.h>
/** 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

View File

@ -14,15 +14,14 @@
*/
#include <stdint.h>
#include <malloc.h>
#include "sched.h"
#include "kernel.h"
#include "kernel_intern.h"
#include "clist.h"
#include <sched.h>
#include <kernel.h>
#include <kernel_intern.h>
#include <clist.h>
#include <bitarithm.h>
//#define ENABLE_DEBUG
#include "debug.h"
#include <debug.h>
volatile int num_tasks = 0;

View File

@ -14,7 +14,6 @@
*/
#include <errno.h>
#include <malloc.h>
#include <stdio.h>
#include "thread.h"

View File

@ -2,8 +2,9 @@
#include <stdint.h>
#include <lpc2387-rtc.h>
#include <sys/time.h>
#include <string.h>
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);
}
}

View File

@ -44,7 +44,6 @@ and the mailinglist (subscription via web site)
#include <sys/unistd.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <shell.h>
#include <shell_commands.h>

View File

@ -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},

View File

@ -6,14 +6,15 @@
#include <board_uart0.h>
#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);